This repository has been archived by the owner on Jan 24, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathTremorPlayer.cs
734 lines (686 loc) · 20.1 KB
/
TremorPlayer.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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.DataStructures;
using Terraria.Graphics.Shaders;
using Terraria.ModLoader;
using Terraria.ID;
using Tremor.Items;
using Tremor.NPCs;
namespace Tremor
{
public class TremorPlayer : ModPlayer
{
public bool heartAmulet;
public bool ZoneRuins;
public int healHurt;
public bool dFear;
public bool creeperMinion;
public bool corruptorMinion;
public bool hungryMinion;
public bool meteorMinion;
public bool jellyfishMinion;
public bool cyberMinion;
public bool blueSakuraMinion;
public bool goblinMinion;
public bool shadowMinion;
public bool AnnoyingDog;
public bool vultureMinion;
public bool skeletonMinion;
public bool goldenWhale;
public bool vortexBee;
public bool nebulaJellyfish;
public bool solarMeteor;
public bool stardustSquid;
public bool mudDoll;
public bool Irradiated;
public bool Brutty;
public bool quetzalcoatlMinion;
public bool northWind;
public bool summonerPower;
public bool gurdPet;
public bool ancientVision;
public bool ZoneGranite;
public bool ZoneComet;
public bool whiteSakura;
public bool petZootaloo;
public bool onHitShadaggers = false;
public bool LivingTombstone;
public bool miniCyber;
public bool cluster;
public bool ZoneIce;
public bool ancientPredator;
public bool starfishMinion;
public bool hauntpet;
public bool crabStaff;
public bool zombatMinion;
public bool huskyStaff;
public bool ruinAltar;
public bool emeraldy;
public bool hunterMinion;
public bool birbStaff;
public bool warkee;
public bool shadowArmSF;
public bool zellariumHead;
public bool zellariumBody;
public bool ZoneTowerNova;
public bool NovaMonolith = false;
public int LastChest;
public override void UpdateDead()
{
zellariumBody = false;
zellariumHead = false;
}
public int zellariumHit;
public int zellariumDash;
public int zellariumCooldown;
public override void PreUpdateBuffs()
{
if (Main.netMode != 1)
{
if (player.chest == -1 && LastChest >= 0 && Main.chest[LastChest] != null)
{
int x2 = Main.chest[LastChest].x;
int y2 = Main.chest[LastChest].y;
ChestItemSummonCheck(x2, y2, mod);
}
LastChest = player.chest;
}
}
public override void PostUpdateEquips()
{
if (zellariumHead)
{
if (zellariumDash > 0)
zellariumDash--;
else
zellariumHit = -1;
if (zellariumDash > 0 && zellariumHit < 0)
{
Rectangle rectangle = new Rectangle((int)(player.position.X + player.velocity.X * 0.5 - 4.0), (int)(player.position.Y + player.velocity.Y * 0.5 - 4.0), player.width + 8, player.height + 8);
for (int i = 0; i < 200; i++)
{
if (Main.npc[i].active && !Main.npc[i].dontTakeDamage && !Main.npc[i].friendly)
{
NPC npc = Main.npc[i];
Rectangle rect = npc.getRect();
if (rectangle.Intersects(rect) && (npc.noTileCollide || Collision.CanHit(player.position, player.width, player.height, npc.position, npc.width, npc.height)))
{
float damage = 2f * player.GetModPlayer<MPlayer>(mod).alchemicalDamage;
float knockback = 3f;
bool crit = false;
if (player.kbGlove)
knockback *= 0f;
if (player.kbBuff)
knockback *= 1f;
if (Main.rand.Next(100) < player.meleeCrit)
crit = true;
int hitDirection = player.direction;
if (player.velocity.X < 0f)
{
hitDirection = -1;
}
if (player.velocity.X > 0f)
{
hitDirection = 1;
}
if (player.whoAmI == Main.myPlayer)
{
npc.StrikeNPC((int)damage, knockback, hitDirection, crit, false, false);
if (Main.netMode != 0)
{
}
}
zellariumDash = 10;
player.dashDelay = 0;
player.velocity.X = -(float)hitDirection * 2f;
player.velocity.Y = -2f;
player.immune = true;
player.immuneTime = 7;
zellariumHit = i;
}
}
}
}
if (player.dash <= 0 && player.dashDelay == 0 && !player.mount.Active)
{
int num21 = 0;
bool flag2 = false;
if (player.dashTime > 0)
player.dashTime--;
if (player.dashTime < 0)
player.dashTime++;
if (player.controlRight && player.releaseRight)
{
if (player.dashTime > 0)
{
num21 = 1;
flag2 = true;
player.dashTime = 0;
}
else
{
player.dashTime = 15;
}
}
else if (player.controlLeft && player.releaseLeft)
{
if (player.dashTime < 0)
{
num21 = -1;
flag2 = true;
player.dashTime = 0;
}
else
{
player.dashTime = -15;
}
}
if (flag2)
{
player.velocity.X = 25f * num21;
Point point3 = (player.Center + new Vector2(num21 * player.width / 2 + 2, player.gravDir * -(float)player.height / 2f + player.gravDir * 2f)).ToTileCoordinates();
Point point4 = (player.Center + new Vector2(num21 * player.width / 2 + 2, 0f)).ToTileCoordinates();
if (WorldGen.SolidOrSlopedTile(point3.X, point3.Y) || WorldGen.SolidOrSlopedTile(point4.X, point4.Y))
{
player.velocity.X = player.velocity.X / 2f;
}
player.dashDelay = -1;
zellariumDash = 15;
for (int num22 = 0; num22 < 100; num22++)
{
int num23 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 59, 0f, 0f, 100, default(Color), 2f);
Dust dust3 = Main.dust[num23];
dust3.position.X = dust3.position.X + Main.rand.Next(-5, 6);
Dust dust4 = Main.dust[num23];
dust4.position.Y = dust4.position.Y + Main.rand.Next(-5, 6);
Main.dust[num23].velocity *= 0.2f;
Main.dust[num23].scale *= 1f + Main.rand.Next(20) * 0.01f;
Main.dust[num23].shader = GameShaders.Armor.GetSecondaryShader(player.shield, player);
}
}
}
}
if (zellariumDash > 0)
zellariumDash--;
if (player.dashDelay < 0)
{
for (int l = 0; l < 0; l++)
{
int num14;
if (player.velocity.Y == 0f)
{
num14 = Dust.NewDust(new Vector2(player.position.X, player.position.Y + player.height - 4f), player.width, 8, 59, 0f, 0f, 100, default(Color), 1.4f);
}
else
{
num14 = Dust.NewDust(new Vector2(player.position.X, player.position.Y + (player.height / 2) - 8f), player.width, 16, 59, 0f, 0f, 100, default(Color), 1.4f);
}
Main.dust[num14].velocity *= 0.1f;
Main.dust[num14].scale *= 1f + Main.rand.Next(20) * 0.01f;
Main.dust[num14].shader = GameShaders.Armor.GetSecondaryShader(player.shoe, player);
}
float maxSpeed = Math.Max(player.accRunSpeed, player.maxRunSpeed);
player.vortexStealthActive = false;
if (player.velocity.X > 12f || player.velocity.X < -12f)
{
player.velocity.X = player.velocity.X * 0.985f;
return;
}
if (player.velocity.X > maxSpeed || player.velocity.X < -maxSpeed)
{
player.velocity.X = player.velocity.X * 0.94f;
return;
}
player.dashDelay = 30;
if (player.velocity.X < 0f)
{
player.velocity.X = -maxSpeed;
return;
}
if (player.velocity.X > 0f)
{
player.velocity.X = maxSpeed;
}
}
}
public override bool PreHurt(bool pvp, bool quiet, ref int damage, ref int hitDirection, ref bool crit, ref bool customDamage, ref bool playSound, ref bool genGore, ref PlayerDeathReason damageSource)
{
if (zellariumBody && Main.rand.Next(10) == 0)
{
return false;
}
return base.PreHurt(pvp, quiet, ref damage, ref hitDirection, ref crit, ref customDamage, ref playSound, ref genGore, ref damageSource);
}
public override void ResetEffects()
{
heartAmulet = false;
dFear = false;
healHurt = 0;
creeperMinion = false;
corruptorMinion = false;
hungryMinion = false;
jellyfishMinion = false;
meteorMinion = false;
cyberMinion = false;
blueSakuraMinion = false;
goblinMinion = false;
shadowMinion = false;
AnnoyingDog = false;
vultureMinion = false;
skeletonMinion = false;
goldenWhale = false;
vortexBee = false;
nebulaJellyfish = false;
solarMeteor = false;
stardustSquid = false;
Irradiated = false;
mudDoll = false;
Brutty = false;
quetzalcoatlMinion = false;
northWind = false;
summonerPower = false;
gurdPet = false;
ancientVision = false;
whiteSakura = false;
petZootaloo = false;
LivingTombstone = false;
miniCyber = false;
cluster = false;
ancientPredator = false;
starfishMinion = false;
hauntpet = false;
crabStaff = false;
zombatMinion = false;
huskyStaff = false;
ruinAltar = false;
emeraldy = false;
hunterMinion = false;
birbStaff = false;
warkee = false;
shadowArmSF = false;
}
private float _fadeOpacity;
private float maxDepth;
private float minDepth;
public override void OnRespawn(Player player)
{
if (heartAmulet)
{
player.statLife = (player.statLifeMax2 / 100) * 80;
}
}
private struct LightPillar
{
public Vector2 Position;
public float Depth;
}
private LightPillar[] _pillars;
public static int[] iceWidth = new int[3];
public static int[] iceHeight = new int[3];
public static Texture2D[] backgroundTexture = new Texture2D[3];
public override void UpdateBiomes()
{
ZoneRuins = (TremorWorld.RuinsTiles > 50);
ZoneGranite = (TremorWorld.GraniteTiles > 100);
ZoneIce = (TremorWorld.IceTiles > 100);
ZoneComet = (TremorWorld.CometTiles > 30);
ZoneTowerNova = false;
if (!player.ZoneTowerSolar && !player.ZoneTowerVortex && !player.ZoneTowerNebula && !player.ZoneTowerStardust)
{
for (int i = 0; i < Main.maxNPCs; i++)
{
var npc = Main.npc[i];
if (npc != null && npc.active && npc.type == mod.NPCType("NovaPillar") && player.Distance(npc.Center) <= 4000f)
{
ZoneTowerNova = true;
}
}
}
}
const int XOffset = 400;
const int YOffset = 400;
public override void PostUpdate()
{
bool First = true;
const int XOffset = 400;
const int YOffset = 400;
//CyberWrathInvasion modPlayer = Main.player[Main.myPlayer].GetModPlayer<CyberWrathInvasion>(mod);
if (ZoneIce)
{
player.ZoneSnow = true;
}
if (ZoneComet)
{
if (Main.rand.Next(310) == 0)
{
switch (Main.rand.Next(0, 4))
{
case 0:
NPC.NewNPC((int)player.Center.X + XOffset, (int)player.Center.Y + YOffset, mod.NPCType("CometHead")); break;
case 1:
NPC.NewNPC((int)player.Center.X + XOffset, (int)player.Center.Y - YOffset, mod.NPCType("CometHead")); break;
case 2:
NPC.NewNPC((int)player.Center.X - XOffset, (int)player.Center.Y + YOffset, mod.NPCType("CometHead")); break;
case 3:
NPC.NewNPC((int)player.Center.X - XOffset, (int)player.Center.Y - YOffset, mod.NPCType("CometHead")); break;
}
}
if (Main.rand.Next(700) == 0)
{
switch (Main.rand.Next(0, 4))
{
case 0:
NPC.NewNPC((int)player.Center.X + XOffset, (int)player.Center.Y + YOffset, mod.NPCType("Galasquid")); break;
case 1:
NPC.NewNPC((int)player.Center.X + XOffset, (int)player.Center.Y - YOffset, mod.NPCType("Galasquid")); break;
case 2:
NPC.NewNPC((int)player.Center.X - XOffset, (int)player.Center.Y + YOffset, mod.NPCType("Galasquid")); break;
case 3:
NPC.NewNPC((int)player.Center.X - XOffset, (int)player.Center.Y - YOffset, mod.NPCType("Galasquid")); break;
}
}
if (Main.rand.Next(860) == 0)
{
switch (Main.rand.Next(0, 4))
{
case 0:
NPC.NewNPC((int)player.Center.X + XOffset, (int)player.Center.Y + YOffset, mod.NPCType("Astrofly")); break;
case 1:
NPC.NewNPC((int)player.Center.X + XOffset, (int)player.Center.Y - YOffset, mod.NPCType("Astrofly")); break;
case 2:
NPC.NewNPC((int)player.Center.X - XOffset, (int)player.Center.Y + YOffset, mod.NPCType("Astrofly")); break;
case 3:
NPC.NewNPC((int)player.Center.X - XOffset, (int)player.Center.Y - YOffset, mod.NPCType("Astrofly")); break;
}
}
}
}
public override void SetupStartInventory(IList<Item> items)
{
Item item = new Item();
item.SetDefaults(mod.ItemType("AdventurerSpark"));
item.stack = 1;
items.Add(item);
}
public override bool CustomBiomesMatch(Player other)
{
var modOther = other.GetModPlayer<TremorPlayer>(mod);
return ZoneTowerNova == modOther.ZoneTowerNova;
}
public override void CopyCustomBiomesTo(Player other)
{
var modOther = other.GetModPlayer<TremorPlayer>(mod);
modOther.ZoneTowerNova = ZoneTowerNova;
}
public override void SendCustomBiomes(BinaryWriter writer)
{
byte flags = 0;
if (ZoneGranite)
{
flags |= 1;
}
if (ZoneTowerNova)
{
flags |= 2;
}
writer.Write(flags);
}
public override void ReceiveCustomBiomes(BinaryReader reader)
{
byte flags = reader.ReadByte();
ZoneGranite = ((flags & 1) == 1);
ZoneTowerNova = ((flags & 2) == 2);
}
public void OnHit(float x, float y, Entity victim)
{
if (onHitShadaggers && Main.rand.NextBool(4))
{
player.petalTimer = 20;
if (x < player.position.X + player.width / 2)
{
}
int direction = player.direction;
float num = Main.screenPosition.X;
if (direction < 0)
{
num += Main.screenWidth;
}
float num2 = Main.screenPosition.Y;
num2 += Main.rand.Next(Main.screenHeight);
Vector2 vector = new Vector2(num, num2);
float num3 = x - vector.X;
float num4 = y - vector.Y;
num3 += Main.rand.Next(-50, 51) * 0.1f;
num4 += Main.rand.Next(-50, 51) * 0.1f;
int num5 = 24;
float num6 = (float)Math.Sqrt(num3 * num3 + num4 * num4);
num6 = num5 / num6;
num3 *= num6;
num4 *= num6;
Projectile.NewProjectile(num, num2, num3, num4, mod.ProjectileType("ParaxydeKnifePro"), 46, 0f, player.whoAmI, 0f, 0f);
}
}
public override void UpdateBadLifeRegen()
{
ResetRegen(dFear || healHurt > 0, player);
player.lifeRegen -= dFear
? 10 : healHurt > 0
? 120 * healHurt : 0;
}
private void ResetRegen(bool condition, Player player)
{
if (condition)
{
if (player.lifeRegen > 0)
{
player.lifeRegen = 0;
}
player.lifeRegenTime = 0;
}
}
public override void UpdateBiomeVisuals()
{
TremorPlayer modPlayer = Main.player[Main.myPlayer].GetModPlayer<TremorPlayer>(mod);
bool UseEffects = modPlayer.ZoneIce;
player.ManageSpecialBiomeVisuals("Tremor:Ice", UseEffects);
//player.ManageSpecialBiomeVisuals("Blizzard", UseEffects);
player.ManageSpecialBiomeVisuals("Tremor:CogLord", NPC.AnyNPCs(mod.NPCType("CogLord")));
bool useNova = ZoneTowerNova || NovaMonolith;
player.ManageSpecialBiomeVisuals("Tremor:Nova", useNova);
}
public override void CatchFish(Item fishingRod, Item bait, int power, int liquidType, int poolSize, int worldLayer, int questFish, ref int caughtType, ref bool junk)
{
if (junk)
{
return;
}
string[] questFishes =
{
"CornFish",
"SunflowerFish",
"PumpfishFish",
"ParrotFish",
"CrateFish",
"ForkFish",
"GlassFish",
"JawFish",
"CoalFish",
"CultistFish",
"AlienFish",
"LunarSquid",
};
string qFish = questFishes.FirstOrDefault(fish => mod.ItemType(fish) == questFish);
if (qFish != null
&& Main.rand.NextBool(10))
{
caughtType = mod.ItemType(qFish);
}
else
{
string[] zoneFish =
{
"WoodenPiranha",
"KeyFish"
};
bool[] zoneCond =
{
player.ZoneJungle,
player.ZoneDungeon
};
qFish = zoneFish.FirstOrDefault(fish => mod.ItemType(fish) == questFish);
if (qFish != null
&& zoneCond[zoneFish.ToList().IndexOf(qFish)]
&& Main.rand.NextBool(10))
{
caughtType = mod.ItemType(qFish);
}
else
{
if (Main.hardMode && Main.rand.Next(20) == 0)
{
caughtType = mod.ItemType("GreenPuzzleFragment");
}
}
}
}
// Straight up copy from removed `DesertMimicSummon` class.
public static bool ChestItemSummonCheck(int x, int y, Mod mod)
{
if (Main.netMode == 1) return false;
int num = Chest.FindChest(x, y);
if (num < 0) return false;
int numberDesertKey = 0;
int numberJungleKey = 0;
int numberOceanKey = 0;
int numberOtherItems = 0;
ushort tileType = Main.tile[Main.chest[num].x, Main.chest[num].y].type;
int tileStyle = Main.tile[Main.chest[num].x, Main.chest[num].y].frameX / 36;
if (TileID.Sets.BasicChest[tileType] && (tileStyle < 5 || tileStyle > 6))
{
for (int i = 0; i < 40; i++)
{
if (Main.chest[num].item[i] != null && Main.chest[num].item[i].type > 0)
{
if (Main.chest[num].item[i].type == mod.ItemType<KeyofSands>())
numberDesertKey += Main.chest[num].item[i].stack;
else if (Main.chest[num].item[i].type == mod.ItemType<KeyofTwilight>())
numberJungleKey += Main.chest[num].item[i].stack;
else if (Main.chest[num].item[i].type == mod.ItemType<KeyofOcean>())
numberOceanKey += Main.chest[num].item[i].stack;
else
numberOtherItems++;
}
}
}
if (numberOtherItems == 0 && numberDesertKey == 1)
{
if (TileID.Sets.BasicChest[Main.tile[x, y].type])
{
if (Main.tile[x, y].frameX % 36 != 0)
x--;
if (Main.tile[x, y].frameY % 36 != 0)
y--;
int number = Chest.FindChest(x, y);
for (int j = x; j <= x + 1; j++)
{
for (int k = y; k <= y + 1; k++)
{
if (Main.tile[j, k].type == TileID.Containers)
Main.tile[j, k].active(false);
}
}
for (int l = 0; l < 40; l++)
Main.chest[num].item[l] = new Item();
Chest.DestroyChest(x, y);
NetMessage.SendData(34, -1, -1, null, 1, x, y, 0f, number, 0, 0);
NetMessage.SendTileSquare(-1, x, y, 3);
}
int npcToSpawn = mod.NPCType<DesertMimic>();
int npcIndex = NPC.NewNPC(x * 16 + 16, y * 16 + 32, npcToSpawn, 0, 0f, 0f, 0f, 0f, 255);
Main.npc[npcIndex].whoAmI = npcIndex;
NetMessage.SendData(23, -1, -1, null, npcIndex, 0f, 0f, 0f, 0, 0, 0);
Main.npc[npcIndex].BigMimicSpawnSmoke();
}
else if (numberOtherItems == 0 && numberJungleKey == 1)
{
if (TileID.Sets.BasicChest[Main.tile[x, y].type])
{
if (Main.tile[x, y].frameX % 36 != 0)
{
x--;
}
if (Main.tile[x, y].frameY % 36 != 0)
{
y--;
}
int number = Chest.FindChest(x, y);
for (int j = x; j <= x + 1; j++)
{
for (int k = y; k <= y + 1; k++)
{
if (Main.tile[j, k].type == 21)
{
Main.tile[j, k].active(false);
}
}
}
for (int l = 0; l < 40; l++)
{
Main.chest[num].item[l] = new Item();
}
Chest.DestroyChest(x, y);
NetMessage.SendData(34, -1, -1, null, 1, x, y, 0f, number, 0, 0);
NetMessage.SendTileSquare(-1, x, y, 3);
}
int npcToSpawn = mod.NPCType("JungleMimic");
int npcIndex = NPC.NewNPC(x * 16 + 16, y * 16 + 32, npcToSpawn, 0, 0f, 0f, 0f, 0f, 255);
Main.npc[npcIndex].whoAmI = npcIndex;
NetMessage.SendData(23, -1, -1, null, npcIndex, 0f, 0f, 0f, 0, 0, 0);
Main.npc[npcIndex].BigMimicSpawnSmoke();
}
else if (numberOtherItems == 0 && numberOceanKey == 1)
{
if (TileID.Sets.BasicChest[Main.tile[x, y].type])
{
if (Main.tile[x, y].frameX % 36 != 0)
{
x--;
}
if (Main.tile[x, y].frameY % 36 != 0)
{
y--;
}
int number = Chest.FindChest(x, y);
for (int j = x; j <= x + 1; j++)
{
for (int k = y; k <= y + 1; k++)
{
if (Main.tile[j, k].type == 21)
{
Main.tile[j, k].active(false);
}
}
}
for (int l = 0; l < 40; l++)
{
Main.chest[num].item[l] = new Item();
}
Chest.DestroyChest(x, y);
NetMessage.SendData(34, -1, -1, null, 1, x, y, 0f, number, 0, 0);
NetMessage.SendTileSquare(-1, x, y, 3);
}
int npcToSpawn = mod.NPCType("OceanMimic");
int npcIndex = NPC.NewNPC(x * 16 + 16, y * 16 + 32, npcToSpawn, 0, 0f, 0f, 0f, 0f, 255);
Main.npc[npcIndex].whoAmI = npcIndex;
NetMessage.SendData(23, -1, -1, null, npcIndex, 0f, 0f, 0f, 0, 0, 0);
Main.npc[npcIndex].BigMimicSpawnSmoke();
}
return false;
}
}
}