-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFishingPlayer.cs
204 lines (194 loc) · 6.41 KB
/
FishingPlayer.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace Fishing3
{
public class FishingPlayer : ModPlayer
{
//handle Vanilla fishing (standard tML method)
public override void CatchFish(Item fishingRod, Item bait, int power, int liquidType, int poolSize, int worldLayer, int questFish, ref int caughtType, ref bool junk)
{
var zone = Zone.None;
if(player.ZoneCorrupt)
zone |= Zone.Corrupt;
if(player.ZoneCrimson)
zone |= Zone.Crimson;
if(player.ZoneSnow)
zone |= Zone.Snow;
if(player.ZoneJungle)
zone |= Zone.Jungle;
if(player.ZoneGlowshroom)
zone |= Zone.Shroom;
if(player.ZoneDesert)
zone |= Zone.Desert;
if(player.ZoneHoly)
zone |= Zone.Holy;
if(player.ZoneDungeon)
zone |= Zone.Dungeon;
_CatchFish(false, player.Center, zone, fishingRod, bait, power, liquidType, poolSize, worldLayer, ref caughtType, ref junk);
}
//handle Miscellania Autofisher
public static void AutofisherCatchFish(Vector2 position, int zoneInfo, Item fishingRod, Item bait, int power, int liquidType, int poolSize, int worldLayer, ref int caughtType, ref bool junk)
{
_CatchFish(true, position, (Zone)zoneInfo, fishingRod, bait, power, liquidType, poolSize, worldLayer, ref caughtType, ref junk);
}
//actual fishing logic
static void _CatchFish(bool automatic, Vector2 position, Zone zone, Item fishingRod, Item bait, int power, int liquidType, int poolSize, int worldLayer, ref int caughtType, ref bool junk)
{
//Main.NewText("you called? automatic: " + automatic);
//Main.NewText("zone: " + zone);
//Main.NewText("bait item: " + bait);
//Main.NewText("liquidType: " + liquidType);
//Main.NewText("worldLayer: " + worldLayer);
//Main.NewText("fishing power: " + power);
var mod = Fishing3.Instance;
int rarityMultiplier = automatic ? 3 : 1;
if(bait.type == Fishing3.Instance.ItemType("SoulBait") && liquidType == 0)
{
if(Main.rand.Next(0, 10 * rarityMultiplier) == 0 && zone.HasFlag(Zone.Dungeon))
{
caughtType = mod.ItemType("PossessedCrate");
}
if(Main.rand.Next(0, 10 * rarityMultiplier) == 0 && zone.HasFlag(Zone.Jungle))
{
caughtType = mod.ItemType("PJungleCrate");
}
if(Main.rand.Next(0, 10 * rarityMultiplier) == 0 && zone.HasFlag(Zone.Crimson))
{
caughtType = mod.ItemType("PCrimsonCrate");
}
if(Main.rand.Next(0, 10 * rarityMultiplier) == 0 && zone.HasFlag(Zone.Corrupt))
{
caughtType = mod.ItemType("PCorruptCrate");
}
if(Main.rand.Next(0, 10 * rarityMultiplier) == 0 && zone.HasFlag(Zone.Holy))
{
caughtType = mod.ItemType("PHallowCrate");
}
}
if(Main.rand.Next(0, 12 * rarityMultiplier) == 0 && zone.HasFlag(Zone.Desert) && liquidType == 0)
{
caughtType = mod.ItemType("DesertCrate");
}
var coords = position.ToTileCoordinates16();
bool ocean = (worldLayer == 1) && (coords.X < 380 || coords.X > Main.maxTilesX - 380);
if(Main.rand.Next(0, 12 * rarityMultiplier) == 0 && zone == Zone.None && !ocean && liquidType == 0 && worldLayer == 1)
{
caughtType = mod.ItemType("ForestCrate");
}
if(Main.rand.Next(0, 12 * rarityMultiplier) == 0 && zone == Zone.None && worldLayer == 3 && liquidType == 0)
{
caughtType = mod.ItemType("CaveCrate");
}
if(Main.rand.Next(0, 12 * rarityMultiplier) == 0 && ocean && liquidType == 0)
{
caughtType = mod.ItemType("OceanCrate");
}
if(Main.rand.Next(0, 12 * rarityMultiplier) == 0 && zone.HasFlag(Zone.Snow) && liquidType == 0)
{
caughtType = mod.ItemType("IceCrate");
}
if(liquidType == 1 && Main.rand.Next(0, 12 * rarityMultiplier) == 0 && worldLayer == 4)
{
caughtType = mod.ItemType("ObsidianCrate");
}
if(fishingRod.type == mod.ItemType("Fishingtron") && liquidType == 0 && worldLayer == 1)
{
if(Main.rand.Next(0, 7 * rarityMultiplier) == 0)
{
caughtType = mod.ItemType("Scrap");
}
if(Main.rand.Next(0, 41 * rarityMultiplier) == 0)
{
caughtType = (new int[]
{
mod.ItemType("DarkMatterEngine"),
mod.ItemType("Shield"),
mod.ItemType("CloseCS"),
mod.ItemType("Missiles"),
mod.ItemType("MagiCore")
})[Main.rand.Next(5)];
}
}
if(Main.hardMode)
{
if(Main.bloodMoon && Main.rand.Next(0, 15 * rarityMultiplier) == 0)
{
caughtType = (int)(new short[]
{
1324, //bananarang
900, //Moon Stone
1327 // Death Sickle
})[Main.rand.Next(3)];
}
if(Main.eclipse && NPC.downedGolemBoss && Main.rand.Next(0, 15 * rarityMultiplier) == 0)
{
caughtType = (int)(new short[]
{
3107, //nail gun
3249, // Deadly Sphere Staff
3292 // The Eye of Cthulhu yoyo
})[Main.rand.Next(3)];
}
}
}
public override void AnglerQuestReward(float quality, List<Item> rewardItems)
{
if (base.player.anglerQuestsFinished == 7)
{
base.player.QuickSpawnItem(2374, 1);
}
if (base.player.anglerQuestsFinished == 12)
{
base.player.QuickSpawnItem(2375, 1);
}
if (base.player.anglerQuestsFinished == 18)
{
base.player.QuickSpawnItem(2373, 1);
}
if (base.player.anglerQuestsFinished == 21)
{
base.player.QuickSpawnItem(3183, 1); //golden bug net
}
if (base.player.anglerQuestsFinished == 23)
{
base.player.QuickSpawnItem(2360, 1);
}
if (base.player.anglerQuestsFinished == 25)
{
base.player.QuickSpawnItem(2422, 1);
}
if (base.player.anglerQuestsFinished == 27)
{
base.player.QuickSpawnItem(3036, 1);
}
if (base.player.anglerQuestsFinished == 35)
{
base.player.QuickSpawnItem(3031, 1);
}
if (base.player.anglerQuestsFinished == 40)
{
base.player.QuickSpawnItem(3032, 1);
}
if (base.player.anglerQuestsFinished == 45 && Main.hardMode)
{
base.player.QuickSpawnItem(2494, 1);
}
if (base.player.anglerQuestsFinished == 100 && Main.hardMode)
{
base.player.QuickSpawnItem(base.mod.ItemType("RewardONE"), 1);
}
if (base.player.anglerQuestsFinished == 120 && Main.hardMode)
{
base.player.QuickSpawnItem(1613, 1);
}
if (base.player.anglerQuestsFinished == 200 && Main.hardMode)
{
base.player.QuickSpawnItem(base.mod.ItemType("RewardPot"), 1);
}
}
}
}