From cc4ea6018ae85264039341120feb473a12043309 Mon Sep 17 00:00:00 2001 From: DartPower Date: Sat, 12 Oct 2013 00:55:32 +0400 Subject: [PATCH] 1.0.4.1 --- AssemblyInfo.cs | 16 + Microsoft/Xna/Framework.RuntimeProfile | 1 + Microsoft/Xna/Framework.XlastConfiguration | Bin 0 -> 2041 bytes NetMessageId.cs | 32 + NetMode.cs | 11 + SendDataId.cs | 25 + StorageDeviceManager.cs | 123 + Terraria.csproj | 160 + Terraria.sln | 20 + Terraria/Achievements/Achievement.cs | 57 + Terraria/Achievements/AchievementSystem.cs | 114 + .../EarnedAchievementsCallback.cs | 11 + Terraria/Achievements/Trigger.cs | 42 + Terraria/Achievements/TriggerSystem.cs | 107 + Terraria/ActivatableSlider.cs | 56 + Terraria/AnimationUtils.cs | 100 + Terraria/BoxGraphic.cs | 63 + Terraria/Buff.cs | 145 + Terraria/CRC32.cs | 85 + Terraria/ChatLine.cs | 23 + Terraria/Chest.cs | 591 + Terraria/Cloud.cs | 164 + Terraria/Collision.cs | 770 + Terraria/CombatText.cs | 122 + Terraria/CompiledText.cs | 476 + Terraria/ControlDesc.cs | 23 + Terraria/CreateCharacter/Assets.cs | 74 + Terraria/CreateCharacter/AttributeWidget`1.cs | 78 + Terraria/CreateCharacter/CategoryIcon.cs | 22 + Terraria/CreateCharacter/CategorySelector.cs | 147 + .../CreateCharacter/ColorAttributeWidget.cs | 34 + Terraria/CreateCharacter/ColorSelector.cs | 171 + Terraria/CreateCharacter/Difficulty.cs | 15 + .../DifficultyAttributeWidget.cs | 39 + .../CreateCharacter/DifficultySelector.cs | 180 + .../CreateCharacter/GenderAttributeWidget.cs | 44 + .../CreateCharacter/HairAttributeWidget.cs | 33 + Terraria/CreateCharacter/HairSelector.cs | 155 + .../CreateCharacter/HorizontalListSelector.cs | 136 + Terraria/CreateCharacter/IAttributeWidget.cs | 41 + Terraria/CreateCharacter/ISelector.cs | 35 + Terraria/CreateCharacter/PlayerModifier.cs | 63 + Terraria/CreateCharacter/RandomCharacter.cs | 103 + Terraria/CreateCharacter/UI.cs | 238 + Terraria/CreateCharacter/WidgetAnimation.cs | 62 + Terraria/Credits.cs | 47 + Terraria/Dust.cs | 73 + Terraria/DustPool.cs | 701 + Terraria/FastRandom.cs | 196 + Terraria/GameMode.cs | 154 + Terraria/Gore.cs | 214 + Terraria/HowToPlay/Assets.cs | 32 + Terraria/HowToPlay/HowToPlayLayout.cs | 123 + Terraria/HowToPlay/TextBlock.cs | 74 + Terraria/HowToPlay/UI.cs | 340 + Terraria/Item.cs | 9817 ++++++++ Terraria/ItemText.cs | 102 + Terraria/ItemTextPool.cs | 121 + Terraria/JoinableSession.cs | 24 + Terraria/Lang.cs | 18248 +++++++++++++++ Terraria/Leaderboards/Assets.cs | 27 + Terraria/Leaderboards/Column.cs | 44 + Terraria/Leaderboards/Leaderboard.cs | 17 + Terraria/Leaderboards/LeaderboardData.cs | 399 + Terraria/Leaderboards/LeaderboardInfo.cs | 172 + Terraria/Leaderboards/LeaderboardsUI.cs | 254 + Terraria/Leaderboards/MockReader.cs | 92 + Terraria/Lighting.cs | 1413 ++ Terraria/Liquid.cs | 813 + Terraria/LiquidBuffer.cs | 25 + Terraria/Location.cs | 19 + Terraria/Main.cs | 3093 +++ Terraria/Mech.cs | 14 + Terraria/MenuMode.cs | 50 + Terraria/MenuType.cs | 14 + Terraria/MessageBox.cs | 139 + Terraria/MiniMap.cs | 595 + Terraria/NPC.cs | 18664 +++++++++++++++ Terraria/NetClient.cs | 176 + Terraria/NetMessage.cs | 2596 +++ Terraria/NetPlayer.cs | 32 + Terraria/Netplay.cs | 590 + Terraria/Pet.cs | 19 + Terraria/Player.cs | 8873 +++++++ Terraria/Program.cs | 44 + Terraria/Projectile.cs | 5988 +++++ Terraria/Recipe.cs | 3179 +++ Terraria/SfxInstancePool.cs | 75 + Terraria/Sign.cs | 138 + Terraria/Size.cs | 13 + Terraria/Slider.cs | 59 + Terraria/SoundUI/Assets.cs | 35 + Terraria/SoundUI/UI.cs | 146 + Terraria/SpriteSheet`1.cs | 257 + Terraria/Star.cs | 98 + Terraria/StatisticEntry.cs | 63 + Terraria/Statistics.cs | 262 + Terraria/TextSequenceBlock.cs | 501 + Terraria/Tile.cs | 140 + Terraria/Time.cs | 319 + Terraria/Tutorial.cs | 94 + Terraria/UI.cs | 8635 +++++++ Terraria/UserString.cs | 99 + Terraria/Vector2i.cs | 19 + Terraria/WorldGen.cs | 19348 ++++++++++++++++ Terraria/WorldSelect.cs | 368 + Terraria/WorldView.cs | 4789 ++++ ToStringExtensions.cs | 562 + _sheetSprites.cs | 3006 +++ _sheetTiles.cs | 466 + 110 files changed, 122106 insertions(+) create mode 100644 AssemblyInfo.cs create mode 100644 Microsoft/Xna/Framework.RuntimeProfile create mode 100644 Microsoft/Xna/Framework.XlastConfiguration create mode 100644 NetMessageId.cs create mode 100644 NetMode.cs create mode 100644 SendDataId.cs create mode 100644 StorageDeviceManager.cs create mode 100644 Terraria.csproj create mode 100644 Terraria.sln create mode 100644 Terraria/Achievements/Achievement.cs create mode 100644 Terraria/Achievements/AchievementSystem.cs create mode 100644 Terraria/Achievements/EarnedAchievementsCallback.cs create mode 100644 Terraria/Achievements/Trigger.cs create mode 100644 Terraria/Achievements/TriggerSystem.cs create mode 100644 Terraria/ActivatableSlider.cs create mode 100644 Terraria/AnimationUtils.cs create mode 100644 Terraria/BoxGraphic.cs create mode 100644 Terraria/Buff.cs create mode 100644 Terraria/CRC32.cs create mode 100644 Terraria/ChatLine.cs create mode 100644 Terraria/Chest.cs create mode 100644 Terraria/Cloud.cs create mode 100644 Terraria/Collision.cs create mode 100644 Terraria/CombatText.cs create mode 100644 Terraria/CompiledText.cs create mode 100644 Terraria/ControlDesc.cs create mode 100644 Terraria/CreateCharacter/Assets.cs create mode 100644 Terraria/CreateCharacter/AttributeWidget`1.cs create mode 100644 Terraria/CreateCharacter/CategoryIcon.cs create mode 100644 Terraria/CreateCharacter/CategorySelector.cs create mode 100644 Terraria/CreateCharacter/ColorAttributeWidget.cs create mode 100644 Terraria/CreateCharacter/ColorSelector.cs create mode 100644 Terraria/CreateCharacter/Difficulty.cs create mode 100644 Terraria/CreateCharacter/DifficultyAttributeWidget.cs create mode 100644 Terraria/CreateCharacter/DifficultySelector.cs create mode 100644 Terraria/CreateCharacter/GenderAttributeWidget.cs create mode 100644 Terraria/CreateCharacter/HairAttributeWidget.cs create mode 100644 Terraria/CreateCharacter/HairSelector.cs create mode 100644 Terraria/CreateCharacter/HorizontalListSelector.cs create mode 100644 Terraria/CreateCharacter/IAttributeWidget.cs create mode 100644 Terraria/CreateCharacter/ISelector.cs create mode 100644 Terraria/CreateCharacter/PlayerModifier.cs create mode 100644 Terraria/CreateCharacter/RandomCharacter.cs create mode 100644 Terraria/CreateCharacter/UI.cs create mode 100644 Terraria/CreateCharacter/WidgetAnimation.cs create mode 100644 Terraria/Credits.cs create mode 100644 Terraria/Dust.cs create mode 100644 Terraria/DustPool.cs create mode 100644 Terraria/FastRandom.cs create mode 100644 Terraria/GameMode.cs create mode 100644 Terraria/Gore.cs create mode 100644 Terraria/HowToPlay/Assets.cs create mode 100644 Terraria/HowToPlay/HowToPlayLayout.cs create mode 100644 Terraria/HowToPlay/TextBlock.cs create mode 100644 Terraria/HowToPlay/UI.cs create mode 100644 Terraria/Item.cs create mode 100644 Terraria/ItemText.cs create mode 100644 Terraria/ItemTextPool.cs create mode 100644 Terraria/JoinableSession.cs create mode 100644 Terraria/Lang.cs create mode 100644 Terraria/Leaderboards/Assets.cs create mode 100644 Terraria/Leaderboards/Column.cs create mode 100644 Terraria/Leaderboards/Leaderboard.cs create mode 100644 Terraria/Leaderboards/LeaderboardData.cs create mode 100644 Terraria/Leaderboards/LeaderboardInfo.cs create mode 100644 Terraria/Leaderboards/LeaderboardsUI.cs create mode 100644 Terraria/Leaderboards/MockReader.cs create mode 100644 Terraria/Lighting.cs create mode 100644 Terraria/Liquid.cs create mode 100644 Terraria/LiquidBuffer.cs create mode 100644 Terraria/Location.cs create mode 100644 Terraria/Main.cs create mode 100644 Terraria/Mech.cs create mode 100644 Terraria/MenuMode.cs create mode 100644 Terraria/MenuType.cs create mode 100644 Terraria/MessageBox.cs create mode 100644 Terraria/MiniMap.cs create mode 100644 Terraria/NPC.cs create mode 100644 Terraria/NetClient.cs create mode 100644 Terraria/NetMessage.cs create mode 100644 Terraria/NetPlayer.cs create mode 100644 Terraria/Netplay.cs create mode 100644 Terraria/Pet.cs create mode 100644 Terraria/Player.cs create mode 100644 Terraria/Program.cs create mode 100644 Terraria/Projectile.cs create mode 100644 Terraria/Recipe.cs create mode 100644 Terraria/SfxInstancePool.cs create mode 100644 Terraria/Sign.cs create mode 100644 Terraria/Size.cs create mode 100644 Terraria/Slider.cs create mode 100644 Terraria/SoundUI/Assets.cs create mode 100644 Terraria/SoundUI/UI.cs create mode 100644 Terraria/SpriteSheet`1.cs create mode 100644 Terraria/Star.cs create mode 100644 Terraria/StatisticEntry.cs create mode 100644 Terraria/Statistics.cs create mode 100644 Terraria/TextSequenceBlock.cs create mode 100644 Terraria/Tile.cs create mode 100644 Terraria/Time.cs create mode 100644 Terraria/Tutorial.cs create mode 100644 Terraria/UI.cs create mode 100644 Terraria/UserString.cs create mode 100644 Terraria/Vector2i.cs create mode 100644 Terraria/WorldGen.cs create mode 100644 Terraria/WorldSelect.cs create mode 100644 Terraria/WorldView.cs create mode 100644 ToStringExtensions.cs create mode 100644 _sheetSprites.cs create mode 100644 _sheetTiles.cs diff --git a/AssemblyInfo.cs b/AssemblyInfo.cs new file mode 100644 index 0000000..86d5090 --- /dev/null +++ b/AssemblyInfo.cs @@ -0,0 +1,16 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Security.Permissions; + +[assembly: Extension] +[assembly: AssemblyProduct("TerrariaXDK")] +[assembly: AssemblyCompany("Engine Software")] +[assembly: AssemblyCopyright("Copyright © Engine Software 2012")] +[assembly: AssemblyTitle("TerrariaXDK")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyTrademark("")] +[assembly: ComVisible(false)] +[assembly: Guid("a1bb9f25-54df-4f2e-a41f-8360dde42e71")] +[assembly: AssemblyVersion("1.0.4.1")] +[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] diff --git a/Microsoft/Xna/Framework.RuntimeProfile b/Microsoft/Xna/Framework.RuntimeProfile new file mode 100644 index 0000000..e593f8b --- /dev/null +++ b/Microsoft/Xna/Framework.RuntimeProfile @@ -0,0 +1 @@ +XDK_v4.0.HiDef diff --git a/Microsoft/Xna/Framework.XlastConfiguration b/Microsoft/Xna/Framework.XlastConfiguration new file mode 100644 index 0000000000000000000000000000000000000000..a5f003317169e2ebbb3c45fe13c032486b6809a3 GIT binary patch literal 2041 zcmYjQX>;O65G9FYgF*O8c5}y@`%X6Zu{i_?P%I%z5~23fmKFx2T4{zF348tT^Lo;f zL)G)^QO~@Y?tcEe)oS%)p>?9O#Cg6Gx;m+sQMF$SSy@w6i0DR$ih}MqDYE=_mTl9j zGf|n`j?|6pInOJhi%ce!(!DEu4K`7p6{5WGlzN8sSm|M!Rn;GfjYx1)oC;q(ZAW{3on0$!4a7~Ng}X`bpPJVn??i?Uv59(6?2J+K%i@S19&)kSD8WWsz0sQB;^CouNX_ zD|Dsp$ZaNt&=<>8Nb>|G|Et51`hWpb7MrhwXR|nJmeV zg3Ts})L|fr4tyc^?GbvD$dx#@-SEjU@D~2enuNh(HsV!pX~#~T>U#D+HYX1KOrnV6 zAawXkcjEX_eJl!GuU>SQK~U?p&0}%!bi4>>ZoFuY_u?REj`Wv~Jr8EJLeCEUpnk>q z5Q&9v4?L&NcYQY+^3?~6Qmp&)Aa?K0Tb?_a#?5Zq_k-r4jx%Z!SI*-)wq{CWhL=xO zS&H)P%AHM~M4s!{)%J(+bm2`GwT|<@KAlEaj_1T-Fym}@X?tEBPZPan*oID$9RvOfxg<;jcBQ{Qe47NL8W!|HD5CH|A& zZM9B8EyRW&Fu%wA4)goWA25H&{1NlV%%3oS%KRDg=geO)f64q6^ViJZFh6Aemias8 z@0ovK{*n17=AW5=Vg8l*H|9sozcZsg^LrJ4UjXg_FEU;N6AlBQT-O=zs~w zj4qhaV_0B9pK$^vP~!<_jB_yIg7FHNKySPc&>LUl_;rro08{)XK=E4~zs)h#NipW# z{HWf#eyWjjRPQA~xd#CC0$yl-R4=?>zT=Kd(;S$>9H3n=hDnkD%wYsc1O_pC=>nL< zd~XEc79&8ffMbjRbsDZQ8>!=PjuD_2z&$250+fV}i~x-SRx$!K3fRdA&`4k@bBIO) zTbWVPXkaZfQW_2HWxg9>dI5Z9glT5*nh~a%!EZ*G<_6ChVVWO&X9Q?|@SYKF#9%@r zMuU9>P+w@UFryKp0sjF|8)(RX0`v$P`d DeviceSelectorCanceled; + + public event EventHandler DeviceDisconnected; + + public StorageDeviceManager(Game game) + : this(game, new PlayerIndex?(), 0) + { + } + + public StorageDeviceManager(Game game, PlayerIndex player) + : this(game, player, 0) + { + } + + public StorageDeviceManager(Game game, int requiredBytes) + : this(game, new PlayerIndex?(), requiredBytes) + { + } + + public StorageDeviceManager(Game game, PlayerIndex player, int requiredBytes) + : this(game, new PlayerIndex?(player), requiredBytes) + { + } + + private StorageDeviceManager(Game game, PlayerIndex? player, int requiredBytes) + : base(game) + { + this.Player = player; + this.RequiredBytes = requiredBytes; + this.PlayerToPrompt = PlayerIndex.One; + } + + public void PromptForDevice() + { + if (!this.isDone) + return; + this.isDone = false; + this.showDeviceSelector = true; + } + + public override void Update(GameTime gameTime) + { + bool flag = false; + if (this.Device != null) + { + flag = this.Device.IsConnected; + if (!flag) + { + if (this.wasDeviceConnected) + this.FireDeviceDisconnectedEvent(); + } + } + try + { + if (!Guide.IsVisible) + { + if (this.showDeviceSelector) + { + this.showDeviceSelector = false; + if (this.Player.HasValue) + StorageDevice.BeginShowSelector(this.Player.Value, this.RequiredBytes, 0, new AsyncCallback(this.deviceSelectorCallback), (object) null); + else + StorageDevice.BeginShowSelector(this.RequiredBytes, 0, new AsyncCallback(this.deviceSelectorCallback), (object) null); + } + } + } + catch (GamerServicesNotAvailableException ex) + { + } + catch (GuideAlreadyVisibleException ex) + { + } + this.wasDeviceConnected = flag; + } + + private void deviceSelectorCallback(IAsyncResult ar) + { + this.Device = StorageDevice.EndShowSelector(ar); + if (this.Device != null) + { + if (this.DeviceSelected != null) + this.DeviceSelected((object) this, (EventArgs) null); + this.wasDeviceConnected = true; + } + else + { + if (this.DeviceSelectorCanceled != null) + this.DeviceSelectorCanceled((object) this, (EventArgs) null); + this.showDeviceSelector = false; + } + this.isDone = true; + } + + private void FireDeviceDisconnectedEvent() + { + this.Device = (StorageDevice) null; + if (this.DeviceDisconnected != null) + this.DeviceDisconnected((object) this, (EventArgs) null); + this.showDeviceSelector = false; + } +} diff --git a/Terraria.csproj b/Terraria.csproj new file mode 100644 index 0000000..9ca32b3 --- /dev/null +++ b/Terraria.csproj @@ -0,0 +1,160 @@ + + + + + Debug + AnyCPU + {3BBD0376-9DF9-4346-A5AA-54019DC1CA46} + Exe + game + v4.0 + + 1.0.4.1 + 512 + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + true + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Terraria.sln b/Terraria.sln new file mode 100644 index 0000000..a1f9e95 --- /dev/null +++ b/Terraria.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "game", "Terraria.csproj", "{3BBD0376-9DF9-4346-A5AA-54019DC1CA46}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {3BBD0376-9DF9-4346-A5AA-54019DC1CA46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3BBD0376-9DF9-4346-A5AA-54019DC1CA46}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3BBD0376-9DF9-4346-A5AA-54019DC1CA46}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3BBD0376-9DF9-4346-A5AA-54019DC1CA46}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Terraria/Achievements/Achievement.cs b/Terraria/Achievements/Achievement.cs new file mode 100644 index 0000000..1c0cf63 --- /dev/null +++ b/Terraria/Achievements/Achievement.cs @@ -0,0 +1,57 @@ +// Type: Terraria.Achievements.Achievement +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +namespace Terraria.Achievements +{ + public enum Achievement + { + TerrariaExpert = 0, + TerrariaStudent = 1, + HomeSweetHome = 2, + FamilyNight = 3, + GoingDown = 4, + Exterminator = 5, + KingOfSlimes = 6, + LookingForChallenge = 7, + AllPumpedUp = 8, + CorruptedSoul = 9, + HallowedBeThyName = 10, + Ophthalmologist = 11, + Anthropologist = 12, + Biologist = 13, + MarathonRunner = 14, + LandscapeArchitect = 15, + DefeatedTheMob = 16, + Survivor = 17, + BewareIcharus = 18, + FashionModel = 19, + AnimalShelter = 20, + PreparationIsEverything = 21, + Airtime = 22, + Blacksmith = 23, + Smelter = 24, + Collector = 25, + Engineer = 26, + WhenTheMoonTurnsRed = 27, + ExpertCrafter = 28, + HellAndBack = 29, + BackForSeconds = 30, + CouldThisBeHeaven = 31, + LeapTallBuildingInSingleBound = 32, + SafeFall = 33, + Hellevator = 34, + GoneIn60Seconds = 35, + OldFashioned = 36, + Homicidal = 37, + Completionist = 38, + AchievementCount = 39, + MINIMUM_AIR_TIME = 60, + LOTS_OF_WIRES = 100, + LOTS_OF_ANVILS = 300, + LOTS_OF_BARS = 10000, + LOTS_OF_TILES = 10000, + LOTS_OF_AIR_TIME = 216000, + } +} diff --git a/Terraria/Achievements/AchievementSystem.cs b/Terraria/Achievements/AchievementSystem.cs new file mode 100644 index 0000000..3d7dc7a --- /dev/null +++ b/Terraria/Achievements/AchievementSystem.cs @@ -0,0 +1,114 @@ +// Type: Terraria.Achievements.AchievementSystem +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework.GamerServices; +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Terraria.Achievements +{ + public class AchievementSystem + { + private const int MaxConcurrentSubmissions = 10; + private const int MaxAchievementCount = 30; + private IAsyncResult[] submissions; + private int firstFree; + + public AchievementSystem() + { + this.submissions = new IAsyncResult[10]; + this.firstFree = 0; + } + + ~AchievementSystem() + { + } + + private static void ProcessEarnedAchievements(IAsyncResult result) + { + AchievementSystem.EarnedAchievementsData achievementsData = (AchievementSystem.EarnedAchievementsData) result.AsyncState; + BitArray earned = new BitArray(39); + try + { + AchievementCollection achievements = achievementsData.Gamer.EndGetAchievements(result); + Type enumType = typeof (Achievement); + using (IEnumerator enumerator = achievements.GetEnumerator()) + { + while (enumerator.MoveNext()) + { + Microsoft.Xna.Framework.GamerServices.Achievement current = enumerator.Current; + int index; + try + { + index = (int) Enum.Parse(enumType, current.Key, false); + } + catch (ArgumentException ex) + { + continue; + } + earned.Set(index, current.IsEarned); + } + } + } + catch + { + } + achievementsData.Callback(earned); + } + + public void GetEarnedAchievements(SignedInGamer gamer, EarnedAchievementsCallback callback) + { + AchievementSystem.EarnedAchievementsData achievementsData = new AchievementSystem.EarnedAchievementsData() + { + Callback = callback, + Gamer = gamer + }; + gamer.BeginGetAchievements(new AsyncCallback(AchievementSystem.ProcessEarnedAchievements), (object) achievementsData); + } + + public void Award(SignedInGamer gamer, Achievement achievement) + { + string str = ((object) achievement).ToString(); + if (achievement >= Achievement.BackForSeconds) + return; + IAsyncResult asyncResult; + try + { + asyncResult = gamer.BeginAwardAchievement(str, (AsyncCallback) null, (object) null); + } + catch (ArgumentException ex) + { + return; + } + this.submissions[this.firstFree] = asyncResult; + ++this.firstFree; + } + + public void Update() + { + int index = 0; + while (index < this.firstFree) + { + if (!this.submissions[index].IsCompleted) + { + ++index; + } + else + { + --this.firstFree; + this.submissions[index] = this.submissions[this.firstFree]; + this.submissions[this.firstFree] = (IAsyncResult) null; + } + } + } + + private class EarnedAchievementsData + { + public EarnedAchievementsCallback Callback; + public SignedInGamer Gamer; + } + } +} diff --git a/Terraria/Achievements/EarnedAchievementsCallback.cs b/Terraria/Achievements/EarnedAchievementsCallback.cs new file mode 100644 index 0000000..2d6ce6c --- /dev/null +++ b/Terraria/Achievements/EarnedAchievementsCallback.cs @@ -0,0 +1,11 @@ +// Type: Terraria.Achievements.EarnedAchievementsCallback +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using System.Collections; + +namespace Terraria.Achievements +{ + public delegate void EarnedAchievementsCallback(BitArray earned); +} diff --git a/Terraria/Achievements/Trigger.cs b/Terraria/Achievements/Trigger.cs new file mode 100644 index 0000000..54335c7 --- /dev/null +++ b/Terraria/Achievements/Trigger.cs @@ -0,0 +1,42 @@ +// Type: Terraria.Achievements.Trigger +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +namespace Terraria.Achievements +{ + public enum Trigger + { + HighestPosition, + HouseGuide, + HousedAllNPCs, + LowestPosition, + AllSlimesKilled, + AllBossesKilled, + UnlockedHardMode, + MaxHealthAndMana, + CorruptedWorld, + HallowedWorld, + FirstTutorialTaskCompleted, + AllTutorialTasksCompleted, + KilledTheTwins, + KilledSkeletronPrime, + KilledDestroyer, + Walked42KM, + RemovedLotsOfTiles, + KilledGoblinArmy, + Sunrise, + SunriseAfterBloodMoon, + AllVanitySlotsEquipped, + CreatedLotsOfBars, + Has5Buffs, + SpawnedAllPets, + CollectedAllArmor, + UsedLotsOfAnvils, + UsedAllCraftingStations, + PlacedLotsOfWires, + WentDownAndUpWithoutDyingOrWarping, + InTheSky, + NumTriggers, + } +} diff --git a/Terraria/Achievements/TriggerSystem.cs b/Terraria/Achievements/TriggerSystem.cs new file mode 100644 index 0000000..1ff6b59 --- /dev/null +++ b/Terraria/Achievements/TriggerSystem.cs @@ -0,0 +1,107 @@ +// Type: Terraria.Achievements.TriggerSystem +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework.GamerServices; +using System.Collections; +using Terraria; + +namespace Terraria.Achievements +{ + public class TriggerSystem + { + private TriggerSystem.TriggerLink[] Links = new TriggerSystem.TriggerLink[30] + { + TriggerSystem.Link(Trigger.HighestPosition, Achievement.BewareIcharus), + TriggerSystem.Link(Trigger.HouseGuide, Achievement.HomeSweetHome), + TriggerSystem.Link(Trigger.HousedAllNPCs, Achievement.FamilyNight), + TriggerSystem.Link(Trigger.LowestPosition, Achievement.GoingDown), + TriggerSystem.Link(Trigger.AllSlimesKilled, Achievement.KingOfSlimes), + TriggerSystem.Link(Trigger.AllBossesKilled, Achievement.Exterminator), + TriggerSystem.Link(Trigger.UnlockedHardMode, Achievement.LookingForChallenge), + TriggerSystem.Link(Trigger.MaxHealthAndMana, Achievement.AllPumpedUp), + TriggerSystem.Link(Trigger.CorruptedWorld, Achievement.CorruptedSoul), + TriggerSystem.Link(Trigger.HallowedWorld, Achievement.HallowedBeThyName), + TriggerSystem.Link(Trigger.FirstTutorialTaskCompleted, Achievement.TerrariaStudent), + TriggerSystem.Link(Trigger.AllTutorialTasksCompleted, Achievement.TerrariaExpert), + TriggerSystem.Link(Trigger.KilledTheTwins, Achievement.Ophthalmologist), + TriggerSystem.Link(Trigger.KilledSkeletronPrime, Achievement.Anthropologist), + TriggerSystem.Link(Trigger.KilledDestroyer, Achievement.Biologist), + TriggerSystem.Link(Trigger.Walked42KM, Achievement.MarathonRunner), + TriggerSystem.Link(Trigger.RemovedLotsOfTiles, Achievement.LandscapeArchitect), + TriggerSystem.Link(Trigger.KilledGoblinArmy, Achievement.DefeatedTheMob), + TriggerSystem.Link(Trigger.Sunrise, Achievement.Survivor), + TriggerSystem.Link(Trigger.SunriseAfterBloodMoon, Achievement.WhenTheMoonTurnsRed), + TriggerSystem.Link(Trigger.AllVanitySlotsEquipped, Achievement.FashionModel), + TriggerSystem.Link(Trigger.CreatedLotsOfBars, Achievement.Smelter), + TriggerSystem.Link(Trigger.Has5Buffs, Achievement.PreparationIsEverything), + TriggerSystem.Link(Trigger.SpawnedAllPets, Achievement.AnimalShelter), + TriggerSystem.Link(Trigger.CollectedAllArmor, Achievement.Collector), + TriggerSystem.Link(Trigger.UsedLotsOfAnvils, Achievement.Blacksmith), + TriggerSystem.Link(Trigger.UsedAllCraftingStations, Achievement.ExpertCrafter), + TriggerSystem.Link(Trigger.PlacedLotsOfWires, Achievement.Engineer), + TriggerSystem.Link(Trigger.WentDownAndUpWithoutDyingOrWarping, Achievement.HellAndBack), + TriggerSystem.Link(Trigger.InTheSky, Achievement.Airtime) + }; + private bool[] Triggers = new bool[30]; + private bool[] CheckTriggers = new bool[30]; + + private static TriggerSystem.TriggerLink Link(Trigger trigger, Achievement achievement) + { + return new TriggerSystem.TriggerLink() + { + Trigger = trigger, + Achievement = achievement + }; + } + + public bool CheckEnabled(Trigger trigger) + { + return this.CheckTriggers[(int) trigger]; + } + + public void SetState(Trigger trigger, bool state) + { + this.Triggers[(int) trigger] = state; + } + + public void ReadProfile(SignedInGamer gamer) + { + if (gamer.IsGuest) + return; + Main.AchievementSystem.GetEarnedAchievements(gamer, new EarnedAchievementsCallback(this.UpdateTriggerChecks)); + } + + private void UpdateTriggerChecks(BitArray earned) + { + for (int index1 = 29; index1 >= 0; --index1) + { + int index2 = (int) this.Links[index1].Trigger; + int index3 = (int) this.Links[index1].Achievement; + this.CheckTriggers[index2] = !earned.Get(index3); + this.Triggers[index2] = false; + } + } + + public void UpdateAchievements(SignedInGamer gamer) + { + for (int index1 = 29; index1 >= 0; --index1) + { + int index2 = (int) this.Links[index1].Trigger; + Achievement achievement = this.Links[index1].Achievement; + if (this.CheckTriggers[index2] && this.Triggers[index2]) + { + this.CheckTriggers[index2] = false; + Main.AchievementSystem.Award(gamer, achievement); + } + } + } + + private struct TriggerLink + { + public Trigger Trigger; + public Achievement Achievement; + } + } +} diff --git a/Terraria/ActivatableSlider.cs b/Terraria/ActivatableSlider.cs new file mode 100644 index 0000000..0f68b12 --- /dev/null +++ b/Terraria/ActivatableSlider.cs @@ -0,0 +1,56 @@ +// Type: Terraria.ActivatableSlider +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework.Graphics; + +namespace Terraria +{ + public class ActivatableSlider + { + private Slider selected; + private Slider active; + private Slider inactive; + + public float Progress + { + get + { + return this.active.Progress; + } + set + { + this.active.Progress = value; + this.inactive.Progress = value; + } + } + + public bool Active + { + get + { + return this.selected == this.active; + } + set + { + if (value) + this.selected = this.active; + else + this.selected = this.inactive; + } + } + + public ActivatableSlider(Slider active, Slider inactive) + { + this.active = active; + this.inactive = inactive; + this.selected = active; + } + + public void Draw(SpriteBatch screen) + { + this.selected.Draw(screen); + } + } +} diff --git a/Terraria/AnimationUtils.cs b/Terraria/AnimationUtils.cs new file mode 100644 index 0000000..111b683 --- /dev/null +++ b/Terraria/AnimationUtils.cs @@ -0,0 +1,100 @@ +// Type: Terraria.AnimationUtils +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace Terraria +{ + public static class AnimationUtils + { + public static Color StringToColor(string text) + { + if (text.Length == 7 && (int) text[0] == 35) + return new Color(AnimationUtils.HexValue(text[1]) * 16 + AnimationUtils.HexValue(text[2]), AnimationUtils.HexValue(text[3]) * 16 + AnimationUtils.HexValue(text[4]), AnimationUtils.HexValue(text[5]) * 16 + AnimationUtils.HexValue(text[6])); + if (text.Length < 11 || (int) text[0] != 123 || (int) text[text.Length - 1] != 125) + return Color.White; + int r = 0; + int g = 0; + int b = 0; + int a = 0; + int index = 1; + while (index + 2 < text.Length && ((int) char.ToLower(text[index]) == 97 || (int) char.ToLower(text[index]) == 114 || ((int) char.ToLower(text[index]) == 103 || (int) char.ToLower(text[index]) == 98)) && (int) text[index + 1] == 58) + { + char ch = char.ToLower(text[index]); + int num = 0; + index += 2; + for (; char.IsDigit(text[index]); ++index) + num = num * 10 + ((int) text[index] - 48); + if ((int) ch == 114) + r = num; + else if ((int) ch == 103) + g = num; + else if ((int) ch == 98) + b = num; + else + a = num; + while ((int) text[index] == 32) + ++index; + } + return new Color(r, g, b, a); + } + + private static int HexValue(char ch) + { + if ((int) ch >= 48 && (int) ch <= 57) + return (int) ch - 48; + if ((int) ch >= 97 && (int) ch <= 122) + return (int) ch - 97 + 10; + if ((int) ch < 65 || (int) ch > 90) + return 0; + else + return (int) ch - 65 + 10; + } + + public static int SqueezeText(SpriteFont font, string text, int width, AnimationUtils.SqueezeTextFlags flags) + { + if (width <= 0 || text.Length == 0) + return 0; + if ((double) (int) UI.MeasureString(font, text).X + (double) UI.Spacing(font) <= (double) width) + return text.Length; + int num1 = 0; + int num2 = text.Length; + do + { + int length = num1 + (num2 - num1 + 1 >> 1); + if ((double) (int) UI.MeasureString(font, text.Substring(0, length)).X + (double) UI.Spacing(font) <= (double) width) + num1 = length; + else + num2 = length; + } + while (num2 > num1 + 1); + if ((flags & AnimationUtils.SqueezeTextFlags.WordBreak) != AnimationUtils.SqueezeTextFlags.NoWordBreak) + { + for (; num1 >= 1; --num1) + { + switch (text[num1 - 1]) + { + case ' ': + case '\t': + case '\r': + case '\n': + goto label_13; + default: + goto default; + } + } + } +label_13: + return num1; + } + + public enum SqueezeTextFlags + { + NoWordBreak, + WordBreak, + } + } +} diff --git a/Terraria/BoxGraphic.cs b/Terraria/BoxGraphic.cs new file mode 100644 index 0000000..83d656c --- /dev/null +++ b/Terraria/BoxGraphic.cs @@ -0,0 +1,63 @@ +// Type: Terraria.BoxGraphic +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace Terraria +{ + internal class BoxGraphic + { + private Texture2D graphic; + public Color Color; + private Rectangle[] destinations; + private Rectangle[] sources; + public int Width; + public int Height; + + public BoxGraphic(Texture2D graphic, Color color, Rectangle[] sources, Rectangle[] destinations, int width, int height) + { + this.graphic = graphic; + this.Color = color; + this.destinations = destinations; + this.sources = sources; + this.Width = width; + this.Height = height; + } + + private static Rectangle[] GetBox9Rectangles(int width, int height, int border) + { + return new Rectangle[9] + { + new Rectangle(0, 0, border, border), + new Rectangle(border, 0, width - border * 2, border), + new Rectangle(width - border, 0, border, border), + new Rectangle(0, border, border, height - border * 2), + new Rectangle(border, border, width - border * 2, height - border * 2), + new Rectangle(width - border, border, border, height - border * 2), + new Rectangle(0, height - border, border, border), + new Rectangle(border, height - border, width - border * 2, border), + new Rectangle(width - border, height - border, border, border) + }; + } + + public static BoxGraphic Create(int width, int height, Texture2D graphic, int borderWidth, Color color) + { + Rectangle[] box9Rectangles1 = BoxGraphic.GetBox9Rectangles(width, height, borderWidth); + Rectangle[] box9Rectangles2 = BoxGraphic.GetBox9Rectangles(graphic.Width, graphic.Height, borderWidth); + return new BoxGraphic(graphic, color, box9Rectangles2, box9Rectangles1, width, height); + } + + public void Draw(Vector2i position, float alpha) + { + for (int index = 0; index < 9; ++index) + { + Rectangle rectangle = this.destinations[index]; + rectangle.Offset(position.X, position.Y); + Main.spriteBatch.Draw(this.graphic, rectangle, new Rectangle?(this.sources[index]), this.Color * alpha); + } + } + } +} diff --git a/Terraria/Buff.cs b/Terraria/Buff.cs new file mode 100644 index 0000000..c5f8c47 --- /dev/null +++ b/Terraria/Buff.cs @@ -0,0 +1,145 @@ +// Type: Terraria.Buff +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +namespace Terraria +{ + public struct Buff + { + public static string[] buffName = new string[46]; + public static string[] buffTip = new string[46]; + public const int NUM_BUFFS = 41; + public const int NUM_BUFF_STRINGS = 46; + public ushort Type; + public ushort Time; + + static Buff() + { + } + + public bool IsPvpBuff() + { + switch ((Buff.ID) this.Type) + { + case Buff.ID.BLEED: + case Buff.ID.CONFUSED: + case Buff.ID.ON_FIRE_2: + case Buff.ID.POISONED: + case Buff.ID.ON_FIRE: + return true; + default: + return false; + } + } + + public static bool IsDebuff(int type) + { + switch (type) + { + case 20: + case 21: + case 22: + case 23: + case 24: + case 25: + case 28: + case 30: + case 31: + case 32: + case 33: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + return true; + default: + return false; + } + } + + public bool IsDebuff() + { + return Buff.IsDebuff((int) this.Type); + } + + public bool IsHealable() + { + switch (this.Type) + { + case (ushort) 20: + case (ushort) 21: + case (ushort) 22: + case (ushort) 23: + case (ushort) 24: + case (ushort) 25: + case (ushort) 30: + case (ushort) 31: + case (ushort) 32: + case (ushort) 33: + case (ushort) 35: + case (ushort) 36: + case (ushort) 37: + case (ushort) 38: + case (ushort) 39: + return (int) this.Time > 0; + default: + return false; + } + } + + public void Init() + { + this.Type = (ushort) 0; + this.Time = (ushort) 0; + } + + public enum ID + { + NONE, + LAVA_IMMUNE, + LIFE_REGEN, + HASTE, + GILLS, + IRONSKIN, + MANA_REGEN, + MAGIC_POWER, + SLOWFALL, + FIND_TREASURE, + INVISIBLE, + SHINE, + NIGHTVISION, + ENEMY_SPAWNS, + THORNS, + WATER_WALK, + RANGED_DAMAGE, + DETECT_CREATURE, + GRAVITY_CONTROL, + LIGHT_ORB, + POISONED, + POTION_DELAY, + BLIND, + NO_ITEMS, + ON_FIRE, + DRUNK, + WELL_FED, + FAIRY, + WEREWOLF, + CLARAVOYANCE, + BLEED, + CONFUSED, + SLOW, + WEAK, + MERFOLK, + SILENCE, + BROKEN_ARMOR, + HORRIFIED, + TONGUED, + ON_FIRE_2, + PET, + NUM_TYPES, + } + } +} diff --git a/Terraria/CRC32.cs b/Terraria/CRC32.cs new file mode 100644 index 0000000..60e8df1 --- /dev/null +++ b/Terraria/CRC32.cs @@ -0,0 +1,85 @@ +// Type: Terraria.CRC32 +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using System; + +namespace Terraria +{ + public sealed class CRC32 + { + private const uint kCrcPoly = 3988292384U; + private const int CRC_NUM_TABLES = 8; + private static uint[] table; + private uint value; + + public CRC32() + { + this.value = uint.MaxValue; + } + + public static void Initialize() + { + CRC32.table = new uint[2048]; + int index1; + for (index1 = 0; index1 < 256; ++index1) + { + uint num = (uint) index1; + for (int index2 = 0; index2 < 8; ++index2) + num = num >> 1 ^ (uint) (-306674912 & ~(((int) num & 1) - 1)); + CRC32.table[index1] = num; + } + for (; index1 < 2048; ++index1) + { + uint num = CRC32.table[index1 - 256]; + CRC32.table[index1] = CRC32.table[(IntPtr) (num & (uint) byte.MaxValue)] ^ num >> 8; + } + } + + public void Init() + { + this.value = uint.MaxValue; + } + + public uint GetValue() + { + return this.value ^ uint.MaxValue; + } + + public void UpdateByte(byte b) + { + this.value = this.value >> 8 ^ CRC32.table[(int) (byte) this.value ^ (int) b]; + } + + public void Update(byte[] data, int offset, int size) + { + if (size == 0) + return; + uint[] numArray = CRC32.table; + uint num1 = this.value; + for (; (offset & 7) != 0 && size != 0; --size) + num1 = num1 >> 8 ^ numArray[(int) (byte) num1 ^ (int) data[offset++]]; + if (size >= 8) + { + int num2 = size - 8 & -8; + size -= num2; + int num3 = num2 + offset; + while (offset != num3) + { + uint num4 = num1 ^ (uint) ((int) data[offset] + ((int) data[offset + 1] << 8) + ((int) data[offset + 2] << 16) + ((int) data[offset + 3] << 24)); + uint num5 = (uint) ((int) data[offset + 4] + ((int) data[offset + 5] << 8) + ((int) data[offset + 6] << 16) + ((int) data[offset + 7] << 24)); + offset += 8; + uint num6; + uint num7; + uint num8; + uint num9; + num1 = numArray[(int) (byte) num4 + 1792] ^ numArray[(int) (num6 = num4 >> 8) + 1536] ^ numArray[(int) (num7 = num6 >> 8) + 1280] ^ numArray[(IntPtr) ((num7 >> 8) + 1024U)] ^ numArray[(int) (byte) num5 + 768] ^ numArray[(int) (num8 = num5 >> 8) + 512] ^ numArray[(int) (num9 = num8 >> 8) + 256] ^ numArray[(IntPtr) (num9 >> 8)]; + } + } + while (size-- != 0) + num1 = num1 >> 8 ^ numArray[(int) (byte) num1 ^ (int) data[offset++]]; + this.value = num1; + } + } +} diff --git a/Terraria/ChatLine.cs b/Terraria/ChatLine.cs new file mode 100644 index 0000000..85c255e --- /dev/null +++ b/Terraria/ChatLine.cs @@ -0,0 +1,23 @@ +// Type: Terraria.ChatLine +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework; + +namespace Terraria +{ + public struct ChatLine + { + public Color color; + public int showTime; + public string text; + + public void Init() + { + this.color = Color.White; + this.showTime = 0; + this.text = (string) null; + } + } +} diff --git a/Terraria/Chest.cs b/Terraria/Chest.cs new file mode 100644 index 0000000..20ab5b4 --- /dev/null +++ b/Terraria/Chest.cs @@ -0,0 +1,591 @@ +// Type: Terraria.Chest +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework; +using System; + +namespace Terraria +{ + public sealed class Chest + { + public Item[] item = new Item[20]; + public const int MAX_ITEMS = 20; + public short x; + public short y; + + public Chest() + { + } + + public Chest(int X, int Y) + { + this.x = (short) X; + this.y = (short) Y; + for (int index = 0; index < 20; ++index) + this.item[index].Init(); + } + + public static unsafe void Unlock(int X, int Y) + { + Main.PlaySound(22, X * 16, Y * 16, 1); + for (int index1 = X; index1 <= X + 1; ++index1) + { + for (int index2 = Y; index2 <= Y + 1; ++index2) + { + if ((int) Main.tile[index1, index2].frameX >= 72 && (int) Main.tile[index1, index2].frameX <= 106 || (int) Main.tile[index1, index2].frameX >= 144 && (int) Main.tile[index1, index2].frameX <= 178) + { + Main.tile[index1, index2].frameX -= (short) 36; + int num = 0; + while (num < 3 && IntPtr.Zero != (IntPtr) Main.dust.NewDust(index1 * 16, index2 * 16, 16, 16, 11, 0.0, 0.0, 0, new Color(), 1.0)) + ++num; + } + } + } + } + + public static int UsingChest(int i) + { + if (Main.chest[i] != null) + { + for (int index = 0; index < 8; ++index) + { + if ((int) Main.player[index].active != 0 && (int) Main.player[index].chest == i) + return index; + } + } + return -1; + } + + public static int FindChest(int X, int Y) + { + for (int index = 0; index < 1000; ++index) + { + if (Main.chest[index] != null && (int) Main.chest[index].x == X && (int) Main.chest[index].y == Y) + return index; + } + return -1; + } + + public static int CreateChest(int X, int Y) + { + for (int index = 0; index < 1000; ++index) + { + if (Main.chest[index] != null && (int) Main.chest[index].x == X && (int) Main.chest[index].y == Y) + return -1; + } + for (int index = 0; index < 1000; ++index) + { + if (Main.chest[index] == null) + { + Main.chest[index] = new Chest(X, Y); + return index; + } + } + return -1; + } + + public static bool DestroyChest(int X, int Y) + { + for (int index1 = 0; index1 < 1000; ++index1) + { + if (Main.chest[index1] != null && (int) Main.chest[index1].x == X && (int) Main.chest[index1].y == Y) + { + for (int index2 = 0; index2 < 20; ++index2) + { + if ((int) Main.chest[index1].item[index2].type > 0 && (int) Main.chest[index1].item[index2].stack > 0) + return false; + } + Main.chest[index1] = (Chest) null; + break; + } + } + return true; + } + + public void AddShop(ref Item newItem) + { + for (int index = 0; index < 19; ++index) + { + if ((int) this.item[index].type == 0) + { + this.item[index] = newItem; + this.item[index].buyOnce = true; + if (this.item[index].value <= 0) + break; + this.item[index].value = this.item[index].value / 5; + if (this.item[index].value >= 1) + break; + this.item[index].value = 1; + break; + } + } + } + + public static int GetShopOwnerHeadTextureId(int npcShop) + { + switch (npcShop) + { + case 1: + return 1257; + case 2: + return 1261; + case 3: + return 1260; + case 4: + return 1259; + case 5: + return 1262; + case 6: + return 1264; + case 7: + return 1265; + case 8: + return 1263; + case 9: + return 1266; + default: + return -1; + } + } + + public void SetupShop(int type, Player player = null) + { + int index1 = 20; + while (index1 > 0) + this.item[--index1].Init(); + int num1; + if (type == 1) + { + Item[] objArray1 = this.item; + int index2 = index1; + int num2 = 1; + int num3 = index2 + num2; + objArray1[index2].SetDefaults(88, 1, false); + Item[] objArray2 = this.item; + int index3 = num3; + int num4 = 1; + int num5 = index3 + num4; + objArray2[index3].SetDefaults(87, 1, false); + Item[] objArray3 = this.item; + int index4 = num5; + int num6 = 1; + int num7 = index4 + num6; + objArray3[index4].SetDefaults(35, 1, false); + Item[] objArray4 = this.item; + int index5 = num7; + int num8 = 1; + int num9 = index5 + num8; + objArray4[index5].netDefaults(-13, 1); + Item[] objArray5 = this.item; + int index6 = num9; + int num10 = 1; + int num11 = index6 + num10; + objArray5[index6].netDefaults(-16, 1); + Item[] objArray6 = this.item; + int index7 = num11; + int num12 = 1; + int num13 = index7 + num12; + objArray6[index7].SetDefaults(8, 1, false); + Item[] objArray7 = this.item; + int index8 = num13; + int num14 = 1; + int num15 = index8 + num14; + objArray7[index8].SetDefaults(28, 1, false); + if (player != null && (int) player.statManaMax >= 200) + this.item[num15++].SetDefaults(110, 1, false); + Item[] objArray8 = this.item; + int index9 = num15; + int num16 = 1; + int num17 = index9 + num16; + objArray8[index9].SetDefaults(40, 1, false); + Item[] objArray9 = this.item; + int index10 = num17; + int num18 = 1; + int index11 = index10 + num18; + objArray9[index10].SetDefaults(42, 1, false); + if (Main.gameTime.bloodMoon) + this.item[index11++].SetDefaults(279, 1, false); + if (!Main.gameTime.dayTime) + this.item[index11++].SetDefaults(282, 1, false); + if (NPC.downedBoss3) + this.item[index11++].SetDefaults(346, 1, false); + if (!Main.hardMode) + return; + this.item[index11].SetDefaults(488, 1, false); + } + else if (type == 2) + { + Item[] objArray1 = this.item; + int index2 = index1; + int num2 = 1; + int num3 = index2 + num2; + objArray1[index2].SetDefaults(97, 1, false); + if (Main.gameTime.bloodMoon || Main.hardMode) + this.item[num3++].SetDefaults(278, 1, false); + if (NPC.downedBoss2 && !Main.gameTime.dayTime || Main.hardMode) + this.item[num3++].SetDefaults(47, 1, false); + Item[] objArray2 = this.item; + int index3 = num3; + int num4 = 1; + int num5 = index3 + num4; + objArray2[index3].SetDefaults(95, 1, false); + Item[] objArray3 = this.item; + int index4 = num5; + int num6 = 1; + int num7 = index4 + num6; + objArray3[index4].SetDefaults(98, 1, false); + if (!Main.gameTime.dayTime) + this.item[num7++].SetDefaults(324, 1, false); + if (!Main.hardMode) + return; + Item[] objArray4 = this.item; + int index5 = num7; + int num8 = 1; + num1 = index5 + num8; + objArray4[index5].SetDefaults(534, 1, false); + } + else if (type == 3) + { + int num2; + if (Main.gameTime.bloodMoon) + { + Item[] objArray1 = this.item; + int index2 = index1; + int num3 = 1; + int num4 = index2 + num3; + objArray1[index2].SetDefaults(67, 1, false); + Item[] objArray2 = this.item; + int index3 = num4; + int num5 = 1; + num2 = index3 + num5; + objArray2[index3].SetDefaults(59, 1, false); + } + else + { + Item[] objArray1 = this.item; + int index2 = index1; + int num3 = 1; + int num4 = index2 + num3; + objArray1[index2].SetDefaults(66, 1, false); + Item[] objArray2 = this.item; + int index3 = num4; + int num5 = 1; + int num6 = index3 + num5; + objArray2[index3].SetDefaults(62, 1, false); + Item[] objArray3 = this.item; + int index4 = num6; + int num7 = 1; + num2 = index4 + num7; + objArray3[index4].SetDefaults(63, 1, false); + } + Item[] objArray4 = this.item; + int index5 = num2; + int num8 = 1; + int num9 = index5 + num8; + objArray4[index5].SetDefaults(27, 1, false); + Item[] objArray5 = this.item; + int index6 = num9; + int num10 = 1; + int num11 = index6 + num10; + objArray5[index6].SetDefaults(114, 1, false); + if (!Main.hardMode) + return; + Item[] objArray6 = this.item; + int index7 = num11; + int num12 = 1; + num1 = index7 + num12; + objArray6[index7].SetDefaults(369, 1, false); + } + else if (type == 4) + { + Item[] objArray1 = this.item; + int index2 = index1; + int num2 = 1; + int num3 = index2 + num2; + objArray1[index2].SetDefaults(168, 1, false); + Item[] objArray2 = this.item; + int index3 = num3; + int num4 = 1; + int num5 = index3 + num4; + objArray2[index3].SetDefaults(166, 1, false); + Item[] objArray3 = this.item; + int index4 = num5; + int num6 = 1; + int num7 = index4 + num6; + objArray3[index4].SetDefaults(167, 1, false); + if (!Main.hardMode) + return; + Item[] objArray4 = this.item; + int index5 = num7; + int num8 = 1; + num1 = index5 + num8; + objArray4[index5].SetDefaults(265, 1, false); + } + else if (type == 5) + { + this.item[index1].SetDefaults(254, 1, false); + int index2 = index1 + 1; + if (Main.gameTime.dayTime) + { + this.item[index2].SetDefaults(242, 1, false); + ++index2; + } + if ((int) Main.gameTime.moonPhase == 0) + { + this.item[index2].SetDefaults(245, 1, false); + int index3 = index2 + 1; + this.item[index3].SetDefaults(246, 1, false); + index2 = index3 + 1; + } + else if ((int) Main.gameTime.moonPhase == 1) + { + this.item[index2].SetDefaults(325, 1, false); + int index3 = index2 + 1; + this.item[index3].SetDefaults(326, 1, false); + index2 = index3 + 1; + } + this.item[index2].SetDefaults(269, 1, false); + int index4 = index2 + 1; + this.item[index4].SetDefaults(270, 1, false); + int index5 = index4 + 1; + this.item[index5].SetDefaults(271, 1, false); + int index6 = index5 + 1; + if (NPC.downedClown) + { + this.item[index6].SetDefaults(503, 1, false); + int index3 = index6 + 1; + this.item[index3].SetDefaults(504, 1, false); + int index7 = index3 + 1; + this.item[index7].SetDefaults(505, 1, false); + index6 = index7 + 1; + } + if (!Main.gameTime.bloodMoon) + return; + this.item[index6].SetDefaults(322, 1, false); + num1 = index6 + 1; + } + else if (type == 6) + { + this.item[index1].SetDefaults(128, 1, false); + int index2 = index1 + 1; + this.item[index2].SetDefaults(486, 1, false); + int index3 = index2 + 1; + this.item[index3].SetDefaults(398, 1, false); + int index4 = index3 + 1; + this.item[index4].SetDefaults(84, 1, false); + int index5 = index4 + 1; + this.item[index5].SetDefaults(407, 1, false); + int index6 = index5 + 1; + this.item[index6].SetDefaults(161, 1, false); + num1 = index6 + 1; + } + else if (type == 7) + { + this.item[index1].SetDefaults(487, 1, false); + int index2 = index1 + 1; + this.item[index2].SetDefaults(496, 1, false); + int index3 = index2 + 1; + this.item[index3].SetDefaults(500, 1, false); + int index4 = index3 + 1; + this.item[index4].SetDefaults(507, 1, false); + int index5 = index4 + 1; + this.item[index5].SetDefaults(508, 1, false); + int index6 = index5 + 1; + this.item[index6].SetDefaults(531, 1, false); + int index7 = index6 + 1; + this.item[index7].SetDefaults(576, 1, false); + num1 = index7 + 1; + } + else if (type == 8) + { + this.item[index1].SetDefaults(509, 1, false); + int index2 = index1 + 1; + this.item[index2].SetDefaults(510, 1, false); + int index3 = index2 + 1; + this.item[index3].SetDefaults(530, 1, false); + int index4 = index3 + 1; + this.item[index4].SetDefaults(513, 1, false); + int index5 = index4 + 1; + this.item[index5].SetDefaults(538, 1, false); + int index6 = index5 + 1; + this.item[index6].SetDefaults(529, 1, false); + int index7 = index6 + 1; + this.item[index7].SetDefaults(541, 1, false); + int index8 = index7 + 1; + this.item[index8].SetDefaults(542, 1, false); + int index9 = index8 + 1; + this.item[index9].SetDefaults(543, 1, false); + num1 = index9 + 1; + } + else + { + if (type != 9) + return; + this.item[index1].SetDefaults(588, 1, false); + int index2 = index1 + 1; + this.item[index2].SetDefaults(589, 1, false); + int index3 = index2 + 1; + this.item[index3].SetDefaults(590, 1, false); + int index4 = index3 + 1; + this.item[index4].SetDefaults(597, 1, false); + int index5 = index4 + 1; + this.item[index5].SetDefaults(598, 1, false); + int index6 = index5 + 1; + this.item[index6].SetDefaults(596, 1, false); + num1 = index6 + 1; + } + } + + private void ConvertCoins(int id) + { + for (int index = 0; index < 20; ++index) + { + if ((int) this.item[index].stack == (int) this.item[index].maxStack && this.item[index].CanBePlacedInCoinSlot()) + { + this.item[index].SetDefaults((int) this.item[index].type + 1, 1, false); + for (int number2 = 0; number2 < 20; ++number2) + { + if (number2 != index && (int) this.item[number2].type == (int) this.item[index].type && (int) this.item[number2].stack < (int) this.item[number2].maxStack) + { + if (id >= 0) + { + NetMessage.CreateMessage2(32, id, number2); + NetMessage.SendMessage(); + } + ++this.item[number2].stack; + this.item[index].Init(); + this.ConvertCoins(id); + } + } + } + } + } + + public void LootAll(Player player) + { + int number = (int) player.chest; + for (int number2 = 0; number2 < 20; ++number2) + { + if ((int) this.item[number2].type > 0) + { + player.GetItem(ref this.item[number2]); + if (number >= 0) + { + NetMessage.CreateMessage2(32, number, number2); + NetMessage.SendMessage(); + } + } + } + } + + public void Deposit(Player player) + { + int num1 = (int) player.chest; + for (int index = 40; index >= 10; --index) + { + if ((int) player.inventory[index].stack > 0 && (int) player.inventory[index].type > 0) + { + if ((int) player.inventory[index].maxStack > 1) + { + for (int number2 = 0; number2 < 20; ++number2) + { + if ((int) this.item[number2].stack < (int) this.item[number2].maxStack && (int) player.inventory[index].netID == (int) this.item[number2].netID) + { + short num2 = player.inventory[index].stack; + if ((int) player.inventory[index].stack + (int) this.item[number2].stack > (int) this.item[number2].maxStack) + num2 = (short) ((int) this.item[number2].maxStack - (int) this.item[number2].stack); + player.inventory[index].stack -= num2; + this.item[number2].stack += num2; + this.ConvertCoins(num1); + Main.PlaySound(7); + if ((int) player.inventory[index].stack <= 0) + { + player.inventory[index].Init(); + if (num1 >= 0) + { + NetMessage.CreateMessage2(32, num1, number2); + NetMessage.SendMessage(); + break; + } + else + break; + } + else + { + if ((int) this.item[number2].type == 0) + { + this.item[number2] = player.inventory[index]; + player.inventory[index].Init(); + } + if (num1 >= 0) + { + NetMessage.CreateMessage2(32, num1, number2); + NetMessage.SendMessage(); + } + } + } + } + } + if ((int) player.inventory[index].stack > 0) + { + for (int number2 = 0; number2 < 20; ++number2) + { + if ((int) this.item[number2].type == 0) + { + Main.PlaySound(7); + this.item[number2] = player.inventory[index]; + player.inventory[index].Init(); + if (num1 >= 0) + { + NetMessage.CreateMessage2(32, num1, number2); + NetMessage.SendMessage(); + break; + } + else + break; + } + } + } + } + } + } + + public void QuickStack(Player player) + { + int num1 = (int) player.chest; + for (int number2 = 0; number2 < 20; ++number2) + { + if ((int) this.item[number2].type > 0 && (int) this.item[number2].stack < (int) this.item[number2].maxStack) + { + for (int index = 0; index < 48; ++index) + { + if ((int) this.item[number2].netID == (int) player.inventory[index].netID) + { + short num2 = player.inventory[index].stack; + if ((int) this.item[number2].stack + (int) num2 > (int) this.item[number2].maxStack) + num2 = (short) ((int) this.item[number2].maxStack - (int) this.item[number2].stack); + Main.PlaySound(7); + this.item[number2].stack += num2; + player.inventory[index].stack -= num2; + this.ConvertCoins(num1); + if ((int) player.inventory[index].stack == 0) + player.inventory[index].Init(); + else if ((int) this.item[number2].type == 0) + { + this.item[number2] = player.inventory[index]; + player.inventory[index].Init(); + } + if (num1 >= 0) + { + NetMessage.CreateMessage2(32, num1, number2); + NetMessage.SendMessage(); + } + } + } + } + } + } + } +} diff --git a/Terraria/Cloud.cs b/Terraria/Cloud.cs new file mode 100644 index 0000000..1a8bed4 --- /dev/null +++ b/Terraria/Cloud.cs @@ -0,0 +1,164 @@ +// Type: Terraria.Cloud +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework; + +namespace Terraria +{ + public struct Cloud + { + public static Cloud[] cloud = new Cloud[20]; + public static int numClouds = 20; + public static float windSpeed = 0.0f; + public static float windSpeedSpeed = 0.0f; + public static bool resetClouds = true; + public const int MAX_CLOUDS = 20; + public const int MAX_CLOUD_TYPES = 4; + public Vector2 position; + public float scale; + public bool active; + public byte type; + public ushort width; + public ushort height; + + static Cloud() + { + } + + public static void Initialize() + { + for (int index = 0; index < 20; ++index) + Cloud.cloud[index].Init(); + } + + public void Init() + { + this.active = false; + this.type = (byte) 0; + this.width = (ushort) 0; + this.height = (ushort) 0; + } + + public static unsafe void addCloud() + { + fixed (Cloud* cloudPtr1 = Cloud.cloud) + { + Cloud* cloudPtr2 = cloudPtr1; + for (int index1 = 19; index1 >= 0; --index1) + { + if (!cloudPtr2->active) + { + cloudPtr2->type = (byte) Main.rand.Next(4); + int index2 = (int) cloudPtr2->type + 8; + cloudPtr2->scale = (float) Main.rand.Next(50, 131) * 0.01f; + cloudPtr2->width = (ushort) ((double) SpriteSheet<_sheetTiles>.src[index2].Width * (double) cloudPtr2->scale); + cloudPtr2->height = (ushort) ((double) SpriteSheet<_sheetTiles>.src[index2].Height * (double) cloudPtr2->scale); + cloudPtr2->position.X = (double) Cloud.windSpeed <= 0.0 ? 960f : (float) -cloudPtr2->width; + cloudPtr2->position.Y = (float) (Main.rand.Next(-135, 135) - Main.rand.Next(180)); + cloudPtr2->active = true; + break; + } + else + ++cloudPtr2; + } + } + } + + public Color cloudColor(Color bgColor) + { + float num1 = (float) (((double) this.scale - 0.400000005960464) * 0.899999976158142); + float num2 = (float) ((double) byte.MaxValue - (double) ((int) byte.MaxValue - (int) bgColor.R) * 1.10000002384186); + float num3 = (float) ((double) byte.MaxValue - (double) ((int) byte.MaxValue - (int) bgColor.G) * 1.10000002384186); + float num4 = (float) ((double) byte.MaxValue - (double) ((int) byte.MaxValue - (int) bgColor.B) * 1.10000002384186); + float num5 = (float) byte.MaxValue; + float num6 = num2 * num1; + float num7 = num3 * num1; + float num8 = num4 * num1; + float num9 = num5 * num1; + if ((double) num6 < 0.0) + num6 = 0.0f; + if ((double) num7 < 0.0) + num7 = 0.0f; + if ((double) num8 < 0.0) + num8 = 0.0f; + if ((double) num9 < 0.0) + num9 = 0.0f; + return new Color((int) (byte) num6, (int) (byte) num7, (int) (byte) num8, (int) (byte) num9); + } + + public static unsafe void UpdateClouds() + { + if (Cloud.resetClouds) + { + Cloud.resetClouds = false; + Cloud.numClouds = Main.rand.Next(10, 20); + do + { + Cloud.windSpeed = (float) Main.rand.Next(-100, 101) * 0.01f; + } + while ((double) Cloud.windSpeed == 0.0); + for (int index = 0; index < 20; ++index) + Cloud.cloud[index].active = false; + for (int index = 0; index < Cloud.numClouds; ++index) + Cloud.addCloud(); + for (int index = 0; index < Cloud.numClouds; ++index) + { + int num = Main.rand.Next(960); + if ((double) Cloud.cloud[index].position.X < 0.0) + Cloud.cloud[index].position.X += (float) num; + else + Cloud.cloud[index].position.X -= (float) num; + } + } + Cloud.windSpeedSpeed += (float) Main.rand.Next(-20, 21) * 0.0001f; + if ((double) Cloud.windSpeedSpeed < -0.002) + Cloud.windSpeedSpeed = -1.0 / 500.0; + else if ((double) Cloud.windSpeedSpeed > 0.002) + Cloud.windSpeedSpeed = 1.0 / 500.0; + Cloud.windSpeed += Cloud.windSpeedSpeed; + if ((double) Cloud.windSpeed < -0.4) + Cloud.windSpeed = -0.4f; + else if ((double) Cloud.windSpeed > 0.4) + Cloud.windSpeed = 0.4f; + Cloud.numClouds += Main.rand.Next(-1, 2); + if (Cloud.numClouds < 0) + Cloud.numClouds = 0; + else if (Cloud.numClouds > 20) + Cloud.numClouds = 20; + int num1 = 0; + for (int index = 0; index < 20; ++index) + { + fixed (Cloud* cloudPtr = &Cloud.cloud[index]) + { + if (cloudPtr->active) + { + cloudPtr->Update(); + ++num1; + } + } + } + if (num1 >= Cloud.numClouds) + return; + Cloud.addCloud(); + } + + public void Update() + { + this.position.X += (float) ((double) Cloud.windSpeed * (double) this.scale * 2.0); + if ((double) Cloud.windSpeed > 0.0) + { + if ((double) this.position.X <= 960.0) + return; + this.active = false; + } + else + { + if ((double) this.position.X >= (double) -this.width) + return; + this.active = false; + } + } + } +} diff --git a/Terraria/Collision.cs b/Terraria/Collision.cs new file mode 100644 index 0000000..7481963 --- /dev/null +++ b/Terraria/Collision.cs @@ -0,0 +1,770 @@ +// Type: Terraria.Collision +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework; +using System; + +namespace Terraria +{ + public sealed class Collision + { + public static bool up; + public static bool down; + + static Collision() + { + } + + public static bool CanHit(ref Rectangle aabb1, ref Rectangle aabb2) + { + int index1 = aabb1.X + (aabb1.Width >> 1) >> 4; + int index2 = aabb1.Y + (aabb1.Height >> 1) >> 4; + int num1 = aabb2.X + (aabb2.Width >> 1) >> 4; + int num2 = aabb2.Y + (aabb2.Height >> 1) >> 4; + try + { + do + { + int num3 = Math.Abs(index1 - num1); + int num4 = Math.Abs(index2 - num2); + if (index1 == num1 && index2 == num2) + return true; + if (num3 > num4) + { + if (index1 < num1) + ++index1; + else + --index1; + if ((int) Main.tile[index1, index2 - 1].active != 0 && Main.tileSolidNotSolidTop[(int) Main.tile[index1, index2 - 1].type] && ((int) Main.tile[index1, index2 + 1].active != 0 && Main.tileSolidNotSolidTop[(int) Main.tile[index1, index2 + 1].type])) + return false; + } + else + { + if (index2 < num2) + ++index2; + else + --index2; + if ((int) Main.tile[index1 - 1, index2].active != 0 && Main.tileSolidNotSolidTop[(int) Main.tile[index1 - 1, index2].type] && ((int) Main.tile[index1 + 1, index2].active != 0 && Main.tileSolidNotSolidTop[(int) Main.tile[index1 + 1, index2].type])) + return false; + } + } + while ((int) Main.tile[index1, index2].active == 0 || !Main.tileSolidNotSolidTop[(int) Main.tile[index1, index2].type]); + return false; + } + catch + { + return false; + } + } + + public static bool AnyPlayerOrNPC(int i, int j, int h) + { + Rectangle rectangle = new Rectangle(); + rectangle.X = i * 16; + rectangle.Y = j * 16; + rectangle.Width = 16; + rectangle.Height = h * 16; + for (int index = 7; index >= 0; --index) + { + if ((int) Main.player[index].active != 0 && rectangle.Intersects(Main.player[index].aabb)) + return true; + } + for (int index = 195; index >= 0; --index) + { + if ((int) Main.npc[index].active != 0 && rectangle.Intersects(Main.npc[index].aabb)) + return true; + } + return false; + } + + public static unsafe bool DrownCollision(ref Vector2 Position, int Width, int Height, int gravDir) + { + Vector2 vector2 = Position; + int num1 = 10; + int num2 = 12; + if (num1 > Width) + num1 = Width; + if (num2 > Height) + num2 = Height; + vector2.X += (float) (Width >> 1); + vector2.X -= (float) (num1 >> 1); + vector2.Y -= 2f; + if (gravDir == -1) + vector2.Y += (float) ((Height >> 1) - 6); + int num3 = ((int) Position.X >> 4) - 1; + int num4 = ((int) Position.X + Width >> 4) + 2; + int num5 = ((int) Position.Y >> 4) - 1; + int num6 = ((int) Position.Y + Height >> 4) + 2; + if (num3 < 0) + num3 = 0; + if (num4 > (int) Main.maxTilesX) + num4 = (int) Main.maxTilesX; + if (num5 < 0) + num5 = 0; + if (num6 > (int) Main.maxTilesY) + num6 = (int) Main.maxTilesY; + Tile[,] tileArray; + // ISSUE: cast to a reference type + // ISSUE: explicit reference operation + fixed (Tile* tilePtr1 = &^((tileArray = Main.tile) == null || tileArray.Length == 0 ? (Tile&) IntPtr.Zero : tileArray.Address(0, 0))) + { + for (int index = num3; index < num4; ++index) + { + Tile* tilePtr2 = tilePtr1 + (index * 1440 + num5); + int num7 = num5; + while (num7 < num6) + { + int num8 = (int) tilePtr2->liquid; + if (num8 > 0) + { + int num9 = index << 4; + float num10 = (float) (num7 << 4); + float num11 = (float) (256 - num8) * (1.0 / 16.0); + float num12 = num10 + num11; + int num13 = 16 - (int) num11; + if ((double) vector2.X + (double) num1 > (double) num9 && (double) vector2.X < (double) (num9 + 16) && ((double) vector2.Y + (double) num2 > (double) num12 && (double) vector2.Y < (double) num12 + (double) num13)) + return true; + } + ++num7; + ++tilePtr2; + } + } + } + return false; + } + + public static unsafe bool WetCollision(ref Vector2 Position, int Width, int Height) + { + Vector2 vector2 = new Vector2(Position.X + (float) (Width >> 1), Position.Y + (float) (Height >> 1)); + int num1 = 10; + int num2 = Height >> 1; + if (num1 > Width) + num1 = Width; + if (num2 > Height) + num2 = Height; + vector2.X -= (float) (num1 >> 1); + vector2.Y -= (float) (num2 >> 1); + int num3 = ((int) Position.X >> 4) - 1; + int num4 = ((int) Position.X + Width >> 4) + 2; + int num5 = ((int) Position.Y >> 4) - 1; + int num6 = ((int) Position.Y + Height >> 4) + 2; + if (num3 < 0) + num3 = 0; + if (num4 > (int) Main.maxTilesX) + num4 = (int) Main.maxTilesX; + if (num5 < 0) + num5 = 0; + if (num6 > (int) Main.maxTilesY) + num6 = (int) Main.maxTilesY; + Tile[,] tileArray; + // ISSUE: cast to a reference type + // ISSUE: explicit reference operation + fixed (Tile* tilePtr1 = &^((tileArray = Main.tile) == null || tileArray.Length == 0 ? (Tile&) IntPtr.Zero : tileArray.Address(0, 0))) + { + for (int index = num3; index < num4; ++index) + { + Tile* tilePtr2 = tilePtr1 + (index * 1440 + num5); + int num7 = num5; + while (num7 < num6) + { + int num8 = (int) tilePtr2->liquid; + if (num8 > 0) + { + int num9 = index << 4; + float num10 = (float) (num7 << 4); + int num11 = 16; + float num12 = (float) (256 - num8) * (1.0 / 16.0); + float num13 = num10 + num12; + int num14 = num11 - (int) num12; + if ((double) vector2.X + (double) num1 > (double) num9 && (double) vector2.X < (double) (num9 + 16) && ((double) vector2.Y + (double) num2 > (double) num13 && (double) vector2.Y < (double) num13 + (double) num14)) + return true; + } + ++num7; + ++tilePtr2; + } + } + } + return false; + } + + public static unsafe bool LavaCollision(ref Vector2 Position, int Width, int Height) + { + int num1 = ((int) Position.X >> 4) - 1; + int num2 = ((int) Position.X + Width >> 4) + 2; + int num3 = ((int) Position.Y >> 4) - 1; + int num4 = ((int) Position.Y + Height >> 4) + 2; + if (num1 < 0) + num1 = 0; + if (num2 > (int) Main.maxTilesX) + num2 = (int) Main.maxTilesX; + if (num3 < 0) + num3 = 0; + if (num4 > (int) Main.maxTilesY) + num4 = (int) Main.maxTilesY; + Tile[,] tileArray; + // ISSUE: cast to a reference type + // ISSUE: explicit reference operation + fixed (Tile* tilePtr1 = &^((tileArray = Main.tile) == null || tileArray.Length == 0 ? (Tile&) IntPtr.Zero : tileArray.Address(0, 0))) + { + for (int index = num1; index < num2; ++index) + { + Tile* tilePtr2 = tilePtr1 + (index * 1440 + num3); + int num5 = num3; + while (num5 < num4) + { + int num6 = (int) tilePtr2->liquid; + if (num6 > 0 && (int) tilePtr2->lava != 0) + { + Vector2 vector2; + vector2.X = (float) (index * 16); + vector2.Y = (float) (num5 * 16); + int num7 = 16; + float num8 = (float) (256 - num6) * (1.0 / 16.0); + vector2.Y += num8; + int num9 = num7 - (int) num8; + if ((double) Position.X + (double) Width > (double) vector2.X && (double) Position.X < (double) vector2.X + 16.0 && ((double) Position.Y + (double) Height > (double) vector2.Y && (double) Position.Y < (double) vector2.Y + (double) num9)) + return true; + } + ++num5; + ++tilePtr2; + } + } + } + return false; + } + + public static unsafe void TileCollision(ref Vector2 Position, ref Vector2 Velocity, int Width, int Height, bool fallThrough = false, bool fall2 = false) + { + Collision.up = false; + Collision.down = false; + Vector2 vector2 = Velocity; + float num1 = Position.X + (float) Width; + float num2 = Position.Y + (float) Height; + float num3 = Position.X + Velocity.X; + float num4 = Position.Y + Velocity.Y; + float num5 = num3 + (float) Width; + float num6 = num4 + (float) Height; + int num7 = ((int) Position.X >> 4) - 1; + int num8 = ((int) num1 >> 4) + 2; + int num9 = ((int) Position.Y >> 4) - 1; + int num10 = ((int) num2 >> 4) + 2; + int num11 = -1; + int num12 = -1; + int num13 = -1; + int num14 = -1; + if (num7 < 0) + num7 = 0; + if (num8 > (int) Main.maxTilesX) + num8 = (int) Main.maxTilesX; + if (num9 < 0) + num9 = 0; + if (num10 > (int) Main.maxTilesY) + num10 = (int) Main.maxTilesY; + Tile[,] tileArray; + // ISSUE: cast to a reference type + // ISSUE: explicit reference operation + fixed (Tile* tilePtr1 = &^((tileArray = Main.tile) == null || tileArray.Length == 0 ? (Tile&) IntPtr.Zero : tileArray.Address(0, 0))) + { + for (int index1 = num7; index1 < num8; ++index1) + { + int num15 = index1 << 4; + if ((double) num5 > (double) num15 && (double) num3 < (double) (num15 + 16)) + { + Tile* tilePtr2 = tilePtr1 + (index1 * 1440 + num9); + int num16 = num9; + while (num16 < num10) + { + if ((int) tilePtr2->active != 0) + { + int index2 = (int) tilePtr2->type; + bool flag = Main.tileSolidTop[index2]; + if (flag && (int) tilePtr2->frameY == 0 || Main.tileSolid[index2]) + { + int num17 = num16 << 4; + if ((double) num6 > (double) num17 && (double) num4 < (double) (num17 + 16)) + { + if ((double) num2 <= (double) num17) + { + Collision.down = true; + if (!flag || !fallThrough || (double) vector2.Y > 1.0 && !fall2) + { + num13 = index1; + num14 = num16; + if (num13 != num11) + Velocity.Y = (float) num17 - num2; + } + } + else if (!flag) + { + if ((double) num1 <= (double) num15) + { + num11 = index1; + num12 = num16; + if (num12 != num14) + Velocity.X = (float) num15 - num1; + if (num13 == num11) + Velocity.Y = vector2.Y; + } + else if ((double) Position.X >= (double) (num15 + 16)) + { + num11 = index1; + num12 = num16; + if (num12 != num14) + Velocity.X = (float) (num15 + 16) - Position.X; + if (num13 == num11) + Velocity.Y = vector2.Y; + } + else if ((double) Position.Y >= (double) (num17 + 16)) + { + Collision.up = true; + num13 = index1; + num14 = num16; + Velocity.Y = (float) (num17 + 16) - Position.Y; + if (num14 == num12) + Velocity.X = vector2.X; + } + } + } + } + } + ++num16; + ++tilePtr2; + } + } + } + } + } + + public static unsafe bool SolidCollision(ref Vector2 Position, int Width, int Height) + { + float num1 = Position.X + (float) Width; + float num2 = Position.Y + (float) Height; + int num3 = ((int) Position.X >> 4) - 1; + int num4 = ((int) num1 >> 4) + 2; + int num5 = ((int) Position.Y >> 4) - 1; + int num6 = ((int) num2 >> 4) + 2; + if (num3 < 0) + num3 = 0; + if (num4 > (int) Main.maxTilesX) + num4 = (int) Main.maxTilesX; + if (num5 < 0) + num5 = 0; + if (num6 > (int) Main.maxTilesY) + num6 = (int) Main.maxTilesY; + Tile[,] tileArray; + // ISSUE: cast to a reference type + // ISSUE: explicit reference operation + fixed (Tile* tilePtr1 = &^((tileArray = Main.tile) == null || tileArray.Length == 0 ? (Tile&) IntPtr.Zero : tileArray.Address(0, 0))) + { + for (int index = num3; index < num4; ++index) + { + if ((double) num1 > (double) (index << 4) && (double) Position.X < (double) (index + 1 << 4)) + { + Tile* tilePtr2 = tilePtr1 + (index * 1440 + num5); + int num7 = num5; + while (num7 < num6) + { + if ((int) tilePtr2->active != 0 && (double) num2 > (double) (num7 << 4) && ((double) Position.Y < (double) (num7 + 1 << 4) && Main.tileSolidNotSolidTop[(int) tilePtr2->type])) + return true; + ++num7; + ++tilePtr2; + } + } + } + } + return false; + } + + public static unsafe Vector2 WaterCollision(Vector2 Position, Vector2 Velocity, int Width, int Height, bool fallThrough = false) + { + Vector2 vector2_1 = Velocity; + Vector2 vector2_2 = Position + Velocity; + Vector2 vector2_3 = Position; + int num1 = ((int) Position.X >> 4) - 1; + int num2 = ((int) Position.X + Width >> 4) + 2; + int num3 = ((int) Position.Y >> 4) - 1; + int num4 = ((int) Position.Y + Height >> 4) + 2; + if (num1 < 0) + num1 = 0; + if (num2 > (int) Main.maxTilesX) + num2 = (int) Main.maxTilesX; + if (num3 < 0) + num3 = 0; + if (num4 > (int) Main.maxTilesY) + num4 = (int) Main.maxTilesY; + Tile[,] tileArray; + // ISSUE: cast to a reference type + // ISSUE: explicit reference operation + fixed (Tile* tilePtr1 = &^((tileArray = Main.tile) == null || tileArray.Length == 0 ? (Tile&) IntPtr.Zero : tileArray.Address(0, 0))) + { + for (int index = num1; index < num2; ++index) + { + Vector2 vector2_4; + vector2_4.X = (float) (index * 16); + Tile* tilePtr2 = tilePtr1 + (index * 1440 + num3); + int num5 = num3; + while (num5 < num4) + { + int num6 = (int) tilePtr2->liquid; + if (num6 > 0) + { + int num7 = num6 + 16 >> 5 << 1; + vector2_4.Y = (float) (num5 * 16 + 16 - num7); + if ((double) vector2_2.X + (double) Width > (double) vector2_4.X && (double) vector2_2.X < (double) vector2_4.X + 16.0 && ((double) vector2_2.Y + (double) Height > (double) vector2_4.Y && (double) vector2_2.Y < (double) vector2_4.Y + (double) num7) && ((double) vector2_3.Y + (double) Height <= (double) vector2_4.Y && !fallThrough)) + vector2_1.Y = vector2_4.Y - (vector2_3.Y + (float) Height); + } + ++num5; + ++tilePtr2; + } + } + } + return vector2_1; + } + + public static unsafe void AnyCollision(ref Vector2 Position, ref Vector2 Velocity, int Width, int Height) + { + Vector2 vector2_1 = Position + Velocity; + Vector2 vector2_2 = Position; + int num1 = ((int) Position.X >> 4) - 1; + int num2 = ((int) Position.X + Width >> 4) + 2; + int num3 = ((int) Position.Y >> 4) - 1; + int num4 = ((int) Position.Y + Height >> 4) + 2; + int num5 = -1; + int num6 = -1; + int num7 = -1; + int num8 = -1; + if (num1 < 0) + num1 = 0; + if (num2 > (int) Main.maxTilesX) + num2 = (int) Main.maxTilesX; + if (num3 < 0) + num3 = 0; + if (num4 > (int) Main.maxTilesY) + num4 = (int) Main.maxTilesY; + Tile[,] tileArray; + // ISSUE: cast to a reference type + // ISSUE: explicit reference operation + fixed (Tile* tilePtr1 = &^((tileArray = Main.tile) == null || tileArray.Length == 0 ? (Tile&) IntPtr.Zero : tileArray.Address(0, 0))) + { + for (int index = num1; index < num2; ++index) + { + double num9 = (double) (index << 4); + if ((double) vector2_1.X + (double) Width > num9 && (double) vector2_1.X < num9 + 16.0) + { + Tile* tilePtr2 = tilePtr1 + (index * 1440 + num3); + int num10 = num3; + while (num10 < num4) + { + if ((int) tilePtr2->active != 0) + { + double num11 = (double) (num10 << 4); + if ((double) vector2_1.Y + (double) Height > num11 && (double) vector2_1.Y < num11 + 16.0) + { + if ((double) vector2_2.Y + (double) Height <= num11) + { + int num12 = index; + num8 = num10; + if (num12 != num5) + Velocity.Y = (float) (num11 - ((double) vector2_2.Y + (double) Height)); + } + else if (!Main.tileSolidTop[(int) tilePtr2->type]) + { + if ((double) vector2_2.X + (double) Width <= num9) + { + num5 = index; + num6 = num10; + if (num6 != num8) + Velocity.X = (float) (num9 - ((double) vector2_2.X + (double) Width)); + } + else if ((double) vector2_2.X >= num9 + 16.0) + { + num5 = index; + num6 = num10; + if (num6 != num8) + Velocity.X = (float) (num9 + 16.0) - vector2_2.X; + } + else if ((double) vector2_2.Y >= num11 + 16.0) + { + num7 = index; + num8 = num10; + Velocity.Y = (float) (num11 + 16.0 - (double) vector2_2.Y + 0.01); + if (num8 == num6) + Velocity.X += 0.01f; + } + } + } + } + ++num10; + ++tilePtr2; + } + } + } + } + } + + public static unsafe void HitTiles(Vector2 Position, Vector2 Velocity, int Width, int Height) + { + Vector2 vector2 = Position + Velocity; + int num1 = ((int) Position.X >> 4) - 1; + int num2 = ((int) Position.X + Width >> 4) + 1; + int num3 = ((int) Position.Y >> 4) - 1; + int num4 = ((int) Position.Y + Height >> 4) + 1; + if (num1 < 0) + num1 = 0; + if (num2 > (int) Main.maxTilesX) + num2 = (int) Main.maxTilesX; + if (num3 < 0) + num3 = 0; + if (num4 > (int) Main.maxTilesY) + num4 = (int) Main.maxTilesY; + Tile[,] tileArray; + // ISSUE: cast to a reference type + // ISSUE: explicit reference operation + fixed (Tile* tilePtr1 = &^((tileArray = Main.tile) == null || tileArray.Length == 0 ? (Tile&) IntPtr.Zero : tileArray.Address(0, 0))) + { + for (int i = num1; i < num2; ++i) + { + Tile* tilePtr2 = tilePtr1 + (i * 1440 + num3); + int j = num3; + while (j < num4) + { + if (tilePtr2->canStandOnTop()) + { + double num5 = (double) (i << 4); + double num6 = (double) (j << 4); + if ((double) vector2.X + (double) Width >= num5 && (double) vector2.X <= num5 + 16.0 && ((double) vector2.Y + (double) Height >= num6 && (double) vector2.Y <= num6 + 16.0)) + WorldGen.KillTile(i, j, true, true, false); + } + ++j; + ++tilePtr2; + } + } + } + } + + public static unsafe int HurtTiles(ref Vector2 Position, ref Vector2 Velocity, int Width, int Height, bool fireImmune = false) + { + int num1 = ((int) Position.X >> 4) - 1; + int num2 = ((int) Position.X + Width >> 4) + 1; + int num3 = ((int) Position.Y >> 4) - 1; + int num4 = ((int) Position.Y + Height >> 4) + 1; + if (num1 < 0) + num1 = 0; + if (num2 > (int) Main.maxTilesX) + num2 = (int) Main.maxTilesX; + if (num3 < 0) + num3 = 0; + if (num4 > (int) Main.maxTilesY) + num4 = (int) Main.maxTilesY; + Tile[,] tileArray; + // ISSUE: cast to a reference type + // ISSUE: explicit reference operation + fixed (Tile* tilePtr1 = &^((tileArray = Main.tile) == null || tileArray.Length == 0 ? (Tile&) IntPtr.Zero : tileArray.Address(0, 0))) + { + for (int index = num1; index < num2; ++index) + { + Tile* tilePtr2 = tilePtr1 + (index * 1440 + num3); + int num5 = num3; + while (num5 < num4) + { + if ((int) tilePtr2->active != 0) + { + int num6 = (int) tilePtr2->type; + switch (num6) + { + case 32: + case 37: + case 48: + case 53: + case 57: + case 58: + case 69: + case 76: + case 112: + case 116: + case 123: + double num7 = (double) (index << 4); + double num8 = (double) (num5 << 4); + int num9 = 0; + if (num6 == 32 || num6 == 69 || num6 == 80) + { + if ((double) Position.X + (double) Width > num7 && (double) Position.X < num7 + 16.0 && ((double) Position.Y + (double) Height > num8 && (double) Position.Y < num8 + 16.01)) + { + int num10 = 10; + if (num6 == 69) + num10 = 17; + else if (num6 == 80) + num10 = 6; + if ((num6 == 32 || num6 == 69) && WorldGen.KillTile(index, num5)) + { + NetMessage.CreateMessage5(17, 4, index, num5, 0, 0); + NetMessage.SendMessage(); + } + return num10; + } + else + break; + } + else if (num6 == 53 || num6 == 112 || (num6 == 116 || num6 == 123)) + { + if ((double) Position.X + (double) Width - 2.0 >= num7 && (double) Position.X + 2.0 <= num7 + 16.0 && ((double) Position.Y + (double) Height - 2.0 >= num8 && (double) Position.Y + 2.0 <= num8 + 16.0)) + return 20; + else + break; + } + else if ((double) Position.X + (double) Width >= num7 && (double) Position.X <= num7 + 16.0 && ((double) Position.Y + (double) Height >= num8 && (double) Position.Y <= num8 + 16.01)) + { + if (num6 == 48) + num9 = 40; + else if (!fireImmune && (num6 == 37 || num6 == 58 || num6 == 76)) + num9 = 20; + return num9; + } + else + break; + } + } + ++num5; + ++tilePtr2; + } + } + } + return 0; + } + + public static unsafe bool SwitchTiles(Vector2 Position, int Width, int Height, Vector2 oldPosition) + { + int num1 = ((int) Position.X >> 4) - 1; + int num2 = ((int) Position.X + Width >> 4) + 1; + int num3 = ((int) Position.Y >> 4) - 1; + int num4 = ((int) Position.Y + Height >> 4) + 1; + if (num1 < 0) + num1 = 0; + if (num2 > (int) Main.maxTilesX) + num2 = (int) Main.maxTilesX; + if (num3 < 0) + num3 = 0; + if (num4 > (int) Main.maxTilesY) + num4 = (int) Main.maxTilesY; + Tile[,] tileArray; + // ISSUE: cast to a reference type + // ISSUE: explicit reference operation + fixed (Tile* tilePtr1 = &^((tileArray = Main.tile) == null || tileArray.Length == 0 ? (Tile&) IntPtr.Zero : tileArray.Address(0, 0))) + { + for (int index = num1; index < num2; ++index) + { + Tile* tilePtr2 = tilePtr1 + (index * 1440 + num3); + int num5 = num3; + while (num5 < num4) + { + if ((int) tilePtr2->type == 135 && (int) tilePtr2->active != 0) + { + double num6 = (double) (index * 16); + double num7 = (double) (num5 * 16 + 12); + if ((double) Position.X + (double) Width > num6 && (double) Position.X < num6 + 16.0 && ((double) Position.Y + (double) Height > num7 && (double) Position.Y < num7 + 4.01) && ((double) oldPosition.X + (double) Width <= num6 || (double) oldPosition.X >= num6 + 16.0 || ((double) oldPosition.Y + (double) Height <= num7 || (double) oldPosition.Y >= num7 + 16.01))) + { + WorldGen.hitSwitch(index, num5); + NetMessage.CreateMessage2(59, index, num5); + NetMessage.SendMessage(); + return true; + } + } + ++num5; + ++tilePtr2; + } + } + } + return false; + } + + public static unsafe Vector2i StickyTiles(Vector2 Position, Vector2 Velocity, int Width, int Height) + { + Vector2 vector2 = Position; + int num1 = ((int) Position.X >> 4) - 1; + int num2 = ((int) Position.X + Width >> 4) + 2; + int num3 = ((int) Position.Y >> 4) - 1; + int num4 = ((int) Position.Y + Height >> 4) + 2; + if (num1 < 0) + num1 = 0; + if (num2 > (int) Main.maxTilesX) + num2 = (int) Main.maxTilesX; + if (num3 < 0) + num3 = 0; + if (num4 > (int) Main.maxTilesY) + num4 = (int) Main.maxTilesY; + Tile[,] tileArray; + // ISSUE: cast to a reference type + // ISSUE: explicit reference operation + fixed (Tile* tilePtr1 = &^((tileArray = Main.tile) == null || tileArray.Length == 0 ? (Tile&) IntPtr.Zero : tileArray.Address(0, 0))) + { + for (int x = num1; x < num2; ++x) + { + Tile* tilePtr2 = tilePtr1 + (x * 1440 + num3); + int y = num3; + while (y < num4) + { + if ((int) tilePtr2->type == 51 && (int) tilePtr2->active != 0) + { + double num5 = (double) (x * 16); + double num6 = (double) (y * 16); + if ((double) vector2.X + (double) Width > num5 && (double) vector2.X < num5 + 16.0 && ((double) vector2.Y + (double) Height > num6 && (double) vector2.Y < num6 + 16.01)) + { + if ((double) Math.Abs(Velocity.X) + (double) Math.Abs(Velocity.Y) > 0.699999988079071 && Main.rand.Next(30) == 0) + Main.dust.NewDust(x * 16, y * 16, 16, 16, 30, 0.0, 0.0, 0, new Color(), 1.0); + return new Vector2i(x, y); + } + } + ++y; + ++tilePtr2; + } + } + } + return new Vector2i(-1, -1); + } + + public static unsafe bool SolidTiles(int startX, int endX, int startY, int endY) + { + if (startX < 0 || endX >= (int) Main.maxTilesX || (startY < 0 || endY >= (int) Main.maxTilesY)) + return true; + Tile[,] tileArray; + // ISSUE: cast to a reference type + // ISSUE: explicit reference operation + fixed (Tile* tilePtr1 = &^((tileArray = Main.tile) == null || tileArray.Length == 0 ? (Tile&) IntPtr.Zero : tileArray.Address(0, 0))) + { + for (int index = startX; index < endX + 1; ++index) + { + Tile* tilePtr2 = tilePtr1 + (index * 1440 + startY); + int num = startY; + while (num < endY + 1) + { + if ((int) tilePtr2->active != 0 && Main.tileSolidNotSolidTop[(int) tilePtr2->type]) + return true; + ++num; + ++tilePtr2; + } + } + } + return false; + } + + public static bool LineIntersection(ref Vector2 a1, ref Vector2 a2, Vector2 b1, Vector2 b2, ref Vector2 intersection) + { + Vector2 vector2_1 = a2 - a1; + Vector2 vector2_2 = b2 - b1; + float num1 = (float) ((double) vector2_1.X * (double) vector2_2.Y - (double) vector2_1.Y * (double) vector2_2.X); + if ((double) num1 == 0.0) + return false; + Vector2 vector2_3 = b1 - a1; + float num2 = (float) ((double) vector2_3.X * (double) vector2_2.Y - (double) vector2_3.Y * (double) vector2_2.X) / num1; + if ((double) num2 < 0.0 || (double) num2 > 1.0) + return false; + float num3 = (float) ((double) vector2_3.X * (double) vector2_1.Y - (double) vector2_3.Y * (double) vector2_1.X) / num1; + if ((double) num3 < 0.0 || (double) num3 > 1.0) + return false; + intersection = a1 + num2 * vector2_1; + return true; + } + } +} diff --git a/Terraria/CombatText.cs b/Terraria/CombatText.cs new file mode 100644 index 0000000..359d82a --- /dev/null +++ b/Terraria/CombatText.cs @@ -0,0 +1,122 @@ +// Type: Terraria.CombatText +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework; + +namespace Terraria +{ + public struct CombatText + { + public byte active; + public bool crit; + public short lifeTime; + public float alpha; + public float alphaDir; + public string text; + public Vector2 position; + public Vector2 velocity; + public Vector2 textSize; + public float scale; + public float rotation; + + public void Init() + { + this.active = (byte) 0; + } + + public static void NewText(Vector2 pos, int w, int h, int amount, bool Crit = false) + { + for (int index1 = 0; index1 < 32; ++index1) + { + if ((int) Main.combatText[index1].active == 0) + { + w >>= 1; + h >>= 1; + int index2 = Crit ? 1 : 0; + Main.combatText[index1].text = ToStringExtensions.ToStringLookup(amount); + Vector2 vector2 = UI.MeasureString(UI.fontCombatText[index2], Main.combatText[index1].text); + Main.combatText[index1].textSize = vector2; + Main.combatText[index1].alpha = 1f; + Main.combatText[index1].alphaDir = -0.05f; + Main.combatText[index1].active = (byte) 1; + Main.combatText[index1].scale = 0.0f; + Main.combatText[index1].position.X = (float) ((double) pos.X + (double) w - (double) vector2.X * 0.5); + Main.combatText[index1].position.Y = (float) ((double) pos.Y + (double) (h >> 1) - (double) vector2.Y * 0.5); + Main.combatText[index1].position.X += (float) Main.rand.Next(-w, w + 1); + Main.combatText[index1].position.Y += (float) Main.rand.Next(-h, h + 1); + Main.combatText[index1].crit = Crit; + if (Crit) + { + Main.combatText[index1].lifeTime = (short) 120; + Main.combatText[index1].velocity.Y = -14f; + Main.combatText[index1].velocity.X = (float) Main.rand.Next(-25, 26) * 0.05f; + Main.combatText[index1].rotation = (double) Main.combatText[index1].velocity.X < 0.0 ? -0.12f : 0.12f; + break; + } + else + { + Main.combatText[index1].rotation = 0.0f; + Main.combatText[index1].velocity.Y = -7f; + Main.combatText[index1].lifeTime = (short) 60; + break; + } + } + } + } + + public void Update() + { + this.alpha += this.alphaDir; + if ((double) this.alpha <= 0.600000023841858) + this.alphaDir = -this.alphaDir; + else if ((double) this.alpha >= 1.0) + { + this.alpha = 1f; + this.alphaDir = -this.alphaDir; + } + this.velocity.Y *= 0.92f; + if (this.crit) + this.velocity.Y *= 0.92f; + this.velocity.X *= 0.93f; + this.position.X += this.velocity.X; + this.position.Y += this.velocity.Y; + if ((int) --this.lifeTime <= 0) + { + this.scale -= 0.1f; + if ((double) this.scale < 0.100000001490116) + this.active = (byte) 0; + this.lifeTime = (short) 0; + if (!this.crit) + return; + this.alphaDir = -1f; + this.scale += 0.07f; + } + else + { + if (this.crit) + { + if ((double) this.velocity.X < 0.0) + this.rotation += 1.0 / 1000.0; + else + this.rotation -= 1.0 / 1000.0; + } + if ((double) this.scale < 1.0) + this.scale += 0.1f; + if ((double) this.scale <= 1.0) + return; + this.scale = 1f; + } + } + + public static void UpdateCombatText() + { + for (int index = 31; index >= 0; --index) + { + if ((int) Main.combatText[index].active != 0) + Main.combatText[index].Update(); + } + } + } +} diff --git a/Terraria/CompiledText.cs b/Terraria/CompiledText.cs new file mode 100644 index 0000000..cc0af7e --- /dev/null +++ b/Terraria/CompiledText.cs @@ -0,0 +1,476 @@ +// Type: Terraria.CompiledText +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; + +namespace Terraria +{ + public sealed class CompiledText + { + private List _segments = new List(); + private Stack _tags = new Stack(); + public const short COMPILEDTEXT_WIDTHOFFSET = (short) 5; + public const short COMPILEDTEXT_HEIGHTOFFSET = (short) 12; + private const int ParagraphBreakHeight = 1; + public string Text; + public short Width; + public short Height; + + public CompiledText(string text, int wrapWidth, CompiledText.Style style, CompiledText.MarkupType markupType = CompiledText.MarkupType.Html) + { + this._tags.Push(new CompiledText.OpenTag(CompiledText.TagType.None, style)); + int xx = 0; + int yy = 0; + int num1 = 0; + this.Text = text; + this.Width = (short) 0; + this.Height = (short) 0; + int ich = 0; +label_38: + while (ich < text.Length) + { + if (markupType == CompiledText.MarkupType.Html && (int) text[ich] == 60 && (int) text[ich + 1] == 47) + { + ich += 2; + CompiledText.TagType tagType; + Color? newColor; + this.skipTag(text, markupType, ref ich, true, out tagType, out newColor); + do + ; + while (this._tags.Count > 1 && this._tags.Pop().Tag != tagType); + } + else if (markupType == CompiledText.MarkupType.Html && (int) text[ich] == 60) + { + ++ich; + CompiledText.TagType tagType; + Color? newColor; + this.skipTag(text, markupType, ref ich, false, out tagType, out newColor); + CompiledText.Style style1 = new CompiledText.Style(this._tags.Peek().Style); + switch (tagType) + { + case CompiledText.TagType.Bold: + style1.TextAttributes |= CompiledText.Attributes.Bold; + break; + case CompiledText.TagType.Italic: + style1.TextAttributes |= CompiledText.Attributes.Italic; + break; + case CompiledText.TagType.Center: + style1.TextAttributes |= CompiledText.Attributes.Center; + break; + case CompiledText.TagType.Right: + style1.TextAttributes |= CompiledText.Attributes.Right; + break; + case CompiledText.TagType.Font: + style1.ForegroundColor = newColor.Value; + break; + case CompiledText.TagType.Highlighted: + style1.TextAttributes |= CompiledText.Attributes.Highlighted; + break; + case CompiledText.TagType.FontTitle: + style1.Font = UI.fontBig; + break; + } + if (tagType != CompiledText.TagType.Paragraph) + { + this._tags.Push(new CompiledText.OpenTag(tagType, style1)); + } + else + { + yy += Math.Max(UI.LineSpacing(this._tags.Peek().Style.Font), num1) + 1; + xx = 0; + num1 = 0; + } + } + else + { + int startIndex = ich; + int length1 = 0; + while (ich < text.Length && !this.isEol(text[ich]) && (markupType != CompiledText.MarkupType.Html || (int) text[ich] != 60)) + { + ++ich; + ++length1; + } + if (wrapWidth == 0) + { + Vector2 vector2 = UI.MeasureString(this._tags.Peek().Style.Font, text.Substring(startIndex, length1)); + vector2.X += UI.Spacing(this._tags.Peek().Style.Font); + vector2.Y = (float) UI.LineSpacing(this._tags.Peek().Style.Font); + this.addSegment(text, startIndex, length1, this._tags.Peek().Style, xx, yy, (int) vector2.X, (int) vector2.Y); + xx += (int) vector2.X; + num1 = Math.Max(num1, (int) vector2.Y); + } + else + { +label_32: + while (length1 != 0) + { + int length2; + if ((length2 = AnimationUtils.SqueezeText(this._tags.Peek().Style.Font, text.Substring(startIndex, length1), wrapWidth - xx, AnimationUtils.SqueezeTextFlags.WordBreak)) == 0 && xx != 0) + { + yy += Math.Max(num1, UI.LineSpacing(this._tags.Peek().Style.Font)); + xx = 0; + num1 = 0; + length2 = AnimationUtils.SqueezeText(this._tags.Peek().Style.Font, text.Substring(startIndex, length1), wrapWidth - xx, AnimationUtils.SqueezeTextFlags.WordBreak); + } + if (length2 == 0) + length2 = AnimationUtils.SqueezeText(this._tags.Peek().Style.Font, text.Substring(startIndex, length1), wrapWidth - xx, AnimationUtils.SqueezeTextFlags.NoWordBreak); + if (length2 != 0) + { + Vector2 vector2 = UI.MeasureString(this._tags.Peek().Style.Font, text.Substring(startIndex, length2)); + vector2.X += UI.Spacing(this._tags.Peek().Style.Font); + vector2.Y = (float) UI.LineSpacing(this._tags.Peek().Style.Font); + this.addSegment(text, startIndex, length2, this._tags.Peek().Style, xx, yy, (int) vector2.X, (int) vector2.Y); + xx += (int) vector2.X; + num1 = Math.Max(num1, (int) vector2.Y); + if (length2 < length1) + { + yy += Math.Max(num1, UI.LineSpacing(this._tags.Peek().Style.Font)); + xx = 0; + num1 = 0; + } + startIndex += length2; + length1 -= length2; + while (true) + { + if (length1 != 0 && (int) text[startIndex] == 32) + { + --length1; + ++startIndex; + } + else + goto label_32; + } + } + else + break; + } + } + while (true) + { + if (ich < text.Length && this.isEol(text[ich])) + { + if ((int) text[ich] == 10) + { + yy += Math.Max(num1, UI.LineSpacing(this._tags.Peek().Style.Font)); + xx = 0; + num1 = 0; + } + ++ich; + } + else + goto label_38; + } + } + } + if (wrapWidth == 0) + return; + long num2 = 0L; + int index1 = -1; + CompiledText.Attributes attributes = CompiledText.Attributes.None; + for (int index2 = 0; index2 < this._segments.Count; { + int index3; + index2 = index3; + } + ) + { + index3 = index2 + 1; + if ((this._segments[index2].Style.TextAttributes & CompiledText.Attributes.Alignment) != CompiledText.Attributes.None) + { + if (index1 == -1) + { + index1 = index2; + num2 = (long) this._segments[index2].Position.Y; + attributes = this._segments[index2].Style.TextAttributes & CompiledText.Attributes.Alignment; + } + if (index3 == this._segments.Count || (long) this._segments[index3].Position.Y != num2 || (this._segments[index3].Style.TextAttributes & CompiledText.Attributes.Alignment) != attributes) + { + int num3 = this._segments[index2].Position.Right - this._segments[index1].Position.X; + int num4 = (wrapWidth - num3) / ((attributes & CompiledText.Attributes.Center) != CompiledText.Attributes.None ? 2 : 1); + for (int index3 = index1; index3 != index3; ++index3) + this._segments[index3].Position.X += num4; + index1 = -1; + } + } + } + } + + public void Draw(SpriteBatch target, Rectangle clip, Color defaultTextColor, Color defaultAccentColor) + { + if (clip.Width == 0 || clip.Height == 0) + return; + foreach (CompiledText.Segment segment in this._segments) + { + Color c = segment.Style.ForegroundColor; + if ((segment.Style.TextAttributes & CompiledText.Attributes.Italic) != CompiledText.Attributes.None) + c = defaultAccentColor; + else if ((segment.Style.TextAttributes & CompiledText.Attributes.Highlighted) != CompiledText.Attributes.None) + c = new Color(64, (int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue); + if (c == Color.Transparent) + c = defaultTextColor; + if (segment.Position.X < clip.Width && segment.Position.Y < clip.Height) + { + UI.DrawStringLT(segment.Style.Font, segment.SegmentText, clip.X + segment.Position.X, clip.Y + segment.Position.Y, c); + if ((segment.Style.TextAttributes & CompiledText.Attributes.Bold) != CompiledText.Attributes.None) + UI.DrawStringLT(segment.Style.Font, segment.SegmentText, clip.X + segment.Position.X + 1, clip.Y + segment.Position.Y, c); + } + } + } + + public int CharHitTest(Point pt, bool fuzzy) + { + int num1 = -1; + int num2 = 0; + int num3 = -1; + int num4 = -1; + for (int index = 0; index < this._segments.Count; ++index) + { + CompiledText.Segment segment = this._segments[index]; + bool flag = index + 1 < this._segments.Count && segment.Position.Y != this._segments[index + 1].Position.Y; + if (segment.Position.Contains(pt)) + return (int) segment.SourceCharIndex + AnimationUtils.SqueezeText(segment.Style.Font, segment.SegmentText, pt.X - segment.Position.Left, AnimationUtils.SqueezeTextFlags.NoWordBreak); + if (fuzzy) + { + if (segment.Position.Contains(new Point(segment.Position.X, pt.Y))) + { + num4 = pt.X >= segment.Position.Left ? (int) segment.SourceCharIndex + (int) segment.SourceCharLength - (flag ? 1 : 0) : (num3 == segment.Position.Top ? num4 : (int) segment.SourceCharIndex); + num3 = segment.Position.Top; + } + else if (segment.Position.Top <= pt.Y) + { + num2 = pt.Y >= segment.Position.Top ? (int) segment.SourceCharIndex + (int) segment.SourceCharLength - (flag ? 1 : 0) : (num1 == segment.Position.Top ? num2 : (int) segment.SourceCharIndex); + num1 = segment.Position.Top; + } + } + } + if (!fuzzy) + return -1; + if (num4 == -1) + return num2; + else + return num4; + } + + public Point CharFind(int charIndex) + { + for (int index = 0; index < this._segments.Count; ++index) + { + CompiledText.Segment segment = this._segments[index]; + if (index + 1 == this._segments.Count || (int) this._segments[index + 1].SourceCharIndex > charIndex) + { + int x = segment.Position.X; + int y = segment.Position.Y; + if (charIndex > (int) segment.SourceCharIndex) + x += (int) UI.MeasureString(segment.Style.Font, segment.SegmentText.Substring(0, charIndex - (int) segment.SourceCharIndex)).X; + return new Point(x, y); + } + } + return new Point(-1, -1); + } + + private void skipTag(string text, CompiledText.MarkupType markupType, ref int ich, bool closingTag, out CompiledText.TagType tagType, out Color? newColor) + { + switch (text[ich]) + { + case 'b': + case 'B': + tagType = (int) text[ich + 1] == 114 || (int) text[ich + 1] == 82 ? CompiledText.TagType.Paragraph : CompiledText.TagType.Bold; + break; + case 'c': + case 'C': + tagType = CompiledText.TagType.Center; + break; + case 'f': + case 'F': + tagType = CompiledText.TagType.Font; + break; + case 'h': + case 'H': + tagType = CompiledText.TagType.Highlighted; + break; + case 'i': + case 'I': + tagType = CompiledText.TagType.Italic; + break; + case 'p': + case 'P': + tagType = CompiledText.TagType.Paragraph; + break; + case 'r': + case 'R': + tagType = CompiledText.TagType.Right; + break; + case 't': + case 'T': + tagType = CompiledText.TagType.FontTitle; + break; + default: + tagType = CompiledText.TagType.None; + break; + } + newColor = new Color?(); + while ((int) text[ich] != 61 && (int) text[ich] != 32 && (int) text[ich] != 62) + ++ich; + if (tagType == CompiledText.TagType.Font && markupType == CompiledText.MarkupType.Html && ((int) text[ich] == 32 && (int) text[ich + 1] == 99)) + { + while ((int) text[ich] != 61 && (int) text[ich] != 62) + ++ich; + } + if (tagType == CompiledText.TagType.Font) + { + if ((int) text[ich] == 61) + { + ++ich; + newColor = new Color?(AnimationUtils.StringToColor(this.popQuotedWord(text, ref ich, '>', true))); + } + else + { + int num1 = closingTag ? 1 : 0; + } + } + int num2 = (int) text[ich]; + ++ich; + } + + private string popQuotedWord(string text, ref int ich, char stopChar, bool stripQuotes) + { + int startIndex = ich; + char ch = text[ich]; + string str; + switch (ch) + { + case '"': + case '\'': + do + { + ++ich; + } + while (ich < text.Length && (int) text[ich] != (int) ch); + if (ich != text.Length) + { + int num = (int) text[ich]; + } + ++ich; + str = !stripQuotes ? text.Substring(startIndex, ich - startIndex) : text.Substring(startIndex + 1, ich - startIndex - 2); + break; + default: + while (ich < text.Length && (int) text[ich] != (int) stopChar && !this.isWhiteEol(text[ich])) + ++ich; + str = text.Substring(startIndex, ich - startIndex); + break; + } + while (ich < text.Length && this.isWhiteEol(text[ich])) + ++ich; + return str; + } + + private void addSegment(string text, int startIndex, int length, CompiledText.Style style, int xx, int yy, int cx, int cy) + { + CompiledText.Segment segment = new CompiledText.Segment(); + segment.SegmentText = text.Substring(startIndex, length); + segment.SourceCharIndex = (short) startIndex; + segment.SourceCharLength = (short) length; + segment.Position = new Rectangle(xx, yy, cx, cy); + segment.Style = style; + this._segments.Add(segment); + this.Width = (short) Math.Max((int) this.Width, segment.Position.Right + 5); + this.Height = (short) Math.Max((int) this.Height, segment.Position.Bottom + 12); + } + + private bool isWhiteEol(char ch) + { + if ((int) ch != 32 && (int) ch != 9 && (int) ch != 13) + return (int) ch == 10; + else + return true; + } + + private bool isEol(char ch) + { + if ((int) ch != 13) + return (int) ch == 10; + else + return true; + } + + public enum MarkupType + { + Plain, + Html, + } + + [System.Flags] + public enum Attributes + { + None = 0, + Italic = 1, + Bold = 2, + Highlighted = 4, + Center = 8, + Right = 16, + TextStyle = Highlighted | Bold | Italic, + Alignment = Right | Center, + } + + public class Style + { + public Color ForegroundColor; + public SpriteFont Font; + public CompiledText.Attributes TextAttributes; + + public Style(SpriteFont font) + { + this.ForegroundColor = Color.Transparent; + this.Font = font; + this.TextAttributes = CompiledText.Attributes.None; + } + + public Style(CompiledText.Style copy) + { + this.ForegroundColor = copy.ForegroundColor; + this.Font = copy.Font; + this.TextAttributes = copy.TextAttributes; + } + } + + private sealed class Segment + { + public string SegmentText; + public short SourceCharIndex; + public short SourceCharLength; + public Rectangle Position; + public CompiledText.Style Style; + } + + private enum TagType + { + None, + Bold, + Italic, + Underline, + Link, + Center, + Right, + Font, + Paragraph, + Highlighted, + FontTitle, + } + + private sealed class OpenTag + { + public CompiledText.TagType Tag; + public CompiledText.Style Style; + + public OpenTag(CompiledText.TagType tag, CompiledText.Style style) + { + this.Tag = tag; + this.Style = style; + } + } + } +} diff --git a/Terraria/ControlDesc.cs b/Terraria/ControlDesc.cs new file mode 100644 index 0000000..a191984 --- /dev/null +++ b/Terraria/ControlDesc.cs @@ -0,0 +1,23 @@ +// Type: Terraria.ControlDesc +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +namespace Terraria +{ + public struct ControlDesc + { + public int alignment; + public ushort X; + public ushort Y; + public string text; + + public ControlDesc(int a, int x, int y, string t) + { + this.alignment = a; + this.X = (ushort) x; + this.Y = (ushort) y; + this.text = t; + } + } +} diff --git a/Terraria/CreateCharacter/Assets.cs b/Terraria/CreateCharacter/Assets.cs new file mode 100644 index 0000000..8f08a0c --- /dev/null +++ b/Terraria/CreateCharacter/Assets.cs @@ -0,0 +1,74 @@ +// Type: Terraria.CreateCharacter.Assets +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Content; +using Microsoft.Xna.Framework.Graphics; + +namespace Terraria.CreateCharacter +{ + internal class Assets + { + public const int HAIR_COUNT = 36; + public static Texture2D CATEGORY_BACKGROUND; + public static Texture2D CATEGORY_BACKGROUND_SELECTED; + public static Texture2D[] CATEGORY_ICONS; + public static Rectangle[] HAIR_SOURCES; + public static Texture2D HAIR_PICKER; + public static Texture2D HAIR_BACKGROUND; + public static Texture2D COLOR_PALETTE; + public static Texture2D COLOR_PICKER; + public static Texture2D OPTION_MALE; + public static Texture2D OPTION_FEMALE; + public static Texture2D DIFFICULTY_SOFTCORE; + public static Texture2D DIFFICULTY_MEDIUMCORE; + public static Texture2D DIFFICULTY_HARDCORE; + public static Texture2D HORIZONTAL_PICKER; + public static Texture2D HORIZONTAL_BACKGROUND; + public static Texture2D FRAME; + + public static void LoadContent(ContentManager Content) + { + Assets.CATEGORY_BACKGROUND = Content.Load("UI/CharacterCreation/Tile01"); + Assets.CATEGORY_BACKGROUND_SELECTED = Content.Load("UI/CharacterCreation/Tile01_Bigger"); + Assets.CATEGORY_ICONS = new Texture2D[10] + { + Content.Load("UI/CharacterCreation/Category_Gender"), + Content.Load("UI/CharacterCreation/Category_Hair"), + Content.Load("UI/CharacterCreation/Category_HairColor"), + Content.Load("UI/CharacterCreation/Category_Eyes"), + Content.Load("UI/CharacterCreation/Category_Skin"), + Content.Load("UI/CharacterCreation/Category_Shirt"), + Content.Load("UI/CharacterCreation/Category_Undershirt"), + Content.Load("UI/CharacterCreation/Category_Pants"), + Content.Load("UI/CharacterCreation/Category_Shoes"), + Content.Load("UI/CharacterCreation/Category_Difficulty") + }; + Assets.HAIR_SOURCES = new Rectangle[36]; + for (int index = 0; index < 36; ++index) + Assets.HAIR_SOURCES[index] = new Rectangle(0, 4, 40, 30); + Assets.HAIR_SOURCES[2] = new Rectangle(0, 6, 40, 40); + Assets.HAIR_SOURCES[8] = new Rectangle(4, 4, 40, 30); + Assets.HAIR_SOURCES[9] = new Rectangle(0, 4, 35, 30); + Assets.HAIR_SOURCES[10] = new Rectangle(2, 4, 40, 28); + Assets.HAIR_SOURCES[16] = new Rectangle(2, 0, 30, 28); + Assets.HAIR_SOURCES[17] = new Rectangle(0, 6, 40, 32); + Assets.HAIR_SOURCES[23] = new Rectangle(0, 0, 40, 28); + Assets.HAIR_SOURCES[26] = new Rectangle(0, 4, 35, 30); + Assets.HAIR_PICKER = Content.Load("UI/CharacterCreation/Hair_Selector"); + Assets.HAIR_BACKGROUND = Content.Load("UI/CharacterCreation/Hair_Background"); + Assets.COLOR_PALETTE = Content.Load("UI/CharacterCreation/Palette"); + Assets.COLOR_PICKER = Content.Load("UI/CharacterCreation/Color_Selector"); + Assets.OPTION_MALE = Content.Load("UI/CharacterCreation/Gender_Male"); + Assets.OPTION_FEMALE = Content.Load("UI/CharacterCreation/Gender_Female"); + Assets.DIFFICULTY_SOFTCORE = Content.Load("UI/CharacterCreation/Button_Difficulty_Soft"); + Assets.DIFFICULTY_MEDIUMCORE = Content.Load("UI/CharacterCreation/Button_Difficulty_Med"); + Assets.DIFFICULTY_HARDCORE = Content.Load("UI/CharacterCreation/Button_Difficulty_Hard"); + Assets.HORIZONTAL_PICKER = Content.Load("UI/CharacterCreation/Hair_Selector"); + Assets.HORIZONTAL_BACKGROUND = Content.Load("UI/CharacterCreation/Hair_Background"); + Assets.FRAME = Content.Load("UI/CharacterCreation/Frame01"); + } + } +} diff --git a/Terraria/CreateCharacter/AttributeWidget`1.cs b/Terraria/CreateCharacter/AttributeWidget`1.cs new file mode 100644 index 0000000..0bafd6d --- /dev/null +++ b/Terraria/CreateCharacter/AttributeWidget`1.cs @@ -0,0 +1,78 @@ +// Type: Terraria.CreateCharacter.AttributeWidget`1 +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework; +using Terraria; + +namespace Terraria.CreateCharacter +{ + public abstract class AttributeWidget where T : ISelector + { + protected T widget; + + public string WidgetDescription { get; protected set; } + + public string ControlDescription { get; protected set; } + + internal AttributeWidget() + { + } + + public virtual void Draw(Vector2 position, float alpha) + { + this.widget.Draw(position, alpha); + } + + public void Update() + { + this.widget.Update(); + } + + public bool SelectLeft() + { + return this.widget.SelectLeft(); + } + + public bool SelectRight() + { + return this.widget.SelectRight(); + } + + public bool SelectUp() + { + return this.widget.SelectUp(); + } + + public bool SelectDown() + { + return this.widget.SelectDown(); + } + + public virtual void SetCursor(Vector2i cursor) + { + this.widget.SetCursor(cursor); + } + + public void Reset() + { + this.widget.Reset(); + } + + public void Back() + { + this.widget.CancelSelection(); + } + + public void Show() + { + this.widget.Show(); + } + + public void FlashSelection(int duration) + { + this.widget.FlashSelection(duration); + } + } +} diff --git a/Terraria/CreateCharacter/CategoryIcon.cs b/Terraria/CreateCharacter/CategoryIcon.cs new file mode 100644 index 0000000..1aae6e6 --- /dev/null +++ b/Terraria/CreateCharacter/CategoryIcon.cs @@ -0,0 +1,22 @@ +// Type: Terraria.CreateCharacter.CategoryIcon +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +namespace Terraria.CreateCharacter +{ + internal enum CategoryIcon + { + GENDER, + HAIR, + HAIRCOLOR, + EYES, + SKIN, + SHIRT, + UNDERSHIRT, + PANTS, + SHOES, + DIFFICULTY, + CATEGORY_COUNT, + } +} diff --git a/Terraria/CreateCharacter/CategorySelector.cs b/Terraria/CreateCharacter/CategorySelector.cs new file mode 100644 index 0000000..75dc9a2 --- /dev/null +++ b/Terraria/CreateCharacter/CategorySelector.cs @@ -0,0 +1,147 @@ +// Type: Terraria.CreateCharacter.CategorySelector +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; + +namespace Terraria.CreateCharacter +{ + internal class CategorySelector + { + private const float SCROLL_SPEED = 0.075f; + private const float UNSELECTED_SIZE = 0.75f; + private Texture2D[] options; + private Texture2D background; + private Texture2D backgroundSelected; + private Vector2 spacing; + public float ScrollTween; + public bool Scrolling; + private CategorySelector.ScrollDirection scrollDirection; + private int previouslySelected; + private int selected; + + public int SelectedIndex + { + get + { + return this.selected; + } + set + { + this.selected = Math.Min(this.options.Length - 1, Math.Max(0, value)); + } + } + + public CategorySelector(Texture2D[] options, Texture2D background, Texture2D backgroundSelected, Vector2 spacing) + { + this.options = options; + this.background = background; + this.backgroundSelected = backgroundSelected; + this.spacing = spacing; + this.selected = 0; + this.Scrolling = false; + this.ScrollTween = 0.0f; + this.scrollDirection = CategorySelector.ScrollDirection.PREVIOUS; + this.previouslySelected = 0; + } + + public void Update() + { + if (!this.Scrolling) + return; + this.ScrollTween -= 0.075f; + if ((double) this.ScrollTween >= 0.0) + return; + this.Scrolling = false; + this.ScrollTween = 0.0f; + } + + public void Draw(Vector2 position) + { + Vector2 vector2_1 = new Vector2((float) (this.background.Width >> 1), (float) (this.background.Height >> 1)); + Vector2 vector2_2 = new Vector2((float) (this.backgroundSelected.Width >> 1), (float) (this.backgroundSelected.Height >> 1)); + int num1 = 4; + int num2 = num1 * 2 + 1; + int num3 = num1 + 1; + for (int index1 = num2; index1 > 0; --index1) + { + int index2 = this.selected - num3 + index1; + if (index2 < 0) + index2 += this.options.Length; + else if (index2 >= this.options.Length) + index2 -= this.options.Length; + float num4 = (float) num1 - Math.Abs((float) (index1 - num3) + this.ScrollTween * (float) this.scrollDirection); + float num5 = Math.Max(0.75f, (float) (1.0 - 0.25 * (double) Math.Abs((float) (index1 - num3) + this.ScrollTween * (float) this.scrollDirection))); + if ((double) num4 >= 0.0 && (double) num5 >= 0.0) + { + Texture2D texture2D = this.options[index2]; + Vector2 vector2_3 = new Vector2((float) (texture2D.Width >> 1), (float) (texture2D.Height >> 1)); + Vector2 vector2_4 = this.spacing * this.ScrollTween * (float) this.scrollDirection; + Vector2 vector2_5 = position + this.spacing * (float) (index1 - num3) + vector2_4; + if (index2 == this.selected) + Main.spriteBatch.Draw(this.backgroundSelected, vector2_5, new Rectangle?(), Color.White * num4, 0.0f, vector2_2, num5, SpriteEffects.None, 0.0f); + else + Main.spriteBatch.Draw(this.background, vector2_5, new Rectangle?(), Color.White * num4, 0.0f, vector2_1, 1f, SpriteEffects.None, 0.0f); + Main.spriteBatch.Draw(texture2D, vector2_5, new Rectangle?(), Color.White * num4, 0.0f, vector2_3, 1f, SpriteEffects.None, 0.0f); + } + } + if (this.Scrolling) + return; + Vector2 vector2_6 = this.spacing * ((float) num1 - 0.25f); + Vector2 vector2_7 = position - vector2_6 - new Vector2(8f, 8f); + Rectangle rect = new Rectangle((int) vector2_7.X, (int) vector2_7.Y, 16, 16); + SpriteSheet<_sheetSprites>.DrawCentered(136, ref rect, SpriteEffects.FlipHorizontally); + Vector2 vector2_8 = position + vector2_6 - new Vector2(8f, 8f); + rect.X = (int) vector2_8.X; + rect.Y = (int) vector2_8.Y; + SpriteSheet<_sheetSprites>.DrawCentered(136, ref rect); + } + + private void StartScrolling(CategorySelector.ScrollDirection direction) + { + this.Scrolling = true; + this.ScrollTween = 1f; + this.scrollDirection = direction; + } + + public bool SelectNext() + { + bool flag = false; + if (!this.Scrolling) + { + this.previouslySelected = this.selected; + ++this.selected; + if (this.selected >= this.options.Length) + this.selected -= this.options.Length; + flag = true; + this.StartScrolling(CategorySelector.ScrollDirection.NEXT); + } + return flag; + } + + public bool SelectPrevious() + { + bool flag = false; + if (!this.Scrolling) + { + this.previouslySelected = this.selected; + --this.selected; + if (this.selected < 0) + this.selected += this.options.Length; + flag = true; + this.StartScrolling(CategorySelector.ScrollDirection.PREVIOUS); + } + return flag; + } + + private enum ScrollDirection + { + PREVIOUS = -1, + NEXT = 1, + } + } +} diff --git a/Terraria/CreateCharacter/ColorAttributeWidget.cs b/Terraria/CreateCharacter/ColorAttributeWidget.cs new file mode 100644 index 0000000..be46765 --- /dev/null +++ b/Terraria/CreateCharacter/ColorAttributeWidget.cs @@ -0,0 +1,34 @@ +// Type: Terraria.CreateCharacter.ColorAttributeWidget +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework; +using System; +using Terraria; + +namespace Terraria.CreateCharacter +{ + public class ColorAttributeWidget : AttributeWidget, IAttributeWidget + { + private Action modifier; + + private ColorAttributeWidget(ColorSelector widget, Action modifier, string widgetDescription, string controlDescription) + { + this.widget = widget; + this.modifier = modifier; + this.WidgetDescription = widgetDescription; + this.ControlDescription = controlDescription; + } + + public static ColorAttributeWidget Create(Action modifier, Vector2i resetValue, string widgetDescription, string controlDescription) + { + return new ColorAttributeWidget(new ColorSelector(Assets.COLOR_PALETTE, Assets.COLOR_PICKER, resetValue), modifier, widgetDescription, controlDescription); + } + + public void Apply(Player player) + { + this.modifier(player, this.widget.Selected); + } + } +} diff --git a/Terraria/CreateCharacter/ColorSelector.cs b/Terraria/CreateCharacter/ColorSelector.cs new file mode 100644 index 0000000..fdd2b45 --- /dev/null +++ b/Terraria/CreateCharacter/ColorSelector.cs @@ -0,0 +1,171 @@ +// Type: Terraria.CreateCharacter.ColorSelector +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; + +namespace Terraria.CreateCharacter +{ + public class ColorSelector : ISelector + { + private const int ITEM_WIDTH = 16; + private const int ITEM_HEIGHT = 16; + private const int ITEM_SELECTED_WIDTH = 20; + private const int ITEM_SELECTED_HEIGHT = 20; + private const int ITEM_SPACING = 6; + private Texture2D palette; + private Rectangle paletteBounds; + private Texture2D picker; + private Rectangle pickerBounds; + private Vector2i selected; + private Vector2i revertValue; + private Vector2i resetValue; + private int flashTimer; + public Color Selected; + + public ColorSelector(Texture2D palette, Texture2D picker, Vector2i resetValue) + { + this.palette = palette; + this.paletteBounds = palette.Bounds; + this.picker = picker; + this.pickerBounds = picker.Bounds; + this.selected = resetValue; + this.resetValue = resetValue; + this.resetValue = resetValue; + this.UpdateColor(); + } + + public void Update() + { + if (this.flashTimer <= 0) + return; + --this.flashTimer; + } + + public void Draw(Vector2 position, float alpha) + { + Rectangle rectangle1 = this.paletteBounds; + Rectangle rectangle2 = new Rectangle(0, 0, 1, 1); + Rectangle rectangle3 = new Rectangle(0, 0, 16, 16); + Vector2 position1 = new Vector2(); + Vector2i vector2i = new Vector2i(8, 8); + int num1 = rectangle1.Width * 22 - 6; + int num2 = rectangle1.Height * 22 - 6; + position.X -= (float) (num1 >> 1); + position.Y -= (float) (num2 >> 1); + position.X += 8f; + position.Y += 8f; + Color color1 = Color.White * alpha; + Color color2 = Color.Black * alpha; + for (int index1 = rectangle1.Height - 1; index1 > -1; --index1) + { + for (int index2 = rectangle1.Width - 1; index2 > -1; --index2) + { + if (this.selected.X != index2 || this.selected.Y != index1) + { + rectangle2.X = index2; + rectangle2.Y = index1; + rectangle3.X = (int) position.X + index2 * 22 - vector2i.X; + rectangle3.Y = (int) position.Y + index1 * 22 - vector2i.Y; + Main.spriteBatch.Draw(this.palette, rectangle3, new Rectangle?(rectangle2), color1); + position1.X = (float) (rectangle3.X - (this.pickerBounds.Width - 16 >> 1)); + position1.Y = (float) (rectangle3.Y - (this.pickerBounds.Height - 16 >> 1)); + Main.spriteBatch.Draw(this.picker, position1, color2); + } + } + } + Vector2 vector2 = new Vector2(); + vector2.X = position.X + (float) (this.selected.X * 22); + vector2.Y = position.Y + (float) (this.selected.Y * 22); + rectangle2.X = this.selected.X; + rectangle2.Y = this.selected.Y; + float num3 = this.flashTimer > 0 ? (float) (1.0 + 0.100000001490116 * (double) this.flashTimer) : 1f; + rectangle3.X = (int) position.X + this.selected.X * 22 - (int) ((double) vector2i.X * (double) num3); + rectangle3.Y = (int) position.Y + this.selected.Y * 22 - (int) ((double) vector2i.Y * (double) num3); + rectangle3.Width = (int) ((double) rectangle3.Width * (double) num3); + rectangle3.Height = (int) ((double) rectangle3.Height * (double) num3); + Main.spriteBatch.Draw(this.palette, rectangle3, new Rectangle?(rectangle2), color1); + Main.spriteBatch.Draw(this.picker, vector2, new Rectangle?(), color1, 0.0f, new Vector2((float) (this.pickerBounds.Width >> 1), (float) (this.pickerBounds.Height >> 1)), num3, SpriteEffects.None, 0.0f); + } + + private void UpdateColor() + { + Rectangle rectangle = new Rectangle(this.selected.X, this.selected.Y, 1, 1); + Color[] colorArray = new Color[1]; + this.palette.GetData(0, new Rectangle?(rectangle), (M0[]) colorArray, 0, 1); + this.Selected = colorArray[0]; + } + + public bool SelectLeft() + { + if (this.selected.X > 0) + --this.selected.X; + else + this.selected.X = this.paletteBounds.Width - 1; + this.UpdateColor(); + return true; + } + + public bool SelectRight() + { + if (this.selected.X < this.paletteBounds.Width - 1) + ++this.selected.X; + else + this.selected.X = 0; + this.UpdateColor(); + return true; + } + + public bool SelectUp() + { + if (this.selected.Y > 0) + --this.selected.Y; + else + this.selected.Y = this.paletteBounds.Height - 1; + this.UpdateColor(); + return true; + } + + public bool SelectDown() + { + if (this.selected.Y < this.paletteBounds.Height - 1) + ++this.selected.Y; + else + this.selected.Y = 0; + this.UpdateColor(); + return true; + } + + public void SetCursor(Vector2i cursor) + { + this.selected = cursor; + this.UpdateColor(); + } + + public void Reset() + { + this.selected = this.resetValue; + this.UpdateColor(); + } + + public void Show() + { + this.revertValue = this.selected; + this.flashTimer = 0; + } + + public void FlashSelection(int duration) + { + this.flashTimer = duration; + } + + public void CancelSelection() + { + this.selected = this.revertValue; + this.UpdateColor(); + } + } +} diff --git a/Terraria/CreateCharacter/Difficulty.cs b/Terraria/CreateCharacter/Difficulty.cs new file mode 100644 index 0000000..0b81782 --- /dev/null +++ b/Terraria/CreateCharacter/Difficulty.cs @@ -0,0 +1,15 @@ +// Type: Terraria.CreateCharacter.Difficulty +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +namespace Terraria.CreateCharacter +{ + public enum Difficulty + { + SOFTCORE, + MEDIUMCORE, + HARDCORE, + DIFFICULTY_COUNT, + } +} diff --git a/Terraria/CreateCharacter/DifficultyAttributeWidget.cs b/Terraria/CreateCharacter/DifficultyAttributeWidget.cs new file mode 100644 index 0000000..894e98b --- /dev/null +++ b/Terraria/CreateCharacter/DifficultyAttributeWidget.cs @@ -0,0 +1,39 @@ +// Type: Terraria.CreateCharacter.DifficultyAttributeWidget +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; + +namespace Terraria.CreateCharacter +{ + public class DifficultyAttributeWidget : AttributeWidget, IAttributeWidget + { + private Action modifier; + + private DifficultyAttributeWidget(DifficultySelector widget, Action modifier, string widgetDescription, string controlDescription) + { + this.widget = widget; + this.modifier = modifier; + this.WidgetDescription = widgetDescription; + this.ControlDescription = controlDescription; + } + + public static DifficultyAttributeWidget Create(Action modifier, Difficulty resetValue, string widgetDescription, string controlDescription) + { + return new DifficultyAttributeWidget(new DifficultySelector(new Texture2D[3] + { + Assets.DIFFICULTY_SOFTCORE, + Assets.DIFFICULTY_MEDIUMCORE, + Assets.DIFFICULTY_HARDCORE + }, resetValue), modifier, widgetDescription, controlDescription); + } + + public void Apply(Player player) + { + this.modifier(player, (byte) this.widget.Selected); + } + } +} diff --git a/Terraria/CreateCharacter/DifficultySelector.cs b/Terraria/CreateCharacter/DifficultySelector.cs new file mode 100644 index 0000000..0302528 --- /dev/null +++ b/Terraria/CreateCharacter/DifficultySelector.cs @@ -0,0 +1,180 @@ +// Type: Terraria.CreateCharacter.DifficultySelector +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; + +namespace Terraria.CreateCharacter +{ + public class DifficultySelector : ISelector + { + private static Vector2 TITLE_OFFSET = new Vector2(0.0f, -50f); + private static Vector2 DESCRIPTION_OFFSET = new Vector2(0.0f, 50f); + private static Vector2 SLIDE_OFFSET = new Vector2(120f, 0.0f); + private const float TRANSITION_SPEED = 0.1f; + private const int DESCRIPTION_ID_START = 29; + private const int TITLE_ID_START = 24; + private const int MAX_DIFFICULTY = 2; + private const int ARROW_OFFSET = 10; + public Difficulty Selected; + private Difficulty ResetValue; + private Texture2D[] DifficultyIcons; + private int FlashTimer; + private float TransitionTween; + private DifficultySelector.Direction TransitionDirection; + private Difficulty PreviousSelected; + + static DifficultySelector() + { + } + + public DifficultySelector(Texture2D[] difficultyIcons, Difficulty resetValue) + { + this.DifficultyIcons = difficultyIcons; + this.ResetValue = resetValue; + this.Selected = resetValue; + this.TransitionTween = 0.0f; + } + + public void Draw(Vector2 position, float alpha) + { + SpriteFont font = Terraria.UI.fontSmallOutline; + if ((double) this.TransitionTween > 0.0) + { + float num1 = (float) (1.0 - (double) Math.Min(this.TransitionTween, 0.5f) / 0.5); + float num2 = (float) (((double) Math.Max(0.5f, this.TransitionTween) - 0.5) / 0.5); + this.DrawDescription(this.PreviousSelected, position, alpha * num2); + this.DrawDescription(this.Selected, position, alpha * num1); + int num3 = (int) this.TransitionDirection; + this.DrawTitle(this.PreviousSelected, position + DifficultySelector.TITLE_OFFSET - DifficultySelector.SLIDE_OFFSET * (1f - this.TransitionTween) * (float) num3, 1f, this.TransitionTween); + this.DrawTitle(this.Selected, position + DifficultySelector.TITLE_OFFSET + DifficultySelector.SLIDE_OFFSET * this.TransitionTween * (float) num3, 1f, 1f - this.TransitionTween); + } + else + { + this.DrawTitle(this.Selected, position + DifficultySelector.TITLE_OFFSET, (float) (1.0 + 0.100000001490116 * (double) this.FlashTimer), alpha); + string text = Lang.menu[(int) (26 - this.Selected)]; + Vector2 vector2 = Terraria.UI.MeasureString(font, text); + if ((double) alpha > 0.899999976158142) + this.DrawArrows(position + DifficultySelector.TITLE_OFFSET, new Vector2((float) ((double) vector2.X * 0.5 + 10.0), 0.0f)); + this.DrawDescription(this.Selected, position, alpha); + } + } + + private void DrawTitle(Difficulty setting, Vector2 position, float scale, float alpha) + { + SpriteFont font = Terraria.UI.fontSmallOutline; + string str = Lang.menu[(int) (26 - setting)]; + Vector2 pivot = Terraria.UI.MeasureString(font, str); + pivot.X = (float) Math.Round((double) pivot.X * 0.5); + pivot.Y = (float) Math.Round((double) pivot.Y * 0.5); + Color color = setting != Difficulty.HARDCORE ? Color.White : Color.Red; + Terraria.UI.DrawString(font, str, position, color * alpha, 0.0f, pivot, scale); + } + + private void DrawArrows(Vector2 position, Vector2 spacing) + { + Vector2 vector2_1 = position - spacing - new Vector2(8f, 8f); + Rectangle rect = new Rectangle((int) vector2_1.X, (int) vector2_1.Y, 16, 16); + SpriteSheet<_sheetSprites>.DrawCentered(136, ref rect, SpriteEffects.FlipHorizontally); + Vector2 vector2_2 = position + spacing - new Vector2(8f, 8f); + rect.X = (int) vector2_2.X; + rect.Y = (int) vector2_2.Y; + SpriteSheet<_sheetSprites>.DrawCentered(136, ref rect); + } + + private void DrawDescription(Difficulty difficulty, Vector2 position, float alpha) + { + int index = (int) difficulty; + Texture2D texture2D = this.DifficultyIcons[index]; + Vector2 vector2 = new Vector2((float) (texture2D.Width >> 1), (float) (texture2D.Height >> 1)); + Main.spriteBatch.Draw(texture2D, position, new Rectangle?(), Color.White * alpha, 0.0f, vector2, (float) (1.0 + 0.100000001490116 * (double) this.FlashTimer), SpriteEffects.None, 0.0f); + string str = Lang.menu[31 - index]; + SpriteFont font = Terraria.UI.fontSmallOutline; + Vector2 pivot = Terraria.UI.MeasureString(font, str); + pivot.X = (float) Math.Round((double) pivot.X * 0.5); + pivot.Y = (float) Math.Round((double) pivot.Y * 0.5); + Terraria.UI.DrawString(font, str, position + DifficultySelector.DESCRIPTION_OFFSET, Color.White * alpha, 0.0f, pivot, 1f); + } + + public void Update() + { + if ((double) this.TransitionTween > 0.0) + this.TransitionTween -= 0.1f; + else + this.TransitionTween = 0.0f; + if (this.FlashTimer <= 0) + return; + --this.FlashTimer; + } + + public bool SelectLeft() + { + this.PreviousSelected = this.Selected; + int num = (int) (this.Selected - 1); + if (num < 0) + num = 2; + this.Selected = (Difficulty) num; + this.TransitionTween = 1f; + this.TransitionDirection = DifficultySelector.Direction.PREVIOUS; + return true; + } + + public bool SelectRight() + { + this.PreviousSelected = this.Selected; + int num = (int) (this.Selected + 1); + if (num > 2) + num = 0; + this.Selected = (Difficulty) num; + this.TransitionTween = 1f; + this.TransitionDirection = DifficultySelector.Direction.NEXT; + return true; + } + + public bool SelectUp() + { + return false; + } + + public bool SelectDown() + { + return false; + } + + public void SetCursor(Vector2i cursor) + { + this.Selected = (Difficulty) Math.Min(Math.Max(cursor.X, 0), 2); + } + + public void Reset() + { + this.Selected = this.ResetValue; + } + + public void Show() + { + this.ResetValue = this.Selected; + this.FlashTimer = 0; + } + + public void FlashSelection(int duration) + { + this.FlashTimer = duration; + } + + public void CancelSelection() + { + this.Selected = this.ResetValue; + } + + private enum Direction + { + PREVIOUS = -1, + NEXT = 1, + } + } +} diff --git a/Terraria/CreateCharacter/GenderAttributeWidget.cs b/Terraria/CreateCharacter/GenderAttributeWidget.cs new file mode 100644 index 0000000..594c0b6 --- /dev/null +++ b/Terraria/CreateCharacter/GenderAttributeWidget.cs @@ -0,0 +1,44 @@ +// Type: Terraria.CreateCharacter.GenderAttributeWidget +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; + +namespace Terraria.CreateCharacter +{ + public class GenderAttributeWidget : AttributeWidget, IAttributeWidget + { + private Action modifier; + + private GenderAttributeWidget(HorizontalListSelector widget, Action modifier, string widgetDescription, string controlDescription) + { + this.widget = widget; + this.modifier = modifier; + this.WidgetDescription = widgetDescription; + this.ControlDescription = controlDescription; + } + + public static GenderAttributeWidget Create(Action modifier, GenderAttributeWidget.Gender resetValue, string widgetDescription, string controlDescription) + { + return new GenderAttributeWidget(new HorizontalListSelector(new Texture2D[2] + { + Assets.OPTION_MALE, + Assets.OPTION_FEMALE + }, Assets.HORIZONTAL_BACKGROUND, Assets.HORIZONTAL_PICKER, resetValue == GenderAttributeWidget.Gender.MALE ? 0 : 1), modifier, widgetDescription, controlDescription); + } + + public void Apply(Player player) + { + this.modifier(player, this.widget.Selected == 0); + } + + public enum Gender + { + MALE, + FEMALE, + } + } +} diff --git a/Terraria/CreateCharacter/HairAttributeWidget.cs b/Terraria/CreateCharacter/HairAttributeWidget.cs new file mode 100644 index 0000000..4f0d18f --- /dev/null +++ b/Terraria/CreateCharacter/HairAttributeWidget.cs @@ -0,0 +1,33 @@ +// Type: Terraria.CreateCharacter.HairAttributeWidget +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using System; +using Terraria; + +namespace Terraria.CreateCharacter +{ + public class HairAttributeWidget : AttributeWidget, IAttributeWidget + { + private Action modifier; + + private HairAttributeWidget(HairSelector widget, Action modifier, string widgetDescription, string controlDescription) + { + this.widget = widget; + this.modifier = modifier; + this.WidgetDescription = widgetDescription; + this.ControlDescription = controlDescription; + } + + public static HairAttributeWidget Create(Action modifier, Vector2i resetValue, string widgetDescription, string controlDescription) + { + return new HairAttributeWidget(new HairSelector(9, Assets.HAIR_SOURCES, Assets.HAIR_BACKGROUND, Assets.HAIR_PICKER, resetValue), modifier, widgetDescription, controlDescription); + } + + public void Apply(Player player) + { + this.modifier(player, this.widget.Selected); + } + } +} diff --git a/Terraria/CreateCharacter/HairSelector.cs b/Terraria/CreateCharacter/HairSelector.cs new file mode 100644 index 0000000..fc17ef4 --- /dev/null +++ b/Terraria/CreateCharacter/HairSelector.cs @@ -0,0 +1,155 @@ +// Type: Terraria.CreateCharacter.HairSelector +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; + +namespace Terraria.CreateCharacter +{ + public class HairSelector : ISelector + { + private const int ITEM_SPACING = 2; + private Texture2D background; + private Texture2D picker; + private Vector2 pickerOrigin; + private int columns; + private int rows; + private Rectangle[] sources; + private int flashTimer; + private Vector2i selected; + private Vector2i revertValue; + private Vector2i resetValue; + + public int Selected + { + get + { + return this.selected.X + this.selected.Y * this.columns; + } + } + + public HairSelector(int columns, Rectangle[] sources, Texture2D background, Texture2D picker, Vector2i resetValue) + { + this.background = background; + this.picker = picker; + this.pickerOrigin = new Vector2((float) (picker.Bounds.Width >> 1), (float) (picker.Bounds.Height >> 1)); + this.columns = columns; + this.rows = sources.Length / columns; + this.sources = sources; + this.selected = resetValue; + this.revertValue = resetValue; + this.resetValue = resetValue; + } + + public void Update() + { + if (this.flashTimer <= 0) + return; + --this.flashTimer; + } + + public void Draw(Vector2 position, float alpha) + { + Rectangle bounds = this.background.Bounds; + int num1 = bounds.Width + 2; + int num2 = bounds.Height + 2; + int num3 = bounds.Width >> 1; + int num4 = bounds.Height >> 1; + int num5 = num1 * this.columns - 2; + int num6 = num2 * this.rows - 2; + position.X -= (float) (num5 >> 1); + position.Y -= (float) (num6 >> 1); + position.X += (float) num3; + position.Y += (float) num4; + Color color = Color.White * alpha; + Vector2 position1 = new Vector2(); + for (int index1 = this.rows - 1; index1 > -1; --index1) + { + int y = (int) position.Y + index1 * num2; + for (int index2 = this.columns - 1; index2 > -1; --index2) + { + if (index1 != this.selected.Y || index2 != this.selected.X) + { + int x = (int) position.X + index2 * num1; + int index3 = index1 * this.columns + index2; + position1.X = (float) (x - num3); + position1.Y = (float) (y - num4); + Main.spriteBatch.Draw(this.background, position1, color); + SpriteSheet<_sheetSprites>.DrawCentered(1269 + index3, x, y, this.sources[index3], color); + } + } + } + Vector2 vector2 = new Vector2(); + float scale = this.flashTimer > 0 ? (float) (1.0 + 0.100000001490116 * (double) this.flashTimer) : 1f; + vector2.X = position.X + (float) (this.selected.X * num1); + vector2.Y = position.Y + (float) (this.selected.Y * num2); + Main.spriteBatch.Draw(this.picker, vector2, new Rectangle?(), color, 0.0f, this.pickerOrigin, scale, SpriteEffects.None, 0.0f); + SpriteSheet<_sheetSprites>.DrawCentered(1269 + this.Selected, (int) vector2.X, (int) vector2.Y, this.sources[this.Selected], color, scale); + } + + public bool SelectLeft() + { + if (this.selected.X > 0) + --this.selected.X; + else + this.selected.X = this.columns - 1; + return true; + } + + public bool SelectRight() + { + if (this.selected.X < this.columns - 1) + ++this.selected.X; + else + this.selected.X = 0; + return true; + } + + public bool SelectUp() + { + if (this.selected.Y > 0) + --this.selected.Y; + else + this.selected.Y = this.rows - 1; + return true; + } + + public bool SelectDown() + { + if (this.selected.Y < this.rows - 1) + ++this.selected.Y; + else + this.selected.Y = 0; + return true; + } + + public void SetCursor(Vector2i cursor) + { + this.selected = cursor; + } + + public void Reset() + { + this.selected = this.resetValue; + } + + public void Show() + { + this.revertValue = this.selected; + this.flashTimer = 0; + } + + public void FlashSelection(int duration) + { + this.flashTimer = duration; + } + + public void CancelSelection() + { + this.selected = this.revertValue; + } + } +} diff --git a/Terraria/CreateCharacter/HorizontalListSelector.cs b/Terraria/CreateCharacter/HorizontalListSelector.cs new file mode 100644 index 0000000..dee47a5 --- /dev/null +++ b/Terraria/CreateCharacter/HorizontalListSelector.cs @@ -0,0 +1,136 @@ +// Type: Terraria.CreateCharacter.HorizontalListSelector +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; + +namespace Terraria.CreateCharacter +{ + public class HorizontalListSelector : ISelector + { + private const int ITEM_SPACING = 4; + private Texture2D[] options; + private Texture2D background; + private Vector2 backgroundOrigin; + private Texture2D picker; + private Vector2 pickerOrigin; + private int flashTimer; + public int Selected; + private int revertValue; + private int resetValue; + + public HorizontalListSelector(Texture2D[] options, Texture2D background, Texture2D picker, int resetValue) + { + this.background = background; + this.backgroundOrigin = new Vector2((float) (background.Width >> 1), (float) (background.Height >> 1)); + this.options = options; + this.picker = picker; + this.pickerOrigin = new Vector2((float) (picker.Bounds.Width >> 1), (float) (picker.Bounds.Height >> 1)); + this.Selected = resetValue; + this.revertValue = resetValue; + this.resetValue = resetValue; + } + + public void Update() + { + if (this.flashTimer <= 0) + return; + --this.flashTimer; + } + + public void Draw(Vector2 position, float alpha) + { + float num1 = this.flashTimer > 0 ? (float) (2.0 + 0.100000001490116 * (double) this.flashTimer) : 2f; + Color color = Color.White * alpha; + float num2 = (float) ((double) this.background.Width * 2.0 + 4.0); + int num3 = (this.options.Length - 1) * (int) num2 - 4; + position.X -= (float) (num3 >> 1); + Vector2 vector2_1 = Vector2.Zero; + Vector2 vector2_2 = Vector2.Zero; + Texture2D texture2D1 = (Texture2D) null; + for (int index = 0; index < this.options.Length; ++index) + { + Texture2D texture2D2 = this.options[index]; + Vector2 vector2_3 = new Vector2((float) (texture2D2.Width >> 1), (float) (texture2D2.Height >> 1)); + if (index == this.Selected) + { + texture2D1 = texture2D2; + vector2_2 = vector2_3; + vector2_1 = position; + } + else + { + Main.spriteBatch.Draw(this.background, position, new Rectangle?(), color, 0.0f, this.backgroundOrigin, 2f, SpriteEffects.None, 0.0f); + Main.spriteBatch.Draw(texture2D2, position, new Rectangle?(), color, 0.0f, vector2_3, 2f, SpriteEffects.None, 0.0f); + } + position.X += num2; + } + if (texture2D1 == null) + return; + Main.spriteBatch.Draw(this.picker, vector2_1, new Rectangle?(), color, 0.0f, this.pickerOrigin, num1, SpriteEffects.None, 0.0f); + Main.spriteBatch.Draw(texture2D1, vector2_1, new Rectangle?(), color, 0.0f, vector2_2, num1, SpriteEffects.None, 0.0f); + } + + public bool SelectLeft() + { + if (this.Selected > 0) + --this.Selected; + else + this.Selected = this.options.Length - 1; + return true; + } + + public bool SelectRight() + { + if (this.Selected < this.options.Length - 1) + ++this.Selected; + else + this.Selected = 0; + return true; + } + + public bool SelectUp() + { + return false; + } + + public bool SelectDown() + { + return false; + } + + public void Reset() + { + this.Selected = this.resetValue; + } + + public void Show() + { + this.revertValue = this.Selected; + this.flashTimer = 0; + } + + public void FlashSelection(int duration) + { + this.flashTimer = duration; + } + + public void CancelSelection() + { + this.Selected = this.revertValue; + } + + public void SetCursor(Vector2i cursor) + { + int num = cursor.X; + if (num < 0) + num = 0; + else if (num > this.options.Length - 1) + num = this.options.Length - 1; + this.Selected = num; + } + } +} diff --git a/Terraria/CreateCharacter/IAttributeWidget.cs b/Terraria/CreateCharacter/IAttributeWidget.cs new file mode 100644 index 0000000..d4ad7dd --- /dev/null +++ b/Terraria/CreateCharacter/IAttributeWidget.cs @@ -0,0 +1,41 @@ +// Type: Terraria.CreateCharacter.IAttributeWidget +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework; +using Terraria; + +namespace Terraria.CreateCharacter +{ + public interface IAttributeWidget + { + string ControlDescription { get; } + + string WidgetDescription { get; } + + void Draw(Vector2 position, float alpha); + + void Update(); + + bool SelectLeft(); + + bool SelectRight(); + + bool SelectUp(); + + bool SelectDown(); + + void Back(); + + void SetCursor(Vector2i cursor); + + void Apply(Player player); + + void Reset(); + + void Show(); + + void FlashSelection(int duration); + } +} diff --git a/Terraria/CreateCharacter/ISelector.cs b/Terraria/CreateCharacter/ISelector.cs new file mode 100644 index 0000000..a53d5c2 --- /dev/null +++ b/Terraria/CreateCharacter/ISelector.cs @@ -0,0 +1,35 @@ +// Type: Terraria.CreateCharacter.ISelector +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework; +using Terraria; + +namespace Terraria.CreateCharacter +{ + public interface ISelector + { + void Draw(Vector2 position, float alpha); + + void Update(); + + bool SelectLeft(); + + bool SelectRight(); + + bool SelectUp(); + + bool SelectDown(); + + void SetCursor(Vector2i cursor); + + void Reset(); + + void Show(); + + void FlashSelection(int duration); + + void CancelSelection(); + } +} diff --git a/Terraria/CreateCharacter/PlayerModifier.cs b/Terraria/CreateCharacter/PlayerModifier.cs new file mode 100644 index 0000000..87fd699 --- /dev/null +++ b/Terraria/CreateCharacter/PlayerModifier.cs @@ -0,0 +1,63 @@ +// Type: Terraria.CreateCharacter.PlayerModifier +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework; +using Terraria; + +namespace Terraria.CreateCharacter +{ + internal class PlayerModifier + { + public static void Hair(Player p, int val) + { + p.hair = (byte) val; + } + + public static void HairColor(Player p, Color val) + { + p.hairColor = val; + } + + public static void Shirt(Player p, Color val) + { + p.shirtColor = val; + } + + public static void Undershirt(Player p, Color val) + { + p.underShirtColor = val; + } + + public static void Pants(Player p, Color val) + { + p.pantsColor = val; + } + + public static void Shoes(Player p, Color val) + { + p.shoeColor = val; + } + + public static void Gender(Player p, bool val) + { + p.male = val; + } + + public static void Difficulty(Player p, byte val) + { + p.difficulty = val; + } + + public static void Eyes(Player p, Color val) + { + p.eyeColor = val; + } + + public static void Skin(Player p, Color val) + { + p.skinColor = val; + } + } +} diff --git a/Terraria/CreateCharacter/RandomCharacter.cs b/Terraria/CreateCharacter/RandomCharacter.cs new file mode 100644 index 0000000..f642f7c --- /dev/null +++ b/Terraria/CreateCharacter/RandomCharacter.cs @@ -0,0 +1,103 @@ +// Type: Terraria.CreateCharacter.RandomCharacter +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Terraria; + +namespace Terraria.CreateCharacter +{ + internal class RandomCharacter + { + private static Vector2i getRandomColor(FastRandom rnd) + { + int width = Assets.COLOR_PALETTE.Width; + int upperBound = Assets.COLOR_PALETTE.Height >> 1; + int num = Assets.COLOR_PALETTE.Height >> 2; + return new Vector2i(rnd.Next(width), rnd.Next(upperBound) + num); + } + + public static Vector2i[] create(FastRandom rnd) + { + RandomCharacter.HairGender[] hairGenderArray = new RandomCharacter.HairGender[36] + { + RandomCharacter.HairGender.Unisex, + RandomCharacter.HairGender.Male, + RandomCharacter.HairGender.Male, + RandomCharacter.HairGender.Male, + RandomCharacter.HairGender.Male, + RandomCharacter.HairGender.Female, + RandomCharacter.HairGender.Female, + RandomCharacter.HairGender.Male, + RandomCharacter.HairGender.Male, + RandomCharacter.HairGender.Female, + RandomCharacter.HairGender.Unisex, + RandomCharacter.HairGender.Female, + RandomCharacter.HairGender.Unisex, + RandomCharacter.HairGender.Unisex, + RandomCharacter.HairGender.Male, + RandomCharacter.HairGender.Male, + RandomCharacter.HairGender.Unisex, + RandomCharacter.HairGender.Male, + RandomCharacter.HairGender.Unisex, + RandomCharacter.HairGender.Male, + RandomCharacter.HairGender.Male, + RandomCharacter.HairGender.Female, + RandomCharacter.HairGender.Female, + RandomCharacter.HairGender.Male, + RandomCharacter.HairGender.Male, + RandomCharacter.HairGender.Female, + RandomCharacter.HairGender.Female, + RandomCharacter.HairGender.Unisex, + RandomCharacter.HairGender.Male, + RandomCharacter.HairGender.Female, + RandomCharacter.HairGender.Male, + RandomCharacter.HairGender.Male, + RandomCharacter.HairGender.Female, + RandomCharacter.HairGender.Unisex, + RandomCharacter.HairGender.Female, + RandomCharacter.HairGender.Male + }; + Vector2i[] vector2iArray1 = new Vector2i[6] + { + new Vector2i(3, 3), + new Vector2i(3, 3), + new Vector2i(3, 5), + new Vector2i(3, 7), + new Vector2i(0, 8), + new Vector2i(3, 0) + }; + Vector2i[] vector2iArray2 = new Vector2i[6] + { + new Vector2i(9, 4), + new Vector2i(3, 8), + new Vector2i(9, 7), + new Vector2i(3, 8), + new Vector2i(3, 8), + new Vector2i(2, 4) + }; + Vector2i[] vector2iArray3 = new Vector2i[10]; + int index1 = rnd.Next(36); + vector2iArray3[1] = new Vector2i(index1 % 9, index1 / 9); + RandomCharacter.HairGender hairGender = hairGenderArray[index1]; + int x = hairGender != RandomCharacter.HairGender.Male ? (hairGender != RandomCharacter.HairGender.Female ? rnd.Next(2) : 1) : 0; + vector2iArray3[0] = new Vector2i(x, 0); + int index2 = rnd.Next(vector2iArray1.Length); + vector2iArray3[4] = vector2iArray1[index2]; + vector2iArray3[3] = vector2iArray2[index2]; + vector2iArray3[2] = RandomCharacter.getRandomColor(rnd); + vector2iArray3[5] = RandomCharacter.getRandomColor(rnd); + vector2iArray3[6] = RandomCharacter.getRandomColor(rnd); + vector2iArray3[7] = RandomCharacter.getRandomColor(rnd); + vector2iArray3[8] = RandomCharacter.getRandomColor(rnd); + return vector2iArray3; + } + + private enum HairGender + { + Male, + Female, + Unisex, + } + } +} diff --git a/Terraria/CreateCharacter/UI.cs b/Terraria/CreateCharacter/UI.cs new file mode 100644 index 0000000..b16f413 --- /dev/null +++ b/Terraria/CreateCharacter/UI.cs @@ -0,0 +1,238 @@ +// Type: Terraria.CreateCharacter.UI +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Input; +using System; +using System.Text; +using Terraria; + +namespace Terraria.CreateCharacter +{ + public class UI + { + private const int FLASH_DURATION = 10; + private Terraria.UI parentUI; + private CategorySelector categoryWidget; + private IAttributeWidget[] attributes; + private int uiDelay; + private FastRandom rnd; + private Player player; + private IAttributeWidget previousAttribute; + private string header; + private Vector2 headerOrigin; + private string footer; + private Vector2 footerOrigin; + private SpriteFont textFont; + private float textScale; + + private IAttributeWidget SelectedAttribute + { + get + { + return this.attributes[this.categoryWidget.SelectedIndex]; + } + } + + private UI(Terraria.UI parentUI, CategorySelector categoryWidget, IAttributeWidget[] attributes) + { + this.parentUI = parentUI; + this.categoryWidget = categoryWidget; + this.attributes = attributes; + this.uiDelay = 0; + this.rnd = new FastRandom(); + this.textFont = Terraria.UI.fontBig; + this.textScale = 0.5f; + } + + public static UI Create(Terraria.UI parentUI) + { + CategorySelector categoryWidget = new CategorySelector(Assets.CATEGORY_ICONS, Assets.CATEGORY_BACKGROUND, Assets.CATEGORY_BACKGROUND_SELECTED, new Vector2(54f, 0.0f)); + IAttributeWidget[] attributes = new IAttributeWidget[10] + { + null, + (IAttributeWidget) HairAttributeWidget.Create(new Action(PlayerModifier.Hair), new Vector2i(4, 1), Lang.controls(Lang.CONTROLS.HAIR_TYPE), Lang.controls(Lang.CONTROLS.SELECT_TYPE)), + (IAttributeWidget) ColorAttributeWidget.Create(new Action(PlayerModifier.HairColor), new Vector2i(4, 6), Lang.controls(Lang.CONTROLS.HAIR_COLOR), Lang.controls(Lang.CONTROLS.SELECT_COLOR)), + null, + null, + (IAttributeWidget) ColorAttributeWidget.Create(new Action(PlayerModifier.Shirt), new Vector2i(4, 2), Lang.controls(Lang.CONTROLS.SHIRT_COLOR), Lang.controls(Lang.CONTROLS.SELECT_COLOR)), + (IAttributeWidget) ColorAttributeWidget.Create(new Action(PlayerModifier.Undershirt), new Vector2i(2, 6), Lang.controls(Lang.CONTROLS.UNDERSHIRT_COLOR), Lang.controls(Lang.CONTROLS.SELECT_COLOR)), + (IAttributeWidget) ColorAttributeWidget.Create(new Action(PlayerModifier.Pants), new Vector2i(9, 7), Lang.controls(Lang.CONTROLS.PANTS_COLOR), Lang.controls(Lang.CONTROLS.SELECT_COLOR)), + (IAttributeWidget) ColorAttributeWidget.Create(new Action(PlayerModifier.Shoes), new Vector2i(0, 0), Lang.controls(Lang.CONTROLS.SHOE_COLOR), Lang.controls(Lang.CONTROLS.SELECT_COLOR)), + null + }; + attributes[3] = (IAttributeWidget) ColorAttributeWidget.Create(new Action(PlayerModifier.Eyes), new Vector2i(9, 2), Lang.controls(Lang.CONTROLS.EYE_COLOR), Lang.controls(Lang.CONTROLS.SELECT_COLOR)); + attributes[4] = (IAttributeWidget) ColorAttributeWidget.Create(new Action(PlayerModifier.Skin), new Vector2i(3, 3), Lang.controls(Lang.CONTROLS.SKIN_COLOR), Lang.controls(Lang.CONTROLS.SELECT_COLOR)); + attributes[0] = (IAttributeWidget) GenderAttributeWidget.Create(new Action(PlayerModifier.Gender), GenderAttributeWidget.Gender.MALE, Lang.controls(Lang.CONTROLS.GENDER), Lang.controls(Lang.CONTROLS.SELECT_GENDER)); + attributes[9] = (IAttributeWidget) DifficultyAttributeWidget.Create(new Action(PlayerModifier.Difficulty), Difficulty.SOFTCORE, Lang.controls(Lang.CONTROLS.DIFFICULTY), Lang.controls(Lang.CONTROLS.SELECT_DIFFICULTY)); + return new UI(parentUI, categoryWidget, attributes); + } + + public void Update(Player player) + { + this.player = (Player) null; + if (this.uiDelay > 0) + --this.uiDelay; + bool flag1 = this.updateCategoryInput(player); + bool flag2 = this.updateWidgetInput(player); + if (flag1 || flag2) + { + if (this.categoryWidget.SelectedIndex == 0 && flag2) + Main.PlaySound(player.male ? 1 : 20); + else + Main.PlaySound(12); + this.uiDelay = 12; + } + this.categoryWidget.Update(); + if (this.previousAttribute != null) + this.previousAttribute.Update(); + this.SelectedAttribute.Update(); + if (this.parentUI.IsButtonTriggered(Buttons.Start)) + { + this.parentUI.ClearInput(); + this.parentUI.SetMenu(MenuMode.NAME_CHARACTER, true, false); + } + if (this.parentUI.IsBackButtonTriggered()) + this.parentUI.SetMenu(MenuMode.CONFIRM_LEAVE_CREATE_CHARACTER, true, false); + this.player = player; + } + + private bool IsButtonDown(Buttons button) + { + if (this.uiDelay == 0) + return this.parentUI.IsButtonDown(button); + else + return false; + } + + private bool updateCategoryInput(Player player) + { + bool flag = false; + IAttributeWidget selectedAttribute = this.SelectedAttribute; + if ((this.IsButtonDown(Buttons.RightShoulder) || this.parentUI.IsButtonTriggered(Buttons.A)) && this.categoryWidget.SelectNext()) + { + flag = true; + this.previousAttribute = selectedAttribute; + this.SelectedAttribute.Show(); + this.UpdateHeaderAndFooter(); + if (this.parentUI.IsButtonTriggered(Buttons.A)) + this.previousAttribute.FlashSelection(10); + } + if (this.IsButtonDown(Buttons.LeftShoulder) && this.categoryWidget.SelectPrevious()) + { + flag = true; + this.previousAttribute = selectedAttribute; + this.SelectedAttribute.Show(); + this.UpdateHeaderAndFooter(); + } + if (this.parentUI.IsButtonTriggered(Buttons.Y)) + { + this.Randomize(player); + flag = true; + } + return flag; + } + + private bool updateWidgetInput(Player player) + { + bool flag = false; + IAttributeWidget selectedAttribute = this.SelectedAttribute; + if (this.uiDelay == 0) + { + if (this.parentUI.IsDownButtonDown() && selectedAttribute.SelectDown()) + flag = true; + if (this.parentUI.IsUpButtonDown() && selectedAttribute.SelectUp()) + flag = true; + if (this.parentUI.IsLeftButtonDown() && selectedAttribute.SelectLeft()) + flag = true; + if (this.parentUI.IsRightButtonDown() && selectedAttribute.SelectRight()) + flag = true; + } + if (flag) + selectedAttribute.Apply(player); + return flag; + } + + private void UpdateHeaderAndFooter() + { + this.header = this.SelectedAttribute.WidgetDescription; + this.headerOrigin = this.textFont.MeasureString(this.header) * 0.5f; + this.footer = string.Format("{0} / {1}", (object) (this.categoryWidget.SelectedIndex + 1), (object) this.attributes.Length); + this.footerOrigin = this.textFont.MeasureString(this.footer) * 0.5f; + } + + public void Draw(WorldView view) + { + int num1 = Assets.FRAME.Width >> 1; + Vector2 position = new Vector2((float) (480 - num1), (float) (view.SAFE_AREA_OFFSET_T + 32)); + Vector2 zero = Vector2.Zero; + Main.spriteBatch.Draw(Assets.FRAME, position, Color.White); + zero.X = 228f; + zero.Y = 32f; + this.categoryWidget.Draw(position + zero); + zero.Y = 204f; + if (this.categoryWidget.Scrolling) + { + float num2 = this.categoryWidget.ScrollTween; + float num3 = Math.Min(num2, 0.5f) / 0.5f; + float alpha = (float) (((double) Math.Max(0.5f, num2) - 0.5) / 0.5); + this.previousAttribute.Draw(position + zero, alpha); + this.SelectedAttribute.Draw(position + zero, 1f - num3); + } + else + this.SelectedAttribute.Draw(position + zero, 1f); + zero.Y = 78f; + Main.spriteBatch.DrawString(this.textFont, this.header, position + zero, Color.White, 0.0f, this.headerOrigin, this.textScale, SpriteEffects.None, 0.0f); + zero.Y = 340f; + Main.spriteBatch.DrawString(this.textFont, this.footer, position + zero, Color.White, 0.0f, this.footerOrigin, this.textScale, SpriteEffects.None, 0.0f); + zero.Y = 385f; + zero.X = (float) num1; + string text = Lang.controls(Lang.CONTROLS.CREATE_CHARACTER); + Vector2 vector2 = this.textFont.MeasureString(text); + Main.spriteBatch.DrawString(this.textFont, text, position + zero, Color.White, 0.0f, vector2 * 0.5f, this.textScale, SpriteEffects.None, 0.0f); + if (this.player == null) + return; + this.player.velocity.X = 1f; + this.player.PlayerFrame(); + zero.X = 520f; + zero.Y = 110f; + this.parentUI.DrawPlayer(this.player, position + zero, 4f); + } + + public void Randomize(Player player) + { + Vector2i[] vector2iArray = RandomCharacter.create(this.rnd); + for (int index = 0; index < this.attributes.Length; ++index) + { + if (index != 9) + { + IAttributeWidget attributeWidget = this.attributes[index]; + attributeWidget.SetCursor(vector2iArray[index]); + attributeWidget.Apply(player); + } + } + } + + public void ApplyDefaultAttributes(Player player) + { + this.Randomize(player); + IAttributeWidget attributeWidget = this.attributes[9]; + attributeWidget.Reset(); + attributeWidget.Apply(player); + this.categoryWidget.SelectedIndex = 0; + this.UpdateHeaderAndFooter(); + } + + public void ControlDescription(StringBuilder strBuilder) + { + strBuilder.Append(Lang.controls(Lang.CONTROLS.CHANGE_CATEGORY)); + strBuilder.Append(' '); + strBuilder.Append(Lang.controls(Lang.CONTROLS.BACK)); + strBuilder.Append(' '); + strBuilder.Append(Lang.controls(Lang.CONTROLS.RANDOMIZE)); + } + } +} diff --git a/Terraria/CreateCharacter/WidgetAnimation.cs b/Terraria/CreateCharacter/WidgetAnimation.cs new file mode 100644 index 0000000..1bb69b4 --- /dev/null +++ b/Terraria/CreateCharacter/WidgetAnimation.cs @@ -0,0 +1,62 @@ +// Type: Terraria.CreateCharacter.WidgetAnimation +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework; + +namespace Terraria.CreateCharacter +{ + public class WidgetAnimation + { + private Vector2 startPosition; + private Vector2 delta; + private float progress; + private float speed; + + public bool Finished + { + get + { + return (double) this.progress >= 1.0; + } + } + + public Vector2 Position + { + get + { + return this.startPosition + this.delta * this.progress; + } + } + + public float Alpha + { + get + { + return this.progress; + } + } + + public WidgetAnimation(Vector2 startPosition, Vector2 endPosition, float speed) + { + this.startPosition = startPosition; + this.delta = endPosition - startPosition; + this.speed = speed; + this.progress = 0.0f; + } + + public void Start() + { + this.progress = 0.0f; + } + + public void Update() + { + this.progress += this.speed; + if ((double) this.progress < 1.0) + return; + this.progress = 1f; + } + } +} diff --git a/Terraria/Credits.cs b/Terraria/Credits.cs new file mode 100644 index 0000000..7ecb9b5 --- /dev/null +++ b/Terraria/Credits.cs @@ -0,0 +1,47 @@ +// Type: Terraria.Credits +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework; + +namespace Terraria +{ + public static class Credits + { + private const int SCROLL_SPEED = 2; + private const string THE_CREDITS = "\r\nPublished by 505 Games\r\n505 Games and the 505 Games logo are registered trademarks of 505 Games.\r\nAll rights reserved.\r\n\r\n\r\nRe-Logic\r\n\r\nCreator/Lead Developer\r\nAndrew \"Redigit\" Spinks\r\n\r\nGraphic Design\r\nAndrew \"Redigit\" Spinks\r\nFinn \"Tiy\" Brice\r\nGabriel \"Red Yoshi\" Kiesshau\r\nJamison \"Lazure\" Hayes\r\n\r\nCreative Consultation/Production Support\r\nJeremy \"Blue\" Guerrette\r\nDavid \"D-Town\" Phelps\r\nDustin \"Splugen\" Gunter\r\n\r\nBusiness Director\r\nDavid \"D-Town\" Phelps\r\n\r\nBeta/QA Testers\r\nGabriel \"Red Yoshi\" Kiesshau\r\nKyle \"Kley\" Hodge\r\nSteven \"Twitchy\" French\r\nBrian \"TGS\" Gilliford\r\nCheah Jun Siang\r\nZach \"Olink\" Piispanen\r\nTyler \"BurnZeZ\" Whiteman\r\nLisa \"Lils\" Chiu\r\nAtri \"m4sterbr0s\" Maharaj\r\nKaleb \"JesusLlama\" Regalado\r\nJamison \"Lazure\" Hayes\r\nIgor \"Conker\" Magi Marinho\r\nElias \"Elbow\" Naddaf\r\nValtteri Nieminen\r\nJonathan \"FallingSnow\" Poholarz\r\nBrandon Thomas\r\nWilliam \"Ignoritus\" Coffey\r\nMike \"Trinity Flash\" Dunn\r\nRyan \"Namyrr\" Le\r\nDaniel \"DMF\" Faria\r\nRobert \"qig\" Buchanan\r\nAlexaunder \"as303298\" Savoy\r\nAlexander \"Vandarx\" Reaves\r\nBalázs \"Mamaluigi\" Makai\r\nDaniel \"Garro\" Berner \r\nTyler \"Quill\" Warr\r\nAndrew \"Andydark\" Windmiller\r\n\r\nSpecial Thanks to\r\nKane Hart, all the guys and gals at Curse and TerrariaOnline.com,\r\nthe IRC operators, the LPers, and all the fans for your passion and continued support!\r\n\r\n\r\n\r\nEngine Software\r\n\r\n\r\nExecutive Producer\r\nIvo Wubbels\r\n\r\n\r\nProducer\r\nJeroen Schmitz\r\n\r\n\r\nLead Programmer\r\nJan-Lieuwe Koopmans\r\n\r\n\r\nProgrammer\r\nBart Veldstra\r\n\r\n\r\nArt Director\r\nSandra Meijer\r\n\r\n\r\nArtists\r\nAaron Willemsen\r\nMarco Willemsen\r\n\r\n\r\nGame Design and testing\r\nHiroshi Wijmer\r\n\r\n\r\n\r\n\r\n\r\n505 Games s.r.l\r\n\r\n\r\nProduction:\r\n\r\nProducer\r\nDavid Welch\r\n\r\n\r\nProduction Coordinator\r\nMichael Greening\r\n\r\n\r\nDevelopment Director\r\nMichael Meischeid\r\n\r\n\r\nSubmissions Managers\nChiara Pasquini\r\nMarcello Monti\r\nDavide Racah\nJohn Sweeney\r\n\r\n\r\nQA Manager\r\nEsther Partschefeld\r\n\r\n\r\nProduction Manager\r\nStefano Stalla\r\n\r\n\r\nBusiness Development Associate\r\nKimberley Rizzo\r\n\r\n\r\n\r\nBrand:\r\n\r\nHead Of Global Brand\r\nTim Woodley\r\n\r\nGlobal Brand Manager\r\nJohn Merchant\r\n\r\nAssistant Brand Manager\r\nRodrigo De La Pedraja\r\n\r\nGlobal Brand Director\r\nMelissa Menton\r\n\r\n\r\n\r\nCreative Services:\r\n\r\nCreative Services Designers\r\nRebecca Meyer\r\nAndrea Quinteri\r\n\r\nStudio Manager\r\nJames Howes\r\n\r\nCreative Director\r\nMark Stevens\r\n\r\n\r\n\r\nCommercial, Marketing & PR:\r\n\r\nPR Director, North America\r\nLisa Fields\r\n\r\nEuropean PR Manager\r\nGreg Jones\r\n\r\nSenior Marketing Services Manager\r\nHoward Liebeskind\r\n\r\n\r\n\r\nOperations:\r\n\r\nPublishing Manager\r\nSilvana Greenfield\r\n\r\nSales Operations Analyst\r\nDawn-Marie Sable\r\n\r\n\r\n\r\nManagement\r\n\r\nPresident, 505 Games Inc\r\nIan Howe\r\n\r\nVP of Operations\r\nNic Ashford\r\n\r\nVP of Sales\r\nGary Kinnsch\n\n\n\nFunctional QA\n\nEC-i\nGlobalStep LLC\n\nLocalisation QA\n\nGTL Media\n\nTranslation\n\r\nTranslate Plus Limited\r\n\r\n\r\n\r\n\r\n\r\n\r\nThanks for playing!\r\n"; + private static CompiledText text; + private static int scrollY; + + public static void Init() + { + if (Credits.text == null) + Credits.text = new CompiledText("\r\nPublished by 505 Games\r\n505 Games and the 505 Games logo are registered trademarks of 505 Games.\r\nAll rights reserved.\r\n\r\n\r\nRe-Logic\r\n\r\nCreator/Lead Developer\r\nAndrew \"Redigit\" Spinks\r\n\r\nGraphic Design\r\nAndrew \"Redigit\" Spinks\r\nFinn \"Tiy\" Brice\r\nGabriel \"Red Yoshi\" Kiesshau\r\nJamison \"Lazure\" Hayes\r\n\r\nCreative Consultation/Production Support\r\nJeremy \"Blue\" Guerrette\r\nDavid \"D-Town\" Phelps\r\nDustin \"Splugen\" Gunter\r\n\r\nBusiness Director\r\nDavid \"D-Town\" Phelps\r\n\r\nBeta/QA Testers\r\nGabriel \"Red Yoshi\" Kiesshau\r\nKyle \"Kley\" Hodge\r\nSteven \"Twitchy\" French\r\nBrian \"TGS\" Gilliford\r\nCheah Jun Siang\r\nZach \"Olink\" Piispanen\r\nTyler \"BurnZeZ\" Whiteman\r\nLisa \"Lils\" Chiu\r\nAtri \"m4sterbr0s\" Maharaj\r\nKaleb \"JesusLlama\" Regalado\r\nJamison \"Lazure\" Hayes\r\nIgor \"Conker\" Magi Marinho\r\nElias \"Elbow\" Naddaf\r\nValtteri Nieminen\r\nJonathan \"FallingSnow\" Poholarz\r\nBrandon Thomas\r\nWilliam \"Ignoritus\" Coffey\r\nMike \"Trinity Flash\" Dunn\r\nRyan \"Namyrr\" Le\r\nDaniel \"DMF\" Faria\r\nRobert \"qig\" Buchanan\r\nAlexaunder \"as303298\" Savoy\r\nAlexander \"Vandarx\" Reaves\r\nBalázs \"Mamaluigi\" Makai\r\nDaniel \"Garro\" Berner \r\nTyler \"Quill\" Warr\r\nAndrew \"Andydark\" Windmiller\r\n\r\nSpecial Thanks to\r\nKane Hart, all the guys and gals at Curse and TerrariaOnline.com,\r\nthe IRC operators, the LPers, and all the fans for your passion and continued support!\r\n\r\n\r\n\r\nEngine Software\r\n\r\n\r\nExecutive Producer\r\nIvo Wubbels\r\n\r\n\r\nProducer\r\nJeroen Schmitz\r\n\r\n\r\nLead Programmer\r\nJan-Lieuwe Koopmans\r\n\r\n\r\nProgrammer\r\nBart Veldstra\r\n\r\n\r\nArt Director\r\nSandra Meijer\r\n\r\n\r\nArtists\r\nAaron Willemsen\r\nMarco Willemsen\r\n\r\n\r\nGame Design and testing\r\nHiroshi Wijmer\r\n\r\n\r\n\r\n\r\n\r\n505 Games s.r.l\r\n\r\n\r\nProduction:\r\n\r\nProducer\r\nDavid Welch\r\n\r\n\r\nProduction Coordinator\r\nMichael Greening\r\n\r\n\r\nDevelopment Director\r\nMichael Meischeid\r\n\r\n\r\nSubmissions Managers\nChiara Pasquini\r\nMarcello Monti\r\nDavide Racah\nJohn Sweeney\r\n\r\n\r\nQA Manager\r\nEsther Partschefeld\r\n\r\n\r\nProduction Manager\r\nStefano Stalla\r\n\r\n\r\nBusiness Development Associate\r\nKimberley Rizzo\r\n\r\n\r\n\r\nBrand:\r\n\r\nHead Of Global Brand\r\nTim Woodley\r\n\r\nGlobal Brand Manager\r\nJohn Merchant\r\n\r\nAssistant Brand Manager\r\nRodrigo De La Pedraja\r\n\r\nGlobal Brand Director\r\nMelissa Menton\r\n\r\n\r\n\r\nCreative Services:\r\n\r\nCreative Services Designers\r\nRebecca Meyer\r\nAndrea Quinteri\r\n\r\nStudio Manager\r\nJames Howes\r\n\r\nCreative Director\r\nMark Stevens\r\n\r\n\r\n\r\nCommercial, Marketing & PR:\r\n\r\nPR Director, North America\r\nLisa Fields\r\n\r\nEuropean PR Manager\r\nGreg Jones\r\n\r\nSenior Marketing Services Manager\r\nHoward Liebeskind\r\n\r\n\r\n\r\nOperations:\r\n\r\nPublishing Manager\r\nSilvana Greenfield\r\n\r\nSales Operations Analyst\r\nDawn-Marie Sable\r\n\r\n\r\n\r\nManagement\r\n\r\nPresident, 505 Games Inc\r\nIan Howe\r\n\r\nVP of Operations\r\nNic Ashford\r\n\r\nVP of Sales\r\nGary Kinnsch\n\n\n\nFunctional QA\n\nEC-i\nGlobalStep LLC\n\nLocalisation QA\n\nGTL Media\n\nTranslation\n\r\nTranslate Plus Limited\r\n\r\n\r\n\r\n\r\n\r\n\r\nThanks for playing!\r\n", 864, UI.styleFontSmallOutline, CompiledText.MarkupType.Html); + Credits.scrollY = 540; + } + + public static void Update() + { + if (UI.main.IsBackButtonTriggered()) + { + Credits.text = (CompiledText) null; + UI.main.PrevMenu(-1); + } + else + { + if (-Credits.scrollY >= (int) Credits.text.Height - 270 || UI.main.IsUpButtonDown()) + return; + Credits.scrollY -= 2; + if (!UI.main.IsDownButtonDown()) + return; + Credits.scrollY -= 2; + } + } + + public static void Draw() + { + Credits.text.Draw(Main.spriteBatch, new Rectangle(48, Credits.scrollY, 864, (int) Credits.text.Height), new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue), new Color((int) byte.MaxValue, 212, 0, (int) byte.MaxValue)); + } + } +} diff --git a/Terraria/Dust.cs b/Terraria/Dust.cs new file mode 100644 index 0000000..bfc3602 --- /dev/null +++ b/Terraria/Dust.cs @@ -0,0 +1,73 @@ +// Type: Terraria.Dust +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework; + +namespace Terraria +{ + public struct Dust + { + public const int NUM_GLOBAL = 256; + public const int NUM_LOCAL = 128; + public byte active; + public bool noGravity; + public bool noLight; + public ushort type; + public short alpha; + public Color color; + public float fadeIn; + public float rotation; + public float scale; + public Rectangle frame; + public Vector2 position; + public Vector2 velocity; + + public void Init() + { + this.active = (byte) 0; + this.noGravity = false; + this.noLight = false; + this.type = (ushort) 0; + this.fadeIn = 0.0f; + } + + public void GetAlpha(ref Color newColor) + { + if ((int) this.type == 6 || (int) this.type == 75 || ((int) this.type == 20 || (int) this.type == 21)) + newColor.A = (byte) 25; + else if (((int) this.type == 68 || (int) this.type == 70) && this.noGravity) + newColor = new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0); + else if ((int) this.type == 66) + newColor.A = (byte) 0; + else if ((int) this.type == 71) + newColor = new Color(200, 200, 200, 0); + else if ((int) this.type == 72) + { + newColor = new Color(200, 200, 200, 200); + } + else + { + float num = (float) ((int) byte.MaxValue - (int) this.alpha) * 0.003921569f; + if ((int) this.type == 15 || (int) this.type == 29 || ((int) this.type == 35 || (int) this.type == 41) || ((int) this.type == 44 || (int) this.type == 27 || ((int) this.type == 45 || (int) this.type == 55)) || ((int) this.type == 56 || (int) this.type == 57 || ((int) this.type == 58 || (int) this.type == 73) || (int) this.type == 74)) + num = (float) (((double) num + 3.0) * 0.25); + else if ((int) this.type == 43) + num = (float) (((double) num + 9.0) * 0.100000001490116); + newColor.R = (byte) ((double) newColor.R * (double) num); + newColor.G = (byte) ((double) newColor.G * (double) num); + newColor.B = (byte) ((double) newColor.B * (double) num); + newColor.A -= (byte) this.alpha; + } + } + + public void GetColor(ref Color newColor) + { + int r = (int) this.color.R - ((int) byte.MaxValue - (int) newColor.R); + int g = (int) this.color.G - ((int) byte.MaxValue - (int) newColor.G); + int b = (int) this.color.B - ((int) byte.MaxValue - (int) newColor.B); + int a = (int) this.color.A - ((int) byte.MaxValue - (int) newColor.A); + newColor = new Color(r, g, b, a); + } + } +} diff --git a/Terraria/DustPool.cs b/Terraria/DustPool.cs new file mode 100644 index 0000000..e6da6a0 --- /dev/null +++ b/Terraria/DustPool.cs @@ -0,0 +1,701 @@ +// Type: Terraria.DustPool +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework; +using System; + +namespace Terraria +{ + public struct DustPool + { + public WorldView view; + public short snowDust; + public short lavaBubbles; + public short nextDust; + public short size; + public Dust[] dust; + + public DustPool(WorldView v, int sizePower2) + { + this.view = v; + this.snowDust = (short) 0; + this.lavaBubbles = (short) 0; + this.nextDust = (short) 0; + this.size = (short) sizePower2; + this.dust = new Dust[sizePower2]; + } + + public void Init() + { + for (int index = (int) this.size - 1; index >= 0; --index) + this.dust[index].Init(); + } + + private bool ClipDust(int x, int y) + { + if (this.view == null) + return !WorldView.AnyViewContains(x, y); + else + return !this.view.clipArea.Contains(x, y); + } + + public unsafe Dust* NewDust(int Type, ref Rectangle r, double SpeedX = 0.0, double SpeedY = 0.0, int Alpha = 0, Color newColor = null, double Scale = 1.0) + { + return this.NewDust(r.X, r.Y, r.Width, r.Height, Type, SpeedX, SpeedY, Alpha, newColor, Scale); + } + + public unsafe Dust* NewDust(int X, int Y, int Width, int Height, int Type, double SpeedX = 0.0, double SpeedY = 0.0, int Alpha = 0, Color newColor = null, double Scale = 1.0) + { + if (this.ClipDust(X, Y)) + return (Dust*) null; + int num1 = (int) this.nextDust; + int num2 = (int) this.size - 1; + for (int index1 = 0; index1 <= num2; ++index1) + { + int index2 = num1 & num2; + fixed (Dust* dustPtr = &this.dust[index2]) + { + if ((int) dustPtr->active == 0) + { + dustPtr->active = (byte) 1; + dustPtr->noGravity = false; + dustPtr->noLight = false; + dustPtr->type = (ushort) Type; + dustPtr->color = newColor; + dustPtr->alpha = (short) Alpha; + dustPtr->fadeIn = 0.0f; + dustPtr->rotation = 0.0f; + dustPtr->scale = (float) (Scale + (double) Main.rand.Next(-20, 21) * 0.01 * Scale); + dustPtr->frame.X = 10 * Type; + dustPtr->frame.Y = 10 * Main.rand.Next(3); + dustPtr->frame.Width = 8; + dustPtr->frame.Height = 8; + int num3 = Width; + int num4 = Height; + if (num3 < 5) + num3 = 5; + if (num4 < 5) + num4 = 5; + dustPtr->position.X = (float) (X + Main.rand.Next(num3 - 4) + 4); + dustPtr->position.Y = (float) (Y + Main.rand.Next(num4 - 4) + 4); + if (Type == 6 || Type == 75 || Type == 29 || Type >= 59 && Type <= 65) + { + dustPtr->velocity.X = (float) (((double) Main.rand.Next(-20, 21) * 0.1 + SpeedX) * 0.3); + dustPtr->velocity.Y = (float) Main.rand.Next(-10, 6) * 0.1f; + IntPtr num5 = (IntPtr) dustPtr; + double num6 = (double) ((Dust*) num5)->scale * 0.699999988079071; + ((Dust*) num5)->scale = (float) num6; + } + else if (Type == 33 || Type == 52) + { + dustPtr->alpha = (short) 170; + dustPtr->velocity.X = (float) (((double) Main.rand.Next(-20, 21) * 0.1 + SpeedX) * 0.5); + dustPtr->velocity.Y = (float) (((double) Main.rand.Next(-20, 21) * 0.1 + SpeedY) * 0.5 + 1.0); + } + else if (Type == 41) + { + dustPtr->velocity.X = 0.0f; + dustPtr->velocity.Y = 0.0f; + } + else if (Type == 34) + { + dustPtr->position.Y -= 8f; + if (!Collision.WetCollision(ref dustPtr->position, 4, 4)) + { + dustPtr->active = (byte) 0; + this.nextDust = (short) index2; + return dustPtr; + } + else + { + dustPtr->position.Y += 8f; + dustPtr->velocity.X = (float) (((double) Main.rand.Next(-20, 21) * 0.1 + SpeedX) * 0.1); + dustPtr->velocity.Y = -0.5f; + } + } + else if (Type == 35) + { + dustPtr->velocity.X = (float) (((double) Main.rand.Next(-20, 21) * 0.1 + SpeedX) * 0.1); + dustPtr->velocity.Y = -0.5f; + } + else + { + dustPtr->velocity.X = (float) ((double) Main.rand.Next(-20, 21) * 0.1 + SpeedX); + dustPtr->velocity.Y = (float) ((double) Main.rand.Next(-20, 21) * 0.1 + SpeedY); + } + this.nextDust = (short) (index2 + 1); + return dustPtr; + } + else + { + // ISSUE: __unpin statement + __unpin(dustPtr); + ++num1; + } + } + } + return (Dust*) null; + } + + public unsafe void UpdateDust() + { + this.lavaBubbles = (short) 0; + this.snowDust = (short) 0; + Vector3 rgb = new Vector3(); + fixed (Dust* dustPtr1 = this.dust) + { + Dust* dustPtr2 = dustPtr1; + for (int index = (int) this.size - 1; index >= 0; --index) + { + if ((int) dustPtr2->active != 0) + { + int num1 = (int) dustPtr2->type; + float num2 = dustPtr2->scale; + dustPtr2->position.X += dustPtr2->velocity.X; + dustPtr2->position.Y += dustPtr2->velocity.Y; + int x = (int) dustPtr2->position.X; + int y1 = (int) dustPtr2->position.Y; + if (num1 == 6 || num1 == 75 || num1 == 29 || num1 >= 59 && num1 <= 65) + { + if (!dustPtr2->noLight) + { + if (this.ClipDust(x, y1)) + { + dustPtr2->active = (byte) 0; + goto label_220; + } + else + { + num2 *= 1.4f; + switch (num1) + { + case 59: + if ((double) num2 > 0.800000011920929) + num2 = 0.8f; + rgb.X = 0.0f; + rgb.Y = num2 * 0.1f; + rgb.Z = num2 * 1.3f; + break; + case 60: + if ((double) num2 > 0.800000011920929) + num2 = 0.8f; + rgb.X = num2; + rgb.Y = rgb.Z = num2 * 0.1f; + break; + case 61: + if ((double) num2 > 0.800000011920929) + num2 = 0.8f; + rgb.X = 0.0f; + rgb.Y = num2; + rgb.Z = num2 * 0.1f; + break; + case 62: + if ((double) num2 > 0.800000011920929) + num2 = 0.8f; + rgb.X = rgb.Z = num2 * 0.9f; + rgb.Y = 0.0f; + break; + case 64: + if ((double) num2 > 0.800000011920929) + num2 = 0.8f; + rgb.X = rgb.Y = num2 * 0.9f; + rgb.Z = 0.0f; + break; + case 65: + if ((double) num2 > 0.800000011920929) + num2 = 0.8f; + rgb.X = (float) (0.5 * (double) Main.demonTorch + 1.0 * (1.0 - (double) Main.demonTorch)); + rgb.Y = 0.3f; + rgb.Z = Main.demonTorch + (float) (0.5 * (1.0 - (double) Main.demonTorch)); + break; + case 75: + if ((double) num2 > 1.0) + num2 = 1f; + rgb.X = num2 * 0.7f; + rgb.Y = num2; + rgb.Z = num2 * 0.2f; + break; + case 6: + if ((double) num2 > 0.600000023841858) + num2 = 0.6f; + rgb.X = num2; + rgb.Y = num2 * 0.65f; + rgb.Z = num2 * 0.4f; + break; + case 29: + if ((double) num2 > 1.0) + num2 = 1f; + rgb.X = num2 * 0.1f; + rgb.Y = num2 * 0.4f; + rgb.Z = num2; + break; + default: + if ((double) num2 > 0.800000011920929) + num2 = 0.8f; + rgb.X = rgb.Y = rgb.Z = num2 * 1.3f; + break; + } + Lighting.addLight(x >> 4, y1 >> 4, rgb); + } + } + if (!dustPtr2->noGravity) + dustPtr2->velocity.Y += 0.05f; + } + else if (num1 == 14 || num1 == 16 || num1 == 46) + { + dustPtr2->velocity.X *= 0.98f; + dustPtr2->velocity.Y *= 0.98f; + } + else if (num1 == 31) + { + dustPtr2->velocity.X *= 0.98f; + dustPtr2->velocity.Y *= 0.98f; + if (dustPtr2->noGravity) + { + dustPtr2->alpha += (short) 4; + if ((int) dustPtr2->alpha > (int) byte.MaxValue) + { + dustPtr2->active = (byte) 0; + goto label_220; + } + else + { + dustPtr2->velocity.X *= 1.02f; + dustPtr2->velocity.Y *= 1.02f; + dustPtr2->scale += 0.02f; + } + } + } + else if (num1 == 32) + { + dustPtr2->scale -= 0.01f; + dustPtr2->velocity.X *= 0.96f; + dustPtr2->velocity.Y += 0.1f; + } + else if (num1 == 43) + { + dustPtr2->rotation += 0.1f * dustPtr2->scale; + if ((double) num2 > 0.0480000004172325) + { + rgb.X = rgb.Y = rgb.Z = num2 * 1.010556f; + Lighting.addLight(x >> 4, y1 >> 4, rgb); + if ((int) dustPtr2->alpha < (int) byte.MaxValue) + { + dustPtr2->scale += 0.09f; + if ((double) dustPtr2->scale >= 1.0) + { + dustPtr2->scale = 1f; + dustPtr2->alpha = (short) byte.MaxValue; + } + } + else if ((double) dustPtr2->scale < 0.5) + dustPtr2->scale -= 0.02f; + else if ((double) dustPtr2->scale < 0.800000011920929) + dustPtr2->scale -= 0.01f; + } + else + { + dustPtr2->active = (byte) 0; + goto label_220; + } + } + else if (num1 == 15 || num1 == 57 || num1 == 58) + { + dustPtr2->velocity.X *= 0.98f; + dustPtr2->velocity.Y *= 0.98f; + if (num1 != 15) + num2 *= 0.8f; + if (dustPtr2->noLight) + { + dustPtr2->velocity.X *= 0.95f; + dustPtr2->velocity.Y *= 0.95f; + } + if ((double) num2 > 1.0) + num2 = 1f; + if (num1 == 15) + Lighting.addLight(x >> 4, y1 >> 4, new Vector3(num2 * 0.45f, num2 * 0.55f, num2)); + else if (num1 == 57) + Lighting.addLight(x >> 4, y1 >> 4, new Vector3(num2 * 0.95f, num2 * 0.95f, num2 * 0.45f)); + else if (num1 == 58) + Lighting.addLight(x >> 4, y1 >> 4, new Vector3(num2, num2 * 0.55f, num2 * 0.75f)); + } + else if (num1 == 66) + { + if ((double) dustPtr2->velocity.X < 0.0) + --dustPtr2->rotation; + else + ++dustPtr2->rotation; + dustPtr2->velocity.X *= 0.98f; + dustPtr2->velocity.Y *= 0.98f; + dustPtr2->scale += 0.02f; + num2 *= 0.003137255f; + if ((double) num2 > 0.00392156885936856) + num2 = 0.003921569f; + rgb.X = num2 * (float) dustPtr2->color.R; + rgb.Y = num2 * (float) dustPtr2->color.G; + rgb.Z = num2 * (float) dustPtr2->color.B; + Lighting.addLight(x >> 4, y1 >> 4, rgb); + } + else if (num1 == 20 || num1 == 21) + { + dustPtr2->scale += 0.005f; + dustPtr2->velocity.X *= 0.94f; + dustPtr2->velocity.Y *= 0.94f; + if (num1 == 21) + { + num2 *= 0.4f; + rgb.X = num2 * 0.8f; + rgb.Y = num2 * 0.3f; + } + else + { + num2 *= 0.8f; + if ((double) num2 > 1.0) + num2 = 1f; + rgb.X = num2 * 0.3f; + rgb.Y = num2 * 0.6f; + } + rgb.Z = num2; + Lighting.addLight(x >> 4, y1 >> 4, rgb); + } + else if (num1 == 27 || num1 == 45) + { + dustPtr2->velocity.X *= 0.94f; + dustPtr2->velocity.Y *= 0.94f; + dustPtr2->scale += 1.0 / 500.0; + if (dustPtr2->noLight) + { + num2 *= 0.1f; + dustPtr2->scale -= 0.06f; + if ((double) dustPtr2->scale < 1.0) + dustPtr2->scale -= 0.06f; + if (this.view != null) + { + if (this.view.player.wet) + { + dustPtr2->position.X += this.view.player.velocity.X * 0.5f; + dustPtr2->position.Y += this.view.player.velocity.Y * 0.5f; + } + else + { + dustPtr2->position.X += this.view.player.velocity.X; + dustPtr2->position.Y += this.view.player.velocity.Y; + } + } + } + if ((double) num2 > 1.0) + num2 = 1f; + Lighting.addLight((int) dustPtr2->position.X >> 4, (int) dustPtr2->position.Y >> 4, new Vector3(num2 * 0.6f, num2 * 0.2f, num2)); + } + else if (num1 == 55 || num1 == 56 || (num1 == 73 || num1 == 74)) + { + dustPtr2->velocity.X *= 0.98f; + dustPtr2->velocity.Y *= 0.98f; + if (num1 == 55) + { + num2 *= 0.8f; + if ((double) num2 > 1.0) + num2 = 1f; + rgb = new Vector3(num2, num2, num2 * 0.6f); + } + else if (num1 == 73) + { + num2 *= 0.8f; + if ((double) num2 > 1.0) + num2 = 1f; + rgb = new Vector3(num2, num2 * 0.35f, num2 * 0.5f); + } + else if (num1 == 74) + { + num2 *= 0.8f; + if ((double) num2 > 1.0) + num2 = 1f; + rgb = new Vector3(num2 * 0.35f, num2, num2 * 0.5f); + } + else + { + num2 *= 1.2f; + if ((double) num2 > 1.0) + num2 = 1f; + rgb = new Vector3(num2 * 0.35f, num2 * 0.5f, num2); + } + Lighting.addLight(x >> 4, y1 >> 4, rgb); + } + else if (num1 == 71 || num1 == 72) + { + dustPtr2->velocity.X *= 0.98f; + dustPtr2->velocity.Y *= 0.98f; + if ((double) num2 > 1.0) + num2 = 1f; + Lighting.addLight(x >> 4, y1 >> 4, new Vector3(num2 * 0.2f, 0.0f, num2 * 0.1f)); + } + else if (num1 == 76) + { + ++this.snowDust; + dustPtr2->scale += 0.009f; + if (this.view != null) + { + if (Collision.SolidCollision(ref dustPtr2->position, 1, 1)) + { + dustPtr2->active = (byte) 0; + goto label_220; + } + else + { + dustPtr2->position.X += this.view.player.velocity.X * 0.2f; + dustPtr2->position.Y += this.view.player.velocity.Y * 0.2f; + } + } + } + else if (!dustPtr2->noGravity) + { + if (num1 != 41 && num1 != 44) + dustPtr2->velocity.Y += 0.1f; + } + else if (num1 == 5) + dustPtr2->scale -= 0.04f; + if (num1 == 33 || num1 == 52) + { + if ((double) dustPtr2->velocity.X == 0.0) + { + if (Collision.SolidCollision(ref dustPtr2->position, 2, 2)) + { + dustPtr2->active = (byte) 0; + goto label_220; + } + else + { + dustPtr2->rotation += 0.5f; + dustPtr2->scale -= 0.01f; + } + } + if (Collision.WetCollision(ref dustPtr2->position, 4, 4)) + { + dustPtr2->scale -= 0.105f; + dustPtr2->alpha += (short) 22; + } + else + { + dustPtr2->scale -= 0.005f; + dustPtr2->alpha += (short) 2; + } + if ((int) dustPtr2->alpha > (int) byte.MaxValue) + { + dustPtr2->active = (byte) 0; + goto label_220; + } + else + { + dustPtr2->velocity.X *= 0.93f; + if ((double) dustPtr2->velocity.Y > 4.0) + dustPtr2->velocity.Y = 4f; + if (dustPtr2->noGravity) + { + if ((double) dustPtr2->velocity.X < 0.0) + dustPtr2->rotation -= 0.2f; + else + dustPtr2->rotation += 0.2f; + dustPtr2->scale += 0.03f; + dustPtr2->velocity.X *= 1.05f; + dustPtr2->velocity.Y += 0.15f; + } + } + } + else if (num1 == 67) + { + if ((double) num2 > 1.0) + num2 = 1f; + Lighting.addLight(x >> 4, y1 >> 4, new Vector3(0.0f, num2 * 0.8f, num2)); + } + else if (num1 == 34 || num1 == 35) + { + if (num1 == 35) + { + ++this.lavaBubbles; + if (dustPtr2->noGravity) + { + dustPtr2->scale += 0.03f; + if ((double) dustPtr2->scale < 1.0) + dustPtr2->velocity.Y += 0.075f; + dustPtr2->velocity.X *= 1.08f; + if ((double) dustPtr2->velocity.X > 0.0) + dustPtr2->rotation += 0.01f; + else + dustPtr2->rotation -= 0.01f; + dustPtr2->velocity.X *= 0.99f; + float num3 = (float) ((double) num2 * 0.600000023841858 + 0.0179999992251396); + if ((double) num3 > 1.0) + num3 = 1f; + rgb.X = num3; + rgb.Y = num3 * 0.3f; + rgb.Z = num3 * 0.1f; + Lighting.addLight(x >> 4, (y1 >> 4) + 1, rgb); + goto label_206; + } + else + { + num2 = (float) ((double) num2 * 0.300000011920929 + 0.400000005960464); + if ((double) num2 > 1.0) + num2 = 1f; + rgb.X = num2; + rgb.Y = num2 * 0.5f; + rgb.Z = num2 * 0.3f; + Lighting.addLight(x >> 4, y1 >> 4, rgb); + dustPtr2->scale -= 0.01f; + dustPtr2->velocity.Y = -0.2f; + dustPtr2->alpha += (short) Main.rand.Next(2); + } + } + else + { + dustPtr2->scale += 0.005f; + dustPtr2->velocity.Y = -0.5f; + } + if ((int) ++dustPtr2->alpha > (int) byte.MaxValue) + { + dustPtr2->active = (byte) 0; + goto label_220; + } + else + { + dustPtr2->position.Y -= 8f; + if (!Collision.WetCollision(ref dustPtr2->position, 4, 4)) + { + dustPtr2->active = (byte) 0; + goto label_220; + } + else + { + dustPtr2->position.Y += 8f; + dustPtr2->velocity.X += (float) Main.rand.Next(-10, 10) * (1.0 / 500.0); + if ((double) dustPtr2->velocity.X < -0.25) + dustPtr2->velocity.X = -0.25f; + else if ((double) dustPtr2->velocity.X > 0.25) + dustPtr2->velocity.X = 0.25f; + } + } + } + else if (num1 == 68) + { + num2 *= 0.3f; + if ((double) num2 > 1.0) + num2 = 1f; + Lighting.addLight(x >> 4, y1 >> 4, new Vector3(num2 * 0.1f, num2 * 0.2f, num2)); + } + else if (num1 == 70) + { + num2 *= 0.3f; + if ((double) num2 > 1.0) + num2 = 1f; + Lighting.addLight(x >> 4, y1 >> 4, new Vector3(num2 * 0.5f, 0.0f, num2)); + } + if (num1 == 41) + { + dustPtr2->velocity.X += (float) Main.rand.Next(-10, 11) * 0.01f; + dustPtr2->velocity.Y += (float) Main.rand.Next(-10, 11) * 0.01f; + if ((double) dustPtr2->velocity.X > 0.75) + dustPtr2->velocity.X = 0.75f; + else if ((double) dustPtr2->velocity.X < -0.75) + dustPtr2->velocity.X = -0.75f; + if ((double) dustPtr2->velocity.Y > 0.75) + dustPtr2->velocity.Y = 0.75f; + else if ((double) dustPtr2->velocity.Y < -0.75) + dustPtr2->velocity.Y = -0.75f; + dustPtr2->scale += 0.007f; + float z = (float) ((double) num2 * 0.699999988079071 + 0.00490000005811453); + if ((double) z > 1.0) + z = 1f; + Lighting.addLight(x >> 4, y1 >> 4, new Vector3(z * 0.4f, z * 0.9f, z)); + } + else if (num1 == 44) + { + dustPtr2->velocity.X += (float) Main.rand.Next(-10, 11) * (3.0 / 1000.0); + dustPtr2->velocity.Y += (float) Main.rand.Next(-10, 11) * (3.0 / 1000.0); + if ((double) dustPtr2->velocity.X > 0.349999994039536) + dustPtr2->velocity.X = 0.35f; + else if ((double) dustPtr2->velocity.X < -0.349999994039536) + dustPtr2->velocity.X = -0.35f; + if ((double) dustPtr2->velocity.Y > 0.349999994039536) + dustPtr2->velocity.Y = 0.35f; + else if ((double) dustPtr2->velocity.Y < -0.349999994039536) + dustPtr2->velocity.Y = -0.35f; + dustPtr2->scale += 0.0085f; + float y2 = (float) ((double) num2 * 0.699999988079071 + 0.00595000013709068); + if ((double) y2 > 1.0) + y2 = 1f; + Lighting.addLight(x >> 4, y1 >> 4, new Vector3(y2 * 0.7f, y2, y2 * 0.8f)); + } + else + dustPtr2->velocity.X *= 0.99f; +label_206: + if ((double) dustPtr2->fadeIn > 0.0) + { + if (num1 == 46) + dustPtr2->scale += 0.1f; + else + dustPtr2->scale += 0.03f; + if ((double) dustPtr2->scale > (double) dustPtr2->fadeIn) + dustPtr2->fadeIn = 0.0f; + } + else + dustPtr2->scale -= 0.01f; + if (dustPtr2->noGravity) + { + dustPtr2->velocity.X *= 0.92f; + dustPtr2->velocity.Y *= 0.92f; + if ((double) dustPtr2->fadeIn == 0.0) + dustPtr2->scale -= 0.04f; + } + if ((double) dustPtr2->scale < 0.100000001490116) + dustPtr2->active = (byte) 0; + else if (num1 != 79) + dustPtr2->rotation += dustPtr2->velocity.X * 0.5f; + } +label_220: + ++dustPtr2; + } + } + } + + public unsafe void DrawDust(WorldView drawView) + { + fixed (Dust* dustPtr1 = this.dust) + { + Dust* dustPtr2 = dustPtr1; + Vector2 pivot = new Vector2(4f, 4f); + Vector2 pos = new Vector2(); + for (int index = (int) this.size - 1; index >= 0; --index) + { + if ((int) dustPtr2->active != 0) + { + int x = (int) dustPtr2->position.X; + int y = (int) dustPtr2->position.Y; + if (this.view != null || drawView.clipArea.Contains(x, y)) + { + Color newColor = dustPtr2->noLight || (int) dustPtr2->type == 6 || (int) dustPtr2->type == 15 || (int) dustPtr2->type >= 59 && (int) dustPtr2->type <= 64 ? Color.White : drawView.lighting.GetColor(x + 4 >> 4, y + 4 >> 4); + dustPtr2->GetAlpha(ref newColor); + if ((int) newColor.PackedValue == 0) + { + dustPtr2->active = (byte) 0; + } + else + { + pos.X = (float) (x - drawView.screenPosition.X); + pos.Y = (float) (y - drawView.screenPosition.Y); + SpriteSheet<_sheetSprites>.Draw(218, ref pos, ref dustPtr2->frame, newColor, dustPtr2->rotation, ref pivot, dustPtr2->scale); + if ((int) dustPtr2->color.PackedValue != 0) + { + dustPtr2->GetColor(ref newColor); + SpriteSheet<_sheetSprites>.Draw(218, ref pos, ref dustPtr2->frame, newColor, dustPtr2->rotation, ref pivot, dustPtr2->scale); + } + } + } + } + ++dustPtr2; + } + } + } + } +} diff --git a/Terraria/FastRandom.cs b/Terraria/FastRandom.cs new file mode 100644 index 0000000..eaf6739 --- /dev/null +++ b/Terraria/FastRandom.cs @@ -0,0 +1,196 @@ +// Type: Terraria.FastRandom +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using System; + +namespace Terraria +{ + public sealed class FastRandom + { + private uint bitMask = 1U; + private const double REAL_UNIT_INT = 4.65661287307739E-10; + private const double REAL_UNIT_UINT = 2.3283064365387E-10; + private const uint Y = 842502087U; + private const uint Z = 3579807591U; + private const uint W = 273326509U; + private uint x; + private uint y; + private uint z; + private uint w; + private uint bitBuffer; + + public FastRandom() + { + this.Reinitialise((uint) Environment.TickCount); + } + + public FastRandom(uint seed) + { + this.Reinitialise(seed); + } + + public void Reinitialise(uint seed) + { + this.x = seed; + this.y = 842502087U; + this.z = 3579807591U; + this.w = 273326509U; + } + + public int Next() + { + uint num1; + do + { + uint num2 = this.x ^ this.x << 11; + this.x = this.y; + this.y = this.z; + this.z = this.w; + this.w = (uint) ((int) this.w ^ (int) (this.w >> 19) ^ ((int) num2 ^ (int) (num2 >> 8))); + num1 = this.w & (uint) int.MaxValue; + } + while ((int) num1 == int.MaxValue); + return (int) num1; + } + + public int Next(int upperBound) + { + uint num = this.x ^ this.x << 11; + this.x = this.y; + this.y = this.z; + this.z = this.w; + return (int) (4.65661287307739E-10 * (double) (int.MaxValue & (int) (this.w = (uint) ((int) this.w ^ (int) (this.w >> 19) ^ ((int) num ^ (int) (num >> 8))))) * (double) upperBound); + } + + public int Next(int lowerBound, int upperBound) + { + uint num = this.x ^ this.x << 11; + this.x = this.y; + this.y = this.z; + this.z = this.w; + return lowerBound + (int) (4.65661287307739E-10 * (double) (int.MaxValue & (int) (this.w = (uint) ((int) this.w ^ (int) (this.w >> 19) ^ ((int) num ^ (int) (num >> 8))))) * (double) (upperBound - lowerBound)); + } + + public double NextDouble() + { + uint num = this.x ^ this.x << 11; + this.x = this.y; + this.y = this.z; + this.z = this.w; + return 4.65661287307739E-10 * (double) (int.MaxValue & (int) (this.w = (uint) ((int) this.w ^ (int) (this.w >> 19) ^ ((int) num ^ (int) (num >> 8))))); + } + + public void NextBytes(byte[] buffer) + { + uint num1 = this.x; + uint num2 = this.y; + uint num3 = this.z; + uint num4 = this.w; + int num5 = 0; + int num6 = buffer.Length - 3; + while (num5 < num6) + { + uint num7 = num1 ^ num1 << 11; + num1 = num2; + num2 = num3; + num3 = num4; + num4 = (uint) ((int) num4 ^ (int) (num4 >> 19) ^ ((int) num7 ^ (int) (num7 >> 8))); + byte[] numArray1 = buffer; + int index1 = num5; + int num8 = 1; + int num9 = index1 + num8; + int num10 = (int) (byte) num4; + numArray1[index1] = (byte) num10; + byte[] numArray2 = buffer; + int index2 = num9; + int num11 = 1; + int num12 = index2 + num11; + int num13 = (int) (byte) (num4 >> 8); + numArray2[index2] = (byte) num13; + byte[] numArray3 = buffer; + int index3 = num12; + int num14 = 1; + int num15 = index3 + num14; + int num16 = (int) (byte) (num4 >> 16); + numArray3[index3] = (byte) num16; + byte[] numArray4 = buffer; + int index4 = num15; + int num17 = 1; + num5 = index4 + num17; + int num18 = (int) (byte) (num4 >> 24); + numArray4[index4] = (byte) num18; + } + if (num5 < buffer.Length) + { + uint num7 = num1 ^ num1 << 11; + num1 = num2; + num2 = num3; + num3 = num4; + num4 = (uint) ((int) num4 ^ (int) (num4 >> 19) ^ ((int) num7 ^ (int) (num7 >> 8))); + byte[] numArray1 = buffer; + int index1 = num5; + int num8 = 1; + int num9 = index1 + num8; + int num10 = (int) (byte) num4; + numArray1[index1] = (byte) num10; + if (num9 < buffer.Length) + { + byte[] numArray2 = buffer; + int index2 = num9; + int num11 = 1; + int num12 = index2 + num11; + int num13 = (int) (byte) (num4 >> 8); + numArray2[index2] = (byte) num13; + if (num12 < buffer.Length) + { + byte[] numArray3 = buffer; + int index3 = num12; + int num14 = 1; + int index4 = index3 + num14; + int num15 = (int) (byte) (num4 >> 16); + numArray3[index3] = (byte) num15; + if (index4 < buffer.Length) + buffer[index4] = (byte) (num4 >> 24); + } + } + } + this.x = num1; + this.y = num2; + this.z = num3; + this.w = num4; + } + + public uint NextUInt() + { + uint num = this.x ^ this.x << 11; + this.x = this.y; + this.y = this.z; + this.z = this.w; + return this.w = (uint) ((int) this.w ^ (int) (this.w >> 19) ^ ((int) num ^ (int) (num >> 8))); + } + + public int NextInt() + { + uint num = this.x ^ this.x << 11; + this.x = this.y; + this.y = this.z; + this.z = this.w; + return int.MaxValue & (int) (this.w = (uint) ((int) this.w ^ (int) (this.w >> 19) ^ ((int) num ^ (int) (num >> 8)))); + } + + public bool NextBool() + { + if ((int) this.bitMask != 1) + return ((int) this.bitBuffer & (int) (this.bitMask >>= 1)) == 0; + uint num = this.x ^ this.x << 11; + this.x = this.y; + this.y = this.z; + this.z = this.w; + this.bitBuffer = this.w = (uint) ((int) this.w ^ (int) (this.w >> 19) ^ ((int) num ^ (int) (num >> 8))); + this.bitMask = (uint) int.MinValue; + return ((int) this.bitBuffer & (int) this.bitMask) == 0; + } + } +} diff --git a/Terraria/GameMode.cs b/Terraria/GameMode.cs new file mode 100644 index 0000000..d3da0ca --- /dev/null +++ b/Terraria/GameMode.cs @@ -0,0 +1,154 @@ +// Type: Terraria.GameMode +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Input; +using System.Text; + +namespace Terraria +{ + public static class GameMode + { + private static int cursorY = 2; + + static GameMode() + { + } + + public static void Update() + { + if (UI.main.IsBackButtonTriggered()) + { + UI.main.PrevMenu(-1); + } + else + { + if (!UI.main.IsButtonTriggered(Buttons.A)) + return; + switch (GameMode.cursorY) + { + case 0: + UI ui1 = UI.main; + int num1 = !ui1.isOnline ? 1 : 0; + ui1.isOnline = num1 != 0; + UI.main.settingsDirty = true; + break; + case 1: + UI ui2 = UI.main; + int num2 = !ui2.isInviteOnly ? 1 : 0; + ui2.isInviteOnly = num2 != 0; + UI.main.settingsDirty = true; + break; + case 2: + GameMode.StartGame(); + break; + } + } + } + + public static void UpdateCursor(int dx, int dy) + { + if (!UI.main.CanPlayOnline()) + { + UI.main.isOnline = false; + GameMode.cursorY = 2; + } + else + { + if (dy == 0) + return; + Main.PlaySound(12); + int num = GameMode.cursorY; + do + { + num += dy; + if (num < 0) + num = 2; + else if (num > 2) + num = 0; + } + while (num == 1 && !UI.main.isOnline); + GameMode.cursorY = (int) (byte) num; + } + } + + public static void Draw(WorldView view) + { + Main.DrawRect(451, new Rectangle() + { + X = ((int) view.viewWidth >> 1) - 190, + Y = 210, + Width = 380, + Height = 168 + }, 64, 0); + Color c = Color.White; + int x = ((int) view.viewWidth >> 1) - 100; + int y1 = 230; + bool flag = UI.main.CanPlayOnline(); + if (GameMode.cursorY == 0) + { + view.ui.DrawInventoryCursor(x, y1, 1.0, (int) byte.MaxValue); + } + else + { + c = flag ? Color.White : new Color(128, 128, 128, (int) byte.MaxValue); + SpriteSheet<_sheetSprites>.Draw(451, x, y1, c); + } + if (UI.main.isOnline) + SpriteSheet<_sheetSprites>.Draw(202, x + 10, y1 + 10, c); + UI.DrawStringLC(UI.fontSmall, Lang.menu[6], x + 60, y1 + 26, c); + int y2 = y1 + 64; + if (GameMode.cursorY == 1) + { + view.ui.DrawInventoryCursor(x, y2, 1.0, (int) byte.MaxValue); + } + else + { + c = !flag || !UI.main.isOnline ? new Color(128, 128, 128, (int) byte.MaxValue) : Color.White; + SpriteSheet<_sheetSprites>.Draw(451, x, y2, c); + } + if (UI.main.isInviteOnly) + SpriteSheet<_sheetSprites>.Draw(202, x + 10, y2 + 10, c); + UI.DrawStringLC(UI.fontSmall, Lang.menu[7], x + 60, y2 + 26, c); + string str = WorldSelect.WorldName() != null ? Lang.menu[10] : Lang.menu[11]; + float scale = 1f; + if (GameMode.cursorY == 2) + { + scale *= (float) (1.0 + (double) UI.cursorAlpha * 0.100000001490116); + c = new Color((int) UI.cursorColor.A, (int) UI.cursorColor.A, 100, (int) byte.MaxValue); + } + else + c = new Color(240, 240, 240, 240); + Vector2 pivot = UI.MeasureString(UI.fontBig, str); + pivot.X *= 0.5f; + pivot.Y *= 0.5f; + Vector2 pos = new Vector2((float) ((int) view.viewWidth >> 1), 454f); + UI.DrawStringScaled(UI.fontBig, str, pos, c, pivot, scale); + } + + public static void ControlDescription(StringBuilder strBuilder) + { + strBuilder.Append(Lang.controls(Lang.CONTROLS.SELECT)); + strBuilder.Append(' '); + strBuilder.Append(Lang.controls(Lang.CONTROLS.BACK)); + } + + private static void StartGame() + { + Main.PlaySound(10); + string str = WorldSelect.WorldName(); + if (str == null) + { + UI.main.SetMenu(MenuMode.WORLD_SIZE, true, false); + } + else + { + UI.main.SetMenu(MenuMode.STATUS_SCREEN, true, false); + Main.worldName = str; + WorldGen.playWorld(); + } + } + } +} diff --git a/Terraria/Gore.cs b/Terraria/Gore.cs new file mode 100644 index 0000000..eaee96f --- /dev/null +++ b/Terraria/Gore.cs @@ -0,0 +1,214 @@ +// Type: Terraria.Gore +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework; + +namespace Terraria +{ + public struct Gore + { + public const int MAX_GORE_TYPES = 175; + public const int MAX_GORE = 128; + public const int goreTime = 360; + private static int lastGoreIndex; + public Vector2 position; + public Vector2 velocity; + public float rotation; + public float scale; + public float light; + public byte active; + public byte type; + public bool sticky; + public short alpha; + public short timeLeft; + + static Gore() + { + } + + public void Init() + { + this.active = (byte) 0; + } + + public void Update() + { + if ((int) this.type == 11 || (int) this.type == 12 || ((int) this.type == 13 || (int) this.type == 61) || ((int) this.type == 62 || (int) this.type == 63 || (int) this.type == 99)) + { + this.velocity.Y *= 0.98f; + this.velocity.X *= 0.98f; + this.scale -= 0.007f; + if ((double) this.scale < 0.100000001490116) + { + this.active = (byte) 0; + return; + } + } + else if ((int) this.type == 16 || (int) this.type == 17) + { + this.velocity.Y *= 0.98f; + this.velocity.X *= 0.98f; + this.scale -= 0.01f; + if ((double) this.scale < 0.100000001490116) + { + this.active = (byte) 0; + return; + } + } + else + this.velocity.Y += 0.2f; + this.rotation += this.velocity.X * 0.1f; + if (this.sticky) + { + int num1 = SpriteSheet<_sheetSprites>.src[256 + (int) this.type].Width; + if (SpriteSheet<_sheetSprites>.src[256 + (int) this.type].Height < num1) + num1 = SpriteSheet<_sheetSprites>.src[256 + (int) this.type].Height; + int num2 = (int) ((double) num1 * (double) this.scale * 0.899999976158142); + Collision.TileCollision(ref this.position, ref this.velocity, num2, num2, false, false); + if ((double) this.velocity.Y == 0.0) + { + this.velocity.X *= 0.97f; + if ((double) this.velocity.X > -0.00999999977648258 && (double) this.velocity.X < 0.00999999977648258) + this.velocity.X = 0.0f; + } + if ((int) this.timeLeft > 0) + --this.timeLeft; + else + ++this.alpha; + } + else + this.alpha += (short) 2; + if ((int) this.alpha >= (int) byte.MaxValue) + { + this.active = (byte) 0; + } + else + { + this.position.X += this.velocity.X; + this.position.Y += this.velocity.Y; + if ((double) this.light <= 0.0) + return; + float num = this.light * this.scale; + Vector3 rgb = new Vector3(num, num, num); + if ((int) this.type == 16) + { + rgb.Y *= 0.8f; + rgb.Z *= 0.3f; + } + else if ((int) this.type == 17) + { + rgb.X *= 0.3f; + rgb.Y *= 0.6f; + } + Lighting.addLight((int) ((double) this.position.X + (double) SpriteSheet<_sheetSprites>.src[256 + (int) this.type].Width * (double) this.scale * 0.5) >> 4, (int) ((double) this.position.Y + (double) SpriteSheet<_sheetSprites>.src[256 + (int) this.type].Height * (double) this.scale * 0.5) >> 4, rgb); + } + } + + public static unsafe int NewGore(Vector2 Position, Vector2 Velocity, int Type, double Scale = 1.0) + { + int index = Gore.lastGoreIndex++ & (int) sbyte.MaxValue; + fixed (Gore* gorePtr = &Main.gore[index]) + { + gorePtr->position = Position; + gorePtr->velocity = Velocity; + gorePtr->velocity.Y -= (float) Main.rand.Next(10, 31) * 0.1f; + gorePtr->velocity.X += (float) Main.rand.Next(-20, 21) * 0.1f; + gorePtr->type = (byte) Type; + gorePtr->active = (byte) 1; + gorePtr->rotation = 0.0f; + if (Type == 16 || Type == 17) + { + gorePtr->sticky = false; + gorePtr->alpha = (short) 100; + gorePtr->scale = 0.7f; + gorePtr->light = 1f; + return index; + } + else + { + if (Type >= 11 && Type <= 13 || Type >= 61 && Type <= 63 || Type == 99) + { + gorePtr->sticky = false; + } + else + { + gorePtr->sticky = true; + gorePtr->timeLeft = (short) 360; + } + gorePtr->scale = (float) Scale; + gorePtr->alpha = (short) 0; + gorePtr->light = 0.0f; + // ISSUE: __unpin statement + __unpin(gorePtr); + return index; + } + } + } + + public static unsafe int NewGore(int X, int Y, Vector2 Velocity, int Type) + { + int index = Gore.lastGoreIndex++ & (int) sbyte.MaxValue; + fixed (Gore* gorePtr = &Main.gore[index]) + { + gorePtr->position.X = (float) X; + gorePtr->position.Y = (float) Y; + gorePtr->velocity = Velocity; + gorePtr->velocity.Y -= (float) Main.rand.Next(10, 31) * 0.1f; + gorePtr->velocity.X += (float) Main.rand.Next(-20, 21) * 0.1f; + gorePtr->type = (byte) Type; + gorePtr->active = (byte) 1; + gorePtr->rotation = 0.0f; + if (Type == 16 || Type == 17) + { + gorePtr->sticky = false; + gorePtr->alpha = (short) 100; + gorePtr->scale = 0.7f; + gorePtr->light = 1f; + return index; + } + else + { + if (Type >= 11 && Type <= 13 || Type >= 61 && Type <= 63 || Type == 99) + { + gorePtr->sticky = false; + } + else + { + gorePtr->sticky = true; + gorePtr->timeLeft = (short) 360; + } + gorePtr->scale = 1f; + gorePtr->alpha = (short) 0; + gorePtr->light = 0.0f; + // ISSUE: __unpin statement + __unpin(gorePtr); + return index; + } + } + } + + public Color GetAlpha(Color newColor) + { + int r; + int g; + int b; + if ((int) this.type == 16 || (int) this.type == 17) + { + r = (int) newColor.R; + g = (int) newColor.G; + b = (int) newColor.B; + } + else + { + double num = ((double) byte.MaxValue - (double) this.alpha) * (1.0 / (double) byte.MaxValue); + r = (int) ((double) newColor.R * num); + g = (int) ((double) newColor.G * num); + b = (int) ((double) newColor.B * num); + } + int a = (int) newColor.A - (int) this.alpha; + return new Color(r, g, b, a); + } + } +} diff --git a/Terraria/HowToPlay/Assets.cs b/Terraria/HowToPlay/Assets.cs new file mode 100644 index 0000000..39810b4 --- /dev/null +++ b/Terraria/HowToPlay/Assets.cs @@ -0,0 +1,32 @@ +// Type: Terraria.HowToPlay.Assets +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework.Content; +using Microsoft.Xna.Framework.Graphics; + +namespace Terraria.HowToPlay +{ + public class Assets + { + public static Texture2D TEXT_BACKGROUND; + public static int TEXT_BACKGROUND_BORDER_WIDTH; + public static Texture2D HOWTO_LOGO; + public static Texture2D HOWTO_MOVEMENT; + public static Texture2D HOWTO_HOTBAR2; + public static Texture2D HOWTO_DEBUFF; + public static Texture2D HOWTO_INVENTORY; + + public static void LoadContent(ContentManager Content) + { + Assets.TEXT_BACKGROUND = Content.Load("UI/HowToPlay/Text_Back"); + Assets.TEXT_BACKGROUND_BORDER_WIDTH = 20; + Assets.HOWTO_MOVEMENT = Content.Load("UI/HowToPlay/Howto_Movement"); + Assets.HOWTO_HOTBAR2 = Content.Load("UI/HowToPlay/Howto_Hotbar2"); + Assets.HOWTO_DEBUFF = Content.Load("UI/HowToPlay/Howto_Debuff"); + Assets.HOWTO_INVENTORY = Content.Load("UI/HowToPlay/Howto_Inventory"); + Assets.HOWTO_LOGO = Content.Load("UI/HowToPlay/Howto_Logo"); + } + } +} diff --git a/Terraria/HowToPlay/HowToPlayLayout.cs b/Terraria/HowToPlay/HowToPlayLayout.cs new file mode 100644 index 0000000..48660c2 --- /dev/null +++ b/Terraria/HowToPlay/HowToPlayLayout.cs @@ -0,0 +1,123 @@ +// Type: Terraria.HowToPlay.HowToPlayLayout +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; + +namespace Terraria.HowToPlay +{ + public class HowToPlayLayout + { + private static Color TEXT_COLOR = Color.White; + private static Color ACCENT_COLOR = new Color((int) byte.MaxValue, 212, 64, (int) byte.MaxValue); + private static Color BACK_COLOR = Terraria.UI.DEFAULT_DIALOG_COLOR; + private const int MAX_HEIGHT = 454; + public TextBlock textblock; + private HowToPlayLayout.Image[] images; + + static HowToPlayLayout() + { + } + + private HowToPlayLayout(TextBlock textblock) + { + this.textblock = textblock; + this.images = new HowToPlayLayout.Image[0]; + } + + private HowToPlayLayout(TextBlock textblock, HowToPlayLayout.Image[] images) + { + this.textblock = textblock; + this.images = images; + } + + public static HowToPlayLayout TextOnlyLayout(string text, int width) + { + int borderWidth = Assets.TEXT_BACKGROUND_BORDER_WIDTH; + int val2 = 454; + CompiledText text1 = new CompiledText(text, width - borderWidth * 2, Terraria.UI.styleFontSmallOutline, CompiledText.MarkupType.Html); + int height = Math.Min((int) text1.Height + Terraria.UI.fontSmallOutline.LineSpacing + borderWidth * 2, val2); + Rectangle dialogArea = new Rectangle(864 - width >> 1, 454 - height >> 1, width, height); + Rectangle textArea = dialogArea; + textArea.Inflate(-borderWidth, -borderWidth); + return new HowToPlayLayout(new TextBlock(ref dialogArea, text1, ref textArea, Assets.TEXT_BACKGROUND, borderWidth, HowToPlayLayout.BACK_COLOR, HowToPlayLayout.TEXT_COLOR, HowToPlayLayout.ACCENT_COLOR)); + } + + public static HowToPlayLayout SideBySideLayout(string text, int width, Texture2D image, int padding = 20) + { + int borderWidth = Assets.TEXT_BACKGROUND_BORDER_WIDTH; + int val2 = 454; + CompiledText text1 = new CompiledText(text, width - borderWidth * 2, Terraria.UI.styleFontSmallOutline, CompiledText.MarkupType.Html); + int height = Math.Min((int) text1.Height + Terraria.UI.fontSmallOutline.LineSpacing + borderWidth * 2, val2); + int x = 864 - (image.Width + padding + width) >> 1; + int y = 454 - height >> 1; + Rectangle dialogArea = new Rectangle(x, y, width, height); + Rectangle textArea = dialogArea; + textArea.Inflate(-borderWidth, -borderWidth); + TextBlock textblock = new TextBlock(ref dialogArea, text1, ref textArea, Assets.TEXT_BACKGROUND, borderWidth, HowToPlayLayout.BACK_COLOR, HowToPlayLayout.TEXT_COLOR, HowToPlayLayout.ACCENT_COLOR); + int num1 = x + (width + padding); + int num2 = 454 - image.Height >> 1; + HowToPlayLayout.Image[] images = new HowToPlayLayout.Image[1] + { + new HowToPlayLayout.Image() + { + Position = new Vector2((float) num1, (float) num2), + Texture = image + } + }; + return new HowToPlayLayout(textblock, images); + } + + public static HowToPlayLayout StackedLayout(string text, int width, int height, Texture2D image, int padding = 20) + { + int borderWidth = Assets.TEXT_BACKGROUND_BORDER_WIDTH; + CompiledText text1 = new CompiledText(text, width - borderWidth * 2, Terraria.UI.styleFontSmallOutline, CompiledText.MarkupType.Html); + height = Math.Min((int) text1.Height + Terraria.UI.fontSmallOutline.LineSpacing + borderWidth * 2, height); + int num1 = height + padding + image.Height; + int x = 864 - (int) text1.Width >> 1; + int y = 454 - num1 >> 1; + Rectangle dialogArea = new Rectangle(x, y, width, height); + Rectangle textArea = dialogArea; + textArea.Inflate(-borderWidth, -borderWidth); + TextBlock textblock = new TextBlock(ref dialogArea, text1, ref textArea, Assets.TEXT_BACKGROUND, borderWidth, HowToPlayLayout.BACK_COLOR, HowToPlayLayout.TEXT_COLOR, HowToPlayLayout.ACCENT_COLOR); + int num2 = 864 - image.Width >> 1; + int num3 = y + (height + padding); + HowToPlayLayout.Image[] images = new HowToPlayLayout.Image[1] + { + new HowToPlayLayout.Image() + { + Position = new Vector2((float) num2, (float) num3), + Texture = image + } + }; + return new HowToPlayLayout(textblock, images); + } + + public void Draw(int offsetX, int offsetY, int scrollY) + { + this.textblock.Draw(offsetX, offsetY, scrollY); + foreach (HowToPlayLayout.Image image in this.images) + { + Vector2 position = image.Position; + position.X += (float) offsetX; + position.Y += (float) offsetY; + Main.spriteBatch.Draw(image.Texture, position, Color.White); + } + } + + public void GenerateCache(GraphicsDevice graphicsDevice) + { + this.textblock.GenerateCache(graphicsDevice); + } + + private struct Image + { + public Vector2 Position; + public Texture2D Texture; + } + } +} diff --git a/Terraria/HowToPlay/TextBlock.cs b/Terraria/HowToPlay/TextBlock.cs new file mode 100644 index 0000000..6be1ad6 --- /dev/null +++ b/Terraria/HowToPlay/TextBlock.cs @@ -0,0 +1,74 @@ +// Type: Terraria.HowToPlay.TextBlock +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; + +namespace Terraria.HowToPlay +{ + public class TextBlock + { + public bool isScrollable; + private BoxGraphic background; + private CompiledText text; + public short minOffsetY; + private Texture2D textTexture; + private Color textColor; + private Color accentColor; + private Rectangle textArea; + private Vector2i dialogPosition; + + public TextBlock(ref Rectangle dialogArea, CompiledText text, ref Rectangle textArea, Texture2D background, int borderWidth, Color backColor, Color textColor, Color accentColor) + { + this.background = BoxGraphic.Create(dialogArea.Width, dialogArea.Height, background, borderWidth, backColor); + this.dialogPosition = new Vector2i(dialogArea.X, dialogArea.Y); + this.text = text; + this.textArea = textArea; + this.isScrollable = (int) text.Height > textArea.Height; + this.minOffsetY = (short) -Math.Max(0, (int) text.Height - textArea.Height); + this.textColor = textColor; + this.accentColor = accentColor; + this.textTexture = (Texture2D) null; + } + + public void Draw(int ox = 0, int oy = 0, int scrollY = 0) + { + Rectangle rectangle1 = this.textArea; + rectangle1.X = 0; + rectangle1.Y = -scrollY; + Rectangle rectangle2 = this.textArea; + rectangle2.X += ox; + rectangle2.Y += oy; + Vector2i position = this.dialogPosition; + position.X += ox; + position.Y += oy; + this.background.Draw(position, 1f); + Main.spriteBatch.Draw(this.textTexture, rectangle2, new Rectangle?(rectangle1), Color.White); + if (!this.isScrollable) + return; + Rectangle rect = new Rectangle(position.X + (this.background.Width >> 1) - 8, position.Y + 2, 16, 16); + if (scrollY < 0) + SpriteSheet<_sheetSprites>.DrawCentered(135, ref rect, SpriteEffects.FlipVertically); + if (scrollY <= (int) this.minOffsetY) + return; + rect.Y = position.Y + this.background.Height - 16 - 2; + SpriteSheet<_sheetSprites>.DrawCentered(135, ref rect); + } + + public void GenerateCache(GraphicsDevice graphicsDevice) + { + RenderTarget2D renderTarget = new RenderTarget2D(graphicsDevice, (int) this.text.Width, (int) this.text.Height + Terraria.UI.fontSmallOutline.LineSpacing); + graphicsDevice.SetRenderTarget(renderTarget); + graphicsDevice.Clear(Color.Transparent); + Main.spriteBatch.Begin(); + this.text.Draw(Main.spriteBatch, new Rectangle(0, 0, (int) this.text.Width, (int) this.text.Height), this.textColor, this.accentColor); + Main.spriteBatch.End(); + graphicsDevice.SetRenderTarget((RenderTarget2D) null); + this.textTexture = (Texture2D) renderTarget; + } + } +} diff --git a/Terraria/HowToPlay/UI.cs b/Terraria/HowToPlay/UI.cs new file mode 100644 index 0000000..951c4bd --- /dev/null +++ b/Terraria/HowToPlay/UI.cs @@ -0,0 +1,340 @@ +// Type: Terraria.HowToPlay.UI +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Input; +using System.Text; +using Terraria; + +namespace Terraria.HowToPlay +{ + internal class UI + { + public static string[] HTP_TEXT_EN = new string[14] + { + "BASICS:\nDig! Fight! Explore! Build! In Terraria, every World is unique-from the floating islands in the sky to the deepest level of The Underworld. Adventure to the ends of the earth, and defeat villainous bosses along the way. The World is your canvas.\n\nChop down trees with an axe to gather wood. Kill slimes and collect their gels. Combine wood and gels to craft torches. When you explore caves, it helps to have wood platforms. Craft them out of wood.\n\nUse a pickaxe to mine the many types of ore in the world and smelt them into bars at a furnace. Use those to craft better weapons and armor. Some weapons, such as bows and guns, require ammo in your Ammo slots. Magic weapons require mana.\n\nKeep an eye out for Life Crystals to increase your health, and collect Falling Stars to craft Mana Crystals. Oh, and build a house before nightfall. You'll need it.", + "CHARACTER CREATION:\nCreate a character and customize them any way you want!\n\nA character on the Normal difficulty setting only drops coins when killed. On Difficult, a character drops all their items. When a Hardcore character dies they are permanently deleted. This setting is only recommended for the most advanced (and HARDCORE) players.\n\nItems on a character, stay on that character. Items in a World, stay in that World.", + "CONTROLS:\nUse " + (object) '\x0084' + " to move around. Press down to fall through wood platforms.\nPress " + (string) (object) '\x008C' + " to jump.\nPress " + (string) (object) '\x0081' + " to perform an action with the current item-such as swinging an axe, placing a torch, or drinking a potion.\nUse " + (string) (object) '\x0085' + " to aim your cursor.\nThere are two " + (string) (object) '\x0085' + " Cursor Modes. Press " + (string) (object) '\x008F' + " to switch between them.\n1) In Auto Mode, pressing " + (string) (object) '\x0081' + " performs an action in the direction of the cursor.\n2) In Manual Mode, the cursor acts like a mouse.\nPressing " + (string) (object) '\x0081' + " performs an action on the cursor's exact location.\nPress " + (string) (object) '\x008D' + " to use a nearby object or NPC. Usable objects and NPCs are highlighted in yellow; when you are near, they will flash and you can interact with them.\nPress " + (string) (object) '\x008A' + " to drop the current item.\nAim and press " + (string) (object) '\x0080' + " to use a grappling hook or similar item (if you have one in your Inventory).\nYou can press " + (string) (object) '\x008E' + " as an alternate jump button.\nAdvanced players may wish to switch the grappling and alternate jump buttons; you can do this from the Controls Menu.\nPress " + (string) (object) '\x0087' + " to view the World Map and player list.", + "HUD:\nThe Inventory Bar is at the top of your screen. The current item is highlighted in yellow. You can scroll between items by pressing \x0082\x0083.\n\nTo rearrange items or view the rest of your Inventory, press " + (object) '\x008B' + ".\nYour health is also at the top of your screen. Every heart is 20 health. If you are underwater, your remaining breath is shown below your health. If you have mana, it will appear as blue star icons on the right side of your screen. Every star is 20 mana.\n\nAny active buffs or debuffs-along with their remaining duration-are shown below the Inventory Bar. To cancel a buff or find out more about it go to the Equip section of the Inventory Menu.", + "INVENTORY:\nPress " + (object) '\x008B' + " to access the Inventory Menu. The Inventory Menu contains several sections: Inventory, Equip, Crafting, and Housing. If you have activated a chest or vendor NPC, there will be a section for it as well.\n\nSwitch between sections by pressing \x0082\x0083. The Inventory Bar is the top row of item slots in your Inventory. Use " + (string) (object) '\x0084' + " to move between slots. Press " + (string) (object) '\x008C' + " to pick up an item; if there is a stack of items in the slot then " + (string) (object) '\x008C' + " will pick them all up. Press " + (string) (object) '\x0081' + " to pick up a single item. Move to another slot and press " + (string) (object) '\x008C' + " to place the item you picked up.\n\nWhen you pick up an item you can switch between the Equip and Inventory sections-or to a chest (or other storage) section-and the item will remain on your cursor.\nPress " + (string) (object) '\x008A' + " to move an item directly to the Trash. An item in the Trash slot will be deleted after a brief delay. Press " + (string) (object) '\x0081' + " to equip items such as armor or accessories directly to a usable slot.", + "EQUIP:\nThe Equip section of the Inventory Menu contains slots for armor items, vanity items, accessory items, and buffs/debuffs.\nUse " + (object) '\x0084' + " to move between slots. Items in Vanity slots appear on your character but do not provide any stat bonuses or effects.\n\nPress " + (string) (object) '\x008C' + " to pick up and place items. You can pick up an item and switch between the Equip and Inventory sections and the item will remain on your cursor.\n\nActive buff/debuff slots are above your character avatar. Select an active buff or debuff to find out more about it.\nPress " + (string) (object) '\x008C' + " to cancel a buff; debuffs cannot be cancelled.", + "CRAFTING:\nIn the Crafting section you can create new types of items by combining items in your Inventory as ingredients. The Crafting section is part of the Inventory Menu that can be opened by pressing " + (object) '\x008B' + ". Switch to the Crafting section by pressing \x0082\x0083.\n\nSwitch between item categories by pressing " + (string) (object) '\x0080' + " " + (string) (object) '\x0081' + ". There are six categories: Structures, Tools, Weapons, Armor, Consumables, and Miscellaneous.\n\nUse " + (string) (object) '\x0084' + " to scroll between crafting recipes. Press " + (string) (object) '\x008C' + " to craft an item from a crafting recipe and place it in your Inventory. Item recipes are shown in the vertical list. Any variations of that base item are shown in a horizontal list.\n\nMore crafting recipes will unlock as you gather exotic ingredients or create new crafting station items (such as a crafting table or anvil). Press " + (string) (object) '\x008A' + " to switch between showing only recipes you can currently craft, or showing all the recipes you have unlocked.\n\nIngredients for the current recipe are shown in the Ingredients area, along with any crafting station items that must be nearby in the World to craft the recipe. Press " + (string) (object) '\x008B' + " to enter (or exit) the Ingredients area to find out more about individual ingredients.", + "HOUSING:\n\nBuild a house before nightfall to stay safe.\nA house (or room) is considered valid if it has side walls that are at least 6 blocks high, and a floor and ceiling at least 10 blocks wide. Additionally, the background must be entirely paneled with walls (such as wood walls or dirt walls). Finally, you must place a light source (such as a torch) and place both a chair and a table.\n\nYou can change your spawn point by placing and using a bed. If you find a Magic Mirror, you can use it to teleport back to your spawn point. As you progress, NPCs will move into your house if there are valid, empty rooms available to live in.\n\nThere is a Housing section in the Inventory Menu where you can manage your household. Open the Inventory Menu by pressing " + (object) '\x008B' + ", and press \x0082\x0083 to switch to the Housing section.\n\nIn the Housing section you can view the NPCs living in your rooms. Press " + (string) (object) '\x0084' + " to select different NPCs and find out about them. Press " + (string) (object) '\x008C' + " to assign that NPC to the room you are standing in. Press " + (string) (object) '\x008B' + " to show or hide NPC room flags in the World. Press " + (string) (object) '\x008A' + " to check if you are standing in valid housing.", + "STORAGE & VENDORS:\n\nIf you use a storage item in the World (such as a chest) or a vendor NPC (such as a Merchant), it will open a special section in the Inventory Menu. In a storage item section, press " + (object) '\x008C' + " to pick up and place items. You can pick up an item and switch between the Inventory, Equip, and storage sections and the item will remain on your cursor.\n\nThere are also three storage shortcuts available: Loot All moves as many items as possible into your Inventory; Deposit All moves as many items as possible from your Inventory into the storage; Quick Stack moves only items from your Inventory that match item stacks already in the storage.\n\nIn a vendor item section, press " + (string) (object) '\x008C' + " to purchase an item with coins. Move items from your Inventory into the vendor item section to sell them.", + "BUFFS & DEBUFFS:\nBuffs are positive status effects such as Invisibility or a pet.\nDebuffs are negative status effects such as Bleeding or Potion Sickness.\n\nActive buffs and debuffs are shown below your Inventory Bar. Most have a limited duration.\n\nYou can find out more about them in the Equip section of the Inventory Menu. From there, you can also cancel a buff by selecting it and pressing " + (object) '\x008C' + "; debuffs cannot be cancelled.", + "MULTIPLAYER:\nTerraria is a multiplayer game by default.\nSplit-screen supports up to 4 players. Local players can join your game by attaching controllers and pressing " + (object) '\x0088' + " or " + (string) (object) '\x008C' + " at any time. Online games support up to 8 players.\n\nWhen you start an online game, the game will be visible to your friends (unless you've selected Invite Only). Likewise, when your friends host public games they will be visible for you to join.\n\nWhile in a game, press " + (string) (object) '\x0087' + " to view a list of players and their locations in the World Map. From here you can also invite players, view Gamer Cards, toggle your Player vs. Player (PvP) mode, or choose your team color.\n\nPlayers who activate Player vs. Player (PvP) mode can attack each other. When players select a team color their location and health are only visible to teammates. Teammates cannot attack each other.", + "DUNGEON:\nEvery World contains a Dungeon.\nDo not enter the Dungeon without first defeating its guardian.\nLook for an Old Man, and speak to him at night.\nBe prepared.", + "HARD MODE:\nTo activate Hard Mode, you must defeat the unspeakable horror that lives in The Underworld. Find a Guide Voodoo Doll and hurl it into the infernal lava to summon the monstrosity.\n\nIf you defeat it, use its treasure to destroy Demon Altars. Hard Mode permanently changes the World: new environments appear, as do new enemies, bosses, items, and NPCs.\n\nHard Mode is only for the bravest warriors.", + "BANNING WORLDS:\nIf you find offensive content in another player's World, you can choose to add that World to your Banned World List. To do this, enter the Pause Menu and press " + (object) '\x0083' + ". If you attempt to join that World in the future, you will be notified that it is in your Banned World List and given the option to either remove it from the list and continue into the World or to back out." + }; + public static string[] HTP_TEXT_DE = new string[14] + { + "GRUNDLAGEN:\n\nGraben! Kämpfen! Erkunden! Bauen! In Terraria ist jede Welt einzigartig -- von den schwimmenden Inseln am Himmel bis zu den tiefsten Ebenen der Unterwelt. Wage dich bis zum Ende der Erde und besiege auf dem Weg bösartige Endgegner. Die Welt ist deine Leinwand.\n\n Fälle Bäume mit einer Axt, um Holz zu sammeln. Töte Schleime und sammle ihre Gels. Kombiniere Holz und Gel, um Fackeln anzufertigen. \n\nWenn du Höhlen erforschst, ist es hilfreich, hölzerne Plattformen zu haben. Fertige sie aus Holz an.\n\nVerwende eine Spitzhacke, um die verschiedenen Erze in der Welt abzubauen und schmelze sie in einem Schmelzofen zu Barren. Verwende diese, um bessere Waffen und Rüstung herzustellen. Manche Waffen, wie Bögen und Pistolen, benötigen Munition in deinen Munitions-Slots. Magische Waffen benötigen Mana.\n\nHalte die Augen auf nach Lebenskristallen, um deine Gesundheit zu erhöhen, und sammle Sternschnuppen, um Manakristalle herzustellen.\n\nOh, und baue ein Haus vor Einbruch der Dunkelheit. Du wirst es brauchen.", + "CHARAKTERERSTELLUNG:\n\nErstelle einen Charakter und gestalte ihn so, wie du ihn dir vorstellst!\n\nEin Charakter der Schwierigkeitsstufe Normal verliert nur seine Münzen, wenn er stirbt. Bei der Einstellung Schwer verliert ein Charakter alle Gegenstände. Wenn einHardcore-Charakter stirbt, wird er für immer gelöscht. Diese Schwierigkeitsstufe ist nur für fortgeschrittene (und HARDCORE-) Spieler gedacht.\n\nGegenstände, die ein Charakter besitzt, bleiben dem Charakter erhalten. Die Gegenstände einer Welt bleiben in dieser Welt.", + "STEUERUNG:\n\nBewege dich mit " + (object) '\x0084' + ". Drücke Unten, um durch hölzerne Plattformen zu fallen.\n\nDrücke zum Springen " + (string) (object) '\x008C' + ".\n\nDrücke " + (string) (object) '\x0081' + ", um eine Aktion mit einem Gegenstand auszuführen, wie z.B. eine Axt schwingen, eine Fackel platzieren oder einen Trank trinken.\n\nBenutze " + (string) (object) '\x0085' + ", um mit dem Cursor zu zielen. Es gibt zwei Cursor-Modi " + (string) (object) '\x0085' + ". Drücke " + (string) (object) '\x008F' + ", um zwischen ihnen zu wechseln.\n\n1) Im Auto-Modus wird durch Drücken von " + (string) (object) '\x0081' + " eine Aktion in die Richtung des Cursors ausgeführt.\n\n2) Im manuellen Modus agiert der Cursor wie eine Maus. Durch Drücken von " + (string) (object) '\x0081' + " wird eine Aktion an der Position des Cursor ausgeführt.\n\nDrücke " + (string) (object) '\x008D' + ", um ein nahegelegenes Objekt oder einen NPC zu benutzen. Benutzbare Gegenstände und NPCs leuchten gelb. Wenn du in der Nähe bist, beginnen sie zu leuchten und du kannst mit ihnen interagieren.\n\nDrücke " + (string) (object) '\x008A' + ", um einen Gegenstand fallen zu lassen.\n\nZiele und drücke " + (string) (object) '\x0080' + ", um einen Enterhaken oder Ähnliches zu benutzen (falls du einen in deinem Inventar hast).\n\nDu kannst " + (string) (object) '\x008E' + " als alternativen Knopf zum Springen drücken. Fortgeschrittene Spieler wollen vielleicht die Knöpfe für Festhaken und Springen tauschen. Das ist im Steuerungsmenü möglich.\n\nDrücke " + (string) (object) '\x0087' + ", um Weltkarte und Spielerliste zu sehen.", + "HUD:\n\nDie Inventarleiste befindet sich oben auf dem Bildschirm. Der aktuelle Gegenstand ist gelb markiert. Durch Drücken von \x0082\x0083 kannst du zwischen Gegenständen wechseln. Drücke " + (object) '\x008B' + ", um Gegenstände neu zu arrangieren oder den Rest des Inventars zu betrachten.\n\nDeine Lebenspunkte werden ebenfalls oben auf dem Bildschirm angezeigt. Jedes Herz steht für 20 Lebenspunkte.\n\nBist du unter Wasser, wird die verbleibende Atemluft unter deinen Lebenspunkten angezeigt.\n\nMana erkennst du als blaue Sterne auf der rechten Bildschirmseite. Jeder Stern steht für 20 Mana.\n\nAktive Buffs und Debuffs werden -- mit der verbleibenden Zeit -- unter der Inventarleiste angezeigt. Wechsle in die Ausrüstungssektion des Inventarmenüs, um einen Buff abzuschalten oder mehr über ihn herauszufinden.", + "INVENTAR:\n\nDrücke " + (object) '\x008B' + ", um das Inventarmenü zu öffnen.\n\nDas Inventarmenü enthält verschiedene Sektionen: Inventar, Ausrüstung, Herstellung und Unterkunft. Wenn du eine Schatzkiste oder einen Verkäufer-NPC aktiviert hast, wird dafür auch eine Sektion angezeigt.\n\nWechsle zwischen den Sektionen, indem du \x0082\x0083 drückst.\n\nDie Inventarleiste ist die obere Reihe der Gegenstand-Slots in deinem Inventar.\n\nDrücke " + (string) (object) '\x0084' + ", um zwischen den Slots zu wechseln.\n\nDrücke " + (string) (object) '\x008C' + ", um einen Gegenstand aufzuheben. Falls sich ein Stapel an Gegenständen im Slot befindet, hebst du sie mit " + (string) (object) '\x008C' + " alle auf. Drücke " + (string) (object) '\x0081' + ", um einen einzelnen Gegenstand aufzuheben.\n\nWähle einen anderen Slot und drücke " + (string) (object) '\x008C' + ", um den Gegenstand dort abzulegen.\n\nWenn du einen Gegenstand aufhebst, kannst du zwischen den Ausrüstungs- und Inventar-Sektionen -- oder zu einer Schatzkisten- (oder einer anderen Lagerungs-) Sektion -- wechseln und der Gegenstand wird auf deinem Cursor bleiben.\n\nDrücke " + (string) (object) '\x008A' + ", um einen Gegenstand direkt in den Müll zu werfen.\n\nEin Gegenstand im Müll-Slot wird nach einer kurzen Verzögerung gelöscht. Drücke " + (string) (object) '\x0081' + ", um Gegenstände wie Rüstung oder Zubehör direkt in einem verwendbaren Slot zu platzieren.", + "AUSRÜSTUNG:\n\nDie Ausrüstungs-Sektion des Inventarmenüs enthält Slots für Rüstung, Verzierung, Zubehör und Buffs/Debuffs.\n\nDrücke " + (object) '\x0084' + ", um zwischen Slots zu wechseln.\n\nGegenstände in Verzierungs-Slots erscheinen an deinem Charakter, haben aber keine Wirkung und verleihen dir keine Boni.\n\nDrücke " + (string) (object) '\x008C' + ", um Gegenstände aufzunehmen und zu platzieren. Du kannst einen Gegenstand aufnehmen und zwischen den Ausrüstungs- und Inventarsektionen verschieben, wobei der Gegenstand auf deinem Cursor bleibt.\n\nAktive Buff-/Debuff-Slots befinden sich über deinem Charakter-Avatar. Wähle einen aktiven Buff oder Debuff, um mehr darüber zu erfahren. Drücke " + (string) (object) '\x008C' + ", um einen Buff abzubrechen; Debuffs können nicht abgebrochen werden.", + "HERSTELLUNG:\n\nIn der Herstellungssektion kannst du neue Arten von Gegenständen herstellen, indem du Gegenstände aus deinem Inventar kombinierst.\n\nDie Herstellungssektion ist Teil des Inventarmenüs. Man öffnet es durch Drücken von " + (object) '\x008B' + ". Wechsle durch Drücken von \x0082\x0083 zur Herstellungssektion.\n\nWechsle zwischen den Gegenstandskategorien, indem du " + (string) (object) '\x0080' + ", " + (string) (object) '\x0081' + " drückst. Es gibt sechs Kategorien: Bauwerke, Werkzeuge, Waffen, Rüstung, Verbrauchsgegenstände und Verschiedenes.\n\nVerwende " + (string) (object) '\x0084' + ", um zwischen den Anleitungen zu wechseln.\n\nDrücke " + (string) (object) '\x008C' + ", um einen Gegenstand nach einer Anleitung herzustellen und platziere ihn in deinem Inventar.\n\nDie Anleitungen werden in der vertikalen Liste angezeigt. Sämtliche Variationen dieses Basisgegenstands werden in einer horizontalen Liste angezeigt. Du kannst mehr Anleitungen freischalten, indem du exotische Zutaten sammelst oder neue Geräte zur Herstellung produzierst (wie etwa eine Werkbank oder einen Amboss). Drücke " + (string) (object) '\x008A' + ", um entweder die Anleitungen anzuzeigen, mit denen du momentan etwas herstellen kannst, oder um sämtliche freigeschalteten Anleitungen anzuzeigen.\n\nBestandteile für die aktuelle Anleitung werden in der Bestandteilssektion angezeigt, zusammen mit den Geräten zur Herstellung, die sich in dieser Welt in der Nähe befinden müssen, um die Anleitung befolgen zu können. Drücke " + (string) (object) '\x008B' + ", um die Bestandteilssektion zu betreten (oder verlassen) und mehr über individuelle Bestandteile herauszufinden.", + "UNTERKUNFT:\n\nBaue ein Haus vor Einbruch der Dunkelheit, um sicher zu sein.\n\nEin Haus (oder Zimmer) gilt als fertig, wenn die Seitenwände mindestens sechs Block hoch und Decke und Fußboden mindestens zehn Block breit sind. Außerdem muss die Rückseite komplett mit Wänden vertäfelt sein (wie z.B. mit Holzwänden oder Lehmwänden). Zum Abschluss musst du eine Lichtquelle (z.B. eine Fackel), einen Stuhl und einen Tisch aufstellen.\n\nDu kannst deinen Spawnpunkt ändern, indem du ein Bett platzierst und benutzt. Wenn du einen Magischen Spiegel findest, kannst du dich damit zu deinem Spawnpunkt teleportieren.\n\nJe weiter du vorankommst, desto mehr NPCs können in dein Haus einziehen, sofern du genug bewohnbare Räume für sie hast.\n\nIm Inventarmenü befindet sich eine Unterkunftssektion, in der du deinen Haushalt verwalten kannst. Öffne das Inventarmenü, indem du " + (object) '\x008B' + " drückst und wechsle mit \x0082\x0083 zwischen den Unterkunftssektionen.\n\nIn der Unterkunftssektion werden die NPCs angezeigt, die in deinen Räumen leben. Wähle mit " + (string) (object) '\x0084' + " verschiedene NPCs aus und du erfährst mehr über sie. Weise einem NPC mit " + (string) (object) '\x008C' + " den Raum zu, in dem du dich befindest. Lass dir mit " + (string) (object) '\x008B' + " die Standorte der NPCs in der Welt anzeigen oder blende sie aus. Drücke " + (string) (object) '\x008A' + ", um zu prüfen, ob du in einem fertigen Haus bist.", + "LAGERN & VERKÄUFER:\n\nWenn du einen Lagergegenstand in der Welt (z.B. eine Kiste) oder einen Verkäufer-NPC (z.B. einen Händler) benutzt, öffnet sich eine spezielle Sektion des Inventarmenüs.\n\nDrücke " + (object) '\x008C' + " in der Lagersektion, um Gegenstände auszuwählen und zu platzieren. Du kannst einen Gegenstand aufheben und zwischen den Inventar-, Ausrüstungs- und Lagersektionen verschieben, wobei der Gegenstand auf deinem Cursor verbleibt.\n\nEs gibt drei Abkürzungen zur Lagerung: Alles plündern platziert so viele Gegenstände in deinem Inventar wie möglich; Alles lagern platziert so viele Gegenstände deines Inventars im Lager wie möglich;Schnell stapeln platziert nur Gegenstände von deinem Inventar im Lager, von denen dort bereits Stapel existieren.\n\nDrücke " + (string) (object) '\x008C' + " in der Gegenstandssektion eines Verkäufers, um einen Gegenstand mit Münzen zu kaufen. Platziere Gegenstände von deinem Inventar in der Gegenstandssektion des Verkäufers, um sie zu verkaufen.", + "BUFFS & DEBUFFS:\n\nBuffs sind positive Statuseffekte, wie z.B. Unsichtbarkeit oder ein Haustier. Debuffs sind negative Statuseffekte, wie z.B. Verwundungen oder durch Tränke hervorgerufene Krankheiten.\n\nAktive Buffs und Debuffs werden unterhalb der Inventarleiste angezeigt. Die meisten haben eine zeitlich begrenzte Wirkung. In der Ausrüstungssektion des Inventarmenüs erfährst du mehr darüber. Dort kannst du Buffs auch deaktivieren, indem du sie auswählst und " + (object) '\x008C' + " drückst.", + "MEHRSPIELER:\n\nTerraria ist automatisch ein Spiel für mehrere Spieler.\n\nDer geteilte Bildschirm unterstützt bis zu vier Spieler. Lokale Spieler können jederzeit deinem Spiel beitreten, indem sie Controller anschließen und " + (object) '\x0088' + " oder " + (string) (object) '\x008C' + " drücken.\n\nOnline-Spiele unterstützen bis zu acht Spieler. Wenn du ein Online-Spiel startest, wird das Spiel für deine Freunde sichtbar (es sei denn, du hast \"Nur mit Einladung\" ausgewählt). Ebenso wird ein Spiel für dich sichtbar, wenn deine Freunde ein öffentliches Spiel starten.\n\nDrücke " + (string) (object) '\x0087' + " Im Spiel, um eine Liste der Spieler und ihre Positionen auf der Weltkarte anzuzeigen. Hier kannst du auch Spieler einladen, Spielerkarten betrachten, den Spieler-gegen-Spieler-Modus (PvP) aktivieren oder eine Farbe für dein Team auswählen.\n\nIm Spieler-gegen-Spieler-Modus (PvP) können Spieler sich gegenseitig angreifen.\n\nWenn Spieler eine Farbe für ihr Team auswählen, sind ihr Standort und ihre Gesundheit nur für Teammitglieder sichtbar. Teammitglieder können sich nicht gegenseitig angreifen.", + "KERKER:\n\nIn jeder Welt gibt es einen Kerker.\n\nBetritt niemals einen Kerker, ohne zuerst seinen Wächter zu besiegen.\n\nSuche nach einem alten Mann und sprich mit ihm, wenn es Nacht ist.\n\nSei auf alles vorbereitet.", + "SCHWIERIGER MODUS:\n\nUm den schwierigen Modus zu aktivieren, musst du das unsägliche Grauen besiegen, das in der Unterwelt lebt. Finde eine Führer-Voodoopuppe und wirf sie in die höllische Lava, um die Monstrosität herbeizurufen.\n\nWenn du sie besiegst, kannst du mit ihren Schätzen die Dämonenaltäre zerstören.\n\nDer schwierige Modus verändert die Welt dauerhaft: Es erscheinen neue Umgebungen, neue Feinde, Endgegner, Gegenstände und NPCs.\n\nDer schwierige Modus ist nur für die furchtlosesten Kämpfer gedacht.", + "WELTEN VERBANNEN:\n\nWenn du anstößige Inhalte in der Welt eines anderen Spielers findet, hast du die Möglichkeit, diese Welt auf die \"Verbannte Welten\" Liste zu stellen. Dafür musst du das Pausenmenü aufrufen und " + (object) '\x0083' + " drücken. Solltest du zukünftig versuchen, diese Welt zu betreten, erhältst du eine Benachrichtigung, dass sich diese Welt auf der Liste deiner verbannten Welten befindet. Du kannst dann entscheiden, ob du die Welt aus dieser Liste streichen möchtest und damit weiteren Zugang zu ihr erhältst, oder ob der Bann weiterhin bestehen soll." + }; + public static string[] HTP_TEXT_FR = new string[14] + { + "LES BASES\n\nCreusez ! Combattez ! Explorez ! Construisez ! Dans Terraria, chaque monde est unique : des îles flottantes dans le ciel aux profondeurs du monde des Enfers. Aventurez-vous jusqu'aux confins de la terre et réduisez à néant les boss qui croisent votre chemin. Le monde est votre toile.\n\nCoupez des arbres avec une hache pour collecter du bois. Éliminez des slimes pour récolter leur gel. Combinez le bois et le gel pour fabriquer des torches.\n\nLes plateformes en bois sont utiles lorsque vous explorez des grottes. Fabriquez-les avec le bois collecté.\n\n Extrayez tous les types de minerais du monde à l'aide d'une pioche et fondez-les en lingots aux fournaises. Avec ceux-ci, vous pourrez fabriquer de meilleures armes et armures. Vous aurez besoin de stocker des munitions pour certaines armes, telles que les arcs ou les pistolets. Les armes magiques ont besoin de mana.\n\nRestez à l'affût des Cristaux de Vie pour restaurer votre santé, et collectez les Étoiles filantes pour fabriquer les Cristaux Mana.\n\nPensez également à construire une maison avant la tombée de la nuit. Vous en aurez besoin.", + "CRÉATION DE PERSONNAGE\n\nCréez un personnage et personnalisez-le à votre idée !\n\nEn mode Normal, un personnage ne perd ses pièces que quand il meurt. En mode Difficile, un personnage perd tous ses objets. Lorsqu'un personnage meurt en mode Hardcore, il est supprimé définitivement. Cette fonction est recommandée uniquement aux joueurs les plus expérimentés (et HARDCORE).\n\nLes objets que possède le personnage restent siens. Les objets d'un monde restent dans ce monde.", + "COMMANDES\n\nUtilisez " + (object) '\x0084' + " pour vous déplacer. Appuyez sur Bas pour passer au travers des plateformes en bois.\n\nAppuyez sur " + (string) (object) '\x008C' + " pour sauter.\n\nAppuyez sur " + (string) (object) '\x0081' + " pour effectuer une action avec l'objet tenu (comme brandir une hache, placer une torche ou boire une potion).\n\nUtilisez " + (string) (object) '\x0085' + " pour viser avec votre curseur. Il y a deux modes Curseur " + (string) (object) '\x0085' + ". Appuyez sur " + (string) (object) '\x008F' + " pour passer de l'un à l'autre.\n\n1)En mode Auto, appuyer sur " + (string) (object) '\x0081' + " effectue une action dans la direction du curseur.\n\n2) En mode Manuel, le curseur agit comme une souris. Appuyer sur " + (string) (object) '\x0081' + " effectue une action à l'emplacement exact du curseur.\n\nAppuyez sur " + (string) (object) '\x008D' + " pour utiliser un objet ou un PNJ à proximité. Les objets et PNJ utilisables apparaissent en jaune ; ils se mettent à clignoter lorsque vous vous en approchez et vous pouvez interagir avec.\n\nAppuyez sur " + (string) (object) '\x008A' + " pour lâcher l'objet tenu.\n\nVisez et appuyez sur " + (string) (object) '\x0080' + " pour utiliser un grappin ou un objet similaire (si vous en avez un dans votre inventaire).\n\n " + (string) (object) '\x008E' + " est un autre bouton qui vous permet de sauter. Les joueurs expérimentés souhaiteront peut-être échanger le grappin contre des boutons de saut ; ceci est possible depuis le menu Commandes.\n\nAppuyez sur " + (string) (object) '\x0087' + " pour consulter la Carte du monde et la liste des joueurs.", + "Affichage tête haute\n\nLa barre d'inventaire se trouve en haut de votre écran. L'objet tenu est surligné en jaune. Vous pouvez faire défiler les objets en appuyant sur \x0082\x0083. Pour réorganiser vos objets ou voir le reste de votre inventaire, appuyez sur " + (object) '\x008B' + ".\n\nVotre indicateur de santé se trouve également en haut de votre écran. Chacun des cœurs vous donne 20 points de santé.\n\nSi vous êtes sous l'eau, l'oxygène restant est affiché sous l'indicateur de santé.\n\nSi vous avez du mana, il apparaîtra sous forme d'étoiles bleues à la droite de votre écran. Chaque étoile représente 20 points de mana.\n\nTout buff ou débuff actif, ainsi que leur durée restante, sont affichés sous la barre d'inventaire. Pour annuler un buff ou en savoir plus à son sujet, consulter la section Équiper du menu Inventaire.", + "INVENTAIRE\n\nAppuyez sur " + (object) '\x008B' + " pour accéder au menu Inventaire.\n\nLe menu Inventaire contient plusieurs sections : Inventaire, Équiper, Artisanat et Logement. Vous pourrez également trouver une section pour les coffres et PNJ vendeurs au cas où vous en auriez activés.\n\nChangez de sections en appuyant sur \x0082\x0083.\n\nLa barre d'inventaire représente la ligne supérieure des emplacements pour objets de votre inventaire.\n\nUtilisez " + (string) (object) '\x0084' + " pour vous déplacer dans les emplacements.\n\nAppuyez sur " + (string) (object) '\x008C' + " pour prendre un objet. Si il y a une pile d'objets dans l'emplacement, " + (string) (object) '\x008C' + " vous permettra de tous les prendre. Appuyez sur " + (string) (object) '\x0081' + " pour prendre un seul objet.\n\nAllez sur un autre emplacement et appuyez sur " + (string) (object) '\x008C' + " pour y placer l'objet.\n\nLorsque vous prenez un objet, vous pouvez passer de la section Équiper à la section Inventaire ; ou à une section coffre (ou tout autre stockage) ; et l'objet restera sur votre curseur.\n\nAppuyez sur " + (string) (object) '\x008A' + " pour mettre un objet directement dans la Poubelle.\n\nUn objet placé dans la Poubelle sera supprimé rapidement. Appuyez sur " + (string) (object) '\x0081' + " pour équiper les objets tels que les armures ou les accessoires dans des emplacements permettant une utilisation directe.", + "ÉQUIPER\n\nLa section Équiper du menu Inventaire contient des emplacements pour les objets d'armure, de vanité, les accessoires, ainsi que les buffs et débuffs.\n\nUtilisez " + (object) '\x0084' + " pour vous déplacer dans les emplacements.\n\nLes objets dans les emplacements de Vanité apparaissent sur votre personnage mais ne confèrent ni statistiques, ni effets bonus.\n\nAppuyez sur " + (string) (object) '\x008C' + " pour prendre et placer des objets. Vous pouvez prendre un objet et passer des sections Équiper à Inventaire sans que l'objet ne quitte votre curseur.\n\nLes emplacements pour les buffs et débuffs actifs se trouvent au-dessus de l'avatar de votre personnage. Sélectionnez un buff ou débuff actif pour en savoir plus à son sujet. Appuyez sur " + (string) (object) '\x008C' + " pour annuler un buff ; les débuffs ne peuvent pas être annulés.", + "ARTISANAT\n\nDans la section Artisanat, vous pouvez créer de nouveaux types d'objets en combinant ceux de votre inventaire comme ingrédients.\n\nLa section Artisanat fait partie du menu Inventaire qui s'ouvre en appuyant sur " + (object) '\x008B' + ". Allez à la section Artisanat en appuyant sur \x0082\x0083.\n\nPassez d'une catégorie d'objets à une autre en appuyant sur " + (string) (object) '\x0080' + " " + (string) (object) '\x0081' + ". Il y a six catégories : Structures, Outils, Armes, Armures, Consommables et Divers.\n\nUtilisez " + (string) (object) '\x0084' + " pour faire défiler les recettes d'artisanat.\n\nAppuyez sur " + (string) (object) '\x008C' + " pour fabriquer un objet à partir d'une recette et le placer dans votre inventaire.\n\nLes recettes d'objets sont affichées dans la liste verticale. Toute variante de cet objet de base figure dans la liste horizontale. Vous déverrouillerez davantage de recettes d'artisanat au fur et à mesure que vous collecterez des ingrédients exotiques ou créerez de nouveaux objets pour vos stations d'artisanat (par exemple, une table ou une enclume). Appuyez sur " + (string) (object) '\x008A' + " pour afficher uniquement les recettes que vous pouvez fabriquer actuellement ou celles que vous avez déverrouillées.\n\nLes ingrédients pour la recette choisie apparaissent dans la zone Ingrédients avec les objets de stations d'artisanat qui doivent se trouver aux alentours pour fabriquer cette recette. Appuyez sur " + (string) (object) '\x008B' + " pour entrer dans la zone Ingrédients (ou en sortir) afin d'en savoir plus sur chaque ingrédient.", + "LOGEMENT\n\nConstruisez une maison avant la tombée de la nuit pour être en sécurité\n\nUne maison (ou chambre) est considérée comme valide si les murs font au moins 6 blocs de haut, et le plancher et le plafond 10 blocs de largeur. De plus, le fond doit être complètement recouvert de murs (par exemple, un mur en bois ou en terre). Pour finir, vous devez placer une source de lumière (par exemple, une torche), ainsi qu'une chaise et une table.\n\nVous pouvez modifier votre point d'apparition en plaçant un lit et en l'utilisant. Si vous trouvez un miroir magique, vous pouvez l'utiliser pour vous téléporter à votre point d'apparition.\n\nAu fur et à mesure de votre progression, des PNJ s'installeront dans votre maison si elle comporte des chambres libres et valides.\n\nDans le menu Inventaire, vous trouverez une section Logement qui vous permettra de gérer votre foyer. Ouvrez le menu Inventaire en appuyant sur " + (object) '\x008B' + ", puis appuyez sur \x0082\x0083 pour accéder à la section Logement.\n\nDans celle-ci, vous pouvez voir les PNJ qui vivent dans vos chambres. Appuyez sur " + (string) (object) '\x0084' + " pour sélectionner les différents PNJ et en savoir plus à leur sujet. Appuyez sur " + (string) (object) '\x008C' + " pour attribuer la chambre dans laquelle vous vous trouvez à un PNJ. Appuyez sur " + (string) (object) '\x008B' + " pour afficher ou masquer les drapeaux des chambres des PNJ dans le monde. Appuyez sur " + (string) (object) '\x008A' + " pour vérifier que vous vous trouvez dans un logement valide.", + "STOCKAGE ET VENDEURS\n\nSi vous utilisez un objet de stockage dans le monde (comme un coffre) ou un PNJ vendeur (comme un marchand), cela ouvrira une section spéciale dans le menu Inventaire.\n\nDans une section d'objets de stockage, appuyez sur " + (object) '\x008C' + " pour prendre des objets et les placer. Vous pouvez prendre un objet et vous déplacer dans les sections Inventaire, Équiper et stockage, l'objet restera sur votre curseur.\n\nIl y a également trois raccourcis possibles : Piller Tout déplace autant d'objets que possible vers votre inventaire ; Déposer tout déplace autant d'objets que possible de votre inventaire dans le stockage ; Pile rapide déplace uniquement les objets de votre inventaire correspondant aux piles d'objets déjà en stock.\n\nDans une section objets de vendeur, appuyez sur " + (string) (object) '\x008C' + " pour acheter un objet avec des pièces. Déplacez des objets de votre inventaire à la section d'objets de vendeur pour les vendre.", + "BUFFS ET DÉBUFFS\n\nLes buffs sont les effets positifs sur l'état tels que l'invisibilité ou un animal de compagnie. Les débuffs sont les effets négatifs sur l'état tels que le saignement ou la maladie des potions.\n\nLes buffs et débuffs actifs sont affichés sous votre barre d'inventaire. La plupart ont une durée limitée. Vous pouvez en apprendre davantage à leur sujet dans la section Équiper du menu Inventaire. Depuis cette section, vous pouvez également annuler un buff en le sélectionnant et en appuyant sur " + (object) '\x008C' + ". Les débuffs ne peuvent pas être annulés.", + "MULTIJOUEUR\n\nTerraria est un jeu multijoueur par défaut.\n\nL'écran partagé prend en charge jusqu'à 4 joueurs. Les joueurs locaux peuvent rejoindre la partie en connectant leurs manettes et en appuyant " + (object) '\x0088' + " ou " + (string) (object) '\x008C' + " a tout moment.\n\nLes parties en ligne prennent en charge jusqu'à 8 joueurs. Lorsque vous commencez une partie en ligne, elle devient visible pour vos amis (à moins que vous n'ayez sélectionné \"Sur invitation seulement\"). De même, lorsque vos amis organisent des parties publiques, vous pourrez les voir et vous y joindre.\n\nPendant la partie, appuyez sur " + (string) (object) '\x0087' + " pour voir la liste des joueurs et leur emplacement sur la carte du monde. Depuis cet écran, vous pouvez également inviter des joueurs, voir les cartes de joueurs, basculer en mode Joueur contre Joueur (JcJ) ou choisir la couleur de votre équipe.\n\nLes joueurs qui activent le mode Joueur contre Joueur (JcJ) peuvent s'attaquer entre eux.\n\nLorsque les joueurs sélectionnent une couleur pour l'équipe, seuls leurs coéquipiers peuvent voir leur emplacement et leur santé. Les coéquipiers ne peuvent pas s'attaquer entre eux.", + "DONJON\n\nIl existe un donjon dans chacun des mondes.\n\nN'entrez pas dans un donjon sans en avoir vaincu son gardien.\n\nCherchez un vieil homme et parlez-lui une fois qu'il fait nuit.\n\nSoyez prêt à tout.", + "MODE DIFFICILE\n\nPour activer le mode Difficile, vous devez vaincre l'innommable horreur qui vit dans le monde des Enfers. Trouvez une poupée vaudou du guide et jetez-la dans la lave infernale pour invoquer la monstruosité.\n\nSi vous en sortez vainqueur, utilisez son trésor pour détruire les autels du démon.\n\nLe mode Difficile change définitivement le monde : de nouveaux environnements apparaissent, ainsi que de nouveaux ennemis, boss, objets et PNJ.\n\nLe mode Difficile est réservé aux guerriers les plus courageux.", + "BANNIR DES MONDES\n\nSi vous trouvez du contenu offensant dans le monde d'un autre joueur, vous pouvez ajouter ce monde à votre Liste de mondes interdits. Pour ce faire, allez dans le menu Pause et appuyez sur " + (object) '\x0083' + ". Si vous essayez de vous joindre à ce monde plus tard, vous serez informé(e) que celui-ci est sur votre liste de mondes bannis et vous aurez la possibilité de le supprimer de la liste et continuer ou bien de quitter le monde." + }; + public static string[] HTP_TEXT_IT = new string[14] + { + "BASICS:\n\nScava! Combatti! Esplora! Costruisci! Ogni Mondo di Terraria è unico, dalle isole fluttuanti nel cielo ai livelli più profondi del Sotterraneo. Spingiti all'estremità della terra e sconfiggi i perfidi boss che troverai durante la tua avventura. Il mondo è la tua tela.\n\nAbbatti gli alberi con l'ascia per raccogliere la legna. Uccidi gli Slime e raccogli la loro gelatina. Unisci la legna alla gelatina per creare delle torce.\n\nAvere le piattaforme di legno è utile quando esplori le caverne. Creale utilizzando la legna.\n\nUtilizza un piccone per estrarre i diversi tipi di minerali e fondili nella fornace per creare delle barre. Da utilizzare per creare armi e armature migliori. Alcune armi, come gli archi e le pistole, richiedono di munizioni che troverai nelle sezioni per le munizioni. È necessario avere il mana per le armi magiche.\n\nCerca i Cristalli di vita per aumentare il livello di vita e raccogli le Stelle cadenti per creare i Cristalli di mana.\n\nOh... e costruisci una casa prima che cali la notte. Ne avrai bisogno!", + "CREAZIONE PERSONAGGIO:\n\nCrea un personaggio e personalizzalo a tuo piacimento!\n\nNella modalità Normale, quando il personaggio viene ucciso, perde solo le monete. Nella modalità Difficile, il personaggio perde tutti gli oggetti, mentre nella modalità Hardcore quando il personaggio muore, viene eliminato definitivamente. Questa modalità è raccomandata esclusivamente ai giocatori più esperti (e agli HARDCORE).\n\nGli oggetti di un personaggio rimangono su quel personaggio. Gli oggetti di un Mondo rimangono in quel Mondo.", + "COMANDI.\n\nUtilizzare " + (object) '\x0084' + " per muoversi. Premere giù per passare da una piattaforma di legno all'altra.\n\nPremere " + (string) (object) '\x008C' + " per saltare.\n\nPremere " + (string) (object) '\x0081' + " per eseguire un'azione con l'oggetto in possesso: ad es. muovere un'ascia, posizionare una torcia, o bere una pozione.\n\nUtilizzare " + (string) (object) '\x0085' + " per puntare il cursore. Sono presenti due modalità Cursore " + (string) (object) '\x0085' + ". Premere " + (string) (object) '\x008F' + " per passare da una modalità all'altra.\n\n1) Premendo " + (string) (object) '\x0081' + " nella modalità Automatica, è possibile eseguire un'azione nella direzione del cursore.\n\n2) Nella modalità Manuale, il cursore funge da mouse. Premendo " + (string) (object) '\x0081' + ", è possibile eseguire un'azione nella posizione esatta del cursore.\n\nPremere " + (string) (object) '\x008D' + " per utilizzare un oggetto vicino o un PNG. Gli oggetti disponibili e i PNG sono evidenziati in giallo. Quando si è vicini, lampeggeranno e sarà possibile interagirvi.\n\nPremere " + (string) (object) '\x008A' + " per lasciare l'oggetto in uso.\n\nPuntare e premere " + (string) (object) '\x0080' + " per utilizzare un rampino o un oggetto simile (se presente nell'Inventario).\n\nÈ possibile premere " + (string) (object) '\x008E' + " come pulsante alternativo per saltare. I giocatori più esperti possono cambiare la modalità di lotta e alternare i pulsanti per saltare. È possibile eseguire questa azione dal menu Comandi.\n\nPremere " + (string) (object) '\x0087' + " per visualizzare la mappa del mondo e la lista giocatori.", + "HUD:\n\nLa barra dell'Inventario si trova nella parte superiore dello schermo. L'oggetto di cui si è in possesso è evidenziato in giallo. È possibile scorrere gli oggetti, premendo \x0082\x0083. Per organizzare gli oggetti o visualizzare il resto dell'Inventario, premere " + (object) '\x008B' + ".\n\nInoltre, il livello di vita si trova nella parte superiore dello schermo. Ogni cuore costituisce 20 unità di vita.\n\nSe si è sott'acqua, il respiro restante è indicato sotto il livello di vita.\n\nIl mana apparirà sotto forma di stelle blu nella parte destra dello schermo, qualora in possesso. Ogni stella costituisce 20 mana.\n\nEventuali bonus e malus attivi sono indicati al di sotto della barra dell'Inventario, insieme alla loro durata restante. Per cancellare o ottenere maggiori informazioni sul bonus, consultare la sezione Equipaggiamento dal menu dell'Inventario.", + "INVENTARIO:\n\nPremere " + (object) '\x008B' + " per accedere al menu dell'Inventario.\n\nIl menu dell'Inventario contiene diverse sezioni: Inventario, Equipaggiamento, Creazione Oggetti e Alloggio. Se è stata attivata una cassa o un venditore PNG, sarà presente una sezione dedicata a quest'ultimi.\n\nPassare da una sezione a un'altra, premendo \x0082\x0083.\n\nLa Barra dell'Inventario è la barra nella parte superiore delle sezioni degli oggetti del tuo Inventario.\n\nUtilizzare " + (string) (object) '\x0084' + " per passare da una sezione a un'altra.\n\nPremere " + (string) (object) '\x008C' + " per raccogliere un oggetto; se nella sezione è presente una pila di oggetti, sarà possibile raccoglierli tutti, premendo " + (string) (object) '\x008C' + " Premere " + (string) (object) '\x0081' + " per raccogliere un oggetto.\n\nSpostarsi in un'altra sezione e premere " + (string) (object) '\x008C' + " per posizionare l'oggetto raccolto.\n\nQuando si raccoglie un oggetto, è possibile passare dalla sezione Equipaggiamento a quella dell'Inventario o alla sezione cassa (o a un altro portaoggetti) e l'oggetto rimarrà sul cursore.\n\nPremere " + (string) (object) '\x008A' + " per spostare un oggetto direttamente nel Cestino.\n\nDopo un breve intervallo, l'oggetto presente nel Cestino verrà eliminato. Premere " + (string) (object) '\x0081' + " per equipaggiarsi di un'armatura o un accessorio direttamente da una sezione disponibile.", + "EQUIPAGGIAMENTO:\n\nLa sezione Equipaggiamento del menu dell'Inventario contiene slot per le armature, oggetti di estetica, accessori, bonus e malus.\n\nUtilizzare " + (object) '\x0084' + " per spostarsi da uno slot all'altro.\n\nGli oggetti negli slot Estetica appaiono sul personaggio ma non forniscono bonus o effetti per le statistiche.\n\nPremere " + (string) (object) '\x008C' + " per raccogliere e posizionare gli oggetti. È possibile raccogliere un oggetto e spostarsi dalla sezione Equipaggiamento a quella dell'Inventario e l'oggetto rimarrà sul cursore.\n\nGli slot dei bonus/malus attivi si trovano al di sopra del proprio avatar. Selezionare il bonus o malus attivo per ottenere maggiori informazioni su di esso. Premere " + (string) (object) '\x008C' + " per annullare un bonus. I malus non possono essere annullati.", + "CREAZIONE OGGETTI:\n\nNella sezione Creazione Oggetti è possibile creare nuovi tipi di oggetti, utilizzando come ingredienti gli elementi dell'Inventario.\n\nLa sezione Creazione Oggetti fa parte del menu dell'Inventario, che è possibile aprire, premendo " + (object) '\x008B' + ". Spostarsi nella sezione Creazione Oggetti premendo \x0082\x0083.\n\nSpostarsi da una categoria oggetti all'altra premendo " + (string) (object) '\x0080' + " " + (string) (object) '\x0081' + ". Esistono sei categorie: Strutture, Attrezzi, Armi, Armature, Accessori e Altro.\n\nUtilizzare " + (string) (object) '\x0084' + " per scorrere le formule per la creazione.\n\nPremere " + (string) (object) '\x008C' + " per creare un oggetto dalla formula per la creazione e posizionalo nell'Inventario.\n\nLe formule per gli oggetti sono indicate nella lista verticale. Tutte le modifiche riportate agli oggetti base saranno indicate nella lista orizzontale. Con l'ottenimento di ingredienti esotici o con la creazione di nuovi oggetti base per la creazione (es. banco da lavoro o incudine), si sbloccheranno altre formule per la creazione. Premere " + (string) (object) '\x008A' + " per spostarsi dalla modalità per visualizzare solo le formule che si possono creare, alla modalità per visualizzare tutte le formule sbloccate.\n\nGli ingredienti della formula utilizzata sono indicati nell'area Ingredienti, insieme a tutti gli oggetti base per la creazione, che devono trovarsi a disposizione all'interno del Mondo per creare formule. Premere " + (string) (object) '\x008B' + " per entrare (o uscire) dall'area Ingredienti per ottenere maggiori informazioni sui singoli ingredienti.", + "ALLOGGIO:\n\nPer restare al sicuro, costruire un'abitazione prima che cali la notte.\n\nUn'abitazione (o stanza) è considerata valida se possiede muri laterali alti almeno 6 blocchi e un pavimento e soffitto larghi almeno 10 blocchi. Inoltre, lo sfondo deve essere interamente rivestito da muri (es. muri di legno o di terra). Infine, bisognerà posizionare una fonte di illuminazione (es. una torcia) e posizionare una sedia e un tavolo.\n\nÈ possibile modificare il punto di rigenerazione, posizionando e utilizzando il letto. Se si trova uno Specchio Magico, è possibile utilizzarlo per teletrasportarsi al punto di rigenerazione.\n\nMan mano che si procede, i PNG si trasferiranno all'interno dell'abitazione, se vi sono stanze vuote e valide in cui vivere.\n\nNel menu dell'Inventario è presente una sezione Alloggio, nella quale è possibile gestire la propria abitazione. Aprire il menu Inventario premendo " + (object) '\x008B' + ", e premere \x0082\x0083 per passare alla sezione Alloggio.\n\nNella sezione Alloggio è possibile visualizzare i PNG che vivono all'interno delle tue stanze. Premere " + (string) (object) '\x0084' + " per selezionare i diversi PNG e per ottenere maggiori informazioni su di essi. Premere " + (string) (object) '\x008C' + " per assegnare la stanza in cui ci si trova a un PNG. Premere " + (string) (object) '\x008B' + " per mostrare o nascondere le bandiere della stanza del PNG nel Mondo. Premere " + (string) (object) '\x008A' + " per controllare la validità dell'alloggio in cui ci si trova.", + "PORTAOGGETTI & VENDITORI:\n\nSe nel Mondo si utilizza un portaoggetti (es. una cassa) o un venditore PNG (es. un mercante), nel menu dell'Inventario apparirà una sezione speciale.\n\nPremere " + (object) '\x008C' + " in una sezione portaoggetti per raccogliere e posizionare gli oggetti. È possibile raccogliere un oggetto e spostarsi dalla sezione Equipaggiamento a quella dell'Inventario e dei portaoggetti, e l'oggetto rimarrà sul cursore.\n\nInoltre, sono disponibili tre comandi per i portaoggetti: Saccheggia Tutto sposta quanti più oggetti possibile nell'Inventario; Deposita Tutto sposta quanti più oggetti possibile dall'Inventario al portaoggetti; Raggruppamento Rapido sposta solo gli oggetti dell'Inventario che corrispondono agli oggetti già accumulati nel portaoggetti.\n\nNella sezione Negozio, premere " + (string) (object) '\x008C' + " per acquistare un oggetto con le monete. Spostare gli oggetti dall'Inventario alla sezione Negozio per venderli.", + "BONUS & MALUS:\n\nI bonus sono degli effetti positivi come l'Invisibilità o un'animale domestico. I malus sono degli effetti negativi come l'Avvelenamento da Pozione o il Sanguinamento.\n\nI bonus e i malus attivi sono indicati sotto la barra dell'Inventario. La maggior parte di essi possiede una durata limitata. È possibile ottenere maggiori informazioni nella sezione Equipaggiamento del menu dell'Inventario. Da qui, è inoltre possibile annullare un bonus, selezionandolo e premendo " + (object) '\x008C' + ". I malus non possono essere annullati.", + "MULTIGIOCATORE:\n\nTerraria è un gioco di base multigiocatore.\n\nLo schermo condiviso supporta fino a 4 giocatori. I giocatori a livello locale possono unirsi al gioco, collegando i controller e premendo " + (object) '\x0088' + " o " + (string) (object) '\x008C' + " in qualsiasi momento.\n\nUna partita online può supportare fino a 8 giocatori. Quando si inizia una partita online, la partita sarà visibile a tutti gli amici (a meno che non si sia selezionato l'opzione 'Solo su invito'). Allo stesso modo, è possibile visualizzare e unirsi alla partita pubblica ospitata dagli amici.\n\nPremere " + (string) (object) '\x0087' + " durante la partita per visualizzare la lista dei giocatori e la loro posizione sulla Mappa del Mondo. Inoltre, è possibile invitare giocatori, visualizzare i profili, attivare la modalità Player vs Player (PvP) o scegliere il colore della propria squadra.\n\nNella modalità Player vs Player (PvP), i giocatori possono attaccarsi a vicenda.\n\nQuando i giocatori selezionano il colore della propria squadra, la loro posizione e la loro vita saranno visibili solo ai compagni di squadra. I compagni di squadra non possono attaccarsi fra di loro.", + "DUNGEON:\n\nOgni Mondo contiene un Dungeon.\n\nNon entrare nel Dungeon senza aver prima sconfitto il guardiano.\n\nCerca un Vecchio e parlagli di notte.\n\nPreparati!", + "MODALITÀ HARD:\n\nPer attivare la modalità Hard, è necessario sconfiggere l'orribile mostro che vive nel Sotterraneo. Trova la Bambola Voodoo della Guida e lanciala nella lava infernale per evocare il mostro.\n\nAlla sua sconfitta, utilizza il suo tesoro per distruggere gli Altari dei demoni.\n\nLa modalità Hard modifica definitivamente il Mondo; appariranno nuovi luoghi, nemici, boss, oggetti e PNG.\n\nLa modalità Hard è solo per i guerrieri più coraggiosi!", + "BLOCCARE I MONDI:\nSe trovi del contenuto offensivo all'interno del Mondo di un altro giocatore, puoi scegliere di aggiungere quel Mondo alla tua lista dei Mondi bloccati. Per far ciò, entra nel Menu di Pausa e premi " + (object) '\x0083' + ". Se in futuro proverai ad entrare in quel Mondo, sarai notificato della sua presenza all'interno della tua lista dei Mondi bloccati e avrai inoltre la possibilità di scegliere se rimuoverlo dalla lista ed entrarci o no." + }; + public static string[] HTP_TEXT_ES = new string[14] + { + "INSTRUCCIONES BÁSICAS:\n\n¡Excava! ¡Lucha! ¡Explora! ¡Construye! En Terraria cada mundo es único, desde las islas flotantes del cielo hasta los niveles más profundos del Inframundo. Vive aventuras en los confines de la tierra y derrota a los malvados jefes que se interpongan en tu camino. El mundo es tu lienzo.\n\nTala árboles con un hacha para conseguir leña. Elimina slimes y consigue sus geles. Combina madera y geles para crear antorchas.\n\nLas plataformas de madera son muy útiles a la hora de explorar cuevas. Constrúyelas con madera.\n\nUsa un pico para extraer los diferentes tipos de minerales del mundo y fúndelos en barras en la fundición. Úsalos para crear armas y armaduras mejores. Algunas armas, como los arcos y las pistolas, necesitan que coloques munición en las ranuras de munición. Las armas mágicas precisan maná.\n\nMantén los ojos abiertos en busca de Cristales de vida para mejorar tu salud y reúne Estrellas fugaces para crear Cristales de maná.\n\nAh, y construye una casa antes de que caiga la noche. La vas a necesitar...", + "CREACIÓN DE PERSONAJES:\n\n¡Crea un personaje y personalízalo como quieras!\n\nEn el nivel de dificultad Normal, los personajes solo pierden monedas cuando son eliminados. En el nivel Difícil, los personajes pierden todos sus objetos. En el nivel Hardcore, si un personaje muere, es eliminado permanentemente. Este ajuste solo se recomienda a los jugadores más avanzados (¡y HARDCORE!).\n\nLos objetos de un personaje permanecen en ese personaje. Los objetos de un mundo se quedan en ese mundo.", + "CONTROLES:\n\nUsa " + (object) '\x0084' + " para moverte. Pulsa abajo para dejarte caer por las plataformas de madera.\n\nPulsa " + (string) (object) '\x008C' + " para saltar.\n\nPulsa " + (string) (object) '\x0081' + " para realizar una acción con el objeto actual, como golpear con un hacha, colocar una antorcha o beber una poción.\n\nUsa " + (string) (object) '\x0085' + " para apuntar con el cursor. El cursor " + (string) (object) '\x0085' + " tiene dos modalidades. Pulsa " + (string) (object) '\x008F' + " para cambiar entre ellas.\n\n1) En el modo Automático, pulsa " + (string) (object) '\x0081' + " para realizar una acción en la dirección del cursor.\n\n2) En el modo Manual, el cursor actúa como un ratón. Pulsa " + (string) (object) '\x0081' + " para realizar una acción en la ubicación exacta del cursor.\n\nPulsa " + (string) (object) '\x008D' + " para interactuar con un objeto o PNJ cercano. Los objetos y PNJ con los que puedes interactuar se resaltan en amarillo. Cuando estás cerca, parpadearán y podrás interactuar con ellos.\n\nPulsa " + (string) (object) '\x008A' + " para soltar el objeto actual.\n\nApunta y pulsa " + (string) (object) '\x0080' + " para usar un garfio de escalada o similar (si tienes alguno en el inventario).\n\nPuedes pulsar " + (string) (object) '\x008E' + " como botón de salto alternativo. Los jugadores avanzados pueden cambiar los botones de agarre y salto alternativo, se puede hacer desde el menú de controles.\n\nPulsa " + (string) (object) '\x0087' + " para ver el mapamundi y la lista de jugadores.", + "PANEL DE INFORMACIÓN:\n\nLa barra de inventario está en la parte superior de la pantalla. El objeto actual está resaltado en amarillo. Puedes navegar por los objetos pulsando \x0082\x0083. Para reorganizar los objetos o ver el resto del inventario, pulsa " + (object) '\x008B' + ".\n\nLa salud se muestra en la parte superior de la pantalla. Cada corazón representa 20 puntos de salud.\n\nSi estás bajo el agua, el aire restante se muestra debajo de la salud.\n\nSi tienes maná, aparecerá en forma de estrellas azules en la parte derecha de la pantalla. Cada estrella representa 20 puntos de maná.\n\nLos potenciadores o penalizadores activos se muestran en la barra de inventario, junto con la duración restante. Para cancelar un potenciador o informarte de sus funciones, entra en la sección Equipo del menú Inventario.", + "INVENTARIO:\n\nPulsa " + (object) '\x008B' + " para acceder al menú Inventario.\n\nEl menú Inventario contiene varias secciones: Inventario, Equipo, Creación y Cobijo. Si has activado un cofre o un PNJ comerciante, también habrá una sección para el mismo.\n\nPasa de una sección a otra pulsando \x0082\x0083.\n\nLa barra del inventario es la fila superior de ranuras de objetos del inventario.\n\nUsa " + (string) (object) '\x0084' + " para moverte entre ranuras.\n\nPulsa " + (string) (object) '\x008C' + " para coger un objeto. Si hay varios objetos en la ranura, puedes cogerlos todos usando " + (string) (object) '\x008C' + ". Pulsa " + (string) (object) '\x0081' + " para coger un solo objeto.\n\nPasa a otra ranura y pulsa " + (string) (object) '\x008C' + " para colocar allí el objeto que has cogido.\n\nCuando coges un objeto puedes cambiar entre las secciones Equipo e Inventario, o una sección de cofre u otro espacio de almacenamiento; el objeto seguirá los movimientos del cursor.\n\nPulsa " + (string) (object) '\x008A' + " para poner un objeto directamente en la basura.\n\nLos objetos que estén en la basura serán eliminados después de un breve periodo. Pulsa " + (string) (object) '\x0081' + " para equipar objetos como armaduras o accesorios directamente en una ranura que puedas usar.", + "EQUIPO:\n\nLa sección Equipo del menú Inventario contiene ranuras para armaduras, adornos, accesorios y potenciadores/penalizadores.\n\nUsa " + (object) '\x0084' + " para pasar de una ranura a otra.\n\nLos objetos de las ranuras de adornos no proporcionan bonificaciones de estado o efectos.\n\nPulsa " + (string) (object) '\x008C' + " para recoger y colocar objetos. Puedes recoger un objeto y moverlo entre las secciones Equipo e Inventario; el objeto seguirá los movimientos del cursor.\n\nLas ranuras de potenciadores/penalizadores activas aparecen sobre el avatar del personaje. Selecciona un potenciador o penalizador activo para obtener información sobre el mismo. Pulsa " + (string) (object) '\x008C' + " para cancelar un potenciador. Los penalizadores no se pueden cancelar.", + "CREACIÓN:\n\nEn la sección Creación, puedes fabricar nuevos tipos de objetos combinando objetos del inventario como ingredientes.\n\nLa sección Creación es la parte del menú Inventario que puedes abrir pulsando " + (object) '\x008B' + ". Cambia a la sección Creación pulsando \x0082\x0083\n\nCambia entre categorías de objetos pulsando " + (string) (object) '\x0080' + " " + (string) (object) '\x0081' + ". Hay seis categorías: Estructuras, Herramientas, Armas, Armaduras, Consumibles y Varios.\n\nUsa " + (string) (object) '\x0084' + " para moverte entre las recetas de creación.\n\nPulsa " + (string) (object) '\x008C' + " para fabricar un objeto partiendo de una receta y ponerlo en el inventario.\n\nLas recetas de objetos se muestran en la lista vertical. Las variaciones de ese objeto base se muestran en una lista horizontal. Conforme vayas consiguiendo ingredientes exóticos y creando nuevos objetos para tu taller de creación (como una mesa o un yunque), se desbloquearán nuevas recetas. Pulsa " + (string) (object) '\x008A' + " para cambiar entre mostrar solo las recetas que puedes crear actualmente o mostrar todas las recetas que has desbloqueado.\n\nLos ingredientes de la receta actual se muestran en la zona de ingredientes, junto con los objetos del taller de creación que deben estar situados cerca para crear la receta. Pulsa " + (string) (object) '\x008B' + " para entrar (o salir) de la zona de ingredientes, donde podrás obtener más información sobre cada uno de ellos.", + "COBIJO:\n\nDebes construir una casa antes de que caiga la noche para estar a salvo.\n\nUna casa o habitación se considera válida si tiene paredes laterales de como mínimo 6 bloques de alto y un techo de 10 bloques de ancho. Además, el fondo debe estar totalmente cubierto de muros (como muros de madera o de barro). Por último, debes poner una fuente de luz (como una antorcha), además de una silla y una mesa.\n\nPuedes cambiar el punto de reaparición colocando y usando una cama. Si encuentras un espejo mágico, puedes usarlo para teletransportarte de nuevo al punto de reaparición.\n\nConforme vayas progresando, los PNJ se mudarán a tu casa para vivir en ella si hay habitaciones válidas y vacías.\n\nPuedes gestionar tu casa mediante la sección Cobijo del menú Inventario. Abre el menú Inventario pulsando " + (object) '\x008B' + ", y pulsa \x0082\x0083 para acceder a la sección Cobijo.\n\nEn la sección Cobijo puedes ver a los PNJ viviendo en sus habitaciones. Pulsa " + (string) (object) '\x0084' + " para seleccionar diferentes PNJ y obtener información sobre ellos. Pulsa " + (string) (object) '\x008C' + " para asignar ese PNJ a la sala en la que estás. Pulsa " + (string) (object) '\x008B' + " para mostrar y ocultar las banderas de habitaciones de PNJ. Pulsa " + (string) (object) '\x008A' + " para comprobar si estás en un cobijo válido.", + "ALMACENAMIENTO Y COMERCIANTES:\n\nAl interactuar con un objeto de almacenamiento (como un cofre) o con un PNJ comerciante (como un mercader), se abrirá una sección especial en el menú Inventario.\n\nPulsa " + (object) '\x008C' + " para coger y colocar objetos en la sección de almacenamiento. Puedes recoger un objeto y moverlo entre las secciones de Inventario, Equipo y Almacenamiento; el objeto seguirá los movimientos del cursor.\n\nHay tres accesos directos de almacenamiento disponibles: Saquearlo todo mueve tantos objetos como sea posible al inventario. Depositarlo todo mueve tantos objetos como sea posible del inventario al espacio de almacenamiento. Apilamiento rápido mueve solo los objetos del inventario que coinciden con objetos que ya están en el espacio de almacenamiento.\n\nEn una sección de objetos de comerciante, pulsa " + (string) (object) '\x008C' + " para comprar un objeto con monedas. Mueve los objetos del inventario a la sección de objetos del comerciante para venderlos.", + "POTENCIADORES Y PENALIZADORES:\n\nLos potenciadores proporcionan efectos de estado positivos, como Invisibilidad o Mascotas. Los penalizadores son efectos de estado negativos como Hemorragia o Enfermedad de poción.\n\nLos potenciadores y penalizadores activos se muestran bajo la barra de inventario. La mayoría tienen efectos de duración limitada. Puedes obtener más información acerca de ellos en la sección Equipo del menú Inventario. Desde ahí también puedes cancelar un potenciador seleccionándolo y pulsando " + (object) '\x008C' + ". Los penalizadores no se pueden cancelar.", + "MULTIJUGADOR:\n\nTerraria está diseñado especialmente para jugar con otros jugadores.\n\nEl modo de pantalla dividida es compatible con hasta 4 jugadores. Otros jugadores pueden unirse a una partida local conectando mandos y pulsando " + (object) '\x0088' + " o " + (string) (object) '\x008C' + " en cualquier momento.\n\nLas partidas online son compatibles con hasta 8 jugadores. Cuando inicias una partida online, la partida será visible para tus amigos (a menos que hayas seleccionado \"Solo por invitación\"). Del mismo modo, cuando tus amigos creen partidas públicas, serán visibles para ti.\n\nCuando estés en una partida, pulsa " + (string) (object) '\x0087' + " para ver una lista de jugadores y sus ubicaciones en el Mapamundi. Desde aquí también puedes invitar a jugadores, ver las tarjetas de jugador, activar o desactivar el modo Jugador Vs. Jugador o elegir el color de tu equipo.\n\nLos jugadores que activen el modo Jugador Vs. Jugador se pueden atacar entre ellos.\n\nAl elegir un color de equipo, la ubicación y la salud de un jugador solo serán visibles para sus compañeros de equipo. Los compañeros de equipo no se pueden atacar entre sí.", + "MAZMORRA:\n\nCada mundo incluye una mazmorra.\n\nNo entres en la mazmorra sin derrotar antes a su guardián.\n\nBusca a un Anciano y habla con él por la noche.\n\nPrepárate.", + "MODO DIFÍCIL:\n\nPara activar el modo Difícil, antes debes derrotar al innombrable horror que habita en el Inframundo. Encuentra un Muñeco vudú guía y lánzalo a la lava para invocar a la monstruosidad.\n\nSi lo derrotas, usa su tesoro para destruir los Altares demoníacos.\n\nEl modo Difícil cambia permanentemente el entorno: aparecen nuevos entornos, nuevos enemigos, jefes, objetos y PNJ.\n\nEl modo Difícil solo es para los guerreros más valientes.", + "CÓMO EXCLUIR MUNDOS:\nSi el contenido de algún mundo de otro jugador te parece ofensivo, puedes añadir ese mundo a tu lista de Mundos Prohibidos. Para hacerlo, entra en el menú de Pausa y pulsa " + (object) '\x0083' + ". Si intentas unirte a ese mundo posteriormente, serás notificado de que está en tu lista de Mundos Prohibidos y tendrás la opción de eliminarlo de esa lista y entrar en el mundo o retroceder." + }; + private const int SCROLL_SPEED = 4; + private Terraria.UI parentUI; + private static HowToPlayLayout[] pages; + private int index; + private short offsetY; + + private HowToPlayLayout SelectedPage + { + get + { + return UI.pages[this.index]; + } + } + + public int Offset + { + get + { + return (int) this.offsetY; + } + set + { + this.offsetY = (short) MathHelper.Clamp((float) value, (float) this.SelectedPage.textblock.minOffsetY, 0.0f); + } + } + + static UI() + { + } + + public UI(Terraria.UI parentUI) + { + this.parentUI = parentUI; + this.index = 0; + this.offsetY = (short) 0; + } + + public static UI Create(Terraria.UI parentUI) + { + return new UI(parentUI); + } + + public void Update() + { + bool flag = false; + if (this.parentUI.IsButtonTriggered(Buttons.X) && this.index > 0) + { + --this.index; + flag = true; + } + else if (this.parentUI.IsButtonTriggered(Buttons.A) && this.index < UI.pages.Length - 1) + { + ++this.index; + flag = true; + } + if (flag) + { + this.offsetY = (short) 0; + Main.PlaySound(12); + } + else + { + if (!this.SelectedPage.textblock.isScrollable) + return; + if (this.parentUI.IsDownButtonDown()) + { + this.Offset -= 4; + } + else + { + if (!this.parentUI.IsUpButtonDown()) + return; + this.Offset += 4; + } + } + } + + public void Draw() + { + this.SelectedPage.Draw(this.parentUI.view.SAFE_AREA_OFFSET_L, this.parentUI.view.SAFE_AREA_OFFSET_T, (int) this.offsetY); + } + + public void ControlDescription(StringBuilder strBuilder) + { + if (this.index < UI.pages.Length - 1) + { + strBuilder.Append(Lang.controls(Lang.CONTROLS.NEXT_PAGE)); + strBuilder.Append(' '); + } + if (this.index > 0) + { + strBuilder.Append(Lang.controls(Lang.CONTROLS.PREVIOUS_PAGE)); + strBuilder.Append(' '); + } + if (this.SelectedPage.textblock.isScrollable) + { + strBuilder.Append(Lang.controls(Lang.CONTROLS.SCROLL_TEXT)); + strBuilder.Append(' '); + } + strBuilder.Append(Lang.controls(Lang.CONTROLS.BACK)); + } + + public static void GenerateCache(GraphicsDevice graphicsDevice) + { + string[] strArray1 = UI.HTP_TEXT_EN; + switch (Lang.lang) + { + case 2: + strArray1 = UI.HTP_TEXT_DE; + break; + case 3: + strArray1 = UI.HTP_TEXT_IT; + break; + case 4: + strArray1 = UI.HTP_TEXT_FR; + break; + case 5: + strArray1 = UI.HTP_TEXT_ES; + break; + } + int num1 = 0; + HowToPlayLayout[] howToPlayLayoutArray1 = new HowToPlayLayout[14]; + HowToPlayLayout[] howToPlayLayoutArray2 = howToPlayLayoutArray1; + int index1 = 0; + string[] strArray2 = strArray1; + int index2 = num1; + int num2 = 1; + int num3 = index2 + num2; + HowToPlayLayout howToPlayLayout1 = HowToPlayLayout.StackedLayout(strArray2[index2], 700, 260, Assets.HOWTO_LOGO, 20); + howToPlayLayoutArray2[index1] = howToPlayLayout1; + HowToPlayLayout[] howToPlayLayoutArray3 = howToPlayLayoutArray1; + int index3 = 1; + string[] strArray3 = strArray1; + int index4 = num3; + int num4 = 1; + int num5 = index4 + num4; + HowToPlayLayout howToPlayLayout2 = HowToPlayLayout.StackedLayout(strArray3[index4], 700, 260, Assets.HOWTO_LOGO, 20); + howToPlayLayoutArray3[index3] = howToPlayLayout2; + HowToPlayLayout[] howToPlayLayoutArray4 = howToPlayLayoutArray1; + int index5 = 2; + string[] strArray4 = strArray1; + int index6 = num5; + int num6 = 1; + int num7 = index6 + num6; + HowToPlayLayout howToPlayLayout3 = HowToPlayLayout.SideBySideLayout(strArray4[index6], 500, Assets.HOWTO_MOVEMENT, 20); + howToPlayLayoutArray4[index5] = howToPlayLayout3; + HowToPlayLayout[] howToPlayLayoutArray5 = howToPlayLayoutArray1; + int index7 = 3; + string[] strArray5 = strArray1; + int index8 = num7; + int num8 = 1; + int num9 = index8 + num8; + HowToPlayLayout howToPlayLayout4 = HowToPlayLayout.StackedLayout(strArray5[index8], 700, 260, Assets.HOWTO_HOTBAR2, 20); + howToPlayLayoutArray5[index7] = howToPlayLayout4; + HowToPlayLayout[] howToPlayLayoutArray6 = howToPlayLayoutArray1; + int index9 = 4; + string[] strArray6 = strArray1; + int index10 = num9; + int num10 = 1; + int num11 = index10 + num10; + HowToPlayLayout howToPlayLayout5 = HowToPlayLayout.SideBySideLayout(strArray6[index10], 500, Assets.HOWTO_INVENTORY, 20); + howToPlayLayoutArray6[index9] = howToPlayLayout5; + HowToPlayLayout[] howToPlayLayoutArray7 = howToPlayLayoutArray1; + int index11 = 5; + string[] strArray7 = strArray1; + int index12 = num11; + int num12 = 1; + int num13 = index12 + num12; + HowToPlayLayout howToPlayLayout6 = HowToPlayLayout.TextOnlyLayout(strArray7[index12], 700); + howToPlayLayoutArray7[index11] = howToPlayLayout6; + HowToPlayLayout[] howToPlayLayoutArray8 = howToPlayLayoutArray1; + int index13 = 6; + string[] strArray8 = strArray1; + int index14 = num13; + int num14 = 1; + int num15 = index14 + num14; + HowToPlayLayout howToPlayLayout7 = HowToPlayLayout.TextOnlyLayout(strArray8[index14], 700); + howToPlayLayoutArray8[index13] = howToPlayLayout7; + HowToPlayLayout[] howToPlayLayoutArray9 = howToPlayLayoutArray1; + int index15 = 7; + string[] strArray9 = strArray1; + int index16 = num15; + int num16 = 1; + int num17 = index16 + num16; + HowToPlayLayout howToPlayLayout8 = HowToPlayLayout.TextOnlyLayout(strArray9[index16], 700); + howToPlayLayoutArray9[index15] = howToPlayLayout8; + HowToPlayLayout[] howToPlayLayoutArray10 = howToPlayLayoutArray1; + int index17 = 8; + string[] strArray10 = strArray1; + int index18 = num17; + int num18 = 1; + int num19 = index18 + num18; + HowToPlayLayout howToPlayLayout9 = HowToPlayLayout.TextOnlyLayout(strArray10[index18], 700); + howToPlayLayoutArray10[index17] = howToPlayLayout9; + HowToPlayLayout[] howToPlayLayoutArray11 = howToPlayLayoutArray1; + int index19 = 9; + string[] strArray11 = strArray1; + int index20 = num19; + int num20 = 1; + int num21 = index20 + num20; + HowToPlayLayout howToPlayLayout10 = HowToPlayLayout.StackedLayout(strArray11[index20], 700, 300, Assets.HOWTO_DEBUFF, 20); + howToPlayLayoutArray11[index19] = howToPlayLayout10; + HowToPlayLayout[] howToPlayLayoutArray12 = howToPlayLayoutArray1; + int index21 = 10; + string[] strArray12 = strArray1; + int index22 = num21; + int num22 = 1; + int num23 = index22 + num22; + HowToPlayLayout howToPlayLayout11 = HowToPlayLayout.TextOnlyLayout(strArray12[index22], 700); + howToPlayLayoutArray12[index21] = howToPlayLayout11; + HowToPlayLayout[] howToPlayLayoutArray13 = howToPlayLayoutArray1; + int index23 = 11; + string[] strArray13 = strArray1; + int index24 = num23; + int num24 = 1; + int num25 = index24 + num24; + HowToPlayLayout howToPlayLayout12 = HowToPlayLayout.TextOnlyLayout(strArray13[index24], 700); + howToPlayLayoutArray13[index23] = howToPlayLayout12; + HowToPlayLayout[] howToPlayLayoutArray14 = howToPlayLayoutArray1; + int index25 = 12; + string[] strArray14 = strArray1; + int index26 = num25; + int num26 = 1; + int num27 = index26 + num26; + HowToPlayLayout howToPlayLayout13 = HowToPlayLayout.TextOnlyLayout(strArray14[index26], 700); + howToPlayLayoutArray14[index25] = howToPlayLayout13; + HowToPlayLayout[] howToPlayLayoutArray15 = howToPlayLayoutArray1; + int index27 = 13; + string[] strArray15 = strArray1; + int index28 = num27; + int num28 = 1; + int num29 = index28 + num28; + HowToPlayLayout howToPlayLayout14 = HowToPlayLayout.TextOnlyLayout(strArray15[index28], 700); + howToPlayLayoutArray15[index27] = howToPlayLayout14; + UI.pages = howToPlayLayoutArray1; + foreach (HowToPlayLayout howToPlayLayout15 in UI.pages) + howToPlayLayout15.GenerateCache(graphicsDevice); + } + } +} diff --git a/Terraria/Item.cs b/Terraria/Item.cs new file mode 100644 index 0000000..2978f68 --- /dev/null +++ b/Terraria/Item.cs @@ -0,0 +1,9817 @@ +// Type: Terraria.Item +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework; +using System; + +namespace Terraria +{ + public struct Item + { + public static short[] headType = new short[48]; + public static short[] bodyType = new short[29]; + public static short[] legType = new short[28]; + private static readonly byte[] PREFIX_TOOLS = new byte[40] + { + (byte) 1, + (byte) 2, + (byte) 3, + (byte) 4, + (byte) 5, + (byte) 6, + (byte) 7, + (byte) 8, + (byte) 9, + (byte) 10, + (byte) 11, + (byte) 12, + (byte) 13, + (byte) 14, + (byte) 15, + (byte) 36, + (byte) 37, + (byte) 38, + (byte) 53, + (byte) 54, + (byte) 55, + (byte) 39, + (byte) 40, + (byte) 56, + (byte) 41, + (byte) 57, + (byte) 42, + (byte) 43, + (byte) 44, + (byte) 45, + (byte) 46, + (byte) 47, + (byte) 48, + (byte) 49, + (byte) 50, + (byte) 51, + (byte) 59, + (byte) 60, + (byte) 61, + (byte) 81 + }; + private static readonly byte[] PREFIX_SPEARS = new byte[14] + { + (byte) 36, + (byte) 37, + (byte) 38, + (byte) 53, + (byte) 54, + (byte) 55, + (byte) 39, + (byte) 40, + (byte) 56, + (byte) 41, + (byte) 57, + (byte) 59, + (byte) 60, + (byte) 61 + }; + private static readonly byte[] PREFIX_GUNS = new byte[36] + { + (byte) 16, + (byte) 17, + (byte) 18, + (byte) 19, + (byte) 20, + (byte) 21, + (byte) 22, + (byte) 23, + (byte) 24, + (byte) 25, + (byte) 58, + (byte) 36, + (byte) 37, + (byte) 38, + (byte) 53, + (byte) 54, + (byte) 55, + (byte) 39, + (byte) 40, + (byte) 56, + (byte) 41, + (byte) 57, + (byte) 42, + (byte) 43, + (byte) 44, + (byte) 45, + (byte) 46, + (byte) 47, + (byte) 48, + (byte) 49, + (byte) 50, + (byte) 51, + (byte) 59, + (byte) 60, + (byte) 61, + (byte) 82 + }; + private static readonly byte[] PREFIX_MAGIC = new byte[36] + { + (byte) 26, + (byte) 27, + (byte) 28, + (byte) 29, + (byte) 30, + (byte) 31, + (byte) 32, + (byte) 33, + (byte) 34, + (byte) 35, + (byte) 52, + (byte) 36, + (byte) 37, + (byte) 38, + (byte) 53, + (byte) 54, + (byte) 55, + (byte) 39, + (byte) 40, + (byte) 56, + (byte) 41, + (byte) 57, + (byte) 42, + (byte) 43, + (byte) 44, + (byte) 45, + (byte) 46, + (byte) 47, + (byte) 48, + (byte) 49, + (byte) 50, + (byte) 51, + (byte) 59, + (byte) 60, + (byte) 61, + (byte) 83 + }; + private static readonly byte[] PREFIX_BOOMERANG = new byte[14] + { + (byte) 36, + (byte) 37, + (byte) 38, + (byte) 53, + (byte) 54, + (byte) 55, + (byte) 39, + (byte) 40, + (byte) 56, + (byte) 41, + (byte) 57, + (byte) 59, + (byte) 60, + (byte) 61 + }; + private static uint lastItemIndex = 0U; + public const int MAX_TYPES = 632; + public const uint potionDelay = 3600U; + public const uint potionDelayPhilosopher = 2700U; + public short type; + public byte active; + public bool beingGrabbed; + public bool wornArmor; + public bool mech; + public bool wet; + public byte wetCount; + public bool lavaWet; + public bool channel; + public bool accessory; + public bool potion; + public bool consumable; + public bool autoReuse; + public bool useTurn; + public bool buyOnce; + public bool noUseGraphic; + public bool noMelee; + public bool buy; + public bool social; + public bool vanity; + public bool material; + public bool noWet; + public bool melee; + public bool magic; + public bool ranged; + public byte prefix; + public byte noGrabDelay; + public byte holdStyle; + public byte useStyle; + public byte useAnimation; + public byte useTime; + public byte pick; + public byte axe; + public byte hammer; + public sbyte tileBoost; + public byte placeStyle; + public byte alpha; + public byte owner; + public byte ownIgnore; + public byte ownTime; + public byte keepTime; + public byte useSound; + public short stack; + public short maxStack; + public short createTile; + public short createWall; + public short damage; + public short healLife; + public short healMana; + public uint spawnTime; + public ushort width; + public ushort height; + public Vector2 position; + public Vector2 velocity; + public float knockBack; + public Color color; + public float scale; + public short defense; + public short headSlot; + public short bodySlot; + public short legSlot; + public ushort buffTime; + public byte buffType; + public byte reuseDelay; + public short netID; + public short crit; + public sbyte rare; + public byte ammo; + public byte useAmmo; + public byte shoot; + public float shootSpeed; + public byte lifeRegen; + public byte mana; + public ushort release; + public int value; + + static Item() + { + } + + public void Init() + { + this.active = (byte) 0; + this.owner = (byte) 8; + this.type = (short) 0; + this.netID = (short) 0; + this.prefix = (byte) 0; + this.crit = (short) 0; + this.wornArmor = false; + this.mech = false; + this.reuseDelay = (byte) 0; + this.melee = false; + this.magic = false; + this.ranged = false; + this.placeStyle = (byte) 0; + this.buffTime = (ushort) 0; + this.buffType = (byte) 0; + this.material = false; + this.noWet = false; + this.vanity = false; + this.mana = (byte) 0; + this.wet = false; + this.wetCount = (byte) 0; + this.lavaWet = false; + this.channel = false; + this.buyOnce = false; + this.social = false; + this.release = (ushort) 0; + this.noMelee = false; + this.noUseGraphic = false; + this.lifeRegen = (byte) 0; + this.shootSpeed = 0.0f; + this.alpha = (byte) 0; + this.ammo = (byte) 0; + this.useAmmo = (byte) 0; + this.autoReuse = false; + this.accessory = false; + this.axe = (byte) 0; + this.healMana = (short) 0; + this.bodySlot = (short) -1; + this.legSlot = (short) -1; + this.headSlot = (short) -1; + this.potion = false; + this.consumable = false; + this.createTile = (short) -1; + this.createWall = (short) -1; + this.damage = (short) 0; + this.defense = (short) 0; + this.hammer = (byte) 0; + this.healLife = (short) 0; + this.knockBack = 0.0f; + this.pick = (byte) 0; + this.rare = (sbyte) 0; + this.scale = 1f; + this.shoot = (byte) 0; + this.stack = (short) 0; + this.maxStack = (short) 0; + this.tileBoost = (sbyte) 0; + this.holdStyle = (byte) 0; + this.useStyle = (byte) 0; + this.useSound = (byte) 0; + this.useTime = (byte) 100; + this.useAnimation = (byte) 100; + this.value = 0; + this.useTurn = false; + this.buy = false; + this.ownIgnore = (byte) 8; + this.ownTime = (byte) 0; + this.keepTime = (byte) 0; + } + + public bool isLocal() + { + if ((int) this.owner < 8) + return Main.player[(int) this.owner].isLocal(); + else + return false; + } + + public bool isEquipable() + { + if (!this.accessory && (int) this.headSlot < 0 && (int) this.bodySlot < 0) + return (int) this.legSlot >= 0; + else + return true; + } + + public bool Prefix(int pre) + { + if (pre == 0 || (int) this.type == 0) + return false; + int num1 = pre; + float num2 = 1f; + float num3 = 1f; + float num4 = 1f; + float num5 = 1f; + float num6 = 1f; + float num7 = 1f; + int num8 = 0; + bool flag = true; + while (flag) + { + num2 = 1f; + num3 = 1f; + num4 = 1f; + num5 = 1f; + num6 = 1f; + num7 = 1f; + num8 = 0; + flag = false; + if (num1 == -1 && Main.rand.Next(4) == 0) + num1 = 0; + if (pre < -1) + num1 = -1; + if (num1 == -1 || num1 == -2 || num1 == -3) + { + if ((int) this.type == 1 || (int) this.type == 4 || ((int) this.type == 6 || (int) this.type == 7) || ((int) this.type == 10 || (int) this.type == 24 || ((int) this.type == 45 || (int) this.type == 46)) || ((int) this.type == 103 || (int) this.type == 104 || ((int) this.type == 121 || (int) this.type == 122) || ((int) this.type == 155 || (int) this.type == 190 || ((int) this.type == 196 || (int) this.type == 198))) || ((int) this.type == 199 || (int) this.type == 200 || ((int) this.type == 201 || (int) this.type == 202) || ((int) this.type == 203 || (int) this.type == 204 || ((int) this.type == 213 || (int) this.type == 217)) || ((int) this.type == 273 || (int) this.type == 367 || ((int) this.type == 368 || (int) this.type == 426) || ((int) this.type == 482 || (int) this.type == 483 || ((int) this.type == 484 || (int) this.type == 613))))) + num1 = (int) Item.PREFIX_TOOLS[Main.rand.Next(Item.PREFIX_TOOLS.Length)]; + else if ((int) this.type == 162 || (int) this.type == 160 || ((int) this.type == 163 || (int) this.type == 220) || ((int) this.type == 274 || (int) this.type == 277 || ((int) this.type == 280 || (int) this.type == 383)) || ((int) this.type == 384 || (int) this.type == 385 || ((int) this.type == 386 || (int) this.type == 387) || ((int) this.type == 388 || (int) this.type == 389 || ((int) this.type == 390 || (int) this.type == 406))) || ((int) this.type == 537 || (int) this.type == 550 || ((int) this.type == 579 || (int) this.type == 614))) + num1 = (int) Item.PREFIX_SPEARS[Main.rand.Next(Item.PREFIX_SPEARS.Length)]; + else if ((int) this.type == 39 || (int) this.type == 44 || ((int) this.type == 95 || (int) this.type == 96) || ((int) this.type == 98 || (int) this.type == 99 || ((int) this.type == 120 || (int) this.type == 164)) || ((int) this.type == 197 || (int) this.type == 219 || ((int) this.type == 266 || (int) this.type == 281) || ((int) this.type == 434 || (int) this.type == 435 || ((int) this.type == 436 || (int) this.type == 481))) || ((int) this.type == 506 || (int) this.type == 533 || ((int) this.type == 534 || (int) this.type == 578) || ((int) this.type == 615 || (int) this.type == 617))) + num1 = (int) Item.PREFIX_GUNS[Main.rand.Next(Item.PREFIX_GUNS.Length)]; + else if ((int) this.type == 64 || (int) this.type == 65 || ((int) this.type == 112 || (int) this.type == 113) || ((int) this.type == (int) sbyte.MaxValue || (int) this.type == 157 || ((int) this.type == 165 || (int) this.type == 218)) || ((int) this.type == 272 || (int) this.type == 494 || ((int) this.type == 495 || (int) this.type == 496) || ((int) this.type == 514 || (int) this.type == 517 || ((int) this.type == 518 || (int) this.type == 519)))) + num1 = (int) Item.PREFIX_MAGIC[Main.rand.Next(Item.PREFIX_MAGIC.Length)]; + else if ((int) this.type == 55 || (int) this.type == 119 || ((int) this.type == 191 || (int) this.type == 284)) + { + num1 = (int) Item.PREFIX_BOOMERANG[Main.rand.Next(Item.PREFIX_BOOMERANG.Length)]; + } + else + { + if (!this.accessory || (int) this.type == 267 || ((int) this.type == 562 || (int) this.type == 563) || ((int) this.type == 564 || (int) this.type == 565 || ((int) this.type == 566 || (int) this.type == 567)) || ((int) this.type == 568 || (int) this.type == 569 || ((int) this.type == 570 || (int) this.type == 571) || ((int) this.type == 572 || (int) this.type == 573 || ((int) this.type == 574 || (int) this.type == 576)))) + return false; + num1 = Main.rand.Next(62, 81); + } + } + if (pre == -3) + return true; + if (pre == -1 && (num1 >= 7 && num1 <= 11 || (num1 == 22 || num1 == 23) || (num1 == 24 || num1 == 29 || (num1 == 30 || num1 == 31)) || (num1 == 39 || num1 == 40 || (num1 == 41 || num1 == 47) || (num1 == 48 || num1 == 49 || num1 == 56))) && Main.rand.Next(3) != 0) + num1 = 0; + if (num1 == 1) + num5 = 1.12f; + else if (num1 == 2) + num5 = 1.18f; + else if (num1 == 3) + { + num2 = 1.05f; + num8 = 2; + num5 = 1.05f; + } + else if (num1 == 4) + { + num2 = 1.1f; + num5 = 1.1f; + num3 = 1.1f; + } + else if (num1 == 5) + num2 = 1.15f; + else if (num1 == 6) + num2 = 1.1f; + else if (num1 == 81) + { + num3 = 1.15f; + num2 = 1.15f; + num8 = 5; + num4 = 0.9f; + num5 = 1.1f; + } + else if (num1 == 7) + num5 = 0.82f; + else if (num1 == 8) + { + num3 = 0.85f; + num2 = 0.85f; + num5 = 0.87f; + } + else if (num1 == 9) + num5 = 0.9f; + else if (num1 == 10) + num2 = 0.85f; + else if (num1 == 11) + { + num4 = 1.1f; + num3 = 0.9f; + num5 = 0.9f; + } + else if (num1 == 12) + { + num3 = 1.1f; + num2 = 1.05f; + num5 = 1.1f; + num4 = 1.15f; + } + else if (num1 == 13) + { + num3 = 0.8f; + num2 = 0.9f; + num5 = 1.1f; + } + else if (num1 == 14) + { + num3 = 1.15f; + num4 = 1.1f; + } + else if (num1 == 15) + { + num3 = 0.9f; + num4 = 0.85f; + } + else if (num1 == 16) + { + num2 = 1.1f; + num8 = 3; + } + else if (num1 == 17) + { + num4 = 0.85f; + num6 = 1.1f; + } + else if (num1 == 18) + { + num4 = 0.9f; + num6 = 1.15f; + } + else if (num1 == 19) + { + num3 = 1.15f; + num6 = 1.05f; + } + else if (num1 == 20) + { + num3 = 1.05f; + num6 = 1.05f; + num2 = 1.1f; + num4 = 0.95f; + num8 = 2; + } + else if (num1 == 21) + { + num3 = 1.15f; + num2 = 1.1f; + } + else if (num1 == 82) + { + num3 = 1.15f; + num2 = 1.15f; + num8 = 5; + num4 = 0.9f; + num6 = 1.1f; + } + else if (num1 == 22) + { + num3 = 0.9f; + num6 = 0.9f; + num2 = 0.85f; + } + else if (num1 == 23) + { + num4 = 1.15f; + num6 = 0.9f; + } + else if (num1 == 24) + { + num4 = 1.1f; + num3 = 0.8f; + } + else if (num1 == 25) + { + num4 = 1.1f; + num2 = 1.15f; + num8 = 1; + } + else if (num1 == 58) + { + num4 = 0.85f; + num2 = 0.85f; + } + else if (num1 == 26) + { + num7 = 0.85f; + num2 = 1.1f; + } + else if (num1 == 27) + num7 = 0.85f; + else if (num1 == 28) + { + num7 = 0.85f; + num2 = 1.15f; + num3 = 1.05f; + } + else if (num1 == 83) + { + num3 = 1.15f; + num2 = 1.15f; + num8 = 5; + num4 = 0.9f; + num7 = 0.9f; + } + else if (num1 == 29) + num7 = 1.1f; + else if (num1 == 30) + { + num7 = 1.2f; + num2 = 0.9f; + } + else if (num1 == 31) + { + num3 = 0.9f; + num2 = 0.9f; + } + else if (num1 == 32) + { + num7 = 1.15f; + num2 = 1.1f; + } + else if (num1 == 33) + { + num7 = 1.1f; + num3 = 1.1f; + num4 = 0.9f; + } + else if (num1 == 34) + { + num7 = 0.9f; + num3 = 1.1f; + num4 = 1.1f; + num2 = 1.1f; + } + else if (num1 == 35) + { + num7 = 1.2f; + num2 = 1.15f; + num3 = 1.15f; + } + else if (num1 == 52) + { + num7 = 0.9f; + num2 = 0.9f; + num4 = 0.9f; + } + else if (num1 == 36) + num8 = 3; + else if (num1 == 37) + { + num2 = 1.1f; + num8 = 3; + num3 = 1.1f; + } + else if (num1 == 38) + num3 = 1.15f; + else if (num1 == 53) + num2 = 1.1f; + else if (num1 == 54) + num3 = 1.15f; + else if (num1 == 55) + { + num3 = 1.15f; + num2 = 1.05f; + } + else if (num1 == 59) + { + num3 = 1.15f; + num2 = 1.15f; + num8 = 5; + } + else if (num1 == 60) + { + num2 = 1.15f; + num8 = 5; + } + else if (num1 == 61) + num8 = 5; + else if (num1 == 39) + { + num2 = 0.7f; + num3 = 0.8f; + } + else if (num1 == 40) + num2 = 0.85f; + else if (num1 == 56) + num3 = 0.8f; + else if (num1 == 41) + { + num3 = 0.85f; + num2 = 0.9f; + } + else if (num1 == 57) + { + num3 = 0.9f; + num2 = 1.18f; + } + else if (num1 == 42) + num4 = 0.9f; + else if (num1 == 43) + { + num2 = 1.1f; + num4 = 0.9f; + } + else if (num1 == 44) + { + num4 = 0.9f; + num8 = 3; + } + else if (num1 == 45) + num4 = 0.95f; + else if (num1 == 46) + { + num8 = 3; + num4 = 0.94f; + num2 = 1.07f; + } + else if (num1 == 47) + num4 = 1.15f; + else if (num1 == 48) + num4 = 1.2f; + else if (num1 == 49) + num4 = 1.08f; + else if (num1 == 50) + { + num2 = 0.8f; + num4 = 1.15f; + } + else if (num1 == 51) + { + num3 = 0.9f; + num4 = 0.9f; + num2 = 1.05f; + num8 = 2; + } + if ((double) num2 != 1.0 && Math.Round((double) this.damage * (double) num2) == (double) this.damage) + { + flag = true; + num1 = -1; + } + if ((double) num4 != 1.0 && Math.Round((double) this.useAnimation * (double) num4) == (double) this.useAnimation) + { + flag = true; + num1 = -1; + } + if ((double) num7 != 1.0 && Math.Round((double) this.mana * (double) num7) == (double) this.mana) + { + flag = true; + num1 = -1; + } + if ((double) num3 != 1.0 && (double) this.knockBack == 0.0) + { + flag = true; + num1 = -1; + } + if (pre == -2 && num1 == 0) + { + num1 = -1; + flag = true; + } + } + this.damage = (short) Math.Round((double) this.damage * (double) num2); + this.useAnimation = (byte) Math.Round((double) this.useAnimation * (double) num4); + this.useTime = (byte) Math.Round((double) this.useTime * (double) num4); + this.reuseDelay = (byte) Math.Round((double) this.reuseDelay * (double) num4); + this.mana = (byte) Math.Round((double) this.mana * (double) num7); + this.knockBack *= num3; + this.scale *= num5; + this.shootSpeed *= num6; + this.crit += (short) num8; + float num9 = (float) ((double) num2 * (2.0 - (double) num4) * (2.0 - (double) num7) * (double) num5 * (double) num3 * (double) num6 * (1.0 + (double) this.crit * 0.0199999995529652)); + if (num1 == 62 || num1 == 69 || (num1 == 73 || num1 == 77)) + num9 *= 1.05f; + else if (num1 == 63 || num1 == 70 || (num1 == 74 || num1 == 78) || num1 == 67) + num9 *= 1.1f; + else if (num1 == 64 || num1 == 71 || (num1 == 75 || num1 == 79) || num1 == 66) + num9 *= 1.15f; + else if (num1 == 65 || num1 == 72 || (num1 == 76 || num1 == 80) || num1 == 68) + num9 *= 1.2f; + this.prefix = (byte) num1; + if ((double) num9 >= 1.20000004768372) + this.rare += (sbyte) 2; + else if ((double) num9 >= 1.04999995231628) + ++this.rare; + else if ((double) num9 <= 0.800000011920929) + this.rare -= (sbyte) 2; + else if ((double) num9 <= 0.949999988079071) + --this.rare; + if ((int) this.rare < -1) + this.rare = (sbyte) -1; + else if ((int) this.rare > 6) + this.rare = (sbyte) 6; + this.value = (int) ((double) this.value * (double) (num9 * num9)); + return true; + } + + public string Name() + { + return Lang.itemName((int) this.netID); + } + + public string AffixName() + { + return Lang.itemAffixName((int) this.prefix, (int) this.netID); + } + + public void SetDefaults(string ItemName) + { + bool flag = false; + if (ItemName == "Gold Pickaxe") + { + this.SetDefaults(1, 1, false); + this.color = new Color(210, 190, 0, 100); + this.useTime = (byte) 17; + this.pick = (byte) 55; + this.useAnimation = (byte) 20; + this.scale = 1.05f; + this.damage = (short) 6; + this.value = 10000; + this.netID = (short) -1; + } + else if (ItemName == "Gold Broadsword") + { + this.SetDefaults(4, 1, false); + this.color = new Color(210, 190, 0, 100); + this.useAnimation = (byte) 20; + this.damage = (short) 13; + this.scale = 1.05f; + this.value = 9000; + this.netID = (short) -2; + } + else if (ItemName == "Gold Shortsword") + { + this.SetDefaults(6, 1, false); + this.color = new Color(210, 190, 0, 100); + this.damage = (short) 11; + this.useAnimation = (byte) 11; + this.scale = 0.95f; + this.value = 7000; + this.netID = (short) -3; + } + else if (ItemName == "Gold Axe") + { + this.SetDefaults(10, 1, false); + this.color = new Color(210, 190, 0, 100); + this.useTime = (byte) 18; + this.axe = (byte) 11; + this.useAnimation = (byte) 26; + this.scale = 1.15f; + this.damage = (short) 7; + this.value = 8000; + this.netID = (short) -4; + } + else if (ItemName == "Gold Hammer") + { + this.SetDefaults(7, 1, false); + this.color = new Color(210, 190, 0, 100); + this.useAnimation = (byte) 28; + this.useTime = (byte) 23; + this.scale = 1.25f; + this.damage = (short) 9; + this.hammer = (byte) 55; + this.value = 8000; + this.netID = (short) -5; + } + else if (ItemName == "Gold Bow") + { + this.SetDefaults(99, 1, false); + this.useAnimation = (byte) 26; + this.useTime = (byte) 26; + this.color = new Color(210, 190, 0, 100); + this.damage = (short) 11; + this.value = 7000; + this.netID = (short) -6; + } + else if (ItemName == "Silver Pickaxe") + { + this.SetDefaults(1, 1, false); + this.color = new Color(180, 180, 180, 100); + this.useTime = (byte) 11; + this.pick = (byte) 45; + this.useAnimation = (byte) 19; + this.scale = 1.05f; + this.damage = (short) 6; + this.value = 5000; + this.netID = (short) -7; + } + else if (ItemName == "Silver Broadsword") + { + this.SetDefaults(4, 1, false); + this.color = new Color(180, 180, 180, 100); + this.useAnimation = (byte) 21; + this.damage = (short) 11; + this.value = 4500; + this.netID = (short) -8; + } + else if (ItemName == "Silver Shortsword") + { + this.SetDefaults(6, 1, false); + this.color = new Color(180, 180, 180, 100); + this.damage = (short) 9; + this.useAnimation = (byte) 12; + this.scale = 0.95f; + this.value = 3500; + this.netID = (short) -9; + } + else if (ItemName == "Silver Axe") + { + this.SetDefaults(10, 1, false); + this.color = new Color(180, 180, 180, 100); + this.useTime = (byte) 18; + this.axe = (byte) 10; + this.useAnimation = (byte) 26; + this.scale = 1.15f; + this.damage = (short) 6; + this.value = 4000; + this.netID = (short) -10; + } + else if (ItemName == "Silver Hammer") + { + this.SetDefaults(7, 1, false); + this.color = new Color(180, 180, 180, 100); + this.useAnimation = (byte) 29; + this.useTime = (byte) 19; + this.scale = 1.25f; + this.damage = (short) 9; + this.hammer = (byte) 45; + this.value = 4000; + this.netID = (short) -11; + } + else if (ItemName == "Silver Bow") + { + this.SetDefaults(99, 1, false); + this.useAnimation = (byte) 27; + this.useTime = (byte) 27; + this.color = new Color(180, 180, 180, 100); + this.damage = (short) 9; + this.value = 3500; + this.netID = (short) -12; + } + else if (ItemName == "Copper Pickaxe") + { + this.SetDefaults(1, 1, false); + this.color = new Color(180, 100, 45, 80); + this.useTime = (byte) 15; + this.pick = (byte) 35; + this.useAnimation = (byte) 23; + this.damage = (short) 4; + this.scale = 0.9f; + this.tileBoost = (sbyte) -1; + this.value = 500; + this.netID = (short) -13; + } + else if (ItemName == "Copper Broadsword") + { + this.SetDefaults(4, 1, false); + this.color = new Color(180, 100, 45, 80); + this.useAnimation = (byte) 23; + this.damage = (short) 8; + this.value = 450; + this.netID = (short) -14; + } + else if (ItemName == "Copper Shortsword") + { + this.SetDefaults(6, 1, false); + this.color = new Color(180, 100, 45, 80); + this.damage = (short) 5; + this.useAnimation = (byte) 13; + this.scale = 0.8f; + this.value = 350; + this.netID = (short) -15; + } + else if (ItemName == "Copper Axe") + { + this.SetDefaults(10, 1, false); + this.color = new Color(180, 100, 45, 80); + this.useTime = (byte) 21; + this.axe = (byte) 7; + this.useAnimation = (byte) 30; + this.scale = 1f; + this.damage = (short) 3; + this.tileBoost = (sbyte) -1; + this.value = 400; + this.netID = (short) -16; + } + else if (ItemName == "Copper Hammer") + { + this.SetDefaults(7, 1, false); + this.color = new Color(180, 100, 45, 80); + this.useAnimation = (byte) 33; + this.useTime = (byte) 23; + this.scale = 1.1f; + this.damage = (short) 4; + this.hammer = (byte) 35; + this.tileBoost = (sbyte) -1; + this.value = 400; + this.netID = (short) -17; + } + else if (ItemName == "Copper Bow") + { + this.SetDefaults(99, 1, false); + this.useAnimation = (byte) 29; + this.useTime = (byte) 29; + this.color = new Color(180, 100, 45, 80); + this.damage = (short) 6; + this.value = 350; + this.netID = (short) -18; + } + else if (ItemName == "Blue Phasesaber") + { + this.SetDefaults(198, 1, false); + this.damage = (short) 41; + this.scale = 1.15f; + flag = true; + this.autoReuse = true; + this.useTurn = true; + this.rare = (sbyte) 4; + this.netID = (short) -19; + } + else if (ItemName == "Red Phasesaber") + { + this.SetDefaults(199, 1, false); + this.damage = (short) 41; + this.scale = 1.15f; + flag = true; + this.autoReuse = true; + this.useTurn = true; + this.rare = (sbyte) 4; + this.netID = (short) -20; + } + else if (ItemName == "Green Phasesaber") + { + this.SetDefaults(200, 1, false); + this.damage = (short) 41; + this.scale = 1.15f; + flag = true; + this.autoReuse = true; + this.useTurn = true; + this.rare = (sbyte) 4; + this.netID = (short) -21; + } + else if (ItemName == "Purple Phasesaber") + { + this.SetDefaults(201, 1, false); + this.damage = (short) 41; + this.scale = 1.15f; + flag = true; + this.autoReuse = true; + this.useTurn = true; + this.rare = (sbyte) 4; + this.netID = (short) -22; + } + else if (ItemName == "White Phasesaber") + { + this.SetDefaults(202, 1, false); + this.damage = (short) 41; + this.scale = 1.15f; + flag = true; + this.autoReuse = true; + this.useTurn = true; + this.rare = (sbyte) 4; + this.netID = (short) -23; + } + else if (ItemName == "Yellow Phasesaber") + { + this.SetDefaults(203, 1, false); + this.damage = (short) 41; + this.scale = 1.15f; + flag = true; + this.autoReuse = true; + this.useTurn = true; + this.rare = (sbyte) 4; + this.netID = (short) -24; + } + if (flag) + this.material = false; + else + this.checkMat(); + } + + public bool checkMat() + { + if (this.CanBePlacedInCoinSlot()) + { + this.material = false; + return false; + } + else + { + int index1 = 0; +label_8: + if (index1 < Recipe.numRecipes) + { + int index2 = (int) Main.recipe[index1].numRequiredItems - 1; + while ((int) this.netID != (int) Main.recipe[index1].requiredItem[index2].netID) + { + if (--index2 < 0) + { + ++index1; + goto label_8; + } + } + this.material = true; + return true; + } + else + { + this.material = false; + return false; + } + } + } + + public void netDefaults(int Type, int Stack = 1) + { + if (Type < 0) + { + if (Type == -1) + this.SetDefaults("Gold Pickaxe"); + else if (Type == -2) + this.SetDefaults("Gold Broadsword"); + else if (Type == -3) + this.SetDefaults("Gold Shortsword"); + else if (Type == -4) + this.SetDefaults("Gold Axe"); + else if (Type == -5) + this.SetDefaults("Gold Hammer"); + else if (Type == -6) + this.SetDefaults("Gold Bow"); + else if (Type == -7) + this.SetDefaults("Silver Pickaxe"); + else if (Type == -8) + this.SetDefaults("Silver Broadsword"); + else if (Type == -9) + this.SetDefaults("Silver Shortsword"); + else if (Type == -10) + this.SetDefaults("Silver Axe"); + else if (Type == -11) + this.SetDefaults("Silver Hammer"); + else if (Type == -12) + this.SetDefaults("Silver Bow"); + else if (Type == -13) + this.SetDefaults("Copper Pickaxe"); + else if (Type == -14) + this.SetDefaults("Copper Broadsword"); + else if (Type == -15) + this.SetDefaults("Copper Shortsword"); + else if (Type == -16) + this.SetDefaults("Copper Axe"); + else if (Type == -17) + this.SetDefaults("Copper Hammer"); + else if (Type == -18) + this.SetDefaults("Copper Bow"); + else if (Type == -19) + this.SetDefaults("Blue Phasesaber"); + else if (Type == -20) + this.SetDefaults("Red Phasesaber"); + else if (Type == -21) + this.SetDefaults("Green Phasesaber"); + else if (Type == -22) + this.SetDefaults("Purple Phasesaber"); + else if (Type == -23) + { + this.SetDefaults("White Phasesaber"); + } + else + { + if (Type != -24) + return; + this.SetDefaults("Yellow Phasesaber"); + } + } + else + this.SetDefaults(Type, Stack, false); + } + + public void SetDefaults(int Type, int Stack = 1, bool noMatCheck = false) + { + this.active = (byte) 1; + this.owner = (byte) 8; + this.type = (short) Type; + this.netID = (short) Type; + this.prefix = (byte) 0; + this.crit = (short) 0; + this.wornArmor = false; + this.mech = false; + this.reuseDelay = (byte) 0; + this.melee = false; + this.magic = false; + this.ranged = false; + this.placeStyle = (byte) 0; + this.buffTime = (ushort) 0; + this.buffType = (byte) 0; + this.material = false; + this.noWet = false; + this.vanity = false; + this.mana = (byte) 0; + this.wet = false; + this.wetCount = (byte) 0; + this.lavaWet = false; + this.channel = false; + this.buyOnce = false; + this.social = false; + this.release = (ushort) 0; + this.noMelee = false; + this.noUseGraphic = false; + this.lifeRegen = (byte) 0; + this.shootSpeed = 0.0f; + this.alpha = (byte) 0; + this.ammo = (byte) 0; + this.useAmmo = (byte) 0; + this.autoReuse = false; + this.accessory = false; + this.axe = (byte) 0; + this.healMana = (short) 0; + this.bodySlot = (short) -1; + this.legSlot = (short) -1; + this.headSlot = (short) -1; + this.potion = false; + this.color = new Color(); + this.consumable = false; + this.createTile = (short) -1; + this.createWall = (short) -1; + this.damage = (short) 0; + this.defense = (short) 0; + this.hammer = (byte) 0; + this.healLife = (short) 0; + this.knockBack = 0.0f; + this.pick = (byte) 0; + this.rare = (sbyte) 0; + this.scale = 1f; + this.shoot = (byte) 0; + this.stack = (short) Stack; + this.maxStack = (short) Stack; + this.tileBoost = (sbyte) 0; + this.holdStyle = (byte) 0; + this.useStyle = (byte) 0; + this.useSound = (byte) 0; + this.useTime = (byte) 100; + this.useAnimation = (byte) 100; + this.value = 0; + this.useTurn = false; + this.buy = false; + this.ownIgnore = (byte) 8; + this.ownTime = (byte) 0; + this.keepTime = (byte) 0; + switch (Type) + { + case 1: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 20; + this.useTime = (byte) 13; + this.autoReuse = true; + this.width = (ushort) 24; + this.height = (ushort) 28; + this.damage = (short) 5; + this.pick = (byte) 40; + this.useSound = (byte) 1; + this.knockBack = 2f; + this.value = 2000; + this.melee = true; + break; + case 2: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createTile = (short) 0; + this.width = (ushort) 12; + this.height = (ushort) 12; + break; + case 3: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createTile = (short) 1; + this.width = (ushort) 12; + this.height = (ushort) 12; + break; + case 4: + this.useStyle = (byte) 1; + this.useTurn = false; + this.useAnimation = (byte) 21; + this.useTime = (byte) 21; + this.width = (ushort) 24; + this.height = (ushort) 28; + this.damage = (short) 10; + this.knockBack = 5f; + this.useSound = (byte) 1; + this.scale = 1f; + this.value = 1800; + this.melee = true; + break; + case 5: + this.useStyle = (byte) 2; + this.useSound = (byte) 2; + this.useTurn = false; + this.useAnimation = (byte) 17; + this.useTime = (byte) 17; + this.width = (ushort) 16; + this.height = (ushort) 18; + this.healLife = (short) 15; + this.maxStack = (short) 99; + this.consumable = true; + this.potion = true; + this.value = 25; + break; + case 6: + this.useStyle = (byte) 3; + this.useTurn = false; + this.useAnimation = (byte) 12; + this.useTime = (byte) 12; + this.width = (ushort) 24; + this.height = (ushort) 28; + this.damage = (short) 8; + this.knockBack = 4f; + this.scale = 0.9f; + this.useSound = (byte) 1; + this.useTurn = true; + this.value = 1400; + this.melee = true; + break; + case 7: + this.autoReuse = true; + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 30; + this.useTime = (byte) 20; + this.hammer = (byte) 45; + this.width = (ushort) 24; + this.height = (ushort) 28; + this.damage = (short) 7; + this.knockBack = 5.5f; + this.scale = 1.2f; + this.useSound = (byte) 1; + this.value = 1600; + this.melee = true; + break; + case 8: + this.noWet = true; + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.holdStyle = (byte) 1; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 4; + this.width = (ushort) 10; + this.height = (ushort) 12; + this.value = 50; + break; + case 9: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createTile = (short) 30; + this.width = (ushort) 8; + this.height = (ushort) 10; + break; + case 10: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 27; + this.knockBack = 4.5f; + this.useTime = (byte) 19; + this.autoReuse = true; + this.width = (ushort) 24; + this.height = (ushort) 28; + this.damage = (short) 5; + this.axe = (byte) 9; + this.scale = 1.1f; + this.useSound = (byte) 1; + this.value = 1600; + this.melee = true; + break; + case 11: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 6; + this.width = (ushort) 12; + this.height = (ushort) 12; + this.value = 500; + break; + case 12: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 7; + this.width = (ushort) 12; + this.height = (ushort) 12; + this.value = 250; + break; + case 13: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 8; + this.width = (ushort) 12; + this.height = (ushort) 12; + this.value = 2000; + break; + case 14: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 9; + this.width = (ushort) 12; + this.height = (ushort) 12; + this.value = 1000; + break; + case 15: + this.width = (ushort) 24; + this.height = (ushort) 28; + this.accessory = true; + this.value = 1000; + break; + case 16: + this.width = (ushort) 24; + this.height = (ushort) 28; + this.accessory = true; + this.value = 5000; + break; + case 17: + this.width = (ushort) 24; + this.height = (ushort) 28; + this.accessory = true; + this.rare = (sbyte) 1; + this.value = 10000; + break; + case 18: + this.width = (ushort) 24; + this.height = (ushort) 18; + this.accessory = true; + this.rare = (sbyte) 1; + this.value = 10000; + break; + case 19: + this.width = (ushort) 20; + this.height = (ushort) 20; + this.maxStack = (short) 99; + this.value = 6000; + break; + case 20: + this.width = (ushort) 20; + this.height = (ushort) 20; + this.maxStack = (short) 99; + this.value = 750; + break; + case 21: + this.width = (ushort) 20; + this.height = (ushort) 20; + this.maxStack = (short) 99; + this.value = 3000; + break; + case 22: + this.width = (ushort) 20; + this.height = (ushort) 20; + this.maxStack = (short) 99; + this.value = 1500; + break; + case 23: + this.width = (ushort) 10; + this.height = (ushort) 12; + this.maxStack = (short) 250; + this.alpha = (byte) 175; + this.ammo = (byte) 23; + this.color = new Color(0, 80, (int) byte.MaxValue, 100); + this.value = 5; + break; + case 24: + this.useStyle = (byte) 1; + this.useTurn = false; + this.useAnimation = (byte) 25; + this.width = (ushort) 24; + this.height = (ushort) 28; + this.damage = (short) 7; + this.knockBack = 4f; + this.scale = 0.95f; + this.useSound = (byte) 1; + this.value = 100; + this.melee = true; + break; + case 25: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 10; + this.width = (ushort) 14; + this.height = (ushort) 28; + this.value = 200; + break; + case 26: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 7; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createWall = (short) 1; + this.width = (ushort) 12; + this.height = (ushort) 12; + break; + case 27: + this.useTurn = true; + this.useStyle = (byte) 1; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 20; + this.width = (ushort) 18; + this.height = (ushort) 18; + this.value = 10; + break; + case 28: + this.useSound = (byte) 3; + this.healLife = (short) 50; + this.useStyle = (byte) 2; + this.useTurn = true; + this.useAnimation = (byte) 17; + this.useTime = (byte) 17; + this.maxStack = (short) 30; + this.consumable = true; + this.width = (ushort) 14; + this.height = (ushort) 24; + this.potion = true; + this.value = 300; + break; + case 29: + this.maxStack = (short) 99; + this.consumable = true; + this.width = (ushort) 18; + this.height = (ushort) 18; + this.useStyle = (byte) 4; + this.useTime = (byte) 30; + this.useSound = (byte) 4; + this.useAnimation = (byte) 30; + this.rare = (sbyte) 2; + this.value = 75000; + break; + case 30: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 7; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createWall = (short) 16; + this.width = (ushort) 12; + this.height = (ushort) 12; + break; + case 31: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 13; + this.width = (ushort) 16; + this.height = (ushort) 24; + this.value = 20; + break; + case 32: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 14; + this.width = (ushort) 26; + this.height = (ushort) 20; + this.value = 300; + break; + case 33: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 17; + this.width = (ushort) 26; + this.height = (ushort) 24; + this.value = 300; + break; + case 34: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 15; + this.width = (ushort) 12; + this.height = (ushort) 30; + this.value = 150; + break; + case 35: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 16; + this.width = (ushort) 28; + this.height = (ushort) 14; + this.value = 5000; + break; + case 36: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 18; + this.width = (ushort) 28; + this.height = (ushort) 14; + this.value = 150; + break; + case 37: + this.width = (ushort) 28; + this.height = (ushort) 12; + this.defense = (short) 1; + this.headSlot = (short) 10; + this.rare = (sbyte) 1; + this.value = 1000; + break; + case 38: + this.width = (ushort) 12; + this.height = (ushort) 20; + this.maxStack = (short) 99; + this.value = 500; + break; + case 39: + this.useStyle = (byte) 5; + this.useAnimation = (byte) 30; + this.useTime = (byte) 30; + this.width = (ushort) 12; + this.height = (ushort) 28; + this.shoot = (byte) 1; + this.useAmmo = (byte) 1; + this.useSound = (byte) 5; + this.damage = (short) 4; + this.shootSpeed = 6.1f; + this.noMelee = true; + this.value = 100; + this.ranged = true; + break; + case 40: + this.shootSpeed = 3f; + this.shoot = (byte) 1; + this.damage = (short) 4; + this.width = (ushort) 10; + this.height = (ushort) 28; + this.maxStack = (short) 250; + this.consumable = true; + this.ammo = (byte) 1; + this.knockBack = 2f; + this.value = 10; + this.ranged = true; + break; + case 41: + this.shootSpeed = 3.5f; + this.shoot = (byte) 2; + this.damage = (short) 6; + this.width = (ushort) 10; + this.height = (ushort) 28; + this.maxStack = (short) 250; + this.consumable = true; + this.ammo = (byte) 1; + this.knockBack = 2f; + this.value = 15; + this.ranged = true; + break; + case 42: + this.useStyle = (byte) 1; + this.shootSpeed = 9f; + this.shoot = (byte) 3; + this.damage = (short) 10; + this.width = (ushort) 18; + this.height = (ushort) 20; + this.maxStack = (short) 250; + this.consumable = true; + this.useSound = (byte) 1; + this.useAnimation = (byte) 15; + this.useTime = (byte) 15; + this.noUseGraphic = true; + this.noMelee = true; + this.value = 20; + this.ranged = true; + break; + case 43: + this.useStyle = (byte) 4; + this.width = (ushort) 22; + this.height = (ushort) 14; + this.consumable = true; + this.useAnimation = (byte) 45; + this.useTime = (byte) 45; + this.maxStack = (short) 20; + break; + case 44: + this.useStyle = (byte) 5; + this.useAnimation = (byte) 25; + this.useTime = (byte) 25; + this.width = (ushort) 12; + this.height = (ushort) 28; + this.shoot = (byte) 1; + this.useAmmo = (byte) 1; + this.useSound = (byte) 5; + this.damage = (short) 14; + this.shootSpeed = 6.7f; + this.knockBack = 1f; + this.alpha = (byte) 30; + this.rare = (sbyte) 1; + this.noMelee = true; + this.value = 18000; + this.ranged = true; + break; + case 45: + this.autoReuse = true; + this.useStyle = (byte) 1; + this.useAnimation = (byte) 30; + this.knockBack = 6f; + this.useTime = (byte) 15; + this.width = (ushort) 24; + this.height = (ushort) 28; + this.damage = (short) 20; + this.axe = (byte) 15; + this.scale = 1.2f; + this.useSound = (byte) 1; + this.rare = (sbyte) 1; + this.value = 13500; + this.melee = true; + break; + case 46: + this.useStyle = (byte) 1; + this.useAnimation = (byte) 20; + this.knockBack = 5f; + this.width = (ushort) 24; + this.height = (ushort) 28; + this.damage = (short) 17; + this.scale = 1.1f; + this.useSound = (byte) 1; + this.rare = (sbyte) 1; + this.value = 13500; + this.melee = true; + break; + case 47: + this.shootSpeed = 3.4f; + this.shoot = (byte) 4; + this.damage = (short) 8; + this.width = (ushort) 10; + this.height = (ushort) 28; + this.maxStack = (short) 250; + this.consumable = true; + this.ammo = (byte) 1; + this.knockBack = 3f; + this.alpha = (byte) 30; + this.rare = (sbyte) 1; + this.value = 40; + this.ranged = true; + break; + case 48: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 21; + this.width = (ushort) 26; + this.height = (ushort) 22; + this.value = 500; + break; + case 49: + this.width = (ushort) 22; + this.height = (ushort) 22; + this.accessory = true; + this.lifeRegen = (byte) 1; + this.rare = (sbyte) 1; + this.value = 50000; + break; + case 50: + this.mana = (byte) 20; + this.useTurn = true; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.useStyle = (byte) 4; + this.useTime = (byte) 90; + this.useSound = (byte) 6; + this.useAnimation = (byte) 90; + this.rare = (sbyte) 1; + this.value = 50000; + break; + case 51: + this.shootSpeed = 0.5f; + this.shoot = (byte) 5; + this.damage = (short) 9; + this.width = (ushort) 10; + this.height = (ushort) 28; + this.maxStack = (short) 250; + this.consumable = true; + this.ammo = (byte) 1; + this.knockBack = 4f; + this.rare = (sbyte) 1; + this.value = 100; + this.ranged = true; + break; + case 52: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 105; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.value = 300; + this.placeStyle = (byte) 1; + break; + case 53: + this.width = (ushort) 16; + this.height = (ushort) 24; + this.accessory = true; + this.rare = (sbyte) 1; + this.value = 50000; + break; + case 54: + this.width = (ushort) 28; + this.height = (ushort) 24; + this.accessory = true; + this.rare = (sbyte) 1; + this.value = 50000; + break; + case 55: + this.noMelee = true; + this.useStyle = (byte) 1; + this.shootSpeed = 10f; + this.shoot = (byte) 6; + this.damage = (short) 13; + this.knockBack = 8f; + this.width = (ushort) 14; + this.height = (ushort) 28; + this.useSound = (byte) 1; + this.useAnimation = (byte) 15; + this.useTime = (byte) 15; + this.noUseGraphic = true; + this.rare = (sbyte) 1; + this.value = 50000; + this.melee = true; + break; + case 56: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 22; + this.width = (ushort) 12; + this.height = (ushort) 12; + this.rare = (sbyte) 1; + this.value = 4000; + break; + case 57: + this.width = (ushort) 20; + this.height = (ushort) 20; + this.maxStack = (short) 99; + this.rare = (sbyte) 1; + this.value = 16000; + break; + case 58: + this.width = (ushort) 12; + this.height = (ushort) 12; + break; + case 59: + this.useTurn = true; + this.useStyle = (byte) 1; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 23; + this.width = (ushort) 14; + this.height = (ushort) 14; + this.value = 500; + break; + case 60: + this.width = (ushort) 16; + this.height = (ushort) 18; + this.maxStack = (short) 99; + this.value = 50; + break; + case 61: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createTile = (short) 25; + this.width = (ushort) 12; + this.height = (ushort) 12; + break; + case 62: + this.useTurn = true; + this.useStyle = (byte) 1; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 2; + this.width = (ushort) 14; + this.height = (ushort) 14; + this.value = 20; + break; + case 63: + this.useTurn = true; + this.useStyle = (byte) 1; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 27; + this.width = (ushort) 26; + this.height = (ushort) 26; + this.value = 200; + break; + case 64: + this.mana = (byte) 12; + this.damage = (short) 8; + this.useStyle = (byte) 1; + this.shootSpeed = 32f; + this.shoot = (byte) 7; + this.width = (ushort) 26; + this.height = (ushort) 28; + this.useSound = (byte) 8; + this.useAnimation = (byte) 30; + this.useTime = (byte) 30; + this.rare = (sbyte) 1; + this.noMelee = true; + this.knockBack = 1f; + this.value = 10000; + this.magic = true; + break; + case 65: + this.autoReuse = true; + this.mana = (byte) 16; + this.knockBack = 5f; + this.alpha = (byte) 100; + this.color = new Color(150, 150, 150, 0); + this.damage = (short) 16; + this.useStyle = (byte) 1; + this.scale = 1.15f; + this.shootSpeed = 12f; + this.shoot = (byte) 9; + this.width = (ushort) 14; + this.height = (ushort) 28; + this.useSound = (byte) 9; + this.useAnimation = (byte) 25; + this.useTime = (byte) 10; + this.rare = (sbyte) 1; + this.value = 50000; + this.magic = true; + break; + case 66: + this.useStyle = (byte) 1; + this.shootSpeed = 4f; + this.shoot = (byte) 10; + this.width = (ushort) 16; + this.height = (ushort) 24; + this.maxStack = (short) 99; + this.consumable = true; + this.useSound = (byte) 1; + this.useAnimation = (byte) 15; + this.useTime = (byte) 15; + this.noMelee = true; + this.value = 75; + break; + case 67: + this.damage = (short) 0; + this.useStyle = (byte) 1; + this.shootSpeed = 4f; + this.shoot = (byte) 11; + this.width = (ushort) 16; + this.height = (ushort) 24; + this.maxStack = (short) 99; + this.consumable = true; + this.useSound = (byte) 1; + this.useAnimation = (byte) 15; + this.useTime = (byte) 15; + this.noMelee = true; + this.value = 100; + break; + case 68: + this.width = (ushort) 18; + this.height = (ushort) 20; + this.maxStack = (short) 99; + this.value = 10; + break; + case 69: + this.width = (ushort) 8; + this.height = (ushort) 20; + this.maxStack = (short) 99; + this.value = 100; + break; + case 70: + this.useStyle = (byte) 4; + this.consumable = true; + this.useAnimation = (byte) 45; + this.useTime = (byte) 45; + this.width = (ushort) 28; + this.height = (ushort) 28; + this.maxStack = (short) 20; + break; + case 71: + this.width = (ushort) 10; + this.height = (ushort) 12; + this.maxStack = (short) 100; + this.value = 5; + break; + case 72: + this.width = (ushort) 10; + this.height = (ushort) 12; + this.maxStack = (short) 100; + this.value = 500; + break; + case 73: + this.width = (ushort) 10; + this.height = (ushort) 12; + this.maxStack = (short) 100; + this.value = 50000; + break; + case 74: + this.width = (ushort) 10; + this.height = (ushort) 12; + this.maxStack = (short) 100; + this.value = 5000000; + break; + case 75: + this.width = (ushort) 18; + this.height = (ushort) 20; + this.maxStack = (short) 100; + this.alpha = (byte) 75; + this.ammo = (byte) 15; + this.value = 500; + this.useStyle = (byte) 4; + this.useSound = (byte) 4; + this.useTurn = false; + this.useAnimation = (byte) 17; + this.useTime = (byte) 17; + this.consumable = true; + this.rare = (sbyte) 1; + break; + case 76: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.defense = (short) 1; + this.legSlot = (short) 1; + this.value = 750; + break; + case 77: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.defense = (short) 2; + this.legSlot = (short) 2; + this.value = 3000; + break; + case 78: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.defense = (short) 3; + this.legSlot = (short) 3; + this.value = 7500; + break; + case 79: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.defense = (short) 4; + this.legSlot = (short) 4; + this.value = 15000; + break; + case 80: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.defense = (short) 2; + this.bodySlot = (short) 1; + this.value = 1000; + break; + case 81: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.defense = (short) 3; + this.bodySlot = (short) 2; + this.value = 4000; + break; + case 82: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.defense = (short) 4; + this.bodySlot = (short) 3; + this.value = 10000; + break; + case 83: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.defense = (short) 5; + this.bodySlot = (short) 4; + this.value = 20000; + break; + case 84: + this.noUseGraphic = true; + this.damage = (short) 0; + this.knockBack = 7f; + this.useStyle = (byte) 5; + this.shootSpeed = 11f; + this.shoot = (byte) 13; + this.width = (ushort) 18; + this.height = (ushort) 28; + this.useSound = (byte) 1; + this.useAnimation = (byte) 20; + this.useTime = (byte) 20; + this.rare = (sbyte) 1; + this.noMelee = true; + this.value = 20000; + break; + case 85: + this.width = (ushort) 14; + this.height = (ushort) 20; + this.maxStack = (short) 99; + this.value = 1000; + break; + case 86: + this.width = (ushort) 14; + this.height = (ushort) 18; + this.maxStack = (short) 99; + this.rare = (sbyte) 1; + this.value = 500; + break; + case 87: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 29; + this.width = (ushort) 20; + this.height = (ushort) 12; + this.value = 10000; + break; + case 88: + this.width = (ushort) 22; + this.height = (ushort) 16; + this.defense = (short) 1; + this.headSlot = (short) 11; + this.rare = (sbyte) 1; + this.value = 80000; + break; + case 89: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.defense = (short) 1; + this.headSlot = (short) 1; + this.value = 1250; + break; + case 90: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.defense = (short) 2; + this.headSlot = (short) 2; + this.value = 5000; + break; + case 91: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.defense = (short) 3; + this.headSlot = (short) 3; + this.value = 12500; + break; + case 92: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.defense = (short) 4; + this.headSlot = (short) 4; + this.value = 25000; + break; + case 93: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 7; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createWall = (short) 4; + this.width = (ushort) 12; + this.height = (ushort) 12; + break; + case 94: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 19; + this.width = (ushort) 8; + this.height = (ushort) 10; + break; + case 95: + this.useStyle = (byte) 5; + this.useAnimation = (byte) 16; + this.useTime = (byte) 16; + this.width = (ushort) 24; + this.height = (ushort) 28; + this.shoot = (byte) 14; + this.useAmmo = (byte) 14; + this.useSound = (byte) 11; + this.damage = (short) 10; + this.shootSpeed = 5f; + this.noMelee = true; + this.value = 50000; + this.scale = 0.9f; + this.rare = (sbyte) 1; + this.ranged = true; + break; + case 96: + this.useStyle = (byte) 5; + this.autoReuse = true; + this.useAnimation = (byte) 43; + this.useTime = (byte) 43; + this.width = (ushort) 44; + this.height = (ushort) 14; + this.shoot = (byte) 10; + this.useAmmo = (byte) 14; + this.useSound = (byte) 11; + this.damage = (short) 23; + this.shootSpeed = 8f; + this.noMelee = true; + this.value = 100000; + this.knockBack = 4f; + this.rare = (sbyte) 1; + this.ranged = true; + break; + case 97: + this.shootSpeed = 4f; + this.shoot = (byte) 14; + this.damage = (short) 7; + this.width = (ushort) 8; + this.height = (ushort) 8; + this.maxStack = (short) 250; + this.consumable = true; + this.ammo = (byte) 14; + this.knockBack = 2f; + this.value = 7; + this.ranged = true; + break; + case 98: + this.useStyle = (byte) 5; + this.autoReuse = true; + this.useAnimation = (byte) 8; + this.useTime = (byte) 8; + this.width = (ushort) 50; + this.height = (ushort) 18; + this.shoot = (byte) 10; + this.useAmmo = (byte) 14; + this.useSound = (byte) 11; + this.damage = (short) 6; + this.shootSpeed = 7f; + this.noMelee = true; + this.value = 350000; + this.rare = (sbyte) 2; + this.ranged = true; + break; + case 99: + this.useStyle = (byte) 5; + this.useAnimation = (byte) 28; + this.useTime = (byte) 28; + this.width = (ushort) 12; + this.height = (ushort) 28; + this.shoot = (byte) 1; + this.useAmmo = (byte) 1; + this.useSound = (byte) 5; + this.damage = (short) 8; + this.shootSpeed = 6.6f; + this.noMelee = true; + this.value = 1400; + this.ranged = true; + break; + case 100: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.defense = (short) 6; + this.legSlot = (short) 5; + this.rare = (sbyte) 1; + this.value = 22500; + break; + case 101: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.defense = (short) 7; + this.bodySlot = (short) 5; + this.rare = (sbyte) 1; + this.value = 30000; + break; + case 102: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.defense = (short) 6; + this.headSlot = (short) 5; + this.rare = (sbyte) 1; + this.value = 37500; + break; + case 103: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 20; + this.useTime = (byte) 15; + this.autoReuse = true; + this.width = (ushort) 24; + this.height = (ushort) 28; + this.damage = (short) 9; + this.pick = (byte) 65; + this.useSound = (byte) 1; + this.knockBack = 3f; + this.rare = (sbyte) 1; + this.value = 18000; + this.scale = 1.15f; + this.melee = true; + break; + case 104: + this.autoReuse = true; + this.useStyle = (byte) 1; + this.useAnimation = (byte) 45; + this.useTime = (byte) 19; + this.hammer = (byte) 55; + this.width = (ushort) 24; + this.height = (ushort) 28; + this.damage = (short) 24; + this.knockBack = 6f; + this.scale = 1.3f; + this.useSound = (byte) 1; + this.rare = (sbyte) 1; + this.value = 15000; + this.melee = true; + break; + case 105: + this.noWet = true; + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 33; + this.width = (ushort) 8; + this.height = (ushort) 18; + this.holdStyle = (byte) 1; + break; + case 106: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 34; + this.width = (ushort) 26; + this.height = (ushort) 26; + break; + case 107: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 35; + this.width = (ushort) 26; + this.height = (ushort) 26; + break; + case 108: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 36; + this.width = (ushort) 26; + this.height = (ushort) 26; + break; + case 109: + this.maxStack = (short) 99; + this.consumable = true; + this.width = (ushort) 18; + this.height = (ushort) 18; + this.useStyle = (byte) 4; + this.useTime = (byte) 30; + this.useSound = (byte) 29; + this.useAnimation = (byte) 30; + this.rare = (sbyte) 2; + break; + case 110: + this.useSound = (byte) 3; + this.healMana = (short) 50; + this.useStyle = (byte) 2; + this.useTurn = true; + this.useAnimation = (byte) 17; + this.useTime = (byte) 17; + this.maxStack = (short) 20; + this.consumable = true; + this.width = (ushort) 14; + this.height = (ushort) 24; + this.value = 100; + break; + case 111: + this.width = (ushort) 22; + this.height = (ushort) 22; + this.accessory = true; + this.rare = (sbyte) 1; + this.value = 50000; + break; + case 112: + this.mana = (byte) 17; + this.damage = (short) 44; + this.useStyle = (byte) 1; + this.shootSpeed = 6f; + this.shoot = (byte) 15; + this.width = (ushort) 26; + this.height = (ushort) 28; + this.useSound = (byte) 20; + this.useAnimation = (byte) 20; + this.useTime = (byte) 20; + this.rare = (sbyte) 3; + this.noMelee = true; + this.knockBack = 5.5f; + this.value = 10000; + this.magic = true; + break; + case 113: + this.mana = (byte) 10; + this.channel = true; + this.damage = (short) 22; + this.useStyle = (byte) 1; + this.shootSpeed = 6f; + this.shoot = (byte) 16; + this.width = (ushort) 26; + this.height = (ushort) 28; + this.useSound = (byte) 9; + this.useAnimation = (byte) 17; + this.useTime = (byte) 17; + this.rare = (sbyte) 2; + this.noMelee = true; + this.knockBack = 5f; + this.tileBoost = (sbyte) 64; + this.value = 10000; + this.magic = true; + break; + case 114: + this.mana = (byte) 5; + this.channel = true; + this.damage = (short) 0; + this.useStyle = (byte) 1; + this.shoot = (byte) 17; + this.width = (ushort) 26; + this.height = (ushort) 28; + this.useSound = (byte) 8; + this.useAnimation = (byte) 20; + this.useTime = (byte) 20; + this.rare = (sbyte) 1; + this.noMelee = true; + this.knockBack = 5f; + this.value = 200000; + break; + case 115: + this.mana = (byte) 40; + this.channel = true; + this.damage = (short) 0; + this.useStyle = (byte) 4; + this.shoot = (byte) 18; + this.width = (ushort) 24; + this.height = (ushort) 24; + this.useSound = (byte) 8; + this.useAnimation = (byte) 20; + this.useTime = (byte) 20; + this.rare = (sbyte) 1; + this.noMelee = true; + this.value = 10000; + this.buffType = (byte) 19; + this.buffTime = (ushort) 18000; + break; + case 116: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createTile = (short) 37; + this.width = (ushort) 12; + this.height = (ushort) 12; + this.value = 1000; + break; + case 117: + this.width = (ushort) 20; + this.height = (ushort) 20; + this.maxStack = (short) 99; + this.rare = (sbyte) 1; + this.value = 7000; + break; + case 118: + this.maxStack = (short) 99; + this.width = (ushort) 18; + this.height = (ushort) 18; + this.value = 1000; + break; + case 119: + this.noMelee = true; + this.useStyle = (byte) 1; + this.shootSpeed = 11f; + this.shoot = (byte) 19; + this.damage = (short) 32; + this.knockBack = 8f; + this.width = (ushort) 14; + this.height = (ushort) 28; + this.useSound = (byte) 1; + this.useAnimation = (byte) 15; + this.useTime = (byte) 15; + this.noUseGraphic = true; + this.rare = (sbyte) 3; + this.value = 100000; + this.melee = true; + break; + case 120: + this.useStyle = (byte) 5; + this.useAnimation = (byte) 25; + this.useTime = (byte) 25; + this.width = (ushort) 14; + this.height = (ushort) 32; + this.shoot = (byte) 1; + this.useAmmo = (byte) 1; + this.useSound = (byte) 5; + this.damage = (short) 29; + this.shootSpeed = 8f; + this.knockBack = 2f; + this.alpha = (byte) 30; + this.rare = (sbyte) 3; + this.noMelee = true; + this.scale = 1.1f; + this.value = 27000; + this.ranged = true; + break; + case 121: + this.useStyle = (byte) 1; + this.useAnimation = (byte) 34; + this.knockBack = 6.5f; + this.width = (ushort) 24; + this.height = (ushort) 28; + this.damage = (short) 36; + this.scale = 1.3f; + this.useSound = (byte) 1; + this.rare = (sbyte) 3; + this.value = 27000; + this.melee = true; + break; + case 122: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 25; + this.useTime = (byte) 25; + this.autoReuse = true; + this.width = (ushort) 24; + this.height = (ushort) 28; + this.damage = (short) 12; + this.pick = (byte) 100; + this.scale = 1.15f; + this.useSound = (byte) 1; + this.knockBack = 2f; + this.rare = (sbyte) 3; + this.value = 27000; + this.melee = true; + break; + case 123: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.defense = (short) 3; + this.headSlot = (short) 6; + this.rare = (sbyte) 1; + this.value = 45000; + break; + case 124: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.defense = (short) 4; + this.bodySlot = (short) 6; + this.rare = (sbyte) 1; + this.value = 30000; + break; + case 125: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.defense = (short) 3; + this.legSlot = (short) 6; + this.rare = (sbyte) 1; + this.value = 30000; + break; + case 126: + this.useSound = (byte) 3; + this.healLife = (short) 20; + this.useStyle = (byte) 2; + this.useTurn = true; + this.useAnimation = (byte) 17; + this.useTime = (byte) 17; + this.maxStack = (short) 30; + this.consumable = true; + this.width = (ushort) 14; + this.height = (ushort) 24; + this.potion = true; + this.value = 20; + break; + case (int) sbyte.MaxValue: + this.autoReuse = true; + this.useStyle = (byte) 5; + this.useAnimation = (byte) 19; + this.useTime = (byte) 19; + this.width = (ushort) 24; + this.height = (ushort) 28; + this.shoot = (byte) 20; + this.mana = (byte) 8; + this.useSound = (byte) 12; + this.knockBack = 0.5f; + this.damage = (short) 17; + this.shootSpeed = 10f; + this.noMelee = true; + this.scale = 0.8f; + this.rare = (sbyte) 1; + this.magic = true; + this.value = 20000; + break; + case 128: + this.width = (ushort) 28; + this.height = (ushort) 24; + this.accessory = true; + this.rare = (sbyte) 3; + this.value = 50000; + break; + case 129: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createTile = (short) 38; + this.width = (ushort) 12; + this.height = (ushort) 12; + break; + case 130: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 7; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createWall = (short) 5; + this.width = (ushort) 12; + this.height = (ushort) 12; + break; + case 131: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createTile = (short) 39; + this.width = (ushort) 12; + this.height = (ushort) 12; + break; + case 132: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 7; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createWall = (short) 6; + this.width = (ushort) 12; + this.height = (ushort) 12; + break; + case 133: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createTile = (short) 40; + this.width = (ushort) 12; + this.height = (ushort) 12; + break; + case 134: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createTile = (short) 41; + this.width = (ushort) 12; + this.height = (ushort) 12; + break; + case 135: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 7; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createWall = (short) 17; + this.width = (ushort) 12; + this.height = (ushort) 12; + break; + case 136: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createTile = (short) 42; + this.width = (ushort) 12; + this.height = (ushort) 28; + break; + case 137: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createTile = (short) 43; + this.width = (ushort) 12; + this.height = (ushort) 12; + break; + case 138: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 7; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createWall = (short) 18; + this.width = (ushort) 12; + this.height = (ushort) 12; + break; + case 139: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createTile = (short) 44; + this.width = (ushort) 12; + this.height = (ushort) 12; + break; + case 140: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 7; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createWall = (short) 19; + this.width = (ushort) 12; + this.height = (ushort) 12; + break; + case 141: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createTile = (short) 45; + this.width = (ushort) 12; + this.height = (ushort) 12; + break; + case 142: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 7; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createWall = (short) 10; + this.width = (ushort) 12; + this.height = (ushort) 12; + break; + case 143: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createTile = (short) 46; + this.width = (ushort) 12; + this.height = (ushort) 12; + break; + case 144: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 7; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createWall = (short) 11; + this.width = (ushort) 12; + this.height = (ushort) 12; + break; + case 145: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createTile = (short) 47; + this.width = (ushort) 12; + this.height = (ushort) 12; + break; + case 146: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 7; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createWall = (short) 12; + this.width = (ushort) 12; + this.height = (ushort) 12; + break; + case 147: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createTile = (short) 48; + this.width = (ushort) 12; + this.height = (ushort) 12; + break; + case 148: + this.noWet = true; + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 49; + this.width = (ushort) 8; + this.height = (ushort) 18; + this.holdStyle = (byte) 1; + break; + case 149: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 50; + this.width = (ushort) 24; + this.height = (ushort) 28; + break; + case 150: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.maxStack = (short) 250; + this.consumable = true; + this.createTile = (short) 51; + this.width = (ushort) 20; + this.height = (ushort) 24; + this.alpha = (byte) 100; + break; + case 151: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.defense = (short) 5; + this.headSlot = (short) 7; + this.rare = (sbyte) 2; + this.value = 45000; + break; + case 152: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.defense = (short) 6; + this.bodySlot = (short) 7; + this.rare = (sbyte) 2; + this.value = 30000; + break; + case 153: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.defense = (short) 5; + this.legSlot = (short) 7; + this.rare = (sbyte) 2; + this.value = 30000; + break; + case 154: + this.maxStack = (short) 99; + this.consumable = true; + this.width = (ushort) 12; + this.height = (ushort) 14; + this.value = 50; + this.useAnimation = (byte) 12; + this.useTime = (byte) 12; + this.useStyle = (byte) 1; + this.useSound = (byte) 1; + this.shootSpeed = 8f; + this.noUseGraphic = true; + this.damage = (short) 22; + this.knockBack = 4f; + this.shoot = (byte) 21; + this.ranged = true; + break; + case 155: + this.autoReuse = true; + this.useTurn = true; + this.useStyle = (byte) 1; + this.useAnimation = (byte) 20; + this.width = (ushort) 40; + this.height = (ushort) 40; + this.damage = (short) 18; + this.scale = 1.1f; + this.useSound = (byte) 1; + this.rare = (sbyte) 2; + this.value = 27000; + this.knockBack = 1f; + this.melee = true; + break; + case 156: + this.width = (ushort) 24; + this.height = (ushort) 28; + this.rare = (sbyte) 2; + this.value = 27000; + this.accessory = true; + this.defense = (short) 1; + break; + case 157: + this.mana = (byte) 7; + this.autoReuse = true; + this.useStyle = (byte) 5; + this.useAnimation = (byte) 16; + this.useTime = (byte) 8; + this.knockBack = 5f; + this.width = (ushort) 38; + this.height = (ushort) 10; + this.damage = (short) 14; + this.scale = 1f; + this.shoot = (byte) 22; + this.shootSpeed = 11f; + this.useSound = (byte) 13; + this.rare = (sbyte) 2; + this.value = 27000; + this.magic = true; + break; + case 158: + this.width = (ushort) 20; + this.height = (ushort) 22; + this.rare = (sbyte) 1; + this.value = 27000; + this.accessory = true; + break; + case 159: + this.width = (ushort) 14; + this.height = (ushort) 28; + this.rare = (sbyte) 1; + this.value = 27000; + this.accessory = true; + break; + case 160: + this.autoReuse = true; + this.useStyle = (byte) 5; + this.useAnimation = (byte) 30; + this.useTime = (byte) 30; + this.knockBack = 6f; + this.width = (ushort) 30; + this.height = (ushort) 10; + this.damage = (short) 25; + this.scale = 1.1f; + this.shoot = (byte) 23; + this.shootSpeed = 11f; + this.useSound = (byte) 10; + this.rare = (sbyte) 2; + this.value = 27000; + this.ranged = true; + break; + case 161: + this.useStyle = (byte) 1; + this.shootSpeed = 5f; + this.shoot = (byte) 24; + this.knockBack = 1f; + this.damage = (short) 15; + this.width = (ushort) 10; + this.height = (ushort) 10; + this.maxStack = (short) 250; + this.consumable = true; + this.useSound = (byte) 1; + this.useAnimation = (byte) 15; + this.useTime = (byte) 15; + this.noUseGraphic = true; + this.noMelee = true; + this.value = 80; + this.ranged = true; + break; + case 162: + this.useStyle = (byte) 5; + this.useAnimation = (byte) 45; + this.useTime = (byte) 45; + this.knockBack = 6.5f; + this.width = (ushort) 30; + this.height = (ushort) 10; + this.damage = (short) 15; + this.scale = 1.1f; + this.noUseGraphic = true; + this.shoot = (byte) 25; + this.shootSpeed = 12f; + this.useSound = (byte) 1; + this.rare = (sbyte) 1; + this.value = 27000; + this.melee = true; + this.channel = true; + this.noMelee = true; + break; + case 163: + this.useStyle = (byte) 5; + this.useAnimation = (byte) 45; + this.useTime = (byte) 45; + this.knockBack = 7f; + this.width = (ushort) 30; + this.height = (ushort) 10; + this.damage = (short) 23; + this.scale = 1.1f; + this.noUseGraphic = true; + this.shoot = (byte) 26; + this.shootSpeed = 12f; + this.useSound = (byte) 1; + this.rare = (sbyte) 2; + this.value = 27000; + this.melee = true; + this.channel = true; + break; + case 164: + this.autoReuse = false; + this.useStyle = (byte) 5; + this.useAnimation = (byte) 12; + this.useTime = (byte) 12; + this.width = (ushort) 24; + this.height = (ushort) 24; + this.shoot = (byte) 14; + this.knockBack = 3f; + this.useAmmo = (byte) 14; + this.useSound = (byte) 11; + this.damage = (short) 14; + this.shootSpeed = 10f; + this.noMelee = true; + this.value = 50000; + this.scale = 0.75f; + this.rare = (sbyte) 2; + this.ranged = true; + break; + case 165: + this.autoReuse = true; + this.rare = (sbyte) 2; + this.mana = (byte) 14; + this.useSound = (byte) 21; + this.useStyle = (byte) 5; + this.damage = (short) 17; + this.useAnimation = (byte) 17; + this.useTime = (byte) 17; + this.width = (ushort) 24; + this.height = (ushort) 28; + this.shoot = (byte) 27; + this.scale = 0.9f; + this.shootSpeed = 4.5f; + this.knockBack = 5f; + this.magic = true; + this.value = 50000; + break; + case 166: + this.useStyle = (byte) 1; + this.shootSpeed = 5f; + this.shoot = (byte) 28; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.maxStack = (short) 50; + this.consumable = true; + this.useSound = (byte) 1; + this.useAnimation = (byte) 25; + this.useTime = (byte) 25; + this.noUseGraphic = true; + this.noMelee = true; + this.value = 500; + this.damage = (short) 0; + break; + case 167: + this.useStyle = (byte) 1; + this.shootSpeed = 4f; + this.shoot = (byte) 29; + this.width = (ushort) 8; + this.height = (ushort) 28; + this.maxStack = (short) 5; + this.consumable = true; + this.useSound = (byte) 1; + this.useAnimation = (byte) 40; + this.useTime = (byte) 40; + this.noUseGraphic = true; + this.noMelee = true; + this.value = 5000; + this.rare = (sbyte) 1; + break; + case 168: + this.useStyle = (byte) 5; + this.shootSpeed = 5.5f; + this.shoot = (byte) 30; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.maxStack = (short) 99; + this.consumable = true; + this.useSound = (byte) 1; + this.useAnimation = (byte) 45; + this.useTime = (byte) 45; + this.noUseGraphic = true; + this.noMelee = true; + this.value = 400; + this.damage = (short) 60; + this.knockBack = 8f; + this.ranged = true; + break; + case 169: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createTile = (short) 53; + this.width = (ushort) 12; + this.height = (ushort) 12; + this.ammo = (byte) 42; + break; + case 170: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createTile = (short) 54; + this.width = (ushort) 12; + this.height = (ushort) 12; + break; + case 171: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createTile = (short) 55; + this.width = (ushort) 28; + this.height = (ushort) 28; + break; + case 172: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createTile = (short) 57; + this.width = (ushort) 12; + this.height = (ushort) 12; + break; + case 173: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createTile = (short) 56; + this.width = (ushort) 12; + this.height = (ushort) 12; + break; + case 174: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createTile = (short) 58; + this.width = (ushort) 12; + this.height = (ushort) 12; + this.rare = (sbyte) 2; + break; + case 175: + this.width = (ushort) 20; + this.height = (ushort) 20; + this.maxStack = (short) 99; + this.rare = (sbyte) 2; + this.value = 20000; + break; + case 176: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createTile = (short) 59; + this.width = (ushort) 12; + this.height = (ushort) 12; + break; + case 177: + this.maxStack = (short) 99; + this.alpha = (byte) 50; + this.width = (ushort) 10; + this.height = (ushort) 14; + this.value = 5625; + break; + case 178: + this.maxStack = (short) 99; + this.alpha = (byte) 50; + this.width = (ushort) 10; + this.height = (ushort) 14; + this.value = 11250; + break; + case 179: + this.maxStack = (short) 99; + this.alpha = (byte) 50; + this.width = (ushort) 10; + this.height = (ushort) 14; + this.value = 7500; + break; + case 180: + this.maxStack = (short) 99; + this.alpha = (byte) 50; + this.width = (ushort) 10; + this.height = (ushort) 14; + this.value = 3750; + break; + case 181: + this.maxStack = (short) 99; + this.alpha = (byte) 50; + this.width = (ushort) 10; + this.height = (ushort) 14; + this.value = 1875; + break; + case 182: + this.maxStack = (short) 99; + this.alpha = (byte) 50; + this.width = (ushort) 10; + this.height = (ushort) 14; + this.value = 15000; + break; + case 183: + this.useStyle = (byte) 2; + this.useSound = (byte) 2; + this.useTurn = false; + this.useAnimation = (byte) 17; + this.useTime = (byte) 17; + this.width = (ushort) 16; + this.height = (ushort) 18; + this.healLife = (short) 25; + this.maxStack = (short) 99; + this.consumable = true; + this.potion = true; + this.value = 50; + break; + case 184: + this.width = (ushort) 12; + this.height = (ushort) 12; + break; + case 185: + this.noUseGraphic = true; + this.damage = (short) 0; + this.knockBack = 7f; + this.useStyle = (byte) 5; + this.shootSpeed = 13f; + this.shoot = (byte) 32; + this.width = (ushort) 18; + this.height = (ushort) 28; + this.useSound = (byte) 1; + this.useAnimation = (byte) 20; + this.useTime = (byte) 20; + this.rare = (sbyte) 3; + this.noMelee = true; + this.value = 20000; + break; + case 186: + this.width = (ushort) 44; + this.height = (ushort) 44; + this.rare = (sbyte) 1; + this.value = 10000; + this.holdStyle = (byte) 2; + break; + case 187: + this.width = (ushort) 28; + this.height = (ushort) 28; + this.rare = (sbyte) 1; + this.value = 10000; + this.accessory = true; + break; + case 188: + this.useSound = (byte) 3; + this.healLife = (short) 100; + this.useStyle = (byte) 2; + this.useTurn = true; + this.useAnimation = (byte) 17; + this.useTime = (byte) 17; + this.maxStack = (short) 30; + this.consumable = true; + this.width = (ushort) 14; + this.height = (ushort) 24; + this.rare = (sbyte) 1; + this.potion = true; + this.value = 1000; + break; + case 189: + this.useSound = (byte) 3; + this.healMana = (short) 100; + this.useStyle = (byte) 2; + this.useTurn = true; + this.useAnimation = (byte) 17; + this.useTime = (byte) 17; + this.maxStack = (short) 50; + this.consumable = true; + this.width = (ushort) 14; + this.height = (ushort) 24; + this.rare = (sbyte) 1; + this.value = 250; + break; + case 190: + this.useStyle = (byte) 1; + this.useAnimation = (byte) 30; + this.knockBack = 3f; + this.width = (ushort) 40; + this.height = (ushort) 40; + this.damage = (short) 28; + this.scale = 1.4f; + this.useSound = (byte) 1; + this.rare = (sbyte) 3; + this.value = 27000; + this.melee = true; + break; + case 191: + this.noMelee = true; + this.useStyle = (byte) 1; + this.shootSpeed = 11f; + this.shoot = (byte) 33; + this.damage = (short) 25; + this.knockBack = 8f; + this.width = (ushort) 14; + this.height = (ushort) 28; + this.useSound = (byte) 1; + this.useAnimation = (byte) 15; + this.useTime = (byte) 15; + this.noUseGraphic = true; + this.rare = (sbyte) 3; + this.value = 50000; + this.melee = true; + break; + case 192: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createTile = (short) 75; + this.width = (ushort) 12; + this.height = (ushort) 12; + break; + case 193: + this.width = (ushort) 20; + this.height = (ushort) 22; + this.rare = (sbyte) 2; + this.value = 27000; + this.accessory = true; + this.defense = (short) 1; + break; + case 194: + this.useTurn = true; + this.useStyle = (byte) 1; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 70; + this.width = (ushort) 14; + this.height = (ushort) 14; + this.value = 150; + break; + case 195: + this.useTurn = true; + this.useStyle = (byte) 1; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 60; + this.width = (ushort) 14; + this.height = (ushort) 14; + this.value = 150; + break; + case 196: + this.autoReuse = true; + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 37; + this.useTime = (byte) 25; + this.hammer = (byte) 25; + this.width = (ushort) 24; + this.height = (ushort) 28; + this.damage = (short) 2; + this.knockBack = 5.5f; + this.scale = 1.2f; + this.useSound = (byte) 1; + this.tileBoost = (sbyte) -1; + this.value = 50; + this.melee = true; + break; + case 197: + this.autoReuse = true; + this.useStyle = (byte) 5; + this.useAnimation = (byte) 12; + this.useTime = (byte) 12; + this.width = (ushort) 50; + this.height = (ushort) 18; + this.shoot = (byte) 12; + this.useAmmo = (byte) 15; + this.useSound = (byte) 9; + this.damage = (short) 55; + this.shootSpeed = 14f; + this.noMelee = true; + this.value = 500000; + this.rare = (sbyte) 2; + this.ranged = true; + break; + case 198: + this.useStyle = (byte) 1; + this.useAnimation = (byte) 25; + this.knockBack = 3f; + this.width = (ushort) 40; + this.height = (ushort) 40; + this.damage = (short) 21; + this.scale = 1f; + this.useSound = (byte) 15; + this.rare = (sbyte) 1; + this.value = 27000; + this.melee = true; + break; + case 199: + this.useStyle = (byte) 1; + this.useAnimation = (byte) 25; + this.knockBack = 3f; + this.width = (ushort) 40; + this.height = (ushort) 40; + this.damage = (short) 21; + this.scale = 1f; + this.useSound = (byte) 15; + this.rare = (sbyte) 1; + this.value = 27000; + this.melee = true; + break; + case 200: + this.useStyle = (byte) 1; + this.useAnimation = (byte) 25; + this.knockBack = 3f; + this.width = (ushort) 40; + this.height = (ushort) 40; + this.damage = (short) 21; + this.scale = 1f; + this.useSound = (byte) 15; + this.rare = (sbyte) 1; + this.value = 27000; + this.melee = true; + break; + case 201: + this.useStyle = (byte) 1; + this.useAnimation = (byte) 25; + this.knockBack = 3f; + this.width = (ushort) 40; + this.height = (ushort) 40; + this.damage = (short) 21; + this.scale = 1f; + this.useSound = (byte) 15; + this.rare = (sbyte) 1; + this.value = 27000; + this.melee = true; + break; + case 202: + this.useStyle = (byte) 1; + this.useAnimation = (byte) 25; + this.knockBack = 3f; + this.width = (ushort) 40; + this.height = (ushort) 40; + this.damage = (short) 21; + this.scale = 1f; + this.useSound = (byte) 15; + this.rare = (sbyte) 1; + this.value = 27000; + this.melee = true; + break; + case 203: + this.useStyle = (byte) 1; + this.useAnimation = (byte) 25; + this.knockBack = 3f; + this.width = (ushort) 40; + this.height = (ushort) 40; + this.damage = (short) 21; + this.scale = 1f; + this.useSound = (byte) 15; + this.rare = (sbyte) 1; + this.value = 27000; + this.melee = true; + break; + case 204: + this.useTurn = true; + this.autoReuse = true; + this.useStyle = (byte) 1; + this.useAnimation = (byte) 30; + this.useTime = (byte) 16; + this.hammer = (byte) 60; + this.axe = (byte) 20; + this.width = (ushort) 24; + this.height = (ushort) 28; + this.damage = (short) 20; + this.knockBack = 7f; + this.scale = 1.2f; + this.useSound = (byte) 1; + this.rare = (sbyte) 1; + this.value = 15000; + this.melee = true; + break; + case 205: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.headSlot = (short) 13; + this.defense = (short) 1; + break; + case 206: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.width = (ushort) 20; + this.height = (ushort) 20; + break; + case 207: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.width = (ushort) 20; + this.height = (ushort) 20; + break; + case 208: + this.width = (ushort) 20; + this.height = (ushort) 20; + this.value = 100; + this.headSlot = (short) 23; + this.vanity = true; + break; + case 209: + this.width = (ushort) 16; + this.height = (ushort) 18; + this.maxStack = (short) 99; + this.value = 200; + break; + case 210: + this.width = (ushort) 14; + this.height = (ushort) 20; + this.maxStack = (short) 99; + this.value = 1000; + break; + case 211: + this.width = (ushort) 20; + this.height = (ushort) 20; + this.accessory = true; + this.rare = (sbyte) 3; + this.value = 50000; + break; + case 212: + this.width = (ushort) 20; + this.height = (ushort) 20; + this.accessory = true; + this.rare = (sbyte) 3; + this.value = 50000; + break; + case 213: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 25; + this.useTime = (byte) 13; + this.autoReuse = true; + this.width = (ushort) 24; + this.height = (ushort) 28; + this.damage = (short) 7; + this.createTile = (short) 2; + this.scale = 1.2f; + this.useSound = (byte) 1; + this.knockBack = 3f; + this.rare = (sbyte) 3; + this.value = 2000; + this.melee = true; + break; + case 214: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createTile = (short) 76; + this.width = (ushort) 12; + this.height = (ushort) 12; + break; + case 215: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.useTurn = true; + this.useTime = (byte) 30; + this.useAnimation = (byte) 30; + this.noUseGraphic = true; + this.useStyle = (byte) 10; + this.useSound = (byte) 16; + this.rare = (sbyte) 2; + this.value = 100; + break; + case 216: + this.width = (ushort) 20; + this.height = (ushort) 20; + this.rare = (sbyte) 1; + this.value = 1500; + this.accessory = true; + this.defense = (short) 1; + break; + case 217: + this.useTurn = true; + this.autoReuse = true; + this.useStyle = (byte) 1; + this.useAnimation = (byte) 27; + this.useTime = (byte) 14; + this.hammer = (byte) 70; + this.axe = (byte) 30; + this.width = (ushort) 24; + this.height = (ushort) 28; + this.damage = (short) 20; + this.knockBack = 7f; + this.scale = 1.4f; + this.useSound = (byte) 1; + this.rare = (sbyte) 3; + this.value = 15000; + this.melee = true; + break; + case 218: + this.mana = (byte) 16; + this.channel = true; + this.damage = (short) 34; + this.useStyle = (byte) 1; + this.shootSpeed = 6f; + this.shoot = (byte) 34; + this.width = (ushort) 26; + this.height = (ushort) 28; + this.useSound = (byte) 20; + this.useAnimation = (byte) 20; + this.useTime = (byte) 20; + this.rare = (sbyte) 3; + this.noMelee = true; + this.knockBack = 6.5f; + this.tileBoost = (sbyte) 64; + this.value = 10000; + this.magic = true; + break; + case 219: + this.autoReuse = false; + this.useStyle = (byte) 5; + this.useAnimation = (byte) 11; + this.useTime = (byte) 11; + this.width = (ushort) 24; + this.height = (ushort) 22; + this.shoot = (byte) 14; + this.knockBack = 2f; + this.useAmmo = (byte) 14; + this.useSound = (byte) 11; + this.damage = (short) 23; + this.shootSpeed = 13f; + this.noMelee = true; + this.value = 50000; + this.scale = 0.75f; + this.rare = (sbyte) 3; + this.ranged = true; + break; + case 220: + this.noMelee = true; + this.useStyle = (byte) 5; + this.useAnimation = (byte) 45; + this.useTime = (byte) 45; + this.knockBack = 7f; + this.width = (ushort) 30; + this.height = (ushort) 10; + this.damage = (short) 33; + this.scale = 1.1f; + this.noUseGraphic = true; + this.shoot = (byte) 35; + this.shootSpeed = 12f; + this.useSound = (byte) 1; + this.rare = (sbyte) 3; + this.value = 27000; + this.melee = true; + this.channel = true; + break; + case 221: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 77; + this.width = (ushort) 26; + this.height = (ushort) 24; + this.value = 3000; + break; + case 222: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 78; + this.width = (ushort) 14; + this.height = (ushort) 14; + this.value = 100; + break; + case 223: + this.width = (ushort) 20; + this.height = (ushort) 22; + this.rare = (sbyte) 3; + this.value = 27000; + this.accessory = true; + break; + case 224: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 79; + this.width = (ushort) 28; + this.height = (ushort) 20; + this.value = 2000; + break; + case 225: + this.maxStack = (short) 99; + this.width = (ushort) 22; + this.height = (ushort) 22; + this.value = 1000; + break; + case 226: + this.useSound = (byte) 3; + this.healMana = (short) 50; + this.healLife = (short) 50; + this.useStyle = (byte) 2; + this.useTurn = true; + this.useAnimation = (byte) 17; + this.useTime = (byte) 17; + this.maxStack = (short) 20; + this.consumable = true; + this.width = (ushort) 14; + this.height = (ushort) 24; + this.potion = true; + this.value = 2000; + break; + case 227: + this.useSound = (byte) 3; + this.healMana = (short) 100; + this.healLife = (short) 100; + this.useStyle = (byte) 2; + this.useTurn = true; + this.useAnimation = (byte) 17; + this.useTime = (byte) 17; + this.maxStack = (short) 20; + this.consumable = true; + this.width = (ushort) 14; + this.height = (ushort) 24; + this.potion = true; + this.value = 4000; + break; + case 228: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.defense = (short) 4; + this.headSlot = (short) 8; + this.rare = (sbyte) 3; + this.value = 45000; + break; + case 229: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.defense = (short) 5; + this.bodySlot = (short) 8; + this.rare = (sbyte) 3; + this.value = 30000; + break; + case 230: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.defense = (short) 4; + this.legSlot = (short) 8; + this.rare = (sbyte) 3; + this.value = 30000; + break; + case 231: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.defense = (short) 8; + this.headSlot = (short) 9; + this.rare = (sbyte) 3; + this.value = 45000; + break; + case 232: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.defense = (short) 9; + this.bodySlot = (short) 9; + this.rare = (sbyte) 3; + this.value = 30000; + break; + case 233: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.defense = (short) 8; + this.legSlot = (short) 9; + this.rare = (sbyte) 3; + this.value = 30000; + break; + case 234: + this.shootSpeed = 3f; + this.shoot = (byte) 36; + this.damage = (short) 9; + this.width = (ushort) 8; + this.height = (ushort) 8; + this.maxStack = (short) 250; + this.consumable = true; + this.ammo = (byte) 14; + this.knockBack = 1f; + this.value = 8; + this.rare = (sbyte) 1; + this.ranged = true; + break; + case 235: + this.useStyle = (byte) 1; + this.shootSpeed = 5f; + this.shoot = (byte) 37; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.maxStack = (short) 50; + this.consumable = true; + this.useSound = (byte) 1; + this.useAnimation = (byte) 25; + this.useTime = (byte) 25; + this.noUseGraphic = true; + this.noMelee = true; + this.value = 500; + this.damage = (short) 0; + break; + case 236: + this.width = (ushort) 12; + this.height = (ushort) 20; + this.maxStack = (short) 99; + this.value = 5000; + break; + case 237: + this.width = (ushort) 28; + this.height = (ushort) 12; + this.headSlot = (short) 12; + this.rare = (sbyte) 2; + this.value = 10000; + this.vanity = true; + break; + case 238: + this.width = (ushort) 28; + this.height = (ushort) 20; + this.headSlot = (short) 14; + this.rare = (sbyte) 2; + this.value = 10000; + this.defense = (short) 2; + break; + case 239: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.headSlot = (short) 15; + this.value = 10000; + this.vanity = true; + break; + case 240: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.bodySlot = (short) 10; + this.value = 5000; + this.vanity = true; + break; + case 241: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.legSlot = (short) 10; + this.value = 5000; + this.vanity = true; + break; + case 242: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.headSlot = (short) 16; + this.value = 10000; + this.vanity = true; + break; + case 243: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.headSlot = (short) 17; + this.value = 20000; + this.vanity = true; + break; + case 244: + this.width = (ushort) 18; + this.height = (ushort) 12; + this.headSlot = (short) 18; + this.value = 10000; + this.vanity = true; + break; + case 245: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.bodySlot = (short) 11; + this.value = 250000; + this.vanity = true; + break; + case 246: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.legSlot = (short) 11; + this.value = 250000; + this.vanity = true; + break; + case 247: + this.width = (ushort) 18; + this.height = (ushort) 12; + this.headSlot = (short) 19; + this.value = 10000; + this.vanity = true; + break; + case 248: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.bodySlot = (short) 12; + this.value = 5000; + this.vanity = true; + break; + case 249: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.legSlot = (short) 12; + this.value = 5000; + this.vanity = true; + break; + case 250: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.headSlot = (short) 20; + this.value = 10000; + this.vanity = true; + break; + case 251: + this.width = (ushort) 18; + this.height = (ushort) 12; + this.headSlot = (short) 21; + this.value = 10000; + this.vanity = true; + break; + case 252: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.bodySlot = (short) 13; + this.value = 5000; + this.vanity = true; + break; + case 253: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.legSlot = (short) 13; + this.value = 5000; + this.vanity = true; + break; + case 254: + this.maxStack = (short) 99; + this.width = (ushort) 12; + this.height = (ushort) 20; + this.value = 10000; + break; + case (int) byte.MaxValue: + this.maxStack = (short) 99; + this.width = (ushort) 12; + this.height = (ushort) 20; + this.value = 2000; + break; + case 256: + this.width = (ushort) 18; + this.height = (ushort) 12; + this.headSlot = (short) 22; + this.value = 10000; + this.vanity = true; + break; + case 257: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.bodySlot = (short) 14; + this.value = 5000; + this.vanity = true; + break; + case 258: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.legSlot = (short) 14; + this.value = 5000; + this.vanity = true; + break; + case 259: + this.width = (ushort) 18; + this.height = (ushort) 20; + this.maxStack = (short) 99; + this.value = 50; + break; + case 260: + this.width = (ushort) 18; + this.height = (ushort) 14; + this.headSlot = (short) 24; + this.value = 1000; + this.vanity = true; + break; + case 261: + this.useStyle = (byte) 2; + this.useSound = (byte) 2; + this.useTurn = false; + this.useAnimation = (byte) 17; + this.useTime = (byte) 17; + this.width = (ushort) 20; + this.height = (ushort) 10; + this.maxStack = (short) 99; + this.healLife = (short) 20; + this.consumable = true; + this.value = 1000; + this.potion = true; + break; + case 262: + this.width = (ushort) 18; + this.height = (ushort) 14; + this.bodySlot = (short) 15; + this.value = 2000; + this.vanity = true; + break; + case 263: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.headSlot = (short) 25; + this.value = 10000; + this.vanity = true; + break; + case 264: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.headSlot = (short) 26; + this.value = 10000; + this.vanity = true; + break; + case 265: + this.shootSpeed = 6.5f; + this.shoot = (byte) 41; + this.damage = (short) 10; + this.width = (ushort) 10; + this.height = (ushort) 28; + this.maxStack = (short) 250; + this.consumable = true; + this.ammo = (byte) 1; + this.knockBack = 8f; + this.value = 100; + this.rare = (sbyte) 2; + this.ranged = true; + break; + case 266: + this.useStyle = (byte) 5; + this.useAnimation = (byte) 16; + this.useTime = (byte) 16; + this.autoReuse = true; + this.width = (ushort) 40; + this.height = (ushort) 20; + this.shoot = (byte) 42; + this.useAmmo = (byte) 42; + this.useSound = (byte) 11; + this.damage = (short) 30; + this.shootSpeed = 12f; + this.noMelee = true; + this.knockBack = 5f; + this.value = 10000; + this.rare = (sbyte) 2; + this.ranged = true; + break; + case 267: + this.accessory = true; + this.width = (ushort) 14; + this.height = (ushort) 26; + this.value = 1000; + break; + case 268: + this.headSlot = (short) 27; + this.defense = (short) 2; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.value = 1000; + this.rare = (sbyte) 2; + break; + case 269: + this.bodySlot = (short) 0; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.value = 10000; + if (UI.current.player != null) + { + this.color = UI.current.player.shirtColor; + break; + } + else + break; + case 270: + this.legSlot = (short) 0; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.value = 10000; + if (UI.current.player != null) + { + this.color = UI.current.player.pantsColor; + break; + } + else + break; + case 271: + this.headSlot = (short) 0; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.value = 10000; + if (UI.current.player != null) + { + this.color = UI.current.player.hairColor; + break; + } + else + break; + case 272: + this.mana = (byte) 14; + this.damage = (short) 35; + this.useStyle = (byte) 5; + this.shootSpeed = 0.2f; + this.shoot = (byte) 45; + this.width = (ushort) 26; + this.height = (ushort) 28; + this.useSound = (byte) 8; + this.useAnimation = (byte) 20; + this.useTime = (byte) 20; + this.rare = (sbyte) 3; + this.noMelee = true; + this.knockBack = 5f; + this.scale = 0.9f; + this.value = 10000; + this.magic = true; + break; + case 273: + this.useStyle = (byte) 1; + this.useAnimation = (byte) 27; + this.useTime = (byte) 27; + this.knockBack = 4.5f; + this.width = (ushort) 40; + this.height = (ushort) 40; + this.damage = (short) 42; + this.scale = 1.15f; + this.useSound = (byte) 1; + this.rare = (sbyte) 3; + this.value = 27000; + this.melee = true; + break; + case 274: + this.useStyle = (byte) 5; + this.useAnimation = (byte) 25; + this.useTime = (byte) 25; + this.shootSpeed = 5f; + this.knockBack = 4f; + this.width = (ushort) 40; + this.height = (ushort) 40; + this.damage = (short) 27; + this.scale = 1.1f; + this.useSound = (byte) 1; + this.shoot = (byte) 46; + this.rare = (sbyte) 3; + this.value = 27000; + this.noMelee = true; + this.noUseGraphic = true; + this.melee = true; + break; + case 275: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createTile = (short) 81; + this.width = (ushort) 20; + this.height = (ushort) 22; + this.value = 400; + break; + case 276: + this.maxStack = (short) 250; + this.width = (ushort) 12; + this.height = (ushort) 12; + this.value = 10; + break; + case 277: + this.useStyle = (byte) 5; + this.useAnimation = (byte) 31; + this.useTime = (byte) 31; + this.shootSpeed = 4f; + this.knockBack = 5f; + this.width = (ushort) 40; + this.height = (ushort) 40; + this.damage = (short) 10; + this.scale = 1.1f; + this.useSound = (byte) 1; + this.shoot = (byte) 47; + this.rare = (sbyte) 1; + this.value = 10000; + this.noMelee = true; + this.noUseGraphic = true; + this.melee = true; + break; + case 278: + this.shootSpeed = 4.5f; + this.shoot = (byte) 14; + this.damage = (short) 9; + this.width = (ushort) 8; + this.height = (ushort) 8; + this.maxStack = (short) 250; + this.consumable = true; + this.ammo = (byte) 14; + this.knockBack = 3f; + this.value = 15; + this.ranged = true; + break; + case 279: + this.useStyle = (byte) 1; + this.shootSpeed = 10f; + this.shoot = (byte) 48; + this.damage = (short) 12; + this.width = (ushort) 18; + this.height = (ushort) 20; + this.maxStack = (short) 250; + this.consumable = true; + this.useSound = (byte) 1; + this.useAnimation = (byte) 15; + this.useTime = (byte) 15; + this.noUseGraphic = true; + this.noMelee = true; + this.value = 50; + this.knockBack = 2f; + this.ranged = true; + break; + case 280: + this.useStyle = (byte) 5; + this.useAnimation = (byte) 31; + this.useTime = (byte) 31; + this.shootSpeed = 3.7f; + this.knockBack = 6.5f; + this.width = (ushort) 32; + this.height = (ushort) 32; + this.damage = (short) 8; + this.scale = 1f; + this.useSound = (byte) 1; + this.shoot = (byte) 49; + this.value = 1000; + this.noMelee = true; + this.noUseGraphic = true; + this.melee = true; + break; + case 281: + this.useStyle = (byte) 5; + this.autoReuse = true; + this.useAnimation = (byte) 45; + this.useTime = (byte) 45; + this.width = (ushort) 38; + this.height = (ushort) 6; + this.shoot = (byte) 10; + this.useAmmo = (byte) 51; + this.useSound = (byte) 5; + this.damage = (short) 9; + this.shootSpeed = 11f; + this.noMelee = true; + this.value = 10000; + this.knockBack = 4f; + this.useAmmo = (byte) 51; + this.ranged = true; + break; + case 282: + this.useStyle = (byte) 1; + this.shootSpeed = 6f; + this.shoot = (byte) 50; + this.width = (ushort) 12; + this.height = (ushort) 12; + this.maxStack = (short) 99; + this.consumable = true; + this.useSound = (byte) 1; + this.useAnimation = (byte) 15; + this.useTime = (byte) 15; + this.noMelee = true; + this.value = 10; + this.holdStyle = (byte) 1; + break; + case 283: + this.shoot = (byte) 51; + this.width = (ushort) 8; + this.height = (ushort) 8; + this.maxStack = (short) 250; + this.ammo = (byte) 51; + break; + case 284: + this.noMelee = true; + this.useStyle = (byte) 1; + this.shootSpeed = 6.5f; + this.shoot = (byte) 52; + this.damage = (short) 7; + this.knockBack = 5f; + this.width = (ushort) 14; + this.height = (ushort) 28; + this.useSound = (byte) 1; + this.useAnimation = (byte) 16; + this.useTime = (byte) 16; + this.noUseGraphic = true; + this.value = 5000; + this.melee = true; + break; + case 285: + this.width = (ushort) 24; + this.height = (ushort) 8; + this.accessory = true; + this.value = 5000; + break; + case 286: + this.useStyle = (byte) 1; + this.shootSpeed = 6f; + this.shoot = (byte) 53; + this.width = (ushort) 12; + this.height = (ushort) 12; + this.maxStack = (short) 99; + this.consumable = true; + this.useSound = (byte) 1; + this.useAnimation = (byte) 15; + this.useTime = (byte) 15; + this.noMelee = true; + this.value = 20; + this.holdStyle = (byte) 1; + break; + case 287: + this.useStyle = (byte) 1; + this.shootSpeed = 11f; + this.shoot = (byte) 54; + this.damage = (short) 13; + this.width = (ushort) 18; + this.height = (ushort) 20; + this.maxStack = (short) 250; + this.consumable = true; + this.useSound = (byte) 1; + this.useAnimation = (byte) 15; + this.useTime = (byte) 15; + this.noUseGraphic = true; + this.noMelee = true; + this.value = 60; + this.knockBack = 2f; + this.ranged = true; + break; + case 288: + this.useSound = (byte) 3; + this.useStyle = (byte) 2; + this.useTurn = true; + this.useAnimation = (byte) 17; + this.useTime = (byte) 17; + this.maxStack = (short) 30; + this.consumable = true; + this.width = (ushort) 14; + this.height = (ushort) 24; + this.buffType = (byte) 1; + this.buffTime = (ushort) 14400; + this.value = 1000; + this.rare = (sbyte) 1; + break; + case 289: + this.useSound = (byte) 3; + this.useStyle = (byte) 2; + this.useTurn = true; + this.useAnimation = (byte) 17; + this.useTime = (byte) 17; + this.maxStack = (short) 30; + this.consumable = true; + this.width = (ushort) 14; + this.height = (ushort) 24; + this.buffType = (byte) 2; + this.buffTime = (ushort) 18000; + this.value = 1000; + this.rare = (sbyte) 1; + break; + case 290: + this.useSound = (byte) 3; + this.useStyle = (byte) 2; + this.useTurn = true; + this.useAnimation = (byte) 17; + this.useTime = (byte) 17; + this.maxStack = (short) 30; + this.consumable = true; + this.width = (ushort) 14; + this.height = (ushort) 24; + this.buffType = (byte) 3; + this.buffTime = (ushort) 14400; + this.value = 1000; + this.rare = (sbyte) 1; + break; + case 291: + this.useSound = (byte) 3; + this.useStyle = (byte) 2; + this.useTurn = true; + this.useAnimation = (byte) 17; + this.useTime = (byte) 17; + this.maxStack = (short) 30; + this.consumable = true; + this.width = (ushort) 14; + this.height = (ushort) 24; + this.buffType = (byte) 4; + this.buffTime = (ushort) 7200; + this.value = 1000; + this.rare = (sbyte) 1; + break; + case 292: + this.useSound = (byte) 3; + this.useStyle = (byte) 2; + this.useTurn = true; + this.useAnimation = (byte) 17; + this.useTime = (byte) 17; + this.maxStack = (short) 30; + this.consumable = true; + this.width = (ushort) 14; + this.height = (ushort) 24; + this.buffType = (byte) 5; + this.buffTime = (ushort) 18000; + this.value = 1000; + this.rare = (sbyte) 1; + break; + case 293: + this.useSound = (byte) 3; + this.useStyle = (byte) 2; + this.useTurn = true; + this.useAnimation = (byte) 17; + this.useTime = (byte) 17; + this.maxStack = (short) 30; + this.consumable = true; + this.width = (ushort) 14; + this.height = (ushort) 24; + this.buffType = (byte) 6; + this.buffTime = (ushort) 7200; + this.value = 1000; + this.rare = (sbyte) 1; + break; + case 294: + this.useSound = (byte) 3; + this.useStyle = (byte) 2; + this.useTurn = true; + this.useAnimation = (byte) 17; + this.useTime = (byte) 17; + this.maxStack = (short) 30; + this.consumable = true; + this.width = (ushort) 14; + this.height = (ushort) 24; + this.buffType = (byte) 7; + this.buffTime = (ushort) 7200; + this.value = 1000; + this.rare = (sbyte) 1; + break; + case 295: + this.useSound = (byte) 3; + this.useStyle = (byte) 2; + this.useTurn = true; + this.useAnimation = (byte) 17; + this.useTime = (byte) 17; + this.maxStack = (short) 30; + this.consumable = true; + this.width = (ushort) 14; + this.height = (ushort) 24; + this.buffType = (byte) 8; + this.buffTime = (ushort) 18000; + this.value = 1000; + this.rare = (sbyte) 1; + break; + case 296: + this.useSound = (byte) 3; + this.useStyle = (byte) 2; + this.useTurn = true; + this.useAnimation = (byte) 17; + this.useTime = (byte) 17; + this.maxStack = (short) 30; + this.consumable = true; + this.width = (ushort) 14; + this.height = (ushort) 24; + this.buffType = (byte) 9; + this.buffTime = (ushort) 18000; + this.value = 1000; + this.rare = (sbyte) 1; + break; + case 297: + this.useSound = (byte) 3; + this.useStyle = (byte) 2; + this.useTurn = true; + this.useAnimation = (byte) 17; + this.useTime = (byte) 17; + this.maxStack = (short) 30; + this.consumable = true; + this.width = (ushort) 14; + this.height = (ushort) 24; + this.buffType = (byte) 10; + this.buffTime = (ushort) 7200; + this.value = 1000; + this.rare = (sbyte) 1; + break; + case 298: + this.useSound = (byte) 3; + this.useStyle = (byte) 2; + this.useTurn = true; + this.useAnimation = (byte) 17; + this.useTime = (byte) 17; + this.maxStack = (short) 30; + this.consumable = true; + this.width = (ushort) 14; + this.height = (ushort) 24; + this.buffType = (byte) 11; + this.buffTime = (ushort) 18000; + this.value = 1000; + this.rare = (sbyte) 1; + break; + case 299: + this.useSound = (byte) 3; + this.useStyle = (byte) 2; + this.useTurn = true; + this.useAnimation = (byte) 17; + this.useTime = (byte) 17; + this.maxStack = (short) 30; + this.consumable = true; + this.width = (ushort) 14; + this.height = (ushort) 24; + this.buffType = (byte) 12; + this.buffTime = (ushort) 14400; + this.value = 1000; + this.rare = (sbyte) 1; + break; + case 300: + this.useSound = (byte) 3; + this.useStyle = (byte) 2; + this.useTurn = true; + this.useAnimation = (byte) 17; + this.useTime = (byte) 17; + this.maxStack = (short) 30; + this.consumable = true; + this.width = (ushort) 14; + this.height = (ushort) 24; + this.buffType = (byte) 13; + this.buffTime = (ushort) 25200; + this.value = 1000; + this.rare = (sbyte) 1; + break; + case 301: + this.useSound = (byte) 3; + this.useStyle = (byte) 2; + this.useTurn = true; + this.useAnimation = (byte) 17; + this.useTime = (byte) 17; + this.maxStack = (short) 30; + this.consumable = true; + this.width = (ushort) 14; + this.height = (ushort) 24; + this.buffType = (byte) 14; + this.buffTime = (ushort) 7200; + this.value = 1000; + this.rare = (sbyte) 1; + break; + case 302: + this.useSound = (byte) 3; + this.useStyle = (byte) 2; + this.useTurn = true; + this.useAnimation = (byte) 17; + this.useTime = (byte) 17; + this.maxStack = (short) 30; + this.consumable = true; + this.width = (ushort) 14; + this.height = (ushort) 24; + this.buffType = (byte) 15; + this.buffTime = (ushort) 18000; + this.value = 1000; + this.rare = (sbyte) 1; + break; + case 303: + this.useSound = (byte) 3; + this.useStyle = (byte) 2; + this.useTurn = true; + this.useAnimation = (byte) 17; + this.useTime = (byte) 17; + this.maxStack = (short) 30; + this.consumable = true; + this.width = (ushort) 14; + this.height = (ushort) 24; + this.buffType = (byte) 16; + this.buffTime = (ushort) 14400; + this.value = 1000; + this.rare = (sbyte) 1; + break; + case 304: + this.useSound = (byte) 3; + this.useStyle = (byte) 2; + this.useTurn = true; + this.useAnimation = (byte) 17; + this.useTime = (byte) 17; + this.maxStack = (short) 30; + this.consumable = true; + this.width = (ushort) 14; + this.height = (ushort) 24; + this.buffType = (byte) 17; + this.buffTime = (ushort) 18000; + this.value = 1000; + this.rare = (sbyte) 1; + break; + case 305: + this.useSound = (byte) 3; + this.useStyle = (byte) 2; + this.useTurn = true; + this.useAnimation = (byte) 17; + this.useTime = (byte) 17; + this.maxStack = (short) 30; + this.consumable = true; + this.width = (ushort) 14; + this.height = (ushort) 24; + this.buffType = (byte) 18; + this.buffTime = (ushort) 10800; + this.value = 1000; + this.rare = (sbyte) 1; + break; + case 306: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 21; + this.placeStyle = (byte) 1; + this.width = (ushort) 26; + this.height = (ushort) 22; + this.value = 5000; + break; + case 307: + this.useTurn = true; + this.useStyle = (byte) 1; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 82; + this.placeStyle = (byte) 0; + this.width = (ushort) 12; + this.height = (ushort) 14; + this.value = 80; + break; + case 308: + this.useTurn = true; + this.useStyle = (byte) 1; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 82; + this.placeStyle = (byte) 1; + this.width = (ushort) 12; + this.height = (ushort) 14; + this.value = 80; + break; + case 309: + this.useTurn = true; + this.useStyle = (byte) 1; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 82; + this.placeStyle = (byte) 2; + this.width = (ushort) 12; + this.height = (ushort) 14; + this.value = 80; + break; + case 310: + this.useTurn = true; + this.useStyle = (byte) 1; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 82; + this.placeStyle = (byte) 3; + this.width = (ushort) 12; + this.height = (ushort) 14; + this.value = 80; + break; + case 311: + this.useTurn = true; + this.useStyle = (byte) 1; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 82; + this.placeStyle = (byte) 4; + this.width = (ushort) 12; + this.height = (ushort) 14; + this.value = 80; + break; + case 312: + this.useTurn = true; + this.useStyle = (byte) 1; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 82; + this.placeStyle = (byte) 5; + this.width = (ushort) 12; + this.height = (ushort) 14; + this.value = 80; + break; + case 313: + this.maxStack = (short) 99; + this.width = (ushort) 12; + this.height = (ushort) 14; + this.value = 100; + break; + case 314: + this.maxStack = (short) 99; + this.width = (ushort) 12; + this.height = (ushort) 14; + this.value = 100; + break; + case 315: + this.maxStack = (short) 99; + this.width = (ushort) 12; + this.height = (ushort) 14; + this.value = 100; + break; + case 316: + this.maxStack = (short) 99; + this.width = (ushort) 12; + this.height = (ushort) 14; + this.value = 100; + break; + case 317: + this.maxStack = (short) 99; + this.width = (ushort) 12; + this.height = (ushort) 14; + this.value = 100; + break; + case 318: + this.maxStack = (short) 99; + this.width = (ushort) 12; + this.height = (ushort) 14; + this.value = 100; + break; + case 319: + this.maxStack = (short) 99; + this.width = (ushort) 16; + this.height = (ushort) 14; + this.value = 200; + break; + case 320: + this.maxStack = (short) 99; + this.width = (ushort) 16; + this.height = (ushort) 14; + this.value = 50; + break; + case 321: + this.useTurn = true; + this.useStyle = (byte) 1; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 85; + this.width = (ushort) 20; + this.height = (ushort) 20; + break; + case 322: + this.headSlot = (short) 28; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.value = 20000; + break; + case 323: + this.width = (ushort) 10; + this.height = (ushort) 20; + this.maxStack = (short) 99; + this.value = 50; + break; + case 324: + this.width = (ushort) 10; + this.height = (ushort) 20; + this.maxStack = (short) 99; + this.value = 750000; + break; + case 325: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.bodySlot = (short) 16; + this.value = 200000; + this.vanity = true; + break; + case 326: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.legSlot = (short) 15; + this.value = 200000; + this.vanity = true; + break; + case 327: + this.width = (ushort) 14; + this.height = (ushort) 20; + this.maxStack = (short) 99; + break; + case 328: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 21; + this.placeStyle = (byte) 3; + this.width = (ushort) 26; + this.height = (ushort) 22; + this.value = 5000; + break; + case 329: + this.width = (ushort) 14; + this.height = (ushort) 20; + this.maxStack = (short) 1; + this.value = 75000; + break; + case 330: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 7; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createWall = (short) 20; + this.width = (ushort) 12; + this.height = (ushort) 12; + break; + case 331: + this.width = (ushort) 18; + this.height = (ushort) 16; + this.maxStack = (short) 99; + this.value = 100; + break; + case 332: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 86; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.value = 300; + break; + case 333: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 87; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.value = 300; + break; + case 334: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 88; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.value = 300; + break; + case 335: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 89; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.value = 300; + break; + case 336: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 90; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.value = 300; + break; + case 337: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 91; + this.placeStyle = (byte) 0; + this.width = (ushort) 10; + this.height = (ushort) 24; + this.value = 500; + break; + case 338: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 91; + this.placeStyle = (byte) 1; + this.width = (ushort) 10; + this.height = (ushort) 24; + this.value = 500; + break; + case 339: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 91; + this.placeStyle = (byte) 2; + this.width = (ushort) 10; + this.height = (ushort) 24; + this.value = 500; + break; + case 340: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 91; + this.placeStyle = (byte) 3; + this.width = (ushort) 10; + this.height = (ushort) 24; + this.value = 500; + break; + case 341: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 92; + this.width = (ushort) 10; + this.height = (ushort) 24; + this.value = 500; + break; + case 342: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 93; + this.width = (ushort) 10; + this.height = (ushort) 24; + this.value = 500; + break; + case 343: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 21; + this.placeStyle = (byte) 5; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.value = 500; + break; + case 344: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 95; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.value = 500; + break; + case 345: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 96; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.value = 500; + break; + case 346: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 97; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.value = 500000; + break; + case 347: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 98; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.value = 500; + break; + case 348: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 21; + this.placeStyle = (byte) 6; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.value = 1000; + break; + case 349: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 100; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.value = 1500; + break; + case 350: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 13; + this.placeStyle = (byte) 3; + this.width = (ushort) 16; + this.height = (ushort) 24; + this.value = 70; + break; + case 351: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 13; + this.placeStyle = (byte) 4; + this.width = (ushort) 16; + this.height = (ushort) 24; + this.value = 20; + break; + case 352: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 94; + this.width = (ushort) 24; + this.height = (ushort) 24; + this.value = 600; + break; + case 353: + this.useSound = (byte) 3; + this.useStyle = (byte) 2; + this.useTurn = true; + this.useAnimation = (byte) 17; + this.useTime = (byte) 17; + this.maxStack = (short) 30; + this.consumable = true; + this.width = (ushort) 10; + this.height = (ushort) 10; + this.buffType = (byte) 25; + this.buffTime = (ushort) 7200; + this.value = 100; + break; + case 354: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 101; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.value = 300; + break; + case 355: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 102; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.value = 300; + break; + case 356: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 103; + this.width = (ushort) 16; + this.height = (ushort) 24; + this.value = 20; + break; + case 357: + this.useSound = (byte) 3; + this.useStyle = (byte) 2; + this.useTurn = true; + this.useAnimation = (byte) 17; + this.useTime = (byte) 17; + this.maxStack = (short) 30; + this.consumable = true; + this.width = (ushort) 10; + this.height = (ushort) 10; + this.buffType = (byte) 26; + this.buffTime = (ushort) 36000; + this.rare = (sbyte) 1; + this.value = 1000; + break; + case 358: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 15; + this.placeStyle = (byte) 1; + this.width = (ushort) 12; + this.height = (ushort) 30; + this.value = 150; + break; + case 359: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 104; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.value = 300; + break; + case 360: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 105; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.value = 300; + break; + case 361: + this.useStyle = (byte) 4; + this.consumable = true; + this.useAnimation = (byte) 45; + this.useTime = (byte) 45; + this.width = (ushort) 28; + this.height = (ushort) 28; + break; + case 362: + this.maxStack = (short) 99; + this.width = (ushort) 24; + this.height = (ushort) 24; + this.value = 30; + break; + case 363: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 106; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.value = 300; + break; + case 364: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 107; + this.width = (ushort) 12; + this.height = (ushort) 12; + this.value = 3500; + this.rare = (sbyte) 3; + break; + case 365: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 108; + this.width = (ushort) 12; + this.height = (ushort) 12; + this.value = 5500; + this.rare = (sbyte) 3; + break; + case 366: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 111; + this.width = (ushort) 12; + this.height = (ushort) 12; + this.value = 7500; + this.rare = (sbyte) 3; + break; + case 367: + this.useTurn = true; + this.autoReuse = true; + this.useStyle = (byte) 1; + this.useAnimation = (byte) 27; + this.useTime = (byte) 14; + this.hammer = (byte) 80; + this.width = (ushort) 24; + this.height = (ushort) 28; + this.damage = (short) 26; + this.knockBack = 7.5f; + this.scale = 1.2f; + this.useSound = (byte) 1; + this.rare = (sbyte) 4; + this.value = 39000; + this.melee = true; + break; + case 368: + this.autoReuse = true; + this.useStyle = (byte) 1; + this.useAnimation = (byte) 25; + this.useTime = (byte) 25; + this.knockBack = 4.5f; + this.width = (ushort) 40; + this.height = (ushort) 40; + this.damage = (short) 47; + this.scale = 1.15f; + this.useSound = (byte) 1; + this.rare = (sbyte) 5; + this.value = 230000; + this.melee = true; + break; + case 369: + this.useTurn = true; + this.useStyle = (byte) 1; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 109; + this.width = (ushort) 14; + this.height = (ushort) 14; + this.value = 2000; + this.rare = (sbyte) 3; + break; + case 370: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createTile = (short) 112; + this.width = (ushort) 12; + this.height = (ushort) 12; + this.ammo = (byte) 42; + break; + case 371: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.defense = (short) 2; + this.headSlot = (short) 29; + this.rare = (sbyte) 4; + this.value = 75000; + break; + case 372: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.defense = (short) 11; + this.headSlot = (short) 30; + this.rare = (sbyte) 4; + this.value = 75000; + break; + case 373: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.defense = (short) 4; + this.headSlot = (short) 31; + this.rare = (sbyte) 4; + this.value = 75000; + break; + case 374: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.defense = (short) 8; + this.bodySlot = (short) 17; + this.rare = (sbyte) 4; + this.value = 60000; + break; + case 375: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.defense = (short) 7; + this.legSlot = (short) 16; + this.rare = (sbyte) 4; + this.value = 45000; + break; + case 376: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.defense = (short) 3; + this.headSlot = (short) 32; + this.rare = (sbyte) 4; + this.value = 112500; + break; + case 377: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.defense = (short) 16; + this.headSlot = (short) 33; + this.rare = (sbyte) 4; + this.value = 112500; + break; + case 378: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.defense = (short) 6; + this.headSlot = (short) 34; + this.rare = (sbyte) 4; + this.value = 112500; + break; + case 379: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.defense = (short) 12; + this.bodySlot = (short) 18; + this.rare = (sbyte) 4; + this.value = 90000; + break; + case 380: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.defense = (short) 9; + this.legSlot = (short) 17; + this.rare = (sbyte) 4; + this.value = 67500; + break; + case 381: + this.width = (ushort) 20; + this.height = (ushort) 20; + this.maxStack = (short) 99; + this.value = 10500; + this.rare = (sbyte) 3; + break; + case 382: + this.width = (ushort) 20; + this.height = (ushort) 20; + this.maxStack = (short) 99; + this.value = 22000; + this.rare = (sbyte) 3; + break; + case 383: + this.useStyle = (byte) 5; + this.useAnimation = (byte) 25; + this.useTime = (byte) 8; + this.shootSpeed = 40f; + this.knockBack = 2.75f; + this.width = (ushort) 20; + this.height = (ushort) 12; + this.damage = (short) 23; + this.axe = (byte) 14; + this.useSound = (byte) 23; + this.shoot = (byte) 57; + this.rare = (sbyte) 4; + this.value = 54000; + this.noMelee = true; + this.noUseGraphic = true; + this.melee = true; + this.channel = true; + break; + case 384: + this.useStyle = (byte) 5; + this.useAnimation = (byte) 25; + this.useTime = (byte) 8; + this.shootSpeed = 40f; + this.knockBack = 3f; + this.width = (ushort) 20; + this.height = (ushort) 12; + this.damage = (short) 29; + this.axe = (byte) 17; + this.useSound = (byte) 23; + this.shoot = (byte) 58; + this.rare = (sbyte) 4; + this.value = 81000; + this.noMelee = true; + this.noUseGraphic = true; + this.melee = true; + this.channel = true; + break; + case 385: + this.useStyle = (byte) 5; + this.useAnimation = (byte) 25; + this.useTime = (byte) 13; + this.shootSpeed = 32f; + this.knockBack = 0.0f; + this.width = (ushort) 20; + this.height = (ushort) 12; + this.damage = (short) 10; + this.pick = (byte) 110; + this.useSound = (byte) 23; + this.shoot = (byte) 59; + this.rare = (sbyte) 4; + this.value = 54000; + this.noMelee = true; + this.noUseGraphic = true; + this.melee = true; + this.channel = true; + break; + case 386: + this.useStyle = (byte) 5; + this.useAnimation = (byte) 25; + this.useTime = (byte) 10; + this.shootSpeed = 32f; + this.knockBack = 0.0f; + this.width = (ushort) 20; + this.height = (ushort) 12; + this.damage = (short) 15; + this.pick = (byte) 150; + this.useSound = (byte) 23; + this.shoot = (byte) 60; + this.rare = (sbyte) 4; + this.value = 81000; + this.noMelee = true; + this.noUseGraphic = true; + this.melee = true; + this.channel = true; + break; + case 387: + this.useStyle = (byte) 5; + this.useAnimation = (byte) 25; + this.useTime = (byte) 6; + this.shootSpeed = 40f; + this.knockBack = 4.5f; + this.width = (ushort) 20; + this.height = (ushort) 12; + this.damage = (short) 33; + this.axe = (byte) 20; + this.useSound = (byte) 23; + this.shoot = (byte) 61; + this.rare = (sbyte) 4; + this.value = 108000; + this.noMelee = true; + this.noUseGraphic = true; + this.melee = true; + this.channel = true; + break; + case 388: + this.useStyle = (byte) 5; + this.useAnimation = (byte) 25; + this.useTime = (byte) 7; + this.shootSpeed = 32f; + this.knockBack = 0.0f; + this.width = (ushort) 20; + this.height = (ushort) 12; + this.damage = (short) 20; + this.pick = (byte) 180; + this.useSound = (byte) 23; + this.shoot = (byte) 62; + this.rare = (sbyte) 4; + this.value = 108000; + this.noMelee = true; + this.noUseGraphic = true; + this.melee = true; + this.channel = true; + break; + case 389: + this.noMelee = true; + this.useStyle = (byte) 5; + this.useAnimation = (byte) 45; + this.useTime = (byte) 45; + this.knockBack = 7f; + this.width = (ushort) 30; + this.height = (ushort) 10; + this.damage = (short) 49; + this.scale = 1.1f; + this.noUseGraphic = true; + this.shoot = (byte) 63; + this.shootSpeed = 15f; + this.useSound = (byte) 1; + this.rare = (sbyte) 5; + this.value = 144000; + this.melee = true; + this.channel = true; + break; + case 390: + this.useStyle = (byte) 5; + this.useAnimation = (byte) 26; + this.useTime = (byte) 26; + this.shootSpeed = 4.5f; + this.knockBack = 5f; + this.width = (ushort) 40; + this.height = (ushort) 40; + this.damage = (short) 35; + this.scale = 1.1f; + this.useSound = (byte) 1; + this.shoot = (byte) 64; + this.rare = (sbyte) 4; + this.value = 67500; + this.noMelee = true; + this.noUseGraphic = true; + this.melee = true; + break; + case 391: + this.width = (ushort) 20; + this.height = (ushort) 20; + this.maxStack = (short) 99; + this.value = 37500; + this.rare = (sbyte) 3; + break; + case 392: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 7; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createWall = (short) 21; + this.width = (ushort) 12; + this.height = (ushort) 12; + break; + case 393: + this.width = (ushort) 24; + this.height = (ushort) 28; + this.rare = (sbyte) 3; + this.value = 100000; + this.accessory = true; + break; + case 394: + this.width = (ushort) 24; + this.height = (ushort) 28; + this.rare = (sbyte) 4; + this.value = 100000; + this.accessory = true; + break; + case 395: + this.width = (ushort) 24; + this.height = (ushort) 28; + this.rare = (sbyte) 4; + this.value = 150000; + this.accessory = true; + break; + case 396: + this.width = (ushort) 24; + this.height = (ushort) 28; + this.rare = (sbyte) 4; + this.value = 100000; + this.accessory = true; + break; + case 397: + this.width = (ushort) 24; + this.height = (ushort) 28; + this.rare = (sbyte) 4; + this.value = 100000; + this.accessory = true; + this.defense = (short) 2; + break; + case 398: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 114; + this.width = (ushort) 26; + this.height = (ushort) 20; + this.value = 100000; + break; + case 399: + this.width = (ushort) 14; + this.height = (ushort) 28; + this.rare = (sbyte) 4; + this.value = 150000; + this.accessory = true; + break; + case 400: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.defense = (short) 4; + this.headSlot = (short) 35; + this.rare = (sbyte) 4; + this.value = 150000; + break; + case 401: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.defense = (short) 22; + this.headSlot = (short) 36; + this.rare = (sbyte) 4; + this.value = 150000; + break; + case 402: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.defense = (short) 8; + this.headSlot = (short) 37; + this.rare = (sbyte) 4; + this.value = 150000; + break; + case 403: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.defense = (short) 14; + this.bodySlot = (short) 19; + this.rare = (sbyte) 4; + this.value = 120000; + break; + case 404: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.defense = (short) 10; + this.legSlot = (short) 18; + this.rare = (sbyte) 4; + this.value = 90000; + break; + case 405: + this.width = (ushort) 28; + this.height = (ushort) 24; + this.accessory = true; + this.rare = (sbyte) 4; + this.value = 100000; + break; + case 406: + this.useStyle = (byte) 5; + this.useAnimation = (byte) 25; + this.useTime = (byte) 25; + this.shootSpeed = 5f; + this.knockBack = 6f; + this.width = (ushort) 40; + this.height = (ushort) 40; + this.damage = (short) 38; + this.scale = 1.1f; + this.useSound = (byte) 1; + this.shoot = (byte) 66; + this.rare = (sbyte) 4; + this.value = 90000; + this.noMelee = true; + this.noUseGraphic = true; + this.melee = true; + break; + case 407: + this.width = (ushort) 28; + this.height = (ushort) 24; + this.accessory = true; + this.rare = (sbyte) 3; + this.value = 100000; + break; + case 408: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createTile = (short) 116; + this.width = (ushort) 12; + this.height = (ushort) 12; + this.ammo = (byte) 42; + break; + case 409: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createTile = (short) 117; + this.width = (ushort) 12; + this.height = (ushort) 12; + break; + case 410: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.defense = (short) 1; + this.bodySlot = (short) 20; + this.value = 5000; + this.rare = (sbyte) 1; + break; + case 411: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.defense = (short) 1; + this.legSlot = (short) 19; + this.value = 5000; + this.rare = (sbyte) 1; + break; + case 412: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createTile = (short) 118; + this.width = (ushort) 12; + this.height = (ushort) 12; + break; + case 413: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createTile = (short) 119; + this.width = (ushort) 12; + this.height = (ushort) 12; + break; + case 414: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createTile = (short) 120; + this.width = (ushort) 12; + this.height = (ushort) 12; + break; + case 415: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createTile = (short) 121; + this.width = (ushort) 12; + this.height = (ushort) 12; + break; + case 416: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createTile = (short) 122; + this.width = (ushort) 12; + this.height = (ushort) 12; + break; + case 417: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 7; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createWall = (short) 22; + this.width = (ushort) 12; + this.height = (ushort) 12; + break; + case 418: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 7; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createWall = (short) 23; + this.width = (ushort) 12; + this.height = (ushort) 12; + break; + case 419: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 7; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createWall = (short) 24; + this.width = (ushort) 12; + this.height = (ushort) 12; + break; + case 420: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 7; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createWall = (short) 25; + this.width = (ushort) 12; + this.height = (ushort) 12; + break; + case 421: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 7; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createWall = (short) 26; + this.width = (ushort) 12; + this.height = (ushort) 12; + break; + case 422: + this.useStyle = (byte) 1; + this.shootSpeed = 9f; + this.rare = (sbyte) 3; + this.damage = (short) 20; + this.shoot = (byte) 69; + this.width = (ushort) 18; + this.height = (ushort) 20; + this.maxStack = (short) 250; + this.consumable = true; + this.knockBack = 3f; + this.useSound = (byte) 1; + this.useAnimation = (byte) 15; + this.useTime = (byte) 15; + this.noUseGraphic = true; + this.noMelee = true; + this.value = 200; + break; + case 423: + this.useStyle = (byte) 1; + this.shootSpeed = 9f; + this.rare = (sbyte) 3; + this.damage = (short) 20; + this.shoot = (byte) 70; + this.width = (ushort) 18; + this.height = (ushort) 20; + this.maxStack = (short) 250; + this.consumable = true; + this.knockBack = 3f; + this.useSound = (byte) 1; + this.useAnimation = (byte) 15; + this.useTime = (byte) 15; + this.noUseGraphic = true; + this.noMelee = true; + this.value = 200; + break; + case 424: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createTile = (short) 123; + this.width = (ushort) 12; + this.height = (ushort) 12; + break; + case 425: + this.mana = (byte) 40; + this.channel = true; + this.damage = (short) 0; + this.useStyle = (byte) 1; + this.shoot = (byte) 72; + this.width = (ushort) 24; + this.height = (ushort) 24; + this.useSound = (byte) 25; + this.useAnimation = (byte) 20; + this.useTime = (byte) 20; + this.rare = (sbyte) 5; + this.noMelee = true; + this.value = this.value = 250000; + this.buffType = (byte) 27; + this.buffTime = (ushort) 18000; + break; + case 426: + this.useStyle = (byte) 1; + this.useAnimation = (byte) 30; + this.knockBack = 8f; + this.width = (ushort) 60; + this.height = (ushort) 70; + this.damage = (short) 39; + this.scale = 1.05f; + this.useSound = (byte) 1; + this.rare = (sbyte) 4; + this.value = 150000; + this.melee = true; + break; + case 427: + this.noWet = true; + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.holdStyle = (byte) 1; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 4; + this.placeStyle = (byte) 1; + this.width = (ushort) 10; + this.height = (ushort) 12; + this.value = 200; + break; + case 428: + this.noWet = true; + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.holdStyle = (byte) 1; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 4; + this.placeStyle = (byte) 2; + this.width = (ushort) 10; + this.height = (ushort) 12; + this.value = 200; + break; + case 429: + this.noWet = true; + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.holdStyle = (byte) 1; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 4; + this.placeStyle = (byte) 3; + this.width = (ushort) 10; + this.height = (ushort) 12; + this.value = 200; + break; + case 430: + this.noWet = true; + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.holdStyle = (byte) 1; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 4; + this.placeStyle = (byte) 4; + this.width = (ushort) 10; + this.height = (ushort) 12; + this.value = 200; + break; + case 431: + this.noWet = true; + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.holdStyle = (byte) 1; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 4; + this.placeStyle = (byte) 5; + this.width = (ushort) 10; + this.height = (ushort) 12; + this.value = 500; + break; + case 432: + this.noWet = true; + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.holdStyle = (byte) 1; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 4; + this.placeStyle = (byte) 6; + this.width = (ushort) 10; + this.height = (ushort) 12; + this.value = 200; + break; + case 433: + this.noWet = true; + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.holdStyle = (byte) 1; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 4; + this.placeStyle = (byte) 7; + this.width = (ushort) 10; + this.height = (ushort) 12; + this.value = 300; + break; + case 434: + this.autoReuse = true; + this.useStyle = (byte) 5; + this.useAnimation = (byte) 12; + this.useTime = (byte) 4; + this.reuseDelay = (byte) 14; + this.width = (ushort) 50; + this.height = (ushort) 18; + this.shoot = (byte) 10; + this.useAmmo = (byte) 14; + this.useSound = (byte) 31; + this.damage = (short) 19; + this.shootSpeed = 7.75f; + this.noMelee = true; + this.value = 150000; + this.rare = (sbyte) 4; + this.ranged = true; + break; + case 435: + this.useStyle = (byte) 5; + this.autoReuse = true; + this.useAnimation = (byte) 25; + this.useTime = (byte) 25; + this.width = (ushort) 50; + this.height = (ushort) 18; + this.shoot = (byte) 1; + this.useAmmo = (byte) 1; + this.useSound = (byte) 5; + this.damage = (short) 30; + this.shootSpeed = 9f; + this.noMelee = true; + this.value = 60000; + this.ranged = true; + this.rare = (sbyte) 4; + this.knockBack = 1.5f; + break; + case 436: + this.useStyle = (byte) 5; + this.autoReuse = true; + this.useAnimation = (byte) 23; + this.useTime = (byte) 23; + this.width = (ushort) 50; + this.height = (ushort) 18; + this.shoot = (byte) 1; + this.useAmmo = (byte) 1; + this.useSound = (byte) 5; + this.damage = (short) 34; + this.shootSpeed = 9.5f; + this.noMelee = true; + this.value = 90000; + this.ranged = true; + this.rare = (sbyte) 4; + this.knockBack = 2f; + break; + case 437: + this.noUseGraphic = true; + this.damage = (short) 0; + this.knockBack = 7f; + this.useStyle = (byte) 5; + this.shootSpeed = 14f; + this.shoot = (byte) 73; + this.width = (ushort) 18; + this.height = (ushort) 28; + this.useSound = (byte) 1; + this.useAnimation = (byte) 20; + this.useTime = (byte) 20; + this.rare = (sbyte) 4; + this.noMelee = true; + this.value = 200000; + break; + case 438: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 105; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.value = 300; + this.placeStyle = (byte) 2; + break; + case 439: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 105; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.value = 300; + this.placeStyle = (byte) 3; + break; + case 440: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 105; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.value = 300; + this.placeStyle = (byte) 4; + break; + case 441: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 105; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.value = 300; + this.placeStyle = (byte) 5; + break; + case 442: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 105; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.value = 300; + this.placeStyle = (byte) 6; + break; + case 443: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 105; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.value = 300; + this.placeStyle = (byte) 7; + break; + case 444: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 105; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.value = 300; + this.placeStyle = (byte) 8; + break; + case 445: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 105; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.value = 300; + this.placeStyle = (byte) 9; + break; + case 446: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 105; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.value = 300; + this.placeStyle = (byte) 10; + break; + case 447: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 105; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.value = 300; + this.placeStyle = (byte) 11; + break; + case 448: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 105; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.value = 300; + this.placeStyle = (byte) 12; + break; + case 449: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 105; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.value = 300; + this.placeStyle = (byte) 13; + break; + case 450: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 105; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.value = 300; + this.placeStyle = (byte) 14; + break; + case 451: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 105; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.value = 300; + this.placeStyle = (byte) 15; + break; + case 452: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 105; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.value = 300; + this.placeStyle = (byte) 16; + break; + case 453: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 105; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.value = 300; + this.placeStyle = (byte) 17; + break; + case 454: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 105; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.value = 300; + this.placeStyle = (byte) 18; + break; + case 455: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 105; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.value = 300; + this.placeStyle = (byte) 19; + break; + case 456: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 105; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.value = 300; + this.placeStyle = (byte) 20; + break; + case 457: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 105; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.value = 300; + this.placeStyle = (byte) 21; + break; + case 458: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 105; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.value = 300; + this.placeStyle = (byte) 22; + break; + case 459: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 105; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.value = 300; + this.placeStyle = (byte) 23; + break; + case 460: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 105; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.value = 300; + this.placeStyle = (byte) 24; + break; + case 461: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 105; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.value = 300; + this.placeStyle = (byte) 25; + break; + case 462: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 105; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.value = 300; + this.placeStyle = (byte) 26; + break; + case 463: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 105; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.value = 300; + this.placeStyle = (byte) 27; + break; + case 464: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 105; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.value = 300; + this.placeStyle = (byte) 28; + break; + case 465: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 105; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.value = 300; + this.placeStyle = (byte) 29; + break; + case 466: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 105; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.value = 300; + this.placeStyle = (byte) 30; + break; + case 467: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 105; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.value = 300; + this.placeStyle = (byte) 31; + break; + case 468: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 105; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.value = 300; + this.placeStyle = (byte) 32; + break; + case 469: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 105; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.value = 300; + this.placeStyle = (byte) 33; + break; + case 470: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 105; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.value = 300; + this.placeStyle = (byte) 34; + break; + case 471: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 105; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.value = 300; + this.placeStyle = (byte) 35; + break; + case 472: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 105; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.value = 300; + this.placeStyle = (byte) 36; + break; + case 473: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 105; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.value = 300; + this.placeStyle = (byte) 37; + break; + case 474: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 105; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.value = 300; + this.placeStyle = (byte) 38; + break; + case 475: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 105; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.value = 300; + this.placeStyle = (byte) 39; + break; + case 476: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 105; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.value = 300; + this.placeStyle = (byte) 40; + break; + case 477: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 105; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.value = 300; + this.placeStyle = (byte) 41; + break; + case 478: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 105; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.value = 300; + this.placeStyle = (byte) 42; + break; + case 479: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 7; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createWall = (short) 27; + this.width = (ushort) 12; + this.height = (ushort) 12; + break; + case 480: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createTile = (short) 124; + this.width = (ushort) 12; + this.height = (ushort) 12; + break; + case 481: + this.useStyle = (byte) 5; + this.autoReuse = true; + this.useAnimation = (byte) 20; + this.useTime = (byte) 20; + this.width = (ushort) 50; + this.height = (ushort) 18; + this.shoot = (byte) 1; + this.useAmmo = (byte) 1; + this.useSound = (byte) 5; + this.damage = (short) 37; + this.shootSpeed = 10f; + this.noMelee = true; + this.value = 120000; + this.ranged = true; + this.rare = (sbyte) 4; + this.knockBack = 2.5f; + break; + case 482: + this.useStyle = (byte) 1; + this.useAnimation = (byte) 27; + this.useTime = (byte) 27; + this.knockBack = 6f; + this.width = (ushort) 40; + this.height = (ushort) 40; + this.damage = (short) 44; + this.scale = 1.2f; + this.useSound = (byte) 1; + this.rare = (sbyte) 4; + this.value = 138000; + this.melee = true; + break; + case 483: + this.useTurn = true; + this.autoReuse = true; + this.useStyle = (byte) 1; + this.useAnimation = (byte) 23; + this.useTime = (byte) 23; + this.knockBack = 3.85f; + this.width = (ushort) 40; + this.height = (ushort) 40; + this.damage = (short) 34; + this.scale = 1.1f; + this.useSound = (byte) 1; + this.rare = (sbyte) 4; + this.value = 69000; + this.melee = true; + break; + case 484: + this.useStyle = (byte) 1; + this.useAnimation = (byte) 26; + this.useTime = (byte) 26; + this.knockBack = 6f; + this.width = (ushort) 40; + this.height = (ushort) 40; + this.damage = (short) 39; + this.scale = 1.15f; + this.useSound = (byte) 1; + this.rare = (sbyte) 4; + this.value = 103500; + this.melee = true; + break; + case 485: + this.rare = (sbyte) 4; + this.width = (ushort) 24; + this.height = (ushort) 28; + this.accessory = true; + this.value = 150000; + break; + case 486: + this.width = (ushort) 10; + this.height = (ushort) 26; + this.accessory = true; + this.value = 10000; + this.rare = (sbyte) 1; + break; + case 487: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createTile = (short) 125; + this.width = (ushort) 22; + this.height = (ushort) 22; + this.value = 100000; + this.rare = (sbyte) 3; + break; + case 488: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createTile = (short) 126; + this.width = (ushort) 22; + this.height = (ushort) 26; + this.value = 10000; + break; + case 489: + this.width = (ushort) 24; + this.height = (ushort) 24; + this.accessory = true; + this.value = 100000; + this.rare = (sbyte) 4; + break; + case 490: + this.width = (ushort) 24; + this.height = (ushort) 24; + this.accessory = true; + this.value = 100000; + this.rare = (sbyte) 4; + break; + case 491: + this.width = (ushort) 24; + this.height = (ushort) 24; + this.accessory = true; + this.value = 100000; + break; + case 492: + this.width = (ushort) 24; + this.height = (ushort) 8; + this.accessory = true; + this.value = 400000; + this.rare = (sbyte) 5; + break; + case 493: + this.width = (ushort) 24; + this.height = (ushort) 8; + this.accessory = true; + this.value = 400000; + this.rare = (sbyte) 5; + break; + case 494: + this.rare = (sbyte) 5; + this.useStyle = (byte) 5; + this.useAnimation = (byte) 12; + this.useTime = (byte) 12; + this.width = (ushort) 12; + this.height = (ushort) 28; + this.shoot = (byte) 76; + this.holdStyle = (byte) 3; + this.autoReuse = true; + this.damage = (short) 30; + this.shootSpeed = 4.5f; + this.noMelee = true; + this.value = 200000; + this.mana = (byte) 4; + this.magic = true; + break; + case 495: + this.rare = (sbyte) 5; + this.mana = (byte) 10; + this.channel = true; + this.damage = (short) 53; + this.useStyle = (byte) 1; + this.shootSpeed = 6f; + this.shoot = (byte) 79; + this.width = (ushort) 26; + this.height = (ushort) 28; + this.useSound = (byte) 28; + this.useAnimation = (byte) 15; + this.useTime = (byte) 15; + this.noMelee = true; + this.knockBack = 5f; + this.tileBoost = (sbyte) 64; + this.value = 200000; + this.magic = true; + break; + case 496: + this.rare = (sbyte) 4; + this.mana = (byte) 7; + this.damage = (short) 26; + this.useStyle = (byte) 1; + this.shootSpeed = 12f; + this.shoot = (byte) 80; + this.width = (ushort) 26; + this.height = (ushort) 28; + this.useSound = (byte) 28; + this.useAnimation = (byte) 17; + this.useTime = (byte) 17; + this.rare = (sbyte) 4; + this.autoReuse = true; + this.noMelee = true; + this.knockBack = 0.0f; + this.value = 1000000; + this.magic = true; + this.knockBack = 2f; + break; + case 497: + this.width = (ushort) 24; + this.height = (ushort) 28; + this.accessory = true; + this.value = 150000; + this.rare = (sbyte) 5; + break; + case 498: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createTile = (short) 128; + this.width = (ushort) 12; + this.height = (ushort) 12; + break; + case 499: + this.useSound = (byte) 3; + this.healLife = (short) 150; + this.useStyle = (byte) 2; + this.useTurn = true; + this.useAnimation = (byte) 17; + this.useTime = (byte) 17; + this.maxStack = (short) 30; + this.consumable = true; + this.width = (ushort) 14; + this.height = (ushort) 24; + this.rare = (sbyte) 3; + this.potion = true; + this.value = 5000; + break; + case 500: + this.useSound = (byte) 3; + this.healMana = (short) 200; + this.useStyle = (byte) 2; + this.useTurn = true; + this.useAnimation = (byte) 17; + this.useTime = (byte) 17; + this.maxStack = (short) 99; + this.consumable = true; + this.width = (ushort) 14; + this.height = (ushort) 24; + this.rare = (sbyte) 3; + this.value = 500; + break; + case 501: + this.width = (ushort) 16; + this.height = (ushort) 14; + this.maxStack = (short) 99; + this.value = 500; + this.rare = (sbyte) 1; + break; + case 502: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createTile = (short) 129; + this.width = (ushort) 24; + this.height = (ushort) 24; + this.value = 8000; + this.rare = (sbyte) 1; + break; + case 503: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.headSlot = (short) 40; + this.value = 20000; + this.vanity = true; + this.rare = (sbyte) 2; + break; + case 504: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.bodySlot = (short) 23; + this.value = 10000; + this.vanity = true; + this.rare = (sbyte) 2; + break; + case 505: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.legSlot = (short) 22; + this.value = 10000; + this.vanity = true; + this.rare = (sbyte) 2; + break; + case 506: + this.useStyle = (byte) 5; + this.autoReuse = true; + this.useAnimation = (byte) 30; + this.useTime = (byte) 6; + this.width = (ushort) 50; + this.height = (ushort) 18; + this.shoot = (byte) 85; + this.useAmmo = (byte) 23; + this.useSound = (byte) 34; + this.damage = (short) 27; + this.knockBack = 0.3f; + this.shootSpeed = 7f; + this.noMelee = true; + this.value = 500000; + this.rare = (sbyte) 5; + this.ranged = true; + break; + case 507: + this.rare = (sbyte) 3; + this.useStyle = (byte) 1; + this.useAnimation = (byte) 12; + this.useTime = (byte) 12; + this.width = (ushort) 12; + this.height = (ushort) 28; + this.autoReuse = true; + this.noMelee = true; + this.value = 10000; + break; + case 508: + this.rare = (sbyte) 3; + this.useStyle = (byte) 5; + this.useAnimation = (byte) 12; + this.useTime = (byte) 12; + this.width = (ushort) 12; + this.height = (ushort) 28; + this.autoReuse = true; + this.noMelee = true; + this.value = 10000; + break; + case 509: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.width = (ushort) 24; + this.height = (ushort) 28; + this.rare = (sbyte) 1; + this.value = 20000; + this.mech = true; + break; + case 510: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.width = (ushort) 24; + this.height = (ushort) 28; + this.rare = (sbyte) 1; + this.value = 20000; + this.mech = true; + break; + case 511: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createTile = (short) 130; + this.width = (ushort) 12; + this.height = (ushort) 12; + this.value = 1000; + this.mech = true; + break; + case 512: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createTile = (short) 131; + this.width = (ushort) 12; + this.height = (ushort) 12; + this.value = 1000; + this.mech = true; + break; + case 513: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createTile = (short) 132; + this.width = (ushort) 24; + this.height = (ushort) 24; + this.value = 3000; + this.mech = true; + break; + case 514: + this.autoReuse = true; + this.useStyle = (byte) 5; + this.useAnimation = (byte) 12; + this.useTime = (byte) 12; + this.width = (ushort) 36; + this.height = (ushort) 22; + this.shoot = (byte) 88; + this.mana = (byte) 8; + this.useSound = (byte) 12; + this.knockBack = 2.5f; + this.damage = (short) 29; + this.shootSpeed = 17f; + this.noMelee = true; + this.rare = (sbyte) 4; + this.magic = true; + this.value = 500000; + break; + case 515: + this.shootSpeed = 5f; + this.shoot = (byte) 89; + this.damage = (short) 9; + this.width = (ushort) 8; + this.height = (ushort) 8; + this.maxStack = (short) 250; + this.consumable = true; + this.ammo = (byte) 14; + this.knockBack = 1f; + this.value = 30; + this.ranged = true; + this.rare = (sbyte) 3; + break; + case 516: + this.shootSpeed = 3.5f; + this.shoot = (byte) 91; + this.damage = (short) 6; + this.width = (ushort) 10; + this.height = (ushort) 28; + this.maxStack = (short) 250; + this.consumable = true; + this.ammo = (byte) 1; + this.knockBack = 2f; + this.value = 80; + this.ranged = true; + this.rare = (sbyte) 3; + break; + case 517: + this.useStyle = (byte) 1; + this.shootSpeed = 10f; + this.shoot = (byte) 93; + this.damage = (short) 28; + this.width = (ushort) 18; + this.height = (ushort) 20; + this.mana = (byte) 7; + this.useSound = (byte) 1; + this.useAnimation = (byte) 15; + this.useTime = (byte) 15; + this.noUseGraphic = true; + this.noMelee = true; + this.value = 1000000; + this.knockBack = 2f; + this.magic = true; + this.rare = (sbyte) 4; + break; + case 518: + this.autoReuse = true; + this.rare = (sbyte) 4; + this.mana = (byte) 5; + this.useSound = (byte) 9; + this.useStyle = (byte) 5; + this.damage = (short) 26; + this.useAnimation = (byte) 7; + this.useTime = (byte) 7; + this.width = (ushort) 24; + this.height = (ushort) 28; + this.shoot = (byte) 94; + this.scale = 0.9f; + this.shootSpeed = 16f; + this.knockBack = 5f; + this.magic = true; + this.value = 500000; + break; + case 519: + this.autoReuse = true; + this.rare = (sbyte) 4; + this.mana = (byte) 14; + this.useSound = (byte) 20; + this.useStyle = (byte) 5; + this.damage = (short) 35; + this.useAnimation = (byte) 20; + this.useTime = (byte) 20; + this.width = (ushort) 24; + this.height = (ushort) 28; + this.shoot = (byte) 95; + this.scale = 0.9f; + this.shootSpeed = 10f; + this.knockBack = 6.5f; + this.magic = true; + this.value = 500000; + break; + case 520: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.maxStack = (short) 250; + this.value = 1000; + this.rare = (sbyte) 3; + break; + case 521: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.maxStack = (short) 250; + this.value = 1000; + this.rare = (sbyte) 3; + break; + case 522: + this.width = (ushort) 12; + this.height = (ushort) 14; + this.maxStack = (short) 99; + this.value = 4000; + this.rare = (sbyte) 3; + break; + case 523: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.holdStyle = (byte) 1; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 4; + this.placeStyle = (byte) 8; + this.width = (ushort) 10; + this.height = (ushort) 12; + this.value = 300; + this.rare = (sbyte) 1; + break; + case 524: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 133; + this.width = (ushort) 44; + this.height = (ushort) 30; + this.value = 50000; + this.rare = (sbyte) 3; + break; + case 525: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 134; + this.width = (ushort) 28; + this.height = (ushort) 14; + this.value = 25000; + this.rare = (sbyte) 3; + break; + case 526: + this.width = (ushort) 14; + this.height = (ushort) 14; + this.maxStack = (short) 99; + this.value = 15000; + this.rare = (sbyte) 1; + break; + case 527: + this.width = (ushort) 14; + this.height = (ushort) 14; + this.maxStack = (short) 99; + this.value = 4500; + this.rare = (sbyte) 2; + break; + case 528: + this.width = (ushort) 14; + this.height = (ushort) 14; + this.maxStack = (short) 99; + this.value = 4500; + this.rare = (sbyte) 2; + break; + case 529: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createTile = (short) 135; + this.width = (ushort) 12; + this.height = (ushort) 12; + this.placeStyle = (byte) 0; + this.mech = true; + this.value = 5000; + this.mech = true; + break; + case 530: + this.width = (ushort) 12; + this.height = (ushort) 18; + this.maxStack = (short) 250; + this.value = 500; + this.mech = true; + break; + case 531: + this.width = (ushort) 12; + this.height = (ushort) 18; + this.maxStack = (short) 99; + this.value = 50000; + this.rare = (sbyte) 1; + break; + case 532: + this.width = (ushort) 20; + this.height = (ushort) 24; + this.value = 100000; + this.accessory = true; + this.rare = (sbyte) 4; + break; + case 533: + this.useStyle = (byte) 5; + this.autoReuse = true; + this.useAnimation = (byte) 7; + this.useTime = (byte) 7; + this.width = (ushort) 50; + this.height = (ushort) 18; + this.shoot = (byte) 10; + this.useAmmo = (byte) 14; + this.useSound = (byte) 11; + this.damage = (short) 23; + this.shootSpeed = 10f; + this.noMelee = true; + this.value = 300000; + this.rare = (sbyte) 5; + this.knockBack = 1f; + this.ranged = true; + break; + case 534: + this.knockBack = 6.5f; + this.useStyle = (byte) 5; + this.useAnimation = (byte) 45; + this.useTime = (byte) 45; + this.width = (ushort) 50; + this.height = (ushort) 14; + this.shoot = (byte) 10; + this.useAmmo = (byte) 14; + this.useSound = (byte) 36; + this.damage = (short) 18; + this.shootSpeed = 6f; + this.noMelee = true; + this.value = 700000; + this.rare = (sbyte) 4; + this.ranged = true; + break; + case 535: + this.width = (ushort) 12; + this.height = (ushort) 18; + this.value = 100000; + this.accessory = true; + this.rare = (sbyte) 4; + break; + case 536: + this.width = (ushort) 12; + this.height = (ushort) 18; + this.value = 100000; + this.rare = (sbyte) 4; + this.accessory = true; + break; + case 537: + this.useStyle = (byte) 5; + this.useAnimation = (byte) 28; + this.useTime = (byte) 28; + this.shootSpeed = 4.3f; + this.knockBack = 4f; + this.width = (ushort) 40; + this.height = (ushort) 40; + this.damage = (short) 29; + this.scale = 1.1f; + this.useSound = (byte) 1; + this.shoot = (byte) 97; + this.rare = (sbyte) 4; + this.value = 45000; + this.noMelee = true; + this.noUseGraphic = true; + this.melee = true; + break; + case 538: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createTile = (short) 136; + this.width = (ushort) 12; + this.height = (ushort) 12; + this.value = 2000; + this.mech = true; + break; + case 539: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createTile = (short) 137; + this.width = (ushort) 12; + this.height = (ushort) 12; + this.value = 10000; + this.mech = true; + break; + case 540: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createTile = (short) 138; + this.width = (ushort) 12; + this.height = (ushort) 12; + this.mech = true; + break; + case 541: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createTile = (short) 135; + this.width = (ushort) 12; + this.height = (ushort) 12; + this.placeStyle = (byte) 1; + this.mech = true; + this.value = 5000; + break; + case 542: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createTile = (short) 135; + this.width = (ushort) 12; + this.height = (ushort) 12; + this.placeStyle = (byte) 2; + this.mech = true; + this.value = 5000; + break; + case 543: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createTile = (short) 135; + this.width = (ushort) 12; + this.height = (ushort) 12; + this.placeStyle = (byte) 3; + this.mech = true; + this.value = 5000; + break; + case 544: + this.useStyle = (byte) 4; + this.width = (ushort) 22; + this.height = (ushort) 14; + this.consumable = true; + this.useAnimation = (byte) 45; + this.useTime = (byte) 45; + this.maxStack = (short) 20; + this.rare = (sbyte) 3; + break; + case 545: + this.shootSpeed = 4f; + this.shoot = (byte) 103; + this.damage = (short) 14; + this.width = (ushort) 10; + this.height = (ushort) 28; + this.maxStack = (short) 250; + this.consumable = true; + this.ammo = (byte) 1; + this.knockBack = 3f; + this.value = 80; + this.ranged = true; + this.rare = (sbyte) 3; + break; + case 546: + this.shootSpeed = 5f; + this.shoot = (byte) 104; + this.damage = (short) 12; + this.width = (ushort) 8; + this.height = (ushort) 8; + this.maxStack = (short) 250; + this.consumable = true; + this.ammo = (byte) 14; + this.knockBack = 4f; + this.value = 30; + this.rare = (sbyte) 1; + this.ranged = true; + this.rare = (sbyte) 3; + break; + case 547: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.maxStack = (short) 250; + this.value = 100000; + this.rare = (sbyte) 5; + break; + case 548: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.maxStack = (short) 250; + this.value = 100000; + this.rare = (sbyte) 5; + break; + case 549: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.maxStack = (short) 250; + this.value = 100000; + this.rare = (sbyte) 5; + break; + case 550: + this.useStyle = (byte) 5; + this.useAnimation = (byte) 22; + this.useTime = (byte) 22; + this.shootSpeed = 5.6f; + this.knockBack = 6.4f; + this.width = (ushort) 40; + this.height = (ushort) 40; + this.damage = (short) 42; + this.scale = 1.1f; + this.useSound = (byte) 1; + this.shoot = (byte) 105; + this.rare = (sbyte) 5; + this.value = 1500000; + this.noMelee = true; + this.noUseGraphic = true; + this.melee = true; + break; + case 551: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.defense = (short) 15; + this.bodySlot = (short) 24; + this.rare = (sbyte) 5; + this.value = 200000; + break; + case 552: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.defense = (short) 11; + this.legSlot = (short) 23; + this.rare = (sbyte) 5; + this.value = 150000; + break; + case 553: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.defense = (short) 9; + this.headSlot = (short) 41; + this.rare = (sbyte) 5; + this.value = 250000; + break; + case 554: + this.width = (ushort) 20; + this.height = (ushort) 24; + this.value = 1500; + this.accessory = true; + this.rare = (sbyte) 4; + break; + case 555: + this.width = (ushort) 20; + this.height = (ushort) 24; + this.value = 50000; + this.accessory = true; + this.rare = (sbyte) 4; + break; + case 556: + this.useStyle = (byte) 4; + this.width = (ushort) 22; + this.height = (ushort) 14; + this.consumable = true; + this.useAnimation = (byte) 45; + this.useTime = (byte) 45; + this.maxStack = (short) 20; + this.rare = (sbyte) 3; + break; + case 557: + this.useStyle = (byte) 4; + this.width = (ushort) 22; + this.height = (ushort) 14; + this.consumable = true; + this.useAnimation = (byte) 45; + this.useTime = (byte) 45; + this.maxStack = (short) 20; + this.rare = (sbyte) 3; + break; + case 558: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.defense = (short) 5; + this.headSlot = (short) 42; + this.rare = (sbyte) 5; + this.value = 250000; + break; + case 559: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.defense = (short) 24; + this.headSlot = (short) 43; + this.rare = (sbyte) 5; + this.value = 250000; + break; + case 560: + this.useStyle = (byte) 4; + this.width = (ushort) 22; + this.height = (ushort) 14; + this.consumable = true; + this.useAnimation = (byte) 45; + this.useTime = (byte) 45; + this.maxStack = (short) 20; + this.rare = (sbyte) 1; + break; + case 561: + this.melee = true; + this.autoReuse = true; + this.noMelee = true; + this.useStyle = (byte) 1; + this.shootSpeed = 13f; + this.shoot = (byte) 106; + this.damage = (short) 35; + this.knockBack = 8f; + this.width = (ushort) 24; + this.height = (ushort) 24; + this.useSound = (byte) 1; + this.useAnimation = (byte) 15; + this.useTime = (byte) 15; + this.noUseGraphic = true; + this.rare = (sbyte) 5; + this.maxStack = (short) 5; + this.value = 500000; + break; + case 562: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.consumable = true; + this.createTile = (short) 139; + this.placeStyle = (byte) 0; + this.width = (ushort) 24; + this.height = (ushort) 24; + this.rare = (sbyte) 4; + this.value = 100000; + this.accessory = true; + break; + case 563: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.consumable = true; + this.createTile = (short) 139; + this.placeStyle = (byte) 1; + this.width = (ushort) 24; + this.height = (ushort) 24; + this.rare = (sbyte) 4; + this.value = 100000; + this.accessory = true; + break; + case 564: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.consumable = true; + this.createTile = (short) 139; + this.placeStyle = (byte) 2; + this.width = (ushort) 24; + this.height = (ushort) 24; + this.rare = (sbyte) 4; + this.value = 100000; + this.accessory = true; + break; + case 565: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.consumable = true; + this.createTile = (short) 139; + this.placeStyle = (byte) 3; + this.width = (ushort) 24; + this.height = (ushort) 24; + this.rare = (sbyte) 4; + this.value = 100000; + this.accessory = true; + break; + case 566: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.consumable = true; + this.createTile = (short) 139; + this.placeStyle = (byte) 4; + this.width = (ushort) 24; + this.height = (ushort) 24; + this.rare = (sbyte) 4; + this.value = 100000; + this.accessory = true; + break; + case 567: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.consumable = true; + this.createTile = (short) 139; + this.placeStyle = (byte) 5; + this.width = (ushort) 24; + this.height = (ushort) 24; + this.rare = (sbyte) 4; + this.value = 100000; + this.accessory = true; + break; + case 568: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.consumable = true; + this.createTile = (short) 139; + this.placeStyle = (byte) 6; + this.width = (ushort) 24; + this.height = (ushort) 24; + this.rare = (sbyte) 4; + this.value = 100000; + this.accessory = true; + break; + case 569: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.consumable = true; + this.createTile = (short) 139; + this.placeStyle = (byte) 7; + this.width = (ushort) 24; + this.height = (ushort) 24; + this.rare = (sbyte) 4; + this.value = 100000; + this.accessory = true; + break; + case 570: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.consumable = true; + this.createTile = (short) 139; + this.placeStyle = (byte) 8; + this.width = (ushort) 24; + this.height = (ushort) 24; + this.rare = (sbyte) 4; + this.value = 100000; + this.accessory = true; + break; + case 571: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.consumable = true; + this.createTile = (short) 139; + this.placeStyle = (byte) 9; + this.width = (ushort) 24; + this.height = (ushort) 24; + this.rare = (sbyte) 4; + this.value = 100000; + this.accessory = true; + break; + case 572: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.consumable = true; + this.createTile = (short) 139; + this.placeStyle = (byte) 10; + this.width = (ushort) 24; + this.height = (ushort) 24; + this.rare = (sbyte) 4; + this.value = 100000; + this.accessory = true; + break; + case 573: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.consumable = true; + this.createTile = (short) 139; + this.placeStyle = (byte) 11; + this.width = (ushort) 24; + this.height = (ushort) 24; + this.rare = (sbyte) 4; + this.value = 100000; + this.accessory = true; + break; + case 574: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.consumable = true; + this.createTile = (short) 139; + this.placeStyle = (byte) 12; + this.width = (ushort) 24; + this.height = (ushort) 24; + this.rare = (sbyte) 3; + this.value = 100000; + this.accessory = true; + break; + case 575: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.maxStack = (short) 250; + this.value = 1000; + this.rare = (sbyte) 3; + break; + case 576: + this.width = (ushort) 24; + this.height = (ushort) 24; + this.rare = (sbyte) 3; + this.value = 100000; + this.accessory = true; + break; + case 577: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createTile = (short) 140; + this.width = (ushort) 12; + this.height = (ushort) 12; + break; + case 578: + this.useStyle = (byte) 5; + this.autoReuse = true; + this.useAnimation = (byte) 19; + this.useTime = (byte) 19; + this.width = (ushort) 50; + this.height = (ushort) 18; + this.shoot = (byte) 1; + this.useAmmo = (byte) 1; + this.useSound = (byte) 5; + this.damage = (short) 39; + this.shootSpeed = 11f; + this.noMelee = true; + this.value = 200000; + this.ranged = true; + this.rare = (sbyte) 4; + this.knockBack = 2.5f; + break; + case 579: + this.useStyle = (byte) 5; + this.useAnimation = (byte) 25; + this.useTime = (byte) 7; + this.shootSpeed = 36f; + this.knockBack = 4.75f; + this.width = (ushort) 20; + this.height = (ushort) 12; + this.damage = (short) 35; + this.pick = (byte) 200; + this.axe = (byte) 22; + this.hammer = (byte) 85; + this.useSound = (byte) 23; + this.shoot = (byte) 107; + this.rare = (sbyte) 4; + this.value = 220000; + this.noMelee = true; + this.noUseGraphic = true; + this.melee = true; + this.channel = true; + break; + case 580: + this.mech = true; + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createTile = (short) 141; + this.width = (ushort) 12; + this.height = (ushort) 12; + break; + case 581: + this.mech = true; + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createTile = (short) 142; + this.width = (ushort) 12; + this.height = (ushort) 12; + break; + case 582: + this.mech = true; + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createTile = (short) 143; + this.width = (ushort) 12; + this.height = (ushort) 12; + break; + case 583: + this.mech = true; + this.noWet = true; + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 144; + this.placeStyle = (byte) 0; + this.width = (ushort) 10; + this.height = (ushort) 12; + this.value = 50; + break; + case 584: + this.mech = true; + this.noWet = true; + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 144; + this.placeStyle = (byte) 1; + this.width = (ushort) 10; + this.height = (ushort) 12; + this.value = 50; + break; + case 585: + this.mech = true; + this.noWet = true; + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 99; + this.consumable = true; + this.createTile = (short) 144; + this.placeStyle = (byte) 2; + this.width = (ushort) 10; + this.height = (ushort) 12; + this.value = 50; + break; + case 586: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createTile = (short) 145; + this.width = (ushort) 12; + this.height = (ushort) 12; + break; + case 587: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createWall = (short) 29; + this.width = (ushort) 12; + this.height = (ushort) 12; + break; + case 588: + this.width = (ushort) 18; + this.height = (ushort) 12; + this.headSlot = (short) 44; + this.value = 150000; + this.vanity = true; + break; + case 589: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.bodySlot = (short) 25; + this.value = 150000; + this.vanity = true; + break; + case 590: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.legSlot = (short) 24; + this.value = 150000; + this.vanity = true; + break; + case 591: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createTile = (short) 146; + this.width = (ushort) 12; + this.height = (ushort) 12; + break; + case 592: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createWall = (short) 30; + this.width = (ushort) 12; + this.height = (ushort) 12; + break; + case 593: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createTile = (short) 147; + this.width = (ushort) 12; + this.height = (ushort) 12; + break; + case 594: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createTile = (short) 148; + this.width = (ushort) 12; + this.height = (ushort) 12; + break; + case 595: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createWall = (short) 31; + this.width = (ushort) 12; + this.height = (ushort) 12; + break; + case 596: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createTile = (short) 149; + this.placeStyle = (byte) 0; + this.width = (ushort) 12; + this.height = (ushort) 12; + this.value = 500; + break; + case 597: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createTile = (short) 149; + this.placeStyle = (byte) 1; + this.width = (ushort) 12; + this.height = (ushort) 12; + this.value = 500; + break; + case 598: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.maxStack = (short) 250; + this.consumable = true; + this.createTile = (short) 149; + this.placeStyle = (byte) 2; + this.width = (ushort) 12; + this.height = (ushort) 12; + this.value = 500; + break; + case 599: + this.width = (ushort) 12; + this.height = (ushort) 12; + this.rare = (sbyte) 1; + break; + case 600: + this.width = (ushort) 12; + this.height = (ushort) 12; + this.rare = (sbyte) 1; + break; + case 601: + this.width = (ushort) 12; + this.height = (ushort) 12; + this.rare = (sbyte) 1; + break; + case 602: + this.useStyle = (byte) 4; + this.consumable = true; + this.useAnimation = (byte) 45; + this.useTime = (byte) 45; + this.width = (ushort) 28; + this.height = (ushort) 28; + this.rare = (sbyte) 2; + break; + case 603: + this.damage = (short) 0; + this.useStyle = (byte) 1; + this.shoot = (byte) 111; + this.width = (ushort) 16; + this.height = (ushort) 30; + this.useSound = (byte) 2; + this.useAnimation = (byte) 20; + this.useTime = (byte) 20; + this.rare = (sbyte) 3; + this.noMelee = true; + this.value = 0; + this.buffType = (byte) 40; + break; + case 604: + this.width = (ushort) 26; + this.height = (ushort) 18; + this.defense = (short) 26; + this.headSlot = (short) 45; + this.rare = (sbyte) 5; + this.value = 500000; + break; + case 605: + this.width = (ushort) 26; + this.height = (ushort) 22; + this.defense = (short) 14; + this.headSlot = (short) 46; + this.rare = (sbyte) 5; + this.value = 500000; + break; + case 606: + this.width = (ushort) 22; + this.height = (ushort) 20; + this.defense = (short) 10; + this.headSlot = (short) 47; + this.rare = (sbyte) 5; + this.value = 500000; + break; + case 607: + this.width = (ushort) 26; + this.height = (ushort) 18; + this.defense = (short) 20; + this.bodySlot = (short) 26; + this.rare = (sbyte) 5; + this.value = 1000000; + break; + case 608: + this.width = (ushort) 30; + this.height = (ushort) 18; + this.defense = (short) 18; + this.bodySlot = (short) 27; + this.rare = (sbyte) 5; + this.value = 1000000; + break; + case 609: + this.width = (ushort) 30; + this.height = (ushort) 28; + this.defense = (short) 15; + this.bodySlot = (short) 28; + this.rare = (sbyte) 5; + this.value = 1000000; + break; + case 610: + this.width = (ushort) 22; + this.height = (ushort) 18; + this.defense = (short) 14; + this.legSlot = (short) 25; + this.rare = (sbyte) 5; + this.value = 750000; + break; + case 611: + this.width = (ushort) 22; + this.height = (ushort) 18; + this.defense = (short) 13; + this.legSlot = (short) 26; + this.rare = (sbyte) 5; + this.value = 750000; + break; + case 612: + this.width = (ushort) 22; + this.height = (ushort) 18; + this.defense = (short) 15; + this.legSlot = (short) 27; + this.rare = (sbyte) 5; + this.value = 750000; + break; + case 613: + this.autoReuse = true; + this.useStyle = (byte) 1; + this.useAnimation = (byte) 25; + this.useTime = (byte) 25; + this.knockBack = 4.6f; + this.width = (ushort) 40; + this.height = (ushort) 40; + this.damage = (short) 55; + this.scale = 1.15f; + this.useSound = (byte) 1; + this.rare = (sbyte) 5; + this.value = 300000; + this.melee = true; + break; + case 614: + this.useStyle = (byte) 5; + this.useAnimation = (byte) 20; + this.useTime = (byte) 20; + this.shootSpeed = 5.75f; + this.knockBack = 6.7f; + this.width = (ushort) 40; + this.height = (ushort) 40; + this.damage = (short) 50; + this.scale = 1.1f; + this.useSound = (byte) 1; + this.shoot = (byte) 112; + this.rare = (sbyte) 5; + this.value = 2000000; + this.noMelee = true; + this.noUseGraphic = true; + this.melee = true; + break; + case 615: + this.useStyle = (byte) 5; + this.useAnimation = (byte) 20; + this.useTime = (byte) 20; + this.width = (ushort) 14; + this.height = (ushort) 32; + this.shoot = (byte) 1; + this.useAmmo = (byte) 1; + this.useSound = (byte) 5; + this.damage = (short) 35; + this.shootSpeed = 10f; + this.knockBack = 2.3f; + this.alpha = (byte) 30; + this.rare = (sbyte) 5; + this.noMelee = true; + this.scale = 1.1f; + this.value = 60000; + this.ranged = true; + break; + case 616: + this.shootSpeed = 4.2f; + this.shoot = (byte) 113; + this.damage = (short) 16; + this.width = (ushort) 10; + this.height = (ushort) 28; + this.maxStack = (short) 250; + this.consumable = true; + this.ammo = (byte) 1; + this.knockBack = 3.1f; + this.value = 90; + this.ranged = true; + this.rare = (sbyte) 4; + break; + case 617: + this.useStyle = (byte) 5; + this.autoReuse = true; + this.useAnimation = (byte) 18; + this.useTime = (byte) 18; + this.width = (ushort) 50; + this.height = (ushort) 18; + this.shoot = (byte) 1; + this.useAmmo = (byte) 1; + this.useSound = (byte) 5; + this.damage = (short) 42; + this.shootSpeed = 12f; + this.noMelee = true; + this.value = 250000; + this.ranged = true; + this.rare = (sbyte) 5; + this.knockBack = 2.65f; + break; + case 618: + this.shootSpeed = 6.6f; + this.shoot = (byte) 114; + this.damage = (short) 12; + this.width = (ushort) 10; + this.height = (ushort) 28; + this.maxStack = (short) 250; + this.consumable = true; + this.ammo = (byte) 1; + this.knockBack = 8.2f; + this.value = 150; + this.rare = (sbyte) 3; + this.ranged = true; + break; + case 619: + this.useStyle = (byte) 4; + this.width = (ushort) 26; + this.height = (ushort) 26; + this.consumable = true; + this.useAnimation = (byte) 45; + this.useTime = (byte) 45; + this.maxStack = (short) 20; + break; + case 620: + this.width = (ushort) 18; + this.height = (ushort) 18; + this.maxStack = (short) 250; + this.value = 100000; + this.rare = (sbyte) 5; + break; + case 621: + this.damage = (short) 0; + this.useStyle = (byte) 1; + this.shoot = (byte) 115; + this.width = (ushort) 16; + this.height = (ushort) 30; + this.useSound = (byte) 2; + this.useAnimation = (byte) 20; + this.useTime = (byte) 20; + this.rare = (sbyte) 3; + this.noMelee = true; + this.value = 0; + this.buffType = (byte) 40; + break; + case 622: + this.damage = (short) 0; + this.useStyle = (byte) 1; + this.shoot = (byte) 116; + this.width = (ushort) 16; + this.height = (ushort) 30; + this.useSound = (byte) 2; + this.useAnimation = (byte) 20; + this.useTime = (byte) 20; + this.rare = (sbyte) 3; + this.noMelee = true; + this.value = 0; + this.buffType = (byte) 40; + break; + case 623: + this.damage = (short) 0; + this.useStyle = (byte) 1; + this.shoot = (byte) 117; + this.width = (ushort) 16; + this.height = (ushort) 30; + this.useSound = (byte) 2; + this.useAnimation = (byte) 20; + this.useTime = (byte) 20; + this.rare = (sbyte) 3; + this.noMelee = true; + this.value = 0; + this.buffType = (byte) 40; + break; + case 624: + this.damage = (short) 0; + this.useStyle = (byte) 1; + this.shoot = (byte) 118; + this.width = (ushort) 16; + this.height = (ushort) 30; + this.useSound = (byte) 2; + this.useAnimation = (byte) 20; + this.useTime = (byte) 20; + this.rare = (sbyte) 3; + this.noMelee = true; + this.value = 0; + this.buffType = (byte) 40; + break; + case 625: + this.damage = (short) 0; + this.useStyle = (byte) 1; + this.shoot = (byte) 119; + this.width = (ushort) 16; + this.height = (ushort) 30; + this.useSound = (byte) 2; + this.useAnimation = (byte) 20; + this.useTime = (byte) 20; + this.rare = (sbyte) 3; + this.noMelee = true; + this.value = 0; + this.buffType = (byte) 40; + break; + case 626: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.consumable = true; + this.createTile = (short) 139; + this.placeStyle = (byte) 13; + this.width = (ushort) 24; + this.height = (ushort) 24; + this.rare = (sbyte) 4; + this.value = 100000; + this.accessory = true; + break; + case 627: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.consumable = true; + this.createTile = (short) 139; + this.placeStyle = (byte) 14; + this.width = (ushort) 24; + this.height = (ushort) 24; + this.rare = (sbyte) 4; + this.value = 100000; + this.accessory = true; + break; + case 628: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.consumable = true; + this.createTile = (short) 139; + this.placeStyle = (byte) 15; + this.width = (ushort) 24; + this.height = (ushort) 24; + this.rare = (sbyte) 4; + this.value = 100000; + this.accessory = true; + break; + case 629: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.consumable = true; + this.createTile = (short) 139; + this.placeStyle = (byte) 16; + this.width = (ushort) 24; + this.height = (ushort) 24; + this.rare = (sbyte) 4; + this.value = 100000; + this.accessory = true; + break; + case 630: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.consumable = true; + this.createTile = (short) 139; + this.placeStyle = (byte) 17; + this.width = (ushort) 24; + this.height = (ushort) 24; + this.rare = (sbyte) 4; + this.value = 100000; + this.accessory = true; + break; + case 631: + this.useStyle = (byte) 1; + this.useTurn = true; + this.useAnimation = (byte) 15; + this.useTime = (byte) 10; + this.autoReuse = true; + this.consumable = true; + this.createTile = (short) 139; + this.placeStyle = (byte) 18; + this.width = (ushort) 24; + this.height = (ushort) 24; + this.rare = (sbyte) 4; + this.value = 100000; + this.accessory = true; + break; + default: + this.active = (byte) 0; + this.stack = (short) 0; + break; + } + if (noMatCheck) + return; + this.checkMat(); + } + + public Color GetAlpha(Color newColor) + { + if ((int) this.type == 75) + return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) newColor.A - (int) this.alpha); + if ((int) this.type >= 119 && (int) this.type <= 122 || (int) this.type >= 198 && (int) this.type <= 203 || ((int) this.type == 217 || (int) this.type == 218 || ((int) this.type == 219 || (int) this.type == 220))) + return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue); + if ((int) this.type == 520 || (int) this.type == 521 || ((int) this.type == 522 || (int) this.type == 547) || ((int) this.type == 548 || (int) this.type == 549 || (int) this.type == 575)) + return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 50); + if ((int) this.type == 58 || (int) this.type == 184 || (int) this.type == 501) + return new Color(200, 200, 200, 200); + int num = 256 - (int) this.alpha; + return new Color((int) newColor.R * num >> 8, (int) newColor.G * num >> 8, (int) newColor.B * num >> 8, (int) newColor.A - (int) this.alpha); + } + + public Color GetAlphaInventory(Color newColor) + { + int num = 256 - (int) this.alpha; + return new Color((int) newColor.R * num >> 8, (int) newColor.G * num >> 8, (int) newColor.B * num >> 8, (int) newColor.A - (int) this.alpha); + } + + public Color GetColor(Color newColor) + { + return new Color((int) this.color.R - ((int) byte.MaxValue - (int) newColor.R), (int) this.color.G - ((int) byte.MaxValue - (int) newColor.G), (int) this.color.B - ((int) byte.MaxValue - (int) newColor.B), (int) this.color.A - ((int) byte.MaxValue - (int) newColor.A)); + } + + public static bool MechSpawn(int x, int y, int type) + { + int num1 = 0; + int num2 = 0; + int num3 = 0; + for (int index = 0; index < 196; ++index) + { + if ((int) Main.item[index].active != 0 && (int) Main.item[index].type == type) + { + ++num1; + Vector2 vector2 = new Vector2((float) x, (float) y); + float num4 = Main.item[index].position.X - vector2.X; + float num5 = Main.item[index].position.Y - vector2.Y; + float num6 = (float) ((double) num4 * (double) num4 + (double) num5 * (double) num5); + if ((double) num6 < 640000.0) + { + ++num3; + if ((double) num6 < 90000.0) + ++num2; + } + } + } + return num2 < 3 && num3 < 6 && num1 < 10; + } + + public unsafe void UpdateItem(int i) + { + float num1 = 0.1f; + float num2 = 7f; + if (this.wet) + { + num2 = 5f; + num1 = 0.08f; + } + Vector2 vector2_1 = this.velocity; + vector2_1.X *= 0.5f; + vector2_1.Y *= 0.5f; + if ((int) this.ownTime > 0 && (int) --this.ownTime == 0) + this.ownIgnore = (byte) 8; + if ((int) this.keepTime > 0) + --this.keepTime; + else if (this.isLocal() || Main.netMode != 1 && ((int) this.owner == 8 || (int) Main.player[(int) this.owner].active == 0)) + this.FindOwner(i); + if (!this.beingGrabbed) + { + this.velocity.X *= 0.95f; + if ((double) this.velocity.X < 0.100000001490116 && (double) this.velocity.X > -0.100000001490116) + this.velocity.X = 0.0f; + if ((int) this.type == 520 || (int) this.type == 521 || ((int) this.type == 547 || (int) this.type == 548) || ((int) this.type == 549 || (int) this.type == 575)) + { + this.velocity.Y *= 0.95f; + if ((double) this.velocity.Y < 0.100000001490116 && (double) this.velocity.Y > -0.100000001490116) + this.velocity.Y = 0.0f; + } + else + { + this.velocity.Y += num1; + if ((double) this.velocity.Y > (double) num2) + this.velocity.Y = num2; + } + bool flag = Collision.LavaCollision(ref this.position, (int) this.width, (int) this.height); + // ISSUE: explicit reference operation + // ISSUE: variable of a reference type + Item& local = @this; + // ISSUE: explicit reference operation + int num3 = (^local).lavaWet | flag ? 1 : 0; + // ISSUE: explicit reference operation + (^local).lavaWet = num3 != 0; + if (Collision.WetCollision(ref this.position, (int) this.width, (int) this.height)) + { + if (!this.wet) + { + if ((int) this.wetCount == 0) + { + this.wetCount = (byte) 20; + if (!flag) + { + for (int index = 0; index < 8; ++index) + { + Dust* dustPtr = Main.dust.NewDust((int) this.position.X - 6, (int) this.position.Y + ((int) this.height >> 1) - 8, (int) this.width + 12, 24, 33, 0.0, 0.0, 0, new Color(), 1.0); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.Y -= 4f; + dustPtr->velocity.X *= 2.5f; + dustPtr->scale = 1.3f; + dustPtr->alpha = (short) 100; + dustPtr->noGravity = true; + } + else + break; + } + Main.PlaySound(19, (int) this.position.X, (int) this.position.Y, 1); + } + else + { + for (int index = 0; index < 4; ++index) + { + Dust* dustPtr = Main.dust.NewDust((int) this.position.X - 6, (int) this.position.Y + ((int) this.height >> 1) - 8, (int) this.width + 12, 24, 35, 0.0, 0.0, 0, new Color(), 1.0); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.Y -= 1.5f; + dustPtr->velocity.X *= 2.5f; + dustPtr->scale = 1.3f; + dustPtr->alpha = (short) 100; + dustPtr->noGravity = true; + } + else + break; + } + Main.PlaySound(19, (int) this.position.X, (int) this.position.Y, 1); + } + } + this.wet = true; + } + } + else if (this.wet) + this.wet = false; + if ((int) this.wetCount > 0) + --this.wetCount; + if (this.wet) + { + Vector2 vector2_2 = this.velocity; + Collision.TileCollision(ref this.position, ref this.velocity, (int) this.width, (int) this.height, false, false); + if ((double) this.velocity.X != (double) vector2_2.X) + vector2_1.X = this.velocity.X; + if ((double) this.velocity.Y != (double) vector2_2.Y) + vector2_1.Y = this.velocity.Y; + } + else + { + this.lavaWet = false; + Collision.TileCollision(ref this.position, ref this.velocity, (int) this.width, (int) this.height, false, false); + } + if (this.lavaWet) + { + if ((int) this.type == 267) + { + if (Main.netMode != 1) + { + this.active = (byte) 0; + this.type = (short) 0; + this.stack = (short) 0; + for (int npcId = 0; npcId < 196; ++npcId) + { + if ((int) Main.npc[npcId].type == 22 && (int) Main.npc[npcId].active != 0) + { + NetMessage.SendNpcHurt(npcId, 8192, 10.0, (int) -Main.npc[npcId].direction, false); + Main.npc[npcId].StrikeNPC(8192, 10f, (int) -Main.npc[npcId].direction, false, false); + NPC.SpawnWOF(ref this.position, false); + break; + } + } + NetMessage.CreateMessage2(21, (int) UI.main.myPlayer, i); + NetMessage.SendMessage(); + } + } + else if (this.isLocal() && (int) this.type != 312 && ((int) this.type != 318 && (int) this.type != 173) && ((int) this.type != 174 && (int) this.type != 175 && (int) this.rare == 0)) + { + this.active = (byte) 0; + this.type = (short) 0; + this.stack = (short) 0; + NetMessage.CreateMessage2(21, (int) UI.main.myPlayer, i); + NetMessage.SendMessage(); + } + } + if ((int) this.type == 520) + { + float num4 = (float) Main.rand.Next(90, 111) * 0.01f * UI.essScale; + Lighting.addLight((int) this.position.X + ((int) this.width >> 1) >> 4, (int) this.position.Y + ((int) this.height >> 1) >> 4, new Vector3(0.5f * num4, 0.1f * num4, 0.25f * num4)); + } + else if ((int) this.type == 521) + { + float num4 = (float) Main.rand.Next(90, 111) * 0.01f * UI.essScale; + Lighting.addLight((int) this.position.X + ((int) this.width >> 1) >> 4, (int) this.position.Y + ((int) this.height >> 1) >> 4, new Vector3(0.25f * num4, 0.1f * num4, 0.5f * num4)); + } + else if ((int) this.type == 547) + { + float num4 = (float) Main.rand.Next(90, 111) * 0.01f * UI.essScale; + Lighting.addLight((int) this.position.X + ((int) this.width >> 1) >> 4, (int) this.position.Y + ((int) this.height >> 1) >> 4, new Vector3(0.5f * num4, 0.3f * num4, 0.05f * num4)); + } + else if ((int) this.type == 548) + { + float num4 = (float) Main.rand.Next(90, 111) * 0.01f * UI.essScale; + Lighting.addLight((int) this.position.X + ((int) this.width >> 1) >> 4, (int) this.position.Y + ((int) this.height >> 1) >> 4, new Vector3(0.1f * num4, 0.1f * num4, 0.6f * num4)); + } + else if ((int) this.type == 575) + { + float num4 = (float) Main.rand.Next(90, 111) * 0.01f * UI.essScale; + Lighting.addLight((int) this.position.X + ((int) this.width >> 1) >> 4, (int) this.position.Y + ((int) this.height >> 1) >> 4, new Vector3(0.1f * num4, 0.3f * num4, 0.5f * num4)); + } + else if ((int) this.type == 549) + { + float num4 = (float) Main.rand.Next(90, 111) * 0.01f * UI.essScale; + Lighting.addLight((int) this.position.X + ((int) this.width >> 1) >> 4, (int) this.position.Y + ((int) this.height >> 1) >> 4, new Vector3(0.1f * num4, 0.5f * num4, 0.2f * num4)); + } + else if ((int) this.type == 58) + { + float num4 = (float) Main.rand.Next(90, 111) * 0.01f * (UI.essScale * 0.5f); + Lighting.addLight((int) this.position.X + ((int) this.width >> 1) >> 4, (int) this.position.Y + ((int) this.height >> 1) >> 4, new Vector3(0.5f * num4, 0.1f * num4, 0.1f * num4)); + } + else if ((int) this.type == 184) + { + float num4 = (float) Main.rand.Next(90, 111) * 0.01f * (UI.essScale * 0.5f); + Lighting.addLight((int) this.position.X + ((int) this.width >> 1) >> 4, (int) this.position.Y + ((int) this.height >> 1) >> 4, new Vector3(0.1f * num4, 0.1f * num4, 0.5f * num4)); + } + else if ((int) this.type == 522) + { + float num4 = (float) Main.rand.Next(90, 111) * 0.01f * (UI.essScale * 0.2f); + Lighting.addLight((int) this.position.X + ((int) this.width >> 1) >> 4, (int) this.position.Y + ((int) this.height >> 1) >> 4, new Vector3(0.5f * num4, 1f * num4, 0.1f * num4)); + } + else if ((int) this.type == 75 && Main.gameTime.dayTime) + { + int num4 = 0; + while (num4 < 8 && IntPtr.Zero != (IntPtr) Main.dust.NewDust((int) this.position.X, (int) this.position.Y, (int) this.width, (int) this.height, 15, (double) this.velocity.X, (double) this.velocity.Y, 150, new Color(), 1.20000004768372)) + ++num4; + for (int index = 0; index < 3; ++index) + Gore.NewGore(this.position, this.velocity, Main.rand.Next(16, 18), 1.0); + this.active = (byte) 0; + this.type = (short) 0; + this.stack = (short) 0; + if (Main.netMode == 2) + { + NetMessage.CreateMessage2(21, (int) UI.main.myPlayer, i); + NetMessage.SendMessage(); + } + } + } + else + this.beingGrabbed = false; + if ((int) this.type == 501) + { + if (Main.rand.Next(6) == 0) + { + Dust* dustPtr = Main.dust.NewDust((int) this.position.X, (int) this.position.Y, (int) this.width, (int) this.height, 55, 0.0, 0.0, 200, this.color, 1.0); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.X *= 0.3f; + dustPtr->velocity.Y *= 0.3f; + dustPtr->scale *= 0.5f; + } + } + } + else if ((int) this.type == 8 || (int) this.type == 105) + { + if (!this.wet) + Lighting.addLight((int) this.position.X + ((int) this.width >> 1) >> 4, (int) this.position.Y + ((int) this.height >> 1) >> 4, new Vector3(1f, 0.95f, 0.8f)); + } + else if ((int) this.type == 523) + Lighting.addLight((int) this.position.X + ((int) this.width >> 1) >> 4, (int) this.position.Y + ((int) this.height >> 1) >> 4, new Vector3(0.85f, 1f, 0.7f)); + else if ((int) this.type >= 427 && (int) this.type <= 432) + { + if (!this.wet) + { + Vector3 rgb; + switch (this.type) + { + case (short) 427: + rgb = new Vector3(0.1f, 0.2f, 1.1f); + break; + case (short) 428: + rgb = new Vector3(1f, 0.1f, 0.1f); + break; + case (short) 429: + rgb = new Vector3(0.0f, 1f, 0.1f); + break; + case (short) 430: + rgb = new Vector3(0.9f, 0.0f, 0.9f); + break; + case (short) 431: + rgb = new Vector3(1.3f, 1.3f, 1.3f); + break; + default: + rgb = new Vector3(0.9f, 0.9f, 0.0f); + break; + } + Lighting.addLight((int) this.position.X + ((int) this.width >> 1) >> 4, (int) this.position.Y + ((int) this.height >> 1) >> 4, rgb); + } + } + else if ((int) this.type == 41) + { + if (!this.wet) + Lighting.addLight((int) this.position.X + (int) this.width >> 4, (int) this.position.Y + ((int) this.height >> 1) >> 4, new Vector3(1f, 0.75f, 0.55f)); + } + else if ((int) this.type == 616) + Lighting.addLight((int) this.position.X + (int) this.width >> 4, (int) this.position.Y + ((int) this.height >> 1) >> 4, this.wet ? new Vector3(0.25f, 0.5f, 0.5f) : new Vector3(0.5f, 1f, 1f)); + else if ((int) this.type == 282) + Lighting.addLight((int) this.position.X + (int) this.width >> 4, (int) this.position.Y + ((int) this.height >> 1) >> 4, new Vector3(0.7f, 1f, 0.8f)); + else if ((int) this.type == 286) + Lighting.addLight((int) this.position.X + (int) this.width >> 4, (int) this.position.Y + ((int) this.height >> 1) >> 4, new Vector3(0.7f, 0.8f, 1f)); + else if ((int) this.type == 331) + Lighting.addLight((int) this.position.X + (int) this.width >> 4, (int) this.position.Y + ((int) this.height >> 1) >> 4, new Vector3(0.55f, 0.75f, 0.6f)); + else if ((int) this.type == 183) + Lighting.addLight((int) this.position.X + (int) this.width >> 4, (int) this.position.Y + ((int) this.height >> 1) >> 4, new Vector3(0.15f, 0.45f, 0.9f)); + else if ((int) this.type == 75) + { + Lighting.addLight((int) this.position.X + (int) this.width >> 4, (int) this.position.Y + ((int) this.height >> 1) >> 4, new Vector3(0.8f, 0.7f, 0.1f)); + if (Main.rand.Next(32) == 0) + Main.dust.NewDust((int) this.position.X, (int) this.position.Y, (int) this.width, (int) this.height, 58, (double) this.velocity.X * 0.5, (double) this.velocity.Y * 0.5, 150, new Color(), 1.20000004768372); + else if (Main.rand.Next(64) == 0) + Gore.NewGore(this.position, new Vector2(this.velocity.X * 0.2f, this.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1.0); + } + ++this.spawnTime; + if (Main.netMode == 2 && !this.isLocal() && (int) ++this.release >= 300) + { + this.release = (ushort) 0; + this.FindOwner(i); + } + if (this.wet) + { + this.position.X += vector2_1.X; + this.position.Y += vector2_1.Y; + } + else + { + this.position.X += this.velocity.X; + this.position.Y += this.velocity.Y; + } + if ((int) this.noGrabDelay <= 0) + return; + --this.noGrabDelay; + } + + public static unsafe int NewItem(int X, int Y, int Width, int Height, int Type, int Stack = 1, bool noBroadcast = false, int pfix = 0) + { + int index1 = 200; + if (Main.netMode != 1) + { + uint num1 = Item.lastItemIndex; + uint num2 = Main.item[(IntPtr) num1].spawnTime; + uint num3 = num1; + for (int index2 = 199; index2 >= 0; --index2) + { + if ((int) Main.item[(IntPtr) num1].active == 0) + { + index1 = (int) num1; + break; + } + else + { + if ((int) ++num1 == 200) + num1 = 0U; + uint num4 = Main.item[(IntPtr) num1].spawnTime; + if (num4 > num2) + { + num2 = num4; + num3 = num1; + } + } + } + if (index1 == 200) + index1 = (int) num3; + uint num5; + if ((int) (num5 = num1 + 1U) == 200) + num5 = 0U; + Item.lastItemIndex = num5; + } + fixed (Item* objPtr = &Main.item[index1]) + { + objPtr->SetDefaults(Type, Stack, false); + objPtr->Prefix(pfix); + objPtr->position.X = (float) (X + (Width - (int) objPtr->width >> 1)); + objPtr->position.Y = (float) (Y + (Height - (int) objPtr->height >> 1)); + objPtr->wet = Collision.WetCollision(ref objPtr->position, (int) objPtr->width, (int) objPtr->height); + objPtr->velocity.X = (float) Main.rand.Next(-30, 31) * 0.1f; + if (Type == 520 || Type == 521) + objPtr->velocity.Y = (float) Main.rand.Next(-30, 31) * 0.1f; + else + objPtr->velocity.Y = (float) Main.rand.Next(-40, -15) * 0.1f; + objPtr->spawnTime = 0U; + if (!noBroadcast && Main.netMode != 1) + { + NetMessage.CreateMessage2(21, (int) UI.main.myPlayer, index1); + NetMessage.SendMessage(); + objPtr->FindOwner(index1); + } + } + return index1; + } + + public unsafe void FindOwner(int whoAmI) + { + if ((int) this.keepTime > 0) + return; + int num1 = 8; + int num2 = 1920; + int num3 = (int) this.position.X - ((int) this.width >> 1); + int num4 = (int) this.position.Y - (int) this.height; + fixed (Item* pNewItem = &this) + { + for (int index = 0; index < 8; ++index) + { + if ((int) this.ownIgnore != index && (int) Main.player[index].active != 0 && Main.player[index].ItemSpace(pNewItem)) + { + int num5 = Math.Abs(Main.player[index].aabb.X + 10 - num3) + Math.Abs(Main.player[index].aabb.Y + 21 - num4); + if (num5 < num2) + { + num2 = num5; + num1 = index; + } + } + } + } + int index1 = (int) this.owner; + if (num1 == index1) + return; + bool flag = this.isLocal(); + this.owner = (byte) num1; + if ((!flag || Main.netMode < 1) && (index1 != 8 || Main.netMode != 2) && (int) Main.player[index1].active != 0 || (int) this.active == 0) + return; + NetMessage.CreateMessage1(22, whoAmI); + NetMessage.SendMessage(); + } + + public bool IsNotTheSameAs(ref Item compareItem) + { + if ((int) this.netID == (int) compareItem.netID && (int) this.stack == (int) compareItem.stack) + return (int) this.prefix != (int) compareItem.prefix; + else + return true; + } + + public bool CanBePlacedInAmmoSlot() + { + if ((int) this.ammo <= 0) + return (int) this.type == 530; + else + return true; + } + + public bool CanBeAutoPlacedInEmptyAmmoSlot() + { + if ((int) this.type != 169 && (int) this.type != 75 && ((int) this.type != 23 && (int) this.type != 370)) + return (int) this.type != 408; + else + return false; + } + + public bool CanBePlacedInCoinSlot() + { + if ((int) this.type >= 71) + return (int) this.type <= 74; + else + return false; + } + + public enum ID + { + NONE, + IRON_PICKAXE, + DIRT_BLOCK, + STONE_BLOCK, + IRON_BROADSWORD, + MUSHROOM, + IRON_SHORTSWORD, + IRON_HAMMER, + TORCH, + WOOD, + IRON_AXE, + IRON_ORE, + COPPER_ORE, + GOLD_ORE, + SILVER_ORE, + COPPER_WATCH, + SILVER_WATCH, + GOLD_WATCH, + DEPTH_METER, + GOLD_BAR, + COPPER_BAR, + SILVER_BAR, + IRON_BAR, + GEL, + WOODEN_SWORD, + WOODEN_DOOR, + STONE_WALL, + ACORN, + LESSER_HEALING_POTION, + LIFE_CRYSTAL, + DIRT_WALL, + BOTTLE, + WOODEN_TABLE, + FURNACE, + WOODEN_CHAIR, + IRON_ANVIL, + WORK_BENCH, + GOGGLES, + LENS, + WOODEN_BOW, + WOODEN_ARROW, + FLAMING_ARROW, + SHURIKEN, + SUSPICIOUS_LOOKING_EYE, + DEMON_BOW, + WAR_AXE_OF_THE_NIGHT, + LIGHTS_BANE, + UNHOLY_ARROW, + CHEST, + BAND_OF_REGENERATION, + MAGIC_MIRROR, + JESTERS_ARROW, + ANGEL_STATUE, + CLOUD_IN_A_BOTTLE, + HERMES_BOOTS, + ENCHANTED_BOOMERANG, + DEMONITE_ORE, + DEMONITE_BAR, + HEART, + CORRUPT_SEEDS, + VILE_MUSHROOM, + EBONSTONE_BLOCK, + GRASS_SEEDS, + SUNFLOWER, + VILETHORN, + STARFURY, + PURIFICATION_POWDER, + VILE_POWDER, + ROTTEN_CHUNK, + WORM_TOOTH, + WORM_FOOD, + COPPER_COIN, + SILVER_COIN, + GOLD_COIN, + PLATINUM_COIN, + FALLEN_STAR, + COPPER_GREAVES, + IRON_GREAVES, + SILVER_GREAVES, + GOLD_GREAVES, + COPPER_CHAINMAIL, + IRON_CHAINMAIL, + SILVER_CHAINMAIL, + GOLD_CHAINMAIL, + GRAPPLING_HOOK, + IRON_CHAIN, + SHADOW_SCALE, + PIGGY_BANK, + MINING_HELMET, + COPPER_HELMET, + IRON_HELMET, + SILVER_HELMET, + GOLD_HELMET, + WOOD_WALL, + WOOD_PLATFORM, + FLINTLOCK_PISTOL, + MUSKET, + MUSKET_BALL, + MINISHARK, + IRON_BOW, + SHADOW_GREAVES, + SHADOW_SCALEMAIL, + SHADOW_HELMET, + NIGHTMARE_PICKAXE, + THE_BREAKER, + CANDLE, + COPPER_CHANDELIER, + SILVER_CHANDELIER, + GOLD_CHANDELIER, + MANA_CRYSTAL, + LESSER_MANA_POTION, + BAND_OF_STARPOWER, + FLOWER_OF_FIRE, + MAGIC_MISSILE, + DIRT_ROD, + ORB_OF_LIGHT, + METEORITE, + METEORITE_BAR, + HOOK, + FLAMARANG, + MOLTEN_FURY, + FIERY_GREATSWORD, + MOLTEN_PICKAXE, + METEOR_HELMET, + METEOR_SUIT, + METEOR_LEGGINGS, + BOTTLED_WATER, + SPACE_GUN, + ROCKET_BOOTS, + GRAY_BRICK, + GRAY_BRICK_WALL, + RED_BRICK, + RED_BRICK_WALL, + CLAY_BLOCK, + BLUE_BRICK, + BLUE_BRICK_WALL, + CHAIN_LANTERN, + GREEN_BRICK, + GREEN_BRICK_WALL, + PINK_BRICK, + PINK_BRICK_WALL, + GOLD_BRICK, + GOLD_BRICK_WALL, + SILVER_BRICK, + SILVER_BRICK_WALL, + COPPER_BRICK, + COPPER_BRICK_WALL, + SPIKE, + WATER_CANDLE, + BOOK, + COBWEB, + NECRO_HELMET, + NECRO_BREASTPLATE, + NECRO_GREAVES, + BONE, + MURAMASA, + COBALT_SHIELD, + AQUA_SCEPTER, + LUCKY_HORSESHOE, + SHINY_RED_BALLOON, + HARPOON, + SPIKY_BALL, + BALL_O_HURT, + BLUE_MOON, + HANDGUN, + WATER_BOLT, + BOMB, + DYNAMITE, + GRENADE, + SAND_BLOCK, + GLASS, + SIGN, + ASH_BLOCK, + OBSIDIAN, + HELLSTONE, + HELLSTONE_BAR, + MUD_BLOCK, + SAPPHIRE, + RUBY, + EMERALD, + TOPAZ, + AMETHYST, + DIAMOND, + GLOWING_MUSHROOM, + STAR, + IVY_WHIP, + BREATHING_REED, + FLIPPER, + HEALING_POTION, + MANA_POTION, + BLADE_OF_GRASS, + THORN_CHAKRAM, + OBSIDIAN_BRICK, + OBSIDIAN_SKULL, + MUSHROOM_GRASS_SEEDS, + JUNGLE_GRASS_SEEDS, + WOODEN_HAMMER, + STAR_CANNON, + BLUE_PHASEBLADE, + RED_PHASEBLADE, + GREEN_PHASEBLADE, + PURPLE_PHASEBLADE, + WHITE_PHASEBLADE, + YELLOW_PHASEBLADE, + METEOR_HAMAXE, + EMPTY_BUCKET, + WATER_BUCKET, + LAVA_BUCKET, + JUNGLE_ROSE, + STINGER, + VINE, + FERAL_CLAWS, + ANKLET_OF_THE_WIND, + STAFF_OF_REGROWTH, + HELLSTONE_BRICK, + WHOOPIE_CUSHION, + SHACKLE, + MOLTEN_HAMAXE, + FLAMELASH, + PHOENIX_BLASTER, + SUNFURY, + HELLFORGE, + CLAY_POT, + NATURES_GIFT, + BED, + SILK, + LESSER_RESTORATION_POTION, + RESTORATION_POTION, + JUNGLE_HAT, + JUNGLE_SHIRT, + JUNGLE_PANTS, + MOLTEN_HELMET, + MOLTEN_BREASTPLATE, + MOLTEN_GREAVES, + METEOR_SHOT, + STICKY_BOMB, + BLACK_LENS, + SUNGLASSES, + WIZARD_HAT, + TOP_HAT, + TUXEDO_SHIRT, + TUXEDO_PANTS, + SUMMER_HAT, + BUNNY_HOOD, + PLUMBERS_HAT, + PLUMBERS_SHIRT, + PLUMBERS_PANTS, + HEROS_HAT, + HEROS_SHIRT, + HEROS_PANTS, + FISH_BOWL, + ARCHAEOLOGISTS_HAT, + ARCHAEOLOGISTS_JACKET, + ARCHAEOLOGISTS_PANTS, + BLACK_DYE, + PURPLE_DYE, + NINJA_HOOD, + NINJA_SHIRT, + NINJA_PANTS, + LEATHER, + RED_HAT, + GOLDFISH, + ROBE, + ROBOT_HAT, + GOLD_CROWN, + HELLFIRE_ARROW, + SANDGUN, + GUIDE_VOODOO_DOLL, + DIVING_HELMET, + FAMILIAR_SHIRT, + FAMILIAR_PANTS, + FAMILIAR_WIG, + DEMON_SCYTHE, + NIGHTS_EDGE, + DARK_LANCE, + CORAL, + CACTUS, + TRIDENT, + SILVER_BULLET, + THROWING_KNIFE, + SPEAR, + BLOWPIPE, + GLOWSTICK, + SEED, + WOODEN_BOOMERANG, + AGLET, + STICKY_GLOWSTICK, + POISONED_KNIFE, + OBSIDIAN_SKIN_POTION, + REGENERATION_POTION, + SWIFTNESS_POTION, + GILLS_POTION, + IRONSKIN_POTION, + MANA_REGENERATION_POTION, + MAGIC_POWER_POTION, + FEATHERFALL_POTION, + SPELUNKER_POTION, + INVISIBILITY_POTION, + SHINE_POTION, + NIGHT_OWL_POTION, + BATTLE_POTION, + THORNS_POTION, + WATER_WALKING_POTION, + ARCHERY_POTION, + HUNTER_POTION, + GRAVITATION_POTION, + GOLD_CHEST, + DAYBLOOM_SEEDS, + MOONGLOW_SEEDS, + BLINKROOT_SEEDS, + DEATHWEED_SEEDS, + WATERLEAF_SEEDS, + FIREBLOSSOM_SEEDS, + DAYBLOOM, + MOONGLOW, + BLINKROOT, + DEATHWEED, + WATERLEAF, + FIREBLOSSOM, + SHARK_FIN, + FEATHER, + TOMBSTONE, + MIME_MASK, + ANTLION_MANDIBLE, + ILLEGAL_GUN_PARTS, + THE_DOCTORS_SHIRT, + THE_DOCTORS_PANTS, + GOLDEN_KEY, + SHADOW_CHEST, + SHADOW_KEY, + OBSIDIAN_BRICK_WALL, + JUNGLE_SPORES, + LOOM, + PIANO, + DRESSER, + BENCH, + BATHTUB, + RED_BANNER, + GREEN_BANNER, + BLUE_BANNER, + YELLOW_BANNER, + LAMP_POST, + TIKI_TORCH, + BARREL, + CHINESE_LANTERN, + COOKING_POT, + SAFE, + SKULL_LANTERN, + TRASH_CAN, + CANDELABRA, + PINK_VASE, + MUG, + KEG, + ALE, + BOOKCASE, + THRONE, + BOWL, + BOWL_OF_SOUP, + TOILET, + GRANDFATHER_CLOCK, + STATUE, + GOBLIN_BATTLE_STANDARD, + TATTERED_CLOTH, + SAWMILL, + COBALT_ORE, + MYTHRIL_ORE, + ADAMANTITE_ORE, + PWNHAMMER, + EXCALIBUR, + HALLOWED_SEEDS, + EBONSAND_BLOCK, + COBALT_HAT, + COBALT_HELMET, + COBALT_MASK, + COBALT_BREASTPLATE, + COBALT_LEGGINGS, + MYTHRIL_HOOD, + MYTHRIL_HELMET, + MYTHRIL_HAT, + MYTHRIL_CHAINMAIL, + MYTHRIL_GREAVES, + COBALT_BAR, + MYTHRIL_BAR, + COBALT_CHAINSAW, + MYTHRIL_CHAINSAW, + COBALT_DRILL, + MYTHRIL_DRILL, + ADAMANTITE_CHAINSAW, + ADAMANTITE_DRILL, + DAO_OF_POW, + MYTHRIL_HALBERD, + ADAMANTITE_BAR, + GLASS_WALL, + COMPASS, + DIVING_GEAR, + GPS, + OBSIDIAN_HORSESHOE, + OBSIDIAN_SHIELD, + TINKERERS_WORKSHOP, + CLOUD_IN_A_BALLOON, + ADAMANTITE_HEADGEAR, + ADAMANTITE_HELMET, + ADAMANTITE_MASK, + ADAMANTITE_BREASTPLATE, + ADAMANTITE_LEGGINGS, + SPECTRE_BOOTS, + ADAMANTITE_GLAIVE, + TOOLBELT, + PEARLSAND_BLOCK, + PEARLSTONE_BLOCK, + MINING_SHIRT, + MINING_PANTS, + PEARLSTONE_BRICK, + IRIDESCENT_BRICK, + MUDSTONE_BRICK, + COBALT_BRICK, + MYTHRIL_BRICK, + PEARLSTONE_BRICK_WALL, + IRIDESCENT_BRICK_WALL, + MUDSTONE_BRICK_WALL, + COBALT_BRICK_WALL, + MYTHRIL_BRICK_WALL, + HOLY_WATER, + UNHOLY_WATER, + SILT_BLOCK, + FAIRY_BELL, + BREAKER_BLADE, + BLUE_TORCH, + RED_TORCH, + GREEN_TORCH, + PURPLE_TORCH, + WHITE_TORCH, + YELLOW_TORCH, + DEMON_TORCH, + CLOCKWORK_ASSAULT_RIFLE, + COBALT_REPEATER, + MYTHRIL_REPEATER, + DUAL_HOOK, + STAR_STATUE, + SWORD_STATUE, + SLIME_STATUE, + GOBLIN_STATUE, + SHIELD_STATUE, + BAT_STATUE, + FISH_STATUE, + BUNNY_STATUE, + SKELETON_STATUE, + REAPER_STATUE, + WOMAN_STATUE, + IMP_STATUE, + GARGOYLE_STATUE, + GLOOM_STATUE, + HORNET_STATUE, + BOMB_STATUE, + CRAB_STATUE, + HAMMER_STATUE, + POTION_STATUE, + SPEAR_STATUE, + CROSS_STATUE, + JELLYFISH_STATUE, + BOW_STATUE, + BOOMERANG_STATUE, + BOOT_STATUE, + CHEST_STATUE, + BIRD_STATUE, + AXE_STATUE, + CORRUPT_STATUE, + TREE_STATUE, + ANVIL_STATUE, + PICKAXE_STATUE, + MUSHROOM_STATUE, + EYEBALL_STATUE, + PILLAR_STATUE, + HEART_STATUE, + POT_STATUE, + SUNFLOWER_STATUE, + KING_STATUE, + QUEEN_STATUE, + PIRANHA_STATUE, + PLANKED_WALL, + WOODEN_BEAM, + ADAMANTITE_REPEATER, + ADAMANTITE_SWORD, + COBALT_SWORD, + MYTHRIL_SWORD, + MOON_CHARM, + RULER, + CRYSTAL_BALL, + DISCO_BALL, + SORCERER_EMBLEM, + WARRIOR_EMBLEM, + RANGER_EMBLEM, + DEMON_WINGS, + ANGEL_WINGS, + MAGICAL_HARP, + RAINBOW_ROD, + ICE_ROD, + NEPTUNES_SHELL, + MANNEQUIN, + GREATER_HEALING_POTION, + GREATER_MANA_POTION, + PIXIE_DUST, + CRYSTAL_SHARD, + CLOWN_HAT, + CLOWN_SHIRT, + CLOWN_PANTS, + FLAMETHROWER, + BELL, + HARP, + WRENCH, + WIRE_CUTTER, + ACTIVE_STONE_BLOCK, + INACTIVE_STONE_BLOCK, + LEVER, + LASER_RIFLE, + CRYSTAL_BULLET, + HOLY_ARROW, + MAGIC_DAGGER, + CRYSTAL_STORM, + CURSED_FLAMES, + SOUL_OF_LIGHT, + SOUL_OF_NIGHT, + CURSED_FLAME, + CURSED_TORCH, + ADAMANTITE_FORGE, + MYTHRIL_ANVIL, + UNICORN_HORN, + DARK_SHARD, + LIGHT_SHARD, + RED_PRESSURE_PLATE, + WIRE, + SPELL_TOME, + STAR_CLOAK, + MEGASHARK, + SHOTGUN, + PHILOSOPHERS_STONE, + TITAN_GLOVE, + COBALT_NAGINATA, + SWITCH, + DART_TRAP, + BOULDER, + GREEN_PRESSURE_PLATE, + GRAY_PRESSURE_PLATE, + BROWN_PRESSURE_PLATE, + MECHANICAL_EYE, + CURSED_ARROW, + CURSED_BULLET, + SOUL_OF_FRIGHT, + SOUL_OF_MIGHT, + SOUL_OF_SIGHT, + GUNGNIR, + HALLOWED_PLATE_MAIL, + HALLOWED_GREAVES, + HALLOWED_HELMET, + CROSS_NECKLACE, + MANA_FLOWER, + MECHANICAL_WORM, + MECHANICAL_SKULL, + HALLOWED_HEADGEAR, + HALLOWED_MASK, + SLIME_CROWN, + LIGHT_DISC, + MUSIC_BOX_OVERWORLD_DAY, + MUSIC_BOX_EERIE, + MUSIC_BOX_NIGHT, + MUSIC_BOX_TITLE, + MUSIC_BOX_UNDERGROUND, + MUSIC_BOX_BOSS1, + MUSIC_BOX_JUNGLE, + MUSIC_BOX_CORRUPTION, + MUSIC_BOX_UNDERGROUND_CORRUPTION, + MUSIC_BOX_THE_HALLOW, + MUSIC_BOX_BOSS2, + MUSIC_BOX_UNDERGROUND_HALLOW, + MUSIC_BOX_BOSS3, + SOUL_OF_FLIGHT, + MUSIC_BOX, + DEMONITE_BRICK, + HALLOWED_REPEATER, + HAMDRAX, + EXPLOSIVES, + INLET_PUMP, + OUTLET_PUMP, + ONE_SECOND_TIMER, + THREE_SECOND_TIMER, + FIVE_SECOND_TIMER, + CANDY_CANE_BLOCK, + CANDY_CANE_WALL, + SANTA_HAT, + SANTA_SHIRT, + SANTA_PANTS, + GREEN_CANDY_CANE_BLOCK, + GREEN_CANDY_CANE_WALL, + SNOW_BLOCK, + SNOW_BRICK, + SNOW_BRICK_WALL, + BLUE_LIGHT, + RED_LIGHT, + GREEN_LIGHT, + BLUE_PRESENT, + GREEN_PRESENT, + YELLOW_PRESENT, + SNOW_GLOBE, + PET_SPAWN_1, + DRAGON_MASK, + TITAN_HELMET, + SPECTRAL_HEADGEAR, + DRAGON_BREASTPLATE, + TITAN_MAIL, + SPECTRAL_ARMOR, + DRAGON_GREAVES, + TITAN_LEGGINGS, + SPECTRAL_SUBLIGAR, + TIZONA, + TONBOGIRI, + SHARANGA, + SPECTRAL_ARROW, + VULCAN_REPEATER, + VULCAN_BOLT, + SUSPICIOUS_LOOKING_SKULL, + SOUL_OF_BLIGHT, + PET_SPAWN_2, + PET_SPAWN_3, + PET_SPAWN_4, + PET_SPAWN_5, + PET_SPAWN_6, + MUSIC_BOX_DESERT, + MUSIC_BOX_SPACE, + MUSIC_BOX_TUTORIAL, + MUSIC_BOX_BOSS4, + MUSIC_BOX_OCEAN, + MUSIC_BOX_SNOW, + NUM_TYPES, + } + } +} diff --git a/Terraria/ItemText.cs b/Terraria/ItemText.cs new file mode 100644 index 0000000..b620429 --- /dev/null +++ b/Terraria/ItemText.cs @@ -0,0 +1,102 @@ +// Type: Terraria.ItemText +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework; + +namespace Terraria +{ + public struct ItemText + { + public const int ACTIVE_TIME = 56; + public byte active; + public short lifeTime; + public short netID; + public Vector2 position; + public float velocityY; + public float alpha; + public float alphaDir; + public float scale; + public Color color; + public int stack; + public string text; + public Vector2 textSize; + + public void Init() + { + this.active = (byte) 0; + } + + public void Update(int whoAmI, ItemTextPool pool) + { + this.alpha += this.alphaDir; + if ((double) this.alpha <= 0.699999988079071) + { + this.alpha = 0.7f; + this.alphaDir = -this.alphaDir; + } + else if ((double) this.alpha >= 1.0) + { + this.alpha = 1f; + this.alphaDir = -this.alphaDir; + } + bool flag = false; + Vector2 vector2_1 = this.textSize * this.scale; + vector2_1.Y *= 0.8f; + Rectangle rectangle1 = new Rectangle(); + Rectangle rectangle2 = new Rectangle(); + rectangle1.X = (int) ((double) this.position.X - (double) vector2_1.X * 0.5); + rectangle1.Y = (int) ((double) this.position.Y - (double) vector2_1.Y * 0.5); + rectangle1.Width = (int) vector2_1.X; + rectangle1.Height = (int) vector2_1.Y; + for (int index = 0; index < 4; ++index) + { + if ((int) pool.itemText[index].active != 0 && index != whoAmI) + { + Vector2 vector2_2 = pool.itemText[index].textSize; + vector2_2 *= pool.itemText[index].scale; + vector2_2.Y *= 0.8f; + rectangle2.X = (int) ((double) pool.itemText[index].position.X - (double) vector2_2.X * 0.5); + rectangle2.Y = (int) ((double) pool.itemText[index].position.Y - (double) vector2_2.Y * 0.5); + rectangle2.Width = (int) vector2_2.X; + rectangle2.Height = (int) vector2_2.Y; + if (rectangle1.Intersects(rectangle2) && ((double) this.position.Y < (double) pool.itemText[index].position.Y || (double) this.position.Y == (double) pool.itemText[index].position.Y && whoAmI < index)) + { + flag = true; + int num = pool.numActive; + if (num > 3) + num = 3; + pool.itemText[index].lifeTime = this.lifeTime = (short) (56 + num * 14); + } + } + } + if (!flag) + { + this.velocityY *= 0.86f; + if ((double) this.scale == 1.0) + this.velocityY *= 0.4f; + } + else if ((double) this.velocityY > -6.0) + this.velocityY -= 0.2f; + else + this.velocityY *= 0.86f; + this.position.Y += this.velocityY; + if ((int) --this.lifeTime <= 0) + { + this.scale -= 0.03f; + if ((double) this.scale < 0.100000001490116) + this.active = (byte) 0; + this.lifeTime = (short) 0; + } + else + { + if ((double) this.scale < 1.0) + this.scale += 0.1f; + if ((double) this.scale <= 1.0) + return; + this.scale = 1f; + } + } + } +} diff --git a/Terraria/ItemTextPool.cs b/Terraria/ItemTextPool.cs new file mode 100644 index 0000000..c7815c8 --- /dev/null +++ b/Terraria/ItemTextPool.cs @@ -0,0 +1,121 @@ +// Type: Terraria.ItemTextPool +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework; + +namespace Terraria +{ + public sealed class ItemTextPool + { + public const int MAX_ITEM_TEXT = 4; + public int numActive; + public WorldView view; + public ItemText[] itemText; + + public ItemTextPool(WorldView view) + { + this.numActive = 0; + this.view = view; + this.itemText = new ItemText[4]; + } + + public void Clear() + { + for (int index = 3; index >= 0; --index) + this.itemText[index].Init(); + } + + public void Update() + { + int num = 0; + for (int whoAmI = 3; whoAmI >= 0; --whoAmI) + { + if ((int) this.itemText[whoAmI].active != 0) + { + ++num; + this.itemText[whoAmI].Update(whoAmI, this); + } + } + this.numActive = num; + } + + public void NewText(ref Item newItem, int stack) + { + if ((int) this.view.ui.inventoryMode > 0 || !this.view.ui.showItemText || (int) newItem.active == 0) + return; + int index1 = -1; + for (int index2 = 3; index2 >= 0; --index2) + { + if ((int) this.itemText[index2].active != 0) + { + if ((int) this.itemText[index2].netID == (int) newItem.netID && (int) newItem.prefix == 0) + { + this.itemText[index2].stack += stack; + Main.strBuilder.Length = 0; + Main.strBuilder.Append(Lang.itemName((int) newItem.netID)); + Main.strBuilder.Append(ToStringExtensions.ToStackString(this.itemText[index2].stack)); + Vector2 vector2 = UI.fontSmallOutline.MeasureString(Main.strBuilder); + this.itemText[index2].text = ((object) Main.strBuilder).ToString(); + this.itemText[index2].textSize = vector2; + this.itemText[index2].lifeTime = (short) 56; + this.itemText[index2].scale = 0.0f; + this.itemText[index2].position.X = newItem.position.X + (float) (((double) newItem.width - (double) vector2.X) * 0.5); + this.itemText[index2].position.Y = (float) ((double) newItem.position.Y + (double) ((int) newItem.height >> 2) - (double) vector2.Y * 0.5); + this.itemText[index2].velocityY = -7f; + return; + } + } + else + index1 = index2; + } + if (index1 < 0) + { + float num = (float) Main.bottomWorld; + for (int index2 = 0; index2 < 4; ++index2) + { + if ((double) num > (double) this.itemText[index2].position.Y) + { + index1 = index2; + num = this.itemText[index2].position.Y; + } + } + } + if (index1 < 0) + return; + string text = newItem.AffixName(); + this.itemText[index1].active = (byte) 1; + this.itemText[index1].lifeTime = (short) 56; + this.itemText[index1].netID = newItem.netID; + this.itemText[index1].stack = stack; + if (stack > 1) + text = text + ToStringExtensions.ToStackString(stack); + this.itemText[index1].text = text; + Vector2 vector2_1 = UI.MeasureString(UI.fontSmallOutline, text); + this.itemText[index1].textSize = vector2_1; + this.itemText[index1].alpha = 1f; + this.itemText[index1].alphaDir = -0.01f; + this.itemText[index1].scale = 0.0f; + this.itemText[index1].velocityY = -7f; + this.itemText[index1].position.X = (float) ((double) newItem.position.X + (double) newItem.width * 0.5 - (double) vector2_1.X * 0.5); + this.itemText[index1].position.Y = (float) ((double) newItem.position.Y + (double) newItem.height * 0.25 - (double) vector2_1.Y * 0.5); + if ((int) newItem.rare == 1) + this.itemText[index1].color = new Color(150, 150, (int) byte.MaxValue); + else if ((int) newItem.rare == 2) + this.itemText[index1].color = new Color(150, (int) byte.MaxValue, 150); + else if ((int) newItem.rare == 3) + this.itemText[index1].color = new Color((int) byte.MaxValue, 200, 150); + else if ((int) newItem.rare == 4) + this.itemText[index1].color = new Color((int) byte.MaxValue, 150, 150); + else if ((int) newItem.rare == 5) + this.itemText[index1].color = new Color((int) byte.MaxValue, 150, (int) byte.MaxValue); + else if ((int) newItem.rare == -1) + this.itemText[index1].color = new Color(130, 130, 130); + else if ((int) newItem.rare == 6) + this.itemText[index1].color = new Color(210, 160, (int) byte.MaxValue); + else + this.itemText[index1].color = Color.White; + } + } +} diff --git a/Terraria/JoinableSession.cs b/Terraria/JoinableSession.cs new file mode 100644 index 0000000..55212ea --- /dev/null +++ b/Terraria/JoinableSession.cs @@ -0,0 +1,24 @@ +// Type: Terraria.JoinableSession +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework.Net; + +namespace Terraria +{ + public sealed class JoinableSession + { + public const int SEARCH_DELAY = 5000; + public string host; + public int players; + public AvailableNetworkSession joinableSession; + + public JoinableSession(AvailableNetworkSession session) + { + this.host = session.HostGamertag; + this.players = session.CurrentGamerCount; + this.joinableSession = session; + } + } +} diff --git a/Terraria/Lang.cs b/Terraria/Lang.cs new file mode 100644 index 0000000..421aed8 --- /dev/null +++ b/Terraria/Lang.cs @@ -0,0 +1,18248 @@ +// Type: Terraria.Lang +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework.GamerServices; +using System; +using System.Globalization; + +namespace Terraria +{ + internal sealed class Lang + { + public static int lang = 0; + public static string languageId = "en"; + public static string[] misc = new string[37]; + public static string[] menu = new string[113]; + public static string[] gen = new string[59]; + public static string[] inter = new string[80]; + public static string[] tip = new string[52]; + public static string[] dt = new string[4]; + public static readonly string[] CONTROLS_EN = new string[87] + { + (string) (object) '\x008C' + (object) "Select", + (string) (object) '\x008D' + (object) "Back", + (string) (object) '\x008D' + (object) "Close", + (string) (object) '\x008A' + (object) "Change Storage Device", + (string) (object) '\x008B' + (object) "Xbox LIVE Party", + (string) (object) '\x008C' + (object) "Toggle Grappling Mode", + (string) (object) '\x0083' + (object) "Ban World", + (string) (object) '\x0085' + (object) "Map", + "\x0080\x0081Zoom", + (string) (object) '\x008C' + (object) "Toggle PvP", + (string) (object) '\x008C' + (object) "Select Team", + (string) (object) '\x008A' + (object) "Invite", + (string) (object) '\x008B' + (object) "Invite Xbox LIVE Party", + (string) (object) '\x008C' + (object) "Gamer card", + (string) (object) '\x008C' + (object) "Create World", + (string) (object) '\x008C' + (object) "Join", + (string) (object) '\x008A' + (object) "Show gamer card", + "\x0082\x0083Switch Item", + "\x0082\x0083Switch Menu", + (string) (object) '\x0080' + (object) "Grapple", + (string) (object) '\x008E' + (object) "Grapple", + (string) (object) '\x008D' + (object) "Use", + (string) (object) '\x008D' + (object) "Talk", + (string) (object) '\x008C' + (object) "Jump", + (string) (object) '\x008B' + (object) "Inventory", + (string) (object) '\x008A' + (object) "Drop", + (string) (object) '\x008A' + (object) "Trash", + (string) (object) '\x008A' + (object) "Sell", + (string) (object) '\x0081' + (object) "Action", + (string) (object) '\x0081' + (object) "Dig", + (string) (object) '\x0081' + (object) "Chop", + (string) (object) '\x0081' + (object) "Attack", + (string) (object) '\x0081' + (object) "Hit", + (string) (object) '\x0081' + (object) "Build", + (string) (object) '\x0081' + (object) "Take One", + (string) (object) '\x008C' + (object) "Take", + (string) (object) '\x008C' + (object) "Place", + (string) (object) '\x008C' + (object) "Equip", + (string) (object) '\x008C' + (object) "Swap", + (string) (object) '\x0081' + (object) "Equip", + (string) (object) '\x0081' + (object) "Open", + (string) (object) '\x008C' + (object) "Reforge", + (string) (object) '\x008C' + (object) "Show Recipes", + (string) (object) '\x008C' + (object) "Craft", + (string) (object) '\x008A' + (object) "Show All", + (string) (object) '\x008A' + (object) "Show Available", + (string) (object) '\x008B' + (object) "Ingredients", + (string) (object) '\x008B' + (object) "Recipes", + "\x0080\x0081Switch Category", + (string) (object) '\x0081' + (object) "Buy One", + (string) (object) '\x008C' + (object) "Buy", + (string) (object) '\x008C' + (object) "Sell", + (string) (object) '\x008C' + (object) "Cancel Buff", + (string) (object) '\x008C' + (object) "Assign to Room", + (string) (object) '\x008A' + (object) "Check Housing", + (string) (object) '\x008B' + (object) "Show Room Flags", + (string) (object) '\x008B' + (object) "Hide Room Flags", + "Gender", + "Difficulty", + "Hair Type", + "Hair Color", + "Vest Color", + "Shirt Color", + "Undershirt Color", + "Pants Color", + "Shoe Color", + "Skin Color", + "Eye Color", + (string) (object) '\x008B' + (object) "Randomize All", + (string) (object) '\x0088' + (object) " Create Character", + "\x0082\x0083Switch Category", + (string) (object) '\x0084' + (object) "Select Color", + (string) (object) '\x0084' + (object) "Select Type", + (string) (object) '\x0084' + (object) "Select Gender", + (string) (object) '\x0084' + (object) "Select Difficulty", + (string) (object) '\x0084' + (object) "Change Sound Volume", + (string) (object) '\x0084' + (object) "Change Music Volume", + (string) (object) '\x008C' + (object) "Next Page", + (string) (object) '\x008A' + (object) "Previous Page", + (string) (object) '\x0084' + (object) "Scroll Text", + "\x0082\x0083Switch Leaderboard", + (string) (object) '\x008A' + (object) "Show Top", + (string) (object) '\x008A' + (object) "Show Myself", + (string) (object) '\x008A' + (object) "Show Friends Only", + (string) (object) '\x008C' + (object) "Exit Game", + (string) (object) '\x008D' + (object) "Back", + (string) (object) '\x008A' + (object) "Unlock Full Game" + }; + public static readonly string[] CONTROLS_DE = new string[87] + { + (string) (object) '\x008C' + (object) "Auswählen", + (string) (object) '\x008D' + (object) "Zurück", + (string) (object) '\x008D' + (object) "Schließen", + (string) (object) '\x008A' + (object) "Speichermedium wechseln", + (string) (object) '\x008B' + (object) "Xbox LIVE Party", + (string) (object) '\x008C' + (object) "Auf Greifhaken-Modus umstellen", + (string) (object) '\x0083' + (object) "Verbanne Welt", + (string) (object) '\x0085' + (object) "Karte", + "\x0080\x0081Zoom", + (string) (object) '\x008C' + (object) "Auf PvP schalten", + (string) (object) '\x008C' + (object) "Team wählen", + (string) (object) '\x008A' + (object) "Einladung", + (string) (object) '\x008B' + (object) "Einladung - Xbox LIVE Party", + (string) (object) '\x008C' + (object) "Spielerkarte", + (string) (object) '\x008C' + (object) "Welt erstellen", + (string) (object) '\x008C' + (object) "Teilnehmen", + (string) (object) '\x008A' + (object) "Spielerkarte zeigen", + "\x0082\x0083Item austauschen", + "\x0082\x0083Menü wechseln", + (string) (object) '\x0080' + (object) "Entern", + (string) (object) '\x008E' + (object) "Entern", + (string) (object) '\x008D' + (object) "Nutzen", + (string) (object) '\x008D' + (object) "Sprechen", + (string) (object) '\x008C' + (object) "Springen", + (string) (object) '\x008B' + (object) "Inventar", + (string) (object) '\x008A' + (object) "Fallenlassen", + (string) (object) '\x008A' + (object) "Müll", + (string) (object) '\x008A' + (object) "Verkaufen", + (string) (object) '\x0081' + (object) "Action", + (string) (object) '\x0081' + (object) "Graben", + (string) (object) '\x0081' + (object) "Hacken", + (string) (object) '\x0081' + (object) "Attackieren", + (string) (object) '\x0081' + (object) "Schlagen", + (string) (object) '\x0081' + (object) "Bauen", + (string) (object) '\x0081' + (object) "Nimm eins", + (string) (object) '\x008C' + (object) "Nehmen", + (string) (object) '\x008C' + (object) "Platzieren", + (string) (object) '\x008C' + (object) "Ausstatten", + (string) (object) '\x008C' + (object) "Tauschen", + (string) (object) '\x0081' + (object) "Ausstatten", + (string) (object) '\x0081' + (object) "Öffnen", + (string) (object) '\x008C' + (object) "Wieder schmieden", + (string) (object) '\x008C' + (object) "Rezepte anzeigen", + (string) (object) '\x008C' + (object) "Herstellen", + (string) (object) '\x008A' + (object) "Alle", + (string) (object) '\x008A' + (object) "Erhältliche", + (string) (object) '\x008B' + (object) "Bestandteile", + (string) (object) '\x008B' + (object) "Rezepte", + "\x0080\x0081Kategorie", + (string) (object) '\x0081' + (object) "Kauf eins", + (string) (object) '\x008C' + (object) "Kaufen", + (string) (object) '\x008C' + (object) "Verkaufen", + (string) (object) '\x008C' + (object) "Buff löschen", + (string) (object) '\x008C' + (object) "Raum zuweisen", + (string) (object) '\x008A' + (object) "Unterkünfte", + (string) (object) '\x008B' + (object) "Flaggen anzeigen", + (string) (object) '\x008B' + (object) "Flaggen verbergen", + "Geschlecht", + "Schwierigkeitsstufe", + "Haartyp", + "Haarfarbe", + "Hemdfarbe", + "Shirt-Farbe", + "Unterhemdfarbe", + "Hosenfarbe", + "Schuhfarbe", + "Hautfarbe", + "Augenfarbe", + (string) (object) '\x008B' + (object) "Alle nach Zufallsprinzip auswählen", + (string) (object) '\x0088' + (object) " Charakter erstellen", + "\x0082\x0083Kategorie wechseln", + (string) (object) '\x0084' + (object) "Farbe auswählen", + (string) (object) '\x0084' + (object) "Typ auswählen", + (string) (object) '\x0084' + (object) "Geschlecht auswählen", + (string) (object) '\x0084' + (object) "Schwierigkeitsstufe auswählen", + (string) (object) '\x0084' + (object) "Tonlautstärke ändern", + (string) (object) '\x0084' + (object) "Musiklautstärke ändern", + (string) (object) '\x008C' + (object) "Nächste Seite", + (string) (object) '\x008A' + (object) "Vorherige Seite", + (string) (object) '\x0084' + (object) "Text scrollen", + "\x0082\x0083Bestenlisten wechseln", + (string) (object) '\x008A' + (object) "Bestplatzierte", + (string) (object) '\x008A' + (object) "Mich selbst anzeigen", + (string) (object) '\x008A' + (object) "Nur Freunde anzeigen", + (string) (object) '\x008C' + (object) "Spiel verlassen", + (string) (object) '\x008D' + (object) "Zurück", + (string) (object) '\x008A' + (object) "Vollständiges Spiel freischalten" + }; + public static readonly string[] CONTROLS_FR = new string[87] + { + (string) (object) '\x008C' + (object) "Sélectionner", + (string) (object) '\x008D' + (object) "Retour", + (string) (object) '\x008D' + (object) "Fermer", + (string) (object) '\x008A' + (object) "Changer périphérique de stockage", + (string) (object) '\x008B' + (object) "Groupe d'amis Xbox LIVE", + (string) (object) '\x008C' + (object) "Basculer en mode grappin", + (string) (object) '\x0083' + (object) "Bannir un monde", + (string) (object) '\x0085' + (object) "Carte", + "\x0080\x0081Agrandir", + (string) (object) '\x008C' + (object) "PvP", + (string) (object) '\x008C' + (object) "L'équipe", + (string) (object) '\x008A' + (object) "Invitation", + (string) (object) '\x008B' + (object) "Inviter groupe d'amis Xbox LIVE", + (string) (object) '\x008C' + (object) "Carte joueur", + (string) (object) '\x008C' + (object) "Créer un monde", + (string) (object) '\x008C' + (object) "Rejoindre", + (string) (object) '\x008A' + (object) "Afficher la carte du joueur", + "\x0082\x0083Changer objet", + "\x0082\x0083Changer menu", + (string) (object) '\x0080' + (object) "Grappin", + (string) (object) '\x008E' + (object) "Grappin", + (string) (object) '\x008D' + (object) "Utiliser", + (string) (object) '\x008D' + (object) "Parler", + (string) (object) '\x008C' + (object) "Sauter", + (string) (object) '\x008B' + (object) "Inventaire", + (string) (object) '\x008A' + (object) "Lâcher", + (string) (object) '\x008A' + (object) "Poubelle", + (string) (object) '\x008A' + (object) "Vendre", + (string) (object) '\x0081' + (object) "Action", + (string) (object) '\x0081' + (object) "Creuser", + (string) (object) '\x0081' + (object) "Couper", + (string) (object) '\x0081' + (object) "Attaquer", + (string) (object) '\x0081' + (object) "Frapper", + (string) (object) '\x0081' + (object) "Construire", + (string) (object) '\x0081' + (object) "En prendre un(e)", + (string) (object) '\x008C' + (object) "Prendre", + (string) (object) '\x008C' + (object) "Placer", + (string) (object) '\x008C' + (object) "Équiper", + (string) (object) '\x008C' + (object) "Échanger", + (string) (object) '\x0081' + (object) "Équiper", + (string) (object) '\x0081' + (object) "Ouvrir", + (string) (object) '\x008C' + (object) "Reforger", + (string) (object) '\x008C' + (object) "Afficher recettes", + (string) (object) '\x008C' + (object) "Fabriquer", + (string) (object) '\x008A' + (object) "Tout", + (string) (object) '\x008A' + (object) "Disponible", + (string) (object) '\x008B' + (object) "Ingrédients", + (string) (object) '\x008B' + (object) "Recettes", + "\x0080\x0081Catégories", + (string) (object) '\x0081' + (object) "En acheter un(e)", + (string) (object) '\x008C' + (object) "Acheter", + (string) (object) '\x008C' + (object) "Vendre", + (string) (object) '\x008C' + (object) "Annuler buff", + (string) (object) '\x008C' + (object) "Attribuer chambre", + (string) (object) '\x008A' + (object) "Logement", + (string) (object) '\x008B' + (object) "Afficher drapeaux", + (string) (object) '\x008B' + (object) "Masquer drapeaux", + "Sexe", + "Difficulté", + "Type de cheveux", + "Couleur de cheveux", + "Couleur de veste", + "Couleur de chemise", + "Couleur de t-shirt", + "Couleur de pantalon", + "Couleur des chaussures", + "Couleur de peau", + "Couleur des yeux", + (string) (object) '\x008B' + (object) "Tout au hasard", + (string) (object) '\x0088' + (object) "Créer un personnage", + "\x0082\x0083Changer de catégorie", + (string) (object) '\x0084' + (object) "Choisir une couleur", + (string) (object) '\x0084' + (object) "Choisir un type", + (string) (object) '\x0084' + (object) "Choisir le sexe", + (string) (object) '\x0084' + (object) "Choisir la difficulté", + (string) (object) '\x0084' + (object) "Changer le volume des sons", + (string) (object) '\x0084' + (object) "Changer le volume de la musique", + (string) (object) '\x008C' + (object) "Page suivante", + (string) (object) '\x008A' + (object) "Page précédente", + (string) (object) '\x0084' + (object) "Faire défiler le texte", + "\x0082\x0083Changer le classement", + (string) (object) '\x008A' + (object) "Afficher les premiers", + (string) (object) '\x008A' + (object) "Afficher mon rang", + (string) (object) '\x008A' + (object) "Afficher amis uniquement", + (string) (object) '\x008C' + (object) "Quitter le jeu", + (string) (object) '\x008D' + (object) "Retour", + (string) (object) '\x008A' + (object) "Déverrouiller le jeu complet" + }; + public static readonly string[] CONTROLS_IT = new string[87] + { + (string) (object) '\x008C' + (object) "Seleziona", + (string) (object) '\x008D' + (object) "Indietro", + (string) (object) '\x008D' + (object) "Chiudi", + (string) (object) '\x008A' + (object) "Cambia portaoggetti", + (string) (object) '\x008B' + (object) "Party Xbox LIVE", + (string) (object) '\x008C' + (object) "Attiva modalità di lotta", + (string) (object) '\x0083' + (object) "Blocca Mondo", + (string) (object) '\x0085' + (object) "Mappa", + "\x0080\x0081Ingrandisci", + (string) (object) '\x008C' + (object) "Attiva PvP", + (string) (object) '\x008C' + (object) "Seleziona squadra", + (string) (object) '\x008A' + (object) "Invito", + (string) (object) '\x008B' + (object) "Invita ad un Party Xbox LIVE", + (string) (object) '\x008C' + (object) "Scheda giocatore", + (string) (object) '\x008C' + (object) "Crea Mondo", + (string) (object) '\x008C' + (object) "Entra", + (string) (object) '\x008A' + (object) "Mostra scheda giocatore", + "\x0082\x0083Cambia oggetto", + "\x0082\x0083Cambia menu", + (string) (object) '\x0080' + (object) "Afferra", + (string) (object) '\x008E' + (object) "Afferra", + (string) (object) '\x008D' + (object) "Utilizza", + (string) (object) '\x008D' + (object) "Parla", + (string) (object) '\x008C' + (object) "Salta", + (string) (object) '\x008B' + (object) "Inventario", + (string) (object) '\x008A' + (object) "Lascia", + (string) (object) '\x008A' + (object) "Cestino", + (string) (object) '\x008A' + (object) "Vendi", + (string) (object) '\x0081' + (object) "Azione", + (string) (object) '\x0081' + (object) "Scava", + (string) (object) '\x0081' + (object) "Taglia", + (string) (object) '\x0081' + (object) "Attacca", + (string) (object) '\x0081' + (object) "Colpisci", + (string) (object) '\x0081' + (object) "Costruisci", + (string) (object) '\x0081' + (object) "Prendi uno", + (string) (object) '\x008C' + (object) "Prendi", + (string) (object) '\x008C' + (object) "Posiziona", + (string) (object) '\x008C' + (object) "Equipaggiati", + (string) (object) '\x008C' + (object) "Scambia", + (string) (object) '\x0081' + (object) "Equipaggiamento", + (string) (object) '\x0081' + (object) "Apri", + (string) (object) '\x008C' + (object) "Riforgia", + (string) (object) '\x008C' + (object) "Mostra formule", + (string) (object) '\x008C' + (object) "Crea", + (string) (object) '\x008A' + (object) "Tutto", + (string) (object) '\x008A' + (object) "Disponibile", + (string) (object) '\x008B' + (object) "Ingredienti", + (string) (object) '\x008B' + (object) "Formule", + "\x0080\x0081Categoria", + (string) (object) '\x0081' + (object) "Compra uno", + (string) (object) '\x008C' + (object) "Compra", + (string) (object) '\x008C' + (object) "Vendi", + (string) (object) '\x008C' + (object) "Cancella bonus", + (string) (object) '\x008C' + (object) "Assegna stanza", + (string) (object) '\x008A' + (object) "Alloggio", + (string) (object) '\x008B' + (object) "Mostra bandiere", + (string) (object) '\x008B' + (object) "Nascondi bandiere", + "Sesso", + "Difficoltà", + "Tipologia capelli", + "Colore capelli", + "Colore giubbotto", + "Colore maglia", + "Colore canottiera", + "Colore pantaloni", + "Colore scarpe", + "Colore pelle", + "Colore occhi", + (string) (object) '\x008B' + (object) "Randomizza tutto", + (string) (object) '\x0088' + (object) " Crea personaggio", + "\x0082\x0083Cambia categoria", + (string) (object) '\x0084' + (object) "Seleziona colore", + (string) (object) '\x0084' + (object) "Seleziona tipologia", + (string) (object) '\x0084' + (object) "Seleziona sesso", + (string) (object) '\x0084' + (object) "Seleziona difficoltà", + (string) (object) '\x0084' + (object) "Cambia volume suono", + (string) (object) '\x0084' + (object) "Cambia volume musica", + (string) (object) '\x008C' + (object) "Pagina successiva", + (string) (object) '\x008A' + (object) "Pagina precedente", + (string) (object) '\x0084' + (object) "Scorri testo", + "\x0082\x0083Cambia classifica", + (string) (object) '\x008A' + (object) "Mostra il primo in classifica", + (string) (object) '\x008A' + (object) "Mostra il mio personaggio", + (string) (object) '\x008A' + (object) "Mostra solo i miei amici", + (string) (object) '\x008C' + (object) "Esci dal gioco", + (string) (object) '\x008D' + (object) "Indietro", + (string) (object) '\x008A' + (object) "Sblocca gioco completo" + }; + public static readonly string[] CONTROLS_ES = new string[87] + { + (string) (object) '\x008C' + (object) "Seleccionar", + (string) (object) '\x008D' + (object) "Atrás", + (string) (object) '\x008D' + (object) "Cerrar", + (string) (object) '\x008A' + (object) "Cambiar de dispositivo de almacenaje", + (string) (object) '\x008B' + (object) "Xbox LIVE Party", + (string) (object) '\x008C' + (object) "Cambiar de modo de agarre", + (string) (object) '\x0083' + (object) "Prohibir Mundo", + (string) (object) '\x0085' + (object) "Mapa", + "\x0080\x0081Aumentar", + (string) (object) '\x008C' + (object) "Cambiar PvP", + (string) (object) '\x008C' + (object) "Seleccionar equipo", + (string) (object) '\x008A' + (object) "Invitación", + (string) (object) '\x008B' + (object) "Invitar a Xbox LIVE Party", + (string) (object) '\x008C' + (object) "Mostrar jugador", + (string) (object) '\x008C' + (object) "Crear mundo", + (string) (object) '\x008C' + (object) "Unirse", + (string) (object) '\x008A' + (object) "Mostrar tarjeta de jugador", + "\x0082\x0083Cambiar objeto", + "\x0082\x0083Cambiar de menú", + (string) (object) '\x0080' + (object) "Agarrar", + (string) (object) '\x008E' + (object) "Agarrar", + (string) (object) '\x008D' + (object) "Usar", + (string) (object) '\x008D' + (object) "Hablar", + (string) (object) '\x008C' + (object) "Saltar", + (string) (object) '\x008B' + (object) "Inventario", + (string) (object) '\x008A' + (object) "Soltar", + (string) (object) '\x008A' + (object) "Basura", + (string) (object) '\x008A' + (object) "Vender", + (string) (object) '\x0081' + (object) "Acción", + (string) (object) '\x0081' + (object) "Excavar", + (string) (object) '\x0081' + (object) "Cortar", + (string) (object) '\x0081' + (object) "Atacar", + (string) (object) '\x0081' + (object) "Golpear", + (string) (object) '\x0081' + (object) "Construir", + (string) (object) '\x0081' + (object) "Tomar uno", + (string) (object) '\x008C' + (object) "Tomar", + (string) (object) '\x008C' + (object) "Poner", + (string) (object) '\x008C' + (object) "Equipar", + (string) (object) '\x008C' + (object) "Cambiar", + (string) (object) '\x0081' + (object) "Equipar", + (string) (object) '\x0081' + (object) "Abrir", + (string) (object) '\x008C' + (object) "Volver a forjar", + (string) (object) '\x008C' + (object) "Mostrar recetas", + (string) (object) '\x008C' + (object) "Crear", + (string) (object) '\x008A' + (object) "Todo", + (string) (object) '\x008A' + (object) "Disponible", + (string) (object) '\x008B' + (object) "Ingredientes", + (string) (object) '\x008B' + (object) "Recetas", + "\x0080\x0081Categoría", + (string) (object) '\x0081' + (object) "Comprar uno", + (string) (object) '\x008C' + (object) "Comprar", + (string) (object) '\x008C' + (object) "Vender", + (string) (object) '\x008C' + (object) "Cancelar potenciador", + (string) (object) '\x008C' + (object) "Asignar habitación", + (string) (object) '\x008A' + (object) "Cobijo", + (string) (object) '\x008B' + (object) "Mostrar banderas", + (string) (object) '\x008B' + (object) "Ocultar banderas", + "Sexo", + "Dificultad", + "Peinado", + "Color de pelo", + "Color de la ropa", + "Color de la camisa", + "Color de camiseta", + "Color de los pantalones", + "Color de los zapatos", + "Color de la piel", + "Color de los ojos", + (string) (object) '\x008B' + (object) "Todo aleatorio", + (string) (object) '\x0088' + (object) "Crear personaje", + "\x0082\x0083Cambiar categoría", + (string) (object) '\x0084' + (object) "Elegir color", + (string) (object) '\x0084' + (object) "Elegir tipo", + (string) (object) '\x0084' + (object) "Elegir sexo", + (string) (object) '\x0084' + (object) "Elegir dificultad", + (string) (object) '\x0084' + (object) "Cambiar volumen del sonido", + (string) (object) '\x0084' + (object) "Cambiar volumen de la música", + (string) (object) '\x008C' + (object) "Página siguiente", + (string) (object) '\x008A' + (object) "Página anterior", + (string) (object) '\x0084' + (object) "Avanzar texto", + "\x0082\x0083Cambiar marcador", + (string) (object) '\x008A' + (object) "Mostrar inicio", + (string) (object) '\x008A' + (object) "Mostrar mi posición", + (string) (object) '\x008A' + (object) "Mostrar solo amigos", + (string) (object) '\x008C' + (object) "Salir del juego", + (string) (object) '\x008D' + (object) "Atrás", + (string) (object) '\x008A' + (object) "Desbloquear juego completo" + }; + private static readonly ControlDesc[] MENU_CONTROLS_EN = new ControlDesc[13] + { + new ControlDesc(0, 361, 144, "Grapple"), + new ControlDesc(0, 592, 144, "Action"), + new ControlDesc(3, (int) byte.MaxValue, 198, "Previous Item"), + new ControlDesc(2, 703, 198, "Next Item"), + new ControlDesc(1, 174, 310, "Quick Shortcuts"), + new ControlDesc(3, (int) byte.MaxValue, 265, "Move/"), + new ControlDesc(3, 550, 420, "Aim/Switch Cursor Mode"), + new ControlDesc(0, 437, 108, "Player List & World Map"), + new ControlDesc(0, 520, 172, "Pause"), + new ControlDesc(2, 703, 290, "Jump"), + new ControlDesc(2, 703, 260, "Use"), + new ControlDesc(2, 703, 320, "Drop"), + new ControlDesc(2, 703, 230, "Inventory") + }; + private static readonly ControlDesc[] MENU_CONTROLS_DE = new ControlDesc[13] + { + new ControlDesc(0, 361, 140, "Entern"), + new ControlDesc(0, 592, 140, "Action"), + new ControlDesc(3, (int) byte.MaxValue, 198, "Vorheriges Item"), + new ControlDesc(2, 703, 198, "Nächstes Item"), + new ControlDesc(1, 174, 310, "Schnelle Verknüpfungen"), + new ControlDesc(3, (int) byte.MaxValue, 265, "Bewegen/"), + new ControlDesc(3, 550, 420, "Mit Cursor zielen/Cursor-Modus ändern"), + new ControlDesc(0, 437, 106, "Spielerliste/Weltkarte"), + new ControlDesc(0, 520, 168, "Pause"), + new ControlDesc(2, 703, 290, "Springen"), + new ControlDesc(2, 703, 260, "Nutzen"), + new ControlDesc(2, 703, 320, "Fallenlassen"), + new ControlDesc(2, 703, 230, "Inventar") + }; + private static readonly ControlDesc[] MENU_CONTROLS_FR = new ControlDesc[13] + { + new ControlDesc(0, 361, 140, "Grappin"), + new ControlDesc(0, 592, 140, "Action"), + new ControlDesc(3, (int) byte.MaxValue, 198, "Objet précédent"), + new ControlDesc(2, 703, 198, "Objet suivant"), + new ControlDesc(1, 174, 310, "Raccourcis"), + new ControlDesc(3, (int) byte.MaxValue, 265, "Se déplacer/"), + new ControlDesc(3, 550, 420, "Viser/Changer le mode curseur"), + new ControlDesc(0, 437, 106, "Liste du joueur/carte du monde"), + new ControlDesc(0, 520, 168, "Pause"), + new ControlDesc(2, 703, 290, "Sauter"), + new ControlDesc(2, 703, 260, "Utiliser"), + new ControlDesc(2, 703, 320, "Lâcher"), + new ControlDesc(2, 703, 230, "Inventaire") + }; + private static readonly ControlDesc[] MENU_CONTROLS_IT = new ControlDesc[13] + { + new ControlDesc(0, 361, 140, "Afferra"), + new ControlDesc(0, 592, 140, "Azione"), + new ControlDesc(3, (int) byte.MaxValue, 198, "Oggetto precedente"), + new ControlDesc(2, 703, 198, "Oggetto nuovo"), + new ControlDesc(1, 174, 310, "Comandi rapidi"), + new ControlDesc(3, (int) byte.MaxValue, 265, "Sposta/"), + new ControlDesc(3, 550, 420, "Modalità cursore Mira/Cambia"), + new ControlDesc(0, 437, 106, "Lista giocatori/Mappa Mondo"), + new ControlDesc(0, 520, 168, "Pausa"), + new ControlDesc(2, 703, 290, "Salta"), + new ControlDesc(2, 703, 260, "Utilizza"), + new ControlDesc(2, 703, 320, "Lascia"), + new ControlDesc(2, 703, 230, "Inventario") + }; + private static readonly ControlDesc[] MENU_CONTROLS_ES = new ControlDesc[13] + { + new ControlDesc(0, 361, 140, "Agarrar"), + new ControlDesc(0, 592, 140, "Acción"), + new ControlDesc(3, (int) byte.MaxValue, 198, "Objeto anterior"), + new ControlDesc(2, 703, 198, "Objeto siguiente"), + new ControlDesc(1, 174, 310, "Accesos directos"), + new ControlDesc(3, (int) byte.MaxValue, 265, "Mover/"), + new ControlDesc(3, 550, 420, "Apuntar/Cambiar modo de cursor"), + new ControlDesc(0, 437, 106, "Lista de jugadores/Mapa del mundo"), + new ControlDesc(0, 520, 168, "Pausa"), + new ControlDesc(2, 703, 290, "Saltar"), + new ControlDesc(2, 703, 260, "Usar"), + new ControlDesc(2, 703, 320, "Soltar"), + new ControlDesc(2, 703, 230, "Inventario") + }; + public static readonly string[] PROJECTILE_NAMES = new string[120] + { + null, + "Wooden Arrow", + "Fire Arrow", + "Shuriken", + "Unholy Arrow", + "Jester's Arrow", + "Enchanted Boomerang", + "Vilethorn", + "Vilethorn (end)", + "Starfury", + "Purification Powder", + "Vile Powder", + "Fallen Star", + "Grappling Hook", + "Musket Ball", + "Ball of Fire", + "Magic Missile", + "Dirt Ball", + "Orb of Light", + "Flamarang", + "Green Laser", + "Bone", + "Water Stream", + "Harpoon", + "Spiky Ball", + "Ball 'O Hurt", + "Blue Moon", + "Water Bolt", + "Bomb", + "Dynamite", + "Grenade", + "Sand Ball", + "Ivy Whip", + "Thorn Chakrum", + "Flamelash", + "Sunfury", + "Meteor Shot", + "Sticky Bomb", + "Harpy Feather", + "Mud Ball", + "Ash Ball", + "Hellfire Arrow", + "Sand Ball", + "Tombstone", + "Demon Sickle", + "Demon Scythe", + "Dark Lance", + "Trident", + "Throwing Knife", + "Spear", + "Glowstick", + "Seed", + "Wooden Boomerang", + "Sticky Glowstick", + "Poisoned Knife", + "Stinger", + "Ebonsand Ball", + "Cobalt Chainsaw", + "Mythril Chainsaw", + "Cobalt Drill", + "Mythril Drill", + "Adamantite Chainsaw", + "Adamantite Drill", + "The Dao of Pow", + "Mythril Halberd", + "Ebonsand Ball", + "Adamantite Glaive", + "Pearl Sand Ball", + "Pearl Sand Ball", + "Holy Water", + "Unholy Water", + "Silt Ball", + "Blue Fairy", + "Hook", + "Hook", + "Happy Bomb", + "Note", + "Note", + "Note", + "Rainbow", + "Ice Block", + "Wooden Arrow", + "Flaming Arrow", + "Eye Laser", + "Pink Laser", + "Flames", + "Pink Fairy", + "Green Fairy", + "Purple Laser", + "Crystal Bullet", + "Crystal Shard", + "Holy Arrow", + "Hallow Star", + "Magic Dagger", + "Crystal Storm", + "Cursed Flame", + "Cursed Flame", + "Cobalt Naginata", + "Poison Dart", + "Boulder", + "Death laser", + "Eye Fire", + "Bomb", + "Cursed Arrow", + "Cursed Bullet", + "Gungnir", + "Light Disc", + "Hamdrax", + "Explosives", + "Snow Ball", + "Bullet", + "Guinea Pig", + "Tonbogiri", + "Spectral Arrow", + "Vulcan Bolt", + "Slime", + "Tiphia", + "Bat", + "Werewolf", + "Zombie" + }; + private static readonly string[] ITEM_PREFIX_EN = new string[84] + { + null, + "Large", + "Massive", + "Dangerous", + "Savage", + "Sharp", + "Pointy", + "Tiny", + "Terrible", + "Small", + "Dull", + "Unhappy", + "Bulky", + "Shameful", + "Heavy", + "Light", + "Sighted", + "Rapid", + "Hasty", + "Intimidating", + "Deadly", + "Staunch", + "Awful", + "Lethargic", + "Awkward", + "Powerful", + "Mystic", + "Adept", + "Masterful", + "Inept", + "Ignorant", + "Deranged", + "Intense", + "Taboo", + "Celestial", + "Furious", + "Keen", + "Superior", + "Forceful", + "Broken", + "Damaged", + "Shoddy", + "Quick", + "Deadly", + "Agile", + "Nimble", + "Murderous", + "Slow", + "Sluggish", + "Lazy", + "Annoying", + "Nasty", + "Manic", + "Hurtful", + "Strong", + "Unpleasant", + "Weak", + "Ruthless", + "Frenzying", + "Godly", + "Demonic", + "Zealous", + "Hard", + "Guarding", + "Armored", + "Warding", + "Arcane", + "Precise", + "Lucky", + "Jagged", + "Spiked", + "Angry", + "Menacing", + "Brisk", + "Fleeting", + "Hasty", + "Quick", + "Wild", + "Rash", + "Intrepid", + "Violent", + "Legendary", + "Unreal", + "Mythical" + }; + private static readonly string[] ITEM_PREFIX_DE = new string[84] + { + null, + "Groß", + "Riesig", + "Gefährlich", + "Barbarisch", + "Scharf", + "Spitz", + "Winzig", + "Schrecklich", + "Klein", + "Stumpf", + "Unglücklich", + "Sperrig", + "Beschämend", + "Schwer", + "Leicht", + "Gesichtet", + "Schnell", + "Hastig", + "Einschüchternd", + "Tödlich", + "Unerschütterlich", + "Schrecklich", + "Lethargisch", + "Unbeholfen", + "Mächtig", + "Mystisch", + "Geschickt", + "Meisterhaft", + "Ungeschickt", + "Unwissend", + "Gestört", + "Intensiv", + "Tabu", + "Himmlisch", + "Wütend", + "Scharf", + "Überlegen", + "Kraftvoll", + "Gebrochen", + "Beschädigt", + "Schäbig", + "Rasch", + "Tödlich", + "Agil", + "Wendig", + "Mörderisch", + "Langsam", + "Träge", + "Faul", + "Lästig", + "Böse", + "Manisch", + "Verletzend", + "Stark", + "Unangenehm", + "Schwach", + "Rücksichtslos", + "Rasend", + "Fromm", + "Dämonisch", + "Eifrig", + "Schwer", + "Schützend", + "Gepanzert", + "Abwehrend", + "Geheimnisvoll", + "Präzise", + "Glücklich", + "Gezackt", + "Spike", + "Wütend", + "Bedrohlich", + "Rege", + "Flüchtig", + "Hastig", + "Rasch", + "Wild", + "Voreilig", + "Unerschrocken", + "Gewalttätig", + "Legendär", + "Unwirklich", + "Mythisch" + }; + private static readonly string[] ITEM_PREFIX_IT = new string[84] + { + null, + "Grande", + "Massiccio", + "Pericoloso", + "Selvaggio", + "Appuntito", + "Tagliente", + "Minuto", + "Terribile", + "Piccolo", + "Opaco", + "Infelice", + "Ingombrante", + "Vergognoso", + "Pesante", + "Luce", + "Avvistato", + "Rapido", + "Frettoloso", + "Intimidatorio", + "Mortale", + "Convinto", + "Orribile", + "Letargico", + "Scomodo", + "Potente", + "Mistico", + "Esperto", + "Magistrale", + "Inetto", + "Ignorante", + "Squilibrato", + "Intenso", + "Tabù", + "Celeste", + "Furioso", + "Appassionato", + "Superiore", + "Forte", + "Rotto", + "Danneggiato", + "Scadente", + "Veloce", + "Mortale", + "Agile", + "Lesto", + "Omicida", + "Lento", + "Lento", + "Pigro", + "Fastidioso", + "Cattivo", + "Maniaco", + "Offensivo", + "Robusto", + "Sgradevole", + "Debole", + "Spietato", + "Frenetico", + "Devoto", + "Diabolico", + "Zelante", + "Duro", + "Protettivo", + "Corazzato", + "Difensivo", + "Arcano", + "Preciso", + "Fortunato", + "Frastagliato", + "Spillo", + "Arrabbiato", + "Minaccioso", + "Vivace", + "Fugace", + "Frettoloso", + "Veloce", + "Selvaggio", + "Temerario", + "Intrepido", + "Violento", + "Leggendario", + "Irreale", + "Mitico" + }; + private static readonly string[] ITEM_PREFIX_FR = new string[84] + { + null, + "Grand", + "Massif", + "Dangereuses", + "Sauvages", + "Coupante", + "Pointues", + "Minuscules", + "Terrible", + "Petit", + "Terne", + "Malheureux", + "Volumineux", + "Honteux", + "Lourds", + "Léger", + "Voyants", + "Rapide", + "Hâtif", + "Intimidant", + "Mortelle", + "Dévoué", + "Affreux", + "Léthargique", + "Scomodo", + "Puissante", + "Mystique", + "Expert", + "Magistrale", + "Inepte", + "Ignorants", + "Dérangé", + "Intenses", + "Tabou", + "Célestes", + "Furieux", + "Vif", + "Supérieure", + "Énergique", + "Rompu", + "Endommagés", + "Mesquin", + "Prompt", + "Mortelle", + "Agile", + "Leste", + "Meurtrier", + "Lente", + "Paresseux", + "Fainéant", + "Ennuyeux", + "Méchant", + "Maniaco", + "Blessant", + "Robuste", + "Désagréables", + "Faibles", + "Impitoyable", + "Frénétique", + "Pieux", + "Démoniaque", + "Zélé", + "Durs", + "Protecteur", + "Blindés", + "Défensif", + "Ésotérique", + "Précise", + "Chanceux", + "Déchiqueté", + "Pointes", + "Fâché", + "Menaçant", + "Brusque", + "Fugace", + "Hâtif", + "Prompt", + "Sauvages", + "Téméraire", + "Intrépide", + "Violent", + "Légendaire", + "Irréel", + "Mythique" + }; + private static readonly string[] ITEM_PREFIX_ES = new string[84] + { + null, + "Grande", + "Enorme", + "Peligroso", + "Salvaje", + "Afilado", + "Puntiagudo", + "Diminuto", + "Mala ", + "Pequeño", + "Aburrido", + "Infeliz", + "Voluminoso", + "Vergonzoso", + "Pesado", + "Ligero", + "Perspicaz", + "Rápido", + "Precipitado", + "Intimidante", + "Mortal", + "Firme", + "Atroz", + "Letárgico", + "Torpe", + "Poderoso", + "Místico", + "Experto", + "Maestro", + "Inepto", + "Ignorante", + "Trastornado", + "Intenso", + "Prohibido", + "Celeste", + "Furioso", + "Incisivo", + "Superior", + "Fuerte", + "Roto", + "Estropeado", + "Chapucero", + "Veloz", + "Mortal", + "Ágil", + "Listo", + "Asesino", + "Lento", + "Perezoso", + "Gandul", + "Molesto", + "Feo", + "Maníaco", + "Hiriente", + "Vigoroso", + "Desagradable", + "Débil", + "Despiadado", + "Frenético", + "Piadoso", + "Demoníaco", + "Fanático", + "Duro", + "Protector", + "Blindado", + "Defensivo", + "Arcano", + "Preciso", + "Afortunado", + "Dentado", + "Claveteado", + "Enojado", + "Amenazante", + "Enérgico", + "Fugaz", + "Precipitado", + "Veloz", + "Salvaje", + "Temerario", + "Intrépido", + "Violento", + "Legendario", + "Irreal", + "Mítico" + }; + private static readonly string[] TUTORIAL_EN = new string[80] + { + "Terraria is a game about adventuring to the ends of the World and defeating villainous bosses along the way. This tutorial will teach you the basics.\n ", + "Press " + (object) '\x008D' + " to continue.", + "Use " + (object) '\x0084' + " to move around.", + "Press " + (object) '\x008C' + " to jump.", + "You can fall through wood platforms by pressing down " + (object) '\x0084' + ". Try falling through the platform.", + "Now jump out by pressing " + (object) '\x008C' + ".", + "Press (or hold) " + (object) '\x0081' + " to perform actions with the current item. Aim with " + (string) (object) '\x0085' + ".", + "At the top of your screen is the Inventory Bar. You can switch between items with " + (object) '\x0082' + " & " + (string) (object) '\x0083' + ". Now switch to your sword.", + "An evil monster has appeared. Defeat it with your sword by pressing " + (object) '\x0081' + ".", + "Terraria is full of monsters, especially at night. Luckily there are many weapons you can find to help you.\n ", + "Press " + (object) '\x008D' + " to continue.", + "If you get hurt, you will heal over time. You can also use food or healing potions.\n ", + "Press " + (object) '\x008D' + " to continue.", + "Killing that slime gave you a gel. If you had wood to combine it with, you could craft a torch. Let's gather some wood.\n ", + "Press " + (object) '\x008D' + " to continue.", + "To chop down a tree you must use an axe. Switch to your axe.", + "Chop down a tree by aiming toward one and holding " + (object) '\x0081' + ".", + "All the items you pick up go into your Inventory. Press " + (object) '\x008B' + " to open the Inventory Menu.", + "The Inventory Menu is split into sections. This area is your main Inventory. The top row of item slots is your Inventory Bar. There are also slots for ammo (such as arrows) or coins.\n ", + "Press " + (object) '\x008D' + " to continue.", + "Use " + (object) '\x0084' + " to move between slots. Use " + (string) (object) '\x008C' + " to pick up and place stacks of items. Use " + (string) (object) '\x0081' + " to move one item at a time.\n ", + "Press " + (object) '\x008D' + " to continue.", + "To permanently delete an item, move it to the Trash slot or press " + (object) '\x008A' + ".\n ", + "Press " + (object) '\x008D' + " to continue.", + "Press " + (object) '\x0083' + " to switch to the Equip section.", + "The Equip section is where you place armor and accessories. Items in Vanity slots appear on your character, but do not give armor bonuses.\n ", + "Press " + (object) '\x008D' + " to continue.", + "If you activate a chest or vendor NPC, a separate section will appear for it.\n ", + "Press " + (object) '\x008D' + " to continue.", + "Press " + (object) '\x0082' + " or " + (string) (object) '\x0083' + " until you switch to the Crafting section.", + "The gel and wood you collected can be crafted into a torch. Select the torch icon and press " + (object) '\x008C' + " to create it.", + "If you want to find out more about a recipe's ingredients, you can press " + (object) '\x008B' + " to enter or exit the Ingredients area.\n ", + "Press " + (object) '\x008D' + " to continue.", + "There are several categories of crafting items. You can switch between them by pressing " + (object) '\x0080' + " and " + (string) (object) '\x0081' + ".", + "Press " + (object) '\x008D' + " to exit Crafting.", + "To create better items and explore the vast underground, you will need to dig down and mine ore with a pickaxe. Switch to your pickaxe.", + "Nearby there is a vein of ore. Mine it all by aiming toward it and holding " + (object) '\x0081' + ".", + "As you dig deeper underground, you will find better ores. Some may require a better pickaxe to mine.\n ", + "Press " + (object) '\x008D' + " to continue.", + "If you get stuck in a hole, you can place wood platforms to get out. Craft 5 wood platforms.", + "Press " + (object) '\x008B' + " to open the Inventory Menu. Switch to Crafting with " + (string) (object) '\x0082' + " and " + (string) (object) '\x0083' + ".", + "Now select the wood platforms in your Inventory Bar.", + "Placing items and structures is easier in the Manual Cursor Mode. Press " + (object) '\x008F' + " to switch your Cursor Mode.", + "In Manual Cursor Mode " + (object) '\x0085' + " acts like a mouse. Aim the cursor and press " + (string) (object) '\x0081' + " to place wood platforms.\n\n", + "Build enough so you can jump out of the hole.", + "Remember you can switch between Cursor Modes at any time by pressing " + (object) '\x008F' + ".\n ", + "Press " + (object) '\x008D' + " to continue.", + "It's dangerous to be outside at night. Build a shelter before it gets dark.\n ", + "Press " + (object) '\x008D' + " to continue.", + "To start, build walls and a ceiling. Give yourself plenty of room inside. If you don't have enough wood (or stone), gather more.", + "\n\nA shelter must be at least 6 blocks high and 10 blocks wide.", + "You'll need a door to get in and out. Remove 3 blocks from the bottom of a wall to make room.", + "\n\nUse an axe to remove wood blocks, or a pickaxe to remove stone blocks.", + "To craft a door, you need a work bench. Craft a work bench and place it inside your house.", + "\nIf you don't have enough wood, chop down more trees.", + "When you are standing near a work bench or other crafting station (such as an anvil or furnace), more recipes will be available to build in your Crafting menu.\n ", + "Press " + (object) '\x008D' + " to continue.", + "Stand near your crafting table and craft a door.", + "\nIf you don't have enough wood, chop down more trees.", + "Now place the door in the space in the wall. This can be tricky, and is easiest in the Manual Cursor Mode, " + (object) '\x008F' + ".", + "You can open or close your door. Aim at it and press " + (object) '\x008D' + ".", + "You're almost done. To make your house safe, you will need to panel the background of your house with walls (such as wood walls).\n ", + "Press " + (object) '\x008D' + " to continue.", + "Craft a bunch of wood walls at your work bench.", + "\nIf you don't have enough wood, chop down more trees.", + "Panel the background of your house with wood walls. This is easiest in the Auto Cursor Mode, " + (object) '\x008F' + ".", + "Make sure to cover the entire background.", + "Your house is now safe. For a room to be livable for NPCs, it needs: a table (such as your work bench), a chair, and a light source (such as a torch).\n ", + "Press " + (object) '\x008D' + " to continue.", + "Craft a chair and place it in your house.", + "Now place a torch on the walls or floor of your house. This is easiest in Manual Cursor Mode, " + (object) '\x008F' + ".", + "This room is now livable for NPCs. As you progress, there are many NPCs who can move into your house if you have enough livable rooms for them.\n ", + "Press " + (object) '\x008D' + " to continue.", + "The Guide is the first NPC who can move into your house. You can talk to him for tips or details about crafting ingredients.\n ", + "Press " + (object) '\x008D' + " to continue.", + "If you ever want to destroy furniture or background walls, you can craft a hammer to do so.\n ", + "Press " + (object) '\x008D' + " to continue.", + "Congratulations, you have completed the tutorial. There are only a few areas to explore on this floating island. When you are ready, exit the tutorial and create yourself a whole new World!\n ", + "Press " + (object) '\x008D' + " to continue.", + null + }; + private static readonly string[] TUTORIAL_DE = new string[80] + { + "Terraria ist ein Spiel, in dem du dich bis ans Ende der Welt wagst und unterwegs bösartige Endgegner besiegst. Dieses Tutorial bringt dir die Grundlagen dafür bei.\n", + "Drücke " + (object) '\x008D' + ", um fortzufahren.", + "Bewege dich mit " + (object) '\x0084' + ".", + "Springe mit " + (object) '\x008C' + ".", + "Du kannst durch Holzplattformen fallen, indem du " + (object) '\x0084' + " nach unten drückst. Versuche, durch eine Plattform zu fallen.", + "Springe heraus, indem du " + (object) '\x008C' + " drückst.", + "Drücke (oder halte) " + (object) '\x0081' + ", um Aktionen mit einem Gegenstand durchzuführen. Ziele mit " + (string) (object) '\x0085' + ".", + "Am oberen Ende des Bildschirms befindet sich deine Inventarleiste. Mit" + (object) '\x0082' + " & " + (string) (object) '\x0083' + " kannst du zwischen Gegenständen wechseln. Wechsle zu deinem Schwert.", + "Ein böses Monster ist erschienen. Besiege es mit deinem Schwert, indem du " + (object) '\x0081' + " drückst.", + "Terraria ist voller Monster, besonders nachts. Zum Glück kannst du viele Waffen finden, die dir helfen.\n", + "Drücke " + (object) '\x008D' + ", um fortzufahren.", + "Wenn du verletzt wirst, regenerierst du dich mit der Zeit wieder. Du kannst dazu auch Nahrung oder Heiltränke verwenden.\n", + "Drücke " + (object) '\x008D' + ", um fortzufahren.", + "Die Zerstörung des Schleims hat dir ein Gel eingebracht. Wenn du Holz hättest, könntest du damit eine Fackel herstellen. Lass uns Holz sammeln.\n", + "Drücke " + (object) '\x008D' + ", um fortzufahren.", + "Zum Fällen eines Baumes musst du eine Axt benutzen. Wechsle zu deiner Axt.", + "Fälle einen Baum, indem du auf ihn zielst und " + (object) '\x0081' + " hältst.", + "Alle von dir gesammelten Gegenstände gehen in dein Inventar. Drücke " + (object) '\x008B' + ", um das Inventarmenü zu öffnen.", + "Das Inventar-Menü ist in Sektionen unterteilt. Diese Sektion ist dein Hauptinventar. Die obere Reihe Gegenstand-Slots ist deine Inventarleiste. Es gibt auch Slots für Munition (z.B. Pfeile) oder Münzen.\n ", + "Drücke " + (object) '\x008D' + ", um fortzufahren.", + "Wechsle mit " + (object) '\x0084' + " zwischen den Slots. Nimm mit " + (string) (object) '\x008C' + " einen Stapel von Gegenständen auf und platziere ihn. Bewege jeweils einen Gegenstand mit " + (string) (object) '\x0081' + ".\n ", + "Drücke " + (object) '\x008D' + ", um fortzufahren.", + "Um einen Gegenstand für immer zu löschen, lege ihn auf den Müll-Slot oder drücke " + (object) '\x008A' + ". \n ", + "Drücke " + (object) '\x008D' + ", um fortzufahren.", + "Wechsle durch Drücken von " + (object) '\x0083' + " zur Ausrüstungssektion.", + "In der Ausrüstungssektion legst du deine Rüstung und dein Zubehör ab. Gegenstände in den Verzierungs-Slots erscheinen an deinem Charakter und verleihen keine Rüstungsboni.\n", + "Drücke " + (object) '\x008D' + ", um fortzufahren.", + "Wenn du eine Schatzkiste oder einen Verkäufer-NPC aktivierst, erscheint dafür eine separate Sektion.\n", + "Drücke " + (object) '\x008D' + ", um fortzufahren.", + "Drücke " + (object) '\x0082' + " oder " + (string) (object) '\x0083' + ", bis du zu der Herstellungssektion wechselst.", + "Die gesammelten Gegenstände Gel und Holz können zu einer Fackel verarbeitet werden. Wähle das Fackelsymbol und drücke " + (object) '\x008C' + ", um sie anzufertigen.", + "Wenn du mehr über eine Anleitung herausfinden möchtest, kannst du mit " + (object) '\x008B' + " die Sparte für Bestandteile anwählen oder verlassen.\n", + "Drücke " + (object) '\x008D' + ", um fortzufahren.", + "Es gibt verschiedene Kategorien von herstellbaren Gegenständen. Durch Drücken von " + (object) '\x0080' + " und " + (string) (object) '\x0081' + " kannst du zwischen ihnen wechseln.", + "Verlasse die Herstellungssektion durch Drücken von " + (object) '\x008D' + ".", + "Du brauchst eine Spitzhacke zur Herstellung besserer Gegenstände und zur Erforschung der Unterwelt. Mit ihr kannst du graben und Erz abbauen. Wechsle zu deiner Spitzhacke.", + "In der Nähe befindet sich eine Erzader. Baue sie ab, indem du auf sie zielst und " + (object) '\x0081' + " hältst.", + "Wenn du tiefer in den Untergrund gräbst, findest du bessere Erze. Für manche brauchst du eine bessere Spitzhacke, um sie abzubauen.\n ", + "Drücke " + (object) '\x008D' + ", um fortzufahren.", + "Wenn du in einem Loch steckst, kannst du Holzplattformen errichten, um herauszukommen. Errichte fünf Holzplattformen.", + "Drücke " + (object) '\x008B' + ", um das Inventarmenü zu öffnen. Wechsle mit " + (string) (object) '\x0082' + " und " + (string) (object) '\x0083' + " zur Herstellungssektion.", + "Wähle nun die Holzplattformen in deiner Inventarleiste.", + "Gegenstände und Bauwerke können im manuellen Cursor-Modus leichter platziert werden. Drücke " + (object) '\x008F' + ", um deinen Cursor-Modus zu wechseln.", + "Im manuellen Cursor-Modus verhält sich " + (object) '\x0085' + " wie eine Maus. Ziele mit dem Cursor und drücke " + (string) (object) '\x0081' + ", um Holzplattformen zu platzieren.\n\n", + "Baue hoch genug, um aus dem Loch herauszuspringen.", + "Denk daran, dass du jederzeit mit " + (object) '\x008F' + " zwischen den Cursor-Modi wechseln kannst.\n", + "Drücke " + (object) '\x008D' + ", um fortzufahren.", + "Es ist gefährlich, nachts draußen zu sein. Baue eine Unterkunft, bevor es dunkel wird.\n ", + "Drücke " + (object) '\x008D' + ", um fortzufahren.", + "Errichte zuerst Wände und ein Dach. Gestalte den Innenraum weiträumig. Falls du nicht genug Holz (oder Steine) hast, sammle mehr davon.", + "\n\nEine Unterkunft muss mindestens sechs Blöcke hoch und zehn Blöcke breit sein.", + "Du benötigst eine Tür, um hinein-und hinauszukommen. Entferne drei Blöcke an der Unterseite einer Wand, um Platz zu schaffen.", + "\n\nBenutze eine Axt, um Holzblöcke zu entfernen oder eine Spitzhacke, um Steinblöcke zu entfernen.", + "Zur Herstellung einer Tür benötigst du eine Werkbank. Errichte eine Werkbank und platziere sie in deinem Haus.", + "\nFälle mehr Bäume, wenn du nicht genug Holz hast.", + "Wenn du in der Nähe einer Werkbank oder anderer Arbeitsgeräte (wie z.B. Amboss oder Schmelzofen) stehst, sind mehr Anleitungen in deinem Herstellungsmenü verfügbar.\n", + "Drücke " + (object) '\x008D' + ", um fortzufahren.", + "Stelle dich neben deine Werkbank und stelle eine Tür her.", + "\nFälle mehr Bäume, wenn du nicht genug Holz hast.", + "Platziere nun die Tür in der Aussparung der Wand. Dies kann knifflig sein und lässt sich am einfachstem im manuellen Cursor-Modus erledigen, " + (object) '\x008F' + ".", + "Du kannst die Tür öffnen oder schließen. Ziele darauf und drücke " + (object) '\x008D' + ".", + "Du bist fast fertig. Um dein Haus sicher zu machen, musst du die Rückseite deines Hauses mit Wänden (wie z.B. Holzwänden) vertäfeln.\n", + "Drücke " + (object) '\x008D' + ", um fortzufahren.", + "Stelle Holzwände auf deiner Werkbank her.", + "\nFälle mehr Bäume, wenn du nicht genug Holz hast.", + "Vertäfle die Rückseite deines Hauses mit Holzwänden. Am einfachsten lässt sich das im manuellen Cursor-Modus erledigen " + (object) '\x008F' + ".", + "Achte darauf, die gesamte Rückseite abzudecken.", + "Dein Haus ist jetzt sicher. Damit NPCs in einem Raum leben können, brauchst du: Tisch (wie z.B. eine Werkbank), Stuhl und Lichtquelle (wie z.B. eine Fackel).\n", + "Drücke " + (object) '\x008D' + ", um fortzufahren.", + "Stelle einen Stuhl her und platziere ihn in deinem Haus.", + "Platziere nun eine Fackel an der Wand oder auf dem Boden des Hauses. Am einfachsten lässt sich das im manuellen Cursor-Modus erledigen " + (object) '\x008F' + ".", + "Dieser Raum kann jetzt von NPCs bewohnt werden. Je weiter du vorankommst, desto mehr NPCs können in dein Haus einziehen, sofern du genug bewohnbare Räume für sie hast.\n", + "Drücke " + (object) '\x008D' + ", um fortzufahren.", + "Der Ratgeber ist der erste NPC, der in dein Haus einziehen kann. Du kannst mit ihm reden und Tipps oder Details zu Herstellungsbestandteilen erhalten.\n", + "Drücke " + (object) '\x008D' + ", um fortzufahren.", + "Wenn du Möbel oder Rückwände zerstören willst, kannst du dafür einen Hammer herstellen.\n", + "Drücke " + (object) '\x008D' + ", um fortzufahren.", + "Herzlichen Glückwunsch, du hast das Tutorial abgeschlossen. Es gibt nur ein paar wenige Areale auf dieser schwimmenden Insel zu erkunden.Beende das Tutorial und erschaffe eine komplett neue Welt, sobald du bereit dazu bist!\n ", + "Drücke " + (object) '\x008D' + ", um fortzufahren.", + null + }; + private static readonly string[] TUTORIAL_FR = new string[80] + { + "Terraria est un jeu qui entraîne le joueur au bout du monde et lui fait affronter les boss infâmes se dressant sur son chemin. Ce didacticiel va vous enseigner les bases.\n", + "Appuyez sur " + (object) '\x008D' + " pour continuer.", + "Utilisez " + (object) '\x0084' + " pour vous déplacer.", + "Appuyez sur " + (object) '\x008C' + " pour sauter.", + "Vous pouvez passer au travers des plateformes en bois en appuyant sur " + (object) '\x0084' + ". Essayez de passer au travers de la plateforme.", + "Maintenant, sautez de la plateforme en appuyant sur " + (object) '\x008C' + ".", + "Appuyez sur (ou maintenez) " + (object) '\x0081' + " pour réaliser des actions avec l'objet tenu. Visez avec " + (string) (object) '\x0085' + ".", + "La barre d'inventaire figure en haut de votre écran. Vous pouvez changer d'objet avec " + (object) '\x0082' + " et " + (string) (object) '\x0083' + ". Maintenant, prenez votre épée.", + "Un monstre diabolique est apparu. Vainquez-le à l'aide de votre épée en appuyant sur " + (object) '\x0081' + ".", + "Terraria grouille de monstres, surtout la nuit. Heureusement, vous pouvez trouver beaucoup d'armes qui vous seront d'une grande aide.\n ", + "Appuyez sur " + (object) '\x008D' + " pour continuer.", + "En cas de blessure, vous guérirez au fil du temps. Vous pouvez également utiliser de la nourriture ou des potions de soin.\n ", + "Appuyez sur " + (object) '\x008D' + " pour continuer.", + "Tuer ce slime vous a rapporté un gel. En le combinant avec du bois, vous pourriez fabriquer une torche. Ramassons du bois.\n ", + "Appuyez sur " + (object) '\x008D' + " pour continuer.", + "Pour couper un arbre, il vous faut une hache. Prenez votre hache.", + "Coupez un arbre en le visant tout en maintenant " + (object) '\x0081' + ".", + "Tous les objets que vous collectez vont dans votre inventaire. Appuyez sur " + (object) '\x008B' + " pour ouvrir le menu Inventaire.", + "Le menu Inventaire est divisé en sections. Cette zone représente votre inventaire principal. La ligne supérieure des emplacements pour objets est votre barre d'inventaire. Il y a également des emplacements pour les munitions (comme les flèches) ou pour les pièces.\n ", + "Appuyez sur " + (object) '\x008D' + " pour continuer.", + "Utilisez " + (object) '\x0084' + " pour vous déplacer dans les emplacements. Utilisez " + (string) (object) '\x008C' + " pour prendre et placer des piles d'objets. Utilisez " + (string) (object) '\x0081' + " pour déplacer un seul objet à la fois.\n ", + "Appuyez sur " + (object) '\x008D' + " pour continuer.", + "Pour supprimer définitivement un objet, placez-le sur l'emplacement Poubelle ou appuyez sur " + (object) '\x008A' + ". \n ", + "Appuyez sur " + (object) '\x008D' + " pour continuer.", + "Appuyez sur " + (object) '\x0083' + " pour passer à la section Équiper.", + "La section Équiper est celle dans laquelle vous placez vos armures et vos accessoires. Les objets des emplacements Vanité apparaissent sur votre personnage, mais ne confèrent aucun bonus d'armure.\n ", + "Appuyez sur " + (object) '\x008D' + " pour continuer.", + "Une section séparée apparaîtra si vous activez un coffre ou un PNJ vendeur.\n ", + "Appuyez sur " + (object) '\x008D' + " pour continuer.", + "Appuyez sur " + (object) '\x0082' + " ou " + (string) (object) '\x0083' + " jusqu'à la section Artisanat.", + "Vous pouvez combiner le gel et le bois que vous avez collectés pour fabriquer une torche. Sélectionnez l'icône de la torche et appuyez sur " + (object) '\x008C' + " pour la créer.", + "Si vous voulez en savoir plus sur les ingrédients d'une recette, vous pouvez appuyer sur " + (object) '\x008B' + " pour entrer dans la zone Ingrédients ou en sortir.\n ", + "Appuyez sur " + (object) '\x008D' + " pour continuer.", + "Il existe plusieurs catégories d'objets d'artisanat. Vous pouvez les consulter en appuyant sur " + (object) '\x0080' + " et " + (string) (object) '\x0081' + ".", + "Appuyez sur " + (object) '\x008D' + " pour quitter Artisanat.", + "Pour créer de meilleurs objets et explorer les immenses souterrains, vous devrez creuser et extraire du minerai à l'aide d'une pioche. Prenez votre pioche.", + "Il y a une veine de minerai dans les environs. Exploitez-la entièrement en la visant tout en maintenant " + (object) '\x0081' + ".", + "En creusant plus profondément, vous trouverez de meilleurs minerais. Vous aurez peut-être besoin d'une pioche plus solide pour en extraire certains.\n ", + "Appuyez sur " + (object) '\x008D' + " pour continuer.", + "Si vous êtes dans un trou, vous pouvez placer des plateformes en bois pour en sortir. Fabriquez 5 plateformes en bois.", + "Appuyez sur " + (object) '\x008B' + " pour ouvrir le menu Inventaire. Accédez à Artisanat avec " + (string) (object) '\x0082' + " et " + (string) (object) '\x0083' + ".", + "Sélectionnez les plateformes en bois dans votre barre d'inventaire.", + "Le mode Curseur manuel permet de placer des objets et structures plus facilement. Appuyez sur " + (object) '\x008F' + " pour changer le mode Curseur.", + "En mode Curseur manuel, " + (object) '\x0085' + " a la même fonction qu'une souris. Visez avec le curseur et appuyez sur " + (string) (object) '\x0081' + " pour placer les plateformes en bois.\n\n", + "Construisez-en assez pour pouvoir sortir du trou.", + "N'oubliez pas que vous pouvez changer de mode Curseur à tout moment en appuyant sur " + (object) '\x008F' + ".\n ", + "Appuyez sur " + (object) '\x008D' + " pour continuer.", + "C'est dangereux d'être dehors quand il fait nuit. Construisez un abri avant la tombée de la nuit.\n", + "Appuyez sur " + (object) '\x008D' + " pour continuer.", + "Pour commencer, construisez les murs et le plafond. Accordez-vous beaucoup d'espace intérieur. Si vous n'avez pas assez de bois (ou de pierres), collectez-en plus.", + "\n\nUn abri doit avoir au moins 6 blocs de hauteur et 10 blocs de largeur.", + "Vous aurez besoin d'une porte pour entrer et sortir. Supprimez 3 blocs du bas d'un des murs pour réserver cet espace.", + "\n\nUtilisez une hache pour supprimer les blocs de bois ou une pioche pour supprimer les blocs de pierre.", + "Vous aurez besoin d'un établi pour fabriquer une porte. Fabriquez un établi et placez-le dans votre maison.", + "\nSi vous n'avez pas assez de bois, coupez plus d'arbres.", + "Lorsque vous vous tenez près d'un établi ou d'une autre station d'artisanat (comme une enclume ou une fournaise), de nouvelles recettes apparaîtront dans votre menu Artisanat.\n '", + "Appuyez sur " + (object) '\x008D' + " pour continuer.", + "Placez-vous à côté de votre établi et fabriquez une porte.", + "\nSi vous n'avez pas assez de bois, coupez plus d'arbres.", + "Placez maintenant la porte dans l'espace réservé du mur. Ceci peut s'avérer délicat et le mode Curseur manuel vous facilitera la tâche, " + (object) '\x008F' + ".", + "Vous pouvez ouvrir ou fermer votre porte. Visez-la et appuyez sur " + (object) '\x008D' + ".", + "C'est presque fini. Pour sécuriser votre maison, vous devrez en recouvrir le fond de murs (par exemple, des murs en bois).\n ", + "Appuyez sur " + (object) '\x008D' + " pour continuer.", + "Fabriquez une réserve de murs en bois à votre établi.", + "\nSi vous n'avez pas assez de bois, coupez plus d'arbres.", + "Recouvrez le fond de votre maison de murs en bois. Le mode Curseur auto vous facilitera la tâche, " + (object) '\x008F' + ".", + "Veillez à bien recouvrir la totalité du mur du fond.", + "Votre maison est maintenant sûre. Afin qu'un PNJ puisse vivre dans une chambre, il faut : une table (par exemple, votre établi), une chaise et une source de lumière (par exemple, une torche).\n ", + "Appuyez sur " + (object) '\x008D' + " pour continuer.", + "Fabriquez une chaise et placez-la dans votre maison.", + "Placez maintenant une torche aux murs ou sur le sol de votre maison. Le mode Curseur manuel vous facilitera la tâche, " + (object) '\x008F' + ".", + "Cette pièce est désormais habitable pour les PNJ. Au fur et à mesure de votre progression, plusieurs PNJ pourront s'installer dans votre maison si vous avez suffisamment de chambres habitables.\n ", + "Appuyez sur " + (object) '\x008D' + " pour continuer.", + "Le guide est le premier PNJ à pouvoir s'installer dans votre maison. Vous pouvez lui parler pour obtenir des conseils et des détails sur les ingrédients d'artisanat.\n ", + "Appuyez sur " + (object) '\x008D' + " pour continuer.", + "Vous pouvez fabriquer un marteau si jamais vous souhaitez détruire un meuble ou les murs du fond.\n ", + "Appuyez sur " + (object) '\x008D' + " pour continuer.", + "Félicitations, vous avez achevé le didacticiel. Il n'y a que quelques zones à explorer sur cette île flottante.Quand vous serez prêt(e), quittez le didacticiel et créez-vous un monde complètement nouveau !\n ", + "Appuyez sur " + (object) '\x008D' + " pour continuer.", + null + }; + private static readonly string[] TUTORIAL_IT = new string[80] + { + "Terraria è un gioco d'avventura per spingersi ai confini del Mondo e sconfiggere i perfidi boss sul tuo cammino. Questo tutorial te ne insegnerà le basi.\n", + "Premi " + (object) '\x008D' + " per continuare.", + "Utilizza " + (object) '\x0084' + " per spostarti.", + "Premi " + (object) '\x008C' + " per saltare.", + "Puoi passare attraverso le piattaforme di legno, premendo in giù " + (object) '\x0084' + ". Prova a passare attraverso una piattaforma di legno.", + "Quindi salta fuori, premendo " + (object) '\x008C' + ".", + "Premi (o tieni premuto) " + (object) '\x0081' + " per eseguire un'azione con l'oggetto in uso. Punta con " + (string) (object) '\x0085' + ".", + "La barra dell'Inventario si trova nella parte superiore dello schermo. È possibile passare da un oggetto all'altro con " + (object) '\x0082' + " & " + (string) (object) '\x0083' + ". Adesso passa alla spada.", + "È apparso un mostro malvagio. Sconfiggilo con la spada, premendo " + (object) '\x0081' + ".", + "Terraria è piena di mostri, specialmente di notte. Per fortuna, puoi trovare molte armi che ti saranno di grande aiuto.\n ", + "Premi " + (object) '\x008D' + " per continuare.", + "Se ti fai male, guarirai col tempo. Puoi anche usare del cibo o pozioni di guarigione.\n ", + "Premi " + (object) '\x008D' + " per continuare.", + "L'uccisione dello Slime ti ha fornito della gelatina. Combinandola con la legna, otterrai una torcia. Raccogliamo un po' di legna!\n ", + "Premi " + (object) '\x008D' + " per continuare.", + "Per abbattere un albero userai un'ascia. Passa all'ascia.", + "Per abbattere un albero, puntane uno e tieni premuto " + (object) '\x0081' + ".", + "Tutti gli oggetti raccolti vanno nell'Inventario. Premi " + (object) '\x008B' + " per aprire il menu dell'Inventario.", + "Il menu dell'Inventario è diviso in sezioni. Quest'area costituisce l'Inventario principale. La riga superiore degli slot degli oggetti è la tua barra dell'Inventario. Inoltre, sono presenti slot per le munizioni (es. frecce) o per le monete.\n ", + "Premi " + (object) '\x008D' + " per continuare.", + "Utilizza " + (object) '\x0084' + " per spostarti da uno slot all'altro. Utilizza " + (string) (object) '\x008C' + " per raccogliere e posizionare gli oggetti accumulati. Utilizza " + (string) (object) '\x0081' + " per spostare un oggetto alla volta.\n ", + "Premi " + (object) '\x008D' + " per continuare.", + "Sposta l'oggetto nella sezione del Cestino o premi " + (object) '\x008A' + ", per eliminarlo definitivamente. \n ", + "Premi " + (object) '\x008D' + " per continuare.", + "Premi " + (object) '\x0083' + " per passare alla sezione Equipaggiamento.", + "Nella sezione Equipaggiamento si trovano armature e accessori. Gli oggetti negli slot di Estetica sappaiono sul personaggio, ma non forniscono bonus per le armature.\n ", + "Premi " + (object) '\x008D' + " per continuare.", + "Se attivi una cassa o un venditore PNG, apparirà una sezione apposita.\n ", + "Premi " + (object) '\x008D' + " per continuare.", + "Premi " + (object) '\x0082' + " o " + (string) (object) '\x0083' + " finché non passi alla sezione Creazione Oggetti.", + "Con la gelatina e la legna raccolte puoi creare una torcia. Seleziona l'icona della torcia e premi " + (object) '\x008C' + " per crearla.", + "Per ottenere maggiori informazioni sugli ingredienti delle formule, premi " + (object) '\x008B' + " per entrare o uscire dall'area Ingredienti.\n ", + "Premi " + (object) '\x008D' + " per continuare.", + "Ci sono diverse categorie di oggetti da creare.Puoi scorrerli premendo " + (object) '\x0080' + " e " + (string) (object) '\x0081' + ".", + "Premi " + (object) '\x008D' + " per uscire dalla sezione Creazione Oggetti.", + "È necessario scavare ed estrarre minerali con un piccone per creare oggetti migliori ed esplorare gli immensi sotterranei. Passa al piccone.", + "C'è un filone di minerali nei paraggi. Estrailo completamente, puntando su di esso e tenendo premuto " + (object) '\x0081' + ".", + "Quanto più scavi in profondità, tanto migliori saranno i minerali. Alcuni di questi richiedono un piccone migliore per essere estratti.\n ", + "Premi " + (object) '\x008D' + " per continuare.", + "Se resti bloccato in un buco, è possibile posizionare delle piattaforme di legno per uscire. Crea 5 piattaforme di legno.", + "Premi " + (object) '\x008B' + " per aprire il menu dell'Inventario. Passa alla sezione Creazione Oggetti premendo " + (string) (object) '\x0082' + " e " + (string) (object) '\x0083' + ".", + "Ora seleziona le piattaforme di legno dalla barra dell'Inventario", + "È più facile posizionare oggetti e strutture nella modalità Cursore Manuale. Premi " + (object) '\x008F' + " per cambiare modalità Cursore.", + "Nella modalità Cursore Manuale, " + (object) '\x0085' + " funge da mouse. Punta il cursore e premi " + (string) (object) '\x0081' + " per posizionare le piattaforme di legno.\n\n", + "Costruisci abbastanza piattaforme per saltare fuori dal buco.", + "Ricorda che puoi passare da una modalità Cursore all'altra in qualunque momento, premendo " + (object) '\x008F' + ".\n ", + "Premi " + (object) '\x008D' + " per continuare.", + "È pericoloso trovarsi fuori di notte. Costruisci un rifugio prima che faccia buio!\n ", + "Premi " + (object) '\x008D' + " per continuare.", + "Inizia a costruire i muri e il soffitto. Crea un ambiente spazioso e raccogli altra legna (o pietre) se non ne possiedi abbastanza.", + "\n\nIl rifugio deve essere alto almeno 6 blocchi e largo 10 blocchi.", + "Ti serve una porta per entrare e uscire. Rimuovi 3 blocchi dalla parte inferiore di un muro per fare spazio.", + "\n\nUtilizza un'ascia per rimuovere i blocchi di legno o un piccone per rimuovere i blocchi di pietra.", + "Per fare una porta ti serve un banco da lavoro. Crea un banco da lavoro e posizionalo all'interno dell'abitazione.", + "\nAbbatti altri alberi se non possiedi abbastanza legna.", + "Quando sei vicino a un banco da lavoro o a un'altra unità per la creazione (es. un'incudine o una fornace), nel menu Creazione Oggetti saranno disponibili più formule.\n ", + "Premi " + (object) '\x008D' + " per continuare.", + "Avvicinati al banco da lavoro e fai una porta.", + "\nAbbatti altri alberi se non possiedi abbastanza legna.", + "Adesso posiziona la porta nello spazio creato nel muro. È complicato, ma risulta più facile nella modalità Cursore Manuale " + (object) '\x008F' + ".", + "Puoi aprire e chiudere la porta. Punta su di essa e premi " + (object) '\x008D' + ".", + "Ci sei quasi! Per rendere sicura l'abitazione, è necessario rivestire lo sfondo di quest'ultima con dei muri (es. muri di legno).\n ", + "Premi " + (object) '\x008D' + " per continuare.", + "Crea un set di muri di legno sul banco da lavoro.", + "\nAbbatti altri alberi se non possiedi abbastanza legna.", + "Rivesti lo sfondo dell'abitazione con muri di legno. Il compito risulta più facile nella modalità Cursore Automatico, " + (object) '\x008F' + ".", + "Assicurati di coprire l'intero sfondo.", + "L'abitazione ora è sicura. Perché un PNG possa abitare una stanza sono necessari: un tavolo (es. banco da lavoro), una sedia e una fonte di illuminazione (es. torcia).\n ", + "Premi " + (object) '\x008D' + " per continuare.", + "Crea una sedia e posizionala all'interno dell'abitazione.", + "Quindi posiziona una torcia sui muri o sul pavimento dell'abitazione. Il compito è più facile nella modalità Cursore Manuale " + (object) '\x008F' + ".", + "Questa stanza è a misura di PNG! Man mano che avanzi, molti PNG potranno trasferirsi nell'abitazione se vi sono abbastanza stanze abitabili a disposizione.\n ", + "Premi " + (object) '\x008D' + " per continuare.", + "La Guida è il primo PNG che può trasferirsi nell'abitazione. Puoi parlargli per chiedere consigli o informazioni sugli ingredienti per la creazione.\n ", + "Premi " + (object) '\x008D' + " per continuare.", + "È possibile creare un martello per distruggere mobili o muri sullo sfondo.\n ", + "Premi " + (object) '\x008D' + " per continuare.", + "Congratulazioni, hai completato il tutorial! Ci sono solo poche aree da esplorare su quest'isola fluttuante. Quando sei pronto, esci dal tutorial e crea un mondo completamente nuovo!\n ", + "Premi " + (object) '\x008D' + " per continuare.", + null + }; + private static readonly string[] TUTORIAL_ES = new string[80] + { + "Terraria es un juego que te permite vivir aventuras en los confines de la tierra y derrotar a los malvados jefes que se crucen en tu camino. Con este tutorial te familiarizarás con los principios básicos.\n", + "Pulsa " + (object) '\x008D' + " para continuar.", + "Usa " + (object) '\x0084' + " para moverte.", + "Pulsa " + (object) '\x008C' + " para saltar.", + "Puedes dejarte caer por las plataformas de madera pulsando hacia abajo " + (object) '\x0084' + ". Intenta dejarte caer por la plataforma.", + "Ahora, salta pulsando " + (object) '\x008C' + ".", + "Pulsa (o mantén presionado) " + (object) '\x0081' + " para realizar acciones con el objeto actual. Apunta con " + (string) (object) '\x0085' + ".", + "La barra de inventario está en la parte superior de la pantalla. Puedes desplazarte entre los objetos pulsando " + (object) '\x0082' + " & " + (string) (object) '\x0083' + ". Ahora, cambia a la espada.", + "Ha aparecido un malvado monstruo. Derrótalo con la espada pulsando " + (object) '\x0081' + ".", + "Terraria está llena de monstruos, sobre todo por la noche. Por suerte, hay muchas armas que puedes encontrar para facilitarte la vida.\n ", + "Pulsa " + (object) '\x008D' + " para continuar.", + "Si te hieren, te curarás con el tiempo. También puedes usar comida o pociones sanadoras.\n ", + "Pulsa " + (object) '\x008D' + " para continuar.", + "Si eliminas a ese slime conseguirás un gel. Si tuvieses madera con la que combinarlo, podrías fabricar una antorcha. Vamos a por algo de madera.\n ", + "Pulsa " + (object) '\x008D' + " para continuar.", + "Para talar un árbol debes usar un hacha. Cambia al hacha.", + "Tala un árbol apuntando hacia uno y manteniendo presionado " + (object) '\x0081' + ".", + "Todos los objetos que consigas irán al inventario. Pulsa " + (object) '\x008B' + " para abrir el menú Inventario.", + "El menú Inventario se divide en secciones. Esta zona es tu inventario principal. La barra de inventario es la fila superior de ranuras de objetos. También hay ranuras para monedas y munición (por ejemplo, flechas).\n ", + "Pulsa " + (object) '\x008D' + " para continuar.", + "Usa " + (object) '\x0084' + " para pasar de una ranura a otra. Usa " + (string) (object) '\x008C' + " para coger un objeto y apilarlo. Usa " + (string) (object) '\x0081' + " para mover los objetos de uno en uno.\n ", + "Pulsa " + (object) '\x008D' + " para continuar.", + "Si quieres eliminar un objeto permanentemente, ponlo en la ranura de basura o pulsa " + (object) '\x008A' + ". \n ", + "Pulsa " + (object) '\x008D' + " para continuar.", + "Pulsa " + (object) '\x0083' + " para cambiar a la sección Equipo.", + "En la sección Equipo se colocan la armadura y los accesorios. Los objetos de las ranuras de adornos cambian el aspecto de tu personaje, pero no proporcionan bonificaciones de armadura.\n ", + "Pulsa " + (object) '\x008D' + " para continuar.", + "Si interactúas con un cofre o un PNJ comerciante, aparecerá una sección para el mismo.\n ", + "Pulsa " + (object) '\x008D' + " para continuar.", + "Pulsa " + (object) '\x0082' + " o " + (string) (object) '\x0083' + " para cambiar a la sección Creación.", + "El gel y la madera que has conseguido pueden usarse para fabricar una antorcha. Selecciona el icono de antorcha y pulsa " + (object) '\x008C' + " para crearla.", + "Si quieres obtener más información acerca de los ingredientes de una receta, pulsa " + (object) '\x008B' + " para entrar o salir de la zona de ingredientes.\n ", + "Pulsa " + (object) '\x008D' + " para continuar.", + "Hay varias categorías de objetos que puedes crear. Puedes cambiar entre ellas pulsando " + (object) '\x0080' + " y " + (string) (object) '\x0081' + ".", + "Pulsa " + (object) '\x008D' + " para salir del modo Creación.", + "Para crear objetos mejores y explorar el amplio mundo subterráneo, necesitarás excavar y conseguir minerales con un pico. Cambia al pico.", + "Hay una veta de minerales cerca. Explótala a fondo apuntando hacia ella y manteniendo presionado " + (object) '\x0081' + ".", + "Cuanto más profundo excaves, mejores minerales encontrarás. Algunos minerales requerirán un pico de mejor calidad.\n ", + "Pulsa " + (object) '\x008D' + " para continuar.", + "Si te quedas bloqueado en un agujero, puedes colocar plataformas de madera para salir. Fabrica 5 plataformas de madera.", + "Pulsa " + (object) '\x008B' + " para abrir el menú Inventario. Cambia al modo Creación con " + (string) (object) '\x0082' + " y " + (string) (object) '\x0083' + ".", + "Ahora selecciona las plataformas de madera de la barra de inventario.", + "Colocar objetos y estructuras es más fácil en el modo cursor manual. Pulsa " + (object) '\x008F' + " para cambiar el modo de cursor.", + "En el modo cursor manual, " + (object) '\x0085' + " actúa como un ratón. Apunta con el cursor y pulsa " + (string) (object) '\x0081' + " para colocar plataformas de madera.\n\n", + "Construye suficientes para poder salir del agujero.", + "Recuerda que puedes cambiar entre los modos de cursor en cualquier momento pulsando " + (object) '\x008F' + ".\n ", + "Pulsa " + (object) '\x008D' + " para continuar.", + "Es peligroso estar fuera por la noche. Construye un cobijo antes de que sea tarde.\n ", + "Pulsa " + (object) '\x008D' + " para continuar.", + "Para empezar, construye muros y un techo. Debes dejar bastante espacio dentro. Si no tienes madera o piedras suficientes, consigue más.", + "\n\nLa casa o cobijo debe tener como mínimo 6 bloques de alto y 10 de ancho.", + "Necesitarás una puerta para entrar y salir. Quita 3 bloques de la parte inferior del muro para hacer espacio.", + "\n\nUsa un hacha para eliminar los bloques de madera o un pico para eliminar los bloques de piedra.", + "Para fabricar una puerta necesitarás un banco de trabajo. Crea un banco de trabajo y ponlo dentro de la casa.", + "\nSi no tienes madera suficiente, tala más árboles.", + "Cuando estás cerca de un banco de trabajo o de cualquier objeto de tu taller de creación (como un yunque o una forja), tendrás más recetas disponibles para construir en el menú Creación.\n ", + "Pulsa " + (object) '\x008D' + " para continuar.", + "Ponte cerca de la mesa y construye una puerta.", + "\nSi no tienes madera suficiente, tala más árboles.", + "Ahora coloca la puerta en el espacio de la pared. Esto puede ser algo complicado. Será más fácil si usas el modo cursor manual, " + (object) '\x008F' + ".", + "Puedes abrir o cerrar la puerta. Apunta hacia ella y pulsa " + (object) '\x008D' + ".", + "Ya casi has terminado. Para hacer que la casa sea segura, necesitarás cubrir con muros (por ejemplo, paneles de madera) el fondo de la casa.\n ", + "Pulsa " + (object) '\x008D' + " para continuar.", + "Crea unos cuantos muros de madera en el banco de trabajo.", + "\nSi no tienes madera suficiente, tala más árboles.", + "Cubre el fondo de la casa con muros de madera. Esto es más fácil en el modo cursor automático, " + (object) '\x008F' + ".", + "Asegúrate de cubrir todo el fondo.", + "La casa ya es segura. Para que una habitación sea habitable para los PNJ, necesita: una mesa (como el banco de trabajo), una fuente de luz (como una antorcha) y una silla.\n ", + "Pulsa " + (object) '\x008D' + " para continuar.", + "Crea una silla y ponla dentro de casa.", + "Ahora coloca una antorcha en los muros o en el suelo de la casa. Esto es más fácil en el modo cursor manual, " + (object) '\x008F' + ".", + "A partir de ahora, esta sala podrá ser habitada por los PNJ. Conforme vayas progresando, otros PNJ se mudarán a tu casa si tienes suficientes habitaciones disponibles para ellos.\n ", + "Pulsa " + (object) '\x008D' + " para continuar.", + "El guía es el primer PNJ que se puede mudar a la casa. Puedes hablar con él para recibir consejos o detalles sobre los ingredientes empleados en el proceso de creación.\n ", + "Pulsa " + (object) '\x008D' + " para continuar.", + "Si alguna vez quieres destruir muebles o muros de fondo, puedes crear un martillo para hacerlo.\n ", + "Pulsa " + (object) '\x008D' + " para continuar.", + "¡Enhorabuena, has completado el tutorial! Solo quedan algunas zonas por explorar en esta isla flotante.¡Cuando estés preparado, sal del tutorial y crea todo un mundo nuevo para ti!\n ", + "Pulsa " + (object) '\x008D' + " para continuar.", + null + }; + public const char _LT_ = '\x0080'; + public const char _RT_ = '\x0081'; + public const char _LB_ = '\x0082'; + public const char _RB_ = '\x0083'; + public const char _LS_ = '\x0084'; + public const char _RS_ = '\x0085'; + public const char _DPAD_ = '\x0086'; + public const char _BACK_ = '\x0087'; + public const char _START_ = '\x0088'; + public const char _HOME_ = '\x0089'; + public const char _X_ = '\x008A'; + public const char _Y_ = '\x008B'; + public const char _A_ = '\x008C'; + public const char _B_ = '\x008D'; + public const char _LS_PRESS_ = '\x008E'; + public const char _RS_PRESS_ = '\x008F'; + public const string _LB_RB_ = "\x0082\x0083"; + public const string _RT_A_ = "\x0081\x008C"; + public const string _LT_RT_ = "\x0080\x0081"; + private const char _USE_ = '\x0081'; + private const char _INTERACT_ = '\x008D'; + private const char _INVENTORY_SELECT_ = '\x008C'; + private const char _MOVE_ = '\x0084'; + private const char _CONTROL_MODE_ = '\x0085'; + private const char _JUMP_ = '\x008C'; + private const char _INVENTORY_ = '\x008B'; + private const char _LEAVE_INVENTORY_ = '\x008D'; + private const char _MOVE_CURSOR_ = '\x0085'; + private const char _DROP_ = '\x008A'; + private const string _HB_SCROLL_ = "\x0082\x0083"; + + static Lang() + { + } + + public static string controls(Lang.CONTROLS i) + { + switch (Lang.lang) + { + case 2: + return Lang.CONTROLS_DE[(int) i]; + case 3: + return Lang.CONTROLS_IT[(int) i]; + case 4: + return Lang.CONTROLS_FR[(int) i]; + case 5: + return Lang.CONTROLS_ES[(int) i]; + default: + return Lang.CONTROLS_EN[(int) i]; + } + } + + public static ControlDesc[] controls() + { + switch (Lang.lang) + { + case 2: + return Lang.MENU_CONTROLS_DE; + case 3: + return Lang.MENU_CONTROLS_IT; + case 4: + return Lang.MENU_CONTROLS_FR; + case 5: + return Lang.MENU_CONTROLS_ES; + default: + return Lang.MENU_CONTROLS_EN; + } + } + + public static string itemPrefix(int prefix) + { + switch (Lang.lang) + { + case 2: + return Lang.ITEM_PREFIX_DE[prefix]; + case 3: + return Lang.ITEM_PREFIX_IT[prefix]; + case 4: + return Lang.ITEM_PREFIX_FR[prefix]; + case 5: + return Lang.ITEM_PREFIX_ES[prefix]; + default: + return Lang.ITEM_PREFIX_EN[prefix]; + } + } + + public static string dialog(Player player, int l) + { + string str1 = NPC.chrName[17]; + string str2 = NPC.chrName[18]; + string str3 = NPC.chrName[22]; + string str4 = NPC.chrName[19]; + string str5 = NPC.chrName[20]; + string str6 = NPC.chrName[38]; + string str7 = NPC.chrName[54]; + string str8 = NPC.chrName[107]; + string str9 = NPC.chrName[108]; + string str10 = NPC.chrName[124]; + if (Lang.lang <= 1) + { + switch (l) + { + case 1: + return "I hope a scrawny kid like you isn't all that is standing between us and Cthulu's Eye."; + case 2: + return "Look at that shoddy armor you're wearing. Better buy some more healing potions."; + case 3: + return "I feel like an evil presence is watching me."; + case 4: + return "Sword beats paper! Get one today."; + case 5: + return "You want apples? You want carrots? You want pineapples? We got torches."; + case 6: + return "Lovely morning, wouldn't you say? Was there something you needed?"; + case 7: + return "Night will be upon us soon, friend. Make your choices while you can."; + case 8: + return "You have no idea how much dirt blocks sell for overseas."; + case 9: + return "Ah, they will tell tales of " + player.name + " some day... good ones I'm sure."; + case 10: + return "Check out my dirt blocks; they are extra dirty."; + case 11: + return "Boy, that sun is hot! I do have some perfectly ventilated armor."; + case 12: + return "The sun is high, but my prices are not."; + case 13: + return "Oh, great. I can hear " + str10 + " and " + str2 + " arguing from here."; + case 14: + return "Have you seen Chith...Shith.. Chat... The big eye?"; + case 15: + return "Hey, this house is secure, right? Right? " + player.name + "?"; + case 16: + return "Not even a Blood Moon can stop capitalism. Let's do some business."; + case 17: + return "Keep your eye on the prize, buy a lense!"; + case 18: + return "Kosh, kapleck Mog. Oh sorry, that's klingon for 'Buy something or die.'"; + case 19: + return player.name + " is it? I've heard good things, friend!"; + case 20: + return "I hear there's a secret treasure... oh never mind."; + case 21: + return "Angel Statue you say? I'm sorry, I'm not a junk dealer."; + case 22: + return "The last guy who was here left me some junk... er I mean... treasures!"; + case 23: + return "I wonder if the moon is made of cheese...huh, what? Oh yes, buy something!"; + case 24: + return "Did you say gold? I'll take that off of ya."; + case 25: + return "You better not get blood on me."; + case 26: + return "Hurry up and stop bleeding."; + case 27: + return "If you're going to die, do it outside."; + case 28: + return "What is that supposed to mean?!"; + case 29: + return "I don't think I like your tone."; + case 30: + return "Why are you even here? If you aren't bleeding, you don't need to be here. Get out."; + case 31: + return "WHAT?!"; + case 32: + return "Have you seen that old man pacing around the dungeon? He looks troubled."; + case 33: + return "I wish " + str6 + " would be more careful. I'm getting tired of having to sew his limbs back on every day."; + case 34: + return "Hey, has " + str4 + " mentioned needing to go to the doctor for any reason? Just wondering."; + case 35: + return "I need to have a serious talk with " + str3 + ". How many times a week can you come in with severe lava burns?"; + case 36: + return "I think you look better this way."; + case 37: + return "Eww... What happened to your face?"; + case 38: + return "MY GOODNESS! I'm good, but I'm not THAT good."; + case 39: + return "Dear friends we are gathered here today to bid farewell... Oh, you'll be fine."; + case 40: + return "You left your arm over there. Let me get that for you..."; + case 41: + return "Quit being such a baby! I've seen worse."; + case 42: + return "That's gonna need stitches!"; + case 43: + return "Trouble with those bullies again?"; + case 44: + return "Hold on, I've got some cartoon bandages around here somewhere."; + case 45: + return "Walk it off, " + player.name + ", you'll be fine. Sheesh."; + case 46: + return "Does it hurt when you do that? Don't do that."; + case 47: + return "You look half digested. Have you been chasing slimes again?"; + case 48: + return "Turn your head and cough."; + case 49: + return "That's not the biggest I've ever seen... Yes, I've seen bigger wounds for sure."; + case 50: + return "Would you like a lollipop?"; + case 51: + return "Show me where it hurts."; + case 52: + return "I'm sorry, but you can't afford me."; + case 53: + return "I'm gonna need more gold than that."; + case 54: + return "I don't work for free you know."; + case 55: + return "I don't give happy endings."; + case 56: + return "I can't do anymore for you without plastic surgery."; + case 57: + return "Quit wasting my time."; + case 58: + return "I heard there is a doll that looks very similar to " + str3 + " somewhere in the underworld. I'd like to put a few rounds in it."; + case 59: + return "Make it quick! I've got a date with " + str2 + " in an hour."; + case 60: + return "I want what " + str2 + " is sellin'. What do you mean, she doesn't sell anything?"; + case 61: + return str5 + " is a looker. Too bad she's such a prude."; + case 62: + return "Don't bother with " + str6 + ", I've got all you need right here."; + case 63: + return "What's " + str6 + "'s problem? Does he even realize we sell completely different stuff?"; + case 64: + return "Man, it's a good night not to talk to anybody, don't you think, " + player.name + "?"; + case 65: + return "I love nights like tonight. There is never a shortage of things to kill!"; + case 66: + return "I see you're eyeballin' the Minishark.. You really don't want to know how it was made."; + case 67: + return "Hey, this ain't a movie, pal. Ammo is extra."; + case 68: + return "Keep your hands off my gun, buddy!"; + case 69: + return "Have you tried using purification powder on the ebonstone of the corruption?"; + case 70: + return "I wish " + str4 + " would stop flirting with me. Doesn't he realize I'm 500 years old?"; + case 71: + return "Why does " + str1 + " keep trying to sell me an angel statues? Everyone knows that they don't do anything."; + case 72: + return "Have you seen the old man walking around the dungeon? He doesn't look well at all..."; + case 73: + return "I sell what I want! If you don't like it, too bad."; + case 74: + return "Why do you have to be so confrontational during a time like this?"; + case 75: + return "I don't want you to buy my stuff. I want you to want to buy my stuff, ok?"; + case 76: + return "Dude, is it just me or is there like a million zombies out tonight?"; + case 77: + return "You must cleanse the world of this corruption."; + case 78: + return "Be safe; Terraria needs you!"; + case 79: + return "The sands of time are flowing. And well, you are not aging very gracefully."; + case 80: + return "What's this about me having more 'bark' than bite?"; + case 81: + return "So two goblins walk into a bar, and one says to the other, 'Want to get a Goblet of beer?!"; + case 82: + return "I cannot let you enter until you free me of my curse."; + case 83: + return "Come back at night if you wish to enter."; + case 84: + return "My master cannot be summoned under the light of day."; + case 85: + return "You are far too weak to defeat my curse. Come back when you aren't so worthless."; + case 86: + return "You pathetic fool. You cannot hope to face my master as you are now."; + case 87: + return "I hope you have like six friends standing around behind you."; + case 88: + return "Please, no, stranger. You'll only get yourself killed."; + case 89: + return "You just might be strong enough to free me from my curse..."; + case 90: + return "Stranger, do you possess the strength to defeat my master?"; + case 91: + return "Please! Battle my captor and free me! I beg you!"; + case 92: + return "Defeat my master, and I will grant you passage into the Dungeon."; + case 93: + return "Trying to get past that ebonrock, eh? Why not introduce it to one of these explosives!"; + case 94: + return "Hey, have you seen a clown around?"; + case 95: + return "There was a bomb sitting right here, and now I can't seem to find it..."; + case 96: + return "I've got something for them zombies alright!"; + case 97: + return "Even " + str4 + " wants what I'm selling!"; + case 98: + return "Would you rather have a bullet hole or a grenade hole? That's what I thought."; + case 99: + return "I'm sure " + str2 + " will help if you accidentally lose a limb to these."; + case 100: + return "Why purify the world when you can just blow it up?"; + case 101: + return "If you throw this one in the bathtub and close all the windows, it'll clear your sinuses and pop your ears!"; + case 102: + return "Wanna play Fuse Chicken?"; + case 103: + return "Hey, could you sign this Griefing Waiver?"; + case 104: + return "NO SMOKING IN HERE!!"; + case 105: + return "Explosives are da' bomb these days. Buy some now!"; + case 106: + return "It's a good day to die!"; + case 107: + return "I wonder what happens if I... (BOOM!)... Oh, sorry, did you need that leg?"; + case 108: + return "Dynamite, my own special cure-all for what ails ya."; + case 109: + return "Check out my goods; they have explosive prices!"; + case 110: + return "I keep having vague memories of tying up a woman and throwing her in a dungeon."; + case 111: + return "... we have a problem! It's a Blood Moon out there!"; + case 112: + return "T'were I younger, I would ask " + str2 + " out. I used to be quite the lady killer."; + case 113: + return "That Red Hat of yours looks familiar..."; + case 114: + return "Thanks again for freeing me from my curse. Felt like something jumped up and bit me."; + case 115: + return "Mama always said I would make a great tailor."; + case 116: + return "Life's like a box of clothes; you never know what you are gonna wear!"; + case 117: + return "Of course embroidery is hard! If it wasn't hard, no one would do it! That's what makes it great."; + case 118: + return "I know everything they is to know about the clothierin' business."; + case 119: + return "Being cursed was lonely, so I once made a friend out of leather. I named him Wilson."; + case 120: + return "Thank you for freeing me, human. I was tied up and left here by the other goblins. You could say that we didn't get along very well."; + case 121: + return "I can't believe they tied me up and left me here just for pointing out that they weren't going east!"; + case 122: + return "Now that I'm an outcast, can I throw away the spiked balls? My pockets hurt."; + case 123: + return "Looking for a gadgets expert? I'm your goblin!"; + case 124: + return "Thanks for your help. Now, I have to finish pacing around aimlessly here. I'm sure we'll meet again."; + case 125: + return "I thought you'd be taller."; + case 126: + return "Hey...what's " + str10 + " up to? Have you...have you talked to her, by chance?"; + case (int) sbyte.MaxValue: + return "Hey, does your hat need a motor? I think I have a motor that would fit exactly in that hat."; + case 128: + return "Yo, I heard you like rockets and running boots, so I put some rockets in your running boots."; + case 129: + return "Silence is golden. Duct tape is silver."; + case 130: + return "YES, gold is stronger than iron. What are they teaching these humans nowadays?"; + case 131: + return "You know, that mining helmet-flipper combination was a much better idea on paper."; + case 132: + return "Goblins are surprisingly easy to anger. In fact, they could start a war over cloth!"; + case 133: + return "To be honest, most goblins aren't exactly rocket scientists. Well, some are."; + case 134: + return "Do you know why we all carry around these spiked balls? Because I don't."; + case 135: + return "I just finished my newest creation! This version doesn't explode violently if you breathe on it too hard."; + case 136: + return "Goblin thieves aren't very good at their job. They can't even steal from an unlocked chest!"; + case 137: + return "Thanks for saving me, friend! This bondage was starting to chafe."; + case 138: + return "Ohh, my hero!"; + case 139: + return "Oh, how heroic! Thank you for saving me, young lady!"; + case 140: + return "Oh, how heroic! Thank you for saving me, young man!"; + case 141: + return "Now that we know each other, I can move in with you, right?"; + case 142: + return "Well, hi there, " + str3 + "! What can I do for you today?"; + case 143: + return "Well, hi there, " + str6 + "! What can I do for you today?"; + case 144: + return "Well, hi there, " + str8 + "! What can I do for you today?"; + case 145: + return "Well, hi there, " + str2 + "! What can I do for you today?"; + case 146: + return "Well, hi there, " + str10 + "! What can I do for you today?"; + case 147: + return "Well, hi there, " + str5 + "! What can I do for you today?"; + case 148: + return "Want me to pull a coin from behind your ear? No? Ok."; + case 149: + return "Do you want some magic candy? No? Ok."; + case 150: + return "I make a rather enchanting hot chocolate if you'd be inter... No? Ok."; + case 151: + return "Are you here for a peek at my crystal ball?"; + case 152: + return "Ever wanted an enchanted ring that turns rocks into slimes? Well neither did I."; + case 153: + return "Someone once told me friendship is magic. That's ridiculous. You can't turn people into frogs with friendship."; + case 154: + return "I can see your future now... You will buy a lot of items from me!"; + case 155: + return "I once tried to bring an Angel Statue to life. It didn't do anything."; + case 156: + return "Thanks! It was just a matter of time before I ended up like the rest of the skeletons down here."; + case 157: + return "Hey, watch where you're going! I was over there a little while ago!"; + case 158: + return "Hold on, I've almost got wifi going down here."; + case 159: + return "But I was almost done putting blinking lights up here!"; + case 160: + return "DON'T MOVE. I DROPPED MY CONTACT."; + case 161: + return "All I want is for the switch to make the... What?!"; + case 162: + return "Oh, let me guess. Didn't buy enough wire. Idiot."; + case 163: + return "Just-could you just... Please? Ok? Ok. Ugh."; + case 164: + return "I don't appreciate the way you're looking at me. I am WORKING right now."; + case 165: + return "Hey, " + player.name + ", did you just come from " + str8 + "'s? Did he say anything about me by chance?"; + case 166: + return str4 + " keeps talking about pressing my pressure plate. I told him it was for stepping on."; + case 167: + return "Always buy more wire than you need!"; + case 168: + return "Did you make sure your device was plugged in?"; + case 169: + return "Oh, you know what this house needs? More blinking lights."; + case 170: + return "You can tell a Blood Moon is out when the sky turns red. There is something about it that causes monsters to swarm."; + case 171: + return "Hey, buddy, do you know where any deathweed is? Oh, no reason; just wondering, is all."; + case 172: + return "If you were to look up, you'd see that the moon is red right now."; + case 173: + return "You should stay indoors at night. It is very dangerous to be wandering around in the dark."; + case 174: + return "Greetings, " + player.name + ". Is there something I can help you with?"; + case 175: + return "I am here to give you advice on what to do next. It is recommended that you talk with me anytime you get stuck."; + case 176: + return "They say there is a person who will tell you how to survive in this land... oh wait. That's me."; + case 177: + return "You can use your pickaxe to dig through dirt, and your axe to chop down trees. Just place your cursor over the tile and press " + (object) '\x0081' + "!"; + case 178: + return "If you want to survive, you will need to create weapons and shelter. Start by chopping down trees and gathering wood."; + case 179: + return "Press " + (object) '\x008B' + "to access your crafting menu. When you have enough wood, create a workbench. This will allow you to create more complicated things, as long as you are standing close to it."; + case 180: + return "You can build a shelter by placing wood or other blocks in the world. Don't forget to create and place walls."; + case 181: + return "Once you have a wooden sword, you might try to gather some gel from the slimes. Combine wood and gel to make a torch!"; + case 182: + return "To interact with backgrounds and placed objects, use a hammer!"; + case 183: + return "You should do some mining to find metal ore. You can craft very useful things with it."; + case 184: + return "Now that you have some ore, you will need to turn it into a bar in order to make items with it. This requires a furnace!"; + case 185: + return "You can create a furnace out of torches, wood, and stone. Make sure you are standing near a work bench."; + case 186: + return "You will need an anvil to make most things out of metal bars."; + case 187: + return "Anvils can be crafted out of iron, or purchased from a merchant."; + case 188: + return "Underground are crystal hearts that can be used to increase your max life. You will need a hammer to obtain them."; + case 189: + return "If you gather 10 fallen stars, they can be combined to create an item that will increase your magic capacity."; + case 190: + return "Stars fall all over the world at night. They can be used for all sorts of usefull things. If you see one, be sure to grab it because they disappear after sunrise."; + case 191: + return "There are many different ways you can attract people to move in to our town. They will of course need a home to live in."; + case 192: + return "In order for a room to be considered a home, it needs to have a door, chair, table, and a light source. Make sure the house has walls as well."; + case 193: + return "Two people will not live in the same home. Also, if their home is destroyed, they will look for a new place to live."; + case 194: + return "You can use the housing interface to assign and view housing."; + case 195: + return "If you want a merchant to move in, you will need to gather plenty of money. 50 silver coins should do the trick!"; + case 196: + return "For a nurse to move in, you might want to increase your maximum life."; + case 197: + return "If you had a gun, I bet an arms dealer might show up to sell you some ammo!"; + case 198: + return "You should prove yourself by defeating a strong monster. That will get the attention of a dryad."; + case 199: + return "Make sure to explore the dungeon thoroughly. There may be prisoners held deep within."; + case 200: + return "Perhaps the old man by the dungeon would like to join us now that his curse has been lifted."; + case 201: + return "Hang on to any bombs you might find. A demolitionist may want to have a look at them."; + case 202: + return "Are goblins really so different from us that we couldn't live together peacefully?"; + case 203: + return "I heard there was a powerfully wizard who lives in these parts. Make sure to keep an eye out for him next time you go underground."; + case 204: + return "If you combine lenses at a demon altar, you might be able to find a way to summon a powerful monster. You will want to wait until night before using it, though."; + case 205: + return "You can create worm bait with rotten chunks and vile powder. Make sure you are in a corrupt area before using it."; + case 206: + return "Demonic altars can usually be found in the corruption. You will need to be near them to craft some items."; + case 207: + return "You can make a grappling hook from a hook and 3 chains. Skeletons found deep underground usually carry hooks, and chains can be made from iron bars."; + case 208: + return "If you see a pot, be sure to smash it open. They contain all sorts of useful supplies."; + case 209: + return "There is treasure hidden all over the world. Some amazing things can be found deep underground!"; + case 210: + return "Smashing a shadow orb will sometimes cause a meteor to fall out of the sky. Shadow orbs can usually be found in the chasms around corrupt areas."; + case 211: + return "You should focus on gathering more heart crystals to increase your maximum life."; + case 212: + return "Your current equipment simply won't do. You need to make better armor."; + case 213: + return "I think you are ready for your first major battle. Gather some lenses from the eyeballs at night and take them to a demon altar."; + case 214: + return "You will want to increase your life before facing your next challenge. Fifteen hearts should be enough."; + case 215: + return "The ebonstone in the corruption can be purified using some powder from a dryad, or it can be destroyed with explosives."; + case 216: + return "Your next step should be to explore the corrupt chasms. Find and destroy any shadow orb you find."; + case 217: + return "There is a old dungeon not far from here. Now would be a good time to go check it out."; + case 218: + return "You should make an attempt to max out your available life. Try to gather twenty hearts."; + case 219: + return "There are many treasures to be discovered in the jungle, if you are willing to dig deep enough."; + case 220: + return "The underworld is made of a material called hellstone. It's perfect for making weapons and armor."; + case 221: + return "When you are ready to challenge the keeper of the underworld, you will have to make a living sacrifice. Everything you need for it can be found in the underworld."; + case 222: + return "Make sure to smash any demon altar you can find. Something good is bound to happen if you do!"; + case 223: + return "Souls can sometimes be gathered from fallen creatures in places of extreme light or dark."; + case 224: + return "Ho ho ho, and a bottle of... Egg Nog!"; + case 225: + return "Care to bake me some cookies?"; + case 226: + return "What? You thought I wasn't real?"; + case 227: + return "I managed to sew your face back on. Be more careful next time."; + case 228: + return "That's probably going to leave a scar."; + case 229: + return "All better. I don't want to see you jumping off anymore cliffs."; + case 230: + return "That didn't hurt too bad, now did it?"; + } + } + else if (Lang.lang == 2) + { + switch (l) + { + case 1: + return "Ich hoffe, du dünnes Hemd bist nicht das Einzige, was zwischen Chtulus Auge und uns steht."; + case 2: + return "Was für eine schäbige Rüstung du trägst. Kauf lieber ein paar Heiltränke."; + case 3: + return "Ich habe das Gefühl, dass mich eine böse Kraft beobachtet."; + case 4: + return "Schwert schlägt Papier! Hol dir noch heute eins."; + case 5: + return "Du möchtest Äpfel? Du willst Karotten? Ananas? Wir haben Fackeln."; + case 6: + return "Ein schöner Morgen, nicht wahr? War da noch was, was du brauchst?"; + case 7: + return "Die Nacht wird bald hereinbrechen, mein Freund. Entscheide dich, solange du kannst."; + case 8: + return "Du hast keine Ahnung, wie gut sich Dreckblöcke nach Übersee verkaufen."; + case 9: + return "Ach, eines Tages werden sie Geschichten über" + player.name + " erzählen ... sicher gute."; + case 10: + return "Schau dir mal meine Dreckblöcke an; die sind wirklich super-dreckig."; + case 11: + return "Junge, Junge, wie die Sonne brennt! Ich hab da eine tolle klimatisierte Rüstung."; + case 12: + return "Die Sonne steht zwar hoch, meine Preise sind's aber nicht."; + case 13: + return "Toll. Ich kann " + str10 + " und " + str2 + " von hier aus diskutieren hören."; + case 14: + return "Hast du Chith ... Shith.. Chat... das große Auge gesehen?"; + case 15: + return "Heh, dieses Haus ist doch wohl sicher? Oder? " + player.name + "?"; + case 16: + return "Nicht mal ein Blutmond kann den Kapitalismus stoppen. Lass uns also Geschäfte machen."; + case 17: + return "Achte auf den Preis, kaufe eine Linse!"; + case 18: + return "Kosh, kapleck Mog. Oha, sorry. Das ist klingonisch für: Kauf oder stirb!"; + case 19: + return player.name + " ist es? Ich habe nur Gutes über dich gehört!"; + case 20: + return "Ich hörte, es gibt einen geheimen Schatz ... oh, vergiss es!"; + case 21: + return "Engelsstatue, sagst du? Tut mir Leid, ich bin kein Nippesverkäufer."; + case 22: + return "Der letzte Typ, der hier war, hinterließ mir einigen Nippes, äh, ich meine ... Schätze!"; + case 23: + return "Ich frage mich, ob der Mond aus Käse ist ... huch, was? Oh, ja, kauf etwas!"; + case 24: + return "Hast du Gold gesagt? Ich nehm' dir das ab."; + case 25: + return "Blute mich bloß nicht voll!"; + case 26: + return "Mach schon und hör mit dem Bluten auf!"; + case 27: + return "Wenn du stirbst, dann bitte draußen."; + case 28: + return "Was soll das heißen?!"; + case 29: + return "Irgendwie gefällt mir dein Ton nicht."; + case 30: + return "Warum bist du überhaupt hier? Wenn du nicht blutest, gehörst du nicht hierher. Raus jetzt!"; + case 31: + return "WAS?!"; + case 32: + return "Hast du den Greis um das Verlies schreiten sehen? Der scheint Probleme zu haben."; + case 33: + return "Ich wünschte, " + str6 + " wäre vorsichtiger. Es nervt mich, täglich seine Glieder zusammennähen zu müssen."; + case 34: + return "Heh, hat " + str4 + " den Grund für einen notwendigen Arztbesuch erwähnt? Ich wundere mich nur."; + case 35: + return "Ich muss mal ein ernsthaftes Wort mit " + str3 + " reden. Wie oft kann man in einer Woche mit schweren Lavaverbrennungen hereinkommen?"; + case 36: + return "Ich finde, du siehst so besser aus."; + case 37: + return "Ähhh ... was ist denn mit deinem Gesicht passiert?"; + case 38: + return "MEINE GÜTE! Ich bin gut, aber ich bin nicht SO gut."; + case 39: + return "Liebe Freunde, wir sind zusammengekommen, um Aufwiedersehen zu sagen ... Ach, es wird schon werden."; + case 40: + return "Du hast deinen Arm da drüben gelassen. Lass mich ihn holen ..."; + case 41: + return "Hör schon auf, wie ein Baby zu plärren! Ich habe Schlimmeres gesehen."; + case 42: + return "Das geht nicht ohne ein paar Stiche!"; + case 43: + return "Schon wieder Ärger mit diesen Rabauken?"; + case 44: + return "Halt durch. Ich hab hier irgendwo ein paar hübsch bedruckte Pflaster."; + case 45: + return "Hör schon auf, " + player.name + ", du überstehst das schon. Mist."; + case 46: + return "Tut es weh, wenn du das machst? Tu das nicht."; + case 47: + return "Du siehst halb verdaut aus. Hast du schon wieder Schleime gejagt?"; + case 48: + return "Dreh deinen Kopf und huste!"; + case 49: + return "Ich habe schon Schlimmeres gesehen ... ja, ganz sicher habe ich schon größere Wunden gesehen."; + case 50: + return "Möchtest du einen Lollipop?"; + case 51: + return "Zeig mir, wo es weh tut."; + case 52: + return "Tut mir leid, aber ich bin viel zu teuer für dich."; + case 53: + return "Dafür brauche ich mehr Gold."; + case 54: + return "Ich arbeite schließlich nicht umsonst, weißt du."; + case 55: + return "Ich verschenke keine Happy-Ends."; + case 56: + return "Ohne eine Schönheitsoperation kann ich nicht mehr für dich tun ."; + case 57: + return "Hör auf, meine Zeit zu verschwenden!"; + case 58: + return "Ich habe gehört, es gibt eine Puppe in der Unterwelt, die " + str3 + " sehr ähnlich sieht. Ich würde sie gerne mit ein paar Kugeln durchlöchern."; + case 59: + return "Mach schnell! Ich habe in einer Stunde ein Date mit " + str2 + "."; + case 60: + return "Ich möchte das, was " + str2 + " verkauft. Was heißt, sie verkauft nichts?"; + case 61: + return str5 + " ist hübsch. Zu dumm, dass sie so prüde ist."; + case 62: + return "Halte dich nicht mit " + str6 + " auf, ich habe alles, was du brauchst, hier."; + case 63: + return "Was ist eigentlich mit " + str6 + " los? Kriegt der mal mit, dass wir ganz andere Sachen verkaufen?"; + case 64: + return "Das ist eine gute Nacht, um mit niemandem zu sprechen, denkst du nicht, " + player.name + "?"; + case 65: + return "Ich liebe Nächte wie diese. Es gibt immer genug zu töten!"; + case 66: + return "Wie ich sehe, starrst du den Minihai an ... Du solltest lieber nicht fragen, wie der entstand."; + case 67: + return "Moment, das ist kein Film, Freundchen. Munition geht extra."; + case 68: + return "Hände weg von meinem Gewehr, Kumpel!"; + case 69: + return "Hast du versucht, das Reinigungspulver auf dem Ebenstein des Verderbens auszuprobieren?"; + case 70: + return "Ich wünschte, " + str4 + " würde aufhören, mit mir zu flirten. Versteht er nicht, dass ich 500 Jahre alt bin?"; + case 71: + return "Warum versucht " + str1 + " , mir Engelsstatuen zu verkaufen? Jeder weiß, dass sie nutzlos sind."; + case 72: + return "Hast du den Greis um das Verlies herumgehen sehen? Der sieht gar nicht gut aus ..."; + case 73: + return "Ich verkaufe, was ich will! Dein Pech, wenn du es nicht magst."; + case 74: + return "Warum bist du in einer Zeit wie dieser so aggressiv?"; + case 75: + return "Ich möchte nicht, dass du meine Sachen kaufst, sondern dass du dir wünschst, sie zu kaufen, okay?"; + case 76: + return "Kommt es mir nur so vor oder sind heute Nacht eine Million Zombies draußen?"; + case 77: + return "Du musst die Welt von diesem Verderben befreien."; + case 78: + return "Pass auf dich auf, Terraria braucht dich!"; + case 79: + return "Der Zahn der Zeit nagt und du alterst nicht gerade würdevoll."; + case 80: + return "Was soll das heißen: Ich belle mehr als ich beiße?"; + case 81: + return "Zwei Goblins kommen in einen Stoffladen. Sagt der eine zum anderen: Sitzt du gerne auf Gobelin?"; + case 82: + return "Ich kann dich erst hineinlassen, wenn du mich von meinem Fluch befreit hast."; + case 83: + return "Komm in der Nacht wieder, wenn du hineinwillst."; + case 84: + return "Mein Meister kann nicht bei Tageslicht herbeigerufen werden."; + case 85: + return "Du bist viel zu schwach, um meinen Fluch zu brechen. Komm wieder, wenn du was aus dir gemacht hast."; + case 86: + return "Du armseliger Wicht. So kannst du meinem Meister nicht gegenübertreten."; + case 87: + return "Ich hoffe, du hast mindestens sechs Freunde, die hinter dir stehen."; + case 88: + return "Bitte nicht, Fremdling. Du bringst dich nur selbst um."; + case 89: + return "Du könntest tatsächlich stark genug sein, um mich von meinem Fluch zu befreien ..."; + case 90: + return "Fremdling, hast du die Kraft, meinen Meister zu besiegen?"; + case 91: + return "Bitte! Bezwinge meinen Kerkermeister und befreie mich! Ich flehe dich an!"; + case 92: + return "Besiege meinen Meister und ich gewähre dir den Zutritt in das Verlies."; + case 93: + return "Du versuchst, hinter den Ebenstein zu kommen? Warum führst du ihn nicht mit diesen Explosiva zusammen?"; + case 94: + return "Heh, hast du hier in der Gegend einen Clown gesehen?"; + case 95: + return "Genau hier war doch eine Bombe und jetzt kann ich sie nicht finden ..."; + case 96: + return "Ich habe etwas für diese Zombies!"; + case 97: + return "Sogar " + str4 + " ist scharf auf meine Waren!"; + case 98: + return "Hättest du lieber das Einschussloch eines Gewehrs oder das einer Granate? Das dachte ich mir."; + case 99: + return "Ich bin sicher, dass " + str2 + " dir helfen wird, wenn du versehentlich ein Glied verlierst."; + case 100: + return "Warum willst du die Welt reinigen, wenn du sie einfach in die Luft jagen kannst?"; + case 101: + return "Wenn du das hier in die Badewanne schmeißt und alle Fenster schließt, durchpustet es deine Nasenhöhlen und dir fliegen die Ohren weg!"; + case 102: + return "Möchtest du mal Grillhähnchen spielen?"; + case 103: + return "Könntest du hier unterschreiben, dass du nicht jammern wirst?"; + case 104: + return "RAUCHEN IST HIER NICHT ERLAUBT!!"; + case 105: + return "Sprengstoffe sind zur Zeit der Knaller. Kauf dir jetzt welche!"; + case 106: + return "Ein schöner Tag, um zu sterben!"; + case 107: + return "Ich frage mich, was passiert, wenn ich ... (BUMM!) ... Oha, sorry, brauchtest du dieses Bein noch?"; + case 108: + return "Dynamit, mein ganz spezielles Heilmittelchen - für alles, was schmerzt."; + case 109: + return "Schau dir meine Waren an - sie haben hochexplosive Preise!"; + case 110: + return "Ich erinnere mich vage an eine Frau, die ich fesselte und in das Verlies warf."; + case 111: + return "... wir haben ein Problem! Es ist Blutmond!"; + case 112: + return "Wenn ich jünger wäre, würde ich mit " + str2 + " ausgehen wollen. Ich war mal ein Womanizer."; + case 113: + return "Dein roter Hut kommt mir bekannt vor ..."; + case 114: + return "Danke nochmals, dass du mich von meinem Fluch befreit hast. Es fühlte sich an, als hätte mich etwas angesprungen und gebissen."; + case 115: + return "Mama sagte immer, dass ich einen guten Schneider abgeben würde."; + case 116: + return "Das Leben ist wie ein Kleiderschrank; du weißt nie, was du tragen wirst!"; + case 117: + return "Natürlich ist die Stickerei schwierig! Wenn es nicht schwierig wäre, würde es niemand machen! Das macht es so großartig."; + case 118: + return "Ich weiß alles, was man über das Kleidergeschäft wissen muss."; + case 119: + return "Das Leben mit dem Fluch war einsam, deshalb fertigte ich mir aus Leder einen Freund an. Ich nannte ihn Wilson."; + case 120: + return "Danke für die Befreiung, Mensch. Ich wurde gefesselt und von den anderen Goblins hier zurückgelassen. Man kann sagen, dass wir nicht besonders gut miteinander auskamen."; + case 121: + return "Ich kann nicht glauben, dass sie mich fesselten und hier ließen, nur um klarzumachen, dass sie nicht nach Osten gehen."; + case 122: + return "Darf ich nun, da ich zu den Verstoßenen gehöre, meine Stachelkugeln wegwerfen? Sie pieken durch die Taschen."; + case 123: + return "Suchst du einen Bastelexperten? Dann bin ich dein Goblin!"; + case 124: + return "Danke für deine Hilfe. Jetzt muss ich erst mal aufhören, hier ziellos herumzuschreiten. Wir begegnen uns sicher wieder."; + case 125: + return "Ich hielt dich für größer."; + case 126: + return "Heh ... was macht " + str10 + " so? Hast du ... hast du vielleicht mit ihr gesprochen?"; + case (int) sbyte.MaxValue: + return "Wäre ein Motor für deinen Hut nicht schick? Ich glaube, ich habe einen Motor, der genau hineinpasst."; + case 128: + return "Ja, ich hab schon gehört, dass du Raketen und Laufstiefel magst. Deshalb habe ich ein paar Raketen in deine Laufstiefel montiert."; + case 129: + return "Schweigen ist Gold. Klebeband ist Silber."; + case 130: + return "Ja! Gold ist stärker als Eisen. Was bringt man den Menschen heutzutage eigentlich bei?"; + case 131: + return "Diese Bergmanns-Helm-Flossen-Kombination sah auf dem Papier viel besser aus."; + case 132: + return "Goblins kann man erstaunlich leicht auf die Palme bringen. Die würden sogar wegen Kleidern einen Krieg anfangen."; + case 133: + return "Um ehrlich zu sein, Goblins sind nicht gerade Genies oder Astroforscher. Naja, bis auf ein paar Ausnahmen."; + case 134: + return "Weißt du eigentlich, warum wir alle diese Stachelkugeln mit uns herumtragen? Ich weiß es nämlich nicht."; + case 135: + return "Meine neuste Erfindung ist fertig! Diese Version explodiert nicht, wenn du sie heftig anhauchst."; + case 136: + return "Goblin-Diebe sind nicht besonders gut in ihrem Job. Sie können nicht mal was aus einer unverschlossenen Truhe klauen."; + case 137: + return "Danke für die Rettung, mein Freund! Die Fesseln fingen an, zu scheuern."; + case 138: + return "Oh, mein Held!"; + case 139: + return "Oh, wie heroisch! Danke für die Rettung, Lady!"; + case 140: + return "Oh, wie heroisch! Danke für die Rettung, mein Herr!"; + case 141: + return "Nun da wir uns kennen, kann ich doch bei dir einziehen, oder?"; + case 142: + return "Hallo, " + str3 + "! Was kann ich heute für dich tun?"; + case 143: + return "Hallo, " + str6 + "! Was kann ich heute für dich tun?"; + case 144: + return "Hallo, " + str8 + "! Was kann ich heute für dich tun?"; + case 145: + return "Hallo, " + str2 + "! Was kann ich heute für dich tun?"; + case 146: + return "Hallo, " + str10 + "! Was kann ich heute für dich tun?"; + case 147: + return "Hallo, " + str5 + "! Was kann ich heute für dich tun?"; + case 148: + return "Möchtest du, dass ich eine Münze hinter deinem Ohr hervorziehe? Nein? Gut."; + case 149: + return "Möchtest du vielleicht magische Süßigkeiten? Nein? Gut."; + case 150: + return "Ich braue eine heiße Zauber-Schokolade, wenn du inter ... Nein? Gut."; + case 151: + return "Bist du hier, um einen Blick in meine Kristallkugel zu werfen?"; + case 152: + return "Hast du dir je einen verzauberten Ring gewünscht, der Steine in Schleime verwandelt? Ich auch nicht."; + case 153: + return "Jemand sagte mir mal, Freundschaft sei magisch. Das ist lächerlich. Du kannst mit Freundschaft keine Menschen in Frösche verwandeln."; + case 154: + return "Jetzt kann ich deine Zukunft sehen ... Du wirst mir eine Menge Items abkaufen!"; + case 155: + return "Ich habe mal versucht, eine Engelsstatue zu beleben. Hat überhaupt nichts gebracht!"; + case 156: + return "Danke! Es wäre nur eine Frage der Zeit gewesen, bis aus mir eines der Skelette hier geworden wäre."; + case 157: + return "Pass auf, wo du hingehst! Ich war vor einer Weile dort drüben."; + case 158: + return "Warte, ich habe es fast geschafft, hier unten WiFi zu installieren."; + case 159: + return "Aber ich hatte es fast geschafft, hier oben blinkende Lichter anzubringen."; + case 160: + return "BEWEG DICH NICHT. ICH HABE MEINE KONTAKTLINSE VERLOREN."; + case 161: + return "Ich möchte nur den Schalter ... Was?!"; + case 162: + return "Oh, lass mich raten. Nicht genügend Kabel gekauft, Idiot."; + case 163: + return "Könntest du vielleicht ... bitte? Ja? Gut. Uff!"; + case 164: + return "Mir gefällt nicht, wie du mich anschaust. Ich ARBEITE gerade."; + case 165: + return "Sag, " + player.name + ", kommst du gerade von " + str8 + "? Hat er vielleicht etwas über mich gesagt?"; + case 166: + return str4 + " spricht immer davon, auf meine Druckplatten zu drücken. Ich habe ihm gesagt, die ist zum Drauftreten."; + case 167: + return "Kaufe immer etwas mehr Kabel als nötig!"; + case 168: + return "Hast du dich vergewissert, dass dein Gerät angeschlossen ist?"; + case 169: + return "Oh, weißt du, was dieses Haus noch braucht? Mehr blinkende Lichter."; + case 170: + return "Du erkennst den Blutmond an der Rotfärbung des Himmels. Irgendetwas daran lässt Monster ausschwärmen."; + case 171: + return "Weißt du vielleicht, wo Todeskraut ist? Nein, es hat keinen Grund. Ich frag mich das bloß."; + case 172: + return "Wenn du mal hochschauen würdest, würdest du bemerken, dass der Mond rot ist."; + case 173: + return "Du solltest in der Nacht drinnen bleiben. Es ist sehr gefährlich, in der Dunkelheit umherzustreifen."; + case 174: + return "Sei gegrüßt, " + player.name + ". Gibt es etwas, das ich für dich tun kann?"; + case 175: + return "Ich bin hier, um dir zu raten, was du als Nächstes tust. Du solltest immer zu mir kommen, wenn du feststeckst."; + case 176: + return "Man sagt, es gibt jemanden, der dir erklaert, wie man in diesem Land überlebt ... oh, Moment. Das bin ja ich."; + case 177: + return "Du kannst deine Spitzhacke zum Graben im Dreck verwenden und deine Axt zum Holzfällen. Bewege einfach deinen Zeiger über das Feld und klicke!"; + case 178: + return "Wenn du überleben willst, musst du Waffen und Zufluchten bauen. Fälle dazu Bäume und sammle das Holz."; + case 179: + return "Drücke " + (object) '\x008B' + " zum Aufrufen des Handwerksmenüs. Wenn du genügend Holz hast, stelle eine Werkbank zusammen. Damit kannst du komplexere Sachen herstellen, solange du nahe genug bei ihr stehst."; + case 180: + return "Du kannst durch Platzieren von Holz oder anderen Blöcken in der Welt eine Zuflucht bauen. Vergiss dabei nicht, auch Wände zu bauen und aufzustellen."; + case 181: + return "Wenn du einmal ein Holzschwert hast, kannst du versuchen, etwas Glibber von den Schleimen zu sammeln. Kombiniere Holz und Glibber zur Herstellung einer Fackel."; + case 182: + return "Verwende einen Hammer zum Interagieren mit Hintergründen und platzierten Objekten!"; + case 183: + return "Du solltest ein bisschen Bergbau betreiben, um Gold zu finden. Du kannst sehr nützliche Dinge damit herstellen."; + case 184: + return "Jetzt, da du etwas Gold hast, musst du es in einen Barren verwandeln, um damit Items zu erschaffen. Dazu brauchst du einen Schmelzofen!"; + case 185: + return "Du kannst einen Schmelzofen aus Fackeln, Holz und Steinen herstellen. Achte dabei darauf, dass du neben einer Werkbank stehst."; + case 186: + return "Zum Herstellen der meisten Sachen aus einem Metallbarren wirst du einen Amboss brauchen."; + case 187: + return "Ambosse können aus Eisen hergestellt oder von einem Händler gekauft werden."; + case 188: + return "Unterirdisch finden sich Kristallherzen, die verwendet werden können, um deine maximale Lebensspanne zu erhöhen. Um sie zu erhalten, benötigst du einen Hammer."; + case 189: + return "Wenn du 10 Sternschnuppen gesammelt hast, können sie zur Herstellung eines Items kombiniert werden. Dieses Item erhöht deine magische Fähigkeit."; + case 190: + return "Sterne fallen nachts auf der ganzen Welt herunter. Sie können für alle möglichen nützlichen Dinge verwendet werden. Wenn du einen erspäht hast, dann greif ihn dir schnell - sie verschwinden nach Sonnenaufgang."; + case 191: + return "Es gibt viele Möglichkeiten, wie du Menschen dazu bewegen kannst, in unsere Stadt zu ziehen. Sie brauchen zuallererst ein Zuhause."; + case 192: + return "Damit ein Raum wie ein Heim wirkt, braucht es eine Tür, einen Stuhl, einen Tisch und eine Lichtquelle. Achte darauf, dass das Haus auch Wände hat."; + case 193: + return "Zwei Menschen werden nicht im selben Haus leben wollen. Außerdem brauchen sie ein neues Zuhause, wenn ihr Heim zerstört wurde."; + case 194: + return "Du kannst das Behausungsinterface verwenden, um ein Haus zuzuweisen und anzuschauen. Öffne dein Inventar und klicke auf das Haus-Symbol."; + case 195: + return "Wenn du willst, dass ein Händler einzieht, brauchst du eine Menge Geld. 50 Silbermünzen sollten aber reichen."; + case 196: + return "Damit eine Krankenschwester einzieht, solltest du deine maximale Lebensspanne erhöhen."; + case 197: + return "Wenn du ein Gewehr hast, taucht garantiert ein Waffenhändler auf, um dir Munition zu verkaufen!"; + case 198: + return "Du solltest dich selbst testen, indem du ein starkes Monster besiegst. Das wird die Aufmerksamkeit eines Dryaden erregen."; + case 199: + return "Erforsche das Verlies wirklich sorgfältig. Tief unten könnte sich ein Gefangener befinden."; + case 200: + return "Vielleicht hat der Greis vom Verlies Lust, bei uns mitzumachen - jetzt da sein Fluch aufgehoben wurde."; + case 201: + return "Behalte alle Bomben, die du findest. Ein Sprengmeister möchte vielleicht einen Blick darauf werfen."; + case 202: + return "Sind Goblins wirklich so anders als wir, dass wir nicht in Frieden zusammenleben können?"; + case 203: + return "Ich hörte, dass ein mächtiger Zauberer in diesen Gebieten lebt. Achte bei deiner nächsten unterirdischen Expedition auf ihn."; + case 204: + return "Wenn du Linsen an einem Dämonenaltar kombinierst, kannst du vielleicht ein mächtiges Monster herbeirufen. Du solltest jedoch bis zur Nacht warten, bevor du es verwendest."; + case 205: + return "Du kannst einen Wurmköder mit verfaulten Fleischbrocken und Ekelpulver erzeugen. Achte aber darauf, dass du dich vor der Verwendung in einem verderbten Gebiet befindest."; + case 206: + return "Dämonenaltäre sind gewöhnlich im Verderben zu finden. Du musst aber nahe bei ihnen stehen, um Items herstellen zu können."; + case 207: + return "Du kannst einen Greifhaken aus einem Haken und 3 Ketten herstellen. Die Skelette tief unter der Erde tragen gewöhnlich Haken bei sich. Die Ketten dazu können aus Eisenbarren gefertigt werden."; + case 208: + return "Wenn du einen Topf siehst, so schlage ihn auf. Töpfe enthalten alle möglichen nützlichen Zubehörteile."; + case 209: + return "Verborgene Schätze sind auf der ganzen Welt zu finden! Einige erstaunliche Dinge sind auch tief unter der Erde aufzuspüren!"; + case 210: + return "Beim Zerschlagen einer Schattenkugel fällt mitunter ein Meteor vom Himmel. Schattenkugeln können normalerweise in den Schluchten bei verderbten Gebieten gefunden werden."; + case 211: + return "Du solltest dich darauf konzentrieren, mehr Kristallherzen zur Erhöhung deiner maximalen Lebensspanne zu sammeln."; + case 212: + return "Deine jetzige Ausrüstung wird einfach nicht ausreichen. Du musst eine bessere Rüstung fertigen."; + case 213: + return "Ich denke, du bist bereit für deinen ersten großen Kampf. Sammle in der Nacht ein paar Linsen von den Augäpfeln und bringe sie zum Dämonenaltar."; + case 214: + return "Du solltest dein Leben verlängern, bevor du die nächste Herausforderung annimmst. 15 Herzen sollten ausreichen."; + case 215: + return "Der Ebenstein im Verderben kann durch Verwendung von etwas Pulver eines Dryaden gereinigt werden oder er kann durch Sprengstoffe zerstört werden."; + case 216: + return "Dein nächster Schritt ist, die verderbten Schluchten zu untersuchen. Suche nach Schattenkugeln und zerstöre sie!"; + case 217: + return "Nicht weit von hier gibt es ein altes Verlies. Dies wäre ein guter Zeitpunkt, es zu untersuchen."; + case 218: + return "Du solltest versuchen, deine Lebensspanne auf das Maximum anzuheben. Versuche, 20 Herzen zu finden."; + case 219: + return "Im Dschungel lassen sich viele Schätze finden, wenn du bereit bist, tief genug zu graben."; + case 220: + return "Die Unterwelt entstand aus einem Material, welches sich Höllenstein nennt. Es ist perfekt geeignet für die Produktion von Waffen und Rüstungen."; + case 221: + return "Wenn du bereit bist, den Wächter der Unterwelt herauszufordern, musst du ein Opfer bringen. Alles was du brauchst, findest du in der Unterwelt."; + case 222: + return "Zerschlage jeden Dämonenaltar, den du findest. Etwas Gutes wird sich ereignen!"; + case 223: + return "Seelen können manchmal von gefallenen Kreaturen an Orten extremen Lichts oder extremer Finsternis aufgesammelt werden."; + case 224: + return "Ho ho ho, und eine Flasche ... Egg Nog!"; + case 225: + return "Würdest du mir ein paar Plätzchen backen?"; + case 226: + return "Was? Du dachtest, ich wäre nicht real?"; + case 227: + return "Es gelang mir, dein Gesicht wieder anzunähen. Sei beim nächsten Mal vorsichtiger."; + case 228: + return "Das wird wahrscheinlich eine Narbe hinterlassen."; + case 229: + return "Alles okay. Ich will nicht, dass du nochmal von irgendwelchen Klippen springst."; + case 230: + return "Das hat nicht allzu weh getan, oder?"; + } + } + else if (Lang.lang == 3) + { + switch (l) + { + case 1: + return "Spero che tra noi e l'Occhio di Cthulhu non ci sia solo un bimbo scarno come te."; + case 2: + return "Guarda la pessima armatura che indossi. Faresti meglio a comprare più pozioni curative."; + case 3: + return "Ho la sensazione che una presenza malvagia mi stia guardando."; + case 4: + return "Spada batte carta! Prendine una oggi."; + case 5: + return "Desideri mele? Carote? Ananas? Abbiamo delle torce."; + case 6: + return "Bella mattina, no? C'era qualcosa di cui avevi bisogno?"; + case 7: + return "Presto si farà notte, amico. Fai le tue scelte finché puoi."; + case 8: + return "Non immagini quanti blocchi di terra si vendono oltreoceano."; + case 9: + return "Ah, racconteranno storie di " + player.name + " un giorno... belle storie ovviamente."; + case 10: + return "Guarda i miei blocchi di terra: sono super terrosi."; + case 11: + return "Ragazzo, quel sole scotta! Ho un'armatura perfettamente ventilata."; + case 12: + return "Il sole è alto, ma i miei prezzi no."; + case 13: + return "Fantastico! Da qui sento " + str10 + " e " + str2 + " discutere."; + case 14: + return "Hai visto Chith... Shith... Chat... Il grande occhio?"; + case 15: + return "Ehi, questa casa è sicura, no? Giusto? " + player.name + "?"; + case 16: + return "Nemmeno una Luna di Sangue può fermare il capitalismo. Facciamo un po' di affari."; + case 17: + return "Tieni d'occhio il premio, compra una lente!"; + case 18: + return "Kosh, kapleck Mog. Oh scusa, in klingon significa 'Compra qualcosa o muori.'"; + case 19: + return "Sei, " + player.name + ", vero? Ho sentito belle cose su di te!"; + case 20: + return "Sento che c'è un tesoro segreto... non importa."; + case 21: + return "Una Statua D'Angelo, dici? Scusa, non tratto cianfrusaglie."; + case 22: + return "L'ultimo ragazzo venuto qui mi lasciò delle cianfrusaglie... o meglio... tesori!"; + case 23: + return "Mi chiedo se la luna sia fatta di formaggio... Uhm, cosa? Oh sì, compra qualcosa!"; + case 24: + return "Hai detto oro? Te lo tolgo io."; + case 25: + return "Niente sangue su di me."; + case 26: + return "Sbrigati e smettila di sanguinare."; + case 27: + return "Se stai per morire, fallo fuori."; + case 28: + return "Cosa vorresti insinuare?!"; + case 29: + return "Quel tuo tono non mi piace."; + case 30: + return "Che ci fai qui? Se non sanguini, non devi stare qui. Via."; + case 31: + return "COSA?!"; + case 32: + return "Hai visto il vecchio che gira intorno alla segreta? Sembra agitato."; + case 33: + return "Vorrei che " + str6 + " fosse più attento. Mi sto stancando di dovergli ricucire gli arti ogni giorno."; + case 34: + return "Ehi, " + str4 + " ha detto di dover andare dal dottore per qualche ragione? Solo per chiedere."; + case 35: + return "Devo parlare seriamente con " + str3 + ". Quante volte a settimana si può venire con gravi ustioni da lava?"; + case 36: + return "Penso che tu stia meglio così."; + case 37: + return "Ehm... Che ti è successo alla faccia?"; + case 38: + return "SANTO CIELO! Sono brava, ma non fino a questo punto."; + case 39: + return "Cari amici, siamo qui riuniti, oggi, per congedarci... Oh, ti riprenderai."; + case 40: + return "Hai lasciato il braccio laggiù. Te lo prendo io..."; + case 41: + return "Smettila di fare il bambino! Ho visto di peggio."; + case 42: + return "Serviranno dei punti!"; + case 43: + return "Di nuovo problemi con quei bulli?"; + case 44: + return "Aspetta, ho i cerotti con i cartoni animati da qualche parte."; + case 45: + return "Cammina, " + player.name + " starai bene. Fiuu."; + case 46: + return "Ti fa male quando lo fai? Non farlo."; + case 47: + return "Sembri mezzo digerito. Hai di nuovo inseguito gli slime?"; + case 48: + return "Gira la testa e tossisci."; + case 49: + return "Non è la ferita più grande che abbia mai visto... Ne ho viste certamente di più grandi."; + case 50: + return "Vuoi un lecca-lecca?"; + case 51: + return "Dimmi dove ti fa male."; + case 52: + return "Scusa, ma non puoi permetterti di avermi."; + case 53: + return "Avrò bisogno di più soldi."; + case 54: + return "Sai che non lavoro gratis."; + case 55: + return "Non faccio lieti fini."; + case 56: + return "Non posso fare più nulla per te senza chirurgia plastica."; + case 57: + return "Smettila di sprecare il mio tempo."; + case 58: + return "Ho sentito che c'è una bambola molto simile a " + str3 + " nel sotterraneo. Vorrei metterci dei proiettili."; + case 59: + return "Veloce! Ho un appuntamento con " + str2 + " tra un'ora."; + case 60: + return "Voglio quello che vende " + str2 + ". In che senso, non vende niente?"; + case 61: + return str5 + " è uno spettacolo. Peccato sia così bigotta."; + case 62: + return "Lascia stare " + str6 + ", qui ho tutto ciò che ti serve."; + case 63: + return "Qual è il problema di " + str6 + "? Almeno lo sa che vendiamo oggetti diversi?"; + case 64: + return "Beh, è una bella notte per non parlare con nessuno, non credi, " + player.name + "?"; + case 65: + return "Mi piacciono le notti come questa. Non mancano mai cose da uccidere!"; + case 66: + return "Vedo che stai addocchiando il Minishark... Meglio che non ti dica di cosa è fatto."; + case 67: + return "Ehi, non è un film, amico. Le munizioni sono extra."; + case 68: + return "Giù le mani dalla mia pistola, amico!"; + case 69: + return "Hai provato a utilizzare la polvere purificatrice sulla pietra d'ebano della corruzione?"; + case 70: + return "Vorrei che " + str4 + " la smettesse di flirtare con me. Non sa che ho 500 anni?"; + case 71: + return "Perché " + str1 + " continua a vendermi statue d'angelo? Lo sanno tutti che non servono a nulla."; + case 72: + return "Hai visto il vecchio che gira intorno alla dungeon? Non ha per niente un bell'aspetto..."; + case 73: + return "Vendo ciò che voglio! Se non ti piace, pazienza."; + case 74: + return "Perché devi essere così conflittuale in un momento come questo?"; + case 75: + return "Non voglio che tu compri la mia roba. Voglio che tu desideri comprarla, ok?"; + case 76: + return "Amico, sbaglio o ci sono tipo un milione di zombie in giro, stanotte?"; + case 77: + return "Devi purificare il mondo da questa corruzione."; + case 78: + return "Sii cauto: Terraria ha bisogno di te!"; + case 79: + return "Il tempo vola e tu, ahimé, non stai invecchiando molto bene."; + case 80: + return "Cos'è questa storia di me che abbaio, ma non mordo?"; + case 81: + return "Due goblin entrano in un bar e uno dice all'altro: 'Vuoi un calice di birra?!' "; + case 82: + return "Non posso farti entrare finché non mi libererai dalla maledizione."; + case 83: + return "Torna di notte se vuoi entrare."; + case 84: + return "Il mio padrone non può essere evocato di giorno."; + case 85: + return "Sei decisamente troppo debole per sconfiggere la mia maledizione. Torna quando servirai a qualcosa."; + case 86: + return "Tu, pazzo patetico. Non puoi sperare di affrontare il mio padrone ora come ora."; + case 87: + return "Spero che tu abbia almeno sei amici che ti coprano le spalle."; + case 88: + return "No, ti prego, straniero. Finirai per essere ucciso."; + case 89: + return "Potresti essere abbastanza forte da liberarmi dalla mia maledizione..."; + case 90: + return "Straniero, hai la forza per sconfiggere il mio padrone?"; + case 91: + return "Ti prego! Sconfiggi chi mi ha catturato e liberami, ti supplico!"; + case 92: + return "Sconfiggi il mio padrone e ti farò passare nella dungeon."; + case 93: + return "Stai provando a superare quella pietra d'ebano, eh? Perché non metterci uno di questi esplosivi!"; + case 94: + return "Ehi, hai visto un clown in giro?"; + case 95: + return "C'era una bomba qui e ora non riesco a trovarla..."; + case 96: + return "Ho qualcosa per quegli zombie, altroché!"; + case 97: + return "Persino " + str4 + " vuole ciò che sto vendendo!"; + case 98: + return "Preferisci avere un buco da proiettile o granata? Ecco ciò che pensavo."; + case 99: + return "Sono sicuro che " + str2 + " ti aiuterà se per caso perderai un arto."; + case 100: + return "Perché purificare il mondo quando potresti farlo saltare in aria?"; + case 101: + return "Se verserai questo nella vasca da bagno e chiuderai tutte le finestre, ti pulirà le cavità nasali e ti sturerà le orecchie."; + case 102: + return "Vuoi giocare a Esplodi-Pollo?"; + case 103: + return "Ehi, potresti firmare questa rinuncia al dolore?"; + case 104: + return "VIETATO FUMARE QUI DENTRO!!"; + case 105: + return "Gli esplosivi vanno a ruba di questi tempi. Comprane un po'!"; + case 106: + return "È un bel giorno per morire!"; + case 107: + return "Mi chiedo cosa succederà se io... (BUM!) ... Oh, scusa, ti serviva quella gamba?"; + case 108: + return "La dinamite, la mia cura speciale per tutto ciò che ti affligge."; + case 109: + return "Guarda i miei prodotti: hanno prezzi esplosivi!"; + case 110: + return "Continuo ad avere vaghi ricordi di aver legato una donna e averla gettata nella dungeon."; + case 111: + return "... abbiamo un problema! C'è una Luna di Sangue là fuori!"; + case 112: + return "Fossi più giovane, chiederei a " + str2 + " di uscire. Avevo un successone con le ragazze."; + case 113: + return "Quel tuo Cappello rosso mi sembra familiare..."; + case 114: + return "Grazie ancora per avermi liberato dalla mia maledizione. Sentivo come qualcosa che saltava e mi mordeva."; + case 115: + return "Mia mamma mi diceva sempre che sarei stato un grande sarto."; + case 116: + return "La vita è come una scatola di vestiti; non sai mai ciò che indosserai!"; + case 117: + return "Ricamare è difficile! Se non fosse così, nessuno lo farebbe! È ciò che lo rende fantastico."; + case 118: + return "So tutto ciò che c'è da sapere riguardo alle attività di sartoria."; + case 119: + return "Nella maledizione ero solo, perciò una volta mi creai un amico di pelle. Lo chiamai Wilson."; + case 120: + return "Grazie per avermi liberato, umano. Sono stato legato e lasciato qui da altri goblin. Si potrebbe dire che non andavamo proprio d'accordo."; + case 121: + return "Non posso credere che mi hanno legato e lasciato qui soltanto per far notare che non andavano verso est!"; + case 122: + return "Ora che sono un escluso, posso buttar via le palle chiodate? Mi fanno male le tasche."; + case 123: + return "Cerchi un esperto di gadget? Sono il tuo goblin!"; + case 124: + return "Grazie per l'aiuto. Ora devo smetterla di gironzolare senza scopo qui attorno. Sono sicuro che ci incontreremo di nuovo."; + case 125: + return "Pensavo fossi più alto."; + case 126: + return "Ehi... cosa sta combinando " + str10 + "? Hai... hai parlato con lei, per caso?"; + case (int) sbyte.MaxValue: + return "Ehi, il tuo cappello ha bisogno di un motore? Credo di averne uno perfettamente adatto."; + case 128: + return "Ciao, ho sentito che ti piacciono i razzi e gli stivali da corsa, così ho messo dei missili nei tuoi stivali."; + case 129: + return "Il silenzio è d'oro. Il nastro adesivo è d'argento."; + case 130: + return "SÌ, l'oro è più forte del ferro. Cosa insegnano al giorno d'oggi a questi umani?"; + case 131: + return "Sai, quella combinazione casco da minatore-pinne era un'idea molto migliore sulla carta."; + case 132: + return "I goblin si irritano molto facilmente. Potrebbero persino scatenare una guerra per i tessuti!"; + case 133: + return "A dire il vero, la maggior parte dei goblin non sono ingegneri aerospaziali. Beh, alcuni sì."; + case 134: + return "Sai perché noi tutti ci portiamo dietro queste palle chiodate? Perché io non lo faccio."; + case 135: + return "Ho appena finito la mia ultima creazione! Questa versione non esplode violentemente se ci si respira troppo forte sopra."; + case 136: + return "I ladri goblin non sono molto furbi. Non sanno nemmeno rubare da una cassa aperta!"; + case 137: + return "Grazie per avermi salvato, amico! Questi legacci iniziavano a irritarmi."; + case 138: + return "Ohh, mio eroe!"; + case 139: + return "Oh, eroica! Grazie per avermi salvato, ragazza!"; + case 140: + return "Oh, eroico! Grazie per avermi salvato, ragazzo!"; + case 141: + return "Ora che ci conosciamo, posso trasferirmi da te, vero?"; + case 142: + return "Bene, ciao, " + str3 + "! Cosa posso fare per te oggi?"; + case 143: + return "Bene, ciao, " + str6 + "! Cosa posso fare per te oggi?"; + case 144: + return "Bene, ciao, " + str8 + "! Cosa posso fare per te oggi?"; + case 145: + return "Bene, ciao, " + str2 + "! Cosa posso fare per te oggi?"; + case 146: + return "Bene, ciao, " + str10 + "! Cosa posso fare per te oggi?"; + case 147: + return "Bene, ciao, " + str5 + "! Cosa posso fare per te oggi?"; + case 148: + return "Vuoi che tiri fuori una moneta da dietro il tuo orecchio? No? Ok."; + case 149: + return "Vuoi dei dolci magici? No? Ok."; + case 150: + return "Posso preparare una cioccalata calda proprio deliziosa se sei inter...No? Ok."; + case 151: + return "Sei qui per dare un'occhiata alla mia sfera di cristallo?"; + case 152: + return "Mai desiderato un anello incantato che trasforma le rocce in slime? Neanch'io."; + case 153: + return "Una volta qualcuno mi disse che l'amicizia è magica. Sciocchezze. Non puoi trasformare le persone in rane con l'amicizia."; + case 154: + return "Ora vedo il tuo futuro... Comprerai molti prodotti da me!"; + case 155: + return "Una volta ho provato a dare la vita a una Statua D'Angelo. Invano."; + case 156: + return "Grazie! Era solo questione di tempo prima che facessi la stessa fine degli scheletri laggiù."; + case 157: + return "Ehi, guarda dove stai andando! Ero laggiù un attimo fa!"; + case 158: + return "Resisti, sono quasi riuscito a portare fin qui il Wi-Fi."; + case 159: + return "Ma ero quasi riuscito a mettere luci intermittenti quassù!"; + case 160: + return "NON MUOVERTI. MI È CADUTA UNA LENTE A CONTATTO."; + case 161: + return "Tutto ciò che voglio è che l'interruttore faccia... Cosa?!"; + case 162: + return "Oh, fammi indovinare. Non hai comprato abbastanza cavi. Idiota."; + case 163: + return "Soltanto-potresti soltanto... Per favore? Ok? Ok. Puah."; + case 164: + return "Non apprezzo il modo in cui mi guardi. Sto LAVORANDO ora."; + case 165: + return "Ehi, " + player.name + ", sei appena stato da " + str8 + "? Ha detto qualcosa di me, per caso?"; + case 166: + return str4 + " continua a dire di aver schiacciato la mia piastra a pressione. Gli ho spiegato che serve proprio a quello."; + case 167: + return "Compra sempre più cavi del necessario!"; + case 168: + return "Ti sei assicurato che il tuo dispositivo fosse collegato?"; + case 169: + return "Oh, sai di cosa ha bisogno questa casa? Di più luci intermittenti."; + case 170: + return "Si può dire che appare una luna di sangue quando il cielo si fa rosso. C'è qualcosa in lei che ridesta i mostri."; + case 171: + return "Ehi, amico, sai dov'è un po' di erba della morte? Scusa, me lo stavo solo chiedendo, tutto qua."; + case 172: + return "Se dovessi alzare lo sguardo, vedresti che la luna è rossa ora."; + case 173: + return "Dovresti stare dentro di notte. È molto pericoloso girare al buio."; + case 174: + return "Saluti, " + player.name + ". Come posso esserti utile?"; + case 175: + return "Sono qui per darti consigli su cosa fare dopo. Ti consiglio di parlare con me ogni volta che sarai nei guai."; + case 176: + return "Si dice ci sia una persona che ti dirà come sopravvivere in questa terra... Aspetta. Sono io."; + case 177: + return "Puoi utilizzare il piccone per scavare nell'immondizia e l'ascia per abbattere gli alberi. Posiziona il cursore sulla mattonella e clicca " + (object) '\x0081' + "!"; + case 178: + return "Se vuoi sopravvivere, dovrai creare armi e un riparo. Inizia abbattendo gli alberi e raccogliendo legna."; + case 179: + return "Clicca su " + (object) '\x008B' + "per accedere al menu Creazione Oggetti. Quando avrai abbastanza legna, crea un banco da lavoro. Così potrai creare oggetti più sofisticati, finché sarai vicino ad esso."; + case 180: + return "Puoi costruirti un riparo con legna o altri blocchi nel mondo. Non dimenticare di creare e sistemare i muri."; + case 181: + return "Una volta che possiederai una spada di legno, puoi provare a raccogliere la gelatina dagli slime. Unisci la legna e la gelatina per creare una torcia!"; + case 182: + return "Per interagire con gli ambienti e gli oggetti posizionati, usa un martello!"; + case 183: + return "Devi praticare un po' di estrazione per trovare minerali metallici. Puoi crearci oggetti molto utili."; + case 184: + return "Ora che hai un po' di minerale, dovrai trasformarlo in una barra per poterci fare degli oggetti. Per questo serve una fornace!"; + case 185: + return "Puoi creare una fornace con torce, legna e pietra. Assicurati di essere vicino a un banco da lavoro."; + case 186: + return "Avrai bisogno di un'incudine per creare la maggior parte degli oggetti dalle barre metalliche."; + case 187: + return "Le incudini possono essere create con del ferro o acquistate da un mercante."; + case 188: + return "Nel Sottoterraneo vi sono cuori di cristallo che possono essere utilizzati per aumentare la tua vita massima. Dovrai avere un martello per ottenerli."; + case 189: + return "Se raccoglierai 10 stelle cadenti, potrai combinarle per creare un oggetto che aumenterà le tue abilità magiche."; + case 190: + return "Le stelle cadono sul mondo di notte. Possono essere utilizzate per ogni tipo di oggetto utile. Se ne vedi una, cerca di afferrarla, poiché scomparirà dopo l'alba."; + case 191: + return "Ci sono diversi modi per convincere le persone a trasferirsi nella tua città. Di sicuro dovranno avere una casa in cui vivere."; + case 192: + return "Perché una stanza sia considerata una casa, ha bisogno di una porta, una sedia, un tavolo e una fonte di illuminazione. Assicurati che la casa abbia anche i muri."; + case 193: + return "Due persone non possono vivere nella stessa casa. Inoltre, se la loro casa verrà distrutta, cercheranno un nuovo posto in cui vivere."; + case 194: + return "Puoi utilizzare l'interfaccia Alloggio per visualizzare e assegnare gli alloggi. Apri l'inventario e clicca sull'icona della casa."; + case 195: + return "Se vuoi che un mercante si trasferisca, dovrai raccogliere molto denaro. Servono 50 monete d'argento!"; + case 196: + return "Se vuoi che un'infermiera si trasferisca, dovrai aumentare la tua vita massima."; + case 197: + return "Se avessi una pistola, scommetto che potrebbe apparire un mercante d'armi per venderti munizioni!"; + case 198: + return "Dovresti metterti alla prova sconfiggendo un mostro forte. Così attirerai l'attenzione di una driade."; + case 199: + return "Esplora attentamente tutta la dungeon. Potrebbero esserci prigionieri nelle zone più profonde."; + case 200: + return "Forse il vecchio della dungeon vorrebbe unirsi a noi, ora che la maledizione è terminata."; + case 201: + return "Arraffa tutte le bombe che potresti trovare. Un esperto di demolizioni potrebbe volerci dare un'occhiata."; + case 202: + return "I goblin sono così diversi da noi che non possiamo convivere in maniera pacifica?"; + case 203: + return "Ho sentito che c'era un potente stregone da queste parti. Tienilo d'occhio la prossima volta che scenderai sottoterra."; + case 204: + return "Se unirai le lenti a un altare dei demoni, potresti trovare un modo per evocare un potente mostro. Ma aspetta che si faccia buio prima di utilizzarlo."; + case 205: + return "Puoi creare un'esca di vermi con pezzi marci e polvere disgustosa. Assicurati di essere in una zona corrotta prima di utilizzarla."; + case 206: + return "Gli altari dei demoni si trovano generalmente nella corruzione. Dovrai essere vicino ad essi per creare oggetti."; + case 207: + return "Puoi creare un rampino con un uncino e tre catene. Gli scheletri sottoterra di solito trasportano gli uncini, mentre le catene possono essere ricavate dalle barre di ferro."; + case 208: + return "Se vedi un vaso, demoliscilo e aprilo. Contiene una serie di utili provviste."; + case 209: + return "Vi sono tesori nascosti in tutto il mondo. Alcuni oggetti fantastici si possono trovare nelle zone sotterranee più profonde."; + case 210: + return "Demolire un'orbita d'ombra provocherà a volte la caduta di un meteorite dal cielo. Le orbite d'ombra si possono generalmente trovare negli abissi attorno alle zone distrutte."; + case 211: + return "Dovresti cercare di raccogliere più cuori di cristallo per aumentare la tua vita massima."; + case 212: + return "Il tuo equipaggiamento attuale non è sufficiente. Hai bisogno di un'armatura migliore."; + case 213: + return "Credo tu sia pronto per la tua prima grande battaglia. Raccogli lenti dai bulbi oculari di notte e portale a un altare dei demoni."; + case 214: + return "Aumenta la tua vita prima di affrontare la prossima sfida. Quindici cuori dovrebbero bastare."; + case 215: + return "La pietra d'ebano nella corruzione può essere purificata con polvere di driade o distrutta con esplosivi."; + case 216: + return "La prossima tappa consiste nell'esplorazione degli abissi corrotti. Trova e distruggi ogni orbita d'ombra che incontrerai."; + case 217: + return "C'è una vecchia dungeon non lontano da qui. Sarebbe il momento giusto per visitarla."; + case 218: + return "Dovresti tentare di massimizzare la vita disponibile. Prova a raccogliere venti cuori."; + case 219: + return "Ci sono molti tesori da scroprire nella giungla, se sei disposto a scavare abbastanza in profondità."; + case 220: + return "Il sotterraneo è composto da un materiale detto pietra infernale, perfetto per creare armi e armatura."; + case 221: + return "Quando sarai pronto a sfidare il custode del sotterraneo, dovrai fare un enorme sacrificio. Tutto ciò che ti serve si trova nel sotterraneo."; + case 222: + return "Assicurati di demolire ogni altare dei demoni che incontri. Se lo farai, ti succederà qualcosa di bello!"; + case 223: + return "A volte è possibile riunire le anime delle creature morte in luoghi estremamente luminosi o bui."; + case 224: + return "Ho ho ho e una bottiglia di ... Egg Nog!"; + case 225: + return "Ti sta a cuore prepararmi dei biscotti?"; + case 226: + return "Che cosa? Credevi non fosse vero?"; + case 227: + return "Sono riuscita a cucire di nuovo la tua faccia. Stai più attento la prossima volta."; + case 228: + return "Probabilmente ti lascerà una cicatrice."; + case 229: + return "I miei migliori auguri. Non voglio vederti saltare da altre scogliere."; + case 230: + return "Non ti ha fatto male, vero?"; + } + } + else if (Lang.lang == 4) + { + switch (l) + { + case 1: + return "Rassurez-moi, on ne doit pas compter que sur vous pour nous protéger de l'œil de Cthulhu."; + case 2: + return "Regardez-moi cette armure bas de gamme que vous avez sur le dos. Vous avez intérêt à acheter davantage de potions de soin."; + case 3: + return "Je sens une présence maléfique m'observer."; + case 4: + return "L'épée est plus forte que la plume. Achetez-en une dès aujourd'hui."; + case 5: + return "Vous voulez des pommes ? Vous voulez des poires ? Vous voulez des scoubidous ? Nous avons des torches."; + case 6: + return "Quelle belle matinée, n'est-ce pas ? Vous voulez quelque chose ?"; + case 7: + return "La nuit va bientôt tomber, alors faites votre choix tant qu'il est encore temps."; + case 8: + return "Vous n'avez pas idée du prix des blocs de terre à l'étranger."; + case 9: + return "Un jour, des légendes étonnantes circuleront sur " + player.name + "."; + case 10: + return "Jetez un œil à mes blocs de terre, c'est de la terre de premier choix."; + case 11: + return "Voyez comme le soleil tape. J'ai des armures parfaitement ventilées."; + case 12: + return "Le soleil est haut dans le ciel, mais mes prix sont bas."; + case 13: + return "Super. J'entends " + str10 + " et " + str2 + " se disputer d'ici."; + case 14: + return "Avez-vous vu Chult... Cthuch... Le truc avec le gros œil ?"; + case 15: + return "Cette maison est sûre, n'est-ce pas ? Hein, " + player.name + "?"; + case 16: + return "Même la lune sanglante ne peut arrêter le capitalisme. Alors, faisons affaires."; + case 17: + return "Pour garder un œil sur les prix, achetez une lentille."; + case 18: + return "Kosh, kapleck Mog. Oh désolé, ça veut dire « Achetez-moi quelque chose ou allez au diable » en klingon."; + case 19: + return "Vous êtes " + player.name + ", n'est-ce pas ? J'ai entendu de bonnes choses à votre sujet."; + case 20: + return "J'ai entendu dire qu'il y avait un trésor caché... Bon, laissez tomber."; + case 21: + return "Une statue d'ange, dites-vous ? Désolé, ce n'est pas une boutique de souvenirs ici."; + case 22: + return "Le dernier type qui est venu m'a vendu quelques sales... Je veux dire, de vrais trésors."; + case 23: + return "Je me demande si la lune est un gros fromage... Hein, quoi ? Oh, bien sûr, achetez ce que vous voulez !"; + case 24: + return "Vous avez dit or ? Je vais vous en débarrasser."; + case 25: + return "Faites attention de ne pas me mettre du sang partout."; + case 26: + return "Dépêchez-vous et arrêtez de saigner."; + case 27: + return "Si vous comptez mourir, faites-le dehors."; + case 28: + return "Qu'est-ce que ça veut dire ?"; + case 29: + return "Je n'aime pas beaucoup votre ton."; + case 30: + return "Qu'est-ce que vous faites là ? Si vous ne saignez pas, sortez d'ici. Dehors !"; + case 31: + return "QUOI ?!"; + case 32: + return "Vous avez vu ce vieil homme qui se pressait autour du donjon ? Il semblait avoir des ennuis."; + case 33: + return "J'aimerais bien que " + str6 + " fasse plus attention. J'en ai assez de lui faire des points de suture chaque jour."; + case 34: + return "Je me demande si " + str4 + " a dit qu'il avait besoin d'un docteur."; + case 35: + return "Il va falloir que je discute sérieusement avec " + str3 + ". Combien de fois par semaine allez-vous revenir ici avec des brûlures au second degré ?"; + case 36: + return "Vous avez meilleure mine comme ça."; + case 37: + return "Que vous est-il arrivé au visage ?"; + case 38: + return "Bon sang, je suis une bonne infirmière, mais pas à ce point."; + case 39: + return "Mes chers amis, nous sommes rassemblés aujourd'hui pour faire nos adieux... Bon, tout se passera bien."; + case 40: + return "Vous avez laissé votre bras là-bas. Laissez-moi arranger ça."; + case 41: + return "Arrêtez de vous comporter comme une mauviette. J'ai déjà vu bien pire."; + case 42: + return "Cela va demander quelques points de suture."; + case 43: + return "Encore des soucis avec ces brutes ?"; + case 44: + return "Attendez, je dois avoir quelques pansements pour enfants quelque part."; + case 45: + return "Allez faire quelques pas, " + player.name + ", ça devrait aller. Allez, ouste !"; + case 46: + return "Ça vous fait mal quand vous faites ça ? Eh bien, ne le faites pas."; + case 47: + return "On dirait qu'on a commencé à vous digérer. Vous avez encore chassé des slimes ?"; + case 48: + return "Tournez votre tête et toussez."; + case 49: + return "Ce n'est pas la plus grave blessure que j'ai vue... Oui, j'ai déjà vu des blessures bien plus graves que ça."; + case 50: + return "Vous voulez une sucette ?"; + case 51: + return "Montrez-moi où vous avez mal."; + case 52: + return "Je suis désolée, mais vous n'avez pas les moyens."; + case 53: + return "Il va me falloir plus d'or que cela."; + case 54: + return "Je ne travaille pas gratuitement, vous savez."; + case 55: + return "Je ne vous garantis pas le résultat."; + case 56: + return "Je ne peux rien faire de plus pour vous sans chirurgie esthétique."; + case 57: + return "Arrêtez de me faire perdre mon temps."; + case 58: + return "J'ai entendu dire qu'il y aurait une poupée qui ressemblerait beaucoup à " + str3 + " dans le monde inférieur. J'aimerais bien lui coller quelques pruneaux."; + case 59: + return "Dépêchez-vous, j'ai un rencard avec " + str2 + " dans une heure."; + case 60: + return "Je veux ce que vend " + str2 + ". Comment ça, elle ne vend rien !"; + case 61: + return str5 + " est vraiment canon. Dommage qu'elle soit aussi prude."; + case 62: + return "Ne vous embêtez pas avec " + str6 + ", j'ai tout ce qu'il vous faut ici."; + case 63: + return "C'est quoi le problème de " + str6 + " ? Est-ce qu'il réalise seulement que l'on vend du matériel complètement différent ?"; + case 64: + return "Eh bien, c'est la nuit idéale pour ne parler à personne, n'est-ce pas, " + player.name + " ?"; + case 65: + return "J'adore les nuits comme celle-ci, car il y a toujours des choses à tuer."; + case 66: + return "Je vois que vous êtes en train de zieuter le minishark... Mieux vaut ne pas savoir comment c'est fabriqué."; + case 67: + return "Eh, c'est pas du cinéma. Les munitions sont superflues."; + case 68: + return "Retirez les mains de mon flingue."; + case 69: + return "Avez-vous essayé d'utiliser de la poudre de purification sur la pierre d'ébène de corruption ?"; + case 70: + return "Ce serait bien si " + str4 + " cessait de me courtiser. Il n'a pas l'air de réaliser que j'ai 500 ans."; + case 71: + return "Pourquoi " + str1 + " essaie-t-il toujours de me vendre des statues d'ange ? Tout le monde sait qu'elles sont sans intérêt."; + case 72: + return "Avez-vous vu le vieil homme en train de marcher autour du donjon ? Il n'avait vraiment pas l'air bien."; + case 73: + return "Je vends ce que je veux, et si cela ne vous plaît pas, tant pis pour vous."; + case 74: + return "Pourquoi adopter un comportement aussi conflictuel en cette période ?"; + case 75: + return "Je ne veux pas que vous achetiez mes marchandises, je veux que vous ayez envie de les acheter, vous saisissez la nuance ?"; + case 76: + return "Dites, c'est moi ou il y a un million de zombies qui déambulent cette nuit ?"; + case 77: + return "Je veux que vous purifiiez le monde de la corruption."; + case 78: + return "Faites attention, Terraria a besoin de vous."; + case 79: + return "Les sables du temps s'écoulent et il faut bien avouer que vous vieillissez plutôt mal."; + case 80: + return "Comment ça, j'aboie plus que je ne mords ?"; + case 81: + return "C'est l'histoire de deux gobelins qui entrent dans une taverne et l'un dit à l'autre : « Tu veux un gobelet de bière ? »"; + case 82: + return "Je ne peux pas vous laisser entrer tant que vous ne m'aurez pas débarrassé de ma malédiction."; + case 83: + return "Revenez à la nuit tombée si vous voulez entrer."; + case 84: + return "Mon maître ne peut pas être invoqué à la lumière du jour."; + case 85: + return "Vous êtes bien trop faible pour me débarrasser de ma malédiction. Revenez quand vous serez de taille."; + case 86: + return "C'est pathétique ! Vous n'espérez quand même pas affronter mon maître dans votre état."; + case 87: + return "J'espère que vous avez au moins six amis pour vous épauler."; + case 88: + return "Je vous en prie, ne faites pas ça. Vous allez vous faire tuer."; + case 89: + return "Votre puissance semble suffisante pour me débarrasser de ma malédiction."; + case 90: + return "Disposez-vous de la force nécessaire pour vaincre mon maître ?"; + case 91: + return "S'il vous plaît, je vous en conjure, affrontez mon ravisseur et libérez-moi."; + case 92: + return "Terrassez mon maître et je vous ouvrirai la voie du donjon."; + case 93: + return "Vous essayez d'écouler cette pierre d'ébène, hein ? Pourquoi ne pas l'intégrer à l'un de ces explosifs ?"; + case 94: + return "Dites donc, vous n'auriez pas vu un clown dans le coin ?"; + case 95: + return "Il y avait une bombe juste là et je n'arrive plus à remettre la main dessus."; + case 96: + return "J'ai quelque chose dont les zombies raffolent."; + case 97: + return "Même " + str4 + " raffole de mes marchandises."; + case 98: + return "Vous préférez un trou de balle ou un trou de grenade ? C'est bien ce que je pensais."; + case 99: + return str2 + " vous aidera si jamais vous perdez un membre avec ça."; + case 100: + return "Pourquoi purifier le monde alors que vous pouvez tout faire sauter ?"; + case 101: + return "Si vous lancez ça dans votre baignoire et que vous fermez les fenêtres, ça vous débouchera les sinus et les oreilles en moins de deux."; + case 102: + return "Vous voulez jouer au poulet-fusée ?"; + case 103: + return "Pourriez-vous signer cette clause de non-responsabilité ?"; + case 104: + return "INTERDICTION FORMELLE DE FUMER."; + case 105: + return "Les explosifs, c'est de la bombe en ce moment. Achetez-en dès maintenant."; + case 106: + return "C'est un bon jour pour mourir."; + case 107: + return "Je me demande ce qui va se passer si je... (BOUM !)... Désolé, vous aviez besoin de cette jambe ?"; + case 108: + return "La dynamite, c'est mon remède spécial à tous vos petits problèmes."; + case 109: + return "Jetez un œil à mes marchandises, mes prix sont explosifs."; + case 110: + return "J'ai encore le vague souvenir d'avoir attaché une femme et de l'avoir balancée dans un donjon."; + case 111: + return "Il y a un problème, c'est la lune sanglante."; + case 112: + return "Si j'avais été plus jeune, j'aurais proposé un rencard à " + str2 + ". J'étais un bourreau des cœurs dans le temps."; + case 113: + return "Ce chapeau rouge que vous portez me dit quelque chose."; + case 114: + return "Merci de m'avoir débarrassé de cette malédiction. J'avais l'impression que quelque chose m'avait mordu et ne me lâchait plus."; + case 115: + return "Ma mère m'a toujours dit que je ferais un bon tailleur."; + case 116: + return "La vie est comme le chapeau d'un magicien, on ne sait jamais ce qui va en sortir."; + case 117: + return "La broderie, c'est très difficile. Si ça ne l'était pas, personne n'en ferait. C'est ce qui la rend si intéressante."; + case 118: + return "Le commerce du prêt-à-porter n'a aucun secret pour moi."; + case 119: + return "Quand on est maudit, ça n'aide pas à se faire des amis. Alors un jour, je m'en suis fait un avec un morceau de cuir et je l'ai appelé Wilson."; + case 120: + return "Merci de m'avoir libéré, humain. J'ai été attaché et laissé ici par les autres gobelins. On peut dire qu'on ne s'entendait pas très bien, eux et moi."; + case 121: + return "Je n'arrive pas à croire qu'ils m'aient attaché et planté ici juste pour montrer qu'ils ne voulaient pas aller vers l'est."; + case 122: + return "Puisque je suis devenu un paria, puis-je jeter mes boules piquantes ? Mes poches me font mal."; + case 123: + return "Vous cherchez un expert en gadgets ? Je suis votre gobelin."; + case 124: + return "Merci de votre aide. À présent, je dois continuer à errer sans but dans les environs. Je suis sûr qu'on se reverra."; + case 125: + return "Je ne vous imaginais pas comme ça."; + case 126: + return "Et comment va " + str10 + " ? Lui auriez-vous parlé, par hasard ?"; + case (int) sbyte.MaxValue: + return "Est-ce que votre chapeau a besoin d'un moteur ? Je crois en avoir un en stock qui ferait parfaitement l'affaire."; + case 128: + return "J'ai entendu dire que vous aimiez les bottes de course et les fusées, du coup, j'ai installé des fusées dans vos bottes de course."; + case 129: + return "Le silence est d'or, mais le chatterton reste très efficace."; + case 130: + return "Oui, l'or est plus précieux que le fer. Mais qu'est-ce qu'ils vous apprennent chez les humains ?"; + case 131: + return "C'est vrai que ce casque de mineur combiné à une palme rendait mieux sur le papier."; + case 132: + return "Les gobelins sont étonnamment soupe au lait. Ils pourraient déclencher une guerre pour un mot de travers."; + case 133: + return "Il faut bien avouer que les gobelins n'ont pas inventé la poudre, mais il y a des exceptions à la règle."; + case 134: + return "Savez-vous pourquoi on trimballe toujours ces boules piquantes ? Parce que moi, je n'en sais fichtre rien."; + case 135: + return "Je viens de mettre la touche finale à ma dernière invention. Et ce modèle n'explosera pas si vous soufflez trop fort dessus."; + case 136: + return "Les voleurs gobelins sont des vrais manchots. Ils ne sont même pas capables de dérober le contenu d'un coffre non verrouillé."; + case 137: + return "Merci de m'avoir secouru. Ces liens commençaient à m'irriter la peau."; + case 138: + return "Mon héros !"; + case 139: + return "Quel héroïsme ! Merci de m'avoir sauvé, belle dame."; + case 140: + return "Quel héroïsme ! Merci de m'avoir sauvé, fringant jeune homme."; + case 141: + return "Maintenant que nous avons fait connaissance, je peux venir avec vous, n'est-ce pas ?"; + case 142: + return "Bonjour, " + str3 + " ! Que puis-je pour vous, aujourd'hui ?"; + case 143: + return "Bonjour, " + str6 + " ! Que puis-je pour vous, aujourd'hui ?"; + case 144: + return "Bonjour, " + str8 + " ! Que puis-je pour vous, aujourd'hui ?"; + case 145: + return "Bonjour, " + str2 + " ! Que puis-je pour vous, aujourd'hui ?"; + case 146: + return "Bonjour, " + str10 + " ! Que puis-je pour vous, aujourd'hui ?"; + case 147: + return "Bonjour, " + str5 + " ! Que puis-je pour vous, aujourd'hui ?"; + case 148: + return "Voulez-vous que je fasse apparaître une pièce de monnaie de derrière votre oreille ? Non ? Bon."; + case 149: + return "Est-ce qu'un berlingot magique vous ferait plaisir ? Non ? Bon."; + case 150: + return "Je peux concocter un merveilleux chocolat chaud magique, si cela vous intéresse... Non ? Bon."; + case 151: + return "Souhaitez-vous jeter un œil à ma boule de cristal ?"; + case 152: + return "N'avez-vous jamais rêvé de posséder un anneau magique qui transformerait les rochers en slimes ? Moi non plus, à vrai dire."; + case 153: + return "Un jour, quelqu'un m'a dit que l'amitié était quelque chose de magique. C'est n'importe quoi. On ne peut pas transformer quelqu'un en grenouille avec l'amitié."; + case 154: + return "À présent, votre avenir m'apparaît clairement... Vous allez m'acheter de nombreux objets."; + case 155: + return "Une fois, j'ai tenté de ramener une statue d'ange à la vie. Il ne s'est rien passé."; + case 156: + return "Merci. C'était moins une, j'ai failli terminer comme tous ces squelettes."; + case 157: + return "Attention où vous mettez les pieds. J'étais encore là-bas il y a peu."; + case 158: + return "Attendez, j'ai presque réussi à me connecter au Wi-Fi ici."; + case 159: + return "Mais j'avais presque terminé d'installer des stroboscopes là-haut."; + case 160: + return "QUE PERSONNE NE BOUGE ! J'AI PERDU UNE LENTILLE !"; + case 161: + return "Tout ce que je veux, c'est que l'interrupteur... Quoi ?"; + case 162: + return "Je parie que vous n'avez pas acheté assez de câbles. Décidément, vous n'êtes vraiment pas une lumière."; + case 163: + return "Est-ce que vous pourriez juste... S'il vous plaît ? OK ? OK."; + case 164: + return "Je n'aime pas trop la façon dont vous me regardez. Je suis en train de travailler, moi."; + case 165: + return "Au fait, " + player.name + ", vous venez de voir " + str8 + " ? Est-ce qu'il aurait parlé de moi, par hasard ?"; + case 166: + return str4 + " parle toujours de pressuriser mes plaques de pression. Je lui ai dit que c'était pour marcher dessus."; + case 167: + return "Il faut toujours acheter plus de câbles que prévu."; + case 168: + return "Vous avez bien vérifié que votre matériel était branché ?"; + case 169: + return "Vous savez ce qu'il faudrait à cette maison ? Plus de stroboscopes."; + case 170: + return "La lune sanglante se remarque lorsque le ciel vire au rouge et quelque chose fait que les monstres pullulent."; + case 171: + return "Dites donc, vous savez où je peux trouver de la mauvaise herbe morte. Non, pour rien, je me demandais, c'est tout."; + case 172: + return "Si vous regardiez en l'air, vous verriez que là, la lune est toute rouge."; + case 173: + return "La nuit, vous devriez rester à l'intérieur. C'est très dangereux de se balader dans le noir."; + case 174: + return "Bienvenue, " + player.name + ". Je peux faire quelque chose pour vous ?"; + case 175: + return "Je suis là pour vous conseiller et vous aider dans vos prochaines actions. Vous devriez venir me parler au moindre problème."; + case 176: + return "On dit qu'il y a une personne capable de vous aider à survivre sur ces terres... Oh, attendez, c'est moi."; + case 177: + return "Vous pouvez utiliser votre pioche pour creuser dans la terre, et votre hache pour abattre des arbres. Placez simplement le curseur à l'emplacement souhaité et cliquez."; + case 178: + return "Si vous voulez survivre, vous allez devoir fabriquer des armes et un abri. Commencez par abattre des arbres et récolter du bois."; + case 179: + return "Appuyez sur " + (object) '\x008B' + " pour accéder au menu d'artisanat. Lorsque vous avez assez de bois, créez un établi. Tant que vous vous tiendrez à proximité, il vous permettra de fabriquer des objets plus complexes."; + case 180: + return "Vous pouvez construire un abri en plaçant du bois ou d'autres blocs dans le monde. N'oubliez pas de créer des murs et de les placer."; + case 181: + return "Une fois que vous aurez une épée en bois, vous pourrez essayer de récupérer du gel grâce aux slimes. Combinez ensuite le bois et le gel pour faire une torche."; + case 182: + return "Pour interagir avec les arrière-plans et les objets placés, utilisez un marteau."; + case 183: + return "Vous devriez creuser pour trouver du minerai. Cela vous permet de fabriquer des objets très utiles."; + case 184: + return "Maintenant que vous avez du minerai, vous allez devoir le transformer en lingot pour pouvoir en faire des objets. Il vous faut une fournaise."; + case 185: + return "Vous pouvez fabriquer une fournaise avec des torches, du bois et de la pierre. Assurez-vous de vous tenir près d'un établi."; + case 186: + return "Vous aurez besoin d'une enclume pour pouvoir fabriquer la plupart des choses à partir des lingots de métal."; + case 187: + return "Une enclume peut être fabriquée avec du fer ou bien achetée chez les marchands."; + case 188: + return "Le souterrain contient des cœurs de cristal utilisés pour augmenter votre maximum de vie. Il vous faudra un marteau pour les extraire."; + case 189: + return "Si vous récupérez dix étoiles filantes, elles peuvent être combinées pour fabriquer un objet qui augmentera votre capacité de magie."; + case 190: + return "Les étoiles tombent sur le monde durant la nuit. Elles peuvent être utilisées pour toutes sortes de choses utiles. Si vous en voyez une, dépêchez-vous de la ramasser, car elles disparaissent l'aube venue."; + case 191: + return "Il existe de nombreux moyens pour attirer du monde dans notre ville. Bien sûr, une fois sur place, ces nouveaux arrivants auront besoin d'une maison pour s'abriter."; + case 192: + return "Pour qu'une pièce puisse être considérée comme un foyer, elle doit comporter une porte, une chaise, une table et une source de lumière. Assurez-vous que la maison dispose également de murs."; + case 193: + return "Deux personnes distinctes ne vivront pas dans le même foyer. De plus, si leur foyer est détruit, ils chercheront un nouveau lieu où habiter."; + case 194: + return "Vous pouvez utiliser l'interface de logement pour attribuer des logements et les visualiser. Ouvrez votre inventaire et cliquez sur l'icône de maison."; + case 195: + return "Si vous souhaitez qu'un marchand emménage, vous devrez avoir une quantité d'argent suffisante. 50 pièces d'argent devraient suffire."; + case 196: + return "Pour qu'une infirmière emménage, il vous faudra peut-être augmenter votre maximum de vie."; + case 197: + return "Si vous avez un pistolet, il se peut qu'un marchand d'armes fasse son apparition pour vous vendre des munitions."; + case 198: + return "Vous devriez montrer de quoi vous êtes capable en triomphant d'un monstre. Cela attirera l'attention d'une dryade."; + case 199: + return "Assurez-vous d'explorer minutieusement les donjons. Il pourrait y avoir des prisonniers retenus captifs dans les profondeurs."; + case 200: + return "Peut-être que le vieil homme du donjon voudra se joindre à nous maintenant que sa malédiction a été levée."; + case 201: + return "Récupérez toutes les bombes que vous pourrez trouver. Un démolisseur voudra sûrement y jeter un œil."; + case 202: + return "Les gobelins sont-ils si différents de nous pour que nous ne puissions pas vivre ensemble de manière paisible ?"; + case 203: + return "J'ai entendu dire qu'un puissant magicien vivait dans les environs. Assurez-vous de le trouver la prochaine fois que vous irez dans le souterrain."; + case 204: + return "Si vous combinez des lentilles à un autel de démon, vous pourrez trouver un moyen d'invoquer un monstre très puissant. Cependant, il vous faudra attendre la tombée de la nuit avant de pouvoir l'utiliser."; + case 205: + return "Vous pouvez fabriquer de la nourriture pour ver avec des morceaux pourris et de la poudre infecte. Assurez-vous de vous trouver dans une zone corrompue avant de l'utiliser."; + case 206: + return "Les autels démoniaques peuvent généralement être trouvés dans la corruption. Il vous faudra vous tenir près d'eux pour fabriquer certains objets."; + case 207: + return "Vous pouvez fabriquer un grappin avec un crochet et trois chaînes. Les squelettes trouvés dans les profondeurs portent souvent des crochets sur eux. Les chaînes peuvent être fabriquées à l'aide de lingots de fer."; + case 208: + return "Si vous voyez des pots, détruisez-les pour les ouvrir, car ils contiennent souvent des objets très utiles."; + case 209: + return "Des trésors sont disséminés un peu partout dans le monde et vous pouvez trouver des objets fantastiques dans les profondeurs."; + case 210: + return "Lorsqu'on écrase un orbe d'ombre, il arrive qu'une météorite tombe du ciel. Les orbes d'ombre peuvent généralement être trouvés dans les gouffres des zones corrompues."; + case 211: + return "Vous devriez vous employer à récolter davantage de cristaux de cœur pour augmenter votre maximum de vie."; + case 212: + return "Votre équipement actuel ne suffira pas. Il vous faut une meilleure armure."; + case 213: + return "Je crois que vous pouvez maintenant prendre part à votre première grande bataille. De nuit, rassemblez des lentilles récupérées des globes oculaires et portez-les sur un autel du démon."; + case 214: + return "Vous devriez augmenter votre vie avant votre prochaine épreuve. Quinze cœurs devraient suffire."; + case 215: + return "La pierre d'ébène dans la corruption peut être purifiée en utilisant de la poudre fournie par une dryade, ou bien peut être détruite avec des explosifs."; + case 216: + return "Votre prochaine épreuve sera d'explorer les abîmes corrompus. Trouvez et détruisez tous les orbes d'ombre que vous trouverez."; + case 217: + return "Il existe un vieux donjon situé pas très loin d'ici. Vous devriez aller y faire un tour dès maintenant."; + case 218: + return "Vous devriez essayer d'augmenter votre vie au maximum. Essayez de rassembler vingt cœurs."; + case 219: + return "Si vous pouvez creuser assez profondément, il y a de nombreux trésors à découvrir dans la jungle."; + case 220: + return "Le monde des Enfers est fait d'un matériau appelé pierre de l'enfer. Ce matériau est parfait pour la fabrication d'armes et d'armures."; + case 221: + return "Lorsque vous voudrez affronter le gardien du monde des Enfers, vous devrez faire le sacrifice d'un être vivant. Tout ce dont vous avez besoin pour cela se trouve dans le monde des Enfers."; + case 222: + return "Assurez-vous d'écraser tous les autels de démon que vous trouverez. Vous pourrez en tirer quelque chose de bénéfique."; + case 223: + return "Des âmes peuvent être parfois récupérées des créatures déchues dans des lieux de lumière ou d'ombre extrême."; + case 224: + return "Ho ho ho et une bouteille de... lait de poule !"; + case 225: + return "Vous voulez bien me faire des biscuits ?"; + case 226: + return "Quoi ? Vous pensiez que je n'existais pas ?"; + case 227: + return "J'ai réussi à recoudre votre visage. Faites plus attention la prochaine fois."; + case 228: + return "Cela va probablement laisser une cicatrice."; + case 229: + return "Ça va mieux. Je ne veux plus vous voir sauter du sommet des falaises."; + case 230: + return "Cela n'a pas fait trop mal, n'est-ce pas ?"; + } + } + else if (Lang.lang == 5) + { + switch (l) + { + case 1: + return "Espero que un canijo como tú no sea lo único que se interpone entre nosotros y el Ojo de Cthulu."; + case 2: + return "Vaya una armadura más chapucera que llevas. Yo de ti compraría más pociones curativas."; + case 3: + return "Siento como si una presencia maligna me observara."; + case 4: + return "¡La espada siempre gana! Cómprate una ahora."; + case 5: + return "¿Quieres manzanas? ¿Zanahorias? ¿Unas piñas? Tenemos antorchas."; + case 6: + return "Una mañana estupenda, ¿verdad? ¿No necesitas nada?"; + case 7: + return "La noche caerá pronto, amigo. Haz tus compras mientras puedas."; + case 8: + return "Ni te imaginas lo bien que se venden los bloques de tierra en el extranjero."; + case 9: + return "Oh, algún día narrarán las aventuras de " + player.name + "... y seguro que acaban bien."; + case 10: + return "Echa un vistazo a estos bloques de tierra... ¡Tienen extra de tierra!"; + case 11: + return "¡Oye, cómo pega el sol! Por suerte, tengo armaduras totalmente transpirables."; + case 12: + return "El sol está alto, al contrario que mis precios."; + case 13: + return "¡Vaya! Desde aquí se oye cómo discuten " + str10 + " y " + str2 + "."; + case 14: + return "¿Has visto a Chith... esto... Shith... eh... Chat...? Vamos, ¿al gran Ojo?"; + case 15: + return "Oye, esta casa es segura, ¿verdad? ¿Verdad? " + player.name + "..."; + case 16: + return "Ni siquiera una luna de sangre detendría el capitalismo. Así que vamos a hacer negocios."; + case 17: + return "No pierdas de vista tus sueños. ¡Compra una lente!"; + case 18: + return "Kosh, kapleck Mog. Lo siento, hablaba en klingon... quiere decir \"Compra algo o muere\"."; + case 19: + return "¿Eres tú, " + player.name + "? ¡Me han hablado bien de ti, amigo!"; + case 20: + return "Dicen que aquí hay un tesoro escondido... Oh, olvídalo..."; + case 21: + return "¿La estatua de un ángel? Lo siento pero no vendo cosas de segunda mano."; + case 22: + return "El último tipo que estuvo aquí me dejó algunos trastos viejos... ¡Bueno, en realidad eran tesoros!"; + case 23: + return "Me pregunto si la luna estará hecha de queso... Eh... esto... ¿Querías comprar algo?"; + case 24: + return "¿Has dicho oro? Me lo quedo."; + case 25: + return "Será mejor que no me manches de sangre."; + case 26: + return "Date prisa... y deja ya de sangrar."; + case 27: + return "Si te vas a morir hazlo fuera, por favor."; + case 28: + return "¿Y eso qué quiere decir?"; + case 29: + return "No me gusta el tono que empleas."; + case 30: + return "¿Por qué sigues aquí? Si no te estás desangrando, aquí no pintas nada. Lárgate."; + case 31: + return "¿¡CÓMO!?"; + case 32: + return "¿Has visto a ese anciano que deambula por la mazmorra? Parece que tiene problemas."; + case 33: + return "Ojalá " + str6 + " tuviera más cuidado. Ya me estoy hartando de tener que coserle las extremidades todos los días."; + case 34: + return "Oye, por curiosidad, ¿ha dicho " + str4 + " por qué tiene que ir al médico?"; + case 35: + return "Debo hablar en serio con " + str3 + ". ¿Cuántas veces crees que puedes venir en una semana con quemaduras de lava graves?"; + case 36: + return "Creo que así estarás mejor."; + case 37: + return "Eh... ¿Qué te ha pasado en la cara?"; + case 38: + return "¡DIOS MÍO! Soy buena en mi trabajo, pero no tanto."; + case 39: + return "Queridos amigos, nos hemos reunido hoy aquí para decir adiós a... ¡Era broma! Saldrás de esta."; + case 40: + return "Te dejaste el brazo por ahí. Deja que te ayude..."; + case 41: + return "¡Deja de comportarte como un bebé! He visto cosas peores."; + case 42: + return "¡Voy a tener que darte puntos!"; + case 43: + return "¿Ya te has vuelto a meter en líos?"; + case 44: + return "Aguanta, por aquí tengo unas tiritas infantiles chulísimas."; + case 45: + return "Anda ya, " + player.name + ", te pondrás bien. Serás nenaza..."; + case 46: + return "Así que te duele cuando haces eso... Pues no lo hagas."; + case 47: + return "Vienes como si estuvieras a medio digerir. ¿Has estado cazando slimes otra vez?"; + case 48: + return "Gira la cabeza y tose."; + case 49: + return "No es de las peores heridas que he visto... Sin duda, he visto heridas más grandes que esta."; + case 50: + return "¿Quieres una piruleta, chiquitín?"; + case 51: + return "A ver... ¿Dónde te duele?"; + case 52: + return "Lo siento, pero no trabajo por caridad."; + case 53: + return "Vas a necesitar más oro del que traes."; + case 54: + return "Oye, yo no trabajo gratis."; + case 55: + return "No tengo una varita mágica."; + case 56: + return "Esto es todo lo que puedo hacer por ti... Necesitas cirugía plástica."; + case 57: + return "No me hagas perder el tiempo."; + case 58: + return "Dicen que en alguna parte del Inframundo hay una muñeca que se parece mucho a " + str3 + ". Ojalá pudiera usarla para practicar el tiro al blanco."; + case 59: + return "¡Date prisa! Tengo una cita con " + str2 + " dentro de una hora."; + case 60: + return "Quiero lo que vende " + str2 + ". ¿Cómo dices? ¿Que no vende nada?"; + case 61: + return str5 + " es una monada. Es una lástima que sea tan mojigata."; + case 62: + return "Olvídate de " + str6 + ", yo tengo todo lo que necesitas aquí y ahora."; + case 63: + return "¿Qué mosca le ha picado a " + str6 + "? ¿Aún no sabe que vendemos cosas totalmente distintas?"; + case 64: + return "Oye, hace una noche magnífica para no hablar con nadie, ¿no crees, " + player.name + "?"; + case 65: + return "Me encantan estas noches. ¡Siempre encuentras algo que matar!"; + case 66: + return "Veo que le has echado el ojo al Minitiburón. Será mejor que no sepas de qué está hecho."; + case 67: + return "Eh, amigo, que esto no es una película. La munición va aparte."; + case 68: + return "¡Aparta esas manos de mi pistola, colega!"; + case 69: + return "¿Has probado a usar polvos de purificación sobre la piedra de ébano corrupta?"; + case 70: + return "Ojalá " + str4 + " dejara de flirtear conmigo. ¿No se da cuenta de que tengo 500 años?"; + case 71: + return "¿Por qué se empeña " + str1 + " en intentar venderme una estatua de ángel? Todo el mundo sabe que no sirven para nada."; + case 72: + return "¿Has visto a ese anciano que deambula por la mazmorra? No tiene muy buen aspecto..."; + case 73: + return "¡Yo vendo lo que quiero! Si no te gusta, mala suerte."; + case 74: + return "¿Por qué tienes que ser tan beligerante en estos tiempos que corren?"; + case 75: + return "No quiero que compres mis artículos. Quiero que desees comprar mis artículos, ¿entiendes?"; + case 76: + return "Oye, ¿soy yo o esta noche han salido de juerga un millón de zombis?"; + case 77: + return "Debes erradicar la corrupción de este mundo."; + case 78: + return "Ponte a salvo; ¡Terraria te necesita!"; + case 79: + return "Fluyen las arenas del tiempo. Y la verdad, no estás envejeciendo con mucha elegancia."; + case 80: + return "¿Qué tiene que ver conmigo eso de perro ladrador?"; + case 81: + return "Entra un duende en un bar y dice el dueño: \"A ver, quiero control, ¿eh?\". Y dice el duende: \"No, sin trol, sin trol\"."; + case 82: + return "No puedo dejarte entrar hasta que me liberes de esta maldición."; + case 83: + return "Si quieres entrar, vuelve por la noche."; + case 84: + return "No se puede invocar al maestro a la luz del día."; + case 85: + return "Eres demasiado débil para romper esta maldición. Vuelve cuando seas de más utilidad."; + case 86: + return "Eres patético. No esperes presentarte ante el maestro tal como eres."; + case 87: + return "Espero que hayas venido con varios amigos..."; + case 88: + return "No lo hagas, forastero. Sería un suicidio."; + case 89: + return "Tal vez seas lo bastante fuerte para poder librarme de esta maldición..."; + case 90: + return "Forastero, ¿te crees con fuerzas para derrotar al maestro?"; + case 91: + return "¡Por favor! ¡Lucha con mi raptor y libérame! ¡Te lo suplico!"; + case 92: + return "Derrota al maestro y te permitiré entrar a la mazmorra."; + case 93: + return "¿Conque intentando librarte de esa piedra de ébano, eh? ¿Por qué pruebas con estos explosivos?"; + case 94: + return "Eh, ¿has visto a un payaso por aquí?"; + case 95: + return "Había una bomba aquí mismo, y ahora no soy capaz de encontrarla..."; + case 96: + return "¡Yo les daré a esos zombis lo que necesitan!"; + case 97: + return "¡Incluso " + str4 + " quiere lo que vendo!"; + case 98: + return "Y pensé: ¿Qué prefieres? ¿Un agujero de bala o de granada?"; + case 99: + return "Seguro que " + str2 + " te ayudará si pierdes una extremidad jugando con estas monadas..."; + case 100: + return "¿Por qué purificar el mundo cuando puedes volarlo en pedazos?"; + case 101: + return "¡Si lanzas uno de estos en la bañera y cierras todas las ventanas, te despejará la nariz y los oídos!"; + case 102: + return "¿Quieres jugar con fuego, gallina?"; + case 103: + return "Oye, ¿firmarías esta renuncia de daños y perjuicios?"; + case 104: + return "¡AQUÍ NO SE PUEDE FUMAR!"; + case 105: + return "Los explosivos están de moda hoy en día. ¡Llévate unos cuantos!"; + case 106: + return "¡Es un buen día para morir!"; + case 107: + return "Y qué pasa si... (¡BUM!)... Oh, lo siento, ¿usabas mucho esa pierna?"; + case 108: + return "Dinamita, mi propia panacea para todos los males."; + case 109: + return "Echa un vistazo a este género; ¡los precios son una bomba!"; + case 110: + return "Recuerdo vagamente haber atado a una mujer y haberla arrojado a una mazmorra."; + case 111: + return "¡Tenemos un problema! ¡Hoy tenemos luna de sangre!"; + case 112: + return "Si fuera más joven, invitaría a " + str2 + " a salir. Yo antes era todo un galán."; + case 113: + return "Ese sombrero rojo me resulta familiar..."; + case 114: + return "Gracias otra vez por librarme de esta maldición. Sentí como si algo me hubiera saltado encima y me hubiera mordido."; + case 115: + return "Mamá siempre dijo que yo sería un buen sastre."; + case 116: + return "La vida es como un cajón de la ropa; ¡nunca sabes qué te vas a poner!"; + case 117: + return "¡Desde luego bordar es una tarea difícil! ¡Si no fuera así, nadie lo haría! Eso es lo que la hace tan genial."; + case 118: + return "Sé todo lo que hay que saber sobre el negocio de la confección."; + case 119: + return "La maldición me ha convertido en un ser solitario; una vez me hice amigo de un muñeco de cuero. Lo llamaba Wilson."; + case 120: + return "Gracias por liberarme, humano. Los otros duendes me ataron y me dejaron aquí. Te puedes imaginar que no nos llevamos muy bien."; + case 121: + return "¡No puedo creer que me ataran y me dejaran aquí solo por decirles que no se dirigían al este!"; + case 122: + return "Ahora que soy un proscrito, ¿puedo tirar ya estas bolas de pinchos? Tengo los bolsillos destrozados."; + case 123: + return "¿Buscas un experto en artilugios? ¡Yo soy tu duende!"; + case 124: + return "Gracias por tu ayuda. Tengo que dejar de vagar por ahí sin rumbo. Seguro que nos volvemos a ver."; + case 125: + return "Creía que eras más alto."; + case 126: + return "Oye... ¿Qué trama " + str10 + "? ¿Tú... has hablado con ella, por un casual?"; + case (int) sbyte.MaxValue: + return "Eh, ¿quieres un motor para tu sombrero? Creo que tengo un motor que quedaría de perlas en ese sombrero."; + case 128: + return "Oye, he oído que te gustan los cohetes y las botas de correr, así que he puesto unos cohetes en tus botas."; + case 129: + return "Mi reino por un poco de cinta adhesiva..."; + case 130: + return "Pues claro, el oro es más resistente que el hierro. ¿Pero qué os enseñan estos humanos de hoy?"; + case 131: + return "En fin, la idea de un casco de minero con alas quedaba mucho mejor sobre el papel."; + case 132: + return "Los duendes tienen una increíble predisposición al enfado. ¡De hecho, podrían declarar una guerra por una discusión sobre ropa!"; + case 133: + return "Sinceramente, la mayoría de los duendes no son precisamente unos genios. Bueno, algunos sí."; + case 134: + return "¿Tú sabes por qué llevamos estas bolas con pinchos? Porque yo no."; + case 135: + return "¡Acabo de terminar mi última creación! Esta versión no explota con violencia si respiras encima."; + case 136: + return "Los duendes ladrones no son muy buenos en lo suyo. ¡Ni siquiera saben robar un cofre abierto!"; + case 137: + return "¡Gracias por salvarme! Estas ataduras me estaban haciendo rozaduras."; + case 138: + return "¡Oh, te debo la vida!"; + case 139: + return "¡Oh, qué heroico! ¡Gracias por salvarme, jovencita!"; + case 140: + return "¡Oh, qué heroico por tu parte! ¡Gracias por salvarme, jovencito!"; + case 141: + return "Ahora que nos conocemos, ¿me puedo ir a vivir contigo, verdad?"; + case 142: + return "¡Eh, hola, " + str3 + "! ¿Qué puedo hacer hoy por ti?"; + case 143: + return "¡Eh, hola, " + str6 + "! ¿Qué puedo hacer hoy por ti?"; + case 144: + return "¡Eh, hola, " + str8 + "! ¿Qué puedo hacer hoy por ti?"; + case 145: + return "¡Eh, hola, " + str2 + "! ¿Qué puedo hacer hoy por ti?"; + case 146: + return "¡Eh, hola, " + str10 + "! ¿Qué puedo hacer hoy por ti?"; + case 147: + return "¡Eh, hola, " + str5 + "! ¿Qué puedo hacer hoy por ti?"; + case 148: + return "¿Quieres que saque un conejo de tu chistera? ¿No? Pues nada."; + case 149: + return "¿Quieres un caramelo mágico? ¿No? Vale."; + case 150: + return "Si te gusta, te puedo hacer un delicioso chocolate calentito... ¿Tampoco? Vale, está bien."; + case 151: + return "¿Has venido a echar un ojo a mi bola de cristal?"; + case 152: + return "¿Nunca has deseado tener un anillo mágico que convierta las piedras en slimes? La verdad es que yo tampoco."; + case 153: + return "Una vez me dijeron que la amistad es algo mágico. ¡Ridículo! No puedes convertir a nadie en rana con la amistad."; + case 154: + return "Veo tu futuro... ¡Vas a comprarme un montón de artículos!"; + case 155: + return "En cierta ocasión intenté devolverle la vida a una estatua de ángel. Pero no pasó nada."; + case 156: + return "¡Gracias! Un poco más y habría acabado como los demás esqueletos de ahí abajo."; + case 157: + return "¡Eh, mira por dónde vas! ¡Llevo ahí desde hace... un rato!"; + case 158: + return "Espera un momento, ya casi he conseguido que funcione el wifi."; + case 159: + return "¡Casi había acabado de poner luces intermitentes aquí arriba!"; + case 160: + return "¡No te muevas! ¡Se me ha caído una lentilla!"; + case 161: + return "Lo único que quiero es que el conmutador haga... ¿Qué?"; + case 162: + return "A ver si lo adivino. No has comprado suficiente cable. ¡Ya te vale!"; + case 163: + return "¿Podrías...? Solo... ¿Por favor...? ¿Vale? Está bien. Arrg."; + case 164: + return "No me gusta cómo me miras. Ahora estoy TRABAJANDO."; + case 165: + return "Eh, " + player.name + ", ¿acabas de llegar de la casa de " + str8 + "? ¿Por casualidad no te hablaría de mí?"; + case 166: + return str4 + " sigue insistiendo en pulir mi place de presión. Ya le he dicho que funciona pisándola."; + case 167: + return "¡Siempre compras más cable del que necesitas!"; + case 168: + return "¿Has comprobado si tu dispositivo está enchufado?"; + case 169: + return "Oh, ¿sabes lo que necesita esta casa? Más luces intermitentes."; + case 170: + return "Sabrás que se avecina una luna de sangre cuando el cielo se tiña de rojo. Hay algo en ella que hace que los monstruos ataquen en grupo."; + case 171: + return "Eh, amigo, ¿sabes dónde hay por aquí malahierba? Oh, no es por nada, solo preguntaba, nada más."; + case 172: + return "Si miraras hacia arriba, verías que ahora mismo la luna está roja."; + case 173: + return "Deberías quedarte en casa por la noche. Es muy peligroso andar por ahí en la oscuridad."; + case 174: + return "Saludos, " + player.name + ". ¿Te puedo ayudar en algo?"; + case 175: + return "Estoy aquí para aconsejarte sobre lo que debes ir haciendo. Te aconsejo que hables conmigo cuando estés atascado."; + case 176: + return "Dicen que hay una persona que te dirá cómo sobrevivir en esta tierra... ¡Oh, espera, sí soy yo!"; + case 177: + return "Puedes usar el pico para cavar en la tierra y el hacha para talar árboles. Sitúa el cursor sobre el ladrillo y pulsa " + (object) '\x0081' + "."; + case 178: + return "Si quieres sobrevivir, tendrás que crear armas y un cobijo. Empieza talando árboles y recogiendo madera."; + case 179: + return "Pulsa " + (object) '\x008B' + " para acceder al menú de creación. Cuando tengas suficiente madera, crea un banco de trabajo. De este modo podrás crear objetos más elaborados siempre que permanezcas cerca del banco."; + case 180: + return "Puedes construir un cobijo juntando madera y otros bloques que hay por el mundo. No olvides levantar y colocar paredes."; + case 181: + return "En cuanto tengas una espada de madera, puedes intentar recoger el gel de los slimes. Mezcla madera y gel para hacer una antorcha."; + case 182: + return "Usa un martillo para interactuar con el entorno y colocar objetos."; + case 183: + return "Deberías cavar una mina para encontrar vetas de mineral. Así podrás crear objetos muy útiles."; + case 184: + return "Ahora que tienes minerales, tendrás que convertirlos en un lingote para fabricar objetos con ellos. Para ello necesitas una forja."; + case 185: + return "Puedes construir una forja con antorchas, madera y piedra. Asegúrate de no alejarte del banco de trabajo."; + case 186: + return "Necesitarás un yunque para crear objetos con los lingotes de metal."; + case 187: + return "Los yunques se pueden hacer de hierro o bien comprarse a un mercader."; + case 188: + return "En el subsuelo hay cristales de corazón que puedes usar para aumentar al máximo tu vida. Para recogerlos, necesitarás un martillo."; + case 189: + return "Si recoges 10 estrellas fugaces, podrás combinarlas para crear un objeto que aumente tu poder mágico."; + case 190: + return "Las estrellas fugaces caen del cielo a la tierra por la noche. Se pueden utilizar para toda clase de objetos útiles. Si ves una date prisa en cogerla, ya que desaparecen al amanecer."; + case 191: + return "Hay muchas formas de hacer que los demás se muden a nuestra ciudad. Por supuesto, necesitarán una casa en la que vivir."; + case 192: + return "Para que una habitación pueda ser considerada un hogar, debe tener una puerta, una silla, una mesa y una fuente de luz. Y paredes, claro."; + case 193: + return "En la misma casa no pueden vivir dos personas. Además, si se destruye una casa, esa persona deberá buscar un nuevo lugar donde vivir."; + case 194: + return "En la interfaz de Cobijo puedes ver y asignar viviendas. Abre tu inventario y haz clic en el icono de casa."; + case 195: + return "Si quieres que un mercader se mude a una casa, deberás recoger una gran cantidad de dinero. Bastará con 50 monedas de plata."; + case 196: + return "Para que se mude una enfermera, tendrías que aumentar al máximo tu nivel de vida."; + case 197: + return "Si tuvieras alguna pistola, seguro que aparecería algún traficante de armas para venderte municiones."; + case 198: + return "Deberías ponerte a prueba y derrotar a un monstruo corpulento. Eso llamaría la atención de una dríada."; + case 199: + return "Asegúrate de explorar la mazmorra a fondo. Podría haber prisioneros retenidos en la parte más profunda."; + case 200: + return "Quizás el anciano de la mazmorra quiera unirse a nosotros ahora que su maldición ha desaparecido."; + case 201: + return "Guarda bien las bombas que encuentres. Algún demoledor querrá echarles un vistazo."; + case 202: + return "¿En realidad los duendes son tan distintos a nosotros que no podríamos vivir juntos en paz?"; + case 203: + return "He oído que por esta región vive un poderoso mago. Estate muy atento por si lo ves la próxima vez que viajes al subsuelo."; + case 204: + return "Si juntas varias lentes en un altar demoníaco, tal vez encuentres la forma de invocar a un monstruo poderoso. Aunque te conviene esperar hasta la noche para hacerlo."; + case 205: + return "Puedes hacer cebo de gusanos con trozos podridos y polvo vil. Asegúrate de estar en una zona corrompida antes de usarlo."; + case 206: + return "Los altares demoníacos se suelen encontrar en territorio corrompido. Deberás estar cerca de ellos para crear ciertos objetos."; + case 207: + return "Puedes hacerte un garfio de escalada con un garfio y tres cadenas. Los esqueletos se encuentran en las profundidades del subsuelo y suelen llevar ganchos. En cuanto a las cadenas, se pueden fabricar con lingotes de hierro."; + case 208: + return "Si ves un jarrón, ábrelo aunque sea a golpes. Contienen toda clase de suministros de utilidad."; + case 209: + return "Hay tesoros escondidos por todo el mundo. ¡En las profundidades del subsuelo se pueden encontrar objetos maravillosos!"; + case 210: + return "Romper un orbe sombrío a veces provoca la caída de un meteorito del cielo. Los orbes sombríos se suelen encontrar en los abismos que rodean las zonas corrompidas"; + case 211: + return "Deberías dedicarte a recoger más cristal de corazón para aumentar tu nivel de vida hasta el máximo."; + case 212: + return "El equipo que llevas sencillamente no sirve. Debes mejorar tu armadura."; + case 213: + return "Creo que ya estás listo para tu primera gran batalla. Recoge de noche algunas lentes de los ojos y llévalas a un altar demoníaco."; + case 214: + return "Te conviene aumentar tu nivel de vida antes de enfrentarte al siguiente desafío. Con 15 corazones bastará."; + case 215: + return "La piedra de ébano que se encuentra en el territorio corrompido se puede purificar usando un poco de polvo de dríada, o destruirla con explosivos."; + case 216: + return "El siguiente paso debería ser explorar los abismos corrompidos. Encuentra y destruye todos los orbes sombríos que encuentres."; + case 217: + return "No muy lejos de aquí hay una antigua mazmorra. Ahora sería un buen momento para ir a echar un vistazo."; + case 218: + return "Deberías intentar aumentar al máximo tu nivel de vida. Intenta conseguir 20 corazones."; + case 219: + return "Hay muchos tesoros por descubrir en la selva si estás dispuesto a cavar a suficiente profundidad."; + case 220: + return "El Inframundo se compone de un material llamado piedra infernal, perfecto para hacer armas y armaduras."; + case 221: + return "Cuando estés preparado para desafiar al guardián del Inframundo, tendrás que hacer un sacrificio viviente. Todo lo que necesitas para hacerlo lo encontrarás en el Inframundo."; + case 222: + return "No dejes de destruir todos los altares demoníacos que encuentres. ¡Algo bueno te sucederá si lo haces!"; + case 223: + return "A veces puedes recuperar el alma de las criaturas caídas en lugares de extrema luminosidad u oscuridad."; + case 224: + return "Ho, ho, ho y una botella de... ¡ponche de huevo!"; + case 225: + return "¿Me preparas unas galletitas?"; + case 226: + return "¿Qué? ¿Creías que no existía?"; + case 227: + return "Me las arreglé para coserte la cara de nuevo. Ten más cuidado la próxima vez."; + case 228: + return "Seguramente te quede una cicatriz."; + case 229: + return "Ya está. No quiero verte saltar por más acantilados."; + case 230: + return "No ha sido para tanto, ¿verdad?"; + } + } + return (string) null; + } + + public static string setBonus(int l) + { + if (Lang.lang <= 1) + { + switch (l) + { + case 0: + return "2 defense"; + case 1: + return "3 defense"; + case 2: + return "15% increased movement speed"; + case 3: + return "Space Gun costs 0 mana"; + case 4: + return "20% chance to not consume ammo"; + case 5: + return "16% reduced mana usage"; + case 6: + return "17% extra melee damage"; + case 7: + return "20% increased mining speed"; + case 8: + return "14% reduced mana usage"; + case 9: + return "15% increased melee speed"; + case 10: + return "20% chance to not consume ammo"; + case 11: + return "17% reduced mana usage"; + case 12: + return "5% increased melee critical strike chance"; + case 13: + return "20% chance to not consume ammo"; + case 14: + return "19% reduced mana usage"; + case 15: + return "18% increased melee and movement speed"; + case 16: + return "25% chance to not consume ammo"; + case 17: + return "20% reduced mana usage"; + case 18: + return "19% increased melee and movement speed"; + case 19: + return "25% chance to not consume ammo"; + case 20: + return "23% reduced mana usage"; + case 21: + return "21% increased melee and movement speed"; + case 22: + return "28% chance to not consume ammo"; + } + } + else if (Lang.lang == 2) + { + switch (l) + { + case 0: + return "2 Abwehr"; + case 1: + return "3 Abwehr"; + case 2: + return "Um 15% erhöhtes Bewegungstempo"; + case 3: + return "Weltraumpistole kostet 0 Mana"; + case 4: + return "20%ige Chance, keine Munition zu verbrauchen"; + case 5: + return "Um 16% reduzierte Mananutzung"; + case 6: + return "17% extra Nahkampfschaden"; + case 7: + return "Um 20% erhöhtes Abbautempo"; + case 8: + return "Um 14% reduzierte Mananutzung"; + case 9: + return "Um 15% erhöhtes Nahkampftempo"; + case 10: + return "20%ige Chance, keine Munition zu verbrauchen"; + case 11: + return "Um 17% reduzierte Mananutzung"; + case 12: + return "5% Erhöhte kritische Nahkampf-Trefferchance"; + case 13: + return "20%ige Chance, keine Munition zu verbrauchen"; + case 14: + return "Um 19% reduzierte Mananutzung"; + case 15: + return "18% Erhöhtes Nahkampf-und Bewegungstempo"; + case 16: + return "25%ige Chance, keine Munition zu verbrauchen"; + case 17: + return "Um 20% reduzierte Mananutzung"; + case 18: + return "19% Erhöhtes Nahkampf-und Bewegungstempo"; + case 19: + return "25%ige Chance, keine Munition zu verbrauchen"; + case 20: + return "Um 23% reduzierte Mananutzung"; + case 21: + return "21% Erhöhtes Nahkampf-und Bewegungstempo"; + case 22: + return "28%ige Chance, keine Munition zu verbrauchen"; + } + } + else if (Lang.lang == 3) + { + switch (l) + { + case 0: + return "2 difesa"; + case 1: + return "3 difesa"; + case 2: + return "Velocità di movimento aumentata del 15%"; + case 3: + return "La pistola spaziale costa 0 mana"; + case 4: + return "20% di possibilità di non consumare munizioni"; + case 5: + return "Consumo mana ridotto del 16%"; + case 6: + return "17% danni da mischia in più"; + case 7: + return "Velocità di estrazione aumentata del 20%"; + case 8: + return "Consumo mana ridotto del 14%"; + case 9: + return "Velocità del corpo a corpo aumentata del 15%"; + case 10: + return "20% di possibilità di non consumare munizioni"; + case 11: + return "Consumo mana ridotto del 17%"; + case 12: + return "Possibilità di colpo critico nel corpo a corpo aumentata del 5%"; + case 13: + return "20% di possibilità di non consumare munizioni"; + case 14: + return "Consumo mana ridotto del 19%"; + case 15: + return "Velocità di corpo a corpo e movimento aumentata del 18%"; + case 16: + return "25% di possibilità di non consumare munizioni"; + case 17: + return "Consumo mana ridotto del 20%"; + case 18: + return "Velocità di corpo a corpo e movimento aumentate del 19%"; + case 19: + return "25% di possibilità di non consumare munizioni"; + case 20: + return "Consumo mana ridotto del 23%"; + case 21: + return "Velocità di corpo a corpo e movimento aumentate del 21%"; + case 22: + return "28% di possibilità di non consumare munizioni"; + } + } + else if (Lang.lang == 4) + { + switch (l) + { + case 0: + return "2 de défense"; + case 1: + return "3 de défense"; + case 2: + return "Vitesse de déplacement augmentée de 15 %"; + case 3: + return "Le fusil de l'espace coûte 0 mana"; + case 4: + return "20 % de chance de n'utiliser aucune munition"; + case 5: + return "Utilisation de mana réduite de 16 %"; + case 6: + return "17% de dégâts de mêlée supplémentaires"; + case 7: + return "Vitesse d'extraction minière augmentée de 20 %"; + case 8: + return "Utilisation de mana réduite de 14 %"; + case 9: + return "Vitesse de mêlée augmentée de 15 %"; + case 10: + return "20 % de chance de n'utiliser aucune munition"; + case 11: + return "Utilisation de mana réduite de 17 %"; + case 12: + return "Chance de coup critique de mêlée augmentée de 5 %"; + case 13: + return "20 % de chance de n'utiliser aucune munition"; + case 14: + return "Utilisation de mana réduite de 19 %"; + case 15: + return "Vitesse de déplacement et de mêlée augmentée de 18 %"; + case 16: + return "25 % de chance de n'utiliser aucune munition"; + case 17: + return "Utilisation de mana réduite de 20 %"; + case 18: + return "Vitesse de déplacement et de mêlée augmentée de 19 %"; + case 19: + return "25 % de chance de n'utiliser aucune munition"; + case 20: + return "Utilisation de mana réduite de 23 %"; + case 21: + return "Vitesse de déplacement et de mêlée augmentée de 21 %"; + case 22: + return "28 % de chance de n'utiliser aucune munition"; + } + } + else if (Lang.lang == 5) + { + switch (l) + { + case 0: + return "2 defensa"; + case 1: + return "3 defensa"; + case 2: + return "Aumenta en un 15% la velocidad de movimiento"; + case 3: + return "La pistola espacial no cuesta maná"; + case 4: + return "Probabilidad del 20% de no gastar munición"; + case 5: + return "Reduce el uso de maná en un 16%"; + case 6: + return "Aumenta en un 17% el daño de los ataques cuerpo a cuerpo"; + case 7: + return "Aumenta en un 20% la velocidad de excavación"; + case 8: + return "Reduce el uso de maná en un 14%"; + case 9: + return "Aumenta un 15% la velocidad de los ataques cuerpo a cuerpo"; + case 10: + return "Probabilidad del 20% de no gastar munición"; + case 11: + return "Reduce el uso de maná en un 17%"; + case 12: + return "Aumenta la probabilidad de conseguir ataques críticos cuerpo a cuerpo"; + case 13: + return "Probabilidad del 20% de no gastar munición"; + case 14: + return "Reduce el uso de maná en un 19%"; + case 15: + return "Aumenta en un 18% la velocidad de movimiento y de los ataques cuerpo a cuerpo"; + case 16: + return "Probabilidad del 25% de no gastar munición"; + case 17: + return "Reduce el uso de maná en un 20%"; + case 18: + return "19% Aumenta la velocidad de movimiento y en el cuerpo a cuerpo"; + case 19: + return "Probabilidad del 25% de no gastar munición"; + case 20: + return "Reduce el uso de maná en un 23%"; + case 21: + return "21% Aumenta la velocidad de movimiento y en el cuerpo a cuerpo"; + case 22: + return "Probabilidad del 28% de no gastar munición"; + } + } + return (string) null; + } + + public static string npcName(int l) + { + if (Lang.lang <= 1) + { + switch (l) + { + case -18: + case -1: + return "Slimeling"; + case -17: + return "Big Stinger"; + case -16: + return "Little Stinger"; + case -15: + return "Heavy Skeleton"; + case -14: + return "Big Boned"; + case -13: + return "Short Bones"; + case -12: + return "Big Eater"; + case -11: + return "Little Eater"; + case -10: + return "Jungle Slime"; + case -9: + return "Yellow Slime"; + case -8: + return "Red Slime"; + case -7: + return "Purple Slime"; + case -6: + return "Black Slime"; + case -5: + return "Baby Slime"; + case -4: + return "Pinky"; + case -3: + return "Green Slime"; + case -2: + return "Slimer"; + case 1: + return "Blue Slime"; + case 2: + return "Demon Eye"; + case 3: + return "Zombie"; + case 4: + return "Eye of Cthulhu"; + case 5: + return "Servant of Cthulhu"; + case 6: + return "Eater of Souls"; + case 7: + case 8: + case 9: + return "Devourer"; + case 10: + case 11: + case 12: + return "Giant Worm"; + case 13: + case 14: + case 15: + return "Eater of Worlds"; + case 16: + return "Mother Slime"; + case 17: + return "Merchant"; + case 18: + return "Nurse"; + case 19: + return "Arms Dealer"; + case 20: + return "Dryad"; + case 21: + return "Skeleton"; + case 22: + return "Guide"; + case 23: + return "Meteor Head"; + case 24: + return "Fire Imp"; + case 25: + return "Burning Sphere"; + case 26: + return "Goblin Peon"; + case 27: + return "Goblin Thief"; + case 28: + return "Goblin Warrior"; + case 29: + return "Goblin Sorcerer"; + case 30: + return "Chaos Ball"; + case 31: + return "Angry Bones"; + case 32: + return "Dark Caster"; + case 33: + return "Water Sphere"; + case 34: + return "Cursed Skull"; + case 35: + case 36: + return "Skeletron"; + case 37: + return "Old Man"; + case 38: + return "Demolitionist"; + case 39: + case 40: + case 41: + return "Bone Serpent"; + case 42: + return "Hornet"; + case 43: + return "Man Eater"; + case 44: + return "Undead Miner"; + case 45: + return "Tim"; + case 46: + return "Bunny"; + case 47: + return "Corrupt Bunny"; + case 48: + return "Harpy"; + case 49: + return "Cave Bat"; + case 50: + return "King Slime"; + case 51: + return "Jungle Bat"; + case 52: + return "Doctor Bones"; + case 53: + return "The Groom"; + case 54: + return "Clothier"; + case 55: + return "Goldfish"; + case 56: + return "Snatcher"; + case 57: + return "Corrupt Goldfish"; + case 58: + return "Piranha"; + case 59: + return "Lava Slime"; + case 60: + return "Hellbat"; + case 61: + return "Vulture"; + case 62: + return "Demon"; + case 63: + return "Blue Jellyfish"; + case 64: + return "Pink Jellyfish"; + case 65: + return "Shark"; + case 66: + return "Voodoo Demon"; + case 67: + return "Crab"; + case 68: + return "Dungeon Guardian"; + case 69: + return "Antlion"; + case 70: + return "Spike Ball"; + case 71: + return "Dungeon Slime"; + case 72: + return "Blazing Wheel"; + case 73: + return "Goblin Scout"; + case 74: + return "Bird"; + case 75: + return "Pixie"; + case 77: + return "Armored Skeleton"; + case 78: + return "Mummy"; + case 79: + return "Dark Mummy"; + case 80: + return "Light Mummy"; + case 81: + return "Corrupt Slime"; + case 82: + return "Wraith"; + case 83: + return "Cursed Hammer"; + case 84: + return "Enchanted Sword"; + case 85: + return "Mimic"; + case 86: + return "Unicorn"; + case 87: + case 88: + case 89: + case 90: + case 91: + case 92: + return "Wyvern"; + case 93: + return "Giant Bat"; + case 94: + return "Corruptor"; + case 95: + case 96: + case 97: + return "Digger"; + case 98: + case 99: + case 100: + return "World Feeder"; + case 101: + return "Clinger"; + case 102: + return "Angler Fish"; + case 103: + return "Green Jellyfish"; + case 104: + return "Werewolf"; + case 105: + return "Bound Goblin"; + case 106: + return "Bound Wizard"; + case 107: + return "Goblin Tinkerer"; + case 108: + return "Wizard"; + case 109: + return "Clown"; + case 110: + return "Skeleton Archer"; + case 111: + return "Goblin Archer"; + case 112: + return "Vile Spit"; + case 113: + case 114: + return "Wall of Flesh"; + case 115: + case 116: + return "The Hungry"; + case 117: + case 118: + case 119: + return "Leech"; + case 120: + return "Chaos Elemental"; + case 121: + return "Slimer"; + case 122: + return "Gastropod"; + case 123: + return "Bound Mechanic"; + case 124: + return "Mechanic"; + case 125: + return "Retinazer"; + case 126: + return "Spazmatism"; + case (int) sbyte.MaxValue: + return "Skeletron Prime"; + case 128: + return "Prime Cannon"; + case 129: + return "Prime Saw"; + case 130: + return "Prime Vice"; + case 131: + return "Prime Laser"; + case 132: + return "Zombie"; + case 133: + return "Wandering Eye"; + case 134: + case 135: + case 136: + return "The Destroyer"; + case 137: + return "Illuminant Bat"; + case 138: + return "Illuminant Slime"; + case 139: + return "Probe"; + case 140: + return "Possessed Armor"; + case 141: + return "Toxic Sludge"; + case 142: + return "Santa Claus"; + case 143: + return "Snowman Gangsta"; + case 144: + return "Mister Stabby"; + case 145: + return "Snow Balla"; + case 147: + return "Albino Antlion"; + case 148: + return "Orca"; + case 149: + return "Vampire Miner"; + case 150: + return "Shadow Slime"; + case 151: + return "Shadow Hammer"; + case 152: + return "Shadow Mummy"; + case 153: + return "Spectral Gastropod"; + case 154: + return "Spectral Elemental"; + case 155: + return "Spectral Mummy"; + case 156: + return "Dragon Snatcher"; + case 157: + return "Dragon Hornet"; + case 158: + return "Dragon Skull"; + case 159: + case 160: + case 161: + case 162: + case 163: + case 164: + return "Arch Wyvern"; + case 165: + return "Arch Demon"; + case 166: + return "Ocram"; + case 167: + return "Servant of Ocram"; + default: + return ""; + } + } + else if (Lang.lang == 2) + { + switch (l) + { + case -18: + case -1: + return "Schleimling"; + case -17: + return "Riesenhornisse"; + case -16: + return "Minihornisse"; + case -15: + return "Mammutskelett"; + case -14: + return "Großknochen"; + case -13: + return "Kleinknochen"; + case -12: + return "Maxifresser"; + case -11: + return "Minifresser"; + case -10: + return "Dschungelschleim"; + case -9: + return "Gelber Schleim"; + case -8: + return "Roter Schleim"; + case -7: + return "Lila Schleim"; + case -6: + return "Schwarzer Schleim"; + case -5: + return "Schleimbaby"; + case -4: + return "Pinky"; + case -3: + return "Grüner Schleim"; + case -2: + return "Flugschleimi"; + case 1: + return "Blauer Schleim"; + case 2: + return "Dämonenauge"; + case 3: + return "Zombie"; + case 4: + return "Auge von Cthulhu"; + case 5: + return "Diener von Cthulhu"; + case 6: + return "Seelenfresser"; + case 7: + case 8: + case 9: + return "Verschlinger"; + case 10: + case 11: + case 12: + return "Riesenwurm"; + case 13: + case 14: + case 15: + return "Weltenfresser"; + case 16: + return "Schleimmami"; + case 17: + return "Händler"; + case 18: + return "Krankenschwester"; + case 19: + return "Waffenhändler"; + case 20: + return "Dryade"; + case 21: + return "Skelett"; + case 22: + return "Fremdenführer"; + case 23: + return "Meteorenkopf"; + case 24: + return "Feuer-Imp"; + case 25: + return "Flammenkugel"; + case 26: + return "Goblin-Arbeiter"; + case 27: + return "Goblin-Dieb"; + case 28: + return "Goblin-Krieger"; + case 29: + return "Goblin-Hexer"; + case 30: + return "Chaoskugel"; + case 31: + return "Wutknochen"; + case 32: + return "Düstermagier"; + case 33: + return "Wasserkugel"; + case 34: + return "Fluchschädel"; + case 35: + case 36: + return "Skeletron"; + case 37: + return "Greis"; + case 38: + return "Sprengmeister"; + case 39: + case 40: + case 41: + return "Knochenschlange"; + case 42: + return "Hornisse"; + case 43: + return "Menschenfresser"; + case 44: + return "Untoter Minenarbeiter"; + case 45: + return "Tim"; + case 46: + return "Hase"; + case 47: + return "Verderbnishase"; + case 48: + return "Harpyie"; + case 49: + return "Höhlenfledermaus"; + case 50: + return "Schleimkönig"; + case 51: + return "Dschungelfledermaus"; + case 52: + return "Doktor Bones"; + case 53: + return "Bräutigam"; + case 54: + return "Schneider"; + case 55: + return "Goldfisch"; + case 56: + return "Schnapper"; + case 57: + return "Verderbnisgoldfisch"; + case 58: + return "Piranha"; + case 59: + return "Lavaschleim"; + case 60: + return "Höllenfledermaus"; + case 61: + return "Geier"; + case 62: + return "Dämon"; + case 63: + return "Blauqualle"; + case 64: + return "Pinkqualle"; + case 65: + return "Hai"; + case 66: + return "Voodoo-Dämon"; + case 67: + return "Krabbe"; + case 68: + return "Verlies-Wächter"; + case 69: + return "Ameisenlöwe"; + case 70: + return "Nagelball"; + case 71: + return "Verliesschleim"; + case 72: + return "Flammenrad"; + case 73: + return "Goblin-Späher"; + case 74: + return "Vogel"; + case 75: + return "Pixie"; + case 77: + return "Gepanzertes Skelett"; + case 78: + return "Mumie"; + case 79: + return "Dunkle Mumie"; + case 80: + return "Helle Mumie"; + case 81: + return "Verderbnisschleimi"; + case 82: + return "Monstergeist"; + case 83: + return "Verfluchter Hammer"; + case 84: + return "Verzaubertes Schwert"; + case 85: + return "Mimic"; + case 86: + return "Einhorn"; + case 87: + case 88: + case 89: + case 90: + case 91: + case 92: + return "Lindwurm"; + case 93: + return "Riesenfledermaus"; + case 94: + return "Verderber"; + case 95: + case 96: + case 97: + return "Gräber"; + case 98: + case 99: + case 100: + return "Weltspeiser"; + case 101: + return "Klette"; + case 102: + return "Seeteufel"; + case 103: + return "Grüne Qualle"; + case 104: + return "Werwolf"; + case 105: + return "Gebundener Goblin"; + case 106: + return "Gebundener Zauberer"; + case 107: + return "Goblin-Tüftler"; + case 108: + return "Zauberer"; + case 109: + return "Clown"; + case 110: + return "Skelettbogenschütze"; + case 111: + return "Goblin-Bogenschütze"; + case 112: + return "Ekelspeichel"; + case 113: + case 114: + return "Fleischwand"; + case 115: + case 116: + return "Fressmaul"; + case 117: + case 118: + case 119: + return "Blutegel"; + case 120: + return "Chaos Elementar"; + case 121: + return "Flugschleim"; + case 122: + return "Bauchfüßler"; + case 123: + return "Gebundene Mechanikerin"; + case 124: + return "Mechanikerin"; + case 125: + return "Retinazer"; + case 126: + return "Spazmatism"; + case (int) sbyte.MaxValue: + return "Skeletron Prime"; + case 128: + return "Super-Kanone"; + case 129: + return "Super-Säge"; + case 130: + return "Super-Zange"; + case 131: + return "Super-Laser"; + case 132: + return "Zombie"; + case 133: + return "Wanderndes Auge"; + case 134: + case 135: + case 136: + return "Der Zerstörer"; + case 137: + return "Leuchtfledermaus"; + case 138: + return "Leuchtender Schleim"; + case 139: + return "Sonde"; + case 140: + return "Geisterrüstung"; + case 141: + return "Giftiger Schlamm"; + case 142: + return "Weihnachtsmann"; + case 143: + return "Gangster Schneemann"; + case 144: + return "Herr Stabby"; + case 145: + return "Schnee Balla"; + case 147: + return "Albino Ameisenlöwe"; + case 148: + return "Orca"; + case 149: + return "Vampire Miner"; + case 150: + return "Schattenschleim"; + case 151: + return "Schattenhammer"; + case 152: + return "Schattenmumie"; + case 153: + return "Gespenstischer Bauchfüßler"; + case 154: + return "Spectral Elemental"; + case 155: + return "Gespenstische Mumie"; + case 156: + return "Drachen-Schnapper"; + case 157: + return "Drachenhornisse"; + case 158: + return "Drachenschädel"; + case 159: + case 160: + case 161: + case 162: + case 163: + case 164: + return "Erz-Lindwurm"; + case 165: + return "Erz-Dämon"; + case 166: + return "Ocram"; + case 167: + return "Diener von Ocram"; + default: + return ""; + } + } + else if (Lang.lang == 3) + { + switch (l) + { + case -18: + case -1: + return "Slimeling"; + case -17: + return "Vespa grande"; + case -16: + return "Vespa piccola"; + case -15: + return "Scheletro pesante"; + case -14: + return "Disossato"; + case -13: + return "Ossa corte"; + case -12: + return "Grande mangiatore"; + case -11: + return "Piccolo mangiatore"; + case -10: + return "Slime della giungla"; + case -9: + return "Slime giallo"; + case -8: + return "Slime rosso"; + case -7: + return "Slime viola"; + case -6: + return "Slime nero"; + case -5: + return "Slime baby"; + case -4: + return "Mignolo"; + case -3: + return "Slime verde"; + case -2: + return "Slimer"; + case 1: + return "Slime blu"; + case 2: + return "Occhio del Demone"; + case 3: + return "Zombie"; + case 4: + return "Occhio di Cthulhu"; + case 5: + return "Servo di Cthulhu"; + case 6: + return "Mangiatore di anime"; + case 7: + case 8: + case 9: + return "Divoratore"; + case 10: + case 11: + case 12: + return "Verme gigante"; + case 13: + case 14: + case 15: + return "Mangiatore di mondi"; + case 16: + return "Slime madre"; + case 17: + return "Mercante"; + case 18: + return "Infermiera"; + case 19: + return "Mercante di armi"; + case 20: + return "Driade"; + case 21: + return "Scheletro"; + case 22: + return "Guida"; + case 23: + return "Testa di meteorite"; + case 24: + return "Diavoletto di fuoco"; + case 25: + return "Sfera infuocata"; + case 26: + return "Goblin operaio"; + case 27: + return "Goblin ladro"; + case 28: + return "Goblin guerriero"; + case 29: + return "Goblin stregone"; + case 30: + return "Palla del caos"; + case 31: + return "Ossa arrabbiate"; + case 32: + return "Lanciatore oscuro"; + case 33: + return "Sfera d'acqua"; + case 34: + return "Teschio maledetto"; + case 35: + case 36: + return "Skeletron"; + case 37: + return "Vecchio"; + case 38: + return "Esperto in demolizioni"; + case 39: + case 40: + case 41: + return "Serpente di ossa"; + case 42: + return "Calabrone"; + case 43: + return "Mangiauomini"; + case 44: + return "Minatore non-morto"; + case 45: + return "Tim"; + case 46: + return "Coniglio"; + case 47: + return "Coniglio corrotto"; + case 48: + return "Arpia"; + case 49: + return "Pipistrello della caverna"; + case 50: + return "Slime re"; + case 51: + return "Pipistrello della giungla"; + case 52: + return "Dottor ossa"; + case 53: + return "Lo sposo"; + case 54: + return "Mercante di abiti"; + case 55: + return "Pesce rosso"; + case 56: + return "Pianta afferratrice"; + case 57: + return "Pesce rosso corrotto"; + case 58: + return "Piranha"; + case 59: + return "Slime di lava"; + case 60: + return "Pipistrello dell'inferno"; + case 61: + return "Avvoltoio"; + case 62: + return "Demone"; + case 63: + return "Medusa blu"; + case 64: + return "Medusa rosa"; + case 65: + return "Squalo"; + case 66: + return "Demone voodoo"; + case 67: + return "Granchio"; + case 68: + return "Guardiano della Dungeon"; + case 69: + return "Formicaleone"; + case 70: + return "Sfera con spuntoni"; + case 71: + return "Slime della Dungeon"; + case 72: + return "Ruota ardente"; + case 73: + return "Goblin ricognitore"; + case 74: + return "Uccello"; + case 75: + return "Folletto"; + case 76: + return ""; + case 77: + return "Scheletro corazzato"; + case 78: + return "Mummia"; + case 79: + return "Mummia oscura"; + case 80: + return "Mummia chiara"; + case 81: + return "Slime corrotto"; + case 82: + return "Fantasma"; + case 83: + return "Martello maledetto"; + case 84: + return "Spada incantata"; + case 85: + return "Sosia"; + case 86: + return "Unicorno"; + case 87: + case 88: + case 89: + case 90: + case 91: + case 92: + return "Viverna"; + case 93: + return "Pipistrello gigante"; + case 94: + return "Corruttore"; + case 95: + case 96: + case 97: + return "Scavatore"; + case 98: + case 99: + case 100: + return "Alimentatore del mondo"; + case 101: + return "Appiccicoso"; + case 102: + return "Rana pescatrice"; + case 103: + return "Medusa verde"; + case 104: + return "Lupo mannaro"; + case 105: + return "Goblin legato"; + case 106: + return "Stregone legato"; + case 107: + return "Goblin inventore"; + case 108: + return "Stregone"; + case 109: + return "Clown"; + case 110: + return "Scheletro arciere"; + case 111: + return "Goblin arciere"; + case 112: + return "Bava disgustosa"; + case 113: + case 114: + return "Muro di carne"; + case 115: + case 116: + return "L'Affamato"; + case 117: + case 118: + case 119: + return "Sanguisuga"; + case 120: + return "Elementale del caos"; + case 121: + return "Slimer"; + case 122: + return "Gasteropodo"; + case 123: + return "Meccanico legato"; + case 124: + return "Meccanico"; + case 125: + return "Retinazer"; + case 126: + return "Spazmatism"; + case (int) sbyte.MaxValue: + return "Skeletron primario"; + case 128: + return "Cannone primario"; + case 129: + return "Sega primaria"; + case 130: + return "Morsa primaria"; + case 131: + return "Laser primario"; + case 132: + return "Zombie"; + case 133: + return "Occhio errante"; + case 134: + case 135: + case 136: + return "Il Distruttore"; + case 137: + return "Pipistrello illuminante"; + case 138: + return "Slime illuminante"; + case 139: + return "Sonda"; + case 140: + return "Armatura posseduta"; + case 141: + return "Fango tossico"; + case 142: + return "Babbo Natale"; + case 143: + return "Pupazzo di neve Gangsta"; + case 144: + return "Signor Stabby"; + case 145: + return "Neve Balla"; + case 147: + return "Formicaleone albino"; + case 148: + return "Orca"; + case 149: + return "Minatore vampiro"; + case 150: + return "Slime ombra"; + case 151: + return "Mummia ombra"; + case 152: + return "Shadow Mummy"; + case 153: + return "Gasteropode spettrale"; + case 154: + return "Elementale spettrale"; + case 155: + return "Mummia spettrale"; + case 156: + return "Pianta afferratrice del Drago"; + case 157: + return "Calabrone del Drago"; + case 158: + return "Teschio del Drago"; + case 159: + case 160: + case 161: + case 162: + case 163: + case 164: + return "Arciviverna"; + case 165: + return "Arcidiavolo"; + case 166: + return "Ocram"; + case 167: + return "Servo di Ocram"; + default: + return ""; + } + } + else if (Lang.lang == 4) + { + switch (l) + { + case -18: + case -1: + return "Slimeling"; + case -17: + return "Gros frelon"; + case -16: + return "Petit frelon"; + case -15: + return "Squelette lourd"; + case -14: + return "Grand squelette"; + case -13: + return "Petit squelette"; + case -12: + return "Grand dévoreur"; + case -11: + return "Petit dévoreur"; + case -10: + return "Slime de la jungle"; + case -9: + return "Slime jaune"; + case -8: + return "Slime rouge"; + case -7: + return "Slime violet"; + case -6: + return "Slime noir"; + case -5: + return "Bébé slime"; + case -4: + return "Pinky"; + case -3: + return "Slime vert"; + case -2: + return "Slimer"; + case 1: + return "Slime bleu"; + case 2: + return "Œil de démon"; + case 3: + return "Zombie"; + case 4: + return "Œil de Cthulhu"; + case 5: + return "Servant de Cthulhu"; + case 6: + return "Dévoreur d'âmes"; + case 7: + case 8: + case 9: + return "Dévoreur"; + case 10: + case 11: + case 12: + return "Ver géant"; + case 13: + case 14: + case 15: + return "Dévoreur de mondes"; + case 16: + return "Mère slime"; + case 17: + return "Marchand"; + case 18: + return "Infirmière"; + case 19: + return "Marchand d'armes"; + case 20: + return "Dryade"; + case 21: + return "Squelette"; + case 22: + return "Guide"; + case 23: + return "Tête de météorite"; + case 24: + return "Diablotin de feu"; + case 25: + return "Sphère brûlante"; + case 26: + return "Péon gobelin"; + case 27: + return "Voleur gobelin"; + case 28: + return "Guerrier gobelin"; + case 29: + return "Sorcier gobelin"; + case 30: + return "Boule de chaos"; + case 31: + return "Squelette furieux"; + case 32: + return "Magicien noir"; + case 33: + return "Sphère d'eau"; + case 34: + return "Crâne maudit"; + case 35: + return "Squeletron"; + case 36: + return "Squeletron"; + case 37: + return "Vieil homme"; + case 38: + return "Démolisseur"; + case 39: + case 40: + case 41: + return "Serpent d'os"; + case 42: + return "Frelon"; + case 43: + return "Mangeur d'hommes"; + case 44: + return "Mineur mort-vivant"; + case 45: + return "Tim"; + case 46: + return "Lapin"; + case 47: + return "Lapin corrompu"; + case 48: + return "Harpie"; + case 49: + return "Chauve-souris"; + case 50: + return "Roi slime"; + case 51: + return "Chauve-souris de la jungle"; + case 52: + return "Docteur Bones"; + case 53: + return "Le jeune marié"; + case 54: + return "Tailleur"; + case 55: + return "Poisson rouge"; + case 56: + return "Ravisseur"; + case 57: + return "Poisson rouge corrompu"; + case 58: + return "Piranha"; + case 59: + return "Slime de l'enfer"; + case 60: + return "Chauve-souris de l'enfer"; + case 61: + return "Vautour"; + case 62: + return "Démon"; + case 63: + return "Méduse bleue"; + case 64: + return "Méduse rose"; + case 65: + return "Requin"; + case 66: + return "Démon vaudou"; + case 67: + return "Crabe"; + case 68: + return "Gardien du donjon"; + case 69: + return "Fourmilion"; + case 70: + return "Boule piquante"; + case 71: + return "Slime des donjons"; + case 72: + return "Roue de feu"; + case 73: + return "Scout gobelin"; + case 74: + return "Oiseau"; + case 75: + return "Lutin"; + case 76: + return ""; + case 77: + return "Squelette en armure"; + case 78: + return "Momie"; + case 79: + return "Momie de l'ombre"; + case 80: + return "Momie de lumière"; + case 81: + return "Slime corrompu"; + case 82: + return "Spectre"; + case 83: + return "Marteau maudit"; + case 84: + return "Épée enchantée"; + case 85: + return "Imitateur"; + case 86: + return "Licorne"; + case 87: + case 88: + case 89: + case 90: + case 91: + case 92: + return "Wyverne"; + case 93: + return "Chauve-souris géante"; + case 94: + return "Corrupteur"; + case 95: + case 96: + case 97: + return "Fouisseur"; + case 98: + case 99: + case 100: + return "Nourricier"; + case 101: + return "Accrocheur"; + case 102: + return "Baudroie"; + case 103: + return "Méduse verte"; + case 104: + return "Loup-garou"; + case 105: + return "Gobelin attaché"; + case 106: + return "Magicien attaché"; + case 107: + return "Gobelin bricoleur"; + case 108: + return "Magicien"; + case 109: + return "Clown"; + case 110: + return "Archer squelette"; + case 111: + return "Archer gobelin"; + case 112: + return "Immonde crachat"; + case 113: + case 114: + return "Mur de chair"; + case 115: + case 116: + return "L'affamé"; + case 117: + case 118: + case 119: + return "Sangsue"; + case 120: + return "Élémentaire du chaos"; + case 121: + return "Slimer"; + case 122: + return "Gastropode"; + case 123: + return "Mécanicienne attachée"; + case 124: + return "Mécanicienne"; + case 125: + return "Rétinazer"; + case 126: + return "Spazmatisme"; + case (int) sbyte.MaxValue: + return "Skeletron Prime"; + case 128: + return "Canon primaire"; + case 129: + return "Scie primaire"; + case 130: + return "Étau principal"; + case 131: + return "Laser principal"; + case 132: + return "Zombie"; + case 133: + return "Œil vagabond"; + case 134: + case 135: + case 136: + return "Le destructeur"; + case 137: + return "Chauve-souris illuminée"; + case 138: + return "Slime illuminé"; + case 139: + return "Sonde"; + case 140: + return "Armure possédée"; + case 141: + return "Boue toxique"; + case 142: + return "Père Noël"; + case 143: + return "Snowman Gangsta"; + case 144: + return "Monsieur Stabby"; + case 145: + return "Neige Balla"; + case 147: + return "Fourmilion albinos"; + case 148: + return "Orca"; + case 149: + return "Mineur vampire"; + case 150: + return "Slime de l'ombre"; + case 151: + return "Marteau de l'ombre"; + case 152: + return "Momie de l'ombre"; + case 153: + return "Gastropode spectral"; + case 154: + return "Élémentaire spectral"; + case 155: + return "Momie spectrale"; + case 156: + return "Dragon ravisseur"; + case 157: + return "Frelon dragon"; + case 158: + return "Crâne de dragon"; + case 159: + case 160: + case 161: + case 162: + case 163: + case 164: + return "Arche Wyvern"; + case 165: + return "Arche démon"; + case 166: + return "Ocram"; + case 167: + return "Serviteur d'Ocram"; + default: + return ""; + } + } + else + { + if (Lang.lang != 5) + return (string) null; + switch (l) + { + case -18: + case -1: + return "Slimeling"; + case -17: + return "Gran avispa"; + case -16: + return "Avispa pequeña"; + case -15: + return "Esqueleto pesado"; + case -14: + return "Gran huesitos"; + case -13: + return "Pequeño huesitos"; + case -12: + return "Gran devorador"; + case -11: + return "Pequeño devorador"; + case -10: + return "Slime selvático"; + case -9: + return "Slime amarillo"; + case -8: + return "Slime rojo"; + case -7: + return "Slime morado"; + case -6: + return "Slime negro"; + case -5: + return "Bebé slime"; + case -4: + return "Slime rosa"; + case -3: + return "Slime verde"; + case -2: + return "Slimer"; + case 1: + return "Slime azul"; + case 2: + return "Ojo demoníaco"; + case 3: + return "Zombi"; + case 4: + return "Ojo Cthulhu"; + case 5: + return "Siervo de Cthulhu"; + case 6: + return "Devoraalmas"; + case 7: + case 8: + case 9: + return "Gusano devorador"; + case 10: + case 11: + case 12: + return "Gusano gigante"; + case 13: + case 14: + case 15: + return "Devoramundos"; + case 16: + return "Mamá slime"; + case 17: + return "Mercader"; + case 18: + return "Enfermera"; + case 19: + return "Traficante de armas"; + case 20: + return "Dríada"; + case 21: + return "Esqueleto"; + case 22: + return "Guía"; + case 23: + return "Cabeza meteorito"; + case 24: + return "Diablillo de fuego"; + case 25: + return "Esfera ardiente"; + case 26: + return "Duende peón"; + case 27: + return "Duende ladrón"; + case 28: + return "Duende guerrero"; + case 29: + return "Duende hechicero"; + case 30: + return "Bola del caos"; + case 31: + return "Huesitos furioso"; + case 32: + return "Mago siniestro"; + case 33: + return "Esfera de agua"; + case 34: + return "Cráneo maldito"; + case 35: + return "Esqueletrón"; + case 36: + return "Esqueletrón"; + case 37: + return "Anciano"; + case 38: + return "Demoledor"; + case 39: + case 40: + case 41: + return "Esqueleto de serpiente"; + case 42: + return "Avispón"; + case 43: + return "Devorahombres"; + case 44: + return "Minero zombi"; + case 45: + return "Tim"; + case 46: + return "Conejito"; + case 47: + return "Conejito corrompido"; + case 48: + return "Arpía"; + case 49: + return "Murciélago de cueva"; + case 50: + return "Rey slime"; + case 51: + return "Murciélago de selva"; + case 52: + return "Doctor Látigo"; + case 53: + return "El novio zombi"; + case 54: + return "Buhonero"; + case 55: + return "Pececillo"; + case 56: + return "Atrapadora"; + case 57: + return "Pececillo corrompido"; + case 58: + return "Piraña"; + case 59: + return "Babosa de lava"; + case 60: + return "Murciélago infernal"; + case 61: + return "Buitre"; + case 62: + return "Demonio"; + case 63: + return "Medusa azul"; + case 64: + return "Medusa rosa"; + case 65: + return "Tiburón"; + case 66: + return "Demonio vudú"; + case 67: + return "Cangrejo"; + case 68: + return "Guardián de la mazmorra"; + case 69: + return "Hormiga león"; + case 70: + return "Bola de pinchos"; + case 71: + return "Slime de las mazmorras"; + case 72: + return "Rueda ardiente"; + case 73: + return "Duende explorador"; + case 74: + return "Pájaro"; + case 75: + return "Duendecillo"; + case 77: + return "Esqueleto con armadura"; + case 78: + return "Momia"; + case 79: + return "Momia de la oscuridad"; + case 80: + return "Momia de la luz"; + case 81: + return "Slime corrompido"; + case 82: + return "Espectro"; + case 83: + return "Martillo maldito"; + case 84: + return "Espada encantada"; + case 85: + return "Cofre falso"; + case 86: + return "Unicornio"; + case 87: + case 88: + case 89: + case 90: + case 91: + case 92: + return "Guiverno"; + case 93: + return "Murciélago gigante"; + case 94: + return "Corruptor"; + case 95: + case 96: + case 97: + return "Excavador"; + case 98: + case 99: + case 100: + return "Tragamundos"; + case 101: + return "Lapa"; + case 102: + return "Pez abisal"; + case 103: + return "Medusa verde"; + case 104: + return "Hombre lobo"; + case 105: + return "Duende cautivo"; + case 106: + return "Mago cautivo"; + case 107: + return "Duende chapucero"; + case 108: + return "Mago"; + case 109: + return "Payaso"; + case 110: + return "Esqueleto arquero"; + case 111: + return "Duende arquero"; + case 112: + return "Escupitajo vil"; + case 113: + case 114: + return "Muro carnoso"; + case 115: + case 116: + return "El Famélico"; + case 117: + case 118: + case 119: + return "Sanguijuela"; + case 120: + return "Caos elemental"; + case 121: + return "Slimer"; + case 122: + return "Gasterópodo"; + case 123: + return "Mecánico cautivo"; + case 124: + return "Mecánico"; + case 125: + return "Retinator"; + case 126: + return "Espasmatizador"; + case (int) sbyte.MaxValue: + return "Esqueletrón mayor"; + case 128: + return "Cañón mayor"; + case 129: + return "Sierra mayor"; + case 130: + return "Torno mayor"; + case 131: + return "Láser mayor"; + case 132: + return "Zombi"; + case 133: + return "Ojo errante"; + case 134: + case 135: + case 136: + return "El Destructor"; + case 137: + return "Murciélago luminoso"; + case 138: + return "Slime luminoso"; + case 139: + return "Sonda"; + case 140: + return "Armadura poseída"; + case 141: + return "Fango tóxico"; + case 142: + return "Papá Noel"; + case 143: + return "Muñeco de nieve malote"; + case 144: + return "Señor Stabby"; + case 145: + return "Triunfador de nieve"; + case 147: + return "Hormiga león albina"; + case 148: + return "Orca"; + case 149: + return "Minero vampiro"; + case 150: + return "Slime sombrío"; + case 151: + return "Martillo sombrío"; + case 152: + return "Momia sombría"; + case 153: + return "Gasterópodo espectral"; + case 154: + return "Elemental espectral"; + case 155: + return "Momia espectral"; + case 156: + return "Raptor de dragones"; + case 157: + return "Avispa dragón"; + case 158: + return "Calavera de dragón"; + case 159: + case 160: + case 161: + case 162: + case 163: + case 164: + return "Archiguiverno"; + case 165: + return "Archidemonio"; + case 166: + return "Ocram"; + case 167: + return "Siervo de Ocram"; + default: + return ""; + } + } + } + + public static string toolTip(int l) + { + if (Lang.lang <= 1) + { + switch (l) + { + case 434: + return "Three round burst"; + case 485: + return "Turns the holder into a werewolf on full moons"; + case 486: + return "Creates a grid on screen for block placement"; + case 489: + return "15% increased magic damage"; + case 490: + return "15% increased melee damage"; + case 491: + return "15% increased ranged damage"; + case 492: + case 493: + return "Allows flight and slow fall"; + case 495: + return "Casts a controllable rainbow"; + case 496: + return "Summons a block of ice"; + case 497: + return "Transforms the holder into merfolk when entering water"; + case 506: + return "Uses gel for ammo"; + case 509: + return "Places wire"; + case 510: + return "Removes wire"; + case 515: + return "Creates several crystal shards on impact"; + case 516: + return "Summons falling stars on impact"; + case 517: + return "A magical returning dagger"; + case 518: + return "Summons rapid fire crystal shards"; + case 519: + return "Summons unholy fire balls"; + case 520: + return "'The essence of light creatures'"; + case 521: + return "'The essence of dark creatures'"; + case 522: + return "'Not even water can put the flame out'"; + case 523: + return "Can be placed in water"; + case 524: + return "Used to smelt adamantite ore"; + case 525: + return "Used to craft items from mythril and adamantite bars"; + case 526: + return "'Sharp and magical!'"; + case 527: + return "'Sometimes carried by creatures in corrupt deserts'"; + case 528: + return "'Sometimes carried by creatures in light deserts'"; + case 529: + return "Activates when stepped on"; + case 531: + return "Can be enchanted"; + case 532: + return "Causes stars to fall when injured"; + case 533: + return "50% chance to not consume ammo"; + case 534: + return "Fires a spread of bullets"; + case 535: + return "Reduces the cooldown of healing potions"; + case 536: + return "Increases melee knockback"; + case 541: + case 542: + case 543: + return "Activates when stepped on"; + case 544: + return "Summons The Twins"; + case 547: + return "'The essence of pure terror'"; + case 548: + return "'The essence of the destroyer'"; + case 549: + return "'The essence of omniscient watchers'"; + case 551: + return "7% increased critical strike chance"; + case 552: + return "7% increased damage"; + case 553: + return "15% increased ranged damage"; + case 554: + return "Increases length of invincibility after taking damage"; + case 555: + return "8% reduced mana usage"; + case 556: + return "Summons Destroyer"; + case 557: + return "Summons Skeletron Prime"; + case 558: + return "Increases maximum mana by 100"; + case 559: + return "10% increased melee damage and critical strike chance"; + case 560: + return "Summons King Slime"; + case 561: + return "Stacks up to 5"; + case 575: + return "'The essence of powerful flying creatures'"; + case 576: + return "Has a chance to record songs"; + case 579: + return "'Not to be confused with a hamsaw'"; + case 580: + return "Explodes when activated"; + case 581: + return "Sends water to outlet pumps"; + case 582: + return "Receives water from inlet pumps"; + case 583: + return "Activates every second"; + case 584: + return "Activates every 3 seconds"; + case 585: + return "Activates every 5 seconds"; + case 599: + case 600: + case 601: + return "Press " + (object) '\x0081' + " to open"; + case 602: + return "Summons the Frost Legion"; + case 603: + return "Summons a pet guinea pig"; + case 604: + return "15% increased melee damage and critical strike chance"; + case 605: + return "15% increased ranged damage, 5% chance to not consume ammo"; + case 606: + return "Increases maximum mana by 120"; + case 607: + return "10% increased critical strike chance"; + case 608: + return "5% increased ranged damage, 5% chance to not consume ammo"; + case 609: + return "5% increased magical damage, 10% reduced mana use"; + case 610: + return "12% increased movement speed"; + case 611: + return "10% increased movement speed and ranged damage"; + case 612: + return "10% increased movement speed and magical damage"; + case 613: + return "Has a chance to cause bleeding"; + case 614: + return "A legendary Japanese spear coated in venom"; + case 615: + return "Transforms any suitable ammo into Spectral Arrows"; + case 617: + return "Transforms any suitable ammo into Vulcan Bolts"; + case 619: + return "Summons Ocram"; + case 620: + return "'The essence of infected creatures'"; + case 621: + return "Summons a pet slime"; + case 622: + return "Summons a pet tiphia"; + case 623: + return "Summons a pet bat"; + case 624: + return "Summons a pet werewolf"; + case 625: + return "Summons a pet zombie"; + case 357: + return "Minor improvements to all stats"; + case 361: + return "Summons a Goblin Army"; + case 363: + return "Used for advanced wood crafting"; + case 367: + return "Strong enough to destroy Demon Altars"; + case 371: + return "Increases maximum mana by 40"; + case 372: + return "7% increased movement speed"; + case 373: + return "10% increased ranged damage"; + case 376: + return "Increases maximum mana by 60"; + case 377: + return "5% increased melee critical strike chance"; + case 378: + return "12% increased ranged damage"; + case 385: + return "Can mine Mythril"; + case 386: + return "Can mine Adamantite"; + case 389: + return "Has a chance to confuse"; + case 393: + return "Shows horizontal position"; + case 394: + return "Grants the ability to swim"; + case 395: + return "Shows position"; + case 396: + return "Negates fall damage"; + case 397: + return "Grants immunity to knockback"; + case 398: + return "Allows the combining of some accessories"; + case 399: + return "Allows the holder to double jump"; + case 400: + return "Increases maximum mana by 80"; + case 401: + return "7% increased melee critical strike chance"; + case 402: + return "14% increased ranged damage"; + case 403: + return "6% increased damage"; + case 404: + return "4% increased critical strike chance"; + case 405: + return "Allows flight"; + case 407: + return "Increases block placement range"; + case 422: + return "Spreads the Hallow to some blocks"; + case 423: + return "Spreads the corruption to some blocks"; + case 425: + return "Summons a magical fairy"; + case 327: + return "Opens one Gold Chest"; + case 329: + return "Opens all Shadow Chests"; + case 332: + return "Used for crafting cloth"; + case 352: + return "Used for brewing ale"; + case 261: + return "'It's smiling, might be a good snack'"; + case 266: + return "'This is a good idea!'"; + case 267: + return "'You are a terrible person.'"; + case 268: + return "Greatly extends underwater breathing"; + case 272: + return "Casts a demon scythe"; + case 281: + return "Allows the collection of seeds for ammo"; + case 282: + return "Works when wet"; + case 283: + return "For use with Blowpipe"; + case 285: + return "5% increased movement speed"; + case 288: + return "Provides immunity to lava"; + case 289: + return "Provides life regeneration"; + case 290: + return "25% increased movement speed"; + case 291: + return "Breathe water instead of air"; + case 292: + return "Increase defense by 8"; + case 293: + return "Increased mana regeneration"; + case 294: + return "20% increased magic damage"; + case 295: + return "Slows falling speed"; + case 296: + return "Shows the location of treasure and ore"; + case 297: + return "Grants invisibility"; + case 298: + return "Emits an aura of light"; + case 299: + return "Increases night vision"; + case 300: + return "Increases enemy spawn rate"; + case 301: + return "Attackers also take damage"; + case 302: + return "Allows the ability to walk on water"; + case 303: + return "20% increased arrow speed and damage"; + case 304: + return "Shows the location of enemies"; + case 305: + return "Allows the control of gravity"; + case 324: + return "'Banned in most places'"; + case 222: + return "Grows plants"; + case 223: + return "6% reduced mana usage"; + case 228: + case 229: + case 230: + return "Increases maximum mana by 20"; + case 235: + return "'Tossing may be difficult.'"; + case 237: + return "'Makes you look cool!'"; + case 238: + return "15% increased magic damage"; + case 193: + return "Grants immunity to fire blocks"; + case 197: + return "Shoots fallen stars"; + case 208: + return "'It's pretty, oh so pretty'"; + case 211: + return "12% increased melee speed"; + case 212: + return "10% increased movement speed"; + case 213: + return "Creates grass on dirt"; + case 215: + return "'May annoy others'"; + case 218: + return "Summons a controllable ball of fire"; + case 175: + return "'Hot to the touch'"; + case 186: + return "'Because not drowning is kinda nice'"; + case 187: + return "Grants the ability to swim"; + case 98: + return "33% chance to not consume ammo"; + case 100: + case 101: + case 102: + return "7% increased melee speed"; + case 103: + return "Able to mine Hellstone"; + case 109: + return "Permanently increases maximum mana by 20"; + case 111: + return "Increases maximum mana by 20"; + case 112: + return "Throws balls of fire"; + case 113: + return "Casts a controllable missile"; + case 114: + return "Magically moves dirt"; + case 115: + return "Creates a magical orb of light"; + case 117: + return "'Warm to the touch'"; + case 118: + return "Sometimes dropped by Skeletons and Piranha"; + case 120: + return "Lights wooden arrows ablaze"; + case 121: + return "'It's made out of fire!'"; + case 123: + case 124: + case 125: + return "5% increased magic damage"; + case 128: + return "Allows flight"; + case 148: + return "Holding this may attract unwanted attention"; + case 149: + return "'It contains strange symbols'"; + case 151: + case 152: + case 153: + return "4% increased ranged damage."; + case 156: + return "Grants immunity to knockback"; + case 157: + return "Sprays out a shower of water"; + case 158: + return "Negates fall damage"; + case 159: + return "Increases jump height"; + case 165: + return "Casts a slow moving bolt of water"; + case 166: + return "A small explosion that will destroy some tiles"; + case 167: + return "A large explosion that will destroy most tiles"; + case 168: + return "A small explosion that will not destroy tiles"; + case 75: + return "Disappears after the sunrise"; + case 84: + return "'Get over here!'"; + case 88: + return "Provides light when worn"; + case 43: + return "Summons the Eye of Cthulhu"; + case 49: + return "Slowly regenerates life"; + case 50: + return "Gaze in the mirror to return home"; + case 53: + return "Allows the holder to double jump"; + case 54: + return "The wearer can run super fast"; + case 56: + case 57: + return "'Pulsing with dark energy'"; + case 64: + return "Summons a vile thorn"; + case 65: + return "Causes stars to rain from the sky"; + case 66: + return "Cleanses the corruption"; + case 67: + return "Removes the Hallow"; + case 68: + return "'Looks tasty!'"; + case 70: + return "Summons the Eater of Worlds"; + case 29: + return "Permanently increases maximum life by 20"; + case 33: + return "Used for smelting ore"; + case 35: + return "Used to craft items from metal bars"; + case 36: + return "Used for basic crafting"; + case -1: + return "Can mine Meteorite"; + case 8: + return "Provides light"; + case 15: + case 16: + case 17: + return "Tells the time"; + case 18: + return "Shows depth"; + case 23: + return "'Both tasty and flammable'"; + } + } + else if (Lang.lang == 2) + { + switch (l) + { + case 434: + return "Dreifachschuss"; + case 485: + return "Verwandelt den Inhaber bei Vollmond in einen Werwolf"; + case 486: + return "Erstellt ein Raster auf dem Bildschirm zum Platzieren der Blöcke"; + case 489: + return "Um 15% erhöhter magischer Schaden"; + case 490: + return "Um 15% erhöhter Nahkampfschaden"; + case 491: + return "Um 15% erhöhter Fernkampfschaden"; + case 492: + return "Ermoeglicht Flug und langsamen Fall"; + case 493: + return "Ermöglicht Flug und langsamen Fall"; + case 495: + return "Wirft einen steuerbaren Regenbogen aus"; + case 496: + return "Ruft einen Eisblock herbei"; + case 497: + return "Verwandelt den Besitzer beim Hineingehen ins Wasser in Meermenschen"; + case 506: + return "Verwendet Glibber als Munition"; + case 509: + return "Platziert Kabel"; + case 510: + return "Entfernt Kabel"; + case 515: + return "Erzeugt beim Aufprall mehrere Kristallscherben"; + case 516: + return "Ruft beim Aufprall Sternschnuppen herbei"; + case 517: + return "Ein Dolch, der magisch zurückkehrt"; + case 518: + return "Ruft schnelle Feuerkristallscherben herbei"; + case 519: + return "Ruft unheilige Feuerbälle herbei"; + case 520: + return "'Die Essenz von Lichtkreaturen'"; + case 521: + return "'Die Essenz von Finsterkreaturen'"; + case 522: + return "'Nicht einmal Wasser löscht diese Flamme'"; + case 523: + return "Kann in Wasser platziert werden"; + case 524: + return "Zum Schmelzen von Adamantiterz"; + case 525: + return "Zur Herstellung von Items aus Mithril- und Adamantitbarren"; + case 526: + return "'Scharf und magisch!'"; + case 527: + return "'Kreaturen in verderbten Wüsten tragen sie mitunter'"; + case 528: + return "'Werden mitunter von Kreaturen in Lichtwüsten getragen'"; + case 529: + return "Wird beim Betreten aktiviert"; + case 531: + return "Zum Zaubern"; + case 532: + return "Lässt Sterne bei Verletzung herabfallen"; + case 533: + return "50%ige Chance, keine Munition zu verbrauchen"; + case 534: + return "Feuert einen Kugelregen ab"; + case 535: + return "Verringert die Abklingzeit von Heiltränken"; + case 536: + return "Erhöht Nahkampf-Rückstoss"; + case 541: + return "Wird beim Betreten aktiviert"; + case 542: + return "Wird beim Betreten aktiviert"; + case 543: + return "Wird beim Betreten aktiviert"; + case 544: + return "Ruft die Zwillinge herbei"; + case 547: + return "'Die Essenz reinen Schreckens'"; + case 548: + return "'Die Essenz des Zerstörers'"; + case 549: + return "'Die Essenz der allwissenden Beobachter'"; + case 551: + return "Um 7% erhöhte kritische Trefferchance"; + case 552: + return "Um 7% erhöhter Schaden"; + case 553: + return "Um 15% erhöhter Fernkampfschaden"; + case 554: + return "Verlängert die Unbesiegbarkeit nach erlittenem Schaden"; + case 555: + return "Um 8% reduzierte Mananutzung"; + case 556: + return "Ruft den Zerstörer"; + case 557: + return "Ruft Skeletron Prime herbei"; + case 558: + return "Erhöht die maximale Mana um 100"; + case 559: + return "Nahkampfschaden und kritische Trefferchance um 10% erhöht"; + case 560: + return "Ruft Schleimkönig herbei"; + case 561: + return "Kann bis zu 5 stapeln"; + case 575: + return "'Essenz mächtiger fliegender Kreaturen'"; + case 576: + return "Kann Songs aufzeichnen"; + case 579: + return "'Nicht mit einer Hamsäge zu verwechseln'"; + case 580: + return "Explodiert bei Aktivierung"; + case 581: + return "Sendet Wasser zu Auslasspumpen"; + case 582: + return "Empfängt Wasser von Einlasspumpen"; + case 583: + return "Aktiviert jede Sekunde"; + case 584: + return "Aktiviert alle 3 Sekunden"; + case 585: + return "Aktiviert alle 5 Sekunden"; + case 599: + case 600: + case 601: + return "Drücke " + (object) '\x0081' + " zum Öffnen"; + case 602: + return "Beschwört die Frost Legion"; + case 603: + return "Ruft ein Haustier-Meerschweinchen herbei"; + case 604: + return "Nahkampfschaden und kritische Trefferchance um 15% erhöht"; + case 605: + return "Um 15% erhöhter Fernkampf-Schaden, 5%ige Chance, keine Munition zu verbrauchen"; + case 606: + return "Erhöht maximales Mana um 120"; + case 607: + return "Kritische Trefferchance um 10% erhöht"; + case 608: + return "Um 5% erhöhter Fernkampf-Schaden, 5%ige Chance, keine Munition zu verbrauchen"; + case 609: + return "Um 5% erhöhter Magieschaden, um 10% reduzierte Mana-Nutzung"; + case 610: + return "Um 10% erhöhtes Bewegungstempo"; + case 611: + return "Um 10% erhöhtes Bewegungstempo und Fernkampf-Schaden"; + case 612: + return "Um 10% erhöhtes Bewegungstempo und Magieschaden"; + case 613: + return "Kann Blutungen verursachen"; + case 614: + return "Ein legendärer japanischer Speer, der in Gift getaucht wurde"; + case 615: + return "Verwandelt jede passende Munition in Spektralpfeile"; + case 617: + return "Verwandelt jede passende Munition in Vulkanbolzen"; + case 619: + return "Ruft Ocram herbei"; + case 620: + return "'Die Essenz von infizierten Kreaturen'"; + case 621: + return "Ruft einen Haustier-Schleim herbei"; + case 622: + return "Ruft eine Haustier-Tiphia herbei"; + case 623: + return "Ruft eine Haustier-Fledermaus herbei"; + case 624: + return "Ruft einen Haustier-Werwolf herbei"; + case 625: + return "Ruft einen Haustier-Zombie herbei"; + case 357: + return "Geringe Anhebung aller Werte"; + case 361: + return "Ruft eine Goblin-Armee herbei"; + case 363: + return "Für fortgeschrittene Holzherstellung"; + case 367: + return "Stark genug, um Dämonenaltäre zu zerstören"; + case 371: + return "Erhöht die maximale Mana um 40"; + case 372: + return "Um 7% erhöhtes Bewegungstempo"; + case 373: + return "Um 10% erhöhter Fernkampfschaden"; + case 376: + return "Erhöht die maximale Mana um 60"; + case 377: + return "Um 5% erhöhte kritische Nahkampf-Trefferchance"; + case 378: + return "Um 12% erhöhter Fernkampf-Schaden"; + case 385: + return "Kann Mithril abbauen"; + case 386: + return "Kann Adamantit abbauen"; + case 389: + return "Kann Verwirrung stiften"; + case 393: + return "Zeigt horizontale Position"; + case 394: + return "Befähigt zum Schwimmen"; + case 395: + return "Zeigt Position an"; + case 396: + return "Hebt Sturzschaden auf"; + case 397: + return "Macht immun gegen Rückstoß"; + case 398: + return "Ermöglicht die Kombination von Zubehör"; + case 399: + return "Berechtigt den Inhaber zum Doppelsprung"; + case 400: + return "Erhöht die maximale Mana um 80"; + case 401: + return "Um 7% erhöhte kritische Nahkampf-Trefferchance"; + case 402: + return "Um 14% erhöhter Fernkampfschaden"; + case 403: + return "Um 6% erhöhter Schaden"; + case 404: + return "Um 4% erhöhte kritische Trefferchance"; + case 405: + return "Lässt fliegen"; + case 407: + return "Erweitert den Platzierbereich von Blöcken"; + case 422: + return "Verspritzt Heil auf einige Blöcke"; + case 423: + return "Verteilt Verderben auf einige Blöcke"; + case 425: + return "Ruft eine magische Fee herbei"; + case 327: + return "Öffnet eine Goldtruhe"; + case 329: + return "Öffnet alle Schattentruhen"; + case 332: + return "Verwendet für die Herstellung von Kleidung"; + case 352: + return "Zum Bierbrauen"; + case 261: + return "'Er lächelt - vielleicht schmeckt er auch gut...'"; + case 266: + return "'Das ist eine gute Idee!'"; + case 267: + return "'Du bist ein schrecklicher Mensch.'"; + case 268: + return "Verleiht deutlich mehr Atemluft unter Wasser"; + case 272: + return "Wirft eine Dämonensense aus"; + case 281: + return "Zum Erstellen einer Saatsammlung als Munition"; + case 282: + return "Funktioniert bei Naesse"; + case 283: + return "Zur Verwendung im Blasrohr"; + case 285: + return "Um 5% erhöhtes Bewegungstempo"; + case 288: + return "Macht immun gegen Lava"; + case 289: + return "Belebt wieder"; + case 290: + return "Erhöht Bewegungstempo um 25%"; + case 291: + return "Wasser statt Luft atmen"; + case 292: + return "Erhöht die Abwehr um 8"; + case 293: + return "Erhöhte Mana-Wiederherstellung"; + case 294: + return "Erhöht magischen Schaden um 20%"; + case 295: + return "Verlangsamt das Sturztempo"; + case 296: + return "Zeigt den Fundort von Schätzen und Erz"; + case 297: + return "Macht unsichtbar"; + case 298: + return "Verströmt eine Aura aus Licht"; + case 299: + return "Erhöht die Nachtsicht"; + case 300: + return "Erhöht Feind-Spawnquote"; + case 301: + return "Auch die Angreifer erleiden Schaden"; + case 302: + return "Befähigt, auf dem Wasser zu gehen"; + case 303: + return "Erhöht Pfeiltempo und Schaden um 20%"; + case 304: + return "Zeigt die Position von Feinden"; + case 305: + return "Zur Steuerung der Schwerkraft"; + case 324: + return "'An den meisten Orten verboten'"; + case 222: + return "Lässt Pflanzen wachsen"; + case 223: + return "Um 6% reduzierte Mana-Nutzung"; + case 228: + return "Erhoeht die maximale Mana um 20"; + case 229: + return "Erhoeht die maximale Mana um 20"; + case 230: + return "Erhöht die maximale Mana um 20"; + case 235: + return "'Werfen könnte schwierig werden.'"; + case 237: + return "'Damit siehst du cool aus!'"; + case 238: + return "Um 15% erhöhter magischer Schaden"; + case 193: + return "Macht immun gegen Feuer-Blöcke"; + case 197: + return "Schießt Sternschnuppen herunter"; + case 208: + return "'Oh, ist das hübsch!'"; + case 211: + return "Um 12% erhöhtes Nahkampftempo"; + case 212: + return "Um 10% erhöhtes Bewegungstempo"; + case 213: + return "Lässt Gras auf Schmutz wachsen"; + case 215: + return "'Kann Ärger erregen'"; + case 218: + return "Ruft einen steuerbaren Feuerball herbei"; + case 175: + return "'Heiß, heiß, heiß!'"; + case 186: + return "'Ganz nett, nicht ertrinken zu müssen'"; + case 187: + return "Befähigt zum Schwimmen"; + case 98: + return "33%ige Chance, keine Munition zu verbrauchen"; + case 100: + return "Um 7% erhoehtes Nahkampftempo"; + case 101: + return "Um 7% erhoehtes Nahkampftempo"; + case 102: + return "Um 7% erhoehtes Nahkampftempo"; + case 103: + return "Kann Höllenstein abbauen"; + case 109: + return "Erhöht maximales Mana um 20"; + case 111: + return "Erhöht die maximale Mana um 20"; + case 112: + return "Schießt Feuerbälle ab"; + case 113: + return "Wirft eine steuerbare Rakete aus"; + case 114: + return "Bewegt magisch Dreck"; + case 115: + return "Erschafft eine magische Lichtkugel"; + case 117: + return "'Fühlt sich warm an'"; + case 118: + return "Fällt mitunter von Skeletten und Piranhas herab"; + case 120: + return "Entfacht lodernde Holzpfeile"; + case 121: + return "'Ist ganz aus Feuer!'"; + case 123: + return "Um 5% erhoehter magischer Schaden"; + case 124: + return "Um 5% erhoehter magischer Schaden"; + case 125: + return "Um 5% erhöhter magischer Schaden"; + case 128: + return "Lässt fliegen"; + case 148: + return "Kann unerwünschte Aufmerksamkeit erwecken"; + case 149: + return "'Es enthält seltsame Symbole'"; + case 151: + return "Um 4% erhöhter Fernkampf-Schaden"; + case 152: + return "Um 4% erhöhter Fernkampf-Schaden"; + case 153: + return "Um 4% erhöhter Fernkampf-Schaden"; + case 156: + return "Macht immun gegen Rückstoß"; + case 157: + return "Versprüht eine Wasserdusche"; + case 158: + return "Hebt Sturzschaden auf"; + case 159: + return "Vergrößert die Sprunghöhe"; + case 165: + return "Wirft einen sich langsam bewegenden Wasserbolzen aus"; + case 166: + return "Eine kleine Explosion, die einige Felder zerstören wird"; + case 167: + return "Eine große Explosion, die die meisten Felder zerstört"; + case 168: + return "Eine kleine Explosion, die keine Felder zerstört"; + case 75: + return "Verschwindet nach Sonnenaufgang"; + case 84: + return "'Komm hier rüber!'"; + case 88: + return "Verströmt beim Tragen Licht"; + case 43: + return "Ruft das Auge von Cthulhu herbei"; + case 49: + return "Belebt langsam wieder"; + case 50: + return "Ein Blick in den Spiegel bringt einen zurück nach Hause"; + case 53: + return "Berechtigt den Inhaber zum Doppelsprung"; + case 54: + return "Der Träger kann superschnell rennen"; + case 56: + return "'Durchpulst von dunkler Energie'"; + case 57: + return "'Durchpulst von dunkler Energie'"; + case 64: + return "Ruft einen Ekeldorn herbei"; + case 65: + return "Lässt Sterne vom Himmel regnen"; + case 66: + return "Reinigt das Verderben"; + case 67: + return "Entfernt das Heilige"; + case 68: + return "'Sieht lecker aus!'"; + case 70: + return "Ruft den Weltenfresser herbei"; + case 29: + return "Erhöht dauerhaft die maximale Lebensspanne um 20"; + case 33: + return "Wird für die Verhüttung von Erz verwendet"; + case 35: + return "Wird verwendet, um Items aus Metallbarren herzustellen"; + case 36: + return "Wird zur einfachen Herstellung verwendet"; + case -1: + return "Kann Meteorite abbauen"; + case 8: + return "Verströmt Licht"; + case 15: + return "Zeigt die Zeit an"; + case 16: + return "Zeigt die Zeit an"; + case 17: + return "Zeigt die Zeit an"; + case 18: + return "Zeigt die Tiefe an"; + case 23: + return "'Lecker und brennbar'"; + } + } + else if (Lang.lang == 3) + { + switch (l) + { + case 434: + return "Tre raffiche"; + case 485: + return "Durante la luna piena trasforma il portatore in un lupo mannaro"; + case 486: + return "Crea una griglia sullo schermo per posizionare i blocchi"; + case 489: + return "Danno magico aumentato del 15%"; + case 490: + return "Danno da mischia aumentato del 15%"; + case 491: + return "Danno boomerang aumentato del 15%"; + case 492: + return "Permettono il volo e la caduta lenta"; + case 493: + return "Permettono il volo e la caduta lenta"; + case 495: + return "Genera un arcobaleno guidato"; + case 496: + return "Evoca un blocco di ghiaccio"; + case 497: + return "Trasforma il portatore in Tritone quando entra in acqua"; + case 506: + return "Utilizza la gelatina come munizione"; + case 509: + return "Posiziona i cavi"; + case 510: + return "Rimuove i cavi"; + case 515: + return "Crea svariati frammenti di cristallo all'impatto"; + case 516: + return "Evoca stelle cadenti all'impatto"; + case 517: + return "Un pugnale magico che ritorna"; + case 518: + return "Evoca veloci frammenti di cristallo infuocati"; + case 519: + return "Evoca sfere di fuoco profane"; + case 520: + return "'L'essenza delle creature della luce'"; + case 521: + return "'L'essenza delle creature oscure'"; + case 522: + return "'Neanche l'acqua può spegnere la fiamma'"; + case 523: + return "Può essere messa in acqua"; + case 524: + return "Utilizzata per fondere il minerale adamantio"; + case 525: + return "Utilizzata per creare oggetti da barre di mitrilio e adamantio"; + case 526: + return "'Appuntito e magico!'"; + case 527: + return "'A volte portato dalle creature nei deserti corrotti'"; + case 528: + return "'A volte portato dalle creature nei deserti di luce'"; + case 529: + return "Si attiva quando calpestata"; + case 531: + return "Può essere incantato"; + case 532: + return "Causa la caduta delle stelle quando colpito"; + case 533: + return "50% di possibilità di non consumare munizioni"; + case 534: + return "Spara una rosa di proiettili"; + case 535: + return "Riduce la ricarica della pozione curativa"; + case 536: + return "Aumenta lo spintone nel corpo a corpo"; + case 541: + return "Si attiva quando calpestata"; + case 542: + return "Si attiva quando calpestata"; + case 543: + return "Si attiva quando calpestata"; + case 544: + return "Evoca i Gemelli"; + case 547: + return "'L'essenza del terrore puro'"; + case 548: + return "'L'essenza del distruttore'"; + case 549: + return "'L'essenza degli osservatori onniscienti'"; + case 551: + return "Possibilità di colpo critico aumentata del 7%"; + case 552: + return "Danno aumentato del 7%"; + case 553: + return "Danno boomerang aumentato del 15%"; + case 554: + return "Aumenta la durata dell'invincibilità dopo aver subito danni"; + case 555: + return "Consumo mana ridotto del 8%"; + case 556: + return "Evoca il Distruttore"; + case 557: + return "Evoca lo Skeletron primario"; + case 558: + return "Aumenta il mana massimo di 100"; + case 559: + return "Possibilità di danno da mischia critico aumentate del 10%"; + case 560: + return "Evoca lo Slime re"; + case 561: + return "Raccoglie fino a 5"; + case 575: + return "'L'essenza delle potenti creature volanti'"; + case 576: + return "Ha una possibilità di registrare canzoni"; + case 579: + return "'Da non confondere con il Segartello'"; + case 580: + return "Esplodono quando attivati"; + case 581: + return "Invia acqua alle pompe esterne"; + case 582: + return "Riceve acqua dalle pompe interne"; + case 583: + return "Si attiva ogni secondo"; + case 584: + return "Si attiva ogni 3 secondi"; + case 585: + return "Si attiva ogni 5 secondi"; + case 599: + case 600: + case 601: + return "Premi " + (object) '\x0081' + " per aprire"; + case 602: + return "Evoca la Legione gelo"; + case 603: + return "Evoca un porcellino d'India "; + case 604: + return "Danno da mischia e possibilità di colpo critico aumentati del 15%"; + case 605: + return "Danno boomerang aumentato del 15%, 5% di possibilità di non consumare munizioni"; + case 606: + return "Aumenta il mana massimo di 120"; + case 607: + return "Possibilità di colpo critico aumentata del 10%"; + case 608: + return "Danno boomerang aumentato del 5%, 5% di possibilità di non consumare munizioni"; + case 609: + return "Danno magico aumentato del 5%, consumo del mana ridotto del 10%"; + case 610: + return "Velocità di movimento aumentata del 12%"; + case 611: + return "Velocità di movimento e danno boomerang aumentati del 10%"; + case 612: + return "Velocità di movimento e danno magico aumentati del 10%"; + case 613: + return "Ha la possibilità di provocare un sanguinamento"; + case 614: + return "Una leggendaria lancia giapponese ricoperta di veleno"; + case 615: + return "Trasforma qualsiasi munizione adatta in Frecce spettrali"; + case 617: + return "Trasforma qualsiasi munizione adatta in Balestre vulcaniche"; + case 619: + return "Evoca Ocram"; + case 620: + return "'L'essenza delle creature contaminate'"; + case 621: + return "Evoca uno slime"; + case 622: + return "Evoca una vespa"; + case 623: + return "Evoca un pipistrello"; + case 624: + return "Evoca un lupo mannaro"; + case 625: + return "Evoca uno zombie"; + case 357: + return "Migliorie minori a tutti i parametri"; + case 361: + return "Evoca un Esercito dei Goblin"; + case 363: + return "Utilizzata per una lavorazione del legno avanzata"; + case 367: + return "Abbastanza forte per distruggere gli Altari dei demoni"; + case 371: + return "Aumenta il mana massimo di 40"; + case 372: + return "Velocità di movimento aumentata del 7%"; + case 373: + return "Danno boomerang aumentato del 10%"; + case 376: + return "Aumenta il mana massimo di 60"; + case 377: + return "Possibilità di colpo critico nel corpo a corpo aumentata del 5%"; + case 378: + return "Danno boomerang aumentato del 12%"; + case 385: + return "Può estrarre Mitrilio"; + case 386: + return "Può estrarre Adamantio"; + case 389: + return "Può confondere"; + case 393: + return "Mostra posizione orizzontale"; + case 394: + return "Abilita al nuoto"; + case 395: + return "Mostra posizione"; + case 396: + return "Annulla i danni da caduta"; + case 397: + return "Permette immunità allo spintone"; + case 398: + return "Permette la combinazione di alcuni accessori"; + case 399: + return "Permette il salto doppio"; + case 400: + return "Aumenta il mana massimo di 80"; + case 401: + return "Possibilità di colpo critico nel corpo a corpo aumentata del 7%"; + case 402: + return "Danno boomerang aumentato del 14%"; + case 403: + return "Danno aumentato del 6%"; + case 404: + return "Possibilità di colpo critico aumetata del 4%"; + case 405: + return "Permettono di volare"; + case 407: + return "Aumenta la possibilità di posizionamento dei blocchi"; + case 422: + return "Spruzza acquasanta su alcuni blocchi"; + case 423: + return "Diffonde la corruzione su alcuni blocchi"; + case 425: + return "Evoca una fata magica"; + case 327: + return "Apre una Cassa d'oro"; + case 329: + return "Apre tutte le Casse ombra"; + case 332: + return "Utilizzato per creare abiti"; + case 352: + return "Utilizzato per produrre birra"; + case 261: + return "'Sta ridendo, potrebbe essere uno spuntino appetitoso'"; + case 266: + return "'Buona idea!'"; + case 267: + return "'Sei una persona terribile.'"; + case 268: + return "Aumenta moltissimo il respiro sott'acqua"; + case 272: + return "Evoca una falce demoniaca"; + case 281: + return "Permette la raccolta di semi come munizioni"; + case 282: + return "Funziona da bagnato"; + case 283: + return "Da utilizzare con la Cerbottana"; + case 285: + return "Velocità di movimento aumentata del 5%"; + case 288: + return "Fornisce immunità alla lava"; + case 289: + return "Rigenera la vita"; + case 290: + return "Velocità di movimento aumentata del 25%"; + case 291: + return "Respira acqua invece di aria"; + case 292: + return "Aumenta la difesa di 8"; + case 293: + return "Aumenta la rigenerazione del mana"; + case 294: + return "Danno magico aumentato del 20%"; + case 295: + return "Velocità di caduta lenta"; + case 296: + return "Mostra l'ubicazione di tesori e dei minerali"; + case 297: + return "Rende invisibili"; + case 298: + return "Emette un'aura di luce"; + case 299: + return "Migliora la visione notturna"; + case 300: + return "Aumenta il ritmo di generazone dei nemici"; + case 301: + return "Anche gli aggressori subiscono danni"; + case 302: + return "Consente di camminare sull'acqua"; + case 303: + return "Velocità e danni della freccia aumentati del 20%"; + case 304: + return "Mostra la posizione dei nemici"; + case 305: + return "Permette il controllo della gravità"; + case 324: + return "'Bandita in molti luoghi'"; + case 222: + return "Fa crescere le piante"; + case 223: + return "Consumo mana ridotto del 6%"; + case 228: + return "Aumenta il mana massimo di 20"; + case 229: + return "Aumenta il mana massimo di 20"; + case 230: + return "Aumenta il mana massimo di 20"; + case 235: + return "'Lanciare potrebbe essere difficile.'"; + case 237: + return "'Migliora il tuo look!'"; + case 238: + return "Danno magico aumentato del 15%"; + case 193: + return "Permette immunità ai blocchi di fuoco"; + case 197: + return "Spara stelle cadenti"; + case 208: + return "'Graziosa, oh com'è graziosa'"; + case 211: + return "Velocità del corpo a corpo aumentata del 12%"; + case 212: + return "Velocità di movimento aumentata del 10%"; + case 213: + return "Crea erba dalla terra"; + case 215: + return "'Può disturbare gli altri'"; + case 218: + return "Evoca una palla di fuoco guidata"; + case 175: + return "'Calda al tocco'"; + case 186: + return "'Perché non annegare è alquanto piacevole'"; + case 187: + return "Abilita al nuoto"; + case 98: + return "33% di possibilità di non consumare munizioni"; + case 100: + return "Velocità del corpo a corpo aumentata del 7%"; + case 101: + return "Velocità del corpo a corpo aumentata del 7%"; + case 102: + return "Velocità del corpo a corpo aumentata del 7%"; + case 103: + return "In grado di estrarre la pietra infernale"; + case 109: + return "Aumenta in maniera permanente il mana massimo di 20"; + case 111: + return "Aumenta il mana massimo di 20"; + case 112: + return "Tira palle di fuoco"; + case 113: + return "Scaglia un missile guidato"; + case 114: + return "Muovi magicamente la terra"; + case 115: + return "Crea una sfera di luce magica"; + case 117: + return "'Calda al tocco'"; + case 118: + return "Lanciato a volte da Scheletri e Piranha"; + case 120: + return "Incendia le frecce di legno"; + case 121: + return "'Creato dal fuoco!'"; + case 123: + return "Danno magico aumentato del 5%"; + case 124: + return "Danno magico aumentato del 5%"; + case 125: + return "Danno magico aumentato del 5%"; + case 128: + return "Permettono di volare"; + case 148: + return "Avere questo oggetto potrebbe attirare attenzione non desiderata"; + case 149: + return "'Contiene simboli strani'"; + case 151: + return "Danno boomerang aumentato del 4%"; + case 152: + return "Danno boomerang aumentato del 4%"; + case 153: + return "Danno boomerang aumentato del 4%"; + case 156: + return "Permette immunità allo spintone"; + case 157: + return "Spruzza una cascata d'acqua"; + case 158: + return "Annulla i danni da caduta"; + case 159: + return "Aumenta l'altezza del salto"; + case 165: + return "Lancia un dardo di acqua lento"; + case 166: + return "Una piccola esplosione che distruggerà alcune mattonelle"; + case 167: + return "Una grande esplosione che distruggerà molte mattonelle"; + case 168: + return "Una piccola esplosione che non distruggerà mattonelle"; + case 75: + return "Sparisce dopo l'alba"; + case 84: + return "'Vieni qui!'"; + case 88: + return "Fa luce una volta indossato"; + case 43: + return "Evoca l'Occhio di Cthulhu"; + case 49: + return "Rigenera la vita lentamente"; + case 50: + return "Guarda nello specchio per tornare a casa"; + case 53: + return "Permette il salto doppio"; + case 54: + return "Colui che li indossa può correre velocissimo"; + case 56: + return "'Pulsa di energia oscura'"; + case 57: + return "'Pulsa di energia oscura'"; + case 64: + return "Evoca una spina vile"; + case 65: + return "Fa piovere le stelle dal cielo"; + case 66: + return "Ripulisce la corruzione"; + case 67: + return "Rimuove il consacrato"; + case 68: + return "'Gustoso!'"; + case 70: + return "Evoca il Mangiatore di Mondi"; + case 29: + return "Aumenta in maniera permanente la vita massima di 20"; + case 33: + return "Utilizzato per fondere i minerali"; + case 35: + return "Utilizzato per creare oggetti dalle barre di metallo"; + case 36: + return "Utilizzato per la creazione di base"; + case -1: + return "Può estrarre meteorite"; + case 8: + return "Fornisce luce"; + case 15: + return "Indica il tempo"; + case 16: + return "Indica il tempo"; + case 17: + return "Indica il tempo"; + case 18: + return "Mostra la profondità"; + case 23: + return "'Sia gustoso che infiammabile'"; + } + } + else if (Lang.lang == 4) + { + switch (l) + { + case 434: + return "Tire des rafales de trois coups"; + case 485: + return "Transforme le porteur en loup-garou à la pleine lune"; + case 486: + return "Crée une grille à l'écran pour le placement des blocs"; + case 489: + return "Dégâts magiques augmentés de 15 %"; + case 490: + return "Dégâts de mêlée augmentés de 15 %"; + case 491: + return "Dégâts à distance augmentés de 15 %"; + case 492: + return "Permet de voler et de ralentir la chute"; + case 493: + return "Permet de voler et de ralentir la chute"; + case 495: + return "Lance un arc-en-ciel contrôlable"; + case 496: + return "Invoque un bloc de glace"; + case 497: + return "Transforme le porteur en sirène lorsqu'il entre dans l'eau"; + case 506: + return "Utilise du gel comme carburant"; + case 509: + return "Joint les câbles"; + case 510: + return "Coupe les câbles"; + case 515: + return "Crée plusieurs éclats de cristal à l'impact"; + case 516: + return "Invoque des étoiles déchues à l'impact"; + case 517: + return "Une dague qui revient magiquement à son possesseur"; + case 518: + return "Invoque des éclats rapides de cristal de feu"; + case 519: + return "Invoque des boules de feu maudites"; + case 520: + return "« L'essence des créatures de lumière »"; + case 521: + return "« L'essence des créatures sombres »"; + case 522: + return "« Même l'eau ne peut l'éteindre »"; + case 523: + return "Peut être placée dans l'eau"; + case 524: + return "Utilisée pour fondre le minerai d'adamantine"; + case 525: + return "Utilisée pour forger des objets avec du mythril et de l'adamantite"; + case 526: + return "« Magique et coupante »"; + case 527: + return "« Porté parfois par les créatures dans le désert corrompu »"; + case 528: + return "« Porté parfois par les créatures dans le désert de lumière »"; + case 529: + return "S'active en marchant dessus"; + case 531: + return "Peut être enchanté"; + case 532: + return "Des étoiles tombent lorsque le porteur est blessé"; + case 533: + return "50 % de chance de n'utiliser aucune munition"; + case 534: + return "Disperse une salve de balles"; + case 535: + return "Réduit le temps d'utilisation entre les potions de soin"; + case 536: + return "Accroît le recul en mêlée"; + case 541: + return "S'active en marchant dessus"; + case 542: + return "S'active en marchant dessus"; + case 543: + return "S'active en marchant dessus"; + case 544: + return "Invoque les Jumeaux"; + case 547: + return "« L'essence de la terreur pure »"; + case 548: + return "« L'essence du destructeur »"; + case 549: + return "« L'essence des observateurs omniscients »"; + case 551: + return "Chance de coup critique augmentée de 7 %"; + case 552: + return "Dégâts augmentés de 7 %"; + case 553: + return "Dégâts à distance augmentés de 15 %"; + case 554: + return "Augmente la durée d'invincibilité après avoir subi des dégâts"; + case 555: + return "Utilisation de mana réduite de 8 %"; + case 556: + return "Invoque le destructeur"; + case 557: + return "Invoque le Skeletron Prime"; + case 558: + return "Augmente le maximum de mana de 100"; + case 559: + return "Chance de coup critique et dégâts de mêlée augmentés de 10 %"; + case 560: + return "Invoque le roi slime"; + case 561: + return "Possibilité d'en empiler jusqu'à 5"; + case 575: + return "« L'essence des puissantes créatures volantes »"; + case 576: + return "A une chance d'enregistrer un morceau"; + case 579: + return "« À ne pas confondre avec le marteau-scie »"; + case 580: + return "Explosent lorsqu'ils sont activés"; + case 581: + return "Envoie de l'eau aux sorties de pompage"; + case 582: + return "Reçoit de l'eau des postes de pompage"; + case 583: + return "S'active chaque seconde"; + case 584: + return "S'active toutes les 3 secondes"; + case 585: + return "S'active toutes les 5 secondes"; + case 599: + case 600: + case 601: + return "Appuyez sur" + (object) '\x0081' + "pour ouvrir"; + case 602: + return "Invoque la Légion gel"; + case 603: + return "Invoque un cochon d'Inde de compagnie"; + case 604: + return "Dégâts de mêlée et chance de coup critique, augmentés de 15 %"; + case 605: + return "Dégâts à distance augmentés de 15 %, 5 % de chance de n'utiliser aucune munition"; + case 606: + return "Maximum de mana augmenté de 120"; + case 607: + return "Chance de coup critique augmentée de 10 %"; + case 608: + return "Dégâts à distance augmentés de 5 %, 5 % de chance de n'utiliser aucune munition"; + case 609: + return "Dégâts magiques augmentés de 5 %, utilisation du mana réduite de 10 %"; + case 610: + return "Vitesse de déplacement augmentée de 12 %"; + case 611: + return "Vitesse de déplacement et dégâts à distance augmentés de 10 %"; + case 612: + return "Vitesse de déplacement et dégâts magiques augmentés de 10 %"; + case 613: + return "A une chance de provoquer des saignements"; + case 614: + return "Une lance japonaise légendaire couverte de venin"; + case 615: + return "Transforme toute munition appropriée en flèches spectrales"; + case 617: + return "Transforme toute munition appropriée en traits de Vulcain"; + case 619: + return "Invoque Ocram"; + case 620: + return "L'essence de créatures infectes"; + case 621: + return "Invoque un slime de compagnie"; + case 622: + return "Invoque un tiphia de compagnie"; + case 623: + return "Invoque une chauve-souris de compagnie"; + case 624: + return "Invoque un loup-garou de compagnie"; + case 625: + return "Invoque un zombie de compagnie"; + case 357: + return "Amélioration mineure de toutes les stats."; + case 361: + return "Invoque une armée de gobelins"; + case 363: + return "Permet un travail avancé du bois"; + case 367: + return "Suffisamment puissant pour détruire les autels de démon"; + case 371: + return "Augmente le maximum de mana de 40"; + case 372: + return "Vitesse de déplacement augmentée de 7 %"; + case 373: + return "Dégâts à distance augmentés de 10 %"; + case 376: + return "Augmente le maximum de mana de 60"; + case 377: + return "Chance de coup critique de mêlée augmentée de 5 %"; + case 378: + return "Dégâts à distance augmentés de 12 %"; + case 385: + return "Permet d'extraire du mythril"; + case 386: + return "Permet d'extraire de l'adamantine"; + case 389: + return "Peut étourdir les ennemis"; + case 393: + return "Indique la position horizontale"; + case 394: + return "Permet de nager"; + case 395: + return "Indique la position"; + case 396: + return "Annule les dégâts de chute"; + case 397: + return "Annule tout effet de recul"; + case 398: + return "Permet de combiner certains accessoires"; + case 399: + return "Permet de faire un double saut"; + case 400: + return "Augmente le maximum de mana de 80"; + case 401: + return "Chance de coup critique de mêlée augmentée de 7 %"; + case 402: + return "Dégâts à distance augmentés de 14 %"; + case 403: + return "Dégâts augmentés de 6 %"; + case 404: + return "Chance de coup critique augmentée de 4 %"; + case 405: + return "Permet de voler"; + case 407: + return "Permet de construire un bloc plus loin"; + case 422: + return "Purifie certains blocs"; + case 423: + return "Corrompt certains blocs"; + case 425: + return "Invoque une fée magique"; + case 327: + return "Ouvre un coffre d'or"; + case 329: + return "Ouvre tous les coffres sombres"; + case 332: + return "Utilisé pour la fabrication de vêtements"; + case 352: + return "Utilisé pour brasser la bière."; + case 261: + return "'Il sourit, ça ferait un casse-croûte sympa.'"; + case 266: + return "'Super idée !'"; + case 267: + return "'Vous êtes vraiment terrible.'"; + case 268: + return "Améliore grandement la respiration sous l'eau"; + case 272: + return "Lance une faux de démon"; + case 281: + return "Permet de récupérer des graines comme munitions"; + case 282: + return "Fonctionne même humide"; + case 283: + return "Utilisable avec la sarbacane"; + case 285: + return "La vitesse de déplacement est augmentée de 5 %"; + case 288: + return "Procure l'immunité à la lave"; + case 289: + return "Régénère la vie"; + case 290: + return "Augmente la vitesse de déplacement de 25 %"; + case 291: + return "Permet de respirer sous l'eau comme dans l'air"; + case 292: + return "Augmente la défense de 8"; + case 293: + return "Régénération de mana augmentée"; + case 294: + return "Dégâts magiques augmentés de 20 %"; + case 295: + return "Réduit la vitesse de chute"; + case 296: + return "Indique l'emplacement des trésors et du minerai"; + case 297: + return "Procure l'invisibilité"; + case 298: + return "Émet une aura de lumière"; + case 299: + return "Augmente la vision nocturne"; + case 300: + return "Augmente la fréquence d'apparition des ennemis"; + case 301: + return "Les attaquants subissent aussi des dégâts"; + case 302: + return "Permet de marcher sur l'eau"; + case 303: + return "Vitesse des flèches et leurs dégâts augmentés de 20 %"; + case 304: + return "Indique l'emplacement des ennemis"; + case 305: + return "Permet de contrôler la gravité"; + case 324: + return "'Interdit quasiment partout'"; + case 222: + return "Fait pousser les plantes"; + case 223: + return "Réduit le coût de mana de 6 %"; + case 228: + return "Augmente le maximum de mana de 20"; + case 229: + return "Augmente le maximum de mana de 20"; + case 230: + return "Augmente le maximum de mana de 20"; + case 235: + return "'Peut s'avérer difficile à lancer'"; + case 237: + return "'Pour un look de star !'"; + case 238: + return "Dégâts magiques augmentés de 15 %"; + case 193: + return "Permet de résister aux blocs de feu"; + case 197: + return "Tire des étoiles filantes"; + case 208: + return "'Comme c'est joli !'"; + case 211: + return "Vitesse de mêlée augmentée de 12 %"; + case 212: + return "Vitesse de déplacement augmentée de 10 %"; + case 213: + return "Fait pousser de l'herbe sur la terre"; + case 215: + return "'Peut être incommodant'"; + case 218: + return "Invoque une boule de feu contrôlable"; + case 175: + return "'Chaude au toucher'"; + case 186: + return "'Ne pas se noyer, c'est quand même cool !'"; + case 187: + return "Permet de nager"; + case 98: + return "33 % de chance de n'utiliser aucune munition"; + case 100: + return "Vitesse de mêlée augmentée de 7 %"; + case 101: + return "Vitesse de mêlée augmentée de 7 %"; + case 102: + return "Vitesse de mêlée augmentée de 7 %"; + case 103: + return "Permet d'extraire de la pierre de l'enfer"; + case 109: + return "Augmente le maximum de mana de 20 de façon permanente"; + case 111: + return "Augmente le maximum de mana de 20"; + case 112: + return "Lance des boules de feu"; + case 113: + return "Lance un missile contrôlable"; + case 114: + return "Déplace la terre par magie"; + case 115: + return "Crée un orbe magique de lumière"; + case 117: + return "'Chaude au toucher'"; + case 118: + return "Trouvé parfois sur les squelettes et les piranhas"; + case 120: + return "Transforme les flèches en bois tirées en flèches enflammées"; + case 121: + return "'Elle pète le feu !'"; + case 123: + return "Dégâts magiques augmentés de 5 %"; + case 124: + return "Dégâts magiques augmentés de 5 %"; + case 125: + return "Dégâts magiques augmentés de 5 %"; + case 128: + return "Permet de voler"; + case 148: + return "Cet objet peut attirer une attention non désirée"; + case 149: + return "« Il contient d'étranges symboles »"; + case 151: + return "Dégâts à distance augmentés de 4 %"; + case 152: + return "Dégâts à distance augmentés de 4 %"; + case 153: + return "Dégâts à distance augmentés de 4 %"; + case 156: + return "Annule tout effet de recul"; + case 157: + return "Lance de l'eau en continu"; + case 158: + return "Annule les dégâts de chute"; + case 159: + return "Augmente la hauteur des sauts"; + case 165: + return "Invoque une boule d'eau se déplaçant lentement"; + case 166: + return "Une petite explosion détruisant quelques blocs"; + case 167: + return "Une grosse explosion détruisant la plupart des blocs"; + case 168: + return "Une petite explosion ne détruisant pas de blocs"; + case 75: + return "Disparaît au coucher du soleil"; + case 84: + return "« Viens ici ! »"; + case 88: + return "Procure de la lumière lorsqu'il est porté"; + case 43: + return "Invoque l'œil de Cthulhu"; + case 49: + return "Régénère lentement la vie"; + case 50: + return "Fixer le miroir pour regagner son foyer"; + case 53: + return "Permet de faire un double saut"; + case 54: + return "Le porteur peur courir super vite"; + case 56: + return "'Vibre d'une énergie sombre'"; + case 57: + return "'Vibre d'une énergie sombre'"; + case 64: + return "Invoque une vileronce"; + case 65: + return "Provoque une pluie d'étoiles"; + case 66: + return "Purifie la corruption"; + case 67: + return "Corrompt la sainteté"; + case 68: + return "'Ça a l'air bon !'"; + case 70: + return "Invoque le dévoreur de mondes"; + case 29: + return "Augmente le maximum de vie de 20 de façon permanente"; + case 33: + return "Utilisé pour fondre le minerai"; + case 35: + return "Permet de forger des objets à partir de métal"; + case 36: + return "Utilisé pour l'artisanat de base"; + case -1: + return "Permet d'extraire la météorite"; + case 8: + return "Procure de la lumière"; + case 15: + return "Donne l'heure"; + case 16: + return "Donne l'heure"; + case 17: + return "Donne l'heure"; + case 18: + return "Indique la profondeur"; + case 23: + return "'À la fois savoureux et inflammable'"; + } + } + else if (Lang.lang == 5) + { + switch (l) + { + case 434: + return "Dispara tres ráfagas"; + case 485: + return "Convierte a su portador en hombre lobo durante la luna llena"; + case 486: + return "Dibuja una rejilla en pantalla para colocar los bloques"; + case 489: + return "Aumenta el daño de los ataques mágicos en un 15%"; + case 490: + return "Aumenta el daño de los ataques cuerpo a cuerpo en un 15%"; + case 491: + return "Aumenta el daño de los ataques a distancia en un 15%"; + case 492: + return "Permite volar y caer lentamente"; + case 493: + return "Permite volar y caer lentamente"; + case 495: + return "Lanza un arco iris dirigido"; + case 496: + return "Invoca un bloque de hielo"; + case 497: + return "Transforma a su portador en un tritón al sumergirse en el agua"; + case 506: + return "Utiliza gel como munición"; + case 509: + return "Permite colocar alambre"; + case 510: + return "Permite cortar alambre"; + case 515: + return "Crea varios fragmentos de cristal al impactar"; + case 516: + return "Invoca estrellas fugaces al impactar"; + case 517: + return "Una daga mágica que vuelve al arrojarse"; + case 518: + return "Lanza fragmentos de cristal a toda velocidad"; + case 519: + return "Lanza bolas de fuego impuras"; + case 520: + return "La esencia de las criaturas de la luz"; + case 521: + return "La esencia de las criaturas de la oscuridad"; + case 522: + return "Ni siquiera el agua puede apagarla"; + case 523: + return "Se puede meter en el agua"; + case 524: + return "Se usa para fundir mineral de adamantita"; + case 525: + return "Se usa para fabricar objetos con lingotes de mithril y adamantita"; + case 526: + return "'¡Puntiagudo y mágico!'"; + case 527: + return "A veces lo llevan las criaturas de los desiertos corrompidos"; + case 528: + return "A veces lo llevan las criaturas de los desiertos de luz"; + case 529: + return "Se activa al pisarla"; + case 531: + return "Se puede hechizar"; + case 532: + return "Hace que las estrellas caigan al recibir heridas"; + case 533: + return "Probabilidad del 50% de no gastar munición"; + case 534: + return "Dispara una ráfaga dispersa de balas"; + case 535: + return "Reduce el tiempo de espera para usar pociones curativas"; + case 536: + return "Aumenta el retroceso en el cuerpo a cuerpo"; + case 541: + return "Se activa al pisarla"; + case 542: + return "Se activa al pisarla"; + case 543: + return "Se activa al pisarla"; + case 544: + return "Invoca a los Gemelos"; + case 547: + return "La esencia del terror en estado puro"; + case 548: + return "La esencia del Destructor"; + case 549: + return "La esencia de los observadores omniscientes"; + case 551: + return "Aumenta la probabilidad de conseguir ataques críticos en un 7%"; + case 552: + return "Aumenta el daño de los ataques en un 7%"; + case 553: + return "Aumenta el daño a de los ataques a distancia en un 15%"; + case 554: + return "Aumenta el tiempo de invencibilidad tras recibir daños"; + case 555: + return "Reduce el uso de maná en un 8%"; + case 556: + return "Invoca al Destructor"; + case 557: + return "Invoca al Esqueletrón mayor"; + case 558: + return "Aumenta el maná máximo en 100"; + case 559: + return "Aumenta en un 10% el daño de los ataques cuerpo a cuerpo y la posibilidad de causar ataques críticos"; + case 560: + return "Invoca al rey slime"; + case 561: + return "No apilar más de 5"; + case 575: + return "La esencia de poderosas criaturas que vuelan"; + case 576: + return "Permite grabar canciones"; + case 579: + return "No confundir con un cuchillo jamonero"; + case 580: + return "Explota al activarse"; + case 581: + return "Envía agua a los colectores de salida"; + case 582: + return "Recibe agua de los colectores de entrada"; + case 583: + return "Se activa cada segundo"; + case 584: + return "Se activa cada 3 segundos"; + case 585: + return "Se activa cada 5 segundos"; + case 599: + case 600: + case 601: + return "Pulsa " + (object) '\x0081' + " para abrir"; + case 602: + return "Convoca a la Legión del hielo"; + case 603: + return "Invoca a un conejillo de Indias de mascota"; + case 604: + return "15% de aumento en daño por ataque en grupo y posibilidad de ataque mortal"; + case 605: + return "15% de aumento de daño a distancia, 5% de posibilidad de no gastar munición"; + case 606: + return "Aumenta el maná máximo en 120"; + case 607: + return "10% de aumento en posibilidad de ataque mortal"; + case 608: + return "5% de aumento de daño a distancia, 5% de posibilidad de no gastar munición"; + case 609: + return "5% de aumento en daño por magia, 10% de reducción en uso de maná"; + case 610: + return "12% de aumento en la velocidad de movimiento"; + case 611: + return "10% de aumento en la velocidad de movimiento y el daño a distancia"; + case 612: + return "10% de aumento en la velocidad de movimiento y el daño por magia"; + case 613: + return "Tiene la posibilidad de causar hemorragia"; + case 614: + return "Una legendaria lanza japonesa empapada de veneno"; + case 615: + return "Transforma cualquier munición adecuada en flechas espectrales"; + case 617: + return "Transforma cualquier munición adecuada en relámpagos volcánicos"; + case 619: + return "Invoca a Ocram"; + case 620: + return "'La esencia de las criaturas infectadas'"; + case 621: + return "Invoca a un slime mascota"; + case 622: + return "Invoca a una avispa mascota"; + case 623: + return "Invoca a un murciélago mascota"; + case 624: + return "Invoca a un hombre lobo mascota"; + case 625: + return "Invoca a un zombi mascota"; + case 357: + return "Proporciona pequeñas mejoras a todas las estadísticas"; + case 361: + return "Invoca a un ejército de duendes"; + case 363: + return "Se usa para fabricar artículos de madera avanzados"; + case 367: + return "Lo bastante sólido para destruir los altares demoníacos"; + case 371: + return "Aumenta el maná máximo en 40"; + case 372: + return "Aumenta en un 7% la velocidad de movimiento"; + case 373: + return "Aumenta el daño de los ataques a distancia en un 10%"; + case 376: + return "Aumenta el maná máximo en 60"; + case 377: + return "Aumenta un 5% la probabilidad de ataque crítico en el cuerpo a cuerpo"; + case 378: + return "Aumenta el daño de los ataques a distancia en un 12%"; + case 385: + return "Permite extraer mithril"; + case 386: + return "Permite extraer adamantita"; + case 389: + return "Puede llegar a confundir"; + case 393: + return "Indica el horizonte"; + case 394: + return "Permite nadar"; + case 395: + return "Indica la posición"; + case 396: + return "Anula el daño al caer"; + case 397: + return "Anula el retroceso"; + case 398: + return "Permite combinar varios accesorios"; + case 399: + return "Su portador puede realizar dobles saltos"; + case 400: + return "Aumenta el maná máximo en 80"; + case 401: + return "Aumenta un 7% la probabilidad de ataque crítico en el cuerpo a cuerpo"; + case 402: + return "Aumenta el daño de los ataques a distancia en un 14%"; + case 403: + return "Aumenta el daño de los ataques en un 6%"; + case 404: + return "Aumenta la probabilidad de conseguir ataques críticos en un 4%"; + case 405: + return "Permite volar"; + case 407: + return "Aumenta la distancia de colocación de bloques"; + case 422: + return "Convierte los bloques cercanos en bloques sagrados"; + case 423: + return "Extiende la corrupción a algunos bloques"; + case 425: + return "Invoca a una hada mágica"; + case 327: + return "Abre un cofre de oro"; + case 329: + return "Abre todos los cofres de las sombras"; + case 332: + return "Se usa para confeccionar ropa"; + case 352: + return "Se usa para elaborar cerveza"; + case 261: + return "Sonríe y además es un buen aperitivo"; + case 266: + return "'¡Una buena idea!'"; + case 267: + return "'Eres mala persona'"; + case 268: + return "Permite respirar bajo el agua mucho más tiempo"; + case 272: + return "Lanza una guadaña demoníaca"; + case 281: + return "Permite recoger semillas como munición"; + case 282: + return "Funciona con humedad"; + case 283: + return "Para la cerbatana"; + case 285: + return "Aumenta en un 5% la velocidad de movimiento"; + case 288: + return "Ofrece inmunidad ante la lava"; + case 289: + return "Regenera la vida"; + case 290: + return "Aumenta en un 25% la velocidad de movimiento"; + case 291: + return "Permite respirar agua en lugar de aire"; + case 292: + return "Aumenta la defensa en 8"; + case 293: + return "Aumenta la regeneración de maná"; + case 294: + return "Aumenta el daño de los ataques mágicos en un 20%"; + case 295: + return "Disminuye la velocidad de caída"; + case 296: + return "Muestra la ubicación de tesoros y minerales"; + case 297: + return "Proporciona invisibilidad"; + case 298: + return "Emite un aura de luz"; + case 299: + return "Mejora la visión nocturna"; + case 300: + return "Aumenta la velocidad de regeneración del enemigo"; + case 301: + return "Los atacantes también sufren daños"; + case 302: + return "Permite caminar sobre el agua"; + case 303: + return "Aumenta en un 20% la velocidad de las flechas y el daño que causan"; + case 304: + return "Muestra la ubicación de los enemigos"; + case 305: + return "Permite controlar la gravedad"; + case 324: + return "'Prohibidos en casi todas partes'"; + case 222: + return "Cultiva plantas"; + case 223: + return "Reduce el uso de maná en un 6%"; + case 228: + return "Aumenta el maná máximo en 20"; + case 229: + return "Aumenta el maná máximo en 20"; + case 230: + return "Aumenta el maná máximo en 20"; + case 235: + return "'Puede costar lanzarla'"; + case 237: + return "'¡Te quedan muy bien!'"; + case 238: + return "Aumenta el daño de los ataques mágicos en un 15%"; + case 193: + return "Ofrece inmunidad ante los bloques de fuego"; + case 197: + return "Dispara estrellas fugaces"; + case 208: + return "'Hermosa, muy hermosa'"; + case 211: + return "Aumenta un 12% la velocidad en el cuerpo a cuerpo"; + case 212: + return "Aumenta en un 10% la velocidad de movimiento"; + case 213: + return "Genera césped sobre la tierra"; + case 215: + return "'Una molestia para los demás'"; + case 218: + return "Lanza una bola de fuego dirigida"; + case 175: + return "Caliente al tacto"; + case 186: + return "'Está bien eso de no ahogarse'"; + case 187: + return "Permite nadar"; + case 98: + return "Probabilidad del 33% de no gastar munición"; + case 100: + return "Aumenta un 7% la velocidad de los ataques cuerpo a cuerpo"; + case 101: + return "Aumenta un 7% la velocidad de los ataques cuerpo a cuerpo"; + case 102: + return "Aumenta un 7% la velocidad de los ataques cuerpo a cuerpo"; + case 103: + return "Permite excavar la piedra infernal"; + case 109: + return "Aumenta el maná máximo en 20 de forma permanente"; + case 111: + return "Aumenta el maná máximo en 20"; + case 112: + return "Arroja bolas de fuego"; + case 113: + return "Lanza un proyectil dirigido"; + case 114: + return "Desplaza la tierra por arte de magia"; + case 115: + return "Crea un orbe mágico de luz"; + case 117: + return "Caliente al tacto"; + case 118: + return "A veces lo sueltan esqueletos y pirañas"; + case 120: + return "Enciende las flechas de madera"; + case 121: + return "'¡Hecha de fuego!'"; + case 123: + return "Aumenta el daño de los ataques mágicos en un 5%"; + case 124: + return "Aumenta el daño de los ataques mágicos en un 5%"; + case 125: + return "Aumenta el daño de los ataques mágicos en un 5%"; + case 128: + return "Permite volar"; + case 148: + return "Su portador llamará la atención de los indeseables"; + case 149: + return "'Contiene extraños símbolos'"; + case 151: + return "Aumenta el daño de los ataques a distancia en un 4%"; + case 152: + return "Aumenta el daño de los ataques a distancia en un 4%"; + case 153: + return "Aumenta el daño de los ataques a distancia en un 4%"; + case 156: + return "Anula el retroceso"; + case 157: + return "Lanza un chorro de agua"; + case 158: + return "Anula el daño al caer"; + case 159: + return "Aumenta la altura de los saltos"; + case 165: + return "Lanza un proyectil de agua a baja velocidad"; + case 166: + return "Pequeña explosión capaz de romper varios ladrillos"; + case 167: + return "Gran explosión capaz de romper casi todos los ladrillos"; + case 168: + return "Pequeña explosión que no rompe ningún ladrillo"; + case 75: + return "Desaparece al amanecer"; + case 84: + return "'¡Te atrapé!'"; + case 88: + return "Da luz a su portador"; + case 43: + return "Invoca al Ojo de Cthulhu"; + case 49: + return "Regenera la vida poco a poco"; + case 50: + return "Al mirarte en él regresarás a tu hogar"; + case 53: + return "Su portador puede realizar dobles saltos"; + case 54: + return "Permite correr superrápido"; + case 56: + return "La energía oscura fluye en su interior"; + case 57: + return "La energía oscura fluye en su interior"; + case 64: + return "Lanza una espina vil"; + case 65: + return "Hace que lluevan estrellas del cielo"; + case 66: + return "Limpia la corrupción"; + case 67: + return "Devuelve el territorio sagrado a la normalidad"; + case 68: + return "¡Qué delicia!"; + case 70: + return "Invoca al Devoramundos"; + case 29: + return "Aumenta el nivel máximo de vida en 20 de forma permanente"; + case 33: + return "Se usa para fundir mineral"; + case 35: + return "Se usa para fabricar objetos con lingotes de metal"; + case 36: + return "Se usa para creaciones básicas"; + case -1: + return "Permite excavar meteoritos"; + case 8: + return "Da luz"; + case 15: + return "Da la hora"; + case 16: + return "Da la hora"; + case 17: + return "Da la hora"; + case 18: + return "Indica la profundidad"; + case 23: + return "Sabroso a la par que inflamable"; + } + } + return (string) null; + } + + public static string toolTip2(int l) + { + if (Lang.lang <= 1) + { + switch (l) + { + case 552: + return "8% increased movement speed"; + case 553: + return "8% increased ranged critical strike chance"; + case 555: + return "Automatically use mana potions when needed"; + case 558: + return "12% increased magic damage and critical strike chance"; + case 559: + return "10% increased melee speed"; + case 604: + return "15% increased critical strike chance"; + case 605: + return "10% increased ranged critical strike chance"; + case 606: + return "15% increased magic damage and critical strike chance"; + case 607: + return "5% increased melee damage"; + case 608: + return "10% increased ranged critical strike chance"; + case 609: + return "10% increased magic critical strike chance"; + case 610: + return "2% increased melee speed"; + case 611: + return "10% chance to not consume ammo"; + case 612: + return "Increases maximum mana by 30"; + case 434: + return "Only the first shot consumes ammo"; + case 533: + return "'Minishark's older brother'"; + case 228: + return "3% increased magic critical strike chance"; + case 229: + return "3% increased magic critical strike chance"; + case 230: + return "3% increased magic critical strike chance"; + case 371: + return "9% increased magic critical strike chance"; + case 372: + return "12% increased melee speed"; + case 373: + return "6% increased ranged critical strike chance"; + case 374: + return "3% increased critical strike chance"; + case 375: + return "10% increased movement speed"; + case 376: + return "15% increased magic damage"; + case 377: + return "10% increased melee damage"; + case 378: + return "7% increased ranged critical strike chance"; + case 379: + return "5% increased damage"; + case 380: + return "3% increased critical strike chance"; + case 389: + return "'Find your inner pieces'"; + case 394: + return "Greatly extends underwater breathing"; + case 395: + return "Tells the time"; + case 396: + return "Grants immunity to fire blocks"; + case 397: + return "Grants immunity to fire blocks"; + case 399: + return "Increases jump height"; + case 400: + return "11% increased magic damage and critical strike chance"; + case 401: + return "14% increased melee damage"; + case 402: + return "8% increased ranged critical strike chance"; + case 404: + return "5% increased movement speed"; + case 405: + return "The wearer can run super fast"; + case 65: + return "'Forged with the fury of heaven'"; + case 98: + return "'Half shark, half gun, completely awesome.'"; + } + } + else if (Lang.lang == 2) + { + switch (l) + { + case 552: + return "Um 8% erhöhtes Bewegungstempo"; + case 553: + return "Um 8% erhöhte kritische Fernkampf-Trefferchance"; + case 555: + return "Bei Bedarf automatisch Manatränke verwenden"; + case 558: + return "Magischer Schaden und kritische Trefferchance um 12% erhöht"; + case 559: + return "Um 10% erhöhtes Nahkampftempo"; + case 604: + return "Kritische Trefferchance um 15% erhöht"; + case 605: + return "Um 10% erhöhte kritische Fernkampf-Trefferchance"; + case 606: + return "Magieschaden und kritische Trefferchance um 15% erhöht"; + case 607: + return "Um 5% erhöhter Nahkampfschaden"; + case 608: + return "Um 10% erhöhte kritische Fernkampf-Trefferchance"; + case 609: + return "10% erhöhte Chance auf kritischen Magietreffer"; + case 610: + return "Um 2% erhöhtes Nahkampftempo"; + case 611: + return "10%ige Chance, keine Munition zu verbrauchen"; + case 612: + return "Erhöht maximales Mana um 30"; + case 434: + return "Nur der erste Schuss verbraucht Munition "; + case 533: + return "'Minihais großer Bruder'"; + case 228: + return "Um 3% erhöhte kritische Magietrefferchance"; + case 229: + return "Um 3% erhöhte kritische Magietrefferchance"; + case 230: + return "Um 3% erhöhte kritische Magietrefferchance"; + case 371: + return "Um 9% erhöhte kritische Magietrefferchance"; + case 372: + return "Um 12% erhöhtes Nahkampftempo"; + case 373: + return "Um 6% erhöhte kritische Fernkampf-Trefferchance"; + case 374: + return "Um 3% erhöhte kritische Trefferchance"; + case 375: + return "Um 10% erhöhtes Bewegungstempo"; + case 376: + return "Um 15% erhöhter magischer Schaden"; + case 377: + return "Um 10% erhöhter Nahkampfschaden"; + case 378: + return "Um 7% erhöhte kritische Fernkampf-Trefferchance"; + case 379: + return "Um 5% erhöhter Schaden"; + case 380: + return "Um 3% erhöhte kritische Trefferchance"; + case 389: + return "'Sammle dich!'"; + case 394: + return "Verleiht deutlich mehr Atemluft unter Wasser"; + case 395: + return "Zeigt die Zeit an"; + case 396: + return "Macht immun gegen Feuer-Blöcke"; + case 397: + return "Macht immun gegen Feuer-Blöcke"; + case 399: + return "Vergrössert die Sprunghöhe"; + case 400: + return "Magischer Schaden und kritische Trefferchance um 11% erhöht"; + case 401: + return "Um 14% erhöhter Nahkampfschaden"; + case 402: + return "Um 8% erhöhte kritische Fernkampf-Trefferchance"; + case 404: + return "Um 5% erhöhtes Bewegungstempo"; + case 405: + return "Der Träger kann superschnell rennen"; + case 65: + return "'Geschmiedet mit Himmelswut'"; + case 98: + return "'Halb Hai, halb Pistole - einfach toll!'"; + } + } + else if (Lang.lang == 3) + { + switch (l) + { + case 552: + return "Velocità di movimento aumentata del 8%"; + case 553: + return "Possibilità di colpo critico a distanza aumentata dell'8%"; + case 555: + return "Utilizza le pozioni mana automaticamente in caso di bisogno"; + case 558: + return "Possibilità di danno magico e colpo critico aumentate del 12%"; + case 559: + return "Velocità del corpo a corpo aumentata del 10%"; + case 604: + return "Possibilità di colpo critico aumentata del 15%"; + case 605: + return "Possibilità di colpo critico boomerang aumentata del 10%"; + case 606: + return "Possibilità di colpo critico e del danno magico aumentati del 15%"; + case 607: + return "Danno da mischia aumentato del 5%"; + case 608: + return "Possibilità di colpo critico boomerang aumentata del 10%"; + case 609: + return "Possibilità di colpo critico magico aumentata del 10%"; + case 610: + return "Velocità del corpo a corpo aumentata del 2%"; + case 611: + return "10% di possibilità di non consumare munizioni"; + case 612: + return "Aumenta il mana massimo di 30"; + case 434: + return "Solo il primo colpo consuma munizioni"; + case 533: + return "'Fratello maggiore del Minishark'"; + case 228: + return "Aumenta la possibilità di colpo critico magico del 3%"; + case 229: + return "Aumenta la possibilità di colpo critico magico del 3%"; + case 230: + return "Aumenta la possibilità di colpo critico magico del 3%"; + case 371: + return "Possibilità colpo critico magico aumentate del 9%"; + case 372: + return "Velocità del corpo a corpo aumentata del 12%"; + case 373: + return "Possibilità di colpo critico magico aumentata del 6%"; + case 374: + return "Possibilità di colpo critico aumentata del 3%"; + case 375: + return "Velocità di movimento aumentata del 10%"; + case 376: + return "Danno magico aumentato del 15%"; + case 377: + return "Danno da mischia aumentato del 10%"; + case 378: + return "Possibilità di colpo critico a distanza aumentata del 7%"; + case 379: + return "Danno aumentato del 5%"; + case 380: + return "Possibilità di colpo critico aumentata del 3%"; + case 389: + return "'Trova i pezzi interni'"; + case 394: + return "Aumenta moltissimo il respiro sott'acqua"; + case 395: + return "Indica il tempo"; + case 396: + return "Permette immunità ai blocchi di fuoco"; + case 397: + return "Permette immunità ai blocchi di fuoco"; + case 399: + return "Aumenta l'altezza del salto"; + case 400: + return "Possibilità di colpo critico e danno magico aumentate del 11%"; + case 401: + return "Danno da mischia aumentato del 14%"; + case 402: + return "Possibilità di colpo critico a distanza aumentata dell'8%"; + case 404: + return "Velocità di movimento aumentata del 5%"; + case 405: + return "Colui che li indossa può correre velocissimo"; + case 65: + return "'Forgiato con la furia del cielo'"; + case 98: + return "'Mezzo squalo, mezza arma, assolutamente terrificante.'"; + } + } + else if (Lang.lang == 4) + { + switch (l) + { + case 552: + return "Vitesse de mouvement augmentée de 8 %"; + case 553: + return "Chance de coup critique à distance augmentée de 8 %"; + case 555: + return "Utilise des potions de mana automatiquement si besoin"; + case 558: + return "Chance de coup critique et dégâts magiques augmentés de 12 %"; + case 559: + return "Vitesse de mêlée augmentée de 10 %"; + case 604: + return "Chance de coup critique augmentée de 15 %"; + case 605: + return "Chance de coup critique à distance augmentée de 10 %"; + case 606: + return "Dégâts magiques et chance de coup critique augmentés de 15 %"; + case 607: + return "Dégâts de mêlée augmentés de 5 %"; + case 608: + return "Chance de coup critique à distance augmentée de 10 %"; + case 609: + return "Chance de coup critique magique augmentée de 10 %"; + case 610: + return "Vitesse de mêlée augmentée de 2 %"; + case 611: + return "10 % de chance de n'utiliser aucune munition"; + case 612: + return "Maximum de mana augmenté de 30"; + case 434: + return "Seul le premier tir utilise des munitions"; + case 533: + return "'La version améliorée du minishark'"; + case 228: + return "Chance de coup critique magique augmentée de 3 %"; + case 229: + return "Chance de coup critique magique augmentée de 3 %"; + case 230: + return "Chance de coup critique magique augmentée de 3 %"; + case 371: + return "Chance de coup critique magique augmentée de 9 %"; + case 372: + return "Vitesse de mêlée augmentée de 12 %"; + case 373: + return "Chance de coup critique à distance augmentée de 6 %"; + case 374: + return "Chance de coup critique augmentée de 3 %"; + case 375: + return "Vitesse de déplacement augmentée de 10 %"; + case 376: + return "Dégâts magiques augmentés de 15 %"; + case 377: + return "Dégâts de mêlée augmentés de 10 %"; + case 378: + return "Chance de coup critique à distance augmentée de 7 %"; + case 379: + return "Dégâts augmentés de 5 %"; + case 380: + return "Chance de coup critique augmentée de 3 %"; + case 389: + return "« Pour trouver la paix intérieure »"; + case 394: + return "Améliore grandement la respiration sous l'eau"; + case 395: + return "Donne l'heure"; + case 396: + return "Permet de résister aux blocs de feu"; + case 397: + return "Permet de résister aux blocs de feu"; + case 399: + return "Augmente la hauteur des sauts"; + case 400: + return "Dégâts magiques et chance de coup critique augmentés de 11 %"; + case 401: + return "Dégâts de mêlée augmentés de 14 %"; + case 402: + return "Chance de coup critique à distance augmentée de 8 %"; + case 404: + return "Vitesse de déplacement augmentée de 5 %"; + case 405: + return "Le porteur peur courir super vite"; + case 65: + return "'Forgée dans la furie du ciel'"; + case 98: + return "'Moitié requin, moitié fusil, c'est de la balle !'"; + } + } + else if (Lang.lang == 5) + { + switch (l) + { + case 552: + return "Aumenta en un 8% la velocidad de movimiento"; + case 553: + return "Aumenta la probabilidad de ataque a distancia crítico en un 8%"; + case 555: + return "Usa de forma automática pociones de maná cuando se necesitan"; + case 558: + return "Aumenta en un 12% el daño de los ataques mágicos y la posibilidad de causar ataques críticos"; + case 559: + return "Aumenta en un 10% la velocidad de los ataques cuerpo a cuerpo"; + case 604: + return "15% de aumento en posibilidad de ataque mortal"; + case 605: + return "10% de aumento en posibilidad de ataque mortal a distancia"; + case 606: + return "15% de aumento en daño por magia y posibilidad de ataque mortal"; + case 607: + return "5% de aumento en daño por ataque en grupo"; + case 608: + return "10% de aumento en posibilidad de ataque mortal a distancia"; + case 609: + return "10% de aumento en posibilidad de ataque mágico mortal"; + case 610: + return "2% de aumento en la velocidad de ataque en grupo"; + case 611: + return "10% de posibilidad de no gastar munición"; + case 612: + return "Aumenta el maná máximo en 30"; + case 434: + return "Solo gasta munición el primer disparo"; + case 533: + return "'El hermano mayor del minitiburón'"; + case 228: + return "Aumenta la probabilidad de ataque mágico crítico en un 3%"; + case 229: + return "Aumenta la probabilidad de ataque mágico crítico en un 3%"; + case 230: + return "Aumenta la probabilidad de ataque mágico crítico en un 3%"; + case 371: + return "Aumenta la probabilidad de ataque mágico crítico en un 9%"; + case 372: + return "Aumenta un 12% la velocidad de los ataques cuerpo a cuerpo"; + case 373: + return "Aumenta la probabilidad de ataque a distancia crítico en un 6%"; + case 374: + return "Aumenta la probabilidad de conseguir ataques críticos en un 3%"; + case 375: + return "Aumenta en un 10% la velocidad de movimiento"; + case 376: + return "Aumenta el daño de los ataques mágicos en un 15%"; + case 377: + return "Aumenta el daño de los ataques cuerpo a cuerpo en un 10%"; + case 378: + return "Aumenta la probabilidad de ataque a distancia crítico en un 7%"; + case 379: + return "Aumenta el daño en un 5%"; + case 380: + return "Aumenta la probabilidad de conseguir ataques críticos en un 3%"; + case 389: + return "Busca en tu interior"; + case 394: + return "Permite respirar bajo el agua mucho más tiempo"; + case 395: + return "Da la hora"; + case 396: + return "Ofrece inmunidad ante los bloques de fuego"; + case 397: + return "Ofrece inmunidad ante los bloques de fuego"; + case 399: + return "Aumenta la altura de los saltos"; + case 400: + return "Aumenta en un 11% el daño de los ataques mágicos y la posibilidad de causar ataques críticos"; + case 401: + return "Aumenta el daño de los ataques cuerpo a cuerpo en un 14%"; + case 402: + return "Aumenta la probabilidad de ataque a distancia crítico en un 8%"; + case 404: + return "Aumenta en un 5% la velocidad de movimiento"; + case 405: + return "Permite correr superrápido"; + case 65: + return "'Forjada por la furia del cielo'"; + case 98: + return "'Mitad tiburón, mitad arma; realmente asombroso'"; + } + } + return (string) null; + } + + public static string itemName(int l) + { + if (Lang.lang <= 1) + { + switch (l) + { + case -24: + return "Yellow Phasesaber"; + case -23: + return "White Phasesaber"; + case -22: + return "Purple Phasesaber"; + case -21: + return "Green Phasesaber"; + case -20: + return "Red Phasesaber"; + case -19: + return "Blue Phasesaber"; + case -18: + return "Copper Bow"; + case -17: + return "Copper Hammer"; + case -16: + return "Copper Axe"; + case -15: + return "Copper Shortsword"; + case -14: + return "Copper Broadsword"; + case -13: + return "Copper Pickaxe"; + case -12: + return "Silver Bow"; + case -11: + return "Silver Hammer"; + case -10: + return "Silver Axe"; + case -9: + return "Silver Shortsword"; + case -8: + return "Silver Broadsword"; + case -7: + return "Silver Pickaxe"; + case -6: + return "Gold Bow"; + case -5: + return "Gold Hammer"; + case -4: + return "Gold Axe"; + case -3: + return "Gold Shortsword"; + case -2: + return "Gold Broadsword"; + case -1: + return "Gold Pickaxe"; + case 1: + return "Iron Pickaxe"; + case 2: + return "Dirt Block"; + case 3: + return "Stone Block"; + case 4: + return "Iron Broadsword"; + case 5: + return "Mushroom"; + case 6: + return "Iron Shortsword"; + case 7: + return "Iron Hammer"; + case 8: + return "Torch"; + case 9: + return "Wood"; + case 10: + return "Iron Axe"; + case 11: + return "Iron Ore"; + case 12: + return "Copper Ore"; + case 13: + return "Gold Ore"; + case 14: + return "Silver Ore"; + case 15: + return "Copper Watch"; + case 16: + return "Silver Watch"; + case 17: + return "Gold Watch"; + case 18: + return "Depth Meter"; + case 19: + return "Gold Bar"; + case 20: + return "Copper Bar"; + case 21: + return "Silver Bar"; + case 22: + return "Iron Bar"; + case 23: + return "Gel"; + case 24: + return "Wooden Sword"; + case 25: + return "Wooden Door"; + case 26: + return "Stone Wall"; + case 27: + return "Acorn"; + case 28: + return "Lesser Healing Potion"; + case 29: + return "Life Crystal"; + case 30: + return "Dirt Wall"; + case 31: + return "Bottle"; + case 32: + return "Wooden Table"; + case 33: + return "Furnace"; + case 34: + return "Wooden Chair"; + case 35: + return "Iron Anvil"; + case 36: + return "Work Bench"; + case 37: + return "Goggles"; + case 38: + return "Lens"; + case 39: + return "Wooden Bow"; + case 40: + return "Wooden Arrow"; + case 41: + return "Flaming Arrow"; + case 42: + return "Shuriken"; + case 43: + return "Suspicious Looking Eye"; + case 44: + return "Demon Bow"; + case 45: + return "War Axe of the Night"; + case 46: + return "Light's Bane"; + case 47: + return "Unholy Arrow"; + case 48: + return "Chest"; + case 49: + return "Band of Regeneration"; + case 50: + return "Magic Mirror"; + case 51: + return "Jester's Arrow"; + case 52: + return "Angel Statue"; + case 53: + return "Cloud in a Bottle"; + case 54: + return "Hermes Boots"; + case 55: + return "Enchanted Boomerang"; + case 56: + return "Demonite Ore"; + case 57: + return "Demonite Bar"; + case 58: + return "Heart"; + case 59: + return "Corrupt Seeds"; + case 60: + return "Vile Mushroom"; + case 61: + return "Ebonstone Block"; + case 62: + return "Grass Seeds"; + case 63: + return "Sunflower"; + case 64: + return "Vilethorn"; + case 65: + return "Starfury"; + case 66: + return "Purification Powder"; + case 67: + return "Vile Powder"; + case 68: + return "Rotten Chunk"; + case 69: + return "Worm Tooth"; + case 70: + return "Worm Food"; + case 71: + return "Copper Coin"; + case 72: + return "Silver Coin"; + case 73: + return "Gold Coin"; + case 74: + return "Platinum Coin"; + case 75: + return "Fallen Star"; + case 76: + return "Copper Greaves"; + case 77: + return "Iron Greaves"; + case 78: + return "Silver Greaves"; + case 79: + return "Gold Greaves"; + case 80: + return "Copper Chainmail"; + case 81: + return "Iron Chainmail"; + case 82: + return "Silver Chainmail"; + case 83: + return "Gold Chainmail"; + case 84: + return "Grappling Hook"; + case 85: + return "Iron Chain"; + case 86: + return "Shadow Scale"; + case 87: + return "Piggy Bank"; + case 88: + return "Mining Helmet"; + case 89: + return "Copper Helmet"; + case 90: + return "Iron Helmet"; + case 91: + return "Silver Helmet"; + case 92: + return "Gold Helmet"; + case 93: + return "Wood Wall"; + case 94: + return "Wood Platform"; + case 95: + return "Flintlock Pistol"; + case 96: + return "Musket"; + case 97: + return "Musket Ball"; + case 98: + return "Minishark"; + case 99: + return "Iron Bow"; + case 100: + return "Shadow Greaves"; + case 101: + return "Shadow Scalemail"; + case 102: + return "Shadow Helmet"; + case 103: + return "Nightmare Pickaxe"; + case 104: + return "The Breaker"; + case 105: + return "Candle"; + case 106: + return "Copper Chandelier"; + case 107: + return "Silver Chandelier"; + case 108: + return "Gold Chandelier"; + case 109: + return "Mana Crystal"; + case 110: + return "Lesser Mana Potion"; + case 111: + return "Band of Starpower"; + case 112: + return "Flower of Fire"; + case 113: + return "Magic Missile"; + case 114: + return "Dirt Rod"; + case 115: + return "Orb of Light"; + case 116: + return "Meteorite"; + case 117: + return "Meteorite Bar"; + case 118: + return "Hook"; + case 119: + return "Flamarang"; + case 120: + return "Molten Fury"; + case 121: + return "Fiery Greatsword"; + case 122: + return "Molten Pickaxe"; + case 123: + return "Meteor Helmet"; + case 124: + return "Meteor Suit"; + case 125: + return "Meteor Leggings"; + case 126: + return "Bottled Water"; + case (int) sbyte.MaxValue: + return "Space Gun"; + case 128: + return "Rocket Boots"; + case 129: + return "Gray Brick"; + case 130: + return "Gray Brick Wall"; + case 131: + return "Red Brick"; + case 132: + return "Red Brick Wall"; + case 133: + return "Clay Block"; + case 134: + return "Blue Brick"; + case 135: + return "Blue Brick Wall"; + case 136: + return "Chain Lantern"; + case 137: + return "Green Brick"; + case 138: + return "Green Brick Wall"; + case 139: + return "Pink Brick"; + case 140: + return "Pink Brick Wall"; + case 141: + return "Gold Brick"; + case 142: + return "Gold Brick Wall"; + case 143: + return "Silver Brick"; + case 144: + return "Silver Brick Wall"; + case 145: + return "Copper Brick"; + case 146: + return "Copper Brick Wall"; + case 147: + return "Spike"; + case 148: + return "Water Candle"; + case 149: + return "Book"; + case 150: + return "Cobweb"; + case 151: + return "Necro Helmet"; + case 152: + return "Necro Breastplate"; + case 153: + return "Necro Greaves"; + case 154: + return "Bone"; + case 155: + return "Muramasa"; + case 156: + return "Cobalt Shield"; + case 157: + return "Aqua Scepter"; + case 158: + return "Lucky Horseshoe"; + case 159: + return "Shiny Red Balloon"; + case 160: + return "Harpoon"; + case 161: + return "Spiky Ball"; + case 162: + return "Ball O' Hurt"; + case 163: + return "Blue Moon"; + case 164: + return "Handgun"; + case 165: + return "Water Bolt"; + case 166: + return "Bomb"; + case 167: + return "Dynamite"; + case 168: + return "Grenade"; + case 169: + return "Sand Block"; + case 170: + return "Glass"; + case 171: + return "Sign"; + case 172: + return "Ash Block"; + case 173: + return "Obsidian"; + case 174: + return "Hellstone"; + case 175: + return "Hellstone Bar"; + case 176: + return "Mud Block"; + case 177: + return "Sapphire"; + case 178: + return "Ruby"; + case 179: + return "Emerald"; + case 180: + return "Topaz"; + case 181: + return "Amethyst"; + case 182: + return "Diamond"; + case 183: + return "Glowing Mushroom"; + case 184: + return "Star"; + case 185: + return "Ivy Whip"; + case 186: + return "Breathing Reed"; + case 187: + return "Flipper"; + case 188: + return "Healing Potion"; + case 189: + return "Mana Potion"; + case 190: + return "Blade of Grass"; + case 191: + return "Thorn Chakram"; + case 192: + return "Obsidian Brick"; + case 193: + return "Obsidian Skull"; + case 194: + return "Mushroom Grass Seeds"; + case 195: + return "Jungle Grass Seeds"; + case 196: + return "Wooden Hammer"; + case 197: + return "Star Cannon"; + case 198: + return "Blue Phaseblade"; + case 199: + return "Red Phaseblade"; + case 200: + return "Green Phaseblade"; + case 201: + return "Purple Phaseblade"; + case 202: + return "White Phaseblade"; + case 203: + return "Yellow Phaseblade"; + case 204: + return "Meteor Hamaxe"; + case 205: + return "Empty Bucket"; + case 206: + return "Water Bucket"; + case 207: + return "Lava Bucket"; + case 208: + return "Jungle Rose"; + case 209: + return "Stinger"; + case 210: + return "Vine"; + case 211: + return "Feral Claws"; + case 212: + return "Anklet of the Wind"; + case 213: + return "Staff of Regrowth"; + case 214: + return "Hellstone Brick"; + case 215: + return "Whoopie Cushion"; + case 216: + return "Shackle"; + case 217: + return "Molten Hamaxe"; + case 218: + return "Flamelash"; + case 219: + return "Phoenix Blaster"; + case 220: + return "Sunfury"; + case 221: + return "Hellforge"; + case 222: + return "Clay Pot"; + case 223: + return "Nature's Gift"; + case 224: + return "Bed"; + case 225: + return "Silk"; + case 226: + return "Lesser Restoration Potion"; + case 227: + return "Restoration Potion"; + case 228: + return "Jungle Hat"; + case 229: + return "Jungle Shirt"; + case 230: + return "Jungle Pants"; + case 231: + return "Molten Helmet"; + case 232: + return "Molten Breastplate"; + case 233: + return "Molten Greaves"; + case 234: + return "Meteor Shot"; + case 235: + return "Sticky Bomb"; + case 236: + return "Black Lens"; + case 237: + return "Sunglasses"; + case 238: + return "Wizard Hat"; + case 239: + return "Top Hat"; + case 240: + return "Tuxedo Shirt"; + case 241: + return "Tuxedo Pants"; + case 242: + return "Summer Hat"; + case 243: + return "Bunny Hood"; + case 244: + return "Plumber's Hat"; + case 245: + return "Plumber's Shirt"; + case 246: + return "Plumber's Pants"; + case 247: + return "Hero's Hat"; + case 248: + return "Hero's Shirt"; + case 249: + return "Hero's Pants"; + case 250: + return "Fish Bowl"; + case 251: + return "Archaeologist's Hat"; + case 252: + return "Archaeologist's Jacket"; + case 253: + return "Archaeologist's Pants"; + case 254: + return "Black Dye"; + case (int) byte.MaxValue: + return "Purple Dye"; + case 256: + return "Ninja Hood"; + case 257: + return "Ninja Shirt"; + case 258: + return "Ninja Pants"; + case 259: + return "Leather"; + case 260: + return "Red Hat"; + case 261: + return "Goldfish"; + case 262: + return "Robe"; + case 263: + return "Robot Hat"; + case 264: + return "Gold Crown"; + case 265: + return "Hellfire Arrow"; + case 266: + return "Sandgun"; + case 267: + return "Guide Voodoo Doll"; + case 268: + return "Diving Helmet"; + case 269: + return "Familiar Shirt"; + case 270: + return "Familiar Pants"; + case 271: + return "Familiar Wig"; + case 272: + return "Demon Scythe"; + case 273: + return "Night's Edge"; + case 274: + return "Dark Lance"; + case 275: + return "Coral"; + case 276: + return "Cactus"; + case 277: + return "Trident"; + case 278: + return "Silver Bullet"; + case 279: + return "Throwing Knife"; + case 280: + return "Spear"; + case 281: + return "Blowpipe"; + case 282: + return "Glowstick"; + case 283: + return "Seed"; + case 284: + return "Wooden Boomerang"; + case 285: + return "Aglet"; + case 286: + return "Sticky Glowstick"; + case 287: + return "Poisoned Knife"; + case 288: + return "Obsidian Skin Potion"; + case 289: + return "Regeneration Potion"; + case 290: + return "Swiftness Potion"; + case 291: + return "Gills Potion"; + case 292: + return "Ironskin Potion"; + case 293: + return "Mana Regeneration Potion"; + case 294: + return "Magic Power Potion"; + case 295: + return "Featherfall Potion"; + case 296: + return "Spelunker Potion"; + case 297: + return "Invisibility Potion"; + case 298: + return "Shine Potion"; + case 299: + return "Night Owl Potion"; + case 300: + return "Battle Potion"; + case 301: + return "Thorns Potion"; + case 302: + return "Water Walking Potion"; + case 303: + return "Archery Potion"; + case 304: + return "Hunter Potion"; + case 305: + return "Gravitation Potion"; + case 306: + return "Gold Chest"; + case 307: + return "Daybloom Seeds"; + case 308: + return "Moonglow Seeds"; + case 309: + return "Blinkroot Seeds"; + case 310: + return "Deathweed Seeds"; + case 311: + return "Waterleaf Seeds"; + case 312: + return "Fireblossom Seeds"; + case 313: + return "Daybloom"; + case 314: + return "Moonglow"; + case 315: + return "Blinkroot"; + case 316: + return "Deathweed"; + case 317: + return "Waterleaf"; + case 318: + return "Fireblossom"; + case 319: + return "Shark Fin"; + case 320: + return "Feather"; + case 321: + return "Tombstone"; + case 322: + return "Mime Mask"; + case 323: + return "Antlion Mandible"; + case 324: + return "Illegal Gun Parts"; + case 325: + return "The Doctor's Shirt"; + case 326: + return "The Doctor's Pants"; + case 327: + return "Golden Key"; + case 328: + return "Shadow Chest"; + case 329: + return "Shadow Key"; + case 330: + return "Obsidian Brick Wall"; + case 331: + return "Jungle Spores"; + case 332: + return "Loom"; + case 333: + return "Piano"; + case 334: + return "Dresser"; + case 335: + return "Bench"; + case 336: + return "Bathtub"; + case 337: + return "Red Banner"; + case 338: + return "Green Banner"; + case 339: + return "Blue Banner"; + case 340: + return "Yellow Banner"; + case 341: + return "Lamp Post"; + case 342: + return "Tiki Torch"; + case 343: + return "Barrel"; + case 344: + return "Chinese Lantern"; + case 345: + return "Cooking Pot"; + case 346: + return "Safe"; + case 347: + return "Skull Lantern"; + case 348: + return "Trash Can"; + case 349: + return "Candelabra"; + case 350: + return "Pink Vase"; + case 351: + return "Mug"; + case 352: + return "Keg"; + case 353: + return "Ale"; + case 354: + return "Bookcase"; + case 355: + return "Throne"; + case 356: + return "Bowl"; + case 357: + return "Bowl of Soup"; + case 358: + return "Toilet"; + case 359: + return "Grandfather Clock"; + case 360: + return "Armor Statue"; + case 361: + return "Goblin Battle Standard"; + case 362: + return "Tattered Cloth"; + case 363: + return "Sawmill"; + case 364: + return "Cobalt Ore"; + case 365: + return "Mythril Ore"; + case 366: + return "Adamantite Ore"; + case 367: + return "Pwnhammer"; + case 368: + return "Excalibur"; + case 369: + return "Hallowed Seeds"; + case 370: + return "Ebonsand Block"; + case 371: + return "Cobalt Hat"; + case 372: + return "Cobalt Helmet"; + case 373: + return "Cobalt Mask"; + case 374: + return "Cobalt Breastplate"; + case 375: + return "Cobalt Leggings"; + case 376: + return "Mythril Hood"; + case 377: + return "Mythril Helmet"; + case 378: + return "Mythril Hat"; + case 379: + return "Mythril Chainmail"; + case 380: + return "Mythril Greaves"; + case 381: + return "Cobalt Bar"; + case 382: + return "Mythril Bar"; + case 383: + return "Cobalt Chainsaw"; + case 384: + return "Mythril Chainsaw"; + case 385: + return "Cobalt Drill"; + case 386: + return "Mythril Drill"; + case 387: + return "Adamantite Chainsaw"; + case 388: + return "Adamantite Drill"; + case 389: + return "Dao of Pow"; + case 390: + return "Mythril Halberd"; + case 391: + return "Adamantite Bar"; + case 392: + return "Glass Wall"; + case 393: + return "Compass"; + case 394: + return "Diving Gear"; + case 395: + return "GPS"; + case 396: + return "Obsidian Horseshoe"; + case 397: + return "Obsidian Shield"; + case 398: + return "Tinkerer's Workshop"; + case 399: + return "Cloud in a Balloon"; + case 400: + return "Adamantite Headgear"; + case 401: + return "Adamantite Helmet"; + case 402: + return "Adamantite Mask"; + case 403: + return "Adamantite Breastplate"; + case 404: + return "Adamantite Leggings"; + case 405: + return "Spectre Boots"; + case 406: + return "Adamantite Glaive"; + case 407: + return "Toolbelt"; + case 408: + return "Pearlsand Block"; + case 409: + return "Pearlstone Block"; + case 410: + return "Mining Shirt"; + case 411: + return "Mining Pants"; + case 412: + return "Pearlstone Brick"; + case 413: + return "Iridescent Brick"; + case 414: + return "Mudstone Brick"; + case 415: + return "Cobalt Brick"; + case 416: + return "Mythril Brick"; + case 417: + return "Pearlstone Brick Wall"; + case 418: + return "Iridescent Brick Wall"; + case 419: + return "Mudstone Brick Wall"; + case 420: + return "Cobalt Brick Wall"; + case 421: + return "Mythril Brick Wall"; + case 422: + return "Holy Water"; + case 423: + return "Unholy Water"; + case 424: + return "Silt Block"; + case 425: + return "Fairy Bell"; + case 426: + return "Breaker Blade"; + case 427: + return "Blue Torch"; + case 428: + return "Red Torch"; + case 429: + return "Green Torch"; + case 430: + return "Purple Torch"; + case 431: + return "White Torch"; + case 432: + return "Yellow Torch"; + case 433: + return "Demon Torch"; + case 434: + return "Clockwork Assault Rifle"; + case 435: + return "Cobalt Repeater"; + case 436: + return "Mythril Repeater"; + case 437: + return "Dual Hook"; + case 438: + return "Star Statue"; + case 439: + return "Sword Statue"; + case 440: + return "Slime Statue"; + case 441: + return "Goblin Statue"; + case 442: + return "Shield Statue"; + case 443: + return "Bat Statue"; + case 444: + return "Fish Statue"; + case 445: + return "Bunny Statue"; + case 446: + return "Skeleton Statue"; + case 447: + return "Reaper Statue"; + case 448: + return "Woman Statue"; + case 449: + return "Imp Statue"; + case 450: + return "Gargoyle Statue"; + case 451: + return "Gloom Statue"; + case 452: + return "Hornet Statue"; + case 453: + return "Bomb Statue"; + case 454: + return "Crab Statue"; + case 455: + return "Hammer Statue"; + case 456: + return "Potion Statue"; + case 457: + return "Spear Statue"; + case 458: + return "Cross Statue"; + case 459: + return "Jellyfish Statue"; + case 460: + return "Bow Statue"; + case 461: + return "Boomerang Statue"; + case 462: + return "Boot Statue"; + case 463: + return "Chest Statue"; + case 464: + return "Bird Statue"; + case 465: + return "Axe Statue"; + case 466: + return "Corrupt Statue"; + case 467: + return "Tree Statue"; + case 468: + return "Anvil Statue"; + case 469: + return "Pickaxe Statue"; + case 470: + return "Mushroom Statue"; + case 471: + return "Eyeball Statue"; + case 472: + return "Pillar Statue"; + case 473: + return "Heart Statue"; + case 474: + return "Pot Statue"; + case 475: + return "Sunflower Statue"; + case 476: + return "King Statue"; + case 477: + return "Queen Statue"; + case 478: + return "Piranha Statue"; + case 479: + return "Planked Wall"; + case 480: + return "Wooden Beam"; + case 481: + return "Adamantite Repeater"; + case 482: + return "Adamantite Sword"; + case 483: + return "Cobalt Sword"; + case 484: + return "Mythril Sword"; + case 485: + return "Moon Charm"; + case 486: + return "Ruler"; + case 487: + return "Crystal Ball"; + case 488: + return "Disco Ball"; + case 489: + return "Sorcerer Emblem"; + case 490: + return "Warrior Emblem"; + case 491: + return "Ranger Emblem"; + case 492: + return "Demon Wings"; + case 493: + return "Angel Wings"; + case 494: + return "Magical Harp"; + case 495: + return "Rainbow Rod"; + case 496: + return "Ice Rod"; + case 497: + return "Neptune's Shell"; + case 498: + return "Mannequin"; + case 499: + return "Greater Healing Potion"; + case 500: + return "Greater Mana Potion"; + case 501: + return "Pixie Dust"; + case 502: + return "Crystal Shard"; + case 503: + return "Clown Hat"; + case 504: + return "Clown Shirt"; + case 505: + return "Clown Pants"; + case 506: + return "Flamethrower"; + case 507: + return "Bell"; + case 508: + return "Harp"; + case 509: + return "Wrench"; + case 510: + return "Wire Cutter"; + case 511: + return "Active Stone Block"; + case 512: + return "Inactive Stone Block"; + case 513: + return "Lever"; + case 514: + return "Laser Rifle"; + case 515: + return "Crystal Bullet"; + case 516: + return "Holy Arrow"; + case 517: + return "Magic Dagger"; + case 518: + return "Crystal Storm"; + case 519: + return "Cursed Flames"; + case 520: + return "Soul of Light"; + case 521: + return "Soul of Night"; + case 522: + return "Cursed Flame"; + case 523: + return "Cursed Torch"; + case 524: + return "Adamantite Forge"; + case 525: + return "Mythril Anvil"; + case 526: + return "Unicorn Horn"; + case 527: + return "Dark Shard"; + case 528: + return "Light Shard"; + case 529: + return "Red Pressure Plate"; + case 530: + return "Wire"; + case 531: + return "Spell Tome"; + case 532: + return "Star Cloak"; + case 533: + return "Megashark"; + case 534: + return "Shotgun"; + case 535: + return "Philosopher's Stone"; + case 536: + return "Titan Glove"; + case 537: + return "Cobalt Naginata"; + case 538: + return "Switch"; + case 539: + return "Dart Trap"; + case 540: + return "Boulder"; + case 541: + return "Green Pressure Plate"; + case 542: + return "Gray Pressure Plate"; + case 543: + return "Brown Pressure Plate"; + case 544: + return "Mechanical Eye"; + case 545: + return "Cursed Arrow"; + case 546: + return "Cursed Bullet"; + case 547: + return "Soul of Fright"; + case 548: + return "Soul of Might"; + case 549: + return "Soul of Sight"; + case 550: + return "Gungnir"; + case 551: + return "Hallowed Plate Mail"; + case 552: + return "Hallowed Greaves"; + case 553: + return "Hallowed Helmet"; + case 554: + return "Cross Necklace"; + case 555: + return "Mana Flower"; + case 556: + return "Mechanical Worm"; + case 557: + return "Mechanical Skull"; + case 558: + return "Hallowed Headgear"; + case 559: + return "Hallowed Mask"; + case 560: + return "Slime Crown"; + case 561: + return "Light Disc"; + case 562: + return "Music Box (Overworld Day)"; + case 563: + return "Music Box (Eerie)"; + case 564: + return "Music Box (Night)"; + case 565: + return "Music Box (Title)"; + case 566: + return "Music Box (Underground)"; + case 567: + return "Music Box (Boss 1)"; + case 568: + return "Music Box (Jungle)"; + case 569: + return "Music Box (Corruption)"; + case 570: + return "Music Box (Underground Corruption)"; + case 571: + return "Music Box (The Hallow)"; + case 572: + return "Music Box (Boss 2)"; + case 573: + return "Music Box (Underground Hallow)"; + case 574: + return "Music Box (Boss 3)"; + case 575: + return "Soul of Flight"; + case 576: + return "Music Box"; + case 577: + return "Demonite Brick"; + case 578: + return "Hallowed Repeater"; + case 579: + return "Hamdrax"; + case 580: + return "Explosives"; + case 581: + return "Inlet Pump"; + case 582: + return "Outlet Pump"; + case 583: + return "1 Second Timer"; + case 584: + return "3 Second Timer"; + case 585: + return "5 Second Timer"; + case 586: + return "Candy Cane Block"; + case 587: + return "Candy Cane Wall"; + case 588: + return "Santa Hat"; + case 589: + return "Santa Shirt"; + case 590: + return "Santa Pants"; + case 591: + return "Green Candy Cane Block"; + case 592: + return "Green Candy Cane Wall"; + case 593: + return "Snow Block"; + case 594: + return "Snow Brick"; + case 595: + return "Snow Brick Wall"; + case 596: + return "Blue Light"; + case 597: + return "Red Light"; + case 598: + return "Green Light"; + case 599: + return "Blue Present"; + case 600: + return "Green Present"; + case 601: + return "Yellow Present"; + case 602: + return "Snow Globe"; + case 603: + return "Cabbage"; + case 604: + return "Dragon Mask"; + case 605: + return "Titan Helmet"; + case 606: + return "Spectral Headgear"; + case 607: + return "Dragon Breastplate"; + case 608: + return "Titan Mail"; + case 609: + return "Spectral Armor"; + case 610: + return "Dragon Greaves"; + case 611: + return "Titan Leggings"; + case 612: + return "Spectral Subligar"; + case 613: + return "Tizona"; + case 614: + return "Tonbogiri"; + case 615: + return "Sharanga"; + case 616: + return "Spectral Arrow"; + case 617: + return "Vulcan Repeater"; + case 618: + return "Vulcan Bolt"; + case 619: + return "Suspicious Looking Skull"; + case 620: + return "Soul of Blight"; + case 621: + return "Petri Dish"; + case 622: + return "Honeycomb"; + case 623: + return "Vial of Blood"; + case 624: + return "Wolf Fang"; + case 625: + return "Brain"; + case 626: + return "Music Box (Desert)"; + case 627: + return "Music Box (Space)"; + case 628: + return "Music Box (Tutorial)"; + case 629: + return "Music Box (Boss 4)"; + case 630: + return "Music Box (Ocean)"; + case 631: + return "Music Box (Snow)"; + } + } + else if (Lang.lang == 2) + { + switch (l) + { + case -24: + return "Gelbes Laserschwert"; + case -23: + return "Weißes Laserschwert"; + case -22: + return "Lila Laserschwert"; + case -21: + return "Grünes Laserschwert"; + case -20: + return "Rotes Laserschwert"; + case -19: + return "Blaues Laserschwert"; + case -18: + return "Kupferbogen"; + case -17: + return "Kupferhammer"; + case -16: + return "Kupferaxt"; + case -15: + return "Kupferkurzschwert"; + case -14: + return "Kupferbreitschwert"; + case -13: + return "Kupferspitzhacke"; + case -12: + return "Silberbogen"; + case -11: + return "Silberhammer"; + case -10: + return "Silberaxt"; + case -9: + return "Silberkurzschwert"; + case -8: + return "Silberbreitschwert"; + case -7: + return "Silberspitzhacke"; + case -6: + return "Goldbogen"; + case -5: + return "Goldhammer"; + case -4: + return "Goldaxt"; + case -3: + return "Goldkurzschwert"; + case -2: + return "Goldbreitschwert"; + case -1: + return "Goldspitzhacke"; + case 1: + return "Eisenspitzhacke"; + case 2: + return "Dreckblock"; + case 3: + return "Steinblock"; + case 4: + return "Eisenbreitschwert"; + case 5: + return "Pilz"; + case 6: + return "Eisenkurzschwert"; + case 7: + return "Eisenhammer"; + case 8: + return "Fackel"; + case 9: + return "Holz"; + case 10: + return "Eisenaxt"; + case 11: + return "Eisenerz"; + case 12: + return "Kupfererz"; + case 13: + return "Golderz"; + case 14: + return "Silbererz"; + case 15: + return "Kupferuhr"; + case 16: + return "Silberuhr"; + case 17: + return "Golduhr"; + case 18: + return "Taucheruhr"; + case 19: + return "Goldbarren"; + case 20: + return "Kupferbarren"; + case 21: + return "Silberbarren"; + case 22: + return "Eisenbarren"; + case 23: + return "Glibber"; + case 24: + return "Holzschwert"; + case 25: + return "Holztür"; + case 26: + return "Steinwand"; + case 27: + return "Eichel"; + case 28: + return "Schwacher Heiltrank"; + case 29: + return "Lebenskristall"; + case 30: + return "Dreckwand"; + case 31: + return "Flasche"; + case 32: + return "Holztisch"; + case 33: + return "Schmelzofen"; + case 34: + return "Holzstuhl"; + case 35: + return "Eisenamboss"; + case 36: + return "Werkbank"; + case 37: + return "Schutzbrille"; + case 38: + return "Linse"; + case 39: + return "Holzbogen"; + case 40: + return "Holzpfeil"; + case 41: + return "Flammenpfeil"; + case 42: + return "Shuriken"; + case 43: + return "Verdächtig aussehendes Auge"; + case 44: + return "Dämonenbogen"; + case 45: + return "Kriegsaxt der Nacht"; + case 46: + return "Schrecken des Tages"; + case 47: + return "Unheiliger Pfeil"; + case 48: + return "Truhe"; + case 49: + return "Wiederbelebungsband"; + case 50: + return "Magischer Spiegel"; + case 51: + return "Jester's Pfeil"; + case 52: + return "Engelsstatue"; + case 53: + return "Wolke in einer Flasche"; + case 54: + return "Hermes-Stiefel"; + case 55: + return "Verzauberter Bumerang"; + case 56: + return "Dämoniterz"; + case 57: + return "Dämonitbarren"; + case 58: + return "Herz"; + case 59: + return "Verderbte Saat"; + case 60: + return "Ekelpilz"; + case 61: + return "Ebensteinblock"; + case 62: + return "Grassaat"; + case 63: + return "Sonnenblume"; + case 64: + return "Ekeldorn"; + case 65: + return "Sternenwut"; + case 66: + return "Reinigungspulver"; + case 67: + return "Ekelpulver"; + case 68: + return "Verfaulter Fleischbrocken"; + case 69: + return "Wurmzahn"; + case 70: + return "Wurmköder"; + case 71: + return "Kupfermünze"; + case 72: + return "Silbermünze"; + case 73: + return "Goldmünze"; + case 74: + return "Platinmünze"; + case 75: + return "Sternschnuppe"; + case 76: + return "Kupferbeinschützer"; + case 77: + return "Eisenbeinschützer"; + case 78: + return "Silberbeinschützer"; + case 79: + return "Goldbeinschützer"; + case 80: + return "Kupferkettenhemd"; + case 81: + return "Eisenkettenhemd"; + case 82: + return "Silberkettenhemd"; + case 83: + return "Goldkettenhemd"; + case 84: + return "Greifhaken "; + case 85: + return "Eisenkette"; + case 86: + return "Schattenschuppe"; + case 87: + return "Sparschwein"; + case 88: + return "Bergmannshelm"; + case 89: + return "Kupferhelm"; + case 90: + return "Eisenhelm"; + case 91: + return "Silberhelm"; + case 92: + return "Goldhelm"; + case 93: + return "Holzwand"; + case 94: + return "Holzklappe"; + case 95: + return "Steinschlosspistole"; + case 96: + return "Muskete"; + case 97: + return "Musketenkugel"; + case 98: + return "Minihai"; + case 99: + return "Eisenbogen"; + case 100: + return "Schattenbeinschützer"; + case 101: + return "Schattenschuppenhemd"; + case 102: + return "Schattenhelm"; + case 103: + return "Albtraum-Spitzhacke"; + case 104: + return "Zerschmetterer"; + case 105: + return "Kerze"; + case 106: + return "Kupferkronleuchter"; + case 107: + return "Silberkronleuchter"; + case 108: + return "Goldkronleuchter"; + case 109: + return "Mana-Kristall"; + case 110: + return "Schwacher Manatrank"; + case 111: + return "Sternenkraftband"; + case 112: + return "Feuerblume"; + case 113: + return "Magische Rakete"; + case 114: + return "Dreckrute"; + case 115: + return "Lichtkugel"; + case 116: + return "Meteorit"; + case 117: + return "Meteoritenbarren"; + case 118: + return "Haken"; + case 119: + return "Flamarang"; + case 120: + return "Geschmolzene Wut"; + case 121: + return "Feuriges Großschwert"; + case 122: + return "Geschmolzene Spitzhacke"; + case 123: + return "Meteorhelm"; + case 124: + return "Meteoranzug"; + case 125: + return "Meteor Leggings"; + case 126: + return "Flaschenwasser"; + case (int) sbyte.MaxValue: + return "Weltraumpistole"; + case 128: + return "Raketenstiefel"; + case 129: + return "Grauer Ziegel"; + case 130: + return "Graue Ziegelwand"; + case 131: + return "Roter Ziegel"; + case 132: + return "Rote Ziegelwand"; + case 133: + return "Lehmblock"; + case 134: + return "Blauer Ziegel"; + case 135: + return "Blaue Ziegelwand"; + case 136: + return "Kettenlaterne"; + case 137: + return "Grüner Ziegel"; + case 138: + return "Grüne Ziegelwand"; + case 139: + return "Rosa Ziegel"; + case 140: + return "Rosa Ziegelwand"; + case 141: + return "Goldziegel"; + case 142: + return "Goldene Ziegelwand"; + case 143: + return "Silberziegel"; + case 144: + return "Silberne Ziegelwand"; + case 145: + return "Kupferziegel"; + case 146: + return "Kupferne Ziegelwand"; + case 147: + return "Stachel"; + case 148: + return "Wasserkerze"; + case 149: + return "Buch"; + case 150: + return "Spinnennetz"; + case 151: + return "Nekrohelm"; + case 152: + return "Nekro-Brustplatte"; + case 153: + return "Nekro-Beinschützer"; + case 154: + return "Knochen"; + case 155: + return "Muramasa"; + case 156: + return "Kobaltschild"; + case 157: + return "Aqua-Zepter"; + case 158: + return "Glückshufeisen"; + case 159: + return "Leuchtend roter Ballon"; + case 160: + return "Harpune"; + case 161: + return "Stachelball"; + case 162: + return "Ball des Schmerzes"; + case 163: + return "Blauer Mond"; + case 164: + return "Pistole"; + case 165: + return "Wasserbolzen"; + case 166: + return "Bombe"; + case 167: + return "Dynamit"; + case 168: + return "Granate"; + case 169: + return "Sandblock"; + case 170: + return "Glas"; + case 171: + return "Spruchschild"; + case 172: + return "Aschenblock"; + case 173: + return "Obsidian"; + case 174: + return "Höllenstein"; + case 175: + return "Höllenstein-Barren"; + case 176: + return "Schlammblock"; + case 177: + return "Saphir"; + case 178: + return "Rubin"; + case 179: + return "Smaragd"; + case 180: + return "Topas"; + case 181: + return "Amethyst"; + case 182: + return "Diamant"; + case 183: + return "Glühender Pilz"; + case 184: + return "Stern"; + case 185: + return "Efeupeitsche"; + case 186: + return "Schilfrohr"; + case 187: + return "Flosse"; + case 188: + return "Heiltrank"; + case 189: + return "Manatrank"; + case 190: + return "Grasklinge"; + case 191: + return "Dornen-Chakram"; + case 192: + return "Obsidianziegel"; + case 193: + return "Obsidianschädel"; + case 194: + return "Pilzgras-Saat"; + case 195: + return "Dschungelgras-Saat"; + case 196: + return "Holzhammer"; + case 197: + return "Sternenkanone"; + case 198: + return "Blaue Laserklinge"; + case 199: + return "Rote Laserklinge"; + case 200: + return "Grüne Laserklinge"; + case 201: + return "Lila Laserklinge"; + case 202: + return "Weiße Laserklinge"; + case 203: + return "Gelbe Laserklinge"; + case 204: + return "Meteor-Hamaxt"; + case 205: + return "Leerer Eimer"; + case 206: + return "Wassereimer"; + case 207: + return "Lavaeimer"; + case 208: + return "Dschungelrose"; + case 209: + return "Hornissenstachel"; + case 210: + return "Weinrebe"; + case 211: + return "Wilde Klauen"; + case 212: + return "Fusskette des Windes"; + case 213: + return "Stab des Nachwachsens"; + case 214: + return "Höllensteinziegel"; + case 215: + return "Furzkissen"; + case 216: + return "Fessel"; + case 217: + return "Geschmolzene Hamaxt"; + case 218: + return "Flammenpeitsche"; + case 219: + return "Phoenix-Blaster"; + case 220: + return "Sonnenwut"; + case 221: + return "Höllenschmiede"; + case 222: + return "Tontopf"; + case 223: + return "Geschenk der Natur"; + case 224: + return "Bett"; + case 225: + return "Seide"; + case 226: + return "Schwacher Wiederherstellungstrank"; + case 227: + return "Wiederherstellungstrank"; + case 228: + return "Dschungelhut"; + case 229: + return "Dschungelhemd"; + case 230: + return "Dschungelhosen"; + case 231: + return "Geschmolzener Helm"; + case 232: + return "Geschmolzene Brustplatte"; + case 233: + return "Geschmolzene Beinschützer"; + case 234: + return "Meteorenschuss"; + case 235: + return "Haftbombe"; + case 236: + return "Schwarze Linsen"; + case 237: + return "Sonnenbrille"; + case 238: + return "Zaubererhut"; + case 239: + return "Zylinderhut"; + case 240: + return "Smokinghemd"; + case 241: + return "Smokinghosen"; + case 242: + return "Sommerhut"; + case 243: + return "Hasenkapuze"; + case 244: + return "Klempnerhut"; + case 245: + return "Klempnerhemd"; + case 246: + return "Klempnerhosen"; + case 247: + return "Heldenhut"; + case 248: + return "Heldenhemd"; + case 249: + return "Heldenhosen"; + case 250: + return "Fischglas"; + case 251: + return "Archäologenhut"; + case 252: + return "Archäologenjacke"; + case 253: + return "Archäologenhosen"; + case 254: + return "Schwarzer Farbstoff"; + case (int) byte.MaxValue: + return "Violetter Farbstoff"; + case 256: + return "Ninja-Kapuze"; + case 257: + return "Ninjahemd"; + case 258: + return "Ninjahosen"; + case 259: + return "Leder"; + case 260: + return "Roter Hut"; + case 261: + return "Goldfisch"; + case 262: + return "Robe"; + case 263: + return "Roboterhut"; + case 264: + return "Goldkrone"; + case 265: + return "Höllenfeuer-Pfeil"; + case 266: + return "Sandgewehr"; + case 267: + return "Guide-Voodoopuppe"; + case 268: + return "Taucherhelm"; + case 269: + return "Vertrautes Hemd"; + case 270: + return "Vertraute Hosen"; + case 271: + return "Vertraute Frisur"; + case 272: + return "Dämonensense"; + case 273: + return "Klinge der Nacht"; + case 274: + return "Dunkle Lanze"; + case 275: + return "Koralle"; + case 276: + return "Kaktus"; + case 277: + return "Dreizack"; + case 278: + return "Silbergeschoss"; + case 279: + return "Wurfmesser"; + case 280: + return "Speer"; + case 281: + return "Blasrohr"; + case 282: + return "Leuchtstab"; + case 283: + return "Saat"; + case 284: + return "Holzbumerang"; + case 285: + return "Schnürsenkelkappe"; + case 286: + return "Klebriger Leuchtstab"; + case 287: + return "Giftmesser"; + case 288: + return "Obsidianhaut-Trank"; + case 289: + return "Wiederbelebungstrank"; + case 290: + return "Flinkheitstrank"; + case 291: + return "Kiementrank"; + case 292: + return "Eisenhaut-Trank"; + case 293: + return "Mana-Wiederherstellungstrank"; + case 294: + return "Magiekraft-Trank"; + case 295: + return "Federsturz-Trank"; + case 296: + return "Höhlenforschertrank"; + case 297: + return "Unsichtbarkeitstrank"; + case 298: + return "Strahlentrank"; + case 299: + return "Nachteulentrank"; + case 300: + return "Kampftrank"; + case 301: + return "Dornentrank"; + case 302: + return "Wasserlauftrank"; + case 303: + return "Bogenschießtrank"; + case 304: + return "Jägertrank"; + case 305: + return "Gravitationstrank"; + case 306: + return "Goldtruhe"; + case 307: + return "Tagesblumensaat"; + case 308: + return "Mondscheinsaat"; + case 309: + return "Leuchtwurzel-Saat"; + case 310: + return "Todeskraut-Saat"; + case 311: + return "Wasserblatt-Saat"; + case 312: + return "Feuerblüten-Saat"; + case 313: + return "Tagesblume"; + case 314: + return "Mondglanz"; + case 315: + return "Leuchtwurzel"; + case 316: + return "Todeskraut"; + case 317: + return "Wasserblatt"; + case 318: + return "Feuerblüte"; + case 319: + return "Haifinne"; + case 320: + return "Feder"; + case 321: + return "Grabstein"; + case 322: + return "Pantomimen-Maske"; + case 323: + return "Ameisenlöwenkiefer"; + case 324: + return "Illegale Gewehrteile"; + case 325: + return "Hemd des Arztes"; + case 326: + return "Hosen des Arztes"; + case 327: + return "Goldener Schlüssel"; + case 328: + return "Schattentruhe"; + case 329: + return "Schattenschlüssel"; + case 330: + return "Obsidianziegelwand"; + case 331: + return "Dschungelsporen"; + case 332: + return "Webstuhl"; + case 333: + return "Piano"; + case 334: + return "Kommode"; + case 335: + return "Sitzbank"; + case 336: + return "Badewanne"; + case 337: + return "Rotes Banner"; + case 338: + return "Grünes Banner"; + case 339: + return "Blaues Banner"; + case 340: + return "Gelbes Banner"; + case 341: + return "Laternenpfahl"; + case 342: + return "Petroleumfackel"; + case 343: + return "Fass"; + case 344: + return "Chinesische Laterne"; + case 345: + return "Kochtopf"; + case 346: + return "Tresor"; + case 347: + return "Schädellaterne"; + case 348: + return "Mülleimer"; + case 349: + return "Kandelaber"; + case 350: + return "Rosa Vase"; + case 351: + return "Krug"; + case 352: + return "Gärbottich"; + case 353: + return "Bier"; + case 354: + return "Bücherregal"; + case 355: + return "Thron"; + case 356: + return "Schüssel"; + case 357: + return "Schüssel mit Suppe"; + case 358: + return "Toilette"; + case 359: + return "Standuhr"; + case 360: + return "Rüstungsstatue"; + case 361: + return "Goblin-Kampfstandarte"; + case 362: + return "Zerfetzter Stoff"; + case 363: + return "Sägewerk"; + case 364: + return "Kobalterz"; + case 365: + return "Mithrilerz"; + case 366: + return "Adamantiterz"; + case 367: + return "Pwnhammer"; + case 368: + return "Excalibur"; + case 369: + return "Heilige Saat"; + case 370: + return "Ebensandblock"; + case 371: + return "Kobalthut"; + case 372: + return "Kobalthelm"; + case 373: + return "Kobalt-Maske"; + case 374: + return "Kobalt-Brustplatte"; + case 375: + return "Kobalt-Gamaschen"; + case 376: + return "Mithril-Kapuze"; + case 377: + return "Mithril-Helm"; + case 378: + return "Mithrilhut"; + case 379: + return "Mithril-Kettenhemd"; + case 380: + return "Mithril-Beinschützer"; + case 381: + return "Kobaltbarren"; + case 382: + return "Mithrilbarren"; + case 383: + return "Kobalt-Kettensäge"; + case 384: + return "Mithril-Kettensäge"; + case 385: + return "Kobaltbohrer"; + case 386: + return "Mithrilbohrer"; + case 387: + return "Adamantit-Kettensäge"; + case 388: + return "Adamantitbohrer"; + case 389: + return "Dao von Pow"; + case 390: + return "Mithril-Hellebarde"; + case 391: + return "Adamantitbarren"; + case 392: + return "Glaswand"; + case 393: + return "Kompass"; + case 394: + return "Tauchausrüstung"; + case 395: + return "GPS"; + case 396: + return "Obsidian-Hufeisen"; + case 397: + return "Obsidianschild"; + case 398: + return "Tüftler-Werkstatt"; + case 399: + return "Wolke in einem Ballon"; + case 400: + return "Adamantit-Kopfschutz"; + case 401: + return "Adamantit-Helm"; + case 402: + return "Adamantit-Maske"; + case 403: + return "Adamantit-Brustplatte"; + case 404: + return "Adamantit-Gamaschen"; + case 405: + return "Geisterstiefel"; + case 406: + return "Adamantit-Gleve"; + case 407: + return "Werkzeuggürtel"; + case 408: + return "Perlsandblock"; + case 409: + return "Perlsteinblock"; + case 410: + return "Bergbauhemd"; + case 411: + return "Bergbauhosen"; + case 412: + return "Perlsteinziegel"; + case 413: + return "Schillernder Ziegel"; + case 414: + return "Schlammsteinziegel"; + case 415: + return "Kobaltziegel"; + case 416: + return "Mithrilziegel"; + case 417: + return "Perlstein-Ziegelwand"; + case 418: + return "Schillernde Ziegelwand"; + case 419: + return "Schlammstein-Ziegelwand"; + case 420: + return "Kobalt-Ziegelwand"; + case 421: + return "Mithril-Ziegelwand"; + case 422: + return "Heiliges Wasser"; + case 423: + return "Unheiliges Wasser"; + case 424: + return "Schlickblock"; + case 425: + return "Feenglocke"; + case 426: + return "Schmetterklinge"; + case 427: + return "Blaue Fackel"; + case 428: + return "Rote Fackel"; + case 429: + return "Grüne Fackel"; + case 430: + return "Lila Fackel"; + case 431: + return "Weiße Fackel"; + case 432: + return "Gelbe Fackel"; + case 433: + return "Dämonenfackel"; + case 434: + return "Automatiksturmwaffe"; + case 435: + return "Kobaltrepetierer"; + case 436: + return "Mithrilrepetierer"; + case 437: + return "Doppel-Greifhaken"; + case 438: + return "Sternstatue"; + case 439: + return "Schwertstatue"; + case 440: + return "Schleimstatue"; + case 441: + return "Goblinstatue"; + case 442: + return "Schildstatue"; + case 443: + return "Fledermausstatue"; + case 444: + return "Fischstatue"; + case 445: + return "Hasenstatue"; + case 446: + return "Skelettstatue"; + case 447: + return "Sensenmannstatue"; + case 448: + return "Frauenstatue"; + case 449: + return "Impstatue"; + case 450: + return "Wasserspeier-Statue"; + case 451: + return "Vanitasstatue"; + case 452: + return "Hornissenstatue"; + case 453: + return "Bombenstatue"; + case 454: + return "Krabbenstatue"; + case 455: + return "Hammerstatue"; + case 456: + return "Trankstatue"; + case 457: + return "Speerstatue"; + case 458: + return "Kreuzstatue"; + case 459: + return "Quallenstatue"; + case 460: + return "Bogenstatue"; + case 461: + return "Bumerangstatue"; + case 462: + return "Stiefelstatue"; + case 463: + return "Truhenstatue"; + case 464: + return "Vogelstatue"; + case 465: + return "Axtstatue"; + case 466: + return "Verderbnisstatue"; + case 467: + return "Baumstatue"; + case 468: + return "Amboss-Statue"; + case 469: + return "Spitzhackenstatue"; + case 470: + return "Pilzstatue"; + case 471: + return "Augapfelstatue"; + case 472: + return "Säulenstatue"; + case 473: + return "Herzstatue"; + case 474: + return "Topfstatue"; + case 475: + return "Sonnenblumenstatue"; + case 476: + return "Königstatue"; + case 477: + return "Königinstatue"; + case 478: + return "Piranhastatue"; + case 479: + return "Plankenwand"; + case 480: + return "Holzbalken"; + case 481: + return "Adamantitrepetierer"; + case 482: + return "Adamantitschwert"; + case 483: + return "Kobaltschwert"; + case 484: + return "Mithrilschwert"; + case 485: + return "Mondzauber"; + case 486: + return "Lineal"; + case 487: + return "Kristallkugel"; + case 488: + return "Diskokugel"; + case 489: + return "Siegel des Magiers"; + case 490: + return "Siegel des Kriegers"; + case 491: + return "Siegel des Bogenschützen"; + case 492: + return "Dämonenflügel"; + case 493: + return "Engelsflügel"; + case 494: + return "Magische Harfe"; + case 495: + return "Regenbogenrute"; + case 496: + return "Eisrute"; + case 497: + return "Neptuns Muschel"; + case 498: + return "Schaufensterpuppe"; + case 499: + return "Großer Heiltrank"; + case 500: + return "Großer Manatrank"; + case 501: + return "Pixie-Staub"; + case 502: + return "Kristallscherbe"; + case 503: + return "Clownshut"; + case 504: + return "Clownshemd"; + case 505: + return "Clownshosen"; + case 506: + return "Flammenwerfer"; + case 507: + return "Glocke"; + case 508: + return "Harfe"; + case 509: + return "Schraubenschlüssel"; + case 510: + return "Kabelcutter"; + case 511: + return "Aktiver Steinblock"; + case 512: + return "Inaktiver Steinblock"; + case 513: + return "Hebel"; + case 514: + return "Lasergewehr"; + case 515: + return "Kristallgeschoss"; + case 516: + return "Heiliger Pfeil"; + case 517: + return "Magischer Dolch"; + case 518: + return "Kristallsturm"; + case 519: + return "Verfluchte Flammen"; + case 520: + return "Seele des Lichts"; + case 521: + return "Seele der Nacht"; + case 522: + return "Verfluchte Flamme"; + case 523: + return "Verfluchte Fackel"; + case 524: + return "Adamantitschmiede"; + case 525: + return "Mithrilamboss"; + case 526: + return "Horn des Einhorns"; + case 527: + return "Dunkle Scherbe"; + case 528: + return "Lichtscherbe"; + case 529: + return "Rote Druckplatte"; + case 530: + return "Kabel"; + case 531: + return "Buch der Flüche"; + case 532: + return "Sternenumhang"; + case 533: + return "Maxihai"; + case 534: + return "Schrotflinte"; + case 535: + return "Stein der Weisen"; + case 536: + return "Titanhandschuh"; + case 537: + return "Kobalt-Naginata"; + case 538: + return "Schalter"; + case 539: + return "Pfeilfalle"; + case 540: + return "Felsbrocken"; + case 541: + return "Grüne Druckplatte"; + case 542: + return "Graue Druckplatte"; + case 543: + return "Braune Druckplatte"; + case 544: + return "Mechanisches Auge"; + case 545: + return "Verfluchter Pfeil"; + case 546: + return "Verfluchtes Geschoss"; + case 547: + return "Seele des Schreckens"; + case 548: + return "Seele der Macht"; + case 549: + return "Seele der Einsicht"; + case 550: + return "Gungnir"; + case 551: + return "Heiliger Plattenpanzer"; + case 552: + return "Heilige Beinschützer"; + case 553: + return "Heiliger Helm"; + case 554: + return "Kreuzhalskette"; + case 555: + return "Mana-Blume"; + case 556: + return "Mechanischer Wurm"; + case 557: + return "Mechanischer Schaedel"; + case 558: + return "Heiliger Kopfschutz"; + case 559: + return "Heilige Maske"; + case 560: + return "Schleimkrone"; + case 561: + return "Lichtscheibe"; + case 562: + return "Musikbox (Tag in der Oberwelt)"; + case 563: + return "Musikbox (Gespenstisch)"; + case 564: + return "Musikbox (Nacht)"; + case 565: + return "Musikbox (Titel)"; + case 566: + return "Musikbox (Unterirdisch)"; + case 567: + return "Musikbox (Boss 1)"; + case 568: + return "Musikbox (Dschungel)"; + case 569: + return "Musikbox (Verderben)"; + case 570: + return "Musikbox (Unterirdisches Verderben)"; + case 571: + return "Musikbox (Das Heilige)"; + case 572: + return "Musikbox (Boss 2)"; + case 573: + return "Musikbox (Unterirdisches Heiliges)"; + case 574: + return "Musikbox (Boss 3)"; + case 575: + return "Seele des Flugs"; + case 576: + return "Musikbox"; + case 577: + return "Dämonitziegel"; + case 578: + return "Heiliger Repetierer"; + case 579: + return "Hamdrax"; + case 580: + return "Sprengstoffe"; + case 581: + return "Einlasspumpe"; + case 582: + return "Auslasspumpe"; + case 583: + return "1-Sekunden-Timer"; + case 584: + return "3-Sekunden-Timer"; + case 585: + return "5-Sekunden-Timer"; + case 586: + return "Candy Cane-Block"; + case 587: + return "Candy Cane-Wand"; + case 588: + return "Weihnachtsmütze"; + case 589: + return "Santa Shirt"; + case 590: + return "von Santa Pants"; + case 591: + return "Grüner Candy Cane-Block"; + case 592: + return "Grüne Candy Cane-Wand"; + case 593: + return "Schnee-Block"; + case 594: + return "Schneeziegel"; + case 595: + return "Schnee-Ziegelwand"; + case 596: + return "Blaues Licht"; + case 597: + return "Rotes Licht"; + case 598: + return "Grünes Licht"; + case 599: + return "Blaue Gegenwart"; + case 600: + return "Grüne Gegenwart"; + case 601: + return "Gelbe Gegenwart"; + case 602: + return "Schneekugel"; + case 603: + return "Kohl"; + case 604: + return "Drachenmaske"; + case 605: + return "Titanhelm"; + case 606: + return "Spektral-Kopfbedeckung"; + case 607: + return "Drachen-Brustpanzer"; + case 608: + return "Titanrüstung"; + case 609: + return "Spektralrüstung"; + case 610: + return "Drachen-Beinschienen"; + case 611: + return "Titanleggings"; + case 612: + return "Spektralschurz"; + case 613: + return "Tizona"; + case 614: + return "Tonbogiri"; + case 615: + return "Sharanga"; + case 616: + return "Spektralpfeil"; + case 617: + return "Vulkan Repeater"; + case 618: + return "Vulkanbolzen"; + case 619: + return "Verdächtig aussehender Schädel"; + case 620: + return "Seele des Verderbens"; + case 621: + return "Petrischale"; + case 622: + return "Bienenwabe"; + case 623: + return "Phiole mit Blut"; + case 624: + return "Wolfszahn"; + case 625: + return "Gehirn"; + case 626: + return "Spieluhr (Wüste)"; + case 627: + return "Spieluhr (Weltall)"; + case 628: + return "Spieluhr (Tutorial)"; + case 629: + return "Spieluhr (Boss 4)"; + case 630: + return "Spieluhr (Ozean)"; + case 631: + return "Spieluhr (Schnee)"; + } + } + else if (Lang.lang == 3) + { + switch (l) + { + case -24: + return "Spada laser gialla"; + case -23: + return "Spada laser bianca"; + case -22: + return "Spada laser viola"; + case -21: + return "Spada laser verde"; + case -20: + return "Spada laser rossa"; + case -19: + return "Spada laser blu"; + case -18: + return "Arco di rame"; + case -17: + return "Martello di rame"; + case -16: + return "Ascia di rame"; + case -15: + return "Spada corta di rame"; + case -14: + return "Spadone di rame"; + case -13: + return "Piccone di rame"; + case -12: + return "Arco d'argento"; + case -11: + return "Martello d'argento"; + case -10: + return "Ascia d'argento"; + case -9: + return "Spada corta d'argento"; + case -8: + return "Spadone d'argento"; + case -7: + return "Piccone d'argento"; + case -6: + return "Arco d'oro"; + case -5: + return "Martello d'oro"; + case -4: + return "Ascia d'oro"; + case -3: + return "Spada corta d'oro"; + case -2: + return "Spadone d'oro"; + case -1: + return "Piccone d'oro"; + case 1: + return "Piccone di ferro"; + case 2: + return "Blocco di terra"; + case 3: + return "Blocco di pietra"; + case 4: + return "Spadone di ferro"; + case 5: + return "Fungo"; + case 6: + return "Spada corta di ferro"; + case 7: + return "Martello di ferro"; + case 8: + return "Torcia"; + case 9: + return "Legno"; + case 10: + return "Ascia di ferro"; + case 11: + return "Minerale di ferro"; + case 12: + return "Minerale di rame"; + case 13: + return "Minerale d'oro"; + case 14: + return "Minerale d'argento"; + case 15: + return "Orologio di rame"; + case 16: + return "Orologio d'argento"; + case 17: + return "Orologio d'oro"; + case 18: + return "Misuratore di profondità"; + case 19: + return "Barra d'oro"; + case 20: + return "Barra di rame"; + case 21: + return "Barra d'argento"; + case 22: + return "Barra di ferro"; + case 23: + return "Gelatina"; + case 24: + return "Spada di legno"; + case 25: + return "Porta di legno"; + case 26: + return "Muro di pietra"; + case 27: + return "Ghianda"; + case 28: + return "Pozione curativa inferiore"; + case 29: + return "Cristallo di vita"; + case 30: + return "Muro di terra"; + case 31: + return "Bottiglia"; + case 32: + return "Tavolo di legno"; + case 33: + return "Fornace"; + case 34: + return "Sedia di legno"; + case 35: + return "Incudine di ferro"; + case 36: + return "Banco da lavoro"; + case 37: + return "Occhiali protettivi"; + case 38: + return "Lenti"; + case 39: + return "Arco di legno"; + case 40: + return "Freccia di legno"; + case 41: + return "Freccia infuocata"; + case 42: + return "Shuriken"; + case 43: + return "Occhio dallo sguardo sospetto"; + case 44: + return "Arco demoniaco"; + case 45: + return "Ascia da guerra della notte"; + case 46: + return "Flagello di luce"; + case 47: + return "Freccia empia"; + case 48: + return "Cassa"; + case 49: + return "Benda di rigenerazione"; + case 50: + return "Specchio magico"; + case 51: + return "Freccia del giullare"; + case 52: + return "Statua dell'angelo"; + case 53: + return "Nuvola in bottiglia"; + case 54: + return "Stivali di Ermes"; + case 55: + return "Boomerang incantato"; + case 56: + return "Minerale demoniaco"; + case 57: + return "Barra demoniaca"; + case 58: + return "Cuore"; + case 59: + return "Semi corrotti"; + case 60: + return "Fungo disgustoso"; + case 61: + return "Blocco pietra d'ebano"; + case 62: + return "Semi d'erba"; + case 63: + return "Girasole"; + case 64: + return "Spina vile"; + case 65: + return "Furia stellare"; + case 66: + return "Polvere purificatrice"; + case 67: + return "Polvere disgustosa"; + case 68: + return "Ceppo marcio"; + case 69: + return "Dente di verme"; + case 70: + return "Esca di verme"; + case 71: + return "Moneta di rame"; + case 72: + return "Moneta d'argento"; + case 73: + return "Moneta d'oro"; + case 74: + return "Moneta di platino"; + case 75: + return "Stella cadente"; + case 76: + return "Schiniere di rame "; + case 77: + return "Schiniere di ferro"; + case 78: + return "Schiniere d'argento"; + case 79: + return "Schiniere d'oro"; + case 80: + return "Maglia metallica di rame"; + case 81: + return "Maglia metallica di ferro"; + case 82: + return "Maglia metallica d'argento"; + case 83: + return "Maglia metallica d'oro"; + case 84: + return "Rampino"; + case 85: + return "Catena di ferro"; + case 86: + return "Scaglia d'ombra"; + case 87: + return "Salvadanaio"; + case 88: + return "Casco da minatore"; + case 89: + return "Casco di rame"; + case 90: + return "Casco di ferro"; + case 91: + return "Casco d'argento"; + case 92: + return "Casco d'oro"; + case 93: + return "Muro di legno"; + case 94: + return "Piattaforma di legno"; + case 95: + return "Pistola a pietra focaia"; + case 96: + return "Moschetto"; + case 97: + return "Palla di moschetto"; + case 98: + return "Minishark"; + case 99: + return "Arco di ferro"; + case 100: + return "Schiniere ombra"; + case 101: + return "Armatura a scaglie ombra"; + case 102: + return "Casco ombra"; + case 103: + return "Piccone dell'incubo"; + case 104: + return "Il Distruttore"; + case 105: + return "Candela"; + case 106: + return "Lampadario di rame"; + case 107: + return "Lampadario d'argento"; + case 108: + return "Lampadario d'oro"; + case 109: + return "Cristallo mana"; + case 110: + return "Pozione mana inferiore"; + case 111: + return "Benda della forza stellare"; + case 112: + return "Fiore di fuoco"; + case 113: + return "Missile magico"; + case 114: + return "Bastone di terra"; + case 115: + return "Orbita di luce"; + case 116: + return "Meteorite"; + case 117: + return "Barra di meteorite"; + case 118: + return "Uncino"; + case 119: + return "Flamarang"; + case 120: + return "Furia fusa"; + case 121: + return "Spadone di fuoco"; + case 122: + return "Piccone fuso"; + case 123: + return "Casco meteorite"; + case 124: + return "Tunica di meteorite"; + case 125: + return "Gambali di meteorite"; + case 126: + return "Acqua imbottigliata"; + case (int) sbyte.MaxValue: + return "Spazio pistola"; + case 128: + return "Stivali razzo"; + case 129: + return "Mattone grigio"; + case 130: + return "Muro grigio"; + case 131: + return "Mattone rosso"; + case 132: + return "Muro rosso"; + case 133: + return "Blocco d'argilla"; + case 134: + return "Mattone blu"; + case 135: + return "Muro blu"; + case 136: + return "Lanterna con catena"; + case 137: + return "Mattone verde"; + case 138: + return "Muro verde"; + case 139: + return "Mattone rosa"; + case 140: + return "Muro rosa"; + case 141: + return "Mattone d'oro"; + case 142: + return "Muro d'oro"; + case 143: + return "Mattone d'argento"; + case 144: + return "Muro d'argento"; + case 145: + return "Mattone di rame"; + case 146: + return "Muro di rame"; + case 147: + return "Spina"; + case 148: + return "Candela d'acqua"; + case 149: + return "Libro"; + case 150: + return "Ragnatela"; + case 151: + return "Casco funebre"; + case 152: + return "Pettorale funebre"; + case 153: + return "Gambali funebri"; + case 154: + return "Osso"; + case 155: + return "Muramasa"; + case 156: + return "Scudo di cobalto"; + case 157: + return "Scettro d'acqua"; + case 158: + return "Ferro di cavallo fortunato"; + case 159: + return "Palloncino rosso brillante"; + case 160: + return "Arpione"; + case 161: + return "Palla chiodata"; + case 162: + return "Palla del dolore"; + case 163: + return "Luna blu"; + case 164: + return "Pistola"; + case 165: + return "Dardo d'acqua"; + case 166: + return "Bomba"; + case 167: + return "Dinamite"; + case 168: + return "Granata"; + case 169: + return "Blocco di sabbia"; + case 170: + return "Vetro"; + case 171: + return "Cartello"; + case 172: + return "Blocco di cenere"; + case 173: + return "Ossidiana"; + case 174: + return "Pietra infernale"; + case 175: + return "Barra di pietra infernale"; + case 176: + return "Blocco di fango"; + case 177: + return "Zaffiro"; + case 178: + return "Rubino"; + case 179: + return "Smeraldo"; + case 180: + return "Topazio"; + case 181: + return "Ametista"; + case 182: + return "Diamante"; + case 183: + return "Fungo luminoso"; + case 184: + return "Stella"; + case 185: + return "Frusta di edera"; + case 186: + return "Canna per la respirazione"; + case 187: + return "Pinna"; + case 188: + return "Pozione curativa"; + case 189: + return "Pozione mana"; + case 190: + return "Spada di erba"; + case 191: + return "Artiglio di Chakram"; + case 192: + return "Mattone di ossidiana"; + case 193: + return "Teschio di ossidiana"; + case 194: + return "Semi di fungo"; + case 195: + return "Semi dell'erba della giungla"; + case 196: + return "Martello di legno"; + case 197: + return "Cannone stellare"; + case 198: + return "Spada laser blu"; + case 199: + return "Spada laser rossa"; + case 200: + return "Spada laser verde"; + case 201: + return "Spada laser viola"; + case 202: + return "Spada laser bianca"; + case 203: + return "Spada laser gialla"; + case 204: + return "Maglio di meteorite"; + case 205: + return "Secchio vuoto"; + case 206: + return "Secchio d'acqua"; + case 207: + return "Secchio di lava"; + case 208: + return "Rosa della giungla"; + case 209: + return "Artiglio"; + case 210: + return "Vite"; + case 211: + return "Artigli bestiali"; + case 212: + return "Cavigliera del vento"; + case 213: + return "Bastone della ricrescita"; + case 214: + return "Mattone di pietra infernale"; + case 215: + return "Cuscino rumoroso"; + case 216: + return "Grillo"; + case 217: + return "Maglio fuso"; + case 218: + return "Lanciatore di fiamma"; + case 219: + return "Blaster della fenice"; + case 220: + return "Furia del sole"; + case 221: + return "Creazione degli inferi"; + case 222: + return "Vaso di argilla"; + case 223: + return "Dono della natura"; + case 224: + return "Letto"; + case 225: + return "Seta"; + case 226: + return "Pozione di ripristino inferiore"; + case 227: + return "Pozione di ripristino"; + case 228: + return "Cappello della giungla"; + case 229: + return "Camicia della giungla"; + case 230: + return "Pantaloni della giungla"; + case 231: + return "Casco fuso"; + case 232: + return "Pettorale fuso"; + case 233: + return "Schiniere fuso"; + case 234: + return "Sparo di meteorite"; + case 235: + return "Bomba appiccicosa"; + case 236: + return "Lenti nere"; + case 237: + return "Occhiali da sole"; + case 238: + return "Cappello dello stregone"; + case 239: + return "Cilindro"; + case 240: + return "Camicia da smoking"; + case 241: + return "Pantaloni da smoking"; + case 242: + return "Cappello estivo"; + case 243: + return "Cappuccio da coniglio"; + case 244: + return "Cappello da idraulico"; + case 245: + return "Camicia da idraulico"; + case 246: + return "Pantaloni da idraulico"; + case 247: + return "Cappello da eroe"; + case 248: + return "Camicia da eroe"; + case 249: + return "Pantaloni da eroe"; + case 250: + return "Boccia dei pesci rossi"; + case 251: + return "Cappello da archeologo"; + case 252: + return "Giacca da archeologo"; + case 253: + return "Pantaloni da archeologo"; + case 254: + return "Tintura nera"; + case (int) byte.MaxValue: + return "Tintura viola"; + case 256: + return "Cappuccio ninja"; + case 257: + return "Camicia ninja"; + case 258: + return "Pantaloni ninja"; + case 259: + return "Pelle"; + case 260: + return "Cappello rosso"; + case 261: + return "Pesce rosso"; + case 262: + return "Mantello"; + case 263: + return "Cappello da robot"; + case 264: + return "Corona d'oro"; + case 265: + return "Freccia di fuoco infernale"; + case 266: + return "Pistola di sabbia"; + case 267: + return "Bambola voodoo della guida"; + case 268: + return "Casco da sommozzatore"; + case 269: + return "Camicia comune"; + case 270: + return "Pantaloni comuni"; + case 271: + return "Parrucca comune"; + case 272: + return "Falce demoniaca"; + case 273: + return "Confine della notte"; + case 274: + return "Lancia oscura"; + case 275: + return "Corallo"; + case 276: + return "Cactus"; + case 277: + return "Tridente"; + case 278: + return "Proiettile d'argento"; + case 279: + return "Coltello da lancio"; + case 280: + return "Lancia"; + case 281: + return "Cerbottana"; + case 282: + return "Bastone luminoso"; + case 283: + return "Seme"; + case 284: + return "Boomerang di legno"; + case 285: + return "Aghetto"; + case 286: + return "Bastone luminoso appiccicoso"; + case 287: + return "Coltello avvelenato"; + case 288: + return "Pozione pelle d'ossidiana"; + case 289: + return "Pozione rigeneratrice"; + case 290: + return "Pozione della rapidità"; + case 291: + return "Pozione branchie"; + case 292: + return "Pozione pelle di ferro"; + case 293: + return "Pozione rigenerazione mana"; + case 294: + return "Pozione potenza magica"; + case 295: + return "Pozione caduta dolce"; + case 296: + return "Pozione speleologo"; + case 297: + return "Pozione invisibilità"; + case 298: + return "Pozione splendore"; + case 299: + return "Pozione civetta"; + case 300: + return "Pozione battaglia"; + case 301: + return "Pozione spine"; + case 302: + return "Pozione per camminare sull'acqua"; + case 303: + return "Pozione arciere"; + case 304: + return "Pozione cacciatore"; + case 305: + return "Pozione gravità"; + case 306: + return "Cassa d'oro"; + case 307: + return "Semi Fiordigiorno"; + case 308: + return "Semi Splendiluna"; + case 309: + return "Semi Lampeggiaradice"; + case 310: + return "Semi Erbamorte"; + case 311: + return "Semi Acquafoglia"; + case 312: + return "Semi Fiordifuoco"; + case 313: + return "Fiordigiorno"; + case 314: + return "Splendiluna"; + case 315: + return "Lampeggiaradice"; + case 316: + return "Erbamorte"; + case 317: + return "Acquafoglia"; + case 318: + return "Fiordifuoco"; + case 319: + return "Pinna di squalo"; + case 320: + return "Piuma"; + case 321: + return "Lapide"; + case 322: + return "Maschera sosia"; + case 323: + return "Mandibola di formicaleone"; + case 324: + return "Parti di pistola illegale"; + case 325: + return "Camicia da medico"; + case 326: + return "Pantaloni da medico"; + case 327: + return "Chiave d'oro"; + case 328: + return "Cassa ombra"; + case 329: + return "Chiave ombra"; + case 330: + return "Muro di ossidiana"; + case 331: + return "Spore della giungla"; + case 332: + return "Telaio"; + case 333: + return "Pianoforte"; + case 334: + return "Cassettone"; + case 335: + return "Panca"; + case 336: + return "Vasca da bagno"; + case 337: + return "Stendardo rosso"; + case 338: + return "Stendardo verde"; + case 339: + return "Stendardo blu"; + case 340: + return "Stendardo giallo"; + case 341: + return "Lampione"; + case 342: + return "Torcia tiki"; + case 343: + return "Barile"; + case 344: + return "Lanterna cinese"; + case 345: + return "Pentola"; + case 346: + return "Caveau"; + case 347: + return "Lanterna-teschio"; + case 348: + return "Bidone"; + case 349: + return "Candelabro"; + case 350: + return "Vaso rosa"; + case 351: + return "Boccale"; + case 352: + return "Barilotto"; + case 353: + return "Birra"; + case 354: + return "Scaffale"; + case 355: + return "Trono"; + case 356: + return "Ciotola"; + case 357: + return "Ciotola di zuppa"; + case 358: + return "Toilette"; + case 359: + return "Pendola"; + case 360: + return "Statua armatura"; + case 361: + return "Insegna di battaglia dei goblin"; + case 362: + return "Abito a brandelli"; + case 363: + return "Segheria"; + case 364: + return "Minerale cobalto"; + case 365: + return "Minerale mitrilio"; + case 366: + return "Minerale adamantio"; + case 367: + return "Martellone"; + case 368: + return "Excalibur"; + case 369: + return "Semi consacrati"; + case 370: + return "Blocco sabbia d'ebano"; + case 371: + return "Cappello di cobalto"; + case 372: + return "Casco di cobalto"; + case 373: + return "Maschera di cobalto"; + case 374: + return "Corrazza di cobalto"; + case 375: + return "Gambali di cobalto"; + case 376: + return "Cappuccio di mitrilio"; + case 377: + return "Casco di mitrilio"; + case 378: + return "Cappello di mitrilio"; + case 379: + return "Maglia metallica di mitrilio"; + case 380: + return "Schiniere di mitrilio"; + case 381: + return "Barra di cobalto"; + case 382: + return "Barra di mitrilio"; + case 383: + return "Motosega di cobalto"; + case 384: + return "Motosega di mitrilio"; + case 385: + return "Perforatrice di cobalto"; + case 386: + return "Perforatrice di mitrilio"; + case 387: + return "Motosega di adamantio"; + case 388: + return "Perforatrice di adamantio"; + case 389: + return "Frustona"; + case 390: + return "Alabarda di mitrilio"; + case 391: + return "Barra di adamantio"; + case 392: + return "Muro di vetro"; + case 393: + return "Bussola"; + case 394: + return "Muta da sub"; + case 395: + return "GPS"; + case 396: + return "Ferro di cavallo di ossidiana"; + case 397: + return "Scudo di ossidiana"; + case 398: + return "Laboratorio dell'inventore"; + case 399: + return "Nuvola in un palloncino"; + case 400: + return "Copricapo di adamantio"; + case 401: + return "Casco di adamantio"; + case 402: + return "Maschera di adamantio"; + case 403: + return "Corrazza di adamantio"; + case 404: + return "Gambali di adamantio"; + case 405: + return "Stivali da fantasma"; + case 406: + return "Alabarda di adamantio"; + case 407: + return "Cintura porta attrezzi"; + case 408: + return "Blocco sabbiaperla"; + case 409: + return "Blocco pietraperla"; + case 410: + return "Camicia da minatore"; + case 411: + return "Pantaloni da minatore"; + case 412: + return "Mattone pietraperla"; + case 413: + return "Mattone iridescente"; + case 414: + return "Mattone pietrafango"; + case 415: + return "Mattone cobalto"; + case 416: + return "Mattone mitrilio"; + case 417: + return "Muro di pietraperla"; + case 418: + return "Muro di mattoni iridescenti"; + case 419: + return "Muro di pietrafango"; + case 420: + return "Muro di mattoni di cobalto"; + case 421: + return "Muro di mattoni di mitrilio"; + case 422: + return "Acquasanta"; + case 423: + return "Acqua profana"; + case 424: + return "Blocco insabbiato"; + case 425: + return "Campana della fata"; + case 426: + return "Lama del distruttore"; + case 427: + return "Torcia blu"; + case 428: + return "Torcia rossa"; + case 429: + return "Torcia verde"; + case 430: + return "Torcia viola"; + case 431: + return "Torcia bianca"; + case 432: + return "Torcia gialla"; + case 433: + return "Torcia demoniaca"; + case 434: + return "Fucile d'assalto automatico"; + case 435: + return "Balestra automatica di cobalto"; + case 436: + return "Balestra automatica di mitrilio"; + case 437: + return "Gancio doppio"; + case 438: + return "Statua stella"; + case 439: + return "Statua spada"; + case 440: + return "Statua slime"; + case 441: + return "Statua goblin"; + case 442: + return "Statua scudo"; + case 443: + return "Statua pipistrello"; + case 444: + return "Statua pesce"; + case 445: + return "Statua coniglio"; + case 446: + return "Statua scheletro"; + case 447: + return "Statua mietitore"; + case 448: + return "Statua donna"; + case 449: + return "Statua diavoletto"; + case 450: + return "Statua gargoyle"; + case 451: + return "Statua tenebre"; + case 452: + return "Statua calabrone"; + case 453: + return "Statua bomba"; + case 454: + return "Statua granchio"; + case 455: + return "Statua martello"; + case 456: + return "Statua pozione"; + case 457: + return "Statua arpione"; + case 458: + return "Statua croce"; + case 459: + return "Statua medusa"; + case 460: + return "Statua arco"; + case 461: + return "Statua boomerang"; + case 462: + return "Statua stivali"; + case 463: + return "Statua cassa"; + case 464: + return "Statua Uccello"; + case 465: + return "Statua ascia"; + case 466: + return "Statua corruzione"; + case 467: + return "Statua albero"; + case 468: + return "Statua incudine"; + case 469: + return "Statua piccone"; + case 470: + return "Statua fungo"; + case 471: + return "Statua bulbo oculare"; + case 472: + return "Statua colonna"; + case 473: + return "Statua cuore"; + case 474: + return "Statua pentola"; + case 475: + return "Statua girasole"; + case 476: + return "Statua re"; + case 477: + return "Statua regina"; + case 478: + return "Statua piranha"; + case 479: + return "Muro impalcato"; + case 480: + return "Trave di legno"; + case 481: + return "Mietitore di adamantio"; + case 482: + return "Spada di adamantio"; + case 483: + return "Spada di cobalto"; + case 484: + return "Spada di mitrilio"; + case 485: + return "Amuleto della luna"; + case 486: + return "Righello"; + case 487: + return "Sfera di cristallo"; + case 488: + return "Palla disco"; + case 489: + return "Emblema dell'incantatore"; + case 490: + return "Emblema del guerriero"; + case 491: + return "Emblema del guardiaboschi"; + case 492: + return "Ali del demone"; + case 493: + return "Ali dell'angelo"; + case 494: + return "Arpa magica"; + case 495: + return "Bastone dell'arcobaleno"; + case 496: + return "Bastone di ghiaccio"; + case 497: + return "Conchiglia di Nettuno"; + case 498: + return "Manichino"; + case 499: + return "Pozione curativa superiore"; + case 500: + return "Pozione mana superiore"; + case 501: + return "Polvere di fata"; + case 502: + return "Frammento di cristallo"; + case 503: + return "Cappello da clown"; + case 504: + return "Camicia da clown"; + case 505: + return "Pantaloni da clown"; + case 506: + return "Lanciafiamme"; + case 507: + return "Campana"; + case 508: + return "Arpa"; + case 509: + return "Chiave inglese"; + case 510: + return "Tagliacavi"; + case 511: + return "Blocco di pietra attivo"; + case 512: + return "Blocco di pietra non attivo"; + case 513: + return "Leva"; + case 514: + return "Fucile laser"; + case 515: + return "Proiettile di cristallo"; + case 516: + return "Freccia sacra"; + case 517: + return "Pugnale magico"; + case 518: + return "Tempesta di cristallo"; + case 519: + return "Fiamme maledette"; + case 520: + return "Anima della luce"; + case 521: + return "Anima della notte"; + case 522: + return "Fiamma maledetta"; + case 523: + return "Torcia maledetta"; + case 524: + return "Forgia di adamantio"; + case 525: + return "Incudine di mitrilio"; + case 526: + return "Corno di unicorno"; + case 527: + return "Frammento oscuro"; + case 528: + return "Frammento di luce"; + case 529: + return "Piastra a pressione rossa"; + case 530: + return "Cavo"; + case 531: + return "Tomo incantato"; + case 532: + return "Mantello stellato"; + case 533: + return "Megashark"; + case 534: + return "Fucile"; + case 535: + return "Pietra filosofale"; + case 536: + return "Guanto del Titano"; + case 537: + return "Naginata di cobalto"; + case 538: + return "Interruttore"; + case 539: + return "Trappola dardi"; + case 540: + return "Masso"; + case 541: + return "Piastra a pressione verde"; + case 542: + return "Piastra a pressione grigia"; + case 543: + return "Piastra a pressione marrone"; + case 544: + return "Occhio meccanico"; + case 545: + return "Freccia maledetta"; + case 546: + return "Proiettile maledetto"; + case 547: + return "Anima del terrore"; + case 548: + return "Anima del potere"; + case 549: + return "Anima della visione"; + case 550: + return "Gungnir"; + case 551: + return "Armatura sacra"; + case 552: + return "Schiniere sacro"; + case 553: + return "Casco sacro"; + case 554: + return "Collana con croce"; + case 555: + return "Fiore di mana"; + case 556: + return "Verme meccanico"; + case 557: + return "Teschio meccanico"; + case 558: + return "Copricapo sacro"; + case 559: + return "Maschera sacra"; + case 560: + return "Corona slime"; + case 561: + return "Disco di luce"; + case 562: + return "Carillon (Giornata mondiale)"; + case 563: + return "Carillon (Mistero)"; + case 564: + return "Carillon (Notte)"; + case 565: + return "Carillon (Titolo)"; + case 566: + return "Carillon (Sotterraneo)"; + case 567: + return "Carillon (Boss 1)"; + case 568: + return "Carillon (Giungla)"; + case 569: + return "Carillon (Corruzione)"; + case 570: + return "Carillon (Corruzione sotterranea)"; + case 571: + return "Carillon (La Consacrazione)"; + case 572: + return "Carillon (Boss 2)"; + case 573: + return "Carillon (Consacrazione sotterranea)"; + case 574: + return "Carillon (Boss 3)"; + case 575: + return "Anima del volo"; + case 576: + return "Carillon"; + case 577: + return "Mattone demoniaco"; + case 578: + return "Balestra automatica consacrata"; + case 579: + return "Perforascia"; + case 580: + return "Esplosivi"; + case 581: + return "Pompa interna"; + case 582: + return "Pompa esterna"; + case 583: + return "Timer 1 secondo"; + case 584: + return "Timer 3 secondi"; + case 585: + return "Timer 5 secondi"; + case 586: + return "Blocco Candy Cane"; + case 587: + return "Muro Candy Cane"; + case 588: + return "Cappello di Babbo Natale"; + case 589: + return "Camicia di Babbo Natale"; + case 590: + return "Pantaloni di Babbo Natale"; + case 591: + return "Blocco verde Candy Cane"; + case 592: + return "Muro verde Candy Cane"; + case 593: + return "Blocco di neve"; + case 594: + return "Mattone di neve"; + case 595: + return "Muro di mattoni di neve"; + case 596: + return "Luce blu"; + case 597: + return "Luce rossa"; + case 598: + return "Luce verde"; + case 599: + return "Regalo blu"; + case 600: + return "Regalo verde"; + case 601: + return "Regalo giallo "; + case 602: + return "Sfera di neve"; + case 603: + return "Cavolo"; + case 604: + return "Maschera del Drago"; + case 605: + return "Casco del Titano"; + case 606: + return "Copricapo spettrale"; + case 607: + return "Corazza del Drago"; + case 608: + return "Armatura del Titano"; + case 609: + return "Armatura spettrale"; + case 610: + return "Schinieri del Drago"; + case 611: + return "Gambali del Titano"; + case 612: + return "Subligar spettrale"; + case 613: + return "Tizona"; + case 614: + return "Tonbogiri"; + case 615: + return "Sharanga"; + case 616: + return "Freccia spettrale"; + case 617: + return "Balestra vulcanica"; + case 618: + return "Dardo vulcanico"; + case 619: + return "Teschio dallo sguardo sospetto"; + case 620: + return "Anima della luce"; + case 621: + return "Capsula di Petri"; + case 622: + return "Nido d'ape"; + case 623: + return "Fiala di sangue"; + case 624: + return "Zanna di lupo"; + case 625: + return "Cervello"; + case 626: + return "Carillon (Deserto)"; + case 627: + return "Carillon (Spazio)"; + case 628: + return "Carillon (Tutorial)"; + case 629: + return "Carillon (Boss 4)"; + case 630: + return "Carillon (Oceano)"; + case 631: + return "Carillon (Neve)"; + } + } + else if (Lang.lang == 4) + { + switch (l) + { + case -24: + return "Sabre laser jaune"; + case -23: + return "Sabre laser blanc"; + case -22: + return "Sabre laser violet"; + case -21: + return "Sabre laser vert"; + case -20: + return "Sabre laser rouge"; + case -19: + return "Sabre laser bleu"; + case -18: + return "Arc en cuivre"; + case -17: + return "Marteau en cuivre"; + case -16: + return "Hache en cuivre"; + case -15: + return "Épée courte en cuivre"; + case -14: + return "Épée longue en cuivre"; + case -13: + return "Pioche en cuivre"; + case -12: + return "Arc en argent"; + case -11: + return "Marteau en argent"; + case -10: + return "Hache en argent"; + case -9: + return "Épée courte en argent"; + case -8: + return "Épée longue en argent"; + case -7: + return "Pioche en argent"; + case -6: + return "Arc en or"; + case -5: + return "Marteau en or"; + case -4: + return "Hache en or"; + case -3: + return "Épée courte en or"; + case -2: + return "Épée longue en or"; + case -1: + return "Pioche en or"; + case 1: + return "Pioche en fer"; + case 2: + return "Bloc de terre"; + case 3: + return "Bloc de pierre"; + case 4: + return "Épée longue en fer"; + case 5: + return "Champignon"; + case 6: + return "Épée courte en fer"; + case 7: + return "Marteau en fer"; + case 8: + return "Torche"; + case 9: + return "Bois"; + case 10: + return "Hache en fer"; + case 11: + return "Minerai de fer"; + case 12: + return "Minerai de cuivre"; + case 13: + return "Minerai d'or"; + case 14: + return "Minerai d'argent"; + case 15: + return "Montre en cuivre"; + case 16: + return "Montre en argent"; + case 17: + return "Montre en or"; + case 18: + return "Altimètre"; + case 19: + return "Lingot d'or"; + case 20: + return "Lingot de cuivre"; + case 21: + return "Lingot d'argent"; + case 22: + return "Lingot de fer"; + case 23: + return "Gel"; + case 24: + return "Épée en bois"; + case 25: + return "Porte en bois"; + case 26: + return "Mur en pierre"; + case 27: + return "Gland"; + case 28: + return "Faible potion de soin"; + case 29: + return "Cristal de vie"; + case 30: + return "Mur en terre"; + case 31: + return "Bouteille"; + case 32: + return "Table en bois"; + case 33: + return "Fournaise"; + case 34: + return "Chaise en bois"; + case 35: + return "Enclume"; + case 36: + return "Établi"; + case 37: + return "Lunettes"; + case 38: + return "Lentille"; + case 39: + return "Arc en bois"; + case 40: + return "Flèche en bois"; + case 41: + return "Flèche enflammée"; + case 42: + return "Shuriken"; + case 43: + return "Œil observateur suspicieux"; + case 44: + return "Arc démoniaque"; + case 45: + return "Hache de guerre de la nuit"; + case 46: + return "Fléau de lumière"; + case 47: + return "Flèche impie"; + case 48: + return "Coffre"; + case 49: + return "Anneau de régénération"; + case 50: + return "Miroir magique"; + case 51: + return "Flèche du bouffon"; + case 52: + return "Statue d'ange"; + case 53: + return "Nuage en bouteille"; + case 54: + return "Bottes d'Hermès"; + case 55: + return "Boomerang enchanté"; + case 56: + return "Barre de démonite"; + case 57: + return "Lingot de démonite"; + case 58: + return "Pilier"; + case 59: + return "Graines corrompues"; + case 60: + return "Champignon infect"; + case 61: + return "Bloc d'ébonite"; + case 62: + return "Graines d'herbe"; + case 63: + return "Tournesols"; + case 64: + return "Vileronce"; + case 65: + return "Furie stellaire"; + case 66: + return "Poudre de purification"; + case 67: + return "Poudre infecte"; + case 68: + return "Morceau pourri"; + case 69: + return "Dent de ver"; + case 70: + return "Nourriture pour ver"; + case 71: + return "Pièce de cuivre"; + case 72: + return "Pièce d'argent"; + case 73: + return "Pièce d'or"; + case 74: + return "Pièce de platine"; + case 75: + return "Étoile filante"; + case 76: + return "Jambières en cuivre"; + case 77: + return "Jambières en fer"; + case 78: + return "Jambières en argent"; + case 79: + return "Jambière en or"; + case 80: + return "Cotte de mailles en cuivre"; + case 81: + return "Cotte de mailles en fer"; + case 82: + return "Cotte de mailles en argent"; + case 83: + return "Cotte de mailles en or"; + case 84: + return "Grappin"; + case 85: + return "Chaîne en fer"; + case 86: + return "Écaille sombre"; + case 87: + return "Tirelire"; + case 88: + return "Casque de mineur"; + case 89: + return "Casque en cuivre"; + case 90: + return "Casque en fer"; + case 91: + return "Casque en argent"; + case 92: + return "Casque en or"; + case 93: + return "Mur en bois"; + case 94: + return "Plateforme en bois"; + case 95: + return "Pistolet à silex"; + case 96: + return "Mousquet"; + case 97: + return "Balle de mousquet"; + case 98: + return "Minishark"; + case 99: + return "Arc en fer"; + case 100: + return "Jambières de l'ombre"; + case 101: + return "Armure d'écailles de l'ombre"; + case 102: + return "Casque de l'ombre"; + case 103: + return "Pioche cauchemardesque"; + case 104: + return "Le briseur"; + case 105: + return "Bougie"; + case 106: + return "Chandelier en cuivre"; + case 107: + return "Chandelier en argent"; + case 108: + return "Chandelier en or"; + case 109: + return "Cristal de mana"; + case 110: + return "Faible potion de mana"; + case 111: + return "Anneau de pouvoir stellaire"; + case 112: + return "Fleur de feu"; + case 113: + return "Missile magique"; + case 114: + return "Bâtonnet de terre"; + case 115: + return "Orbe de lumière"; + case 116: + return "Météorite"; + case 117: + return "Barre de météorite"; + case 118: + return "Crochet"; + case 119: + return "Flamarang"; + case 120: + return "Furie en fusion"; + case 121: + return "Grande épée ardente"; + case 122: + return "Pioche en fusion"; + case 123: + return "Casque de météore"; + case 124: + return "Costume de météore"; + case 125: + return "Leggings de météores"; + case 126: + return "Eau en bouteille"; + case (int) sbyte.MaxValue: + return "Arme d'espace"; + case 128: + return "Bottes-fusées"; + case 129: + return "Brique grise"; + case 130: + return "Mur de briques grises"; + case 131: + return "Brique rouge"; + case 132: + return "Mur de briques rouges"; + case 133: + return "Bloc d'argile"; + case 134: + return "Brique bleue"; + case 135: + return "Mur de briques bleues"; + case 136: + return "Lanterne à chaîne"; + case 137: + return "Brique verte"; + case 138: + return "Mur de briques vertes"; + case 139: + return "Brique rose"; + case 140: + return "Mur de briques roses"; + case 141: + return "Brique dorée"; + case 142: + return "Mur de briques dorées"; + case 143: + return "Brique argentée"; + case 144: + return "Mur de briques argentées"; + case 145: + return "Brique cuivrée"; + case 146: + return "Mur de briques cuivrées"; + case 147: + return "Pointe"; + case 148: + return "Bougie d'eau"; + case 149: + return "Livre"; + case 150: + return "Toile d'araignée"; + case 151: + return "Casque nécro"; + case 152: + return "Plastron nécro"; + case 153: + return "Jambières nécro"; + case 154: + return "Os"; + case 155: + return "Muramasa"; + case 156: + return "Bouclier de cobalt"; + case 157: + return "Sceptre aquatique"; + case 158: + return "Fer à cheval porte-bonheur"; + case 159: + return "Ballon rouge brillant"; + case 160: + return "Harpon"; + case 161: + return "Balle hérissée"; + case 162: + return "Ball O' Hurt"; + case 163: + return "Lune bleue"; + case 164: + return "Pistolet"; + case 165: + return "Trait d'eau"; + case 166: + return "Bombe"; + case 167: + return "Dynamite"; + case 168: + return "Grenade"; + case 169: + return "Bloc de sable"; + case 170: + return "Verre"; + case 171: + return "Panneau"; + case 172: + return "Bloc de cendre"; + case 173: + return "Obsidienne"; + case 174: + return "Pierre de l'enfer"; + case 175: + return "Barre de pierre de l'enfer"; + case 176: + return "Bloc de boue"; + case 177: + return "Saphir"; + case 178: + return "Rubis"; + case 179: + return "Émeraude"; + case 180: + return "Topaze"; + case 181: + return "Améthyste"; + case 182: + return "Diamant"; + case 183: + return "Champignon lumineux"; + case 184: + return "Étoile"; + case 185: + return "Grappin à lianes"; + case 186: + return "Tuba"; + case 187: + return "Palmes"; + case 188: + return "Potion de soins"; + case 189: + return "Potion de mana"; + case 190: + return "Lame d'herbe"; + case 191: + return "Chakram d'épines"; + case 192: + return "Brique d'obsidienne"; + case 193: + return "Crâne d'obsidienne"; + case 194: + return "Graines de champignon"; + case 195: + return "Graines de la jungle"; + case 196: + return "Marteau en bois"; + case 197: + return "Canon à étoiles"; + case 198: + return "Sabre laser bleu"; + case 199: + return "Sabre laser rouge"; + case 200: + return "Sabre laser vert"; + case 201: + return "Sabre laser violet"; + case 202: + return "Sabre laser blanc"; + case 203: + return "Sabre laser jaune"; + case 204: + return "Martache en météorite"; + case 205: + return "Seau vide"; + case 206: + return "Seau d'eau"; + case 207: + return "Seau de lave"; + case 208: + return "Rose de la jungle"; + case 209: + return "Dard"; + case 210: + return "Vigne"; + case 211: + return "Griffes sauvages"; + case 212: + return "Bracelet du vent"; + case 213: + return "Crosse de repousse"; + case 214: + return "Brique de pierre de l'enfer"; + case 215: + return "Coussin péteur"; + case 216: + return "Manille"; + case 217: + return "Martache en fusion"; + case 218: + return "Mèche enflammée"; + case 219: + return "Blaster phénix"; + case 220: + return "Furie solaire"; + case 221: + return "Forge infernale"; + case 222: + return "Pot d'argile"; + case 223: + return "Don de la nature"; + case 224: + return "Lit"; + case 225: + return "Soie"; + case 226: + return "Faible potion de restauration"; + case 227: + return "Potion de restauration"; + case 228: + return "Casque de la jungle"; + case 229: + return "Plastron de la jungle"; + case 230: + return "Jambières de la jungle"; + case 231: + return "Casque en fusion"; + case 232: + return "Plastron en fusion"; + case 233: + return "Jambières en fusion"; + case 234: + return "Balle météore"; + case 235: + return "Bombe collante"; + case 236: + return "Lentille noire"; + case 237: + return "Lunettes de soleil"; + case 238: + return "Chapeau de magicien"; + case 239: + return "Haut de forme"; + case 240: + return "Veste de smoking"; + case 241: + return "Pantalon de smoking"; + case 242: + return "Chapeau d'été"; + case 243: + return "Capuche de lapin"; + case 244: + return "Casquette de plombier"; + case 245: + return "Veste de plombier"; + case 246: + return "Pantalon de plombier"; + case 247: + return "Capuche de héros"; + case 248: + return "Veste de héros"; + case 249: + return "Pantalon de héros"; + case 250: + return "Bocal à poissons"; + case 251: + return "Chapeau d'archéologue"; + case 252: + return "Veste d'archéologue"; + case 253: + return "Pantalon d'archéologue"; + case 254: + return "Teinture noire"; + case (int) byte.MaxValue: + return "Teinture mauve"; + case 256: + return "Cagoule de ninja"; + case 257: + return "Veste de ninja"; + case 258: + return "Pantalon de ninja"; + case 259: + return "Cuir"; + case 260: + return "Chapeau rouge"; + case 261: + return "Poisson rouge"; + case 262: + return "Robe"; + case 263: + return "Chapeau de robot"; + case 264: + return "Couronne d'or"; + case 265: + return "Flèche du feu de l'enfer"; + case 266: + return "Canon à sable"; + case 267: + return "Poupée vaudou du guide"; + case 268: + return "Casque de plongée"; + case 269: + return "Chemise familière"; + case 270: + return "Pantalon familier"; + case 271: + return "Perruque familière"; + case 272: + return "Faux de démon"; + case 273: + return "Fil des Ténèbres"; + case 274: + return "Lance sombre"; + case 275: + return "Corail"; + case 276: + return "Cactus"; + case 277: + return "Trident"; + case 278: + return "Balle d'argent"; + case 279: + return "Couteau de lancer"; + case 280: + return "Lance"; + case 281: + return "Sarbacane"; + case 282: + return "Bâton lumineux"; + case 283: + return "Graine"; + case 284: + return "Boomerang en bois"; + case 285: + return "Embout de lacet"; + case 286: + return "Bâton lumineux collant"; + case 287: + return "Couteau empoisonné"; + case 288: + return "Potion de peau d'obsidienne"; + case 289: + return "Potion de régénération"; + case 290: + return "Potion de rapidité"; + case 291: + return "Potion de branchies"; + case 292: + return "Potion de peau de fer"; + case 293: + return "Potion de régénération de mana"; + case 294: + return "Potion de pouvoir magique"; + case 295: + return "Potion de poids plume"; + case 296: + return "Potion de spéléologue"; + case 297: + return "Potion d'invisibilité"; + case 298: + return "Potion de brillance"; + case 299: + return "Potion de vision nocturne"; + case 300: + return "Potion de bataille"; + case 301: + return "Potion d'épines"; + case 302: + return "Potion de marche sur l'eau"; + case 303: + return "Potion de tir à l'arc"; + case 304: + return "Potion du chasseur"; + case 305: + return "Potion de gravité"; + case 306: + return "Coffre d'or"; + case 307: + return "Graines de floraison du jour"; + case 308: + return "Graines de lueur de lune"; + case 309: + return "Graines de racine clignotante"; + case 310: + return "Graines de mauvaise herbe morte"; + case 311: + return "Graines de feuilles de l'eau"; + case 312: + return "Graines de fleur de feu"; + case 313: + return "Floraison du jour"; + case 314: + return "Lueur de lune"; + case 315: + return "Racine clignotante"; + case 316: + return "Mauvaise herbe morte"; + case 317: + return "Feuille de l'eau"; + case 318: + return "Fleur de feu"; + case 319: + return "Aileron de requin"; + case 320: + return "Plume"; + case 321: + return "Pierre tombale"; + case 322: + return "Masque du mime"; + case 323: + return "Mandibule de fourmilion"; + case 324: + return "Pièces détachées"; + case 325: + return "Veste du docteur"; + case 326: + return "Pantalon du docteur"; + case 327: + return "Clé dorée"; + case 328: + return "Coffre sombre"; + case 329: + return "Clé sombre"; + case 330: + return "Mur de briques d'obsidienne"; + case 331: + return "Spores de la jungle"; + case 332: + return "Métier à tisser"; + case 333: + return "Piano"; + case 334: + return "Commode"; + case 335: + return "Banc"; + case 336: + return "Baignoire"; + case 337: + return "Bannière rouge"; + case 338: + return "Bannière verte"; + case 339: + return "Bannière bleue"; + case 340: + return "Bannière jaune"; + case 341: + return "Lampadaire"; + case 342: + return "Torche de tiki"; + case 343: + return "Baril"; + case 344: + return "Lanterne chinoise"; + case 345: + return "Marmite"; + case 346: + return "Coffre-fort"; + case 347: + return "Lanterne crâne"; + case 348: + return "Poubelle"; + case 349: + return "Candélabre"; + case 350: + return "Vase rose"; + case 351: + return "Chope"; + case 352: + return "Tonnelet"; + case 353: + return "Bière"; + case 354: + return "Bibliothèque"; + case 355: + return "Trône"; + case 356: + return "Bol"; + case 357: + return "Bol de soupe"; + case 358: + return "Toilettes"; + case 359: + return "Horloge de grand-père"; + case 360: + return "Statue d'armure"; + case 361: + return "Étendard de bataille gobelin"; + case 362: + return "Vêtements en lambeaux"; + case 363: + return "Scierie"; + case 364: + return "Minerai de cobalt"; + case 365: + return "Minerai de mythril"; + case 366: + return "Minerai d'adamantine"; + case 367: + return "Pwnhammer"; + case 368: + return "Excalibur"; + case 369: + return "Graines sacrées"; + case 370: + return "Bloc de sable d'ébène"; + case 371: + return "Chapeau de cobalt"; + case 372: + return "Casque de cobalt"; + case 373: + return "Masque de cobalt"; + case 374: + return "Plastron de cobalt"; + case 375: + return "Jambières de cobalt"; + case 376: + return "Capuche de mythril"; + case 377: + return "Casque de mythril"; + case 378: + return "Chapeau de mythril"; + case 379: + return "Cotte de mailles de mythril"; + case 380: + return "Jambières de mythril"; + case 381: + return "Barre de cobalt"; + case 382: + return "Barre de mythril"; + case 383: + return "Tronçonneuse de cobalt"; + case 384: + return "Tronçonneuse de mythril"; + case 385: + return "Perceuse de cobalt"; + case 386: + return "Perceuse de mythril"; + case 387: + return "Tronçonneuse d'adamantine"; + case 388: + return "Perceuse d'adamantine"; + case 389: + return "Dao de Pow"; + case 390: + return "Hallebarde de mythril"; + case 391: + return "Barre d'amantine"; + case 392: + return "Mur de verre"; + case 393: + return "Boussole"; + case 394: + return "Équipement de plongée"; + case 395: + return "GPS"; + case 396: + return "Fer à cheval d'obsidienne"; + case 397: + return "Bouclier d'obsidienne"; + case 398: + return "Atelier du bricoleur"; + case 399: + return "Nuage dans un ballon"; + case 400: + return "Coiffe d'adamantine"; + case 401: + return "Casque d'adamantine"; + case 402: + return "Masque d'adamantine"; + case 403: + return "Plastron d'adamantine"; + case 404: + return "Jambières en adamantine"; + case 405: + return "Bottes spectrales"; + case 406: + return "Glaive d'adamantine"; + case 407: + return "Ceinture à outils"; + case 408: + return "Bloc de sable de perle"; + case 409: + return "Bloc de pierre de perle"; + case 410: + return "Veste de mineur"; + case 411: + return "Pantalon de mineur"; + case 412: + return "Brique de pierre de perle"; + case 413: + return "Brique iridescente"; + case 414: + return "Brique de pierre de terre"; + case 415: + return "Brique de cobalt"; + case 416: + return "Brique de mythril"; + case 417: + return "Mur de briques de pierre de perle"; + case 418: + return "Mur de briques iridescentes"; + case 419: + return "Mur de briques de pierre de terre"; + case 420: + return "Mur de briques de cobalt"; + case 421: + return "Mur de briques de mythril"; + case 422: + return "Eau bénite"; + case 423: + return "Eau impie"; + case 424: + return "Bloc de limon"; + case 425: + return "Clochette de fée"; + case 426: + return "Lame du briseur"; + case 427: + return "Torche bleue"; + case 428: + return "Torche rouge"; + case 429: + return "Torche verte"; + case 430: + return "Torche violette"; + case 431: + return "Torche blanche"; + case 432: + return "Torche jaune"; + case 433: + return "Torche du démon"; + case 434: + return "Fusil d'assaut mécanique"; + case 435: + return "Arbalète en cobalt"; + case 436: + return "Arbalète en mythril"; + case 437: + return "Crochet Double"; + case 438: + return "Statue d'étoile"; + case 439: + return "Statue d'épée"; + case 440: + return "Statue de slime"; + case 441: + return "Statue de gobelin"; + case 442: + return "Statue de bouclier"; + case 443: + return "Statue de chauve-souris"; + case 444: + return "Statue de poisson"; + case 445: + return "Statue de lapin"; + case 446: + return "Statue de squelette"; + case 447: + return "Statue de faucheur"; + case 448: + return "Statue de femme"; + case 449: + return "Statue de diablotin"; + case 450: + return "Statue de gargouille"; + case 451: + return "Statue de morosité"; + case 452: + return "Statue de frelon"; + case 453: + return "Statue de bombe"; + case 454: + return "Statue de crabe"; + case 455: + return "Statue de marteau"; + case 456: + return "Statue de potion"; + case 457: + return "Statue de lance"; + case 458: + return "Statue de croix"; + case 459: + return "Statue de méduse"; + case 460: + return "Statue d'arc"; + case 461: + return "Statue de boomerang"; + case 462: + return "Statue de botte"; + case 463: + return "Statue de coffre"; + case 464: + return "Statue d'oiseau"; + case 465: + return "Statue de hache"; + case 466: + return "Statue corrompue"; + case 467: + return "Statue d'arbre"; + case 468: + return "Statue d'enclume"; + case 469: + return "Statue de pioche"; + case 470: + return "Statue de champignon"; + case 471: + return "Statue d'œil"; + case 472: + return "Statue de pilier"; + case 473: + return "Statue de cœur"; + case 474: + return "Statue de pot"; + case 475: + return "Statue de tournesol"; + case 476: + return "Statue de roi"; + case 477: + return "Statue de reine"; + case 478: + return "Statue de piranha"; + case 479: + return "Mur de planches"; + case 480: + return "Poutre de bois"; + case 481: + return "Arbalète d'adamantine"; + case 482: + return "Épée d'adamantine"; + case 483: + return "Épée de cobalt"; + case 484: + return "Épée de mythril"; + case 485: + return "Sortilège lunaire"; + case 486: + return "Règle"; + case 487: + return "Boule de cristal"; + case 488: + return "Boule à facettes"; + case 489: + return "Emblème sorcier"; + case 490: + return "Emblème guerrier"; + case 491: + return "Emblème ranger"; + case 492: + return "Ailes de démon"; + case 493: + return "Ailes d'ange"; + case 494: + return "Harpe magique"; + case 495: + return "Bâton d'arc-en-ciel"; + case 496: + return "Bâton de glace"; + case 497: + return "Coquillage de Neptune"; + case 498: + return "Mannequin"; + case 499: + return "Potion de soins supérieure"; + case 500: + return "Potion de mana supérieure"; + case 501: + return "Poudre de fée"; + case 502: + return "Éclat de cristal"; + case 503: + return "Chapeau de clown"; + case 504: + return "Veste de clown"; + case 505: + return "Pantalon de clown"; + case 506: + return "Lance-flammes"; + case 507: + return "Cloche"; + case 508: + return "Harpe"; + case 509: + return "Clé à molette"; + case 510: + return "Pince coupante"; + case 511: + return "Bloc de pierre actif"; + case 512: + return "Bloc de pierre inactif"; + case 513: + return "Levier"; + case 514: + return "Fusil laser"; + case 515: + return "Balle de cristal"; + case 516: + return "Flèche bénite"; + case 517: + return "Dague magique"; + case 518: + return "Tempête de cristal"; + case 519: + return "Flammes maudites"; + case 520: + return "Âme de lumière"; + case 521: + return "Âme de la nuit"; + case 522: + return "Flamme maudite"; + case 523: + return "Torche maudite"; + case 524: + return "Forge en adamantine"; + case 525: + return "Enclume en mythril"; + case 526: + return "Corne de licorne"; + case 527: + return "Éclat sombre"; + case 528: + return "Éclat de lumière"; + case 529: + return "Plaque de pression rouge"; + case 530: + return "Câble"; + case 531: + return "Livre de sorts"; + case 532: + return "Cape stellaire"; + case 533: + return "Mégashark"; + case 534: + return "Fusil à pompe"; + case 535: + return "Pierre du philosophe"; + case 536: + return "Gant du titan"; + case 537: + return "Naginata en cobalt"; + case 538: + return "Interrupteur"; + case 539: + return "Piège à fléchette"; + case 540: + return "Rocher"; + case 541: + return "Plaque de pression verte"; + case 542: + return "Plaque de pression grise"; + case 543: + return "Plaque de pression marron"; + case 544: + return "Œil mécanique"; + case 545: + return "Flèche maudite"; + case 546: + return "Balle maudite"; + case 547: + return "Âme d'effroi"; + case 548: + return "Âme de pouvoir"; + case 549: + return "Âme de vision"; + case 550: + return "Gungnir"; + case 551: + return "Armure de plaques sacrée"; + case 552: + return "Jambières sacrées"; + case 553: + return "Casque sacré"; + case 554: + return "Pendentif en croix"; + case 555: + return "Fleur de mana"; + case 556: + return "Ver mécanique"; + case 557: + return "Crâne mécanique"; + case 558: + return "Coiffe sacrée"; + case 559: + return "Masque sacré"; + case 560: + return "Couronne de slime"; + case 561: + return "Disque de lumière"; + case 562: + return "Boîte à musique (Jour du monde supérieur)"; + case 563: + return "Boîte à musique (Surnaturel)"; + case 564: + return "Boîte à musique (Nuit)"; + case 565: + return "Boîte à musique (Titre)"; + case 566: + return "Boîte à musique (Souterrain)"; + case 567: + return "Boîte à musique (Boss 1)"; + case 568: + return "Boîte à musique (Jungle)"; + case 569: + return "Boîte à musique(Corruption)"; + case 570: + return "Boîte à musique (Corruption du souterrain)"; + case 571: + return "Boîte à musique (La Sainteté)"; + case 572: + return "Boîte à musique (Boss 2)"; + case 573: + return "Boîte à musique (Sainteté du souterrain)"; + case 574: + return "Boîte à musique (Boss 3)"; + case 575: + return "Âme du vol"; + case 576: + return "Boîte à musique"; + case 577: + return "Brique de démonite"; + case 578: + return "Arbalète bénie"; + case 579: + return "Martache-perce"; + case 580: + return "Explosifs"; + case 581: + return "Poste de pompage"; + case 582: + return "Sortie de pompage"; + case 583: + return "Minuteur d'une seconde"; + case 584: + return "Minuteur de 3 secondes"; + case 585: + return "Minuteur de 5 secondes"; + case 586: + return "Bloc de sucrerie"; + case 587: + return "Mur de sucrerie"; + case 588: + return "Bonnet de père Noël"; + case 589: + return "Veste de père Noël"; + case 590: + return "Pantalon de père Noël"; + case 591: + return "Bloc de sucrerie vert"; + case 592: + return "Mur de sucrerie vert "; + case 593: + return "bloc de neige"; + case 594: + return "brique de neige"; + case 595: + return "Mur de briques de neige"; + case 596: + return "Lumière bleue"; + case 597: + return "Lumière rouge"; + case 598: + return "Lumière verte"; + case 599: + return "Cadeau bleu"; + case 600: + return "Cadeau vert"; + case 601: + return "Cadeau jaune"; + case 602: + return "Globe de neige"; + case 603: + return "Chou"; + case 604: + return "Masque de dragon"; + case 605: + return "Casque de titan"; + case 606: + return "Coiffe spectrale"; + case 607: + return "Plastron de dragon"; + case 608: + return "Cotte de mailles de titan"; + case 609: + return "Armure spectrale"; + case 610: + return "Jambières de dragon"; + case 611: + return "Jambières de titan"; + case 612: + return "Subligar spectral"; + case 613: + return "Tizona"; + case 614: + return "Tonbogiri"; + case 615: + return "Sharanga"; + case 616: + return "Flèche spectrale"; + case 617: + return "Arbalète de Vulcain"; + case 618: + return "Éclair de Vulcain"; + case 619: + return "Crâne à l'air douteux"; + case 620: + return "Âme du fléau"; + case 621: + return "Boîte de Petri"; + case 622: + return "Nid d'abeille"; + case 623: + return "Fiole de sang"; + case 624: + return "Croc de loup"; + case 625: + return "Cervelle"; + case 626: + return "Boîte à musique (Désert)"; + case 627: + return "Boîte à musique (Espace)"; + case 628: + return "Boîte à musique (Tutoriel)"; + case 629: + return "Boîte à musique (Boss 4)"; + case 630: + return "Boîte à musique (Océan)"; + case 631: + return "Boîte à musique (Neige)"; + } + } + else if (Lang.lang == 5) + { + switch (l) + { + case -24: + return "Sable de luz amarillo"; + case -23: + return "Sable de luz blanco"; + case -22: + return "Sable de luz morado"; + case -21: + return "Sable de luz verde"; + case -20: + return "Sable de luz rojo"; + case -19: + return "Sable de luz azul"; + case -18: + return "Arco de cobre"; + case -17: + return "Martillo de cobre"; + case -16: + return "Hacha de cobre"; + case -15: + return "Espada corta de cobre"; + case -14: + return "Espada larga de cobre"; + case -13: + return "Pico de cobre"; + case -12: + return "Arco de plata"; + case -11: + return "Martillo de plata"; + case -10: + return "Hacha de plata"; + case -9: + return "Espada corta de plata"; + case -8: + return "Espada larga de plata"; + case -7: + return "Pico de plata"; + case -6: + return "Arco de oro"; + case -5: + return "Martillo de oro"; + case -4: + return "Hacha de oro"; + case -3: + return "Espada corta de oro"; + case -2: + return "Espada larga de oro"; + case -1: + return "Pico de oro"; + case 1: + return "Pico de hierro"; + case 2: + return "Bloque de tierra"; + case 3: + return "Bloque de piedra"; + case 4: + return "Espada larga de hierro"; + case 5: + return "Champiñón"; + case 6: + return "Espada corta de hierro"; + case 7: + return "Martillo de hierro"; + case 8: + return "Antorcha"; + case 9: + return "Madera"; + case 10: + return "Hacha de hierro"; + case 11: + return "Mineral de hierro"; + case 12: + return "Mineral de cobre"; + case 13: + return "Mineral de oro"; + case 14: + return "Mineral de plata"; + case 15: + return "Reloj de cobre"; + case 16: + return "Reloj de plata"; + case 17: + return "Reloj de oro"; + case 18: + return "Medidor de profundidad"; + case 19: + return "Lingote de oro"; + case 20: + return "Lingote de cobre"; + case 21: + return "Lingote de plata"; + case 22: + return "Lingote de hierro"; + case 23: + return "Gel"; + case 24: + return "Espada de madera"; + case 25: + return "Puerta de madera"; + case 26: + return "Pared de piedra"; + case 27: + return "Bellota"; + case 28: + return "Poción curativa menor"; + case 29: + return "Cristal de vida"; + case 30: + return "Pared de tierra"; + case 31: + return "Botella"; + case 32: + return "Mesa de madera"; + case 33: + return "Forja"; + case 34: + return "Silla de madera"; + case 35: + return "Yunque de hierro"; + case 36: + return "Banco de trabajo"; + case 37: + return "Gafas de protección"; + case 38: + return "Lentes"; + case 39: + return "Arco de madera"; + case 40: + return "Flecha de madera"; + case 41: + return "Flecha ardiente"; + case 42: + return "Estrellas ninja"; + case 43: + return "Ojo de aspecto sospechoso"; + case 44: + return "Arco demoníaco"; + case 45: + return "Hacha de la noche"; + case 46: + return "Azote de la luz"; + case 47: + return "Flecha infame"; + case 48: + return "Cofre"; + case 49: + return "Banda de regeneración"; + case 50: + return "Espejo mágico"; + case 51: + return "Flecha de bufón"; + case 52: + return "Estatua de ángel"; + case 53: + return "Nube en botella"; + case 54: + return "Botas de Hermes"; + case 55: + return "Bumerán encantado"; + case 56: + return "Mineral endemoniado"; + case 57: + return "Lingote endemoniado"; + case 58: + return "Corazón"; + case 59: + return "Semillas corrompidas"; + case 60: + return "Champiñón vil"; + case 61: + return "Bloque de piedra de ébano"; + case 62: + return "Semillas de césped"; + case 63: + return "Girasol"; + case 64: + return "Lanzador de espina vil"; + case 65: + return "Furia de estrellas"; + case 66: + return "Polvo de purificación"; + case 67: + return "Polvo vil"; + case 68: + return "Trozo podrido"; + case 69: + return "Diente de gusano"; + case 70: + return "Cebo de gusanos"; + case 71: + return "Moneda de cobre"; + case 72: + return "Moneda de plata"; + case 73: + return "Moneda de oro"; + case 74: + return "Moneda de platino"; + case 75: + return "Estrella fugaz"; + case 76: + return "Grebas de cobre"; + case 77: + return "Grebas de hierro"; + case 78: + return "Grebas de plata"; + case 79: + return "Grebas de oro"; + case 80: + return "Cota de malla de cobre"; + case 81: + return "Cota de malla de hierro"; + case 82: + return "Cota de malla de plata"; + case 83: + return "Cota de malla de oro"; + case 84: + return "Garfio de escalada"; + case 85: + return "Cadena de hierro"; + case 86: + return "Escama de las sombras"; + case 87: + return "Hucha"; + case 88: + return "Casco de minero"; + case 89: + return "Casco de cobre"; + case 90: + return "Casco de hierro"; + case 91: + return "Casco de plata"; + case 92: + return "Casco de oro"; + case 93: + return "Pared de madera"; + case 94: + return "Plataforma de madera"; + case 95: + return "Pistola de pedernal"; + case 96: + return "Mosquete"; + case 97: + return "Bala de mosquete"; + case 98: + return "Minitiburón"; + case 99: + return "Arco de hierro"; + case 100: + return "Grebas de las sombras"; + case 101: + return "Cota de escamas de las sombras"; + case 102: + return "Casco de las sombras"; + case 103: + return "Pico de pesadilla"; + case 104: + return "La Despedazadora"; + case 105: + return "Vela"; + case 106: + return "Lámpara araña de cobre"; + case 107: + return "Lámpara araña de plata"; + case 108: + return "Lámpara araña de oro"; + case 109: + return "Cristal de maná"; + case 110: + return "Poción de maná menor"; + case 111: + return "Banda de polvo de estrellas"; + case 112: + return "Flor de fuego"; + case 113: + return "Proyectil mágico"; + case 114: + return "Varita de tierra"; + case 115: + return "Orbe de luz"; + case 116: + return "Meteorito"; + case 117: + return "Lingote de meteorito"; + case 118: + return "Gancho"; + case 119: + return "Bumerán de llamas"; + case 120: + return "Furia fundida"; + case 121: + return "Espadón ardiente"; + case 122: + return "Pico fundido"; + case 123: + return "Casco de meteorito"; + case 124: + return "Cota de meteorito"; + case 125: + return "Perneras de meteorito"; + case 126: + return "Agua embotellada"; + case (int) sbyte.MaxValue: + return "Pistola espacial"; + case 128: + return "Botas cohete"; + case 129: + return "Ladrillo gris"; + case 130: + return "Pared de ladrillo gris"; + case 131: + return "Ladrillo rojo"; + case 132: + return "Pared de ladrillo rojo"; + case 133: + return "Bloque de arcilla"; + case 134: + return "Ladrillo azul"; + case 135: + return "Pared de ladrillo azul"; + case 136: + return "Farolillo"; + case 137: + return "Ladrillo verde"; + case 138: + return "Pared de ladrillo verde"; + case 139: + return "Ladrillo rosa"; + case 140: + return "Pared de ladrillo rosa"; + case 141: + return "Ladrillo dorado"; + case 142: + return "Pared de ladrillo dorado"; + case 143: + return "Ladrillo plateado"; + case 144: + return "Pared de ladrillo plateado"; + case 145: + return "Ladrillo cobrizo"; + case 146: + return "Pared de ladrillo cobrizo"; + case 147: + return "Púa"; + case 148: + return "Vela de agua"; + case 149: + return "Libro"; + case 150: + return "Telaraña"; + case 151: + return "Casco de los muertos"; + case 152: + return "Peto de los muertos"; + case 153: + return "Grebas de los muertos"; + case 154: + return "Hueso"; + case 155: + return "Muramasa"; + case 156: + return "Escudo de cobalto"; + case 157: + return "Cetro de agua"; + case 158: + return "Herradura de la suerte"; + case 159: + return "Globo rojo brillante"; + case 160: + return "Arpón"; + case 161: + return "Bola con pinchos"; + case 162: + return "Flagelo con bola"; + case 163: + return "Luna azul"; + case 164: + return "Pistola"; + case 165: + return "Proyectil de agua"; + case 166: + return "Bomba"; + case 167: + return "Dinamita"; + case 168: + return "Granada"; + case 169: + return "Bloque de arena"; + case 170: + return "Cristal"; + case 171: + return "Cartel"; + case 172: + return "Bloque de ceniza"; + case 173: + return "Obsidiana"; + case 174: + return "Piedra infernal"; + case 175: + return "Lingote de piedra infernal"; + case 176: + return "Bloque de lodo"; + case 177: + return "Zafiro"; + case 178: + return "Rubí"; + case 179: + return "Esmeralda"; + case 180: + return "Topacio"; + case 181: + return "Amatista"; + case 182: + return "Diamante"; + case 183: + return "Champiñón brillante"; + case 184: + return "Estrella"; + case 185: + return "Látigo de hiedra"; + case 186: + return "Caña para respirar"; + case 187: + return "Aletas"; + case 188: + return "Poción curativa"; + case 189: + return "Poción de maná"; + case 190: + return "Espada de hierba"; + case 191: + return "Chakram de espinas"; + case 192: + return "Ladrillo de obsidiana"; + case 193: + return "Calavera obsidiana"; + case 194: + return "Semillas de césped-champiñón"; + case 195: + return "Semillas de césped selvático"; + case 196: + return "Martillo de madera"; + case 197: + return "Cañón de estrellas"; + case 198: + return "Espada de luz azul"; + case 199: + return "Espada de luz roja"; + case 200: + return "Espada de luz verde"; + case 201: + return "Espada de luz morada"; + case 202: + return "Espada de luz blanca"; + case 203: + return "Espada de luz amarilla"; + case 204: + return "Hacha-martillo de meteorito"; + case 205: + return "Cubo vacío"; + case 206: + return "Cubo de agua"; + case 207: + return "Cubo de lava"; + case 208: + return "Rosa de la selva"; + case 209: + return "Aguijón"; + case 210: + return "Enredadera"; + case 211: + return "Garras de bestia"; + case 212: + return "Tobillera de viento"; + case 213: + return "Báculo de regeneración"; + case 214: + return "Ladrillo de piedra infernal"; + case 215: + return "Cojín flatulento"; + case 216: + return "Argolla"; + case 217: + return "Hacha-martillo fundido"; + case 218: + return "Látigo de llamas"; + case 219: + return "Desintegrador Fénix"; + case 220: + return "Furia solar"; + case 221: + return "Forja infernal"; + case 222: + return "Recipiente de barro"; + case 223: + return "Don de la naturaleza"; + case 224: + return "Cama"; + case 225: + return "Seda"; + case 226: + return "Poción de recuperación menor"; + case 227: + return "Poción de recuperación"; + case 228: + return "Casco para la selva"; + case 229: + return "Camisa para la selva"; + case 230: + return "Pantalones para la selva"; + case 231: + return "Casco fundido"; + case 232: + return "Peto fundido"; + case 233: + return "Grebas fundidas"; + case 234: + return "Proyectil de meteorito"; + case 235: + return "Bomba lapa"; + case 236: + return "Lentes negras"; + case 237: + return "Gafas de sol"; + case 238: + return "Sombrero de mago"; + case 239: + return "Sombrero de copa"; + case 240: + return "Camisa de esmoquin"; + case 241: + return "Pantalones de esmoquin"; + case 242: + return "Sombrero veraniego"; + case 243: + return "Máscara de conejito"; + case 244: + return "Gorra de fontanero"; + case 245: + return "Camisa de fontanero"; + case 246: + return "Pantalones de fontanero"; + case 247: + return "Gorro de héroe"; + case 248: + return "Camisa de héroe"; + case 249: + return "Pantalones de héroe"; + case 250: + return "Pecera"; + case 251: + return "Sombrero de arqueólogo"; + case 252: + return "Chaqueta de arqueólogo"; + case 253: + return "Pantalones de arqueólogo"; + case 254: + return "Tinte negro"; + case (int) byte.MaxValue: + return "Tinte violeta"; + case 256: + return "Gorro de ninja"; + case 257: + return "Camisa de ninja"; + case 258: + return "Pantalones de ninja"; + case 259: + return "Cuero"; + case 260: + return "Sombrero rojo"; + case 261: + return "Pececillo"; + case 262: + return "Vestido"; + case 263: + return "Sombrero de robot"; + case 264: + return "Corona de oro"; + case 265: + return "Flecha de fuego infernal"; + case 266: + return "Pistola de arena"; + case 267: + return "Muñeco vudú del guía"; + case 268: + return "Casco de buceo"; + case 269: + return "Camisa informal"; + case 270: + return "Pantalones informales"; + case 271: + return "Peluca informal"; + case 272: + return "Guadaña demoníaca"; + case 273: + return "Espada de la noche"; + case 274: + return "Lanza de la oscuridad"; + case 275: + return "Coral"; + case 276: + return "Cactus"; + case 277: + return "Tridente"; + case 278: + return "Bala de plata"; + case 279: + return "Cuchillo arrojadizo"; + case 280: + return "Lanza"; + case 281: + return "Cerbatana"; + case 282: + return "Varita luminosa"; + case 283: + return "Semilla"; + case 284: + return "Bumerán de madera"; + case 285: + return "Herrete"; + case 286: + return "Varita luminosa adhesiva"; + case 287: + return "Cuchillo envenenado"; + case 288: + return "Poción de piel obsidiana"; + case 289: + return "Poción de regeneración"; + case 290: + return "Poción de rapidez"; + case 291: + return "Poción de agallas"; + case 292: + return "Poción de piel de hierro"; + case 293: + return "Poción de regeneración de maná"; + case 294: + return "Poción de poder mágico"; + case 295: + return "Poción de caída de pluma"; + case 296: + return "Poción de espeleólogo"; + case 297: + return "Poción de invisibilidad"; + case 298: + return "Poción de brillo"; + case 299: + return "Poción de noctámbulo"; + case 300: + return "Poción de batalla"; + case 301: + return "Poción de espinas"; + case 302: + return "Poción de flotación"; + case 303: + return "Poción de tiro con arco"; + case 304: + return "Poción de cazador"; + case 305: + return "Poción de gravedad"; + case 306: + return "Cofre de oro"; + case 307: + return "Semillas de resplandor diurno"; + case 308: + return "Semillas de luz de luna"; + case 309: + return "Semillas de raíz intermitente"; + case 310: + return "Semillas de malahierba"; + case 311: + return "Semillas de hoja de agua"; + case 312: + return "Semillas de resplandor de fuego"; + case 313: + return "Resplandor diurno"; + case 314: + return "Luz de luna"; + case 315: + return "Raíz intermitente"; + case 316: + return "Malahierba"; + case 317: + return "Hoja de agua"; + case 318: + return "Resplandor de fuego"; + case 319: + return "Aleta de tiburón"; + case 320: + return "Pluma"; + case 321: + return "Lápida"; + case 322: + return "Máscara de mimo"; + case 323: + return "Mandíbula de hormiga león"; + case 324: + return "Piezas de arma ilegales"; + case 325: + return "Camisa del doctor"; + case 326: + return "Pantalones del doctor"; + case 327: + return "Llave dorada"; + case 328: + return "Cofre de las sombras"; + case 329: + return "Llave de las sombras"; + case 330: + return "Pared de ladrillo de obsidiana"; + case 331: + return "Esporas de la selva"; + case 332: + return "Telar"; + case 333: + return "Piano"; + case 334: + return "Aparador"; + case 335: + return "Banco"; + case 336: + return "Bañera"; + case 337: + return "Estandarte rojo"; + case 338: + return "Estandarte verde"; + case 339: + return "Estandarte azul"; + case 340: + return "Estandarte amarillo"; + case 341: + return "Farola"; + case 342: + return "Antorcha tiki"; + case 343: + return "Barril"; + case 344: + return "Farolillo de papel"; + case 345: + return "Perol"; + case 346: + return "Caja fuerte"; + case 347: + return "Cráneo con vela"; + case 348: + return "Cubo de basura"; + case 349: + return "Candelabro"; + case 350: + return "Recipiente rosa"; + case 351: + return "Taza"; + case 352: + return "Barrica"; + case 353: + return "Cerveza"; + case 354: + return "Librería"; + case 355: + return "Trono"; + case 356: + return "Cuenco"; + case 357: + return "Cuenco de sopa"; + case 358: + return "Retrete"; + case 359: + return "Reloj de pie"; + case 360: + return "Estatua de armadura"; + case 361: + return "Estandarte de batalla duende"; + case 362: + return "Harapos"; + case 363: + return "Serrería"; + case 364: + return "Mineral de cobalto"; + case 365: + return "Mineral de mithril"; + case 366: + return "Mineral de adamantita"; + case 367: + return "Gran martillo"; + case 368: + return "Excalibur"; + case 369: + return "Semillas sagradas"; + case 370: + return "Bloque de arena de ébano"; + case 371: + return "Gorro de cobalto"; + case 372: + return "Casco de cobalto"; + case 373: + return "Máscara de cobalto"; + case 374: + return "Peto de cobalto"; + case 375: + return "Perneras de cobalto"; + case 376: + return "Caperuza de mithril"; + case 377: + return "Casco de mithril"; + case 378: + return "Gorro de mithril"; + case 379: + return "Cota de malla de mithril"; + case 380: + return "Grebas de mithril"; + case 381: + return "Lingote de cobalto"; + case 382: + return "Lingote de mithril"; + case 383: + return "Motosierra de cobalto"; + case 384: + return "Motosierra de mithril"; + case 385: + return "Taladro de cobalto"; + case 386: + return "Taladro de mithril"; + case 387: + return "Motosierra de adamantita"; + case 388: + return "Taladro de adamantita"; + case 389: + return "Flagelo Taoísta"; + case 390: + return "Alabarda de mithril"; + case 391: + return "Lingote de adamantita"; + case 392: + return "Pared de cristal"; + case 393: + return "Brújula"; + case 394: + return "Equipo de buceo"; + case 395: + return "GPS"; + case 396: + return "Herradura de obsidiana"; + case 397: + return "Escudo de obsidiana"; + case 398: + return "Taller de chapuzas"; + case 399: + return "Nube en globo"; + case 400: + return "Tocado de adamantita"; + case 401: + return "Casco de adamantita"; + case 402: + return "Máscara de adamantita"; + case 403: + return "Peto de adamantita"; + case 404: + return "Polainas de adamantita"; + case 405: + return "Botas de espectro"; + case 406: + return "Guja de adamantita"; + case 407: + return "Cinturón de herramientas"; + case 408: + return "Bloque de arena perlada"; + case 409: + return "Bloque de piedra perlada"; + case 410: + return "Camisa de minero"; + case 411: + return "Pantalones de minero"; + case 412: + return "Ladrillo de piedra perlada"; + case 413: + return "Ladrillo tornasol"; + case 414: + return "Ladrillo de lutita"; + case 415: + return "Ladrillo de cobalto"; + case 416: + return "Ladrillo de mithril"; + case 417: + return "Pared de ladrillo de piedra perlada"; + case 418: + return "Pared de ladrillo tornasol"; + case 419: + return "Pared de ladrillo de lutita"; + case 420: + return "Pared de ladrillo de cobalto"; + case 421: + return "Pared de ladrillo de mithril"; + case 422: + return "Agua sagrada"; + case 423: + return "Agua impura"; + case 424: + return "Bloque de limo"; + case 425: + return "Campana de hada"; + case 426: + return "Espada despedazadora"; + case 427: + return "Antorcha azul"; + case 428: + return "Antorcha roja"; + case 429: + return "Antorcha verde"; + case 430: + return "Antorcha morada"; + case 431: + return "Antorcha blanca"; + case 432: + return "Antorcha amarilla"; + case 433: + return "Antorcha demoníaca"; + case 434: + return "Fusil de asalto de precisión"; + case 435: + return "Repetidor de cobalto"; + case 436: + return "Repetidor de mithril"; + case 437: + return "Gancho doble"; + case 438: + return "Estatua de estrella"; + case 439: + return "Estatua de espada"; + case 440: + return "Estatua de slime"; + case 441: + return "Estatua de duende"; + case 442: + return "Estatua de escudo"; + case 443: + return "Estatua de murciélago"; + case 444: + return "Estatua de pez"; + case 445: + return "Estatua de conejito"; + case 446: + return "Estatua de esqueleto"; + case 447: + return "Estatua de la Muerte"; + case 448: + return "Estatua de mujer"; + case 449: + return "Estatua de diablillo"; + case 450: + return "Estatua de gárgola"; + case 451: + return "Estatua melancólica"; + case 452: + return "Estatua de avispón"; + case 453: + return "Estatua de bomba"; + case 454: + return "Estatua de cangrejo"; + case 455: + return "Estatua de martilla"; + case 456: + return "Estatua de poción"; + case 457: + return "Estatua de lanza"; + case 458: + return "Estatua de cruz"; + case 459: + return "Estatua de medusa"; + case 460: + return "Estatua de arco"; + case 461: + return "Estatua de bumerán"; + case 462: + return "Estatua de bota"; + case 463: + return "Estatua de cofre"; + case 464: + return "Estatua de pájaro"; + case 465: + return "Estatua de hacha"; + case 466: + return "Estatua de corrupción"; + case 467: + return "Estatua de árbol"; + case 468: + return "Estatua de yunque"; + case 469: + return "Estatua de pico"; + case 470: + return "Estatua de champiñón"; + case 471: + return "Estatua de ojo"; + case 472: + return "Estatua de columna"; + case 473: + return "Estatua de corazón"; + case 474: + return "Estatua de marmita"; + case 475: + return "Estatua de girasol"; + case 476: + return "Estatua de rey"; + case 477: + return "Estatua de reina"; + case 478: + return "Estatua de piraña"; + case 479: + return "Pared de tablones"; + case 480: + return "Viga de madera"; + case 481: + return "Repetidor de adamantita"; + case 482: + return "Espada de adamantita"; + case 483: + return "Espada de cobalto"; + case 484: + return "Espada de mithril"; + case 485: + return "Hechizo de luna"; + case 486: + return "Regla"; + case 487: + return "Bola de cristal"; + case 488: + return "Bola de discoteca"; + case 489: + return "Emblema de hechicero"; + case 490: + return "Emblema de guerrero"; + case 491: + return "Emblema de guardián"; + case 492: + return "Alas demoníacas"; + case 493: + return "Alas de ángel"; + case 494: + return "Arpa mágica"; + case 495: + return "Varita multicolor"; + case 496: + return "Varita helada"; + case 497: + return "Concha de Neptuno"; + case 498: + return "Maniquí"; + case 499: + return "Poción curativa mayor"; + case 500: + return "Poción de maná mayor"; + case 501: + return "Polvo de hada"; + case 502: + return "Fragmento de cristal"; + case 503: + return "Sombrero de payaso"; + case 504: + return "Camisa de payaso"; + case 505: + return "Pantalones de payaso"; + case 506: + return "Lanzallamas"; + case 507: + return "Campana"; + case 508: + return "Arpa"; + case 509: + return "Llave inglesa"; + case 510: + return "Alicates"; + case 511: + return "Bloque de piedra activo"; + case 512: + return "Bloque de piedra inactivo"; + case 513: + return "Palanca"; + case 514: + return "Fusil láser"; + case 515: + return "Bala de cristal"; + case 516: + return "Flecha sagrada"; + case 517: + return "Daga mágica"; + case 518: + return "Tormenta de cristal"; + case 519: + return "Llamas malditas"; + case 520: + return "Alma de luz"; + case 521: + return "Alma de noche"; + case 522: + return "Llama maldita"; + case 523: + return "Antorcha maldita"; + case 524: + return "Forja de adamantita"; + case 525: + return "Yunque de mithril"; + case 526: + return "Cuerno de unicornio"; + case 527: + return "Fragmento de oscuridad"; + case 528: + return "Fragmento de luz"; + case 529: + return "Placa de presión roja"; + case 530: + return "Alambre"; + case 531: + return "Tomo encantado"; + case 532: + return "Manto de estrellas"; + case 533: + return "Megatiburón"; + case 534: + return "Escopeta"; + case 535: + return "Piedra filosofal"; + case 536: + return "Guante de titán"; + case 537: + return "Naginata de cobalto"; + case 538: + return "Interruptor"; + case 539: + return "Trampa de dardos"; + case 540: + return "Roca"; + case 541: + return "Placa de presión verde"; + case 542: + return "Placa de presión gris"; + case 543: + return "Placa de presión marrón"; + case 544: + return "Ojo mecánico"; + case 545: + return "Flecha maldita"; + case 546: + return "Bala maldita"; + case 547: + return "Alma de terror"; + case 548: + return "Alma de poder"; + case 549: + return "Alma de visión"; + case 550: + return "Gungnir"; + case 551: + return "Cota de placas sagrada"; + case 552: + return "Grebas sagradas"; + case 553: + return "Casco sagrado"; + case 554: + return "Collar con cruz"; + case 555: + return "Flor de maná"; + case 556: + return "Gusano mecánico"; + case 557: + return "Cráneo mecánico"; + case 558: + return "Tocado sagrado"; + case 559: + return "Máscara sagrada"; + case 560: + return "Corona de slime"; + case 561: + return "Disco de luz"; + case 562: + return "Caja de música (Superficie de día)"; + case 563: + return "Caja de música (Sobrecogedor)"; + case 564: + return "Caja de música (Noche)"; + case 565: + return "Caja de música (Título)"; + case 566: + return "Caja de música (Subsuelo)"; + case 567: + return "Caja de música (Jefe 1)"; + case 568: + return "Caja de música (Selva)"; + case 569: + return "Caja de música (Corrupción)"; + case 570: + return "Caja de música (Corrupción en el subsuelo)"; + case 571: + return "Caja de música (Terreno sagrado)"; + case 572: + return "Caja de música (Jefe 2)"; + case 573: + return "Caja de música (Subsuelo sagrado)"; + case 574: + return "Caja de música (Jefe 3)"; + case 575: + return "Alma de vuelo"; + case 576: + return "Caja de música"; + case 577: + return "Ladrillo endemoniado"; + case 578: + return "Repetidor sagrado"; + case 579: + return "Martitaladrahacha"; + case 580: + return "Explosivos"; + case 581: + return "Colector de entrada"; + case 582: + return "Colector de salida"; + case 583: + return "Temporizador de 1 segundo"; + case 584: + return "Temporizador de 3 segundos"; + case 585: + return "Temporizador de 5 segundos"; + case 586: + return "Bloque de caramelo"; + case 587: + return "Pared de caramelo"; + case 588: + return "Gorro de Papá Noel"; + case 589: + return "Camisa de Papá Noel"; + case 590: + return "Pantalones Papá Noel"; + case 591: + return "Bloque de caramelo verde"; + case 592: + return "Pared de caramelo verde"; + case 593: + return "Bloque de nieve"; + case 594: + return "Ladrillo de nieve"; + case 595: + return "Pared de ladrillos de nieve"; + case 596: + return "Luz azul"; + case 597: + return "Luz roja"; + case 598: + return "Luz verde"; + case 599: + return "Regalo azul"; + case 600: + return "Regalo verde"; + case 601: + return "Regalo amarillo"; + case 602: + return "Globo de nieve"; + case 603: + return "Repollo"; + case 604: + return "Máscara de dragón"; + case 605: + return "Casco de titán"; + case 606: + return "Tocado espectral"; + case 607: + return "Peto de dragón"; + case 608: + return "Malla de titán"; + case 609: + return "Armadura espectral"; + case 610: + return "Grebas de dragón"; + case 611: + return "Perneras de titán"; + case 612: + return "Liguero espectral"; + case 613: + return "Tizona"; + case 614: + return "Tonbogiri"; + case 615: + return "Sharanga"; + case 616: + return "Flecha espectral"; + case 617: + return "Repetidor volcánico"; + case 618: + return "Relámpago volcánico"; + case 619: + return "Calavera de aspecto sospechoso"; + case 620: + return "Alma enfermiza"; + case 621: + return "Placa de Petri"; + case 622: + return "Panal"; + case 623: + return "Vial de sangre"; + case 624: + return "Colmillo de lobo"; + case 625: + return "Cerebro"; + case 626: + return "Caja de música (Desierto)"; + case 627: + return "Caja de música (Espacio)"; + case 628: + return "Caja de música (Tutorial)"; + case 629: + return "Caja de música (Enemigo final 4)"; + case 630: + return "Caja de música (Océano)"; + case 631: + return "Caja de música (Nieve)"; + } + } + return (string) null; + } + + public static string itemAffixName(int prefix, int netID) + { + string str = Lang.itemName(netID); + if (prefix != 0) + str = Lang.lang > 1 ? str + " (" + Lang.itemPrefix(prefix) + (object) ')' : Lang.itemPrefix(prefix) + (object) ' ' + str; + return str; + } + + public static string evilGood() + { + string str1 = (string) null; + if (Lang.lang <= 1) + { + string str2; + if ((int) WorldGen.tGood == 0) + str2 = string.Concat(new object[4] + { + (object) Main.worldName, + (object) " is ", + (object) WorldGen.tEvil, + (object) "% corrupt." + }); + else if ((int) WorldGen.tEvil == 0) + str2 = string.Concat(new object[4] + { + (object) Main.worldName, + (object) " is ", + (object) WorldGen.tGood, + (object) "% hallow." + }); + else + str2 = Main.worldName + (object) " is " + (string) (object) WorldGen.tGood + "% hallow, and " + (string) (object) WorldGen.tEvil + "% corrupt."; + return (int) WorldGen.tGood <= (int) WorldGen.tEvil ? ((int) WorldGen.tEvil <= (int) WorldGen.tGood || (int) WorldGen.tEvil <= 20 ? str2 + " You should try harder." : str2 + " Things are grim indeed.") : str2 + " Keep up the good work!"; + } + else + { + if (Lang.lang == 2) + { + string str2; + if ((int) WorldGen.tGood == 0) + str2 = string.Concat(new object[4] + { + (object) Main.worldName, + (object) " ist zu ", + (object) WorldGen.tEvil, + (object) "% verderbt." + }); + else if ((int) WorldGen.tEvil == 0) + str2 = string.Concat(new object[4] + { + (object) Main.worldName, + (object) " ist zu ", + (object) WorldGen.tGood, + (object) "% geheiligt." + }); + else + str2 = Main.worldName + (object) " ist zu " + (string) (object) WorldGen.tGood + "% geheiligt und zu " + (string) (object) WorldGen.tEvil + "% verderbt."; + str1 = (int) WorldGen.tGood <= (int) WorldGen.tEvil ? ((int) WorldGen.tEvil <= (int) WorldGen.tGood || (int) WorldGen.tEvil <= 20 ? str2 + " Streng dich mehr an!" : str2 + " Es sieht in der Tat nicht gut aus.") : str2 + " Gute Arbeit, weiter so!"; + } + else if (Lang.lang == 3) + { + string str2; + if ((int) WorldGen.tGood == 0) + str2 = string.Concat(new object[4] + { + (object) Main.worldName, + (object) " è corrotto ", + (object) WorldGen.tEvil, + (object) "%." + }); + else if ((int) WorldGen.tEvil == 0) + str2 = string.Concat(new object[4] + { + (object) Main.worldName, + (object) " è consacrato ", + (object) WorldGen.tGood, + (object) "%." + }); + else + str2 = Main.worldName + (object) " è consacrato " + (string) (object) WorldGen.tGood + "% e corrotto " + (string) (object) WorldGen.tEvil + "%."; + str1 = (int) WorldGen.tGood <= (int) WorldGen.tEvil ? ((int) WorldGen.tEvil <= (int) WorldGen.tGood || (int) WorldGen.tEvil <= 20 ? str2 + " Dovresti impegnarti di più." : str2 + " Le cose vanno male.") : str2 + " Continua così!"; + } + else if (Lang.lang == 4) + { + string str2; + if ((int) WorldGen.tGood == 0) + str2 = string.Concat(new object[4] + { + (object) Main.worldName, + (object) " est corrompu à ", + (object) WorldGen.tEvil, + (object) " %." + }); + else if ((int) WorldGen.tEvil == 0) + str2 = string.Concat(new object[4] + { + (object) Main.worldName, + (object) " est purifié à ", + (object) WorldGen.tGood, + (object) " %." + }); + else + str2 = Main.worldName + (object) " est purifié à " + (string) (object) WorldGen.tGood + "% et corrompu à " + (string) (object) WorldGen.tEvil + " %."; + str1 = (int) WorldGen.tGood <= (int) WorldGen.tEvil ? ((int) WorldGen.tEvil <= (int) WorldGen.tGood || (int) WorldGen.tEvil <= 20 ? str2 + " Essayez encore." : str2 + " En effet, c'est pas la joie.") : str2 + " Continuez comme ça."; + } + else if (Lang.lang == 5) + { + string str2; + if ((int) WorldGen.tGood == 0) + str2 = string.Concat(new object[4] + { + (object) Main.worldName, + (object) " ha sido corrompido por ", + (object) WorldGen.tEvil, + (object) "%." + }); + else if ((int) WorldGen.tEvil == 0) + str2 = string.Concat(new object[4] + { + (object) Main.worldName, + (object) " ha sido bendecido por ", + (object) WorldGen.tGood, + (object) "%." + }); + else + str2 = Main.worldName + (object) " ha sido bendecido por " + (string) (object) WorldGen.tGood + "% y corrompido por " + (string) (object) WorldGen.tEvil + "%."; + str1 = (int) WorldGen.tGood <= (int) WorldGen.tEvil ? ((int) WorldGen.tEvil <= (int) WorldGen.tGood || (int) WorldGen.tEvil <= 20 ? str2 + " Deberías esforzarte más." : str2 + " Es bastante desalentador.") : str2 + " ¡Sigue haciéndolo bien!"; + } + return str1; + } + } + + public static void setLang(int language) + { + if (Lang.lang == language) + return; + Lang.lang = language; + if (Lang.lang <= 1) + { + Lang.misc[0] = "A goblin army has been defeated!"; + Lang.misc[1] = "A goblin army is approaching from the west!"; + Lang.misc[2] = "A goblin army is approaching from the east!"; + Lang.misc[3] = "A goblin army has arrived!"; + Lang.misc[4] = "The Frost Legion has been defeated!"; + Lang.misc[5] = "The Frost Legion is approaching from the west!"; + Lang.misc[6] = "The Frost Legion is approaching from the east!"; + Lang.misc[7] = "The Frost Legion has arrived!"; + Lang.misc[8] = "The Blood Moon is rising..."; + Lang.misc[9] = "You feel an evil presence watching you..."; + Lang.misc[10] = "A horrible chill goes down your spine..."; + Lang.misc[11] = "Screams echo around you..."; + Lang.misc[12] = "Your world has been blessed with Cobalt!"; + Lang.misc[13] = "Your world has been blessed with Mythril!"; + Lang.misc[14] = "Your world has been blessed with Adamantite!"; + Lang.misc[15] = "The ancient spirits of light and dark have been released."; + Lang.misc[16] = " has awoken!"; + Lang.misc[17] = " has been defeated!"; + Lang.misc[18] = " has arrived!"; + Lang.misc[19] = " was slain..."; + Lang.misc[20] = "The Twins"; + Lang.misc[21] = "Invalid operation at this state."; + Lang.misc[22] = "You are not using the same version as this server."; + Lang.misc[23] = "Current players: "; + Lang.misc[24] = " has enabled PvP!"; + Lang.misc[25] = " has disabled PvP!"; + Lang.misc[26] = " is no longer on a party."; + Lang.misc[27] = " has joined the red party."; + Lang.misc[28] = " has joined the green party."; + Lang.misc[29] = " has joined the blue party."; + Lang.misc[30] = " has joined the yellow party."; + Lang.misc[31] = "Welcome, "; + Lang.misc[32] = " has joined."; + Lang.misc[33] = " has left."; + Lang.misc[34] = "The Twins have awoken!"; + Lang.misc[35] = "The Twins have been defeated!"; + Lang.misc[36] = "A meteorite has landed!"; + Lang.menu[0] = "Ingredients"; + Lang.menu[1] = " in your inventory)"; + Lang.menu[2] = "Disconnect"; + Lang.menu[3] = "Attention!"; + Lang.menu[4] = "When this icon is visible\n\n\nthe game is saving data."; + Lang.menu[5] = "Error!"; + Lang.menu[6] = "Play Online"; + Lang.menu[7] = "Invite Only"; + Lang.menu[8] = "Found server..."; + Lang.menu[9] = "Load failed!"; + Lang.menu[10] = "Start Game"; + Lang.menu[11] = "Create World"; + Lang.menu[12] = "Corrupted character data was found and has been deleted."; + Lang.menu[13] = "Play Game"; + Lang.menu[14] = "Settings"; + Lang.menu[15] = "Exit Game"; + Lang.menu[16] = "Create Character"; + Lang.menu[17] = (string) (object) '\x008A' + (object) "Delete"; + Lang.menu[18] = "Hair"; + Lang.menu[19] = "Eyes"; + Lang.menu[20] = "Skin"; + Lang.menu[21] = "Clothes"; + Lang.menu[22] = "Male"; + Lang.menu[23] = "Female"; + Lang.menu[24] = "Hardcore"; + Lang.menu[25] = "Difficult"; + Lang.menu[26] = "Normal"; + Lang.menu[27] = "Random"; + Lang.menu[28] = "Create"; + Lang.menu[29] = "Death is permanent"; + Lang.menu[30] = "Drop all items on death"; + Lang.menu[31] = "Drop money on death"; + Lang.menu[32] = "Select difficulty"; + Lang.menu[33] = "Shirt"; + Lang.menu[34] = "Undershirt"; + Lang.menu[35] = "Pants"; + Lang.menu[36] = "Shoes"; + Lang.menu[37] = "Hair"; + Lang.menu[38] = "Hair Color"; + Lang.menu[39] = "Eye Color"; + Lang.menu[40] = "Skin Color"; + Lang.menu[41] = "Shirt Color"; + Lang.menu[42] = "Undershirt Color"; + Lang.menu[43] = "Pants Color"; + Lang.menu[44] = "Shoe Color"; + Lang.menu[45] = "Enter Character Name:"; + Lang.menu[46] = "Delete "; + Lang.menu[47] = "Credits"; + Lang.menu[48] = "Enter World Name:"; + Lang.menu[49] = "Leave without creating a character?"; + Lang.menu[50] = "Select Character"; + Lang.menu[51] = "Waiting for game to start..."; + Lang.menu[52] = "Press START"; + Lang.menu[53] = "Character name"; + Lang.menu[54] = "Saving Character..."; + Lang.menu[55] = "World name"; + Lang.menu[56] = "World"; + Lang.menu[57] = "Spawn point set!"; + Lang.menu[58] = "Distance traveled"; + Lang.menu[59] = "Resources mined and gathered"; + Lang.menu[60] = "Items crafted"; + Lang.menu[61] = "Items used"; + Lang.menu[62] = "Normal bosses defeated"; + Lang.menu[63] = "Hard Mode bosses defeated"; + Lang.menu[64] = "Times died"; + Lang.menu[65] = "Volume"; + Lang.menu[66] = "No Storage Device has been selected. Saving has been disabled."; + Lang.menu[67] = "Autosave On"; + Lang.menu[68] = "Autosave Off"; + Lang.menu[69] = "No Storage Device"; + Lang.menu[70] = "The Storage Device has been removed. Saving has been disabled."; + Lang.menu[71] = "Pickup Text On"; + Lang.menu[72] = "Pickup Text Off"; + Lang.menu[73] = "Requesting world information..."; + Lang.menu[74] = "Requesting tile data..."; + Lang.menu[75] = "Accepting invitation..."; + Lang.menu[76] = "Searching..."; + Lang.menu[77] = "No games found"; + Lang.menu[78] = "Players: "; + Lang.menu[79] = "~ EMPTY ~"; + Lang.menu[80] = "Joining game..."; + Lang.menu[81] = "PvP"; + Lang.menu[82] = "Team"; + Lang.menu[83] = "Your Worlds"; + Lang.menu[84] = "Join Game"; + Lang.menu[85] = "Depth: "; + Lang.menu[86] = "m below"; + Lang.menu[87] = "m above"; + Lang.menu[88] = "level"; + Lang.menu[89] = "Tutorial"; + Lang.menu[90] = "Ok"; + Lang.menu[91] = "Choose world size:"; + Lang.menu[92] = "Small"; + Lang.menu[93] = "Medium"; + Lang.menu[94] = "Large"; + Lang.menu[95] = "Position: "; + Lang.menu[96] = "m east"; + Lang.menu[97] = "m west"; + Lang.menu[98] = "center"; + Lang.menu[99] = "Save Game"; + Lang.menu[100] = "Exit to Main Menu"; + Lang.menu[101] = "Main Menu"; + Lang.menu[102] = "Settings data was corrupted and has been deleted."; + Lang.menu[103] = "Corrupted world data was found and has been deleted."; + Lang.menu[104] = "Yes"; + Lang.menu[105] = "No"; + Lang.menu[106] = "Leaderboards"; + Lang.menu[107] = "Achievements"; + Lang.menu[108] = "Help & Options"; + Lang.menu[109] = "Unlock Full Game"; + Lang.menu[110] = "How to Play"; + Lang.menu[111] = "Controls"; + Lang.menu[112] = "Resume Game"; + Lang.gen[0] = "Generating world terrain..."; + Lang.gen[1] = "Adding sand..."; + Lang.gen[2] = "Generating hills..."; + Lang.gen[3] = "Puttin dirt behind dirt..."; + Lang.gen[4] = "Placing rocks in the dirt..."; + Lang.gen[5] = "Placing dirt in the rocks..."; + Lang.gen[6] = "Adding clay..."; + Lang.gen[7] = "Making random holes..."; + Lang.gen[8] = "Generating small caves..."; + Lang.gen[9] = "Generating large caves..."; + Lang.gen[10] = "Generating surface caves..."; + Lang.gen[11] = "Generating jungle..."; + Lang.gen[12] = "Generating floating islands..."; + Lang.gen[13] = "Adding mushroom patches..."; + Lang.gen[14] = "Placing mud in the dirt..."; + Lang.gen[15] = "Adding silt..."; + Lang.gen[16] = "Adding shinies..."; + Lang.gen[17] = "Adding webs..."; + Lang.gen[18] = "Creating underworld..."; + Lang.gen[19] = "Adding water bodies..."; + Lang.gen[20] = "Making the world evil..."; + Lang.gen[21] = "Generating mountain caves..."; + Lang.gen[22] = "Creating beaches..."; + Lang.gen[23] = "Adding gems..."; + Lang.gen[24] = "Gravitating sand..."; + Lang.gen[25] = "Cleaning up dirt backgrounds..."; + Lang.gen[26] = "Placing altars..."; + Lang.gen[27] = "Settling liquids..."; + Lang.gen[28] = "Placing life crystals..."; + Lang.gen[29] = "Placing statues..."; + Lang.gen[30] = "Hiding treasure..."; + Lang.gen[31] = "Hiding more treasure..."; + Lang.gen[32] = "Hiding jungle treasure..."; + Lang.gen[33] = "Hiding water treasure..."; + Lang.gen[34] = "Placing traps..."; + Lang.gen[35] = "Placing breakables..."; + Lang.gen[36] = "Placing hellforges..."; + Lang.gen[37] = "Spreading grass..."; + Lang.gen[38] = "Growing cacti..."; + Lang.gen[39] = "Planting sunflowers..."; + Lang.gen[40] = "Planting trees..."; + Lang.gen[41] = "Planting herbs..."; + Lang.gen[42] = "Planting weeds..."; + Lang.gen[43] = "Growing vines..."; + Lang.gen[44] = "Planting flowers..."; + Lang.gen[45] = "Planting mushrooms..."; + Lang.gen[46] = "The connection to the host has been lost."; + Lang.gen[47] = "Resetting game objects..."; + Lang.gen[48] = "Setting hard mode..."; + Lang.gen[49] = "Saving world data..."; + Lang.gen[50] = "Backing up world file..."; + Lang.gen[51] = "Loading world data..."; + Lang.gen[52] = "Checking tile alignment..."; + Lang.gen[53] = "An error occurred while reading from the Storage Device."; + Lang.gen[54] = "An error occurred while writing to the Storage Device."; + Lang.gen[55] = "Finding tile frames..."; + Lang.gen[56] = "Adding snow..."; + Lang.gen[57] = "Waiting for a player to leave..."; + Lang.gen[58] = "Creating dungeon..."; + Lang.inter[0] = "Cancel"; + Lang.inter[1] = "Exit without saving"; + Lang.inter[2] = "Save and Exit"; + Lang.inter[3] = "Trash Can"; + Lang.inter[4] = "Inventory"; + Lang.inter[5] = "Do you want to return to the Main Menu?"; + Lang.inter[6] = "Buffs"; + Lang.inter[7] = "Housing"; + Lang.inter[8] = "This housing is not suitable."; + Lang.inter[9] = "Accessories"; + Lang.inter[10] = " Defense"; + Lang.inter[11] = "Vanity"; + Lang.inter[12] = "Helmet"; + Lang.inter[13] = "Shirt"; + Lang.inter[14] = "Pants"; + Lang.inter[15] = " platinum "; + Lang.inter[16] = " gold "; + Lang.inter[17] = " silver "; + Lang.inter[18] = " copper"; + Lang.inter[19] = "Reforge"; + Lang.inter[20] = "Failed to create a network session."; + Lang.inter[21] = "Failed to join the session. The session either is full or cannot be found."; + Lang.inter[22] = "Required objects:"; + Lang.inter[23] = "None"; + Lang.inter[24] = "Alternate grappling mode"; + Lang.inter[25] = "Crafting"; + Lang.inter[26] = "Coins"; + Lang.inter[27] = "Ammo"; + Lang.inter[28] = "Shop"; + Lang.inter[29] = (string) (object) '\x008C' + (object) "Loot All"; + Lang.inter[30] = (string) (object) '\x008C' + (object) "Deposit All"; + Lang.inter[31] = (string) (object) '\x008C' + (object) "Quick Stack"; + Lang.inter[32] = "Piggy Bank"; + Lang.inter[33] = "Safe"; + Lang.inter[34] = "Time: "; + Lang.inter[35] = "Are you sure you want to quit?"; + Lang.inter[36] = "The connection to Xbox LIVE has been lost."; + Lang.inter[37] = "Number of entries: "; + Lang.inter[38] = "You were slain..."; + Lang.inter[39] = "This housing is suitable."; + Lang.inter[40] = "This is not valid housing."; + Lang.inter[41] = "This housing is already occupied."; + Lang.inter[42] = "This housing is corrupted."; + Lang.inter[43] = "This gamer profile does not have suitable privileges to join. You may require a LIVE Gold account, or need to change your parental control settings."; + Lang.inter[44] = "Receiving tile data"; + Lang.inter[45] = "Equip"; + Lang.inter[46] = "Cost: "; + Lang.inter[47] = "Save"; + Lang.inter[48] = "Edit"; + Lang.inter[49] = "Status"; + Lang.inter[50] = "Curse"; + Lang.inter[51] = "Help"; + Lang.inter[52] = "Close"; + Lang.inter[53] = "Water"; + Lang.inter[54] = "Heal"; + Lang.inter[55] = "Provides tips and crafting advice."; + Lang.inter[56] = "Sells basic goods."; + Lang.inter[57] = "Heals wounds and debuffs."; + Lang.inter[58] = "Sells explosives."; + Lang.inter[59] = "Sells natural goods and tells you the state of the World."; + Lang.inter[60] = "Sells guns and ammo."; + Lang.inter[61] = "Sells vanity clothes."; + Lang.inter[62] = "Sells tools and wires."; + Lang.inter[63] = "Sells handy gadgets and reforges items."; + Lang.inter[64] = "Sells magic items and accessories."; + Lang.inter[65] = "A jolly old fellow."; + Lang.inter[66] = "Game Ended"; + Lang.inter[67] = "The game was ended by the host."; + Lang.inter[68] = "Unable to join due to privileges blocked on one of the signed in profiles."; + Lang.inter[69] = "You are currently playing the trial version. Please buy the full version to play online."; + Lang.inter[70] = "There is insufficient space available on the selected storage device."; + Lang.inter[71] = "Playing split-screen in a Standard Definition video mode will result in game text that is difficult to read. High Definition (HD) is strongly recommended for an optimal gameplay experience."; + Lang.inter[72] = "Ban World"; + Lang.inter[73] = "Add this world to your Banned Worlds list?"; + Lang.inter[74] = "This world is in your Banned Worlds list."; + Lang.inter[75] = "Continue (remove from list)"; + Lang.inter[76] = "(Awaiting approval)"; + Lang.inter[77] = "(Censored)"; + Lang.inter[78] = "The Saved Game \"{0}\" was transferred from another profile and will be deleted."; + Lang.inter[79] = "The game will end due to the Member Content settings of one of the signed in profiles."; + Lang.tip[0] = "Equipped in vanity slot"; + Lang.tip[1] = "No stats will be gained"; + Lang.tip[2] = " melee damage"; + Lang.tip[3] = " ranged damage"; + Lang.tip[4] = " magic damage"; + Lang.tip[5] = "% critical strike chance"; + Lang.tip[6] = "Insanely fast speed"; + Lang.tip[7] = "Very fast speed"; + Lang.tip[8] = "Fast speed"; + Lang.tip[9] = "Average speed"; + Lang.tip[10] = "Slow speed"; + Lang.tip[11] = "Very slow speed"; + Lang.tip[12] = "Extremely slow speed"; + Lang.tip[13] = "Snail speed"; + Lang.tip[14] = "No knockback"; + Lang.tip[15] = "Extremely weak knockback"; + Lang.tip[16] = "Very weak knockback"; + Lang.tip[17] = "Weak knockback"; + Lang.tip[18] = "Average knockback"; + Lang.tip[19] = "Strong knockback"; + Lang.tip[20] = "Very strong knockback"; + Lang.tip[21] = "Extremely strong knockback"; + Lang.tip[22] = "Insane knockback"; + Lang.tip[23] = "Equipable"; + Lang.tip[24] = "Vanity Item"; + Lang.tip[25] = " defense"; + Lang.tip[26] = "% pickaxe power"; + Lang.tip[27] = "% axe power"; + Lang.tip[28] = "% hammer power"; + Lang.tip[29] = "Restores "; + Lang.tip[30] = " life"; + Lang.tip[31] = " mana"; + Lang.tip[32] = "Uses "; + Lang.tip[33] = "Can be placed"; + Lang.tip[34] = "Ammo"; + Lang.tip[35] = "Consumable"; + Lang.tip[36] = "Material"; + Lang.tip[37] = " minute duration"; + Lang.tip[38] = " second duration"; + Lang.tip[39] = "% damage"; + Lang.tip[40] = "% speed"; + Lang.tip[41] = "% critical strike chance"; + Lang.tip[42] = "% mana cost"; + Lang.tip[43] = "% size"; + Lang.tip[44] = "% velocity"; + Lang.tip[45] = "% knockback"; + Lang.tip[46] = "% movement speed"; + Lang.tip[47] = "% melee speed"; + Lang.tip[48] = "Set bonus: "; + Lang.tip[49] = "Sell price: "; + Lang.tip[50] = "Buy price: "; + Lang.tip[51] = "No value"; + Lang.dt[0] = " couldn't find the antidote."; + Lang.dt[1] = " couldn't put the fire out."; + Lang.dt[2] = " tried to escape."; + Lang.dt[3] = " was licked."; + Buff.buffName[1] = "Obsidian Skin"; + Buff.buffTip[1] = "Immune to lava"; + Buff.buffName[2] = "Regeneration"; + Buff.buffTip[2] = "Provides life regeneration"; + Buff.buffName[3] = "Swiftness"; + Buff.buffTip[3] = "25% increased movement speed"; + Buff.buffName[4] = "Gills"; + Buff.buffTip[4] = "Breathe water instead of air"; + Buff.buffName[5] = "Ironskin"; + Buff.buffTip[5] = "Increase defense by 8"; + Buff.buffName[6] = "Mana Regeneration"; + Buff.buffTip[6] = "Increased mana regeneration"; + Buff.buffName[7] = "Magic Power"; + Buff.buffTip[7] = "20% increased magic damage"; + Buff.buffName[8] = "Featherfall"; + Buff.buffTip[8] = "Press UP or DOWN to control speed of descent"; + Buff.buffName[9] = "Spelunker"; + Buff.buffTip[9] = "Shows the location of treasure and ore"; + Buff.buffName[10] = "Invisibility"; + Buff.buffTip[10] = "Grants invisibility"; + Buff.buffName[11] = "Shine"; + Buff.buffTip[11] = "Emitting light"; + Buff.buffName[12] = "Night Owl"; + Buff.buffTip[12] = "Increased night vision"; + Buff.buffName[13] = "Battle"; + Buff.buffTip[13] = "Increased enemy spawn rate"; + Buff.buffName[14] = "Thorns"; + Buff.buffTip[14] = "Attackers also take damage"; + Buff.buffName[15] = "Water Walking"; + Buff.buffTip[15] = "Press DOWN to enter water"; + Buff.buffName[16] = "Archery"; + Buff.buffTip[16] = "20% increased arrow damage and speed"; + Buff.buffName[17] = "Hunter"; + Buff.buffTip[17] = "Shows the location of enemies"; + Buff.buffName[18] = "Gravitation"; + Buff.buffTip[18] = "Press UP or DOWN to reverse gravity"; + Buff.buffName[19] = "Orb of Light"; + Buff.buffTip[19] = "A magical orb that provides light"; + Buff.buffName[20] = "Poisoned"; + Buff.buffTip[20] = "Slowly losing life"; + Buff.buffName[21] = "Potion Sickness"; + Buff.buffTip[21] = "Cannot consume anymore healing items"; + Buff.buffName[22] = "Darkness"; + Buff.buffTip[22] = "Decreased light vision"; + Buff.buffName[23] = "Cursed"; + Buff.buffTip[23] = "Cannot use any items"; + Buff.buffName[24] = "On Fire!"; + Buff.buffTip[24] = "Slowly losing life"; + Buff.buffName[25] = "Tipsy"; + Buff.buffTip[25] = "Increased melee abilities, lowered defense"; + Buff.buffName[26] = "Well Fed"; + Buff.buffTip[26] = "Minor improvements to all stats"; + Buff.buffName[27] = "Fairy"; + Buff.buffTip[27] = "A fairy is following you"; + Buff.buffName[28] = "Werewolf"; + Buff.buffTip[28] = "Physical abilities are increased"; + Buff.buffName[29] = "Clairvoyance"; + Buff.buffTip[29] = "Magic powers are increased"; + Buff.buffName[30] = "Bleeding"; + Buff.buffTip[30] = "Cannot regenerate life"; + Buff.buffName[31] = "Confused"; + Buff.buffTip[31] = "Movement is reversed"; + Buff.buffName[32] = "Slow"; + Buff.buffTip[32] = "Movement speed is reduced"; + Buff.buffName[33] = "Weak"; + Buff.buffTip[33] = "Physical abilities are decreased"; + Buff.buffName[34] = "Merfolk"; + Buff.buffTip[34] = "Can breathe and move easily underwater"; + Buff.buffName[35] = "Silenced"; + Buff.buffTip[35] = "Cannot use items that require mana"; + Buff.buffName[36] = "Broken Armor"; + Buff.buffTip[36] = "Defense is cut in half"; + Buff.buffName[37] = "Horrified"; + Buff.buffTip[37] = "You have seen something nasty, there is no escape."; + Buff.buffName[38] = "The Tongue"; + Buff.buffTip[38] = "You are being sucked into the mouth"; + Buff.buffName[39] = "Cursed Inferno"; + Buff.buffTip[39] = "Losing life"; + Buff.buffName[40] = "Pet Guinea Pig"; + Buff.buffTip[40] = "Simply adorable"; + Buff.buffName[41] = "Pet Slime"; + Buff.buffTip[41] = "A real slime ball"; + Buff.buffName[42] = "Pet Tiphia"; + Buff.buffTip[42] = "Wants all the honeys"; + Buff.buffName[43] = "Pet Bat"; + Buff.buffTip[43] = "Out for blood"; + Buff.buffName[44] = "Pet Werewolf"; + Buff.buffTip[44] = "Man's best friend"; + Buff.buffName[45] = "Pet Zombie"; + Buff.buffTip[45] = "Eats brains"; + Main.tileName[13] = "Bottle"; + Main.tileName[14] = "Table"; + Main.tileName[15] = "Chair"; + Main.tileName[16] = "Anvil"; + Main.tileName[17] = "Furnace"; + Main.tileName[18] = "Work Bench"; + Main.tileName[26] = "Demon Altar"; + Main.tileName[77] = "Hellforge"; + Main.tileName[86] = "Loom"; + Main.tileName[94] = "Keg"; + Main.tileName[96] = "Cooking Pot"; + Main.tileName[101] = "Bookcase"; + Main.tileName[106] = "Sawmill"; + Main.tileName[114] = "Tinkerer's Workshop"; + Main.tileName[133] = "Adamantite Forge"; + Main.tileName[134] = "Mythril Anvil"; + } + else if (Lang.lang == 2) + { + Lang.misc[0] = "Die Goblin-Armee wurde besiegt!"; + Lang.misc[1] = "Eine Goblin-Armee nähert sich von Westen!"; + Lang.misc[2] = "Eine Goblin-Armee nähert sich von Osten!"; + Lang.misc[3] = "Ein Goblin-Armee ist da!"; + Lang.misc[4] = "Die Frost-Legion wurde besiegt!"; + Lang.misc[5] = "Die Frost-Legion nähert sich aus dem Westen!"; + Lang.misc[6] = "Die Frost-Legion nähert sich aus dem Osten!"; + Lang.misc[7] = "Die Frost-Legion ist da!"; + Lang.misc[8] = "Der Blutmond steigt auf ..."; + Lang.misc[9] = "Du fühlst dich von einer bösen Kraft beobachtet ..."; + Lang.misc[10] = "Eine Eiseskälte steigt in dir hoch ..."; + Lang.misc[11] = "Du hoerst das Echo von Schreien um dich herum ..."; + Lang.misc[12] = "Deine Welt wurde mit Kobalt gesegnet!"; + Lang.misc[13] = "Deine Welt wurde mit Mithril gesegnet!"; + Lang.misc[14] = "Deine Welt wurde mit Adamantit gesegnet!"; + Lang.misc[15] = "Die uralten Geister des Lichts und der Finsternis wurden freigelassen."; + Lang.misc[16] = " ist aufgewacht!"; + Lang.misc[17] = " wurde besiegt!"; + Lang.misc[18] = " ist eingetroffen!"; + Lang.misc[19] = " wurde getötet von ..."; + Lang.misc[20] = "Die Zwillinge"; + Lang.misc[21] = "Ungültige Operation in diesem Zustand."; + Lang.misc[22] = "Du verwendest nicht die gleiche Version wie der Server."; + Lang.misc[23] = "Aktuelle Spieler: "; + Lang.misc[24] = " hat PvP aktiviert!"; + Lang.misc[25] = " hat PvP deaktiviert!"; + Lang.misc[26] = " ist in keiner Gruppe mehr."; + Lang.misc[27] = " ist der roten Gruppe beigetreten."; + Lang.misc[28] = " ist der gruenen Gruppe beigetreten."; + Lang.misc[29] = " ist der blauen Gruppe beigetreten."; + Lang.misc[30] = " ist der gelben Gruppe beigetreten."; + Lang.misc[31] = "Willkommen, "; + Lang.misc[32] = " ist dazugekommen."; + Lang.misc[33] = " hat das Spiel verlassen."; + Lang.misc[34] = "Die Zwillinge sind erwacht!"; + Lang.misc[35] = "Die Zwillinge wurden besiegt!"; + Lang.misc[36] = "Ein Meteorit ist gelandet!"; + Lang.menu[0] = "Bestandteile"; + Lang.menu[1] = " deines Inventars)"; + Lang.menu[2] = "Trennen"; + Lang.menu[3] = "Achtung!"; + Lang.menu[4] = "Wenn dieses Symbol erscheint,\n\n\nspeichert das Spiel Daten."; + Lang.menu[5] = "Fehler!"; + Lang.menu[6] = "Online spielen"; + Lang.menu[7] = "Nur mit Einladung"; + Lang.menu[8] = "Server gefunden ..."; + Lang.menu[9] = "Laden fehlgeschlagen!"; + Lang.menu[10] = "Spiel beginnen"; + Lang.menu[11] = "Welt erstellen"; + Lang.menu[12] = "Beschädigte Zeichendaten wurden gefunden und gelöscht."; + Lang.menu[13] = "Spiel spielen"; + Lang.menu[14] = "Einstellungen"; + Lang.menu[15] = "Spiel verlassen"; + Lang.menu[16] = "Charakter erstellen"; + Lang.menu[17] = (string) (object) '\x008A' + (object) "Löschen"; + Lang.menu[18] = "Haar"; + Lang.menu[19] = "Augen"; + Lang.menu[20] = "Haut"; + Lang.menu[21] = "Kleidung"; + Lang.menu[22] = "Männlich"; + Lang.menu[23] = "Weiblich"; + Lang.menu[24] = "Hardcore"; + Lang.menu[25] = "Schwierig"; + Lang.menu[26] = "Normal"; + Lang.menu[27] = "Zufällig"; + Lang.menu[28] = "Erstellen"; + Lang.menu[29] = "Der Tod ist für immer"; + Lang.menu[30] = "Lass alle Items auf den Tod fallen"; + Lang.menu[31] = "Lass Geld auf den Tod fallen"; + Lang.menu[32] = "Schwierigkeitsgrad wählen"; + Lang.menu[33] = "Hemd"; + Lang.menu[34] = "Unterhemd"; + Lang.menu[35] = "Hose"; + Lang.menu[36] = "Schuhe"; + Lang.menu[37] = "Haar"; + Lang.menu[38] = "Haarfarbe"; + Lang.menu[39] = "Augenfarbe"; + Lang.menu[40] = "Hautfarbe"; + Lang.menu[41] = "Hemdfarbe"; + Lang.menu[42] = "Unterhemdfarbe"; + Lang.menu[43] = "Hosenfarbe"; + Lang.menu[44] = "Schuhfarbe"; + Lang.menu[45] = "Charaktername eingeben:"; + Lang.menu[46] = "Löschen "; + Lang.menu[47] = "Mitwirkende"; + Lang.menu[48] = "Weltnamen eingeben:"; + Lang.menu[49] = "Verlassen, ohne einen Charakter zu erstellen?"; + Lang.menu[50] = "Wähle einen Charakter aus"; + Lang.menu[51] = "Das Spiel wird gestartet ..."; + Lang.menu[52] = "Drücke auf START"; + Lang.menu[53] = "Charaktername"; + Lang.menu[54] = "Charakter speichern ..."; + Lang.menu[55] = "Name der Welt"; + Lang.menu[56] = "Welt"; + Lang.menu[57] = "Spawnpoint gesetzt!"; + Lang.menu[58] = "Zurückgelegte Strecke"; + Lang.menu[59] = "Ressourcen abgebaut und gesammelt"; + Lang.menu[60] = "Hergestellte Items"; + Lang.menu[61] = "Genutzte Items"; + Lang.menu[62] = "Normale Bosse wurden besiegt"; + Lang.menu[63] = "Hardmode-Bosse wurden besiegt"; + Lang.menu[64] = "Zeiten erloschen"; + Lang.menu[65] = "Lautstärke"; + Lang.menu[66] = "Es wurde kein Speichermedium ausgewählt. Die Speicherung wurde deaktiviert."; + Lang.menu[67] = "Automat. sichern an"; + Lang.menu[68] = "Automat. sichern aus"; + Lang.menu[69] = "Keine Speichermedium"; + Lang.menu[70] = "Das Speichermedium wurde entfernt. Die Speicherung wurde deaktiviert."; + Lang.menu[71] = "Pickup-Text an"; + Lang.menu[72] = "Pickup-Text aus"; + Lang.menu[73] = "Informationen über die Welt werden angefordert ..."; + Lang.menu[74] = "Tile-Daten werden angefordert ..."; + Lang.menu[75] = "Einladung annehmen ..."; + Lang.menu[76] = "Suchen ..."; + Lang.menu[77] = "Keine Spiele gefunden"; + Lang.menu[78] = "Spieler:"; + Lang.menu[79] = "~ LEER ~"; + Lang.menu[80] = "Spiel beitreten ..."; + Lang.menu[81] = "PvP"; + Lang.menu[82] = "Team"; + Lang.menu[83] = "Deine Welten"; + Lang.menu[84] = "Spiel beitreten"; + Lang.menu[85] = "Tiefe: "; + Lang.menu[86] = "m unterhalb"; + Lang.menu[87] = "m oberhalb"; + Lang.menu[88] = "Level"; + Lang.menu[89] = "Tutorial"; + Lang.menu[90] = "OK"; + Lang.menu[91] = "Weltgröße wählen:"; + Lang.menu[92] = "Klein"; + Lang.menu[93] = "Mittel"; + Lang.menu[94] = "Groß"; + Lang.menu[95] = "Position: "; + Lang.menu[96] = "m östlich"; + Lang.menu[97] = "m westlich"; + Lang.menu[98] = "zentral"; + Lang.menu[99] = "Spiel speichern"; + Lang.menu[100] = "Zum Hauptmenü zurückkehren"; + Lang.menu[101] = "Hauptmenü"; + Lang.menu[102] = "Die Einstellungsdaten waren beschädigt und wurden gelöscht."; + Lang.menu[103] = "Beschädigte Weltdaten wurden gefunden und gelöscht."; + Lang.menu[104] = "Ja"; + Lang.menu[105] = "Nein"; + Lang.menu[106] = "Bestenlisten"; + Lang.menu[107] = "Erfolge"; + Lang.menu[108] = "Hilfe und Optionen"; + Lang.menu[109] = "Vollständiges Spiel freischalten"; + Lang.menu[110] = "So wird gespielt"; + Lang.menu[111] = "Steuerung"; + Lang.menu[112] = "Spiel fortsetzen"; + Lang.gen[0] = "Generieren des Weltgeländes ..."; + Lang.gen[1] = "Sand wird hinzugefügt ..."; + Lang.gen[2] = "Hügel werden generiert ..."; + Lang.gen[3] = "Dreck wird hinter Dreck geschoben ..."; + Lang.gen[4] = "Felsen werden in den Dreck gesetzt ..."; + Lang.gen[5] = "Dreck wird in Felsen platziert ..."; + Lang.gen[6] = "Lehm wird hinzugefügt ..."; + Lang.gen[7] = "Zufällig platzierte Löcher werden geschaffen:"; + Lang.gen[8] = "Generieren kleiner Höhlen ..."; + Lang.gen[9] = "Generieren großer Höhlen ..."; + Lang.gen[10] = "Höhlenoberflächen werden generiert ..."; + Lang.gen[11] = "Generieren des Dschungels:"; + Lang.gen[12] = "Schwimmende Inseln werden generiert ..."; + Lang.gen[13] = "Pilzflecken werden generiert ..."; + Lang.gen[14] = "Schlamm wird in Dreck gefügt ..."; + Lang.gen[15] = "Schlick wird hinzugefügt ..."; + Lang.gen[16] = "Glitzer wird hinzugefügt ..."; + Lang.gen[17] = "Spinnweben werden hinzugefügt ..."; + Lang.gen[18] = "Erstellen der Unterwelt ..."; + Lang.gen[19] = "Gewässer wird hinzugefügt ..."; + Lang.gen[20] = "Macht die Welt böse ..."; + Lang.gen[21] = "Berghöhlen werden generiert ..."; + Lang.gen[22] = "Strände werden erstellt ..."; + Lang.gen[23] = "Edelsteine werden hinzugefügt ..."; + Lang.gen[24] = "Gravitieren von Sand ..."; + Lang.gen[25] = "Reinigung von Dreckhintergrund ..."; + Lang.gen[26] = "Platzieren von Altären ..."; + Lang.gen[27] = "Gewässer verteilen ..."; + Lang.gen[28] = "Lebenskristalle platzieren ..."; + Lang.gen[29] = "Platzieren von Statuen ..."; + Lang.gen[30] = "Verstecken von Schätzen ..."; + Lang.gen[31] = "Verstecken von mehr Schätzen ..."; + Lang.gen[32] = "Verstecken von Dschungelschätzen ..."; + Lang.gen[33] = "Verstecken von Wasserschätzen ..."; + Lang.gen[34] = "Platzieren von Fallen ..."; + Lang.gen[35] = "Platzieren von Zerbrechlichem ..."; + Lang.gen[36] = "Platzieren von Höllenschmieden ..."; + Lang.gen[37] = "Gras wird verteilt ..."; + Lang.gen[38] = "Kakteen wachsen ..."; + Lang.gen[39] = "Sonnenblumen werden gepflanzt ..."; + Lang.gen[40] = "Bäume werden gepflanzt ..."; + Lang.gen[41] = "Kräuter werden gepflanzt ..."; + Lang.gen[42] = "Unkraut wird gepflanzt ..."; + Lang.gen[43] = "Wein wird angebaut ..."; + Lang.gen[44] = "Blumen werden gepflanzt ..."; + Lang.gen[45] = "Pilze werden gesät ..."; + Lang.gen[46] = "Die Verbindung zum Host wurde unterbrochen"; + Lang.gen[47] = "Spielobjekte werden zurückgesetzt ..."; + Lang.gen[48] = "Schwerer Modus wird eingestellt ..."; + Lang.gen[49] = "Weltdaten werden gesichert ..."; + Lang.gen[50] = "Backup von Weltdatei wird erstellt ..."; + Lang.gen[51] = "Weltdaten werden geladen ..."; + Lang.gen[52] = "Überprüfen der Feld-Ausrichtung ..."; + Lang.gen[53] = "Fehler beim Lesen vom Datenträger"; + Lang.gen[54] = "Fehler beim Schreiben auf den Datenträger"; + Lang.gen[55] = "Suchen von Feld-Frames ..."; + Lang.gen[56] = "Schnee hinzufügen ..."; + Lang.gen[57] = "Welt"; + Lang.gen[58] = "Verlies erstellen ..."; + Lang.inter[0] = "Abbrechen"; + Lang.inter[1] = "Vorgang ohne Speichern beenden"; + Lang.inter[2] = "Speichern und beenden"; + Lang.inter[3] = "Mülleimer"; + Lang.inter[4] = "Inventar"; + Lang.inter[5] = "Möchtest du zum Hauptmenü zurückkehren?"; + Lang.inter[6] = "Buffs"; + Lang.inter[7] = "Behausung"; + Lang.inter[8] = "Diese Behausung ist ungeeignet."; + Lang.inter[9] = "Zusaetze"; + Lang.inter[10] = " Abwehr"; + Lang.inter[11] = "Vanity"; + Lang.inter[12] = "Helm"; + Lang.inter[13] = "Hemd"; + Lang.inter[14] = "Hose"; + Lang.inter[15] = " platin "; + Lang.inter[16] = " gold "; + Lang.inter[17] = " silber "; + Lang.inter[18] = " kupfer"; + Lang.inter[19] = "Nachschmieden"; + Lang.inter[20] = "Das Erstellen einer Netzwerksitzung ist fehlgeschlagen."; + Lang.inter[21] = "Der Versuch, der Sitzung beizutreten, ist fehlgeschlagen. Die Sitzung ist entweder voll oder kann nicht gefunden werden."; + Lang.inter[22] = "Erforderliche Objekte:"; + Lang.inter[23] = "Keine"; + Lang.inter[24] = "Greifhaken-Modus ändern"; + Lang.inter[25] = "Herstellen"; + Lang.inter[26] = "Münzen"; + Lang.inter[27] = "Munition"; + Lang.inter[28] = "Geschäft"; + Lang.inter[29] = (string) (object) '\x008C' + (object) "Alle ausräumen"; + Lang.inter[30] = (string) (object) '\x008C' + (object) "Alle ablegen"; + Lang.inter[31] = (string) (object) '\x008C' + (object) "Schnellstapeln"; + Lang.inter[32] = "Sparschwein"; + Lang.inter[33] = "Tresor"; + Lang.inter[34] = "Zeit: "; + Lang.inter[35] = "Bist du dir sicher, dass du aufhören möchtest?"; + Lang.inter[36] = "Die Verbindung zu Xbox LIVE wurde unterbrochen."; + Lang.inter[37] = "Anzahl von Eintragungen: "; + Lang.inter[38] = "Du wurdest getötet ..."; + Lang.inter[39] = "Diese Behausung ist geeignet."; + Lang.inter[40] = "Das ist keine zulässige Behausung"; + Lang.inter[41] = "Diese Behausung ist bereits belegt."; + Lang.inter[42] = "Diese Behausung ist beschädigt."; + Lang.inter[43] = "Dieses Spielerprofil hat nicht die passenden Zugangsberechtigungen für eine Teilnahme. Um teilnehmen zu können, benötigst du entweder einen LIVE Gold Account oder du musst deine Jugendschutzeinstellungen ändern."; + Lang.inter[44] = "Felddaten werden empfangen"; + Lang.inter[45] = "Ausrüsten"; + Lang.inter[46] = "Kosten: "; + Lang.inter[47] = "Sparen"; + Lang.inter[48] = "Bearbeiten"; + Lang.inter[49] = "Status"; + Lang.inter[50] = "Fluch"; + Lang.inter[51] = "Hilfe"; + Lang.inter[52] = "Schließen"; + Lang.inter[53] = "Wasser"; + Lang.inter[54] = "Heilen"; + Lang.inter[55] = "Stellt Tipps und Handwerksvorschläge bereit."; + Lang.inter[56] = "Verkauft reguläre Waren."; + Lang.inter[57] = "Heilt Wunden und Debuffs."; + Lang.inter[58] = "Verkauft Sprengstoff."; + Lang.inter[59] = "Verkauft Naturwaren und informiert dich über den Zustand der Welt."; + Lang.inter[60] = "Verkauft Pistolen und Munition."; + Lang.inter[61] = "Verkauft Vanity-Kleidung."; + Lang.inter[62] = "Verkauft Werkzeuge und Kabel."; + Lang.inter[63] = "Verkauft praktisches Zubehör und schmiedet Items zusammen."; + Lang.inter[64] = "Verkauft magische Items und Zubehör."; + Lang.inter[65] = "Ein lustiger alter Kerl."; + Lang.inter[66] = "Spiel beendet"; + Lang.inter[67] = "Das Spiel wurde vom Host beendet."; + Lang.inter[68] = "Es kann nicht beitreten werden, da die Rechte auf einem der Profile geblockt sind."; + Lang.inter[69] = "Du spielst zur Zeit auf der Testversion. Bitte kaufe die Vollversion, um online zu spielen."; + Lang.inter[70] = "Die Speicherkapazität des ausgewählten Speichermediums reicht nicht aus."; + Lang.inter[71] = "Das Spiel auf einem geteilten Bildschirm in einem Videomodus mit Standardauflösung führt zu einer schlechten Lesbarkeit des Spieltexts. Für eine optimale Spielerfahrung wird High Definition (HD) dringend empfohlen."; + Lang.inter[72] = "Verbanne Welt"; + Lang.inter[73] = "Bist du dir sicher, dass du diese Welt deiner \"Verbannte Welten\" Liste hinzufügen möchtest?\n\nWenn du OK auswählst, beendest du gleichzeitig dieses Spiel."; + Lang.inter[74] = "WARNUNG! Die Welt, die du gerade betrittst, befindet sich auf deiner \"Verbannte Welten\" Liste.\n\nWenn du dich dafür entscheidest, diese Welt zu besuchen, wird sie von deiner \"Verbannte Welten\" Liste gestrichen."; + Lang.inter[75] = "Fortfahren"; + Lang.inter[76] = "(In Erwartung der Bestaetigung)"; + Lang.inter[77] = "(Zensiert)"; + Lang.inter[78] = "Das gespeicherte Spiel \"{0}\" wurde von einem anderen Profil übertragen und wird nun gelöscht."; + Lang.inter[79] = "Durch die Nutzerinhalt-Einstellungen von einem der Profile wird das Spiel nun beendet."; + Lang.tip[0] = "Ausgerüstet im Vanity-Slot"; + Lang.tip[1] = "Keine Werte werden gewonnen"; + Lang.tip[2] = " Nahkampfschaden"; + Lang.tip[3] = " Fernkampfschaden"; + Lang.tip[4] = " Magischer Schaden"; + Lang.tip[5] = "% kritische Trefferchance"; + Lang.tip[6] = "Wahnsinnig schnell"; + Lang.tip[7] = "Sehr schnell"; + Lang.tip[8] = "Schnell"; + Lang.tip[9] = "Durchschnittlich"; + Lang.tip[10] = "Langsam"; + Lang.tip[11] = "Sehr langsam"; + Lang.tip[12] = "Extrem langsam"; + Lang.tip[13] = "Schneckentempo"; + Lang.tip[14] = "Kein Rückstoß"; + Lang.tip[15] = "Extrem schwacher Rückstoß"; + Lang.tip[16] = "Sehr schwacher Rückstoß"; + Lang.tip[17] = "Schwacher Rückstoß"; + Lang.tip[18] = "Mittlerer Rückstoß"; + Lang.tip[19] = "Starker Rückstoß"; + Lang.tip[20] = "Sehr starker Rückstoß"; + Lang.tip[21] = "Extrem starker Rückstoß"; + Lang.tip[22] = "Wahnsinniger Rückstoß"; + Lang.tip[23] = "Ausrüstbar"; + Lang.tip[24] = "Mode-Items"; + Lang.tip[25] = " Abwehr"; + Lang.tip[26] = "% Spitzhackenkraft"; + Lang.tip[27] = "% Axtkraft"; + Lang.tip[28] = "% Hammerkraft"; + Lang.tip[29] = "Stellt "; + Lang.tip[30] = " Leben wieder her"; + Lang.tip[31] = " Mana wieder her"; + Lang.tip[32] = "Verwendet "; + Lang.tip[33] = "Kann platziert werden"; + Lang.tip[34] = "Munition"; + Lang.tip[35] = "Verbrauchbar"; + Lang.tip[36] = "Material"; + Lang.tip[37] = " Minuten Dauer"; + Lang.tip[38] = " Sekunden Dauer"; + Lang.tip[39] = "% Schaden"; + Lang.tip[40] = "% Tempo"; + Lang.tip[41] = "% kritische Trefferchance"; + Lang.tip[42] = "% Manakosten"; + Lang.tip[43] = "% Größe"; + Lang.tip[44] = "% Projektiltempo"; + Lang.tip[45] = "% Rückstoß"; + Lang.tip[46] = "% Bewegungstempo"; + Lang.tip[47] = "% Nahkampftempo"; + Lang.tip[48] = "Bonus-Set: "; + Lang.tip[49] = "Verkaufspreis: "; + Lang.tip[50] = "Kaufpreis: "; + Lang.tip[51] = "Kein Wert"; + Lang.dt[0] = " konnte das Antidot nicht finden."; + Lang.dt[1] = " konnte das Feuer nicht löschen."; + Lang.dt[2] = " hat versucht, zu fliehen"; + Lang.dt[3] = " wurde abgeleckt"; + Buff.buffName[1] = "Obsidianhaut"; + Buff.buffTip[1] = "Immun gegen Lava"; + Buff.buffName[2] = "Wiederbelebung"; + Buff.buffTip[2] = "Belebt wieder"; + Buff.buffName[3] = "Wendigkeit"; + Buff.buffTip[3] = "Erhöht Bewegungstempo um 25%"; + Buff.buffName[4] = "Kiemen"; + Buff.buffTip[4] = "Wasser statt Luft atmen"; + Buff.buffName[5] = "Eisenhaut"; + Buff.buffTip[5] = "Erhöht die Abwehr um 8"; + Buff.buffName[6] = "Mana-Wiederherstellung"; + Buff.buffTip[6] = "Erhöhte Mana-Wiederherstellung"; + Buff.buffName[7] = "Magiekraft"; + Buff.buffTip[7] = "Erhöht magischen Schaden um 20%"; + Buff.buffName[8] = "Federsturz"; + Buff.buffTip[8] = "Zur Kontrolle der Sinkgeschwindigkeit Hoch oder Hinunter drücken"; + Buff.buffName[9] = "Höhlenforscher"; + Buff.buffTip[9] = "Zeigt den Fundort von Schatz und Erz"; + Buff.buffName[10] = "Unsichtbarkeit"; + Buff.buffTip[10] = "Macht unsichtbar"; + Buff.buffName[11] = "Glanz"; + Buff.buffTip[11] = "Strahlt Licht aus"; + Buff.buffName[12] = "Nachteule"; + Buff.buffTip[12] = "Erhöhte Nachtsicht"; + Buff.buffName[13] = "Kampf"; + Buff.buffTip[13] = "Erhöhte Feind-Spawnrate"; + Buff.buffName[14] = "Dornen"; + Buff.buffTip[14] = "Auch die Angreifer erleiden Schaden"; + Buff.buffName[15] = "Wasserlaufen"; + Buff.buffTip[15] = "HINUNTER drücken, um aufs Wasser zu gehen"; + Buff.buffName[16] = "Bogenschießen"; + Buff.buffTip[16] = "Um 20% erhöhter Pfeilschaden und -tempo"; + Buff.buffName[17] = "Jäger"; + Buff.buffTip[17] = "Zeigt die Position von Feinden"; + Buff.buffName[18] = "Gravitation"; + Buff.buffTip[18] = "Zum Umkehren der Schwerkraft HOCH oder HINUNTER drücken"; + Buff.buffName[19] = "Lichtkugel"; + Buff.buffTip[19] = "Eine magische Kugel, die Licht verströmt"; + Buff.buffName[20] = "Vergiftet"; + Buff.buffTip[20] = "Langsam entweicht das Leben"; + Buff.buffName[21] = "Krankheitstrank"; + Buff.buffTip[21] = "Kann keine Heil-Items mehr verbrauchen"; + Buff.buffName[22] = "Dunkelheit"; + Buff.buffTip[22] = "Schlechtere Sicht durch weniger Licht"; + Buff.buffName[23] = "Verflucht"; + Buff.buffTip[23] = "Kann keine Items verwenden"; + Buff.buffName[24] = "Flammenmeer!"; + Buff.buffTip[24] = "Langsam entweicht das Leben"; + Buff.buffName[25] = "Beschwipst"; + Buff.buffTip[25] = "Erhöhte Nahkampffähigkeiten, verminderte Abwehr"; + Buff.buffName[26] = "Kleine Stärkung"; + Buff.buffTip[26] = "Geringe Anhebung aller Werte"; + Buff.buffName[27] = "Fee"; + Buff.buffTip[27] = "Eine Fee folgt dir"; + Buff.buffName[28] = "Werwolf"; + Buff.buffTip[28] = "Körperliche Fähigkeiten sind gestiegen"; + Buff.buffName[29] = "Hellsehen"; + Buff.buffTip[29] = "Magiekräfte werden erhöht"; + Buff.buffName[30] = "Bluted"; + Buff.buffTip[30] = "Kann sich nicht mehr erholen"; + Buff.buffName[31] = "Verwirrt"; + Buff.buffTip[31] = "Bewegt sich in die falsche Richtung"; + Buff.buffName[32] = "Langsam"; + Buff.buffTip[32] = "Bewegungstempo ist herabgesetzt"; + Buff.buffName[33] = "Schwach"; + Buff.buffTip[33] = "Körperliche Leistungsfähigkeit ist reduziert"; + Buff.buffName[34] = "Meermenschen"; + Buff.buffTip[34] = "Können unter Wasser leicht atmen und sich bewegen "; + Buff.buffName[35] = "Zum Schweigen gebracht"; + Buff.buffTip[35] = "Kann keine Items nutzen, die Mana erfordern"; + Buff.buffName[36] = "Beschädigte Rüstung"; + Buff.buffTip[36] = "Die Abwehr ist um die Hälfte reduziert"; + Buff.buffName[37] = "Entsetzt"; + Buff.buffTip[37] = "Du hast etwas Schlimmes gesehen. Da gibt es keinen Weg dran vorbei."; + Buff.buffName[38] = "Die Zunge"; + Buff.buffTip[38] = "Du wirst in den Mund gesogen"; + Buff.buffName[39] = "Verfluchtes Inferno"; + Buff.buffTip[39] = "Leben geht verloren"; + Buff.buffName[40] = "Haustier-Meerschweinchen"; + Buff.buffTip[40] = "Zum Verlieben"; + Buff.buffName[41] = "Haustier-Schleim"; + Buff.buffTip[41] = "Ein echter Schleimball"; + Buff.buffName[42] = "Haustier-Tiphia"; + Buff.buffTip[42] = "Will alles, was süß ist"; + Buff.buffName[43] = "Haustier-Fledermaus"; + Buff.buffTip[43] = "Auf der Jagd nach Blut"; + Buff.buffName[44] = "Haustier-Werwolf"; + Buff.buffTip[44] = "Der beste Freund des Menschen"; + Buff.buffName[45] = "Haustier-Zombie"; + Buff.buffTip[45] = "Verspeist Gehirne"; + Main.tileName[13] = "Flasche"; + Main.tileName[14] = "Tabelle"; + Main.tileName[15] = "Stuhl"; + Main.tileName[16] = "Amboss"; + Main.tileName[17] = "Schmelzofen"; + Main.tileName[18] = "Werkbank"; + Main.tileName[26] = "Dämon-Altar"; + Main.tileName[77] = "Höllenschmiede"; + Main.tileName[86] = "Webstuhl"; + Main.tileName[94] = "Gärbottich"; + Main.tileName[96] = "Kochtopf"; + Main.tileName[101] = "Bücherregal"; + Main.tileName[106] = "Sägewerk"; + Main.tileName[114] = "Tüftler-Werkstatt"; + Main.tileName[133] = "Adamantitschmiede"; + Main.tileName[134] = "Mithrilamboss"; + } + else if (Lang.lang == 3) + { + Lang.misc[0] = "L'esercito dei goblin è stato sconfitto!"; + Lang.misc[1] = "L'esercito dei goblin si sta avvicinando da ovest!"; + Lang.misc[2] = "L'esercito dei goblin si sta avvicinando da est!"; + Lang.misc[3] = "L'esercito dei goblin è arrivato!"; + Lang.misc[4] = "La Legione gelo è stata sconfitta!"; + Lang.misc[5] = "La Legione gelo si sta avvicinando da ovest!"; + Lang.misc[6] = "La Legione gelo si sta avvicinando da est!"; + Lang.misc[7] = "La Legione gelo è arrivata!"; + Lang.misc[8] = "La Luna di Sangue sta sorgendo..."; + Lang.misc[9] = "Senti una presenza malvagia che ti sta guardando..."; + Lang.misc[10] = "Un freddo terribile ti attraversa la spina dorsale..."; + Lang.misc[11] = "Intorno a te echeggiano urla... "; + Lang.misc[12] = "Il tuo mondo è stato benedetto con cobalto! "; + Lang.misc[13] = "Il tuo mondo è stato benedetto con mitrilio! "; + Lang.misc[14] = "Il tuo mondo è stato benedetto con adamantio!"; + Lang.misc[15] = "I vecchi spiriti di luce e tenebre sono stati liberati. "; + Lang.misc[16] = " si è svegliato!"; + Lang.misc[17] = " è stato sconfitto!"; + Lang.misc[18] = " è arrivato!"; + Lang.misc[19] = " è stato ucciso..."; + Lang.misc[20] = "I gemelli"; + Lang.misc[21] = "Operazione non valida in questo stato."; + Lang.misc[22] = "Non stai utilizzando la stessa versione del server."; + Lang.misc[23] = "Giocatori correnti: "; + Lang.misc[24] = " ha attivato il PvP!"; + Lang.misc[25] = " ha disattivato il PvP!"; + Lang.misc[26] = " non è più in un gruppo."; + Lang.misc[27] = " si è unito al gruppo rosso."; + Lang.misc[28] = " si è unito al gruppo verde."; + Lang.misc[29] = " si è unito al gruppo blu."; + Lang.misc[30] = " si è unito al gruppo giallo."; + Lang.misc[31] = "Benevenuto, "; + Lang.misc[32] = " ha aderito."; + Lang.misc[33] = " ha smesso di."; + Lang.misc[34] = "I Gemelli si sono svegliati!"; + Lang.misc[35] = "I Gemelli sono stati sconfitti!"; + Lang.misc[36] = "Un meteorite è atterrato!"; + Lang.menu[0] = "Ingredienti"; + Lang.menu[1] = " nel tuo inventario)"; + Lang.menu[2] = "Disconnetti"; + Lang.menu[3] = "Attenzione!"; + Lang.menu[4] = "Quando questa icona è visibile\n\n\nla partita sta salvando i dati."; + Lang.menu[5] = "Errore!"; + Lang.menu[6] = "Gioca online"; + Lang.menu[7] = "Solo su invito"; + Lang.menu[8] = "Server trovato..."; + Lang.menu[9] = "Caricamento non riuscito!"; + Lang.menu[10] = "Inizia partita"; + Lang.menu[11] = "Crea Mondo"; + Lang.menu[12] = "Sono stati trovati ed eliminati dati del personaggio danneggiati."; + Lang.menu[13] = "Gioca"; + Lang.menu[14] = "Impostazioni"; + Lang.menu[15] = "Esci dal gioco"; + Lang.menu[16] = "Crea personaggio"; + Lang.menu[17] = (string) (object) '\x008A' + (object) "Elimina"; + Lang.menu[18] = "Capelli"; + Lang.menu[19] = "Occhi"; + Lang.menu[20] = "Pelle"; + Lang.menu[21] = "Abiti"; + Lang.menu[22] = "Maschio"; + Lang.menu[23] = "Femmina"; + Lang.menu[24] = "Hardcore"; + Lang.menu[25] = "Difficile"; + Lang.menu[26] = "Normale"; + Lang.menu[27] = "Casuale"; + Lang.menu[28] = "Crea"; + Lang.menu[29] = "Si muore per sempre"; + Lang.menu[30] = "Alla morte tutti gli oggetti vengono lasciati"; + Lang.menu[31] = "Alla morte tutte le monete vengono lasciate"; + Lang.menu[32] = "Livello di difficoltà"; + Lang.menu[33] = "Camicia"; + Lang.menu[34] = "Maglietta"; + Lang.menu[35] = "Pantaloni"; + Lang.menu[36] = "Scarpe"; + Lang.menu[37] = "Capelli"; + Lang.menu[38] = "Colore capelli"; + Lang.menu[39] = "Colore occhi"; + Lang.menu[40] = "Colore pelle"; + Lang.menu[41] = "Colore camicia"; + Lang.menu[42] = "Colore maglietta"; + Lang.menu[43] = "Colore pantaloni"; + Lang.menu[44] = "Colore scarpe"; + Lang.menu[45] = "Inserisci nome personaggio:"; + Lang.menu[46] = "Elimina "; + Lang.menu[47] = "Riconoscimenti"; + Lang.menu[48] = "Inserisci nome mondo:"; + Lang.menu[49] = "Te ne vai senza aver creato un personaggio?"; + Lang.menu[50] = "Seleziona personaggio"; + Lang.menu[51] = "Caricamento partita"; + Lang.menu[52] = "Premi START"; + Lang.menu[53] = "Nome personaggio"; + Lang.menu[54] = "Salvataggio personaggio"; + Lang.menu[55] = "Nome Mondo"; + Lang.menu[56] = "Mondo"; + Lang.menu[57] = "Punto di rigenerazione impostato!"; + Lang.menu[58] = "Distanza percorsa"; + Lang.menu[59] = "Risorse estratte e raccolte"; + Lang.menu[60] = "Oggetti creati"; + Lang.menu[61] = "Oggetti utilizzati"; + Lang.menu[62] = "Boss sconfitti in modalità normale"; + Lang.menu[63] = "Boss sconfitti in modalità hardmode"; + Lang.menu[64] = "Volte in cui sei morto"; + Lang.menu[65] = "Volume"; + Lang.menu[66] = "Non è stato selezionato nessun supporto di memoria. Il salvataggio è stato disabilitato."; + Lang.menu[67] = "Salvataggio automatico On"; + Lang.menu[68] = "Salvataggio automatico Off"; + Lang.menu[69] = "Nessun supporto di memoria"; + Lang.menu[70] = "Il supporto di memoria è stato rimosso. Il salvataggio è stato disabilitato."; + Lang.menu[71] = "Testo di collegamento On"; + Lang.menu[72] = "Testo di collegamento Off"; + Lang.menu[73] = "Richiesta informazioni mondo..."; + Lang.menu[74] = "Richiesta dati in cascata..."; + Lang.menu[75] = "Accettazione invito..."; + Lang.menu[76] = "Ricerca..."; + Lang.menu[77] = "Nessuna partita trovata"; + Lang.menu[78] = "Giocatori:"; + Lang.menu[79] = "~ VUOTO ~"; + Lang.menu[80] = "Entrando..."; + Lang.menu[81] = "PvP"; + Lang.menu[82] = "Squadra"; + Lang.menu[83] = "I tuoi Mondi"; + Lang.menu[84] = "Entra nella partita"; + Lang.menu[85] = "Profondità: "; + Lang.menu[86] = "m sotto"; + Lang.menu[87] = "m sopra"; + Lang.menu[88] = "livello"; + Lang.menu[89] = "Tutorial"; + Lang.menu[90] = "Ok"; + Lang.menu[91] = "Scegli grandezza del mondo:"; + Lang.menu[92] = "Piccolo"; + Lang.menu[93] = "Medio"; + Lang.menu[94] = "Grande"; + Lang.menu[95] = "Posizione: "; + Lang.menu[96] = "m ad est"; + Lang.menu[97] = "m ad ovest"; + Lang.menu[98] = "centro "; + Lang.menu[99] = "Salva gioco"; + Lang.menu[100] = "Esci dal menu principale"; + Lang.menu[101] = "Menu principale"; + Lang.menu[102] = "Sono stati trovati ed eliminati dati di impostazione danneggiati."; + Lang.menu[103] = "Sono stati trovati ed eliminati dati del mondo danneggiati."; + Lang.menu[104] = "Sì"; + Lang.menu[105] = "No"; + Lang.menu[106] = "Classifiche"; + Lang.menu[107] = "Obiettivi"; + Lang.menu[108] = "Guida e opzioni"; + Lang.menu[109] = "Sblocca gioco completo"; + Lang.menu[110] = "Come giocare"; + Lang.menu[111] = "Comandi"; + Lang.menu[112] = "Riprendi gioco"; + Lang.gen[0] = "Crea terreno del mondo..."; + Lang.gen[1] = "Aggiungi sabbia..."; + Lang.gen[2] = "Crea colline..."; + Lang.gen[3] = "Aggiungi terra dietro la terra..."; + Lang.gen[4] = "Posiziona rocce nella terra..."; + Lang.gen[5] = "Posiziona terra nelle rocce..."; + Lang.gen[6] = "Aggiungi argilla..."; + Lang.gen[7] = "Crea fori casuali..."; + Lang.gen[8] = "Crea piccole grotte: "; + Lang.gen[9] = "Crea grandi grotte..."; + Lang.gen[10] = "Crea grotte superficiali..."; + Lang.gen[11] = "Crea giungla..."; + Lang.gen[12] = "Crea isole fluttuanti..."; + Lang.gen[13] = "Aggiungi campi di funghi..."; + Lang.gen[14] = "Posiziona fango nella terra..."; + Lang.gen[15] = "Aggiungi fango..."; + Lang.gen[16] = "Aggiungi elementi luminosi..."; + Lang.gen[17] = "Aggiungi ragnatele..."; + Lang.gen[18] = "Crea sotterraneo..."; + Lang.gen[19] = "Aggiungi creature acquatiche..."; + Lang.gen[20] = "Rendi il mondo malvagio..."; + Lang.gen[21] = "Crea grotte montuose..."; + Lang.gen[22] = "Crea spiagge..."; + Lang.gen[23] = "Aggiungi gemme"; + Lang.gen[24] = "Ruota sabbia..."; + Lang.gen[25] = "Pulisci sfondi terra..."; + Lang.gen[26] = "Posiziona altari..."; + Lang.gen[27] = "Versa liquidi..."; + Lang.gen[28] = "Posiziona cristalli di vita..."; + Lang.gen[29] = "Posiziona statue..."; + Lang.gen[30] = "Nascondi tesori..."; + Lang.gen[31] = "Nascondi più tesori..."; + Lang.gen[32] = "Nascondi tesori nella giungla..."; + Lang.gen[33] = "Nascondi tesori in acqua..."; + Lang.gen[34] = "Disponi trappole..."; + Lang.gen[35] = "Disponi oggetti fragili..."; + Lang.gen[36] = "Disponi creazioni degli inferi..."; + Lang.gen[37] = "Estensione erba..."; + Lang.gen[38] = "Crescita cactus..."; + Lang.gen[39] = "Pianta girasoli..."; + Lang.gen[40] = "Pianta alberi..."; + Lang.gen[41] = "Pianta erbe..."; + Lang.gen[42] = "Pianta erbacce..."; + Lang.gen[43] = "Coltiva viti..."; + Lang.gen[44] = "Pianta fiori..."; + Lang.gen[45] = "Pianta funghi..."; + Lang.gen[46] = "Connessione all'host perduta."; + Lang.gen[47] = "Resetta oggetti di gioco..."; + Lang.gen[48] = "Imposta modalità difficile..."; + Lang.gen[49] = "Salva dati del mondo..."; + Lang.gen[50] = "Backup file mondo..."; + Lang.gen[51] = "Carica dati del mondo..."; + Lang.gen[52] = "Controlla l'allineamento delle mattonelle..."; + Lang.gen[53] = "Si è verificato un errore durante la lettura del supporto di memoria."; + Lang.gen[54] = "Si è verificato un errore durante la scrittura sul supporto di memoria."; + Lang.gen[55] = "Trova cornici delle mattonelle..."; + Lang.gen[56] = "Aggiungi neve ..."; + Lang.gen[57] = "Mondo"; + Lang.gen[58] = "Crea la dungeon..."; + Lang.inter[0] = "Cancella"; + Lang.inter[1] = "Esci senza salvare"; + Lang.inter[2] = "Salva ed esci"; + Lang.inter[3] = "Cestino"; + Lang.inter[4] = "Inventario"; + Lang.inter[5] = "Vuoi tornare al menu principale?"; + Lang.inter[6] = "Bonus"; + Lang.inter[7] = "Alloggio"; + Lang.inter[8] = "Questo alloggio non è adatto."; + Lang.inter[9] = "Accessori"; + Lang.inter[10] = " Difesa"; + Lang.inter[11] = "Estetica"; + Lang.inter[12] = "Casco"; + Lang.inter[13] = "Camicia"; + Lang.inter[14] = "Pantaloni"; + Lang.inter[15] = " platino "; + Lang.inter[16] = " oro "; + Lang.inter[17] = " argento "; + Lang.inter[18] = " rame"; + Lang.inter[19] = "Riforgiare"; + Lang.inter[20] = "Creazione sessione di rete non riuscita."; + Lang.inter[21] = "Partecipazione alla sessione non riuscita. La sessione è completa o non è stata trovata."; + Lang.inter[22] = "Oggetti richiesti:"; + Lang.inter[23] = "Nessuno"; + Lang.inter[24] = "Alterna la modalità di lotta"; + Lang.inter[25] = "Creazione Oggetti"; + Lang.inter[26] = "Monete"; + Lang.inter[27] = "Munizioni"; + Lang.inter[28] = "Negozio"; + Lang.inter[29] = (string) (object) '\x008C' + (object) "Saccheggia tutto"; + Lang.inter[30] = (string) (object) '\x008C' + (object) "Deposita tutto"; + Lang.inter[31] = (string) (object) '\x008C' + (object) "Raggruppamento rapido"; + Lang.inter[32] = "Salvadanaio"; + Lang.inter[33] = "Caveau"; + Lang.inter[34] = "Tempo: "; + Lang.inter[35] = "Sei sicuro di voler uscire?"; + Lang.inter[36] = "Connessione a Xbox LIVE perduta"; + Lang.inter[37] = "Numero di entrate: "; + Lang.inter[38] = "Sei morto..."; + Lang.inter[39] = "Questo alloggio è adatto."; + Lang.inter[40] = "Questo alloggio non è valido."; + Lang.inter[41] = "Questo alloggio è già occupato."; + Lang.inter[42] = "Questo alloggio è corrotto."; + Lang.inter[43] = "Questo profilo non possiede i privilegi adatti per entrare. È necessario avere un account LIVE Gold o cambiare le impostazioni per il controllo genitori. "; + Lang.inter[44] = "Ricezione dati in cascata"; + Lang.inter[45] = "Equipaggiamento"; + Lang.inter[46] = "Costo: "; + Lang.inter[47] = "Salva"; + Lang.inter[48] = "Modifica"; + Lang.inter[49] = "Stato"; + Lang.inter[50] = "Maledizione"; + Lang.inter[51] = "Aiuto"; + Lang.inter[52] = "Chiudi"; + Lang.inter[53] = "Acqua"; + Lang.inter[54] = "Guarire"; + Lang.inter[55] = "Offre consigli e suggerimenti sulla creazione."; + Lang.inter[56] = "Vende merce base."; + Lang.inter[57] = "Guarisce ferite e malus."; + Lang.inter[58] = "Vende esplosivi."; + Lang.inter[59] = "Vende merce naturale e indica lo stato del Mondo."; + Lang.inter[60] = "Vende pistole e munizioni."; + Lang.inter[61] = "Vende abiti."; + Lang.inter[62] = "Vende cavi e attrezzi."; + Lang.inter[63] = "Vende merce utile e riforgia oggetti."; + Lang.inter[64] = "Vende oggetti e accessori magici."; + Lang.inter[65] = "Un vecchio simpaticone."; + Lang.inter[66] = "Partita terminata"; + Lang.inter[67] = "La partita è stata terminata dall'host."; + Lang.inter[68] = "Impossibile connettersi a causa delle impostazioni di privacy di uno dei profili connessi."; + Lang.inter[69] = "Stai giocando in versione prova. Acquista la versione completa per giocare online."; + Lang.inter[70] = "Spazio insufficiente sul supporto di memoria selezionato."; + Lang.inter[71] = "Con la condivisione dello schermo in definizione standard è difficile leggere il testo durante la partita. Raccomandiamo quindi, di utilizzare l'alta definizione (HD) per un'esperienza di gioco migliore."; + Lang.inter[72] = "Blocca Mondo"; + Lang.inter[73] = "Sei sicuro di voler aggiungere questo Mondo alla tua lista dei Mondi bloccati?\n\nUscirai inoltre dalla partita, selezionando OK."; + Lang.inter[74] = "ATTENZIONE! Il Mondo in cui stai entrando, è presente nella tua lista dei Mondi bloccati.\n\nSe decidi di partecipare a questa partita, il Mondo verrà rimosso dalla tua lista dei Mondi bloccati."; + Lang.inter[75] = "Continua"; + Lang.inter[76] = "(In attesa di approvazione)"; + Lang.inter[77] = "(Censurato)"; + Lang.inter[78] = "Il Gioco Salvato \"{0}\" è stato trasferito da un altro profilo e sarà cancellato."; + Lang.inter[79] = "La partita finirà a causa delle impostazioni familiari di uno dei profili connessi."; + Lang.tip[0] = "Equipaggiato nella sezione di estetica"; + Lang.tip[1] = "Nessun parametro incrementato"; + Lang.tip[2] = " Danno da mischia"; + Lang.tip[3] = " Danno boomerang"; + Lang.tip[4] = " Danno magico"; + Lang.tip[5] = "% Possibilità colpo critico"; + Lang.tip[6] = "Velocità matta"; + Lang.tip[7] = "Extra velocità"; + Lang.tip[8] = "Alta velocità"; + Lang.tip[9] = "Media velocità"; + Lang.tip[10] = "Bassa velocità"; + Lang.tip[11] = "Velocità molto bassa"; + Lang.tip[12] = "Velocità extra bassa"; + Lang.tip[13] = "Velocità lumaca"; + Lang.tip[14] = "Nessuno spintone"; + Lang.tip[15] = "Spintone extra debole"; + Lang.tip[16] = "Spintone molto debole"; + Lang.tip[17] = "Spintone debole"; + Lang.tip[18] = "Spintone medio"; + Lang.tip[19] = "Spintone forte"; + Lang.tip[20] = "Spintone molto forte"; + Lang.tip[21] = "Spintone extra forte"; + Lang.tip[22] = "Spintone matto"; + Lang.tip[23] = "Equipaggiabili"; + Lang.tip[24] = "Oggetti di estetica"; + Lang.tip[25] = " Difesa"; + Lang.tip[26] = "% Potenza piccone"; + Lang.tip[27] = "% Potenza ascia"; + Lang.tip[28] = "% Potenza martello"; + Lang.tip[29] = "Risana "; + Lang.tip[30] = " vita"; + Lang.tip[31] = " mana"; + Lang.tip[32] = "Utilizza "; + Lang.tip[33] = "Può essere posizionato"; + Lang.tip[34] = "Munizioni"; + Lang.tip[35] = "Consumabile"; + Lang.tip[36] = "Materiale"; + Lang.tip[37] = " Durata minuto"; + Lang.tip[38] = " Durata secondo"; + Lang.tip[39] = "% Danno"; + Lang.tip[40] = "% Velocità"; + Lang.tip[41] = "% Possibilità colpo critico"; + Lang.tip[42] = "% Costo mana"; + Lang.tip[43] = "% Dimensione"; + Lang.tip[44] = "% Velocità del proiettile"; + Lang.tip[45] = "% Spintone"; + Lang.tip[46] = "% Velocità movimento"; + Lang.tip[47] = "% Velocità corpo a corpo"; + Lang.tip[48] = "Imposta bonus: "; + Lang.tip[49] = "Prezzo di vendita: "; + Lang.tip[50] = "Prezzo di acquisto: "; + Lang.tip[51] = "Nessun valore"; + Lang.dt[0] = " non ha trovato l'antidoto."; + Lang.dt[1] = " non ha spento il fuoco."; + Lang.dt[2] = " ha tentato di scappare."; + Lang.dt[3] = "è stato battuto. "; + Buff.buffName[1] = "Pelle ossidiana"; + Buff.buffTip[1] = "Immune alla lava"; + Buff.buffName[2] = "Rigenerazione"; + Buff.buffTip[2] = "Rigenera la vita"; + Buff.buffName[3] = "Velocità"; + Buff.buffTip[3] = "Velocità di movimento aumentata del 25%"; + Buff.buffName[4] = "Branchie"; + Buff.buffTip[4] = "Respira acqua invece di aria"; + Buff.buffName[5] = "Pelle di ferro"; + Buff.buffTip[5] = "Aumenta la difesa di 8"; + Buff.buffName[6] = "Rigenerazione mana"; + Buff.buffTip[6] = "Aumenta la rigenerazione del mana"; + Buff.buffName[7] = "Potere magico"; + Buff.buffTip[7] = "Danno magico aumentato del 20%"; + Buff.buffName[8] = "Cascata di piume"; + Buff.buffTip[8] = "Premi UP o DOWN per controllare la velocità di discesa"; + Buff.buffName[9] = "Speleologo"; + Buff.buffTip[9] = "Mostra l'ubicazione di tesori e minerali"; + Buff.buffName[10] = "Invisibilità"; + Buff.buffTip[10] = "Rende invisibili"; + Buff.buffName[11] = "Brillantezza"; + Buff.buffTip[11] = "Emette luce"; + Buff.buffName[12] = "Civetta notturna"; + Buff.buffTip[12] = "Visione notturna aumentata"; + Buff.buffName[13] = "Battaglia"; + Buff.buffTip[13] = "Ritmo generazione nemici aumentato"; + Buff.buffName[14] = "Spine"; + Buff.buffTip[14] = "Anche gli aggressori subiscono danni"; + Buff.buffName[15] = "Camminata nell'acqua"; + Buff.buffTip[15] = "Premi DOWN per entrare nell'acqua"; + Buff.buffName[16] = "Arco"; + Buff.buffTip[16] = "Danno e velocià freccia aumentati del 20%"; + Buff.buffName[17] = "Cacciatore"; + Buff.buffTip[17] = "Mostra la posizione dei nemici"; + Buff.buffName[18] = "Gravità"; + Buff.buffTip[18] = "Premi UP o DOWN per invertire la gravità"; + Buff.buffName[19] = "Orbita di luce"; + Buff.buffTip[19] = "Sfera magica che fornisce luce"; + Buff.buffName[20] = "Avvelenato"; + Buff.buffTip[20] = "Perdi lentamente la vita"; + Buff.buffName[21] = "Malattia pozione"; + Buff.buffTip[21] = "Non si possono più consumare oggetti curativi"; + Buff.buffName[22] = "Oscurità"; + Buff.buffTip[22] = "Visione della luce diminuita"; + Buff.buffName[23] = "Maledetto"; + Buff.buffTip[23] = "Non si possono più utilizzare oggetti"; + Buff.buffName[24] = "A fuoco!"; + Buff.buffTip[24] = "Perdi lentamente la vita"; + Buff.buffName[25] = "Brillo"; + Buff.buffTip[25] = "Abilità corpo a corpo aumentata, difesa abbassata"; + Buff.buffName[26] = "Ben nutrito"; + Buff.buffTip[26] = "Migliorie minori a tutti i parametri"; + Buff.buffName[27] = "Fata"; + Buff.buffTip[27] = "Una fata ti sta seguendo"; + Buff.buffName[28] = "Lupo mannaro"; + Buff.buffTip[28] = "Abilità fisiche aumentate"; + Buff.buffName[29] = "Chiaroveggenza"; + Buff.buffTip[29] = "Poteri magici aumentati"; + Buff.buffName[30] = "Sanguinamento"; + Buff.buffTip[30] = "Impossibile rigenerare vita"; + Buff.buffName[31] = "Confuso"; + Buff.buffTip[31] = "Movimento invertito"; + Buff.buffName[32] = "Lento"; + Buff.buffTip[32] = "Velocità movimento ridotta"; + Buff.buffName[33] = "Debole"; + Buff.buffTip[33] = "Abilità fisiche diminuite"; + Buff.buffName[34] = "Tritone"; + Buff.buffTip[34] = "Può respirare e muoversi facilmente sott'acqua"; + Buff.buffName[35] = "Tacere"; + Buff.buffTip[35] = "Non possono utilizzare gli elementi che richiedono mana"; + Buff.buffName[36] = "Armatura rotta"; + Buff.buffTip[36] = "La difesa è dimezzata"; + Buff.buffName[37] = "Inorridito"; + Buff.buffTip[37] = "Hai visto qualcosa di orribile, non c'è via di scampo."; + Buff.buffName[38] = "La Lingua"; + Buff.buffTip[38] = "Sei stato succhiato nella bocca"; + Buff.buffName[39] = "Inferno maledetto"; + Buff.buffTip[39] = "Perdi la vita"; + Buff.buffName[40] = "Porcellino d'India"; + Buff.buffTip[40] = "Semplicemente adorabile"; + Buff.buffName[41] = "Slime"; + Buff.buffTip[41] = "Una vera palla di slime"; + Buff.buffName[42] = "Vespa"; + Buff.buffTip[42] = "Vuole tutto il miele"; + Buff.buffName[43] = "Pipistrello"; + Buff.buffTip[43] = "A caccia di sangue"; + Buff.buffName[44] = "Lupo mannaro"; + Buff.buffTip[44] = "Il migliore amico dell'uomo"; + Buff.buffName[45] = "Zombie"; + Buff.buffTip[45] = "Mangia cervelli"; + Main.tileName[13] = "Bottiglia"; + Main.tileName[14] = "Tavolo"; + Main.tileName[15] = "Sedia"; + Main.tileName[16] = "Incudine"; + Main.tileName[17] = "Fornace"; + Main.tileName[18] = "Banco da lavoro"; + Main.tileName[26] = "Altare dei demoni"; + Main.tileName[77] = "Creazione degli inferi"; + Main.tileName[86] = "Telaio"; + Main.tileName[94] = "Barilotto"; + Main.tileName[96] = "Pentola"; + Main.tileName[101] = "Scaffale"; + Main.tileName[106] = "Segheria"; + Main.tileName[114] = "Laboratorio dell'inventore"; + Main.tileName[133] = "Forgia di adamantio"; + Main.tileName[134] = "Incudine di mitrilio"; + } + else if (Lang.lang == 4) + { + Lang.misc[0] = "L'armée des gobelins a été vaincue."; + Lang.misc[1] = "Une armée de gobelins approche par l'ouest."; + Lang.misc[2] = "Une armée de gobelins approche par l'est."; + Lang.misc[3] = "Une armée de gobelins est arrivée !"; + Lang.misc[4] = "La Légion gel a été vaincue !"; + Lang.misc[5] = "La Légion gel approche l'ouest !"; + Lang.misc[6] = "La Légion gel approche par l'est !"; + Lang.misc[7] = "La Légion gel est arrivée !"; + Lang.misc[8] = "La lune sanglante se lève..."; + Lang.misc[9] = "Vous sentez une présence maléfique vous observer..."; + Lang.misc[10] = "Un frisson vous parcourt le dos..."; + Lang.misc[11] = "Des cris retentissent autour de vous..."; + Lang.misc[12] = "Votre monde a la chance de profiter de ressources de cobalt."; + Lang.misc[13] = "Votre monde a la chance de profiter de ressources de mythril."; + Lang.misc[14] = "Votre monde a la chance de profiter de ressources d'adamantine."; + Lang.misc[15] = "Les anciens esprits de l'ombre et de la lumière ont été relâchés."; + Lang.misc[16] = " est réveillé."; + Lang.misc[17] = " a été vaincue."; + Lang.misc[18] = " est arrivée."; + Lang.misc[19] = " s'est fait éliminer..."; + Lang.misc[20] = "Les jumeaux"; + Lang.misc[21] = "Opération non valable en l'état."; + Lang.misc[22] = "Vous n'utilisez pas la même version que ce serveur."; + Lang.misc[23] = "Joueurs actuels : "; + Lang.misc[24] = " a activé le PvP."; + Lang.misc[25] = " a désactivé le PvP."; + Lang.misc[26] = " n'est plus dans une équipe."; + Lang.misc[27] = " a rejoint l'équipe rouge."; + Lang.misc[28] = " a rejoint l'équipe verte."; + Lang.misc[29] = " a rejoint l'équipe bleue."; + Lang.misc[30] = " a rejoint l'équipe jaune."; + Lang.misc[31] = "Bienvenue, "; + Lang.misc[32] = " a rejoint."; + Lang.misc[33] = " a quitté."; + Lang.misc[34] = "Les Jumeaux se sont réveillés !"; + Lang.misc[35] = "Les Jumeaux ont été vaincus !"; + Lang.misc[36] = "Une météorite a atterri !"; + Lang.menu[0] = "Ingrédients"; + Lang.menu[1] = "dans votre inventaire)"; + Lang.menu[2] = "Déconnexion"; + Lang.menu[3] = "Attention !"; + Lang.menu[4] = "Lorsque cette icône apparaît,\n\n\nle jeu est en cours de sauvegarde de données."; + Lang.menu[5] = "Erreur !"; + Lang.menu[6] = "Jouer en ligne"; + Lang.menu[7] = "Sur invitation seulement"; + Lang.menu[8] = "Serveur trouvé..."; + Lang.menu[9] = "Le chargement a échoué."; + Lang.menu[10] = "Démarrer jeu"; + Lang.menu[11] = "Créer un monde"; + Lang.menu[12] = "Des données avec des caractères corrompus ont été détectées et supprimées."; + Lang.menu[13] = "Jouer"; + Lang.menu[14] = "Paramètres"; + Lang.menu[15] = "Quitter le jeu"; + Lang.menu[16] = "Créer un personnage"; + Lang.menu[17] = (string) (object) '\x008A' + (object) "Supprimer"; + Lang.menu[18] = "Cheveux"; + Lang.menu[19] = "Yeux"; + Lang.menu[20] = "Peau"; + Lang.menu[21] = "Vêtements"; + Lang.menu[22] = "Homme"; + Lang.menu[23] = "Femme"; + Lang.menu[24] = "Hardcore"; + Lang.menu[25] = "Difficile"; + Lang.menu[26] = "Normal"; + Lang.menu[27] = "Aléatoire"; + Lang.menu[28] = "Créer"; + Lang.menu[29] = "La mort est définitive"; + Lang.menu[30] = "Perdre tous ses objets à la mort"; + Lang.menu[31] = "Perdre son argent à la mort"; + Lang.menu[32] = "Choisir la difficulté"; + Lang.menu[33] = "Chemise"; + Lang.menu[34] = "Maillot de corps"; + Lang.menu[35] = "Pantalon"; + Lang.menu[36] = "Chaussures"; + Lang.menu[37] = "Cheveux"; + Lang.menu[38] = "Couleur des cheveux"; + Lang.menu[39] = "Couleur des yeux"; + Lang.menu[40] = "Couleur de peau"; + Lang.menu[41] = "Couleur de chemise"; + Lang.menu[42] = "Couleur de maillot de corps"; + Lang.menu[43] = "Couleur de pantalon"; + Lang.menu[44] = "Couleur des chaussures"; + Lang.menu[45] = "Saisir le nom du personnage :"; + Lang.menu[46] = "Supprimer "; + Lang.menu[47] = "Crédits"; + Lang.menu[48] = "Saisir un nom de monde :"; + Lang.menu[49] = "Quitter sans créer de personnage ?"; + Lang.menu[50] = "Sélectionner un personnage"; + Lang.menu[51] = "En attente du démarrage du jeu..."; + Lang.menu[52] = "Appuyez sur START"; + Lang.menu[53] = "Nom du personnage"; + Lang.menu[54] = "Sauvegarde du personnage..."; + Lang.menu[55] = "Nom du monde"; + Lang.menu[56] = "Monde"; + Lang.menu[57] = "Point d'apparition défini !"; + Lang.menu[58] = "Distance parcourue"; + Lang.menu[59] = "Ressources extraites et collectées"; + Lang.menu[60] = "Objets fabriqués"; + Lang.menu[61] = "Objets utilisés"; + Lang.menu[62] = "Boss normaux vaincus"; + Lang.menu[63] = "Boss difficiles vaincus"; + Lang.menu[64] = "Nombre de fois mort(e)"; + Lang.menu[65] = "Volume"; + Lang.menu[66] = "La sauvegarde a été désactivée, car aucun périphérique de stockage n'a été sélectionné. "; + Lang.menu[67] = "Sauvegarde auto activée"; + Lang.menu[68] = "Sauvegarde auto désactivée"; + Lang.menu[69] = "Aucun périphérique de stockage"; + Lang.menu[70] = "La sauvegarde a été désactivée, car le périphérique de stockage a été retiré."; + Lang.menu[71] = "Affichage du texte activé"; + Lang.menu[72] = "Affichage du texte désactivé"; + Lang.menu[73] = "Demande d'informations du monde..."; + Lang.menu[74] = "Demande des données de tuiles..."; + Lang.menu[75] = "Acceptation de l'invitation..."; + Lang.menu[76] = "Recherche..."; + Lang.menu[77] = "Aucune partie trouvée"; + Lang.menu[78] = "Joueurs : "; + Lang.menu[79] = "~ VIDE ~"; + Lang.menu[80] = "Connexion à la partie..."; + Lang.menu[81] = "PvP"; + Lang.menu[82] = "Équipe"; + Lang.menu[83] = "Vos mondes"; + Lang.menu[84] = "Rejoindre la partie"; + Lang.menu[85] = "Profondeur : "; + Lang.menu[86] = "m en-dessous"; + Lang.menu[87] = "m au-dessus"; + Lang.menu[88] = "niveau"; + Lang.menu[89] = "Tutoriel"; + Lang.menu[90] = "OK"; + Lang.menu[91] = "Choisir la taille du monde :"; + Lang.menu[92] = "Petit"; + Lang.menu[93] = "Moyen"; + Lang.menu[94] = "Grand"; + Lang.menu[95] = "Position : "; + Lang.menu[96] = "m est"; + Lang.menu[97] = "m ouest"; + Lang.menu[98] = "centre"; + Lang.menu[99] = "Sauvegarder la partie"; + Lang.menu[100] = "Retour au menu principal"; + Lang.menu[101] = "Menu principal"; + Lang.menu[102] = "Les données des paramètres étaient corrompues et ont été supprimées."; + Lang.menu[103] = "Des données corrompues du monde ont été trouvées et supprimées."; + Lang.menu[104] = "Oui"; + Lang.menu[105] = "Pas"; + Lang.menu[106] = "Classements"; + Lang.menu[107] = "Succès"; + Lang.menu[108] = "Aide et options"; + Lang.menu[109] = "Déverrouiller le jeu complet"; + Lang.menu[110] = "Comment jouer"; + Lang.menu[111] = "Commandes"; + Lang.menu[112] = "Reprendre le jeu"; + Lang.gen[0] = "Création du terrain..."; + Lang.gen[1] = "Ajout de sable..."; + Lang.gen[2] = "Création des collines..."; + Lang.gen[3] = "Placement de la boue derrière la boue..."; + Lang.gen[4] = "Placement des rochers dans la boue..."; + Lang.gen[5] = "Placement de boue dans les rochers..."; + Lang.gen[6] = "Ajout d'argile..."; + Lang.gen[7] = "Création de trous aléatoires..."; + Lang.gen[8] = "Création de petites cavernes..."; + Lang.gen[9] = "Création de grandes cavernes..."; + Lang.gen[10] = "Création des cavernes en surface..."; + Lang.gen[11] = "Création de jungle..."; + Lang.gen[12] = "Création d'îles flottantes..."; + Lang.gen[13] = "Ajout des parcelles de champignons..."; + Lang.gen[14] = "Placement de la terre dans la boue..."; + Lang.gen[15] = "Ajout de limon..."; + Lang.gen[16] = "Ajout des brillances..."; + Lang.gen[17] = "Ajout de toiles d'araignées..."; + Lang.gen[18] = "Création du monde inférieur..."; + Lang.gen[19] = "Ajout d'étendues d'eau..."; + Lang.gen[20] = "Corruption du monde..."; + Lang.gen[21] = "Création de cavernes montagneuses..."; + Lang.gen[22] = "Création de plages..."; + Lang.gen[23] = "Ajout de gemmes..."; + Lang.gen[24] = "Gravitation du sable..."; + Lang.gen[25] = "Nettoyage d'arrière-plans de boue..."; + Lang.gen[26] = "Placement d'autels..."; + Lang.gen[27] = "Mise en place des points d'eau..."; + Lang.gen[28] = "Placement de cristaux de vie..."; + Lang.gen[29] = "Placement de statues..."; + Lang.gen[30] = "Dissimulation de trésors..."; + Lang.gen[31] = "Dissimulation de trésors supplémentaires..."; + Lang.gen[32] = "Dissimulation de trésors de jungle..."; + Lang.gen[33] = "Dissimulation de trésors d'eau..."; + Lang.gen[34] = "Placement de pièges..."; + Lang.gen[35] = "Placement d'objets cassables..."; + Lang.gen[36] = "Placement de forges infernales..."; + Lang.gen[37] = "Création de zone d'herbe..."; + Lang.gen[38] = "Faire pousser des cactus..."; + Lang.gen[39] = "Plantation de tournesols..."; + Lang.gen[40] = "Plantation d'arbres..."; + Lang.gen[41] = "Plantation d'herbe..."; + Lang.gen[42] = "Plantation de mauvaises herbes..."; + Lang.gen[43] = "Faire pousser des vignes..."; + Lang.gen[44] = "Plantation de fleurs..."; + Lang.gen[45] = "Plantation de champignons..."; + Lang.gen[46] = "La connexion à l'hôte a été perdue."; + Lang.gen[47] = "Réinitialisation des objets du jeu..."; + Lang.gen[48] = "Installation du mode difficile..."; + Lang.gen[49] = "Sauvegarde des données du monde..."; + Lang.gen[50] = "Sauvegarde du fichier du monde..."; + Lang.gen[51] = "Chargement des données du monde..."; + Lang.gen[52] = "Vérification de l'alignement des blocs..."; + Lang.gen[53] = "Une erreur est survenue lors de la lecture du périphérique de stockage."; + Lang.gen[54] = "Une erreur est survenue lors de l'écriture sur le périphérique de stockage."; + Lang.gen[55] = "Trouver les images de blocs..."; + Lang.gen[56] = "Ajout de neige..."; + Lang.menu[56] = "Monde"; + Lang.gen[58] = "Création de donjon..."; + Lang.inter[0] = "Annuler"; + Lang.inter[1] = "Quitter sans sauvegarder"; + Lang.inter[2] = "Sauvegarder et quitter"; + Lang.inter[3] = "Poubelle"; + Lang.inter[4] = "Inventaire"; + Lang.inter[5] = "Voulez-vous retourner au menu principal ?"; + Lang.inter[6] = "Buffs"; + Lang.inter[7] = "Logement"; + Lang.inter[8] = "Ce logement n'est pas approprié."; + Lang.inter[9] = "Accessoires"; + Lang.inter[10] = " Défense"; + Lang.inter[11] = "Vanité"; + Lang.inter[12] = "Casque"; + Lang.inter[13] = "Chemise"; + Lang.inter[14] = "Pantalon"; + Lang.inter[15] = " Platine "; + Lang.inter[16] = " Or "; + Lang.inter[17] = " Argent "; + Lang.inter[18] = " Cuivre"; + Lang.inter[19] = "Reforger"; + Lang.inter[20] = "La création d'une session en réseau a échoué."; + Lang.inter[21] = "Impossible de rejoindre la session, car elle est pleine ou introuvable."; + Lang.inter[22] = "Objets requis :"; + Lang.inter[23] = "Aucun"; + Lang.inter[24] = "Alterner le mode grappin"; + Lang.inter[25] = "Artisanat"; + Lang.inter[26] = "Pièces"; + Lang.inter[27] = "Munitions"; + Lang.inter[28] = "Magasin"; + Lang.inter[29] = (string) (object) '\x008C' + (object) "Tout récupérer"; + Lang.inter[30] = (string) (object) '\x008C' + (object) "Tout déposer"; + Lang.inter[31] = (string) (object) '\x008C' + (object) "Pile rapide"; + Lang.inter[32] = "Tirelire"; + Lang.inter[33] = "Coffre-fort"; + Lang.inter[34] = "Temps : "; + Lang.inter[35] = "Voulez-vous vraiment quitter ?"; + Lang.inter[36] = "La connexion à la Xbox LIVE a été perdue"; + Lang.inter[37] = "Nombre d'entrées : "; + Lang.inter[38] = "Vous vous êtes fait exterminer..."; + Lang.inter[39] = "Ce logement convient."; + Lang.inter[40] = "Ce logement ne convient pas."; + Lang.inter[41] = "Ce logement est déjà occupé."; + Lang.inter[42] = "Ce logement est corrompu."; + Lang.inter[43] = "Ce profil du joueur ne dispose pas des privilèges pour se connecter. Il est possible qu'un compte LIVE Gold soit requis, ou que vous deviez changer les paramètres de contrôle parental."; + Lang.inter[44] = "Réception de données de blocs"; + Lang.inter[45] = "équiper"; + Lang.inter[46] = "Coût: "; + Lang.inter[47] = "Enregistrer"; + Lang.inter[48] = "Modifier"; + Lang.inter[49] = "État"; + Lang.inter[50] = "Malédiction"; + Lang.inter[51] = "Aide"; + Lang.inter[52] = "Proches"; + Lang.inter[53] = "De l'eau"; + Lang.inter[54] = "Guérir"; + Lang.inter[55] = "Fournit des astuces et des conseils d'artisanat."; + Lang.inter[56] = "Vend des marchandises de base."; + Lang.inter[57] = "Guérit les blessures et les debuffs."; + Lang.inter[58] = "Vend des explosifs."; + Lang.inter[59] = "Vend des produits naturels et renseigne sur l'état du monde."; + Lang.inter[60] = "Vend des armes à feu et des munitions."; + Lang.inter[61] = "Vend des vêtements de vanité."; + Lang.inter[62] = "Vend des outils et des câbles."; + Lang.inter[63] = "Vend des gadgets utiles et reforge des objets."; + Lang.inter[64] = "Vend des objets et accessoires magiques."; + Lang.inter[65] = "Un vieu bonhomme joyeux."; + Lang.inter[66] = "Partie terminée"; + Lang.inter[67] = "L'hôte a mis fin à la partie."; + Lang.inter[68] = "Impossible de rejoindre la partie, car les privilèges sont bloqués pour l'un des profils connectés."; + Lang.inter[69] = "Vous jouez actuellement à la version d'essai. Veuillez acheter le jeu complet pour pouvoir jouer en ligne."; + Lang.inter[70] = "Il n'y a pas assez d'espace libre sur le périphérique de stockage sélectionné."; + Lang.inter[71] = "Jouer sur un écran divisé en mode vidéo définition standard rendra le texte du jeu difficile à lire. Pour une expérience de jeu optimale, la haute définition (HD) est fortement conseillée."; + Lang.inter[72] = "Bannir un monde"; + Lang.inter[73] = "Voulez-vous vraiment ajouter ce monde à votre liste de mondes bannis?\n\nSi vous sélectionnez OK, vous quitterez cette partie."; + Lang.inter[74] = "AVERTISSEMENT ! Le monde auquel vous vous joignez est sur votre liste de mondes bannis.\n\nSi vous décidez de rejoindre cette partie, le monde sera supprimé de votre liste."; + Lang.inter[75] = "Continuer"; + Lang.inter[76] = "(En attente d'approbation)"; + Lang.inter[77] = "(Censuré)"; + Lang.inter[78] = "La partie enregistrée \"{0}\" a été transféré d'un autre profil et sera supprimée."; + Lang.inter[79] = "La partie va se terminer en raison des paramètres de contenu des membres de l'un des profils connectés."; + Lang.tip[0] = "Équipé dans un emplacement Vanité"; + Lang.tip[1] = "Ne procure pas de stats"; + Lang.tip[2] = " de dégâts de mêlée"; + Lang.tip[3] = " de dégâts à distance"; + Lang.tip[4] = " de dégâts magiques"; + Lang.tip[5] = "% de chance de coup critique"; + Lang.tip[6] = "Vitesse insensée"; + Lang.tip[7] = "Vitesse très rapide"; + Lang.tip[8] = "Vitesse rapide"; + Lang.tip[9] = "Vitesse moyenne"; + Lang.tip[10] = "Vitesse lente"; + Lang.tip[11] = "Vitesse très lente"; + Lang.tip[12] = "Vitesse extrêmement lente"; + Lang.tip[13] = "Vitesse d'escargot"; + Lang.tip[14] = "Pas de recul"; + Lang.tip[15] = "Recul extrêmement faible"; + Lang.tip[16] = "Recul très faible"; + Lang.tip[17] = "Recul faible"; + Lang.tip[18] = "Recul moyen"; + Lang.tip[19] = "Fort recul"; + Lang.tip[20] = "Très fort recul"; + Lang.tip[21] = "Recul extrêmement fort"; + Lang.tip[22] = "Recul ahurissant"; + Lang.tip[23] = "Équipable"; + Lang.tip[24] = "Objets de vanité"; + Lang.tip[25] = " de défense"; + Lang.tip[26] = "% de puissance de pioche"; + Lang.tip[27] = "% de puissance de hache"; + Lang.tip[28] = "% de puissance de marteau"; + Lang.tip[29] = "Redonne "; + Lang.tip[30] = " de vie"; + Lang.tip[31] = " de mana"; + Lang.tip[32] = "Consomme "; + Lang.tip[33] = "Peut être placé"; + Lang.tip[34] = "Munitions"; + Lang.tip[35] = "Consommable"; + Lang.tip[36] = "Matériau"; + Lang.tip[37] = " Durée minute"; + Lang.tip[38] = " Durée seconde"; + Lang.tip[39] = "% de dégâts"; + Lang.tip[40] = "% de vélocité"; + Lang.tip[41] = "% de chance de coup critique"; + Lang.tip[42] = "% de coût de mana"; + Lang.tip[43] = "% de taille"; + Lang.tip[44] = "% de vitesse de projectile"; + Lang.tip[45] = "% de recul"; + Lang.tip[46] = "% de vitesse de déplacement"; + Lang.tip[47] = "% de vitesse de mêlée"; + Lang.tip[48] = "Bonus de collection : "; + Lang.tip[49] = "Prix de vente : "; + Lang.tip[50] = "Prix d'achat : "; + Lang.tip[51] = "Aucune valeur"; + Lang.dt[0] = " n'a pas trouvé l'antidote."; + Lang.dt[1] = " n'a pas réussi à éteindre l'incendie."; + Lang.dt[2] = " a essayé de s'échapper."; + Lang.dt[3] = " s'est fait lécher."; + Buff.buffName[1] = "Peau d'obsidienne"; + Buff.buffTip[1] = "Immunise contre la lave"; + Buff.buffName[2] = "Régénération"; + Buff.buffTip[2] = "Régénère la vie"; + Buff.buffName[3] = "Rapidité"; + Buff.buffTip[3] = "Vitesse de déplacement augmentée de 25 %"; + Buff.buffName[4] = "Branchies"; + Buff.buffTip[4] = "Permet de respirer sous l'eau comme dans l'air"; + Buff.buffName[5] = "Peau de fer"; + Buff.buffTip[5] = "Augmente la défense de 8"; + Buff.buffName[6] = "Régénération de mana"; + Buff.buffTip[6] = "Régénération de mana augmentée"; + Buff.buffName[7] = "Pouvoir magique"; + Buff.buffTip[7] = "Dégâts magiques augmentés de 20 %"; + Buff.buffName[8] = "Poids plume"; + Buff.buffTip[8] = "Appuyer sur Bas ou Haut pour contrôler la vitesse de descente"; + Buff.buffName[9] = "Spéléologue"; + Buff.buffTip[9] = "Indique l'emplacement des trésors et du minerai"; + Buff.buffName[10] = "Invisibilité"; + Buff.buffTip[10] = "Procure l'invisibilité"; + Buff.buffName[11] = "Brillance"; + Buff.buffTip[11] = "Émet une aura de lumière"; + Buff.buffName[12] = "Vision nocturne"; + Buff.buffTip[12] = "Améliore la vision de nuit"; + Buff.buffName[13] = "Bataille"; + Buff.buffTip[13] = "Augmente la vitesse d'apparition des ennemis"; + Buff.buffName[14] = "Épines"; + Buff.buffTip[14] = "Les attaquants subissent aussi des dégâts"; + Buff.buffName[15] = "Marche sur l'eau"; + Buff.buffTip[15] = "Appuyer sur Bas pour entrer dans l'eau"; + Buff.buffName[16] = "Tir à l'arc"; + Buff.buffTip[16] = "La vitesse et les dégâts des flèches augmentent de 20 %"; + Buff.buffName[17] = "Chasseur"; + Buff.buffTip[17] = "Indique l'emplacement des ennemis"; + Buff.buffName[18] = "Gravitation"; + Buff.buffTip[18] = "Appuyer sur Haut ou Bas pour inverser la gravité"; + Buff.buffName[19] = "Orbe de lumière"; + Buff.buffTip[19] = "Un orbe magique qui émet de la lumière"; + Buff.buffName[20] = "Empoisonnement"; + Buff.buffTip[20] = "Perte lente de vie"; + Buff.buffName[21] = "Maladie des potions"; + Buff.buffTip[21] = "Ne peut plus consommer de potions de soin"; + Buff.buffName[22] = "Obscurité"; + Buff.buffTip[22] = "Diminue la vision de nuit"; + Buff.buffName[23] = "Malédiction"; + Buff.buffTip[23] = "Ne peut utiliser aucun objet"; + Buff.buffName[24] = "En feu !"; + Buff.buffTip[24] = "Perte lente de vie"; + Buff.buffName[25] = "Ivresse"; + Buff.buffTip[25] = "Aptitudes de mêlée augmentées, défense réduite"; + Buff.buffName[26] = "Bien nourri"; + Buff.buffTip[26] = "Amélioration mineure de toutes les stats."; + Buff.buffName[27] = "Fée"; + Buff.buffTip[27] = "Une fée vous suit"; + Buff.buffName[28] = "Loup-garou"; + Buff.buffTip[28] = "Les aptitudes physiques sont augmentées"; + Buff.buffName[29] = "Clairvoyance"; + Buff.buffTip[29] = "Les pouvoirs magiques sont augmentés"; + Buff.buffName[30] = "Saignement"; + Buff.buffTip[30] = "Ne peut régénérer la vie"; + Buff.buffName[31] = "Confusion"; + Buff.buffTip[31] = "Les mouvements sont inversés"; + Buff.buffName[32] = "Ralentissement"; + Buff.buffTip[32] = "La vitesse de déplacement est réduite"; + Buff.buffName[33] = "Faiblesse"; + Buff.buffTip[33] = "Les aptitudes physiques sont diminuées"; + Buff.buffName[34] = "Peuple des mers"; + Buff.buffTip[34] = "Peut respirer et se déplacer sous l'eau facilement"; + Buff.buffName[35] = "Silencieux"; + Buff.buffTip[35] = "Ne peut pas utiliser des éléments qui nécessitent de mana"; + Buff.buffName[36] = "Armure brisée"; + Buff.buffTip[36] = "La défense est réduite de moitié"; + Buff.buffName[37] = "Peur panique"; + Buff.buffTip[37] = "Vous avez vu quelque chose de terrible et vous ne pouvez vous échapper."; + Buff.buffName[38] = "La langue"; + Buff.buffTip[38] = "Vous vous êtes fait aspirer dans la bouche"; + Buff.buffName[39] = "Brasier maudit"; + Buff.buffTip[39] = "Perte de vie"; + Buff.buffName[40] = "Cochon d'Inde de compagnie"; + Buff.buffTip[40] = "Simplement adorable"; + Buff.buffName[41] = "Slime de compagnie"; + Buff.buffTip[41] = "Un vrai pot de colle"; + Buff.buffName[42] = "Tiphia de compagnie"; + Buff.buffTip[42] = "Veut récupérer tout le miel"; + Buff.buffName[43] = "Chauve-souris de compagnie"; + Buff.buffTip[43] = "Veut du sang"; + Buff.buffName[44] = "Loup-garou de compagnie"; + Buff.buffTip[44] = "Le meilleur ami de l'homme"; + Buff.buffName[45] = "Zombie de compagnie"; + Buff.buffTip[45] = "Mange de la cervelle"; + Main.tileName[13] = "Bouteille"; + Main.tileName[14] = "Table"; + Main.tileName[15] = "Chaise"; + Main.tileName[16] = "Enclume"; + Main.tileName[17] = "Fournaise"; + Main.tileName[18] = "Établi"; + Main.tileName[26] = "Autel de démon"; + Main.tileName[77] = "Forge infernale"; + Main.tileName[86] = "Métier à tisser"; + Main.tileName[94] = "Tonnelet"; + Main.tileName[96] = "Marmite"; + Main.tileName[101] = "Bibliothèque"; + Main.tileName[106] = "Scierie"; + Main.tileName[114] = "Atelier du bricoleur"; + Main.tileName[133] = "Forge en adamantine"; + Main.tileName[134] = "Enclume en mythril"; + } + else + { + if (Lang.lang != 5) + return; + Lang.misc[0] = "¡El ejército de duendes ha sido derrotado!"; + Lang.misc[1] = "¡Un ejército de duendes se aproxima por el oeste!"; + Lang.misc[2] = "¡Un ejército de duendes se aproxima por el este!"; + Lang.misc[3] = "¡Un ejército duende ha llegado!"; + Lang.misc[4] = "¡La Legión de hielo ha sido derrotada!"; + Lang.misc[5] = "¡La Legión de hielo se aproxima desde el oeste!"; + Lang.misc[6] = "¡La Legión de hielo se aproxima desde el este!"; + Lang.misc[7] = "¡La Legión de hielo ha llegado!"; + Lang.misc[8] = "La luna de sangre está saliendo..."; + Lang.misc[9] = "Sientes que una presencia maligna te observa..."; + Lang.misc[10] = "Sientes un horrible escalofrío por la espalda..."; + Lang.misc[11] = "El eco de los alaridos suena por todas partes..."; + Lang.misc[12] = "¡Tu mundo ha sido bendecido con cobalto!"; + Lang.misc[13] = "¡Tu mundo ha sido bendecido con mithril!"; + Lang.misc[14] = "¡Tu mundo ha sido bendecido con adamantita!"; + Lang.misc[15] = "Los ancestrales espíritus de la luz y la oscuridad han sido liberados."; + Lang.misc[16] = " se despertó."; + Lang.misc[17] = " ha caído en combate."; + Lang.misc[18] = " llegó."; + Lang.misc[19] = " fue asesinado..."; + Lang.misc[20] = "Los Gemelos"; + Lang.misc[21] = "Operación no válida en este estado."; + Lang.misc[22] = "No tienes la misma versión que este servidor."; + Lang.misc[23] = "Jugadores conectados: "; + Lang.misc[24] = " ha activado PvP!"; + Lang.misc[25] = " ha desactivado PvP!"; + Lang.misc[26] = " ya no pertenece a ningún bando."; + Lang.misc[27] = " se ha unido al bando rojo."; + Lang.misc[28] = " se ha unido al bando verde."; + Lang.misc[29] = " se ha unido al bando azul."; + Lang.misc[30] = " se ha unido al bando amarillo."; + Lang.misc[31] = "Bienvenido, "; + Lang.misc[32] = " se ha unido."; + Lang.misc[33] = " se ha marchado."; + Lang.misc[34] = "¡Los gemelos se han despertado!"; + Lang.misc[35] = "¡Los gemelos han sido derrotados!"; + Lang.misc[36] = "¡Ha caído un meteorito!"; + Lang.menu[0] = "Ingredientes"; + Lang.menu[1] = " en el inventario)"; + Lang.menu[2] = "Desconectar"; + Lang.menu[3] = "¡Atención!"; + Lang.menu[4] = "Cuando veas este icono\n\n\nel juego está guardando datos."; + Lang.menu[5] = "¡Error!"; + Lang.menu[6] = "Jugar en línea"; + Lang.menu[7] = "Solo por invitación"; + Lang.menu[8] = "Se ha encontrado un servidor..."; + Lang.menu[9] = "¡Error al cargar!"; + Lang.menu[10] = "Iniciar juego"; + Lang.menu[11] = "Crear mundo"; + Lang.menu[12] = "Se ha encontrado un personaje dañado y se ha eliminado."; + Lang.menu[13] = "Jugar"; + Lang.menu[14] = "Configuración"; + Lang.menu[15] = "Salir del juego"; + Lang.menu[16] = "Crear personaje"; + Lang.menu[17] = (string) (object) '\x008A' + (object) "Eliminar"; + Lang.menu[18] = "Pelo"; + Lang.menu[19] = "Ojos"; + Lang.menu[20] = "Piel"; + Lang.menu[21] = "Ropa"; + Lang.menu[22] = "Hombre"; + Lang.menu[23] = "Mujer"; + Lang.menu[24] = "Hardcore"; + Lang.menu[25] = "Dificultad"; + Lang.menu[26] = "Normal"; + Lang.menu[27] = "Al azar"; + Lang.menu[28] = "Crear"; + Lang.menu[29] = "La muerte es para siempre"; + Lang.menu[30] = "Suelta todos los objetos al morir"; + Lang.menu[31] = "Suelta el dinero al morir"; + Lang.menu[32] = "Seleccionar dificultad"; + Lang.menu[33] = "Camisa"; + Lang.menu[34] = "Camiseta"; + Lang.menu[35] = "Pantalones"; + Lang.menu[36] = "Zapatos"; + Lang.menu[37] = "Pelo"; + Lang.menu[38] = "Color de pelo"; + Lang.menu[39] = "Color de ojos"; + Lang.menu[40] = "Color de piel"; + Lang.menu[41] = "Color de la camisa"; + Lang.menu[42] = "Color de la camiseta"; + Lang.menu[43] = "Color de los pantalones"; + Lang.menu[44] = "Color de los zapatos"; + Lang.menu[45] = "Escribir nombre del personaje:"; + Lang.menu[46] = "Eliminar "; + Lang.menu[47] = "Créditos"; + Lang.menu[48] = "Escribir nombre del mundo:"; + Lang.menu[49] = "¿Quieres salir sin crear un personaje?"; + Lang.menu[50] = "Elige un personaje"; + Lang.menu[51] = "Esperando que empiece el juego..."; + Lang.menu[52] = "Pulsa START"; + Lang.menu[53] = "Nombre del personaje"; + Lang.menu[54] = "Guardando personaje..."; + Lang.menu[55] = "Nombre del mundo"; + Lang.menu[56] = "Mundo"; + Lang.menu[57] = "¡Punto de resurreción establecido!"; + Lang.menu[58] = "Distancia recorrida"; + Lang.menu[59] = "Recursos extraídos de la mina y almacenados"; + Lang.menu[60] = "Objetos creados"; + Lang.menu[61] = "Objetos usados"; + Lang.menu[62] = "Enemigos finales normales derrotados"; + Lang.menu[63] = "Enemigos finales del modo difícil derrotados"; + Lang.menu[64] = "Número de muertes"; + Lang.menu[65] = "Volumen"; + Lang.menu[66] = "No se ha seleccionado ningún dispositivo de almacenamiento."; + Lang.menu[67] = "Autoguardado activado"; + Lang.menu[68] = "Autoguardado desactivado"; + Lang.menu[69] = "No hay dispositivo de almacenamiento"; + Lang.menu[70] = "Se ha extraído el dispositivo de almacenamiento. Se ha desactivado la función de guardado."; + Lang.menu[71] = "Sugerencias activadas"; + Lang.menu[72] = "Sugerencias desactivadas"; + Lang.menu[73] = "Obteniendo información del mundo..."; + Lang.menu[74] = "Obteniendo datos del título..."; + Lang.menu[75] = "Aceptando invitación..."; + Lang.menu[76] = "Buscando..."; + Lang.menu[77] = "No se han encontrado juegos"; + Lang.menu[78] = "Jugadores: "; + Lang.menu[79] = "~ VACÍO ~"; + Lang.menu[80] = "Uniéndose al juego..."; + Lang.menu[81] = "PvP"; + Lang.menu[82] = "Equipo"; + Lang.menu[83] = "Tus mundos"; + Lang.menu[84] = "Unirse al juego"; + Lang.menu[85] = "Profundidad: "; + Lang.menu[86] = "m. hacia abajo"; + Lang.menu[87] = "m. hacia arriba"; + Lang.menu[88] = "nivel"; + Lang.menu[89] = "Tutorial"; + Lang.menu[90] = "Aceptar"; + Lang.menu[91] = "Elegir tamaño del mundo:"; + Lang.menu[92] = "Pequeño"; + Lang.menu[93] = "Mediano"; + Lang.menu[94] = "Grande"; + Lang.menu[95] = "Posición: "; + Lang.menu[96] = "m este"; + Lang.menu[97] = "m oeste"; + Lang.menu[98] = "centro"; + Lang.menu[99] = "Guardar juego"; + Lang.menu[100] = "Salir al menú principal"; + Lang.menu[101] = "Menú principal"; + Lang.menu[102] = "Los datos de configuración estaban dañados y se han eliminado."; + Lang.menu[103] = "Se han encontrado datos de mundo dañados y se han eliminado."; + Lang.menu[104] = "Sí"; + Lang.menu[105] = "No"; + Lang.menu[106] = "Marcadores"; + Lang.menu[107] = "Logros"; + Lang.menu[108] = "Ayuda y opciones"; + Lang.menu[109] = "Desbloquear juego completo"; + Lang.menu[110] = "Cómo se juega"; + Lang.menu[111] = "Controles"; + Lang.menu[112] = "Reanudar juego"; + Lang.gen[0] = "Generando terreno del mundo..."; + Lang.gen[1] = "Añadiendo arena..."; + Lang.gen[2] = "Generando colinas..."; + Lang.gen[3] = "Amontonando tierra..."; + Lang.gen[4] = "Añadiendo rocas a la tierra..."; + Lang.gen[5] = "Añadiendo tierra a las rocas..."; + Lang.gen[6] = "Añadiendo arcilla..."; + Lang.gen[7] = "Generando agujeros aleatorios..."; + Lang.gen[8] = "Generando cuevas pequeñas..."; + Lang.gen[9] = "Generando cuevas grandes..."; + Lang.gen[10] = "Generando cuevas en la superficie..."; + Lang.gen[11] = "Generando selva..."; + Lang.gen[12] = "Generando islas flotantes..."; + Lang.gen[13] = "Añadiendo parcelas de champiñones..."; + Lang.gen[14] = "Añadiendo lodo a la tierra..."; + Lang.gen[15] = "Añadiendo cieno..."; + Lang.gen[16] = "Añadiendo tesoros..."; + Lang.gen[17] = "Añadiendo telas de araña..."; + Lang.gen[18] = "Creando Inframundo..."; + Lang.gen[19] = "Añadiendo cursos de agua..."; + Lang.gen[20] = "Corrompiendo el mundo..."; + Lang.gen[21] = "Generando cuevas en montañas..."; + Lang.gen[22] = "Creando playas..."; + Lang.gen[23] = "Añadiendo gemas..."; + Lang.gen[24] = "Gravitando arena..."; + Lang.gen[25] = "Limpiando de tierra los entornos..."; + Lang.gen[26] = "Colocando altares..."; + Lang.gen[27] = "Distribuyendo líquidos..."; + Lang.gen[28] = "Colocando cristales de vida..."; + Lang.gen[29] = "Colocando estatuas..."; + Lang.gen[30] = "Ocultando tesoro..."; + Lang.gen[31] = "Ocultando más tesoros..."; + Lang.gen[32] = "Ocultando tesoro en la selva..."; + Lang.gen[33] = "Ocultando tesoro en el agua..."; + Lang.gen[34] = "Colocando trampas..."; + Lang.gen[35] = "Colocando objetos quebradizos..."; + Lang.gen[36] = "Colocando forjas infernales..."; + Lang.gen[37] = "Plantando césped..."; + Lang.gen[38] = "Plantando cactus..."; + Lang.gen[39] = "Plantando girasoles..."; + Lang.gen[40] = "Plantando árboles..."; + Lang.gen[41] = "Plantando hierbas..."; + Lang.gen[42] = "Plantando hierbajos..."; + Lang.gen[43] = "Plantando enredaderas..."; + Lang.gen[44] = "Plantando flores..."; + Lang.gen[45] = "Cultivando champiñones..."; + Lang.gen[46] = "Se ha perdido la conexión con el anfitrión."; + Lang.gen[47] = "Reiniciando objetos del juego..."; + Lang.gen[48] = "Estableciendo modo Difícil..."; + Lang.gen[49] = "Guardando datos del mundo..."; + Lang.gen[50] = "Copia de seguridad del archivo del mundo..."; + Lang.gen[51] = "Cargando datos del mundo..."; + Lang.gen[52] = "Comprobando alineación de la cuadrícula..."; + Lang.gen[53] = "Se ha producido un error al leer del dispositivo de almacenamiento."; + Lang.gen[54] = "Se ha producido un error al escribir en el dispositivo de almacenamiento."; + Lang.gen[55] = "Encontrando bordes de la cuadrícula..."; + Lang.gen[56] = "Adición de nieve ..."; + Lang.gen[57] = "Mundo"; + Lang.gen[58] = "Creando mazmorra..."; + Lang.inter[0] = "Cancelar"; + Lang.inter[1] = "Salir sin guardar"; + Lang.inter[2] = "Guardar y salir"; + Lang.inter[3] = "Papelera"; + Lang.inter[4] = "Inventario"; + Lang.inter[5] = "¿Quieres volver al menú principal?"; + Lang.inter[6] = "Potenciadores"; + Lang.inter[7] = "Vivienda"; + Lang.inter[8] = "Esta casa no cumple los requisitos."; + Lang.inter[9] = "Accesorios"; + Lang.inter[10] = " Defensa"; + Lang.inter[11] = "Vanidad"; + Lang.inter[12] = "Casco"; + Lang.inter[13] = "Camisa"; + Lang.inter[14] = "Pantalones"; + Lang.inter[15] = " platino "; + Lang.inter[16] = " oro "; + Lang.inter[17] = " plata "; + Lang.inter[18] = " cobre"; + Lang.inter[19] = "Reciclar"; + Lang.inter[20] = "No ha sido posible crear una sesión de red."; + Lang.inter[21] = "No ha sido posible unirse a la sesión. La sesión está completa o no se puede encontrar."; + Lang.inter[22] = "Objetos necesarios:"; + Lang.inter[23] = "Ninguno"; + Lang.inter[24] = "Alternar el modo de agarre"; + Lang.inter[25] = "Creación"; + Lang.inter[26] = "Monedas"; + Lang.inter[27] = "Munición"; + Lang.inter[28] = "Tienda"; + Lang.inter[29] = (string) (object) '\x008C' + (object) "Saquearlo todo"; + Lang.inter[30] = (string) (object) '\x008C' + (object) "Depositarlo todo"; + Lang.inter[31] = (string) (object) '\x008C' + (object) "Apilamiento rápido"; + Lang.inter[32] = "Hucha"; + Lang.inter[33] = "Caja fuerte"; + Lang.inter[34] = "Hora: "; + Lang.inter[35] = "¿Seguro que quieres abandonar?"; + Lang.inter[36] = "Se ha perdido la conexión con Xbox LIVE."; + Lang.inter[37] = "Número de entradas: "; + Lang.inter[38] = "Te han matado..."; + Lang.inter[39] = "Esta vivienda es válida."; + Lang.inter[40] = "Esta vivienda no es válida."; + Lang.inter[41] = "Esta vivienda ya está ocupada."; + Lang.inter[42] = "Esta vivienda está corrompida."; + Lang.inter[43] = "Este perfil de jugador no posee los privilegios necesarios para unirse. Puede que necesites una suscripción LIVE Gold o tengas que cambiar los ajustes parentales."; + Lang.inter[44] = "Recibiendo datos de casillas"; + Lang.inter[45] = "Equipar"; + Lang.inter[46] = "Coste: "; + Lang.inter[47] = "Guardar"; + Lang.inter[48] = "Editar"; + Lang.inter[49] = "Estado"; + Lang.inter[50] = "Maldición"; + Lang.inter[51] = "Ayuda"; + Lang.inter[52] = "Cerrar"; + Lang.inter[53] = "Agua"; + Lang.inter[54] = "Sanar"; + Lang.inter[55] = "Proporciona consejos y notas sobre cómo crear objetos."; + Lang.inter[56] = "Vende objetos básicos."; + Lang.inter[57] = "Cura las heridas y los suavizadores."; + Lang.inter[58] = "Vende explosivos."; + Lang.inter[59] = "Vende objetos naturales y te informa del estado del mundo."; + Lang.inter[60] = "Vende armas y munición."; + Lang.inter[61] = "Vende ropa de moda."; + Lang.inter[62] = "Vende herramientas y cables."; + Lang.inter[63] = "Vende artilugios útiles y vuelve a forjar objetos."; + Lang.inter[64] = "Vende objetos y accesorios mágicos."; + Lang.inter[65] = "Un viejo amigo muy simpático."; + Lang.inter[66] = "La partida ha terminado"; + Lang.inter[67] = "La partida ha sido finalizada por el anfitrión."; + Lang.inter[68] = "No es posible unirse debido a los privilegios de uno de los jugadores."; + Lang.inter[69] = "Actualmente estás jugando a la versión de prueba. Compra la versión completa del juego para jugar en línea."; + Lang.inter[70] = "No hay espacio suficiente en el dispositivo de almacenamiento seleccionado."; + Lang.inter[71] = "Jugar en el modo pantalla dividida con el ajuste de vídeo de definición estándar provocará que el texto de la pantalla de juego sea difícil de leer. Recomendamos usar el ajuste de alta definición para disfrutar al máximo de la experiencia de juego."; + Lang.inter[72] = "Prohibir Mundo"; + Lang.inter[73] = "¿Seguro que quieres añadir este mundo a tu lista de Mundos Prohibidos?\n\nSi seleccionas Aceptar también saldrás de esta partida."; + Lang.inter[74] = "¡ATENCIÓN! El mundo al que te intentas unir está en tu lista de Mundos Prohibidos.\n\nSi decides unirte a esta partida este mundo será eliminado de tu lista de Mundos Prohibidos."; + Lang.inter[75] = "Continuar"; + Lang.inter[76] = "(En espera de aprobación)"; + Lang.inter[77] = "(Censurado)"; + Lang.inter[78] = "La partida guardada \"{0}\" fue trasladada desde otro perfil y será eliminado."; + Lang.inter[79] = "El juego finalizará debido a los ajustes de contenido creado por los miembros de uno de los perfiles que ha iniciado sesión."; + Lang.tip[0] = "Equipado en la ranura de vanidad"; + Lang.tip[1] = "No aumentará ninguna estadística"; + Lang.tip[2] = " daño en el cuerpo a cuerpo"; + Lang.tip[3] = " daño a distancia"; + Lang.tip[4] = " daño por magia"; + Lang.tip[5] = "% probabilidad de ataque crítico"; + Lang.tip[6] = "Velocidad de vértigo"; + Lang.tip[7] = "Gran velocidad"; + Lang.tip[8] = "Veloz"; + Lang.tip[9] = "Velocidad normal"; + Lang.tip[10] = "Lento"; + Lang.tip[11] = "Muy lento"; + Lang.tip[12] = "Exageradamente lento"; + Lang.tip[13] = "Velocidad de tortuga"; + Lang.tip[14] = "Sin retroceso"; + Lang.tip[15] = "Retroceso sumamente débil"; + Lang.tip[16] = "Retroceso muy débil"; + Lang.tip[17] = "Retroceso débil"; + Lang.tip[18] = "Retroceso normal"; + Lang.tip[19] = "Retroceso fuerte"; + Lang.tip[20] = "Retroceso muy fuerte"; + Lang.tip[21] = "Retroceso tremendamente fuerte"; + Lang.tip[22] = "Retroceso descomunal"; + Lang.tip[23] = "Equipable"; + Lang.tip[24] = "Objeto decorativo"; + Lang.tip[25] = " defensa"; + Lang.tip[26] = "% potencia de pico"; + Lang.tip[27] = "% potencia de hacha"; + Lang.tip[28] = "% potencia de martillo"; + Lang.tip[29] = "Restablece "; + Lang.tip[30] = " vida"; + Lang.tip[31] = " maná"; + Lang.tip[32] = "Consume "; + Lang.tip[33] = "Se puede colocar"; + Lang.tip[34] = "Munición"; + Lang.tip[35] = "Consumible"; + Lang.tip[36] = "Material"; + Lang.tip[37] = " minuto/s de duración"; + Lang.tip[38] = " segundo/s de duración"; + Lang.tip[39] = "% daño"; + Lang.tip[40] = "% velocidad"; + Lang.tip[41] = "% probabilidad de ataque crítico"; + Lang.tip[42] = "% coste de maná"; + Lang.tip[43] = "% tamaño"; + Lang.tip[44] = "% velocidad de proyectil"; + Lang.tip[45] = "% retroceso"; + Lang.tip[46] = "% velocidad de movimiento"; + Lang.tip[47] = "% velocidad en el cuerpo a cuerpo"; + Lang.tip[48] = "Bonus conjunto: "; + Lang.tip[49] = "Precio de venta: "; + Lang.tip[50] = "Precio de compra: "; + Lang.tip[51] = "Sin valor"; + Lang.dt[0] = " no logró encontrar el antídoto."; + Lang.dt[1] = " no pudo extinguir el fuego."; + Lang.dt[2] = " intentó escapar."; + Lang.dt[3] = " recibió una paliza."; + Buff.buffName[1] = "Piel obsidiana"; + Buff.buffTip[1] = "Inmune a la lava"; + Buff.buffName[2] = "Regeneración"; + Buff.buffTip[2] = "Regenera la vida"; + Buff.buffName[3] = "Rapidez"; + Buff.buffTip[3] = "Aumenta en un 25% la velocidad de movimiento"; + Buff.buffName[4] = "Agallas"; + Buff.buffTip[4] = "Permite respirar agua en lugar de aire"; + Buff.buffName[5] = "Piel de hierro"; + Buff.buffTip[5] = "Aumenta la defensa en 8"; + Buff.buffName[6] = "Regeneración de maná"; + Buff.buffTip[6] = "Aumenta la regeneración de maná"; + Buff.buffName[7] = "Poder mágico"; + Buff.buffTip[7] = "Aumenta el daño mágico en un 20%"; + Buff.buffName[8] = "Caída de pluma"; + Buff.buffTip[8] = "Pulsa ARRIBA o ABAJO para controlar la velocidad de descenso"; + Buff.buffName[9] = "Espeleólogo"; + Buff.buffTip[9] = "Muestra la ubicación de tesoros y minerales"; + Buff.buffName[10] = "Invisibilidad"; + Buff.buffTip[10] = "Proporciona invisibilidad"; + Buff.buffName[11] = "Brillo"; + Buff.buffTip[11] = "Emite luz"; + Buff.buffName[12] = "Noctámbulo"; + Buff.buffTip[12] = "Mejora la visión nocturna"; + Buff.buffName[13] = "Batalla"; + Buff.buffTip[13] = "Aumenta la velocidad de regeneración del enemigo"; + Buff.buffName[14] = "Espinas"; + Buff.buffTip[14] = "Los atacantes también sufren daños"; + Buff.buffName[15] = "Flotación"; + Buff.buffTip[15] = "Pulsa ABAJO para sumergirte"; + Buff.buffName[16] = "Tiro con arco"; + Buff.buffTip[16] = "Aumenta en un 20% la velocidad y el daño de las flechas"; + Buff.buffName[17] = "Cazador"; + Buff.buffTip[17] = "Muestra la ubicación de los enemigos"; + Buff.buffName[18] = "Gravedad"; + Buff.buffTip[18] = "Pulsa ARRIBA o ABAJO para invertir la gravedad"; + Buff.buffName[19] = "Orbe de luz"; + Buff.buffTip[19] = "Orbe mágico que proporciona luz"; + Buff.buffName[20] = "Veneno"; + Buff.buffTip[20] = "Reduce el nivel de vida lentamente"; + Buff.buffName[21] = "Enfermedad de poción"; + Buff.buffTip[21] = "Impide seguir consumiendo remedios curativos"; + Buff.buffName[22] = "Oscuridad"; + Buff.buffTip[22] = "Disminuye la claridad"; + Buff.buffName[23] = "Maldición"; + Buff.buffTip[23] = "No se puede usar ningún objeto"; + Buff.buffName[24] = "Llamas"; + Buff.buffTip[24] = "Reduce el nivel de vida lentamente"; + Buff.buffName[25] = "Beodo"; + Buff.buffTip[25] = "Mejora el ataque cuerpo a cuerpo pero reduce la defensa"; + Buff.buffName[26] = "Bien alimentado"; + Buff.buffTip[26] = "Pequeñas mejoras a todas las estadísticas"; + Buff.buffName[27] = "Hada"; + Buff.buffTip[27] = "Un hada te acompaña"; + Buff.buffName[28] = "Hombre lobo"; + Buff.buffTip[28] = "Aumenta la capacidad física"; + Buff.buffName[29] = "Clarividencia"; + Buff.buffTip[29] = "Aumenta los poderes mágicos"; + Buff.buffName[30] = "Hemorragia"; + Buff.buffTip[30] = "No se puede recuperar vida"; + Buff.buffName[31] = "Confusión"; + Buff.buffTip[31] = "Invierte los movimientos"; + Buff.buffName[32] = "Lentitud"; + Buff.buffTip[32] = "Disminuye la velocidad de movimiento"; + Buff.buffName[33] = "Debilidad"; + Buff.buffTip[33] = "Disminuye la capacidad física"; + Buff.buffName[34] = "Tritón"; + Buff.buffTip[34] = "Respira y se mueve bajo el agua con facilidad"; + Buff.buffName[35] = "Silencio"; + Buff.buffTip[35] = "No puede utilizar los artículos que requieren maná"; + Buff.buffName[36] = "Armadura rota"; + Buff.buffTip[36] = "La defensa disminuye hasta la mitad"; + Buff.buffName[37] = "Terror"; + Buff.buffTip[37] = "Has visto algo horrible... ¡No hay escapatoria!"; + Buff.buffName[38] = "La Lengua"; + Buff.buffTip[38] = "Te succiona hacia la Boca"; + Buff.buffName[39] = "El Averno"; + Buff.buffTip[39] = "Reduce el nivel de vida progresivamente"; + Buff.buffName[40] = "Conejilla de Indias mascota"; + Buff.buffTip[40] = "Simplementa entrañable"; + Buff.buffName[41] = "Slime mascota"; + Buff.buffTip[41] = "Una verdadera pelotita slime"; + Buff.buffName[42] = "Avispa mascota"; + Buff.buffTip[42] = "Quiere toda la miel"; + Buff.buffName[43] = "Murciélago mascota"; + Buff.buffTip[43] = "En busca de sangre"; + Buff.buffName[44] = "Hombre lobo mascota"; + Buff.buffTip[44] = "El mejor amigo del hombre"; + Buff.buffName[45] = "Zombi mascota"; + Buff.buffTip[45] = "Come cerebros"; + Main.tileName[13] = "Botella"; + Main.tileName[14] = "Mesa"; + Main.tileName[15] = "Silla"; + Main.tileName[16] = "Yunque"; + Main.tileName[17] = "Forja"; + Main.tileName[18] = "Banco de trabajo"; + Main.tileName[26] = "Altar demoníaco"; + Main.tileName[77] = "Forja infernal"; + Main.tileName[86] = "Telar"; + Main.tileName[94] = "Barrica"; + Main.tileName[96] = "Perol"; + Main.tileName[101] = "Librería"; + Main.tileName[106] = "Serrería"; + Main.tileName[114] = "Taller de chapuzas"; + Main.tileName[133] = "Forja de adamantita"; + Main.tileName[134] = "Yunque de mithril"; + } + } + + public static uint deathMsg(int plr = -1, int npc = 0, int proj = 0, int other = -1) + { + return (uint) (plr & (int) byte.MaxValue | (npc & 1023) << 8 | (proj & (int) byte.MaxValue) << 18 | (other & 63) << 26); + } + + public static string deathMsgString(uint encoded) + { + uint num1 = encoded >> 26 & 63U; + if (num1 >= 3U && num1 < 63U) + return Lang.dt[(IntPtr) (num1 - 3U)]; + uint num2 = encoded & (uint) byte.MaxValue; + int l = (int) encoded << 14 >> 22; + uint num3 = encoded >> 18 & (uint) byte.MaxValue; + string str1 = (string) null; + if (Lang.lang <= 1) + { + string str2; + switch (Main.rand.Next(26)) + { + case 0: + str2 = " was slain"; + break; + case 1: + str2 = " was eviscerated"; + break; + case 2: + str2 = " was murdered"; + break; + case 3: + str2 = "'s face was torn off"; + break; + case 4: + str2 = "'s entrails were ripped out"; + break; + case 5: + str2 = " was destroyed"; + break; + case 6: + str2 = "'s skull was crushed"; + break; + case 7: + str2 = " got massacred"; + break; + case 8: + str2 = " got impaled"; + break; + case 9: + str2 = " was torn in half"; + break; + case 10: + str2 = " was decapitated"; + break; + case 11: + str2 = " let their arms get torn off"; + break; + case 12: + str2 = " watched their innards become outards"; + break; + case 13: + str2 = " was brutally dissected"; + break; + case 14: + str2 = "'s extremities were detached"; + break; + case 15: + str2 = "'s body was mangled"; + break; + case 16: + str2 = "'s vital organs were ruptured"; + break; + case 17: + str2 = " was turned into a pile of flesh"; + break; + case 18: + str2 = " was removed from " + Main.worldName; + break; + case 19: + str2 = " got snapped in half"; + break; + case 20: + str2 = " was cut down the middle"; + break; + case 21: + str2 = " was chopped up"; + break; + case 22: + str2 = "'s plead for death was answered"; + break; + case 23: + str2 = "'s meat was ripped off the bone"; + break; + case 24: + str2 = "'s flailing about was finally stopped"; + break; + default: + str2 = "'s head was removed"; + break; + } + if (num2 < 8U) + { + if ((int) num3 != 0) + str1 = str2 + " by " + Main.player[(IntPtr) num2].name + "'s " + Lang.PROJECTILE_NAMES[(IntPtr) num3] + "."; + else + str1 = str2 + " by " + Main.player[(IntPtr) num2].name + "'s " + Lang.itemName((int) Main.player[(IntPtr) num2].inventory[(int) Main.player[(IntPtr) num2].selectedItem].netID) + "."; + } + else if (l != 0) + str1 = str2 + " by " + Lang.npcName(l) + "."; + else if ((int) num3 != 0) + str1 = str2 + " by " + Lang.PROJECTILE_NAMES[(IntPtr) num3] + "."; + else if ((int) num1 == 0) + str1 = Main.rand.Next(2) != 0 ? " didn't bounce." : " fell to their death."; + else if ((int) num1 == 1) + { + switch (Main.rand.Next(4)) + { + case 0: + str1 = " forgot to breathe."; + break; + case 1: + str1 = " is sleeping with the fish."; + break; + case 2: + str1 = " drowned."; + break; + case 3: + str1 = " is shark food."; + break; + } + } + else if ((int) num1 == 2) + { + switch (Main.rand.Next(4)) + { + case 0: + str1 = " got melted."; + break; + case 1: + str1 = " was incinerated."; + break; + case 2: + str1 = " tried to swim in lava."; + break; + case 3: + str1 = " likes to play in magma."; + break; + } + } + else + str1 = str2 + "."; + } + else if (Lang.lang == 2) + { + string str2; + switch (Main.rand.Next(15)) + { + case 0: + str2 = " wurde getötet von"; + break; + case 1: + str2 = " wurde vernichtet"; + break; + case 2: + str2 = " wurde ermordet"; + break; + case 3: + str2 = " wurde das Gesicht heruntergerissen"; + break; + case 4: + str2 = " wurden die Eingeweide herausgerissen"; + break; + case 5: + str2 = " wurde zerstört"; + break; + case 6: + str2 = " wurde der Schädel eingeschlagen"; + break; + case 7: + str2 = " wurde massakriert"; + break; + case 8: + str2 = " wurde gepfählt"; + break; + case 9: + str2 = " wurde in zwei Hälften gerissen"; + break; + case 10: + str2 = " wurde geköpft"; + break; + case 11: + str2 = "wurden die Arme ausgerissen"; + break; + case 12: + str2 = " sah dabei zu, wie die eigenen Eingeweide herausquollen"; + break; + case 13: + str2 = " wurde brutal seziert"; + break; + default: + str2 = " liess sich den Kopf wegreissen"; + break; + } + if ((int) num1 == 0) + str1 = Main.rand.Next(2) != 0 ? " ist nicht gesprungen." : " stürzte in den Tod."; + else if ((int) num1 == 1) + { + switch (Main.rand.Next(4)) + { + case 0: + str1 = " hat vergessen zu atmen."; + break; + case 1: + str1 = " hat jetzt ein feuchtes Grab bei den Fischen."; + break; + case 2: + str1 = " ist ertrunken."; + break; + case 3: + str1 = " ist jetzt Fischfutter."; + break; + } + } + else if ((int) num1 == 2) + { + switch (Main.rand.Next(4)) + { + case 0: + str1 = " ist geschmolzen."; + break; + case 1: + str1 = " wurde eingeäschert."; + break; + case 2: + str1 = " versuchte, in Lava zu baden."; + break; + case 3: + str1 = " spielt gern mit Magma."; + break; + } + } + else + str1 = str2 + "."; + } + else if (Lang.lang == 3) + { + int num4 = Main.rand.Next(13); + if (num4 == 0) + ; + string str2 = num4 != 0 ? (num4 != 1 ? (num4 != 2 ? (num4 != 3 ? (num4 != 4 ? (num4 != 5 ? (num4 != 6 ? (num4 != 7 ? (num4 != 8 ? (num4 != 9 ? (num4 != 10 ? (num4 != 11 ? " è stato tagliato a metà" : " le braccia sono state spezzate") : " è stato decapitato") : " è stato spezzato a metà") : " ha visto uscire le sue interiora ") : " è stato massacrato") : " il cranio è stato spappolato") : " è stato distrutto") : " è stato massacrato") : " è stato distrutto") : " è stato assassinato") : " è stato sventrato") : " è stato ucciso"; + if ((int) num1 == 0) + str1 = Main.rand.Next(2) != 0 ? " non poteva rimbalzare." : " sente la sua morte."; + else if ((int) num1 == 1) + { + switch (Main.rand.Next(4)) + { + case 0: + str1 = " ha dimenticato di respirare."; + break; + case 1: + str1 = " sta dormendo con i pesci."; + break; + case 2: + str1 = " è affogato."; + break; + case 3: + str1 = " è un pasto dello squalo."; + break; + } + } + else if ((int) num1 == 2) + { + switch (Main.rand.Next(4)) + { + case 0: + str1 = " si è sciolto."; + break; + case 1: + str1 = " si è incenerito."; + break; + case 2: + str1 = " ha provato a nuotare nella lava."; + break; + case 3: + str1 = " piace giocare nel magma."; + break; + } + } + else + str1 = str2 + "."; + } + else if (Lang.lang == 4) + { + string str2; + switch (Main.rand.Next(14)) + { + case 0: + str2 = " s'est fait massacrer"; + break; + case 1: + str2 = " s'est fait éviscérer"; + break; + case 2: + str2 = " s'est fait assassiner"; + break; + case 3: + str2 = " s'est fait défigurer"; + break; + case 4: + str2 = " a vu ses entrailles tomber à ses pieds"; + break; + case 5: + str2 = " s'est fait détruire"; + break; + case 6: + str2 = " s'est fait arracher la tête"; + break; + case 7: + str2 = " s'est fait tuer"; + break; + case 8: + str2 = " s'est fait empaler"; + break; + case 9: + str2 = " s'est fait brutalement découper"; + break; + case 10: + str2 = " a été décapité"; + break; + case 11: + str2 = " s'est fait déchiqueter les bras"; + break; + case 12: + str2 = " s'est fait couper en tranches"; + break; + default: + str2 = " a perdu la tête"; + break; + } + if ((int) num1 == 0) + str1 = Main.rand.Next(2) != 0 ? " ne bouge plus." : " a cassé sa pipe."; + else if ((int) num1 == 1) + { + switch (Main.rand.Next(4)) + { + case 0: + str1 = " a cessé de respirer."; + break; + case 1: + str1 = " mange les pissenlits par la racine."; + break; + case 2: + str1 = " a coulé à pic."; + break; + case 3: + str1 = " nourrit les requins."; + break; + } + } + else if ((int) num1 == 2) + { + switch (Main.rand.Next(4)) + { + case 0: + str1 = " a fondu."; + break; + case 1: + str1 = " s'est fait incinérer."; + break; + case 2: + str1 = " a tenté de nager dans la lave."; + break; + case 3: + str1 = " aime barboter dans le magma."; + break; + } + } + else + str1 = str2 + "."; + } + else if (Lang.lang == 5) + { + string str2 = " fue asesinado"; + if ((int) num1 == 0) + str1 = Main.rand.Next(2) != 0 ? " no saltó a tiempo." : " ha caído al vacío."; + else if ((int) num1 == 1) + { + switch (Main.rand.Next(4)) + { + case 0: + str1 = " se olvidó de respirar."; + break; + case 1: + str1 = " duerme con los peces."; + break; + case 2: + str1 = " se ha ahogado."; + break; + case 3: + str1 = " es pasto de los tiburones."; + break; + } + } + else if ((int) num1 == 2) + { + switch (Main.rand.Next(4)) + { + case 0: + str1 = " se ha calcinado."; + break; + case 1: + str1 = " se ha chamuscado."; + break; + case 2: + str1 = " ha intentado nadar en lava."; + break; + case 3: + str1 = " le gusta jugar con el magma."; + break; + } + } + else + str1 = str2 + "."; + } + return str1; + } + + public static string setSystemLang() + { + Lang.languageId = CultureInfo.CurrentCulture.TwoLetterISOLanguageName; + int language = 1; + if (Lang.languageId == "de") + language = 2; + else if (Lang.languageId == "fr") + language = 4; + else if (Lang.languageId == "es") + language = 5; + else if (Lang.languageId == "it") + language = 3; + Lang.setLang(language); + if (GuideExtensions.get_ConsoleRegion() == 0) + return "ESRB"; + else + return (string) null; + } + + public static string tutorial(Tutorial t) + { + int index = (int) t; + switch (Lang.lang) + { + case 2: + return Lang.TUTORIAL_DE[index]; + case 3: + return Lang.TUTORIAL_IT[index]; + case 4: + return Lang.TUTORIAL_FR[index]; + case 5: + return Lang.TUTORIAL_ES[index]; + default: + return Lang.TUTORIAL_EN[index]; + } + } + + public enum ID + { + NONE, + ENGLISH, + GERMAN, + ITALIAN, + FRENCH, + SPANISH, + } + + public enum CONTROLS + { + SELECT, + BACK, + CLOSE, + CHANGE_STORAGE, + SHOW_PARTY, + TOGGLE_GRAPPLE_MODE, + BLACKLIST, + MOVE_MAP, + ZOOM, + TOGGLE_PVP, + SELECT_TEAM, + INVITE_PLAYER, + INVITE_PARTY, + SHOW_GAMERCARD, + CREATE_WORLD, + JOIN, + X_SHOW_GAMERCARD, + CHANGE_ITEM, + CHANGE_MENU, + GRAPPLE, + GRAPPLE_ALT, + INTERACT, + TALK, + JUMP, + INVENTORY, + DROP, + TRASH, + SELL, + USE, + DIG, + CHOP, + ATTACK, + HIT, + BUILD, + SELECT_ONE, + SELECT_ALL, + PLACE, + PLACE_EQUIPMENT, + SWAP, + EQUIP, + OPEN, + REFORGE, + SHOW_RECIPES, + CRAFT, + SHOW_ALL, + SHOW_AVAILABLE, + INGREDIENTS, + RECIPES, + CRAFTING_CATEGORY, + BUY_ONE, + BUY_ALL, + SELL_ITEM_IN_HAND, + CANCEL_BUFF, + ASSIGN_TO_ROOM, + CHECK_HOUSING, + SHOW_BANNERS, + HIDE_BANNERS, + GENDER, + DIFFICULTY, + HAIR_TYPE, + HAIR_COLOR, + VEST_COLOR, + SHIRT_COLOR, + UNDERSHIRT_COLOR, + PANTS_COLOR, + SHOE_COLOR, + SKIN_COLOR, + EYE_COLOR, + RANDOMIZE, + CREATE_CHARACTER, + CHANGE_CATEGORY, + SELECT_COLOR, + SELECT_TYPE, + SELECT_GENDER, + SELECT_DIFFICULTY, + CHANGE_SOUND_VOLUME, + CHANGE_MUSIC_VOLUME, + NEXT_PAGE, + PREVIOUS_PAGE, + SCROLL_TEXT, + SWITCH_LEADERBOARD, + SHOW_TOP, + SHOW_MYSELF, + SHOW_FRIENDS, + EXIT, + BACK_TO_GAME, + UNLOCK_FULL_GAME, + } + } +} diff --git a/Terraria/Leaderboards/Assets.cs b/Terraria/Leaderboards/Assets.cs new file mode 100644 index 0000000..67f6b74 --- /dev/null +++ b/Terraria/Leaderboards/Assets.cs @@ -0,0 +1,27 @@ +// Type: Terraria.Leaderboards.Assets +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework.Content; +using Microsoft.Xna.Framework.Graphics; + +namespace Terraria.Leaderboards +{ + internal class Assets + { + public static Texture2D[] COLUMN_ICONS; + + public static void LoadContent(ContentManager Content) + { + Assets.COLUMN_ICONS = new Texture2D[32]; + string str1 = "UI/Leaderboards/"; + for (int index = 31; index >= 0; --index) + { + string str2 = ((object) (Column) index).ToString().ToLower(); + string assetName = str1 + str2; + Assets.COLUMN_ICONS[index] = Content.Load(assetName); + } + } + } +} diff --git a/Terraria/Leaderboards/Column.cs b/Terraria/Leaderboards/Column.cs new file mode 100644 index 0000000..797b7dc --- /dev/null +++ b/Terraria/Leaderboards/Column.cs @@ -0,0 +1,44 @@ +// Type: Terraria.Leaderboards.Column +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +namespace Terraria.Leaderboards +{ + public enum Column + { + AIR_COLUMN, + GROUND_COLUMN, + WATER_COLUMN, + LAVA_COLUMN, + ORE_COLUMN, + GEMS_COLUMN, + SOILS_COLUMN, + WOOD_COLUMN, + FURNITURE_COLUMN, + TOOLS_COLUMN, + WEAPONS_COLUMN, + ARMOR_COLUMN, + CONSUMABLES_COLUMN, + MISC_COLUMN, + POTIONS_COLUMN, + LIGHTS_COLUMN, + AMMO_COLUMN, + SEEDS_COLUMN, + KEYS_COLUMN, + KING_SLIME_COLUMN, + CTHULHU_COLUMN, + EATER_COLUMN, + SKELETRON_COLUMN, + WALL_COLUMN, + TWINS_COLUMN, + SKELETRON_PRIME_COLUMN, + DESTROYER_COLUMN, + OCRAM_COLUMN, + DROWNED_COLUMN, + FALLEN_COLUMN, + BURIED_COLUMN, + BURNED_COLUMN, + COLUMN_COUNT, + } +} diff --git a/Terraria/Leaderboards/Leaderboard.cs b/Terraria/Leaderboards/Leaderboard.cs new file mode 100644 index 0000000..04ef56a --- /dev/null +++ b/Terraria/Leaderboards/Leaderboard.cs @@ -0,0 +1,17 @@ +// Type: Terraria.Leaderboards.Leaderboard +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +namespace Terraria.Leaderboards +{ + public enum Leaderboard + { + DISTANCE, + MINING_GATHERING, + CRAFTING, + NORMAL_BOSSES, + HARD_BOSSES, + LEADERBOARD_COUNT, + } +} diff --git a/Terraria/Leaderboards/LeaderboardData.cs b/Terraria/Leaderboards/LeaderboardData.cs new file mode 100644 index 0000000..4a9f099 --- /dev/null +++ b/Terraria/Leaderboards/LeaderboardData.cs @@ -0,0 +1,399 @@ +// Type: Terraria.Leaderboards.LeaderboardData +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework.GamerServices; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; + +namespace Terraria.Leaderboards +{ + public class LeaderboardData + { + private const int PAGE_SIZE = 50; + public int NumEntries; + private LeaderboardData.Cache Stale; + private LeaderboardData.Cache Current; + private LeaderboardData.Cache MergedCache; + private LeaderboardReader Reader; + private IAsyncResult Request; + private LeaderboardData.AsyncRequest ReadState; + private int DefaultBatchSize; + public int BatchSize; + public int BatchStart; + public int Selected; + public Column[] Columns; + public string LeaderboardName; + + public bool Ready + { + get + { + return this.Reader != null; + } + } + + private bool CanPageDown + { + get + { + return this.Reader.CanPageDown; + } + } + + private bool CanPageUp + { + get + { + return this.Reader.CanPageUp; + } + } + + public LeaderboardData(int batchSize) + { + this.DefaultBatchSize = batchSize; + this.BatchStart = 0; + this.MergedCache = new LeaderboardData.Cache() + { + Entries = new LeaderboardData.Row[0], + StartIndex = 0 + }; + } + + private static void ProcessEntries(LeaderboardReader reader, Column[] columns, ref LeaderboardData.Cache cache) + { + ReadOnlyCollection entries = reader.get_Entries(); + int count = entries.Count; + int index1 = 0; + int length = columns.Length; + string[] strArray = new string[length]; + for (int index2 = length - 1; index2 > -1; --index2) + strArray[index2] = ((object) columns[index2]).ToString(); + for (int index2 = 0; index2 < entries.Count; ++index2) + { + LeaderboardEntry leaderboardEntry = entries[index2]; + if (LeaderboardEntryExtensions.GetRank(leaderboardEntry) == 0) + { + --count; + } + else + { + LeaderboardData.Row row = cache.Entries[index1]; + row.Rank = LeaderboardEntryExtensions.GetRank(leaderboardEntry); + row.Gamer = leaderboardEntry.Gamer; + row.Statistics = new uint[length]; + for (int index3 = length - 1; index3 > -1; --index3) + { + string index4 = strArray[index3]; + uint num = (uint) (int) leaderboardEntry.Columns[index4]; + row.Statistics[index3] = num; + } + row.Available = true; + ++index1; + } + } + cache.StartIndex = reader.PageStart; + cache.NumEntries = count; + } + + public void LoadLeaderboard(Leaderboard board) + { + this.Request = LeaderboardReader.BeginRead(LeaderboardInfo.GetIdentity(board), 0, 50, (AsyncCallback) null, (object) null); + this.Reader = (LeaderboardReader) null; + this.ReadState = LeaderboardData.AsyncRequest.FullRead; + this.NumEntries = 0; + this.ResetCaches(); + this.Columns = LeaderboardInfo.GetColumns(board); + this.LeaderboardName = LeaderboardInfo.GetName(board); + } + + public void LoadLeaderboard(Leaderboard board, Gamer gamer) + { + this.Request = LeaderboardReader.BeginRead(LeaderboardInfo.GetIdentity(board), gamer, 50, (AsyncCallback) null, (object) gamer); + this.Reader = (LeaderboardReader) null; + this.ReadState = LeaderboardData.AsyncRequest.FullRead; + this.NumEntries = 0; + this.ResetCaches(); + this.Columns = LeaderboardInfo.GetColumns(board); + this.LeaderboardName = LeaderboardInfo.GetName(board); + } + + public void LoadLeaderboard(Leaderboard board, FriendCollection friends, Gamer gamer) + { + this.Request = LeaderboardReader.BeginRead(LeaderboardInfo.GetIdentity(board), (IEnumerable) friends, gamer, ((ReadOnlyCollection) friends).Count + 1, (AsyncCallback) null, (object) gamer); + this.Reader = (LeaderboardReader) null; + this.ReadState = LeaderboardData.AsyncRequest.FullRead; + this.NumEntries = 0; + this.ResetCaches(); + this.Columns = LeaderboardInfo.GetColumns(board); + this.LeaderboardName = LeaderboardInfo.GetName(board); + } + + private void ResetCaches() + { + LeaderboardData.Row[] rowArray1 = new LeaderboardData.Row[50]; + LeaderboardData.Row[] rowArray2 = new LeaderboardData.Row[50]; + for (int index = 49; index >= 0; --index) + { + rowArray1[index] = new LeaderboardData.Row() + { + Available = false + }; + rowArray2[index] = new LeaderboardData.Row() + { + Available = false + }; + } + this.Current = new LeaderboardData.Cache() + { + Entries = rowArray1, + StartIndex = 0, + NumEntries = 0 + }; + this.Stale = new LeaderboardData.Cache() + { + Entries = rowArray2, + StartIndex = 0, + NumEntries = 0 + }; + this.MergedCache = new LeaderboardData.Cache() + { + Entries = rowArray1, + StartIndex = 0, + NumEntries = 0 + }; + this.BatchStart = 0; + } + + public bool Update() + { + if (this.ReadState == LeaderboardData.AsyncRequest.None || !this.Request.IsCompleted) + return true; + if (this.ReadState == LeaderboardData.AsyncRequest.FullRead) + { + try + { + this.Reader = LeaderboardReader.EndRead(this.Request); + } + catch + { + return false; + } + this.BatchStart = this.Reader.PageStart; + this.Selected = 0; + if (this.Request.AsyncState != null) + { + Gamer gamer = (Gamer) this.Request.AsyncState; + int num = this.BatchStart; + foreach (LeaderboardEntry leaderboardEntry in this.Reader.get_Entries()) + { + if (leaderboardEntry.Gamer.Gamertag == gamer.Gamertag) + { + this.Selected = num; + this.BatchStart = num; + break; + } + else + ++num; + } + } + } + else if (this.ReadState == LeaderboardData.AsyncRequest.NextPage) + this.Reader.EndPageDown(this.Request); + else if (this.ReadState == LeaderboardData.AsyncRequest.PreviousPage) + this.Reader.EndPageUp(this.Request); + LeaderboardData.ProcessEntries(this.Reader, this.Columns, ref this.Current); + if (this.Stale.StartIndex <= this.Current.StartIndex) + this.CreateMergedCache(this.Stale, this.Current); + else + this.CreateMergedCache(this.Current, this.Stale); + if (this.ReadState == LeaderboardData.AsyncRequest.FullRead) + { + this.BatchSize = Math.Min(this.Current.NumEntries, this.DefaultBatchSize); + this.NumEntries = this.Current.NumEntries <= 0 || !this.Reader.CanPageDown && !this.Reader.CanPageUp ? this.Current.NumEntries : this.Reader.TotalLeaderboardSize; + if (this.BatchStart > this.NumEntries - this.BatchSize) + this.BatchStart = this.NumEntries - this.BatchSize; + } + this.ReadState = LeaderboardData.AsyncRequest.None; + this.Request = (IAsyncResult) null; + return true; + } + + public bool MoveDown() + { + ++this.Selected; + if (this.Selected < this.BatchStart + this.BatchSize) + return true; + ++this.BatchStart; + bool flag1 = this.Current.StartIndex + this.Current.NumEntries < this.BatchStart + this.BatchSize; + if (flag1 && !this.CanPageDown && this.ReadState == LeaderboardData.AsyncRequest.None) + { + --this.Selected; + --this.BatchStart; + return false; + } + else + { + bool flag2 = true; + if (flag1) + { + if (this.ReadState == LeaderboardData.AsyncRequest.None) + { + this.CacheNextPage(); + } + else + { + --this.BatchStart; + --this.Selected; + flag2 = false; + } + } + return flag2; + } + } + + public bool MoveUp() + { + --this.Selected; + if (this.Selected >= this.BatchStart) + return true; + --this.BatchStart; + bool flag1 = this.BatchStart < this.Current.StartIndex; + if (flag1 && !this.CanPageUp && this.ReadState == LeaderboardData.AsyncRequest.None) + { + ++this.Selected; + ++this.BatchStart; + return false; + } + else + { + bool flag2 = true; + if (flag1) + { + if (this.ReadState == LeaderboardData.AsyncRequest.None) + { + this.CachePreviousPage(); + } + else + { + ++this.BatchStart; + ++this.Selected; + flag2 = false; + } + } + return flag2; + } + } + + private void CacheNextPage() + { + this.FreeCache(this.Current.StartIndex + this.Current.NumEntries); + this.CreateMergedCache(this.Stale, this.Current); + this.Request = this.Reader.BeginPageDown((AsyncCallback) null, (object) null); + this.ReadState = LeaderboardData.AsyncRequest.NextPage; + } + + private void CachePreviousPage() + { + this.FreeCache(this.Current.StartIndex - Math.Min(this.Current.NumEntries, this.Current.StartIndex)); + this.CreateMergedCache(this.Current, this.Stale); + this.Request = this.Reader.BeginPageUp((AsyncCallback) null, (object) null); + this.ReadState = LeaderboardData.AsyncRequest.PreviousPage; + } + + private void FreeCache(int newStartIndex) + { + LeaderboardData.Cache cache = this.Stale; + this.Stale = this.Current; + this.Current = cache; + if (this.Current.StartIndex == newStartIndex) + return; + this.Current.StartIndex = newStartIndex; + for (int index = 0; index < this.Current.NumEntries; ++index) + this.Current.Entries[index].Available = false; + } + + private void CreateMergedCache(LeaderboardData.Cache first, LeaderboardData.Cache second) + { + int length = second.StartIndex - first.StartIndex + second.NumEntries; + LeaderboardData.Cache cache = new LeaderboardData.Cache() + { + Entries = new LeaderboardData.Row[length], + StartIndex = first.StartIndex, + NumEntries = length + }; + for (int index = first.NumEntries - 1; index >= 0; --index) + cache.Entries[index] = first.Entries[index]; + int num = second.StartIndex - first.StartIndex; + for (int index = second.NumEntries - 1; index >= 0; --index) + { + LeaderboardData.Row row1 = cache.Entries[num + index]; + if (row1 == null || !row1.Available) + cache.Entries[num + index] = second.Entries[index]; + LeaderboardData.Row row2 = cache.Entries[num + index]; + } + this.MergedCache = cache; + } + + public LeaderboardData.Row[] GetRows() + { + int count = Math.Min(this.BatchSize, this.MergedCache.NumEntries); + int sourceIndex = this.BatchStart - this.MergedCache.StartIndex; + if (sourceIndex < 0) + sourceIndex = 0; + if (sourceIndex + count > this.MergedCache.NumEntries) + sourceIndex = this.MergedCache.NumEntries - count; + LeaderboardData.Row[] destination = new LeaderboardData.Row[count]; + this.CopyRows(ref this.MergedCache.Entries, sourceIndex, ref destination, 0, count); + return destination; + } + + private void CopyRows(ref LeaderboardData.Row[] source, int sourceIndex, ref LeaderboardData.Row[] destination, int destinationIndex, int count) + { + for (int index = count - 1; index >= 0; --index) + destination[destinationIndex + index] = source[sourceIndex + index]; + } + + public Gamer GetSelectedGamer() + { + int index = this.Selected - this.MergedCache.StartIndex; + if (index >= 0 && index < this.MergedCache.NumEntries) + return this.MergedCache.Entries[index].Gamer; + else + return (Gamer) null; + } + + public class Row + { + public bool Available; + public int Rank; + public uint[] Statistics; + public Gamer Gamer; + + public string Gamertag + { + get + { + return this.Gamer.Gamertag; + } + } + } + + private class Cache + { + public LeaderboardData.Row[] Entries; + public int StartIndex; + public int NumEntries; + } + + private enum AsyncRequest + { + None, + FullRead, + NextPage, + PreviousPage, + } + } +} diff --git a/Terraria/Leaderboards/LeaderboardInfo.cs b/Terraria/Leaderboards/LeaderboardInfo.cs new file mode 100644 index 0000000..f61219e --- /dev/null +++ b/Terraria/Leaderboards/LeaderboardInfo.cs @@ -0,0 +1,172 @@ +// Type: Terraria.Leaderboards.LeaderboardInfo +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework.GamerServices; +using Microsoft.Xna.Framework.Net; +using Terraria; + +namespace Terraria.Leaderboards +{ + internal class LeaderboardInfo + { + private static LeaderboardInfo[] LEADERBOARDS_INFO = LeaderboardInfo.CreateAll(); + private LeaderboardIdentity Identity; + private LeaderboardInfo.ColumnMapping[] Columns; + private int NameID; + + static LeaderboardInfo() + { + } + + private LeaderboardInfo(LeaderboardIdentity identity, LeaderboardInfo.ColumnMapping[] columns, LeaderboardInfo.TitleTextID nameID) + { + this.Identity = identity; + this.Columns = columns; + this.NameID = (int) nameID; + } + + private static LeaderboardInfo.ColumnMapping Map(StatisticEntry entry, Column column) + { + string name = ((object) column).ToString(); + return new LeaderboardInfo.ColumnMapping(entry, column, name); + } + + private static LeaderboardIdentity CreateId(string key) + { + return new LeaderboardIdentity() + { + Key = key, + GameMode = 0 + }; + } + + public static LeaderboardInfo[] CreateAll() + { + LeaderboardInfo[] leaderboardInfoArray = new LeaderboardInfo[5]; + LeaderboardInfo.ColumnMapping[] columns1 = new LeaderboardInfo.ColumnMapping[4] + { + LeaderboardInfo.Map(StatisticEntry.AirTravel, Column.AIR_COLUMN), + LeaderboardInfo.Map(StatisticEntry.GroundTravel, Column.GROUND_COLUMN), + LeaderboardInfo.Map(StatisticEntry.WaterTravel, Column.WATER_COLUMN), + LeaderboardInfo.Map(StatisticEntry.LavaTravel, Column.LAVA_COLUMN) + }; + leaderboardInfoArray[0] = new LeaderboardInfo(LeaderboardInfo.CreateId("Distance"), columns1, LeaderboardInfo.TitleTextID.DISTANCE); + LeaderboardInfo.ColumnMapping[] columns2 = new LeaderboardInfo.ColumnMapping[4] + { + LeaderboardInfo.Map(StatisticEntry.Ore, Column.ORE_COLUMN), + LeaderboardInfo.Map(StatisticEntry.Gems, Column.GEMS_COLUMN), + LeaderboardInfo.Map(StatisticEntry.Soils, Column.SOILS_COLUMN), + LeaderboardInfo.Map(StatisticEntry.Wood, Column.WOOD_COLUMN) + }; + leaderboardInfoArray[1] = new LeaderboardInfo(LeaderboardInfo.CreateId("Mining"), columns2, LeaderboardInfo.TitleTextID.MINING_GATHERING); + LeaderboardInfo.ColumnMapping[] columns3 = new LeaderboardInfo.ColumnMapping[6] + { + LeaderboardInfo.Map(StatisticEntry.FurnitureCrafted, Column.FURNITURE_COLUMN), + LeaderboardInfo.Map(StatisticEntry.ToolsCrafted, Column.TOOLS_COLUMN), + LeaderboardInfo.Map(StatisticEntry.WeaponsCrafted, Column.WEAPONS_COLUMN), + LeaderboardInfo.Map(StatisticEntry.ArmorCrafted, Column.ARMOR_COLUMN), + LeaderboardInfo.Map(StatisticEntry.ConsumablesCrafted, Column.CONSUMABLES_COLUMN), + LeaderboardInfo.Map(StatisticEntry.MiscCrafted, Column.MISC_COLUMN) + }; + leaderboardInfoArray[2] = new LeaderboardInfo(LeaderboardInfo.CreateId("Crafting"), columns3, LeaderboardInfo.TitleTextID.CRAFTING); + LeaderboardInfo.ColumnMapping[] columns4 = new LeaderboardInfo.ColumnMapping[5] + { + LeaderboardInfo.Map(StatisticEntry.KingSlime, Column.KING_SLIME_COLUMN), + LeaderboardInfo.Map(StatisticEntry.EyeOfCthulhu, Column.CTHULHU_COLUMN), + LeaderboardInfo.Map(StatisticEntry.EaterOfWorlds, Column.EATER_COLUMN), + LeaderboardInfo.Map(StatisticEntry.Skeletron, Column.SKELETRON_COLUMN), + LeaderboardInfo.Map(StatisticEntry.WallOfFlesh, Column.WALL_COLUMN) + }; + leaderboardInfoArray[3] = new LeaderboardInfo(LeaderboardInfo.CreateId("Normal bosses"), columns4, LeaderboardInfo.TitleTextID.NORMAL_BOSSES); + LeaderboardInfo.ColumnMapping[] columns5 = new LeaderboardInfo.ColumnMapping[4] + { + LeaderboardInfo.Map(StatisticEntry.TheTwins, Column.TWINS_COLUMN), + LeaderboardInfo.Map(StatisticEntry.TheDestroyer, Column.DESTROYER_COLUMN), + LeaderboardInfo.Map(StatisticEntry.SkeletronPrime, Column.SKELETRON_PRIME_COLUMN), + LeaderboardInfo.Map(StatisticEntry.Ocram, Column.OCRAM_COLUMN) + }; + leaderboardInfoArray[4] = new LeaderboardInfo(LeaderboardInfo.CreateId("Hard bosses"), columns5, LeaderboardInfo.TitleTextID.HARD_BOSSES); + return leaderboardInfoArray; + } + + public static LeaderboardIdentity GetIdentity(Leaderboard board) + { + return LeaderboardInfo.LEADERBOARDS_INFO[(int) board].Identity; + } + + public static Column[] GetColumns(Leaderboard board) + { + LeaderboardInfo leaderboardInfo = LeaderboardInfo.LEADERBOARDS_INFO[(int) board]; + Column[] columnArray = new Column[leaderboardInfo.Columns.Length]; + for (int index = leaderboardInfo.Columns.Length - 1; index > -1; --index) + columnArray[index] = leaderboardInfo.Columns[index].Column; + return columnArray; + } + + public static string GetName(Leaderboard board) + { + LeaderboardInfo leaderboardInfo = LeaderboardInfo.LEADERBOARDS_INFO[(int) board]; + return Lang.menu[leaderboardInfo.NameID]; + } + + public static void SubmitStatistics(Statistics stats, NetworkGamer gamer) + { + if (Netplay.session.SessionState != NetworkSessionState.Playing) + return; + LeaderboardWriter leaderboardWriter = gamer.LeaderboardWriter; + if (leaderboardWriter == null) + return; + foreach (LeaderboardInfo leaderboardInfo in LeaderboardInfo.LEADERBOARDS_INFO) + leaderboardInfo.Submit(leaderboardWriter, stats); + } + + public static void SubmitStatisticsToLeaderboard(Leaderboard board, Statistics stats, Gamer gamer) + { + LeaderboardWriter leaderboardWriter = gamer.LeaderboardWriter; + if (leaderboardWriter == null) + return; + LeaderboardInfo.LEADERBOARDS_INFO[(int) board].Submit(leaderboardWriter, stats); + } + + private void Submit(LeaderboardWriter writer, Statistics stats) + { + long num1 = 0L; + LeaderboardEntry leaderboard = writer.GetLeaderboard(this.Identity); + foreach (LeaderboardInfo.ColumnMapping columnMapping in this.Columns) + { + uint num2 = stats[columnMapping.Statistic]; + int num3 = (int) num2; + leaderboard.Columns[columnMapping.ColumnName] = (object) num3; + num1 += (long) num2; + } + leaderboard.Rating = num1; + } + + private enum TitleTextID + { + DISTANCE = 58, + MINING_GATHERING = 59, + CRAFTING = 60, + USED = 61, + NORMAL_BOSSES = 62, + HARD_BOSSES = 63, + DEATHS = 64, + } + + private class ColumnMapping + { + public StatisticEntry Statistic; + public Column Column; + public string ColumnName; + + public ColumnMapping(StatisticEntry entry, Column column, string name) + { + this.Statistic = entry; + this.Column = column; + this.ColumnName = name; + } + } + } +} diff --git a/Terraria/Leaderboards/LeaderboardsUI.cs b/Terraria/Leaderboards/LeaderboardsUI.cs new file mode 100644 index 0000000..54a5b35 --- /dev/null +++ b/Terraria/Leaderboards/LeaderboardsUI.cs @@ -0,0 +1,254 @@ +// Type: Terraria.Leaderboards.LeaderboardsUI +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.GamerServices; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Input; +using System; +using System.Text; +using Terraria; + +namespace Terraria.Leaderboards +{ + internal class LeaderboardsUI + { + private static Color ROW_COLOR_SELECTED = Color.White; + private static Color ROW_COLOR = Terraria.UI.DEFAULT_DIALOG_COLOR; + public const uint MAX_NUMBER = 99999999U; + public const string MAX_NUMBER_STRING = "99999999"; + private const int ROW_HEIGHT = 50; + private const int ROW_WIDTH = 900; + private const int ROW_SPACING = 5; + private const int BACKGROUND_X = 20; + private const int RANK_X = 80; + private const int GAMERTAG_X = 250; + private const int STATISTICS_X = 375; + private const int STATISTICS_WIDTH = 550; + private const int MAX_ROWS_PER_SCREEN = 7; + private const Leaderboard DEFAULT_LEADERBOARD = Leaderboard.DISTANCE; + private LeaderboardData Data; + private BoxGraphic Box; + private Terraria.UI parentUI; + private int uiDelay; + private LeaderboardsUI.LeaderboardMode mode; + private Leaderboard SelectedLeaderboard; + private int[] StatisticsPositions; + private int[] IconPositions; + private Texture2D[] IconIndices; + + static LeaderboardsUI() + { + } + + public LeaderboardsUI(Terraria.UI parentUI) + { + this.Data = new LeaderboardData(7); + this.Box = BoxGraphic.Create(900, 50, Terraria.HowToPlay.Assets.TEXT_BACKGROUND, 8, LeaderboardsUI.ROW_COLOR); + this.uiDelay = 0; + this.parentUI = parentUI; + this.SelectedLeaderboard = Leaderboard.DISTANCE; + } + + public void InitializeData() + { + this.mode = LeaderboardsUI.LeaderboardMode.Overall; + this.SelectedLeaderboard = Leaderboard.DISTANCE; + this.LoadLeaderboard(); + } + + private void CalculateStatisticPositions() + { + float num1 = Terraria.UI.MeasureString(Terraria.UI.fontSmallOutline, "99999999").X; + Column[] columnArray = this.Data.Columns; + int length = columnArray.Length; + float num2 = (float) (((double) (550 / length) - (double) num1) * 0.5); + this.StatisticsPositions = new int[length]; + this.IconIndices = new Texture2D[length]; + this.IconPositions = new int[length]; + float num3 = 375f; + for (int index = 0; index < length; ++index) + { + this.StatisticsPositions[index] = (int) ((double) num3 + (double) num2 + (double) num1 * 0.5); + num3 += num1 + num2 * 2f; + Column column = columnArray[index]; + this.IconIndices[index] = Assets.COLUMN_ICONS[(int) column]; + this.IconPositions[index] = this.StatisticsPositions[index] - (this.IconIndices[index].Width >> 1); + } + } + + public void Update() + { + if (!this.parentUI.HasOnline() || !this.Data.Update()) + { + MessageBox.Show(this.parentUI.controller, Lang.menu[5], Lang.inter[36], new string[1] + { + Lang.menu[90] + }, 1 != 0); + this.parentUI.PrevMenu(-1); + } + else if (this.uiDelay > 0) + { + --this.uiDelay; + } + else + { + if (!this.Data.Ready) + return; + bool flag = false; + if (this.parentUI.IsDownButtonDown()) + flag = this.Data.MoveDown(); + else if (this.parentUI.IsUpButtonDown()) + flag = this.Data.MoveUp(); + else if (this.parentUI.IsButtonTriggered(Buttons.X) && !this.parentUI.signedInGamer.IsGuest) + this.SwitchLeaderboardFilter(); + else if (this.parentUI.IsButtonTriggered(Buttons.LeftShoulder)) + this.PreviousLeaderboard(); + else if (this.parentUI.IsButtonTriggered(Buttons.RightShoulder)) + this.NextLeaderboard(); + else if (this.parentUI.IsButtonTriggered(Buttons.A) && this.parentUI.CanViewGamerCard() && this.Data.NumEntries > 0) + this.parentUI.ShowGamerCard(this.Data.GetSelectedGamer()); + if (!flag) + return; + this.uiDelay = 12; + Main.PlaySound(12); + } + } + + private void NextLeaderboard() + { + int num = (int) (this.SelectedLeaderboard + 1); + if (num == 5) + num = 0; + this.SelectedLeaderboard = (Leaderboard) num; + this.LoadLeaderboard(); + } + + private void PreviousLeaderboard() + { + int num = (int) (this.SelectedLeaderboard - 1); + if (num < 0) + num = 4; + this.SelectedLeaderboard = (Leaderboard) num; + this.LoadLeaderboard(); + } + + private void LoadLeaderboard() + { + switch (this.mode) + { + case LeaderboardsUI.LeaderboardMode.MyScore: + this.Data.LoadLeaderboard(this.SelectedLeaderboard, (Gamer) this.parentUI.signedInGamer); + break; + case LeaderboardsUI.LeaderboardMode.Friends: + SignedInGamer signedInGamer = this.parentUI.signedInGamer; + this.Data.LoadLeaderboard(this.SelectedLeaderboard, signedInGamer.GetFriends(), (Gamer) signedInGamer); + break; + default: + this.Data.LoadLeaderboard(this.SelectedLeaderboard); + break; + } + this.CalculateStatisticPositions(); + } + + private void SwitchLeaderboardFilter() + { + if (this.mode == LeaderboardsUI.LeaderboardMode.Overall) + this.mode = LeaderboardsUI.LeaderboardMode.MyScore; + else if (this.mode == LeaderboardsUI.LeaderboardMode.MyScore) + this.mode = LeaderboardsUI.LeaderboardMode.Friends; + else if (this.mode == LeaderboardsUI.LeaderboardMode.Friends) + this.mode = LeaderboardsUI.LeaderboardMode.Overall; + this.LoadLeaderboard(); + } + + public void Draw(WorldView view) + { + SpriteFont font = Terraria.UI.fontSmallOutline; + int x = view.SAFE_AREA_OFFSET_L; + int y = view.SAFE_AREA_OFFSET_T; + Main.strBuilder.Length = 0; + Main.strBuilder.Append(Lang.inter[37]); + Main.strBuilder.Append(this.Data.NumEntries); + Main.strBuilder.Append('\n'); + Main.strBuilder.Append(this.Data.LeaderboardName); + Terraria.UI.DrawStringLT(font, x, y, Color.White); + Vector2 vector2 = new Vector2((float) x, (float) (y + 10)); + for (int index = 0; index < this.IconIndices.Length; ++index) + { + vector2.X = (float) this.IconPositions[index]; + Main.spriteBatch.Draw(this.IconIndices[index], vector2, Color.White); + } + vector2.Y = (float) (view.SAFE_AREA_OFFSET_T + 95); + LeaderboardData.Row[] rows = this.Data.GetRows(); + for (int index1 = 0; index1 < rows.Length; ++index1) + { + this.Box.Color = index1 + this.Data.BatchStart == this.Data.Selected ? LeaderboardsUI.ROW_COLOR_SELECTED : LeaderboardsUI.ROW_COLOR; + this.Box.Draw(new Vector2i(20, (int) vector2.Y - 25), 1f); + LeaderboardData.Row row = rows[index1]; + if (row != null && row.Available) + { + vector2.X = 80f; + string str1 = ToStringExtensions.ToStringLookup(row.Rank); + Vector2 pivot = Terraria.UI.MeasureString(font, str1); + pivot.X = (float) ((int) pivot.X >> 1); + pivot.Y = (float) ((int) pivot.Y >> 1); + Terraria.UI.DrawStringScaled(font, str1, vector2, Color.White, pivot, 1f); + vector2.X = 250f; + string gamertag = row.Gamertag; + pivot = Terraria.UI.MeasureString(font, gamertag); + pivot.X = (float) ((int) pivot.X >> 1); + pivot.Y = (float) ((int) pivot.Y >> 1); + Terraria.UI.DrawStringScaled(font, gamertag, vector2, Color.White, pivot, 1f); + for (int index2 = Math.Min(this.StatisticsPositions.Length, row.Statistics.Length) - 1; index2 >= 0; --index2) + { + vector2.X = (float) this.StatisticsPositions[index2]; + uint num = row.Statistics[index2]; + string str2 = num < 99999999U ? ToStringExtensions.ToStringLookup((int) num) : "99999999"; + pivot = Terraria.UI.MeasureString(font, str2); + pivot.X = (float) ((int) pivot.X >> 1); + pivot.Y = (float) ((int) pivot.Y >> 1); + Terraria.UI.DrawStringScaled(font, str2, vector2, Color.White, pivot, 1f); + } + } + vector2.Y += 55f; + } + } + + public void ControlDescription(StringBuilder strBuilder) + { + strBuilder.Append(Lang.controls(Lang.CONTROLS.SWITCH_LEADERBOARD)); + strBuilder.Append(' '); + if (this.parentUI.CanViewGamerCard() && this.Data.NumEntries > 0) + { + strBuilder.Append(Lang.controls(Lang.CONTROLS.SHOW_GAMERCARD)); + strBuilder.Append(' '); + } + strBuilder.Append(Lang.controls(Lang.CONTROLS.BACK)); + if (this.parentUI.signedInGamer.IsGuest) + return; + strBuilder.Append(' '); + if (this.mode == LeaderboardsUI.LeaderboardMode.Friends) + strBuilder.Append(Lang.controls(Lang.CONTROLS.SHOW_TOP)); + else if (this.mode == LeaderboardsUI.LeaderboardMode.Overall) + { + strBuilder.Append(Lang.controls(Lang.CONTROLS.SHOW_MYSELF)); + } + else + { + if (this.mode != LeaderboardsUI.LeaderboardMode.MyScore) + return; + strBuilder.Append(Lang.controls(Lang.CONTROLS.SHOW_FRIENDS)); + } + } + + private enum LeaderboardMode + { + Overall, + MyScore, + Friends, + } + } +} diff --git a/Terraria/Leaderboards/MockReader.cs b/Terraria/Leaderboards/MockReader.cs new file mode 100644 index 0000000..855934a --- /dev/null +++ b/Terraria/Leaderboards/MockReader.cs @@ -0,0 +1,92 @@ +// Type: Terraria.Leaderboards.MockReader +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using System; +using Terraria; + +namespace Terraria.Leaderboards +{ + public class MockReader + { + private const int SEED = 1234567; + private LeaderboardData.Row[] Database; + private int PageSize; + public bool Loaded; + public int PageStart; + + public bool CanPageDown + { + get + { + return this.PageStart + this.PageSize < this.TotalLeaderboardSize; + } + } + + public bool CanPageUp + { + get + { + return this.PageStart > 0; + } + } + + public int TotalLeaderboardSize + { + get + { + if (!this.Loaded) + return 0; + else + return this.Database.Length; + } + } + + public LeaderboardData.Row[] Entries + { + get + { + LeaderboardData.Row[] rowArray = new LeaderboardData.Row[this.PageSize]; + for (int index = this.PageSize - 1; index >= 0; --index) + rowArray[index] = this.Database[this.PageStart + index]; + return rowArray; + } + } + + private MockReader(LeaderboardData.Row[] database, int pageStart, int pageSize) + { + this.Database = database; + this.PageSize = pageSize; + this.PageStart = pageStart; + } + + public static MockReader Create(int numEntries, int pageSize, int numColumns) + { + FastRandom fastRandom = new FastRandom(1234567U); + LeaderboardData.Row[] database = new LeaderboardData.Row[numEntries]; + for (int index1 = numEntries - 1; index1 >= 0; --index1) + { + database[index1] = new LeaderboardData.Row() + { + Available = true, + Rank = index1 + 1, + Statistics = new uint[numColumns] + }; + for (int index2 = 0; index2 < numColumns; ++index2) + database[index1].Statistics[index2] = (uint) fastRandom.Next(109999998); + } + return new MockReader(database, 0, Math.Min(numEntries, pageSize)); + } + + public void PageDown() + { + this.PageStart = Math.Min(this.PageStart + this.PageSize, this.TotalLeaderboardSize - this.PageSize); + } + + public void PageUp() + { + this.PageStart = Math.Max(this.PageStart - this.PageSize, 0); + } + } +} diff --git a/Terraria/Lighting.cs b/Terraria/Lighting.cs new file mode 100644 index 0000000..916e6d3 --- /dev/null +++ b/Terraria/Lighting.cs @@ -0,0 +1,1413 @@ +// Type: Terraria.Lighting +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework; +using System; +using System.Threading; + +namespace Terraria +{ + public sealed class Lighting + { + private static Lighting.TempLight[] tempLight = new Lighting.TempLight[1024]; + public short scrX = (short) -1; + private float negLight = 0.04f; + private float negLight2 = 0.16f; + private float wetLightR = 0.16f; + private float wetLightG = 0.16f; + private AutoResetEvent workerThreadReady = new AutoResetEvent(false); + private AutoResetEvent workerThreadGo = new AutoResetEvent(false); + public const int maxRenderCount = 4; + public const int OFFSCREEN_TILES = 34; + public const int offScreenTiles2 = 14; + private const int MAX_LIGHT_ARRAY_Y = 107; + private const int COLOR_H = 117; + public const float BRIGHTNESS = 1.2f; + private const int firstToLightY7 = 0; + private const int MAX_TEMP_LIGHTS = 1024; + private int MAX_LIGHT_ARRAY_X; + private int COLOR_W; + public float brightness; + public float defBrightness; + public float oldSkyColor; + public float skyColor; + private float lightColor; + private float lightColorG; + private float lightColorB; + public Vector3[,] color; + public Vector3[,] color2; + public byte[] stopAndWetLight; + private int firstTileX; + private int firstTileY; + private int lastTileX; + private int lastTileY; + private int firstToLightX; + private int firstToLightY; + public short scrY; + public int minX; + public int maxX; + public int minY; + public int maxY; + private int minX7; + private int maxX7; + private int minY7; + private int maxY7; + private int firstTileX7; + private int lastTileX7; + private int lastTileY7; + private int firstTileY7; + private int lastToLightY7; + private int firstToLightX27; + private int lastToLightX27; + private int firstToLightY27; + private int lastToLightY27; + private Thread workerThread; + private volatile bool quitWorkerThread; + public static int tempLightCount; + + static Lighting() + { + } + + public void StartWorkerThread() + { + if (this.workerThread != null) + this.StopWorkerThread(); + this.quitWorkerThread = false; + this.workerThreadReady.Reset(); + this.workerThreadGo.Reset(); + this.workerThread = new Thread(new ThreadStart(this.WorkerThread)); + this.workerThread.IsBackground = true; + this.workerThread.Start(); + } + + public void StopWorkerThread() + { + if (this.workerThread == null) + return; + this.quitWorkerThread = true; + this.workerThreadGo.Set(); + this.workerThread.Join(); + this.workerThread = (Thread) null; + } + + private void WorkerThread() + { + Thread.CurrentThread.SetProcessorAffinity(new int[1] + { + 3 + }); + do + { + this.workerThreadReady.Set(); + this.workerThreadGo.WaitOne(); + lock (this) + this.doColors(); + } + while (!this.quitWorkerThread); + this.workerThreadReady.Set(); + } + + public void SetWidth(int width) + { + lock (this) + { + this.MAX_LIGHT_ARRAY_X = (width + 64 >> 4) + 68; + this.COLOR_W = this.MAX_LIGHT_ARRAY_X + 10; + this.color = new Vector3[this.MAX_LIGHT_ARRAY_X, 107]; + this.color2 = new Vector3[this.COLOR_W, 117]; + this.stopAndWetLight = new byte[this.COLOR_W * 117]; + } + } + + public unsafe void LightTiles(WorldView view) + { + this.firstTileX = (int) view.firstTileX; + this.lastTileX = (int) view.lastTileX; + this.firstTileY = (int) view.firstTileY; + this.lastTileY = (int) view.lastTileY; + this.firstToLightX = this.firstTileX - 34; + this.firstToLightY = this.firstTileY - 34; + int num1 = this.lastTileX + 34; + int num2 = this.lastTileY + 34; + if (this.firstToLightX < 0) + this.firstToLightX = 0; + if (num1 >= (int) Main.maxTilesX) + num1 = (int) Main.maxTilesX - 1; + if (this.firstToLightY < 0) + this.firstToLightY = 0; + if (num2 >= (int) Main.maxTilesY) + num2 = (int) Main.maxTilesY - 1; + if (Main.renderCount <= 4) + { + int num3 = (view.screenPosition.X >> 4) - (view.screenLastPosition.X >> 4); + if (num3 < 0 && num3 >= -4) + { + Vector3[,] vector3Array; + // ISSUE: cast to a reference type + // ISSUE: explicit reference operation + fixed (Vector3* vector3Ptr1 = &^((vector3Array = this.color) == null || vector3Array.Length == 0 ? (Vector3&) IntPtr.Zero : vector3Array.Address(0, 0))) + { + int num4 = (this.MAX_LIGHT_ARRAY_X + num3) * 107 - 1; + int index = num3 * 107; + Vector3* vector3Ptr2 = vector3Ptr1 + (this.MAX_LIGHT_ARRAY_X * 107 - 1); + do + { + *vector3Ptr2 = vector3Ptr2[index]; + --vector3Ptr2; + } + while (--num4 >= 0); + } + } + else if (num3 > 0 && num3 <= 4) + { + Vector3[,] vector3Array; + // ISSUE: cast to a reference type + // ISSUE: explicit reference operation + fixed (Vector3* vector3Ptr1 = &^((vector3Array = this.color) == null || vector3Array.Length == 0 ? (Vector3&) IntPtr.Zero : vector3Array.Address(0, 0))) + { + int num4 = (this.MAX_LIGHT_ARRAY_X - num3) * 107 - 1; + int index = num3 * 107; + Vector3* vector3Ptr2 = vector3Ptr1; + do + { + *vector3Ptr2 = vector3Ptr2[index]; + ++vector3Ptr2; + } + while (--num4 >= 0); + } + } + int num5 = (view.screenPosition.Y >> 4) - (view.screenLastPosition.Y >> 4); + if (num5 < 0 && num5 >= -4) + { + for (int index1 = 0; index1 < this.MAX_LIGHT_ARRAY_X; ++index1) + { + fixed (Vector3* vector3Ptr = &this.color[index1, 0]) + { + for (int index2 = 107 + num5; index2 > -num5; --index2) + vector3Ptr[index2] = vector3Ptr[index2 + num5]; + } + } + } + else if (num5 > 0 && num5 <= 4) + { + for (int index1 = 0; index1 < this.MAX_LIGHT_ARRAY_X; ++index1) + { + fixed (Vector3* vector3Ptr = &this.color[index1, 0]) + { + for (int index2 = 0; index2 < 107 - num5; ++index2) + vector3Ptr[index2] = vector3Ptr[index2 + num5]; + } + } + } + this.oldSkyColor = this.skyColor; + this.skyColor = (float) (((double) view.time.tileColorf.X + (double) view.time.tileColorf.Y + (double) view.time.tileColorf.Z) * 0.333333343267441); + if ((double) this.oldSkyColor == (double) this.skyColor) + return; + int num6 = num2 <= Main.worldSurface ? num2 : Main.worldSurface; + Tile[,] tileArray; + // ISSUE: cast to a reference type + // ISSUE: explicit reference operation + fixed (Tile* tilePtr1 = &^((tileArray = Main.tile) == null || tileArray.Length == 0 ? (Tile&) IntPtr.Zero : tileArray.Address(0, 0))) + { + for (int index = this.firstToLightX; index < num1; ++index) + { + Tile* tilePtr2 = tilePtr1 + (index * 1440 + this.firstToLightY); + int num4 = this.firstToLightY; + while (num4 < num6) + { + if (((int) tilePtr2->active == 0 || !Main.tileNoSunLight[(int) tilePtr2->type]) && ((int) tilePtr2->wall == 0 || (int) tilePtr2->wall == 21) && (int) tilePtr2->liquid < 200) + { + fixed (Vector3* vector3Ptr = &this.color[index - this.firstToLightX, num4 - this.firstToLightY]) + { + if ((double) vector3Ptr->X < (double) this.skyColor) + { + vector3Ptr->X = view.time.tileColorf.X; + if ((double) vector3Ptr->Y < (double) this.skyColor) + vector3Ptr->Y = view.time.tileColorf.Y; + if ((double) vector3Ptr->Z < (double) this.skyColor) + vector3Ptr->Z = view.time.tileColorf.Z; + } + } + } + ++num4; + ++tilePtr2; + } + } + } + } + else + { + this.workerThreadReady.WaitOne(); + int num3 = view.screenPosition.X >> 4; + int num4 = view.screenPosition.Y >> 4; + if ((int) this.scrX >= 0) + { + int num5 = num3 - (int) this.scrX; + int num6 = num4 - (int) this.scrY; + int num7 = num5 < 0 ? -num5 : 0; + int num8 = num6 < 0 ? -num6 : 0; + Vector3[,] vector3Array1; + // ISSUE: cast to a reference type + // ISSUE: explicit reference operation + fixed (Vector3* vector3Ptr1 = &^((vector3Array1 = this.color) == null || vector3Array1.Length == 0 ? (Vector3&) IntPtr.Zero : vector3Array1.Address(0, 0))) + { + Vector3[,] vector3Array2; + // ISSUE: cast to a reference type + // ISSUE: explicit reference operation + fixed (Vector3* vector3Ptr2 = &^((vector3Array2 = this.color2) == null || vector3Array2.Length == 0 ? (Vector3&) IntPtr.Zero : vector3Array2.Address(0, 0))) + { + for (int index1 = num7; index1 < this.MAX_LIGHT_ARRAY_X; ++index1) + { + Vector3* vector3Ptr3 = vector3Ptr1 + (index1 * 107 + num8); + Vector3* vector3Ptr4 = vector3Ptr2 + ((index1 + num5) * 117 + num8 + num6); + for (int index2 = num8; index2 < 107; ++index2) + *vector3Ptr3++ = *vector3Ptr4++; + } + } + } + } + Vector3[,] vector3Array3; + // ISSUE: cast to a reference type + // ISSUE: explicit reference operation + fixed (Vector3* vector3Ptr1 = &^((vector3Array3 = this.color2) == null || vector3Array3.Length == 0 ? (Vector3&) IntPtr.Zero : vector3Array3.Address(0, 0))) + fixed (byte* numPtr1 = this.stopAndWetLight) + { + Vector3* vector3Ptr2 = vector3Ptr1; + byte* numPtr2 = numPtr1; + for (int index = this.COLOR_W * 117 - 1; index >= 0; --index) + { + vector3Ptr2->X = 0.0f; + vector3Ptr2->Y = 0.0f; + vector3Ptr2->Z = 0.0f; + *numPtr2 = (byte) 0; + ++vector3Ptr2; + ++numPtr2; + } + } + fixed (Lighting.TempLight* tempLightPtr1 = Lighting.tempLight) + { + Vector3[,] vector3Array1; + // ISSUE: cast to a reference type + // ISSUE: explicit reference operation + fixed (Vector3* vector3Ptr1 = &^((vector3Array1 = this.color2) == null || vector3Array1.Length == 0 ? (Vector3&) IntPtr.Zero : vector3Array1.Address(0, 0))) + { + Lighting.TempLight* tempLightPtr2 = tempLightPtr1; + for (int index = Lighting.tempLightCount - 1; index >= 0; --index) + { + int num5 = (int) tempLightPtr2->x - this.firstToLightX; + if (num5 >= 0 && num5 < this.COLOR_W) + { + int num6 = (int) tempLightPtr2->y - this.firstToLightY; + if (num6 >= 0 && num6 < 117) + { + Vector3* vector3Ptr2 = vector3Ptr1 + (num6 + num5 * 117); + vector3Ptr2->X = tempLightPtr2->color.X; + vector3Ptr2->Y = tempLightPtr2->color.Y; + vector3Ptr2->Z = tempLightPtr2->color.Z; + } + } + ++tempLightPtr2; + } + } + } + int num9 = this.firstTileX - 14; + int num10 = this.firstTileY - 14; + int num11 = this.lastTileX + 14; + int num12 = this.lastTileY + 14; + if (num9 < 0) + num9 = 0; + if (num11 >= (int) Main.maxTilesX) + num11 = (int) Main.maxTilesX - 1; + if (num10 < 0) + num10 = 0; + if (num12 >= (int) Main.maxTilesY) + num12 = (int) Main.maxTilesY - 1; + if (NPC.wof >= 0) + { + if (view.player.horrified) + { + try + { + int num5 = (view.screenPosition.Y >> 4) - 10; + int num6 = (view.screenPosition.Y + 540 >> 4) + 10; + int num7 = Main.npc[NPC.wof].aabb.X >> 4; + int num8 = (int) Main.npc[NPC.wof].direction <= 0 ? num7 + 2 : num7 - 3; + int num13 = num8 + 8; + Vector3 vector3 = new Vector3((float) (0.200000002980232 * (0.5 * (double) Main.demonTorch + 1.0 * (1.0 - (double) Main.demonTorch))), 0.03f, (float) (0.300000011920929 * ((double) Main.demonTorch + 0.5 * (1.0 - (double) Main.demonTorch)))); + for (int index1 = num8; index1 <= num13; ++index1) + { + for (int index2 = num5; index2 <= num6; ++index2) + Vector3.Max(ref vector3, this.color2.Address(index1 - this.firstToLightX, index2 - this.firstToLightY), this.color2.Address(index1 - this.firstToLightX, index2 - this.firstToLightY)); + } + } + catch + { + } + } + } + int num14 = this.firstToLightX; + int num15 = num1; + int num16 = this.firstToLightY; + int num17 = num2; + int num18 = num17 < Main.worldSurface ? num17 : Main.worldSurface; + Tile[,] tileArray1; + // ISSUE: cast to a reference type + // ISSUE: explicit reference operation + fixed (Tile* tilePtr1 = &^((tileArray1 = Main.tile) == null || tileArray1.Length == 0 ? (Tile&) IntPtr.Zero : tileArray1.Address(0, 0))) + { + for (int index = num14; index < num15; ++index) + { + Tile* tilePtr2 = tilePtr1 + (index * 1440 + num16); + int num5 = num16; + while (num5 < num18) + { + switch (tilePtr2->wall) + { + case (byte) 0: + case (byte) 21: + if ((int) tilePtr2->liquid < 200 && ((int) tilePtr2->active == 0 || !Main.tileNoSunLight[(int) tilePtr2->type])) + { + fixed (Vector3* vector3Ptr = &this.color2[index - this.firstToLightX, num5 - this.firstToLightY]) + { + if ((double) vector3Ptr->X < (double) this.skyColor) + { + vector3Ptr->X = view.time.tileColorf.X; + if ((double) vector3Ptr->Y < (double) this.skyColor) + vector3Ptr->Y = view.time.tileColorf.Y; + if ((double) vector3Ptr->Z < (double) this.skyColor) + vector3Ptr->Z = view.time.tileColorf.Z; + } + } + break; + } + else + break; + } + ++num5; + ++tilePtr2; + } + } + } + this.negLight = 0.91f; + this.negLight2 = 0.72f; + this.wetLightG = 0.97f * this.negLight * UI.blueWave; + this.wetLightR = 0.88f * this.negLight * UI.blueWave; + if (view.player.nightVision) + { + this.negLight *= 1.03f; + this.negLight2 *= 1.03f; + } + if (view.player.blind) + { + this.negLight *= 0.95f; + this.negLight2 *= 0.95f; + } + view.inactiveTiles = 0; + view.sandTiles = 0; + view.evilTiles = 0; + view.snowTiles = 0; + view.holyTiles = 0; + view.meteorTiles = 0; + view.jungleTiles = 0; + view.dungeonTiles = 0; + view.musicBox = -1; + this.minX = this.COLOR_W; + this.maxX = 0; + this.minY = 117; + this.maxY = 0; + Tile[,] tileArray2; + // ISSUE: cast to a reference type + // ISSUE: explicit reference operation + fixed (Tile* tilePtr1 = &^((tileArray2 = Main.tile) == null || tileArray2.Length == 0 ? (Tile&) IntPtr.Zero : tileArray2.Address(0, 0))) + { + for (int index1 = num14; index1 < num15; ++index1) + { + Tile* tilePtr2 = tilePtr1 + (index1 * 1440 + num16); + int num5 = num16; + while (num5 < num17) + { + int index2 = index1 - this.firstToLightX; + int index3 = num5 - this.firstToLightY; + fixed (Vector3* vector3Ptr = &this.color2[index2, index3]) + { + if ((int) tilePtr2->active == 0) + { + ++view.inactiveTiles; + } + else + { + int index4 = (int) tilePtr2->type; + int num6 = num15 - num14 - 99 >> 1; + int num7 = num17 - num16 - 87 >> 1; + if (index1 > num14 + num6 && index1 < num15 - num6 && (num5 > num16 + num7 && num5 < num17 - num7)) + { + switch (index4) + { + case 109: + case 110: + case 113: + case 117: + ++view.holyTiles; + break; + case 112: + ++view.sandTiles; + ++view.evilTiles; + break; + case 116: + ++view.sandTiles; + ++view.holyTiles; + break; + case 139: + if ((int) tilePtr2->frameX >= 36) + { + view.musicBox = (int) tilePtr2->frameY / 36; + break; + } + else + break; + case 147: + case 148: + ++view.snowTiles; + break; + case 60: + case 61: + case 62: + case 84: + ++view.jungleTiles; + break; + case 37: + ++view.meteorTiles; + break; + case 41: + case 43: + case 44: + ++view.dungeonTiles; + break; + case 53: + ++view.sandTiles; + break; + case 23: + case 24: + case 25: + case 32: + ++view.evilTiles; + break; + case 27: + view.evilTiles -= 5; + break; + } + } + if (Main.tileBlockLight[index4]) + this.stopAndWetLight[index2 * 117 + index3] = (byte) 1; + if (Main.tileLighted[index4]) + { + switch (index4) + { + case 140: + case 22: + float num8 = 0.12f; + float num13 = 0.07f; + float num19 = 0.32f; + if ((double) num8 > (double) vector3Ptr->X) + vector3Ptr->X = num8; + if ((double) num13 > (double) vector3Ptr->Y) + vector3Ptr->Y = num13; + if ((double) num19 > (double) vector3Ptr->Z) + { + vector3Ptr->Z = num19; + break; + } + else + break; + case 149: + if ((int) tilePtr2->frameX <= 36) + { + float num20; + float num21; + float num22; + if ((int) tilePtr2->frameX == 0) + { + num20 = 0.1f; + num21 = 0.2f; + num22 = 0.5f; + } + else if ((int) tilePtr2->frameX == 18) + { + num20 = 0.5f; + num21 = 0.1f; + num22 = 0.1f; + } + else + { + num20 = 0.2f; + num21 = 0.5f; + num22 = 0.1f; + } + if ((double) vector3Ptr->X < (double) num20) + vector3Ptr->X = (float) ((double) num20 * (double) Main.rand.Next(970, 1031) * (1.0 / 1000.0)); + if ((double) vector3Ptr->Y < (double) num21) + vector3Ptr->Y = (float) ((double) num21 * (double) Main.rand.Next(970, 1031) * (1.0 / 1000.0)); + if ((double) vector3Ptr->Z < (double) num22) + { + vector3Ptr->Z = (float) ((double) num22 * (double) Main.rand.Next(970, 1031) * (1.0 / 1000.0)); + break; + } + else + break; + } + else + break; + case 125: + float num23 = (float) Main.rand.Next(28, 42) * 0.01f + (float) (270 - (int) UI.mouseTextBrightness) * (1.0 / 800.0); + if ((double) vector3Ptr->Y < 0.100000001490116 * (double) num23) + vector3Ptr->Y = 0.3f * num23; + if ((double) vector3Ptr->Z < 0.300000011920929 * (double) num23) + { + vector3Ptr->Z = 0.6f * num23; + break; + } + else + break; + case 126: + if ((int) tilePtr2->frameX < 36) + { + if ((double) Main.DiscoRGB.X > (double) vector3Ptr->X) + vector3Ptr->X = Main.DiscoRGB.X; + if ((double) Main.DiscoRGB.Y > (double) vector3Ptr->Y) + vector3Ptr->Y = Main.DiscoRGB.Y; + if ((double) Main.DiscoRGB.Z > (double) vector3Ptr->Z) + { + vector3Ptr->Z = Main.DiscoRGB.Z; + break; + } + else + break; + } + else + break; + case 129: + float num24; + float num25; + float num26; + if ((int) tilePtr2->frameX == 0 || (int) tilePtr2->frameX == 54 || (int) tilePtr2->frameX == 108) + { + num24 = 0.0f; + num25 = 0.05f; + num26 = 0.25f; + } + else if ((int) tilePtr2->frameX == 18 || (int) tilePtr2->frameX == 72 || (int) tilePtr2->frameX == 126) + { + num24 = 0.2f; + num25 = 0.0f; + num26 = 0.15f; + } + else + { + num24 = 0.1f; + num25 = 0.0f; + num26 = 0.2f; + } + if ((double) vector3Ptr->X < (double) num24) + vector3Ptr->X = (float) ((double) num24 * (double) Main.rand.Next(970, 1031) * (1.0 / 1000.0)); + if ((double) vector3Ptr->Y < (double) num25) + vector3Ptr->Y = (float) ((double) num25 * (double) Main.rand.Next(970, 1031) * (1.0 / 1000.0)); + if ((double) vector3Ptr->Z < (double) num26) + { + vector3Ptr->Z = (float) ((double) num26 * (double) Main.rand.Next(970, 1031) * (1.0 / 1000.0)); + break; + } + else + break; + case 133: + case 17: + float num27 = 0.83f; + float num28 = 0.6f; + float num29 = 0.5f; + if ((double) num27 > (double) vector3Ptr->X) + vector3Ptr->X = num27; + if ((double) num28 > (double) vector3Ptr->Y) + vector3Ptr->Y = num28; + if ((double) num29 > (double) vector3Ptr->Z) + { + vector3Ptr->Z = num29; + break; + } + else + break; + case 83: + if ((int) tilePtr2->frameX == 18 && !view.time.dayTime) + { + float num20 = 0.1f; + float num21 = 0.4f; + float num22 = 0.6f; + if ((double) num20 > (double) vector3Ptr->X) + vector3Ptr->X = num20; + if ((double) num21 > (double) vector3Ptr->Y) + vector3Ptr->Y = num21; + if ((double) num22 > (double) vector3Ptr->Z) + { + vector3Ptr->Z = num22; + break; + } + else + break; + } + else + break; + case 84: + switch ((int) tilePtr2->frameX / 18) + { + case 2: + float num30 = (float) (270 - (int) UI.mouseTextBrightness) * (1.0 / 800.0); + if ((double) num30 > 1.0) + num30 = 1f; + else if ((double) num30 < 0.0) + num30 = 0.0f; + float num31 = 0.7f * num30; + float num32 = num30; + float num33 = 0.1f * num30; + if ((double) num31 > (double) vector3Ptr->X) + vector3Ptr->X = num31; + if ((double) num32 > (double) vector3Ptr->Y) + vector3Ptr->Y = num32; + if ((double) num33 > (double) vector3Ptr->Z) + { + vector3Ptr->Z = num33; + break; + } + else + break; + case 5: + float num34 = 0.9f; + float num35 = 0.72f; + float num36 = 0.18f; + if ((double) num34 > (double) vector3Ptr->X) + vector3Ptr->X = num34; + if ((double) num35 > (double) vector3Ptr->Y) + vector3Ptr->Y = num35; + if ((double) num36 > (double) vector3Ptr->Z) + { + vector3Ptr->Z = num36; + break; + } + else + break; + } + case 92: + if ((int) tilePtr2->frameY <= 18 && (int) tilePtr2->frameX == 0) + { + float num20 = 1f; + float num21 = 1f; + float num22 = 1f; + if ((double) num20 > (double) vector3Ptr->X) + vector3Ptr->X = num20; + if ((double) num21 > (double) vector3Ptr->Y) + vector3Ptr->Y = num21; + if ((double) num22 > (double) vector3Ptr->Z) + { + vector3Ptr->Z = num22; + break; + } + else + break; + } + else + break; + case 93: + if ((int) tilePtr2->frameY == 0 && (int) tilePtr2->frameX == 0) + { + float num20 = 1f; + float num21 = 0.97f; + float num22 = 0.85f; + if ((double) num20 > (double) vector3Ptr->X) + vector3Ptr->X = num20; + if ((double) num21 > (double) vector3Ptr->Y) + vector3Ptr->Y = num21; + if ((double) num22 > (double) vector3Ptr->Z) + { + vector3Ptr->Z = num22; + break; + } + else + break; + } + else + break; + case 95: + if ((int) tilePtr2->frameX < 36) + { + float num20 = 1f; + float num21 = 0.95f; + float num22 = 0.8f; + if ((double) num20 > (double) vector3Ptr->X) + vector3Ptr->X = num20; + if ((double) num21 > (double) vector3Ptr->Y) + vector3Ptr->Y = num21; + if ((double) num22 > (double) vector3Ptr->Z) + { + vector3Ptr->Z = num22; + break; + } + else + break; + } + else + break; + case 98: + if ((int) tilePtr2->frameY == 0) + { + float num20 = 1f; + float num21 = 0.97f; + float num22 = 0.85f; + if ((double) num20 > (double) vector3Ptr->X) + vector3Ptr->X = num20; + if ((double) num21 > (double) vector3Ptr->Y) + vector3Ptr->Y = num21; + if ((double) num22 > (double) vector3Ptr->Z) + { + vector3Ptr->Z = num22; + break; + } + else + break; + } + else + break; + case 100: + if ((int) tilePtr2->frameX < 36) + { + float num20 = 1f; + float num21 = 0.95f; + float num22 = 0.65f; + if ((double) num20 > (double) vector3Ptr->X) + vector3Ptr->X = num20; + if ((double) num21 > (double) vector3Ptr->Y) + vector3Ptr->Y = num21; + if ((double) num22 > (double) vector3Ptr->Z) + { + vector3Ptr->Z = num22; + break; + } + else + break; + } + else + break; + case 70: + case 71: + case 72: + float num37 = (float) Main.rand.Next(28, 42) * 0.005f + (float) (270 - (int) UI.mouseTextBrightness) * (1.0 / 500.0); + float num38 = 0.1f; + float num39 = 0.3f + num37; + float num40 = 0.6f + num37; + if ((double) num38 > (double) vector3Ptr->X) + vector3Ptr->X = num38; + if ((double) num39 > (double) vector3Ptr->Y) + vector3Ptr->Y = num39; + if ((double) num40 > (double) vector3Ptr->Z) + { + vector3Ptr->Z = num40; + break; + } + else + break; + case 77: + float num41 = 0.75f; + float num42 = 0.45f; + float num43 = 0.25f; + if ((double) num41 > (double) vector3Ptr->X) + vector3Ptr->X = num41; + if ((double) num42 > (double) vector3Ptr->Y) + vector3Ptr->Y = num42; + if ((double) num43 > (double) vector3Ptr->Z) + { + vector3Ptr->Z = num43; + break; + } + else + break; + case 49: + float num44 = 0.3f; + float num45 = 0.3f; + float num46 = 0.75f; + if ((double) num44 > (double) vector3Ptr->X) + vector3Ptr->X = num44; + if ((double) num45 > (double) vector3Ptr->Y) + vector3Ptr->Y = num45; + if ((double) num46 > (double) vector3Ptr->Z) + { + vector3Ptr->Z = num46; + break; + } + else + break; + case 61: + if ((int) tilePtr2->frameX == 144) + { + float num20 = 0.42f; + float num21 = 0.81f; + float num22 = 0.52f; + if ((double) num20 > (double) vector3Ptr->X) + vector3Ptr->X = num20; + if ((double) num21 > (double) vector3Ptr->Y) + vector3Ptr->Y = num21; + if ((double) num22 > (double) vector3Ptr->Z) + { + vector3Ptr->Z = num22; + break; + } + else + break; + } + else + break; + case 26: + case 31: + float num47 = (float) Main.rand.Next(-5, 6) * (1.0 / 400.0); + float num48 = 0.31f + num47; + float num49 = 0.1f; + float num50 = 0.44f + num47; + if ((double) num48 > (double) vector3Ptr->X) + vector3Ptr->X = num48; + if ((double) num49 > (double) vector3Ptr->Y) + vector3Ptr->Y = num49; + if ((double) num50 > (double) vector3Ptr->Z) + { + vector3Ptr->Z = num50; + break; + } + else + break; + case 33: + if ((int) tilePtr2->frameX == 0) + { + float num20 = 1f; + float num21 = 0.95f; + float num22 = 0.65f; + if ((double) num20 > (double) vector3Ptr->X) + vector3Ptr->X = num20; + if ((double) num21 > (double) vector3Ptr->Y) + vector3Ptr->Y = num21; + if ((double) num22 > (double) vector3Ptr->Z) + { + vector3Ptr->Z = num22; + break; + } + else + break; + } + else + break; + case 34: + case 35: + if ((int) tilePtr2->frameX < 54) + { + float num20 = 1f; + float num21 = 0.95f; + float num22 = 0.8f; + if ((double) num20 > (double) vector3Ptr->X) + vector3Ptr->X = num20; + if ((double) num21 > (double) vector3Ptr->Y) + vector3Ptr->Y = num21; + if ((double) num22 > (double) vector3Ptr->Z) + { + vector3Ptr->Z = num22; + break; + } + else + break; + } + else + break; + case 36: + if ((int) tilePtr2->frameX < 54) + { + float num20 = 1f; + float num21 = 0.95f; + float num22 = 0.65f; + if ((double) num20 > (double) vector3Ptr->X) + vector3Ptr->X = num20; + if ((double) num21 > (double) vector3Ptr->Y) + vector3Ptr->Y = num21; + if ((double) num22 > (double) vector3Ptr->Z) + { + vector3Ptr->Z = num22; + break; + } + else + break; + } + else + break; + case 37: + float num51 = 0.56f; + float num52 = 0.43f; + float num53 = 0.15f; + if ((double) num51 > (double) vector3Ptr->X) + vector3Ptr->X = num51; + if ((double) num52 > (double) vector3Ptr->Y) + vector3Ptr->Y = num52; + if ((double) num53 > (double) vector3Ptr->Z) + { + vector3Ptr->Z = num53; + break; + } + else + break; + case 42: + if ((int) tilePtr2->frameX == 0) + { + float num20 = 0.65f; + float num21 = 0.8f; + float num22 = 0.54f; + if ((double) num20 > (double) vector3Ptr->X) + vector3Ptr->X = num20; + if ((double) num21 > (double) vector3Ptr->Y) + vector3Ptr->Y = num21; + if ((double) num22 > (double) vector3Ptr->Z) + { + vector3Ptr->Z = num22; + break; + } + else + break; + } + else + break; + case 4: + if ((int) tilePtr2->frameX < 66) + { + float num20; + float num21; + float num22; + switch (tilePtr2->frameY) + { + case (short) 154: + num20 = (float) (0.5 * (double) Main.demonTorch + 1.0 * (1.0 - (double) Main.demonTorch)); + num21 = 0.3f; + num22 = Main.demonTorch + (float) (0.5 * (1.0 - (double) Main.demonTorch)); + break; + case (short) 176: + num20 = 0.85f; + num21 = 1f; + num22 = 0.7f; + break; + case (short) 110: + num20 = 1.3f; + num21 = 1.3f; + num22 = 1.3f; + break; + case (short) 132: + num20 = 1f; + num21 = 1f; + num22 = 0.1f; + break; + case (short) 66: + num20 = 0.0f; + num21 = 1f; + num22 = 0.1f; + break; + case (short) 88: + num20 = 0.95f; + num21 = 0.1f; + num22 = 0.95f; + break; + case (short) 22: + num20 = 0.0f; + num21 = 0.1f; + num22 = 1.3f; + break; + case (short) 44: + num20 = 1f; + num21 = 0.1f; + num22 = 0.1f; + break; + default: + num20 = 1f; + num21 = 0.95f; + num22 = 0.8f; + break; + } + if ((double) num20 > (double) vector3Ptr->X) + vector3Ptr->X = num20; + if ((double) num21 > (double) vector3Ptr->Y) + vector3Ptr->Y = num21; + if ((double) num22 > (double) vector3Ptr->Z) + { + vector3Ptr->Z = num22; + break; + } + else + break; + } + else + break; + } + } + } + if ((int) tilePtr2->liquid > 0) + { + if ((int) tilePtr2->lava != 0) + { + float num6 = 0.55f + (float) (270 - (int) UI.mouseTextBrightness) * (1.0 / 900.0); + if ((double) vector3Ptr->X < (double) num6) + vector3Ptr->X = num6; + if ((double) vector3Ptr->Y < (double) num6) + vector3Ptr->Y = num6 * 0.6f; + if ((double) vector3Ptr->Z < (double) num6) + vector3Ptr->Z = num6 * 0.2f; + } + else if ((int) tilePtr2->liquid > 128) + this.stopAndWetLight[index2 * 117 + index3] |= (byte) 2; + } + if ((double) vector3Ptr->X > 0.0 || (double) vector3Ptr->Y > 0.0 || (double) vector3Ptr->Z > 0.0) + { + if (this.minX > index2) + this.minX = index2; + if (this.maxX < index2 + 1) + this.maxX = index2 + 1; + if (this.minY > index3) + this.minY = index3; + if (this.maxY < index3 + 1) + this.maxY = index3 + 1; + } + } + ++num5; + ++tilePtr2; + } + } + } + if (view.evilTiles < 0) + view.evilTiles = 0; + int num54 = view.holyTiles; + view.holyTiles -= view.evilTiles; + view.evilTiles -= num54; + if (view.holyTiles < 0) + view.holyTiles = 0; + if (view.evilTiles < 0) + view.evilTiles = 0; + this.minX7 = this.minX; + this.maxX7 = this.maxX; + this.minY7 = this.minY; + this.maxY7 = this.maxY; + this.minX += this.firstToLightX; + this.maxX += this.firstToLightX; + this.minY += this.firstToLightY; + this.maxY += this.firstToLightY; + this.firstTileX7 = this.firstTileX - this.firstToLightX; + this.lastTileX7 = this.lastTileX - this.firstToLightX; + this.lastTileY7 = this.lastTileY - this.firstToLightY; + this.firstTileY7 = this.firstTileY - this.firstToLightY; + this.lastToLightY7 = num2 - this.firstToLightY; + this.firstToLightX27 = num9 - this.firstToLightX; + this.lastToLightX27 = num11 - this.firstToLightX; + this.firstToLightY27 = num10 - this.firstToLightY; + this.lastToLightY27 = num12 - this.firstToLightY; + this.workerThreadGo.Set(); + this.scrX = (short) (view.screenPosition.X >> 4); + this.scrY = (short) (view.screenPosition.Y >> 4); + } + } + + private unsafe void doColors() + { + Vector3[,] vector3Array1; + // ISSUE: cast to a reference type + // ISSUE: explicit reference operation + fixed (Vector3* vector3Ptr = &^((vector3Array1 = this.color2) == null || vector3Array1.Length == 0 ? (Vector3&) IntPtr.Zero : vector3Array1.Address(0, 0))) + { + int num1 = this.minX7 * 117; + int num2 = this.minX7; + while (num2 < this.maxX7) + { + this.lightColor = 0.0f; + this.lightColorG = 0.0f; + this.lightColorB = 0.0f; + for (int index = this.minY7; index < this.lastToLightY27 + 4; ++index) + { + int s = num1 + index; + this.LightColor(vector3Ptr + s, s, 1); + } + this.lightColor = 0.0f; + this.lightColorG = 0.0f; + this.lightColorB = 0.0f; + for (int index = this.maxY7; index >= this.firstTileY7 - 4; --index) + { + int s = num1 + index; + this.LightColor(vector3Ptr + s, s, -1); + } + ++num2; + num1 += 117; + } + } + Vector3[,] vector3Array2; + // ISSUE: cast to a reference type + // ISSUE: explicit reference operation + fixed (Vector3* vector3Ptr = &^((vector3Array2 = this.color2) == null || vector3Array2.Length == 0 ? (Vector3&) IntPtr.Zero : vector3Array2.Address(0, 0))) + { + for (int index = 0; index < this.lastToLightY7; ++index) + { + this.lightColor = 0.0f; + this.lightColorG = 0.0f; + this.lightColorB = 0.0f; + int s1 = index + this.minX7 * 117; + int num1 = this.minX7; + while (num1 < this.lastTileX7 + 4) + { + this.LightColor(vector3Ptr + s1, s1, 117); + ++num1; + s1 += 117; + } + this.lightColor = 0.0f; + this.lightColorG = 0.0f; + this.lightColorB = 0.0f; + int s2 = index + this.maxX7 * 117; + int num2 = this.maxX7; + while (num2 >= this.firstTileX7 - 4) + { + this.LightColor(vector3Ptr + s2, s2, -117); + --num2; + s2 -= 117; + } + } + } + Vector3[,] vector3Array3; + // ISSUE: cast to a reference type + // ISSUE: explicit reference operation + fixed (Vector3* vector3Ptr = &^((vector3Array3 = this.color2) == null || vector3Array3.Length == 0 ? (Vector3&) IntPtr.Zero : vector3Array3.Address(0, 0))) + { + int num1 = this.firstToLightX27 * 117; + int num2 = this.firstToLightX27; + while (num2 < this.lastToLightX27) + { + this.lightColor = 0.0f; + this.lightColorG = 0.0f; + this.lightColorB = 0.0f; + for (int index = this.firstToLightY27; index < this.lastTileY7 + 4; ++index) + { + int s = index + num1; + this.LightColor(vector3Ptr + s, s, 1); + } + this.lightColor = 0.0f; + this.lightColorG = 0.0f; + this.lightColorB = 0.0f; + for (int index = this.lastToLightY27; index >= this.firstTileY7 - 4; --index) + { + int s = index + num1; + this.LightColor(vector3Ptr + s, s, -1); + } + ++num2; + num1 += 117; + } + } + Vector3[,] vector3Array4; + // ISSUE: cast to a reference type + // ISSUE: explicit reference operation + fixed (Vector3* vector3Ptr = &^((vector3Array4 = this.color2) == null || vector3Array4.Length == 0 ? (Vector3&) IntPtr.Zero : vector3Array4.Address(0, 0))) + { + for (int index = this.firstToLightY27; index < this.lastToLightY27; ++index) + { + this.lightColor = 0.0f; + this.lightColorG = 0.0f; + this.lightColorB = 0.0f; + int s1 = index + this.firstToLightX27 * 117; + int num1 = this.firstToLightX27; + while (num1 < this.lastTileX7 + 4) + { + this.LightColor(vector3Ptr + s1, s1, 117); + ++num1; + s1 += 117; + } + this.lightColor = 0.0f; + this.lightColorG = 0.0f; + this.lightColorB = 0.0f; + int s2 = index + this.lastToLightX27 * 117; + int num2 = this.lastToLightX27; + while (num2 >= this.firstTileX7 - 4) + { + this.LightColor(vector3Ptr + s2, s2, -117); + --num2; + s2 -= 117; + } + } + } + } + + public static unsafe void addLight(int i, int j, Vector3 rgb) + { + if (Lighting.tempLightCount == 1024 || !WorldView.AnyViewContains(i << 4, j << 4)) + return; + fixed (Lighting.TempLight* tempLightPtr1 = Lighting.tempLight) + { + int num = Lighting.tempLightCount - 1; + Lighting.TempLight* tempLightPtr2 = tempLightPtr1 + num; + for (; num >= 0; --num) + { + if ((int) tempLightPtr2->x == i && (int) tempLightPtr2->y == j) + { + if ((double) tempLightPtr2->color.X < (double) rgb.X) + tempLightPtr2->color.X = rgb.X; + if ((double) tempLightPtr2->color.Y < (double) rgb.Y) + tempLightPtr2->color.Y = rgb.Y; + if ((double) tempLightPtr2->color.Z >= (double) rgb.Z) + return; + tempLightPtr2->color.Z = rgb.Z; + return; + } + else + --tempLightPtr2; + } + Lighting.TempLight* tempLightPtr3 = tempLightPtr1 + Lighting.tempLightCount++; + tempLightPtr3->x = (short) i; + tempLightPtr3->y = (short) j; + tempLightPtr3->color = rgb; + } + } + + private unsafe void LightColor(Vector3* pColor2, int s, int offset) + { + s = (int) this.stopAndWetLight[s]; + float num1 = this.lightColor; + if ((double) pColor2->X > (double) num1) + num1 = pColor2->X; + if ((double) num1 > 0.0185000002384186) + { + pColor2->X = num1; + if ((double) pColor2[offset].X <= (double) num1) + { + if (s == 0) + num1 *= this.negLight; + else if ((s & 1) != 0) + num1 *= this.negLight2; + else + num1 *= (float) ((double) this.wetLightR * (double) Main.rand.Next(98, 100) * 0.00999999977648258); + } + this.lightColor = num1; + } + float num2 = this.lightColorG; + if ((double) pColor2->Y > (double) num2) + num2 = pColor2->Y; + if ((double) num2 > 0.0185000002384186) + { + pColor2->Y = num2; + if ((double) pColor2[offset].Y <= (double) num2) + { + if (s == 0) + num2 *= this.negLight; + else if ((s & 1) != 0) + num2 *= this.negLight2; + else + num2 *= (float) ((double) this.wetLightG * (double) Main.rand.Next(97, 100) * 0.00999999977648258); + } + this.lightColorG = num2; + } + float num3 = this.lightColorB; + if ((double) pColor2->Z > (double) num3) + num3 = pColor2->Z; + if ((double) num3 <= 0.0185000002384186) + return; + pColor2->Z = num3; + if ((double) pColor2[offset].Z < (double) num3) + { + if ((s & 1) != 0) + num3 *= this.negLight2; + else + num3 *= this.negLight; + } + this.lightColorB = num3; + } + + public Color GetColorPlayer(int x, int y, Color oldColor) + { + int index1 = x - this.firstToLightX; + int index2 = y - this.firstToLightY; + if (index1 < 0 || index2 < 0 || (index1 >= this.MAX_LIGHT_ARRAY_X || index2 >= 107)) + return Color.Black; + float num1 = this.color[index1, index2].X * 2.5f; + if ((double) num1 > 1.0) + num1 = 1f; + int r = (int) ((double) oldColor.R * (double) num1 * (double) this.brightness); + float num2 = this.color[index1, index2].Y * 2.5f; + if ((double) num2 > 1.0) + num2 = 1f; + int g = (int) ((double) oldColor.G * (double) num2 * (double) this.brightness); + float num3 = this.color[index1, index2].Z * 2.5f; + if ((double) num3 > 1.0) + num3 = 1f; + int b = (int) ((double) oldColor.B * (double) num3 * (double) this.brightness); + return new Color(r, g, b, (int) byte.MaxValue); + } + + public Color GetColorPlayer(int x, int y) + { + int index1 = x - this.firstToLightX; + int index2 = y - this.firstToLightY; + if (index1 < 0 || index2 < 0 || (index1 >= this.MAX_LIGHT_ARRAY_X || index2 >= 107)) + return Color.Black; + else + return new Color(this.color[index1, index2] * (this.brightness * 2.5f)); + } + + public Color GetColorUnsafe(int x, int y) + { + return new Color(this.color[x - this.firstToLightX, y - this.firstToLightY] * this.brightness); + } + + public Color GetColor(int x, int y) + { + int index1 = x - this.firstToLightX; + int index2 = y - this.firstToLightY; + if (index1 < 0 || index2 < 0 || (index1 >= this.MAX_LIGHT_ARRAY_X || index2 >= 107)) + return Color.Black; + else + return new Color(this.color[index1, index2] * this.brightness); + } + + public unsafe float Brightness(int x, int y) + { + int index1 = x - this.firstToLightX; + int index2 = y - this.firstToLightY; + if (index1 < 0 || index2 < 0 || (index1 >= this.MAX_LIGHT_ARRAY_X || index2 >= 107)) + return 0.0f; + fixed (Vector3* vector3Ptr = &this.color[index1, index2]) + return (float) (((double) vector3Ptr->X + (double) vector3Ptr->Y + (double) vector3Ptr->Z) * 0.333333343267441); + } + + public unsafe float BrightnessUnsafe(int x, int y) + { + fixed (Vector3* vector3Ptr = &this.color[x - this.firstToLightX, y - this.firstToLightY]) + return (float) (((double) vector3Ptr->X + (double) vector3Ptr->Y + (double) vector3Ptr->Z) * 0.333333343267441); + } + + public unsafe bool IsNotBlackUnsafe(int x, int y) + { + fixed (Vector3* vector3Ptr = &this.color[x - this.firstToLightX, y - this.firstToLightY]) + return (double) vector3Ptr->X > 0.0 || (double) vector3Ptr->Y > 0.0 || (double) vector3Ptr->Z > 0.0; + } + + public unsafe bool Brighter(int x, int y, int x2, int y2) + { + int index1 = x - this.firstToLightX; + int index2 = y - this.firstToLightY; + if (index1 < 0 || index2 < 0 || (index1 >= this.MAX_LIGHT_ARRAY_X || index2 >= 107)) + return true; + int index3 = x2 - this.firstToLightX; + int index4 = y2 - this.firstToLightY; + if (index3 < 0 || index4 < 0 || (index3 >= this.MAX_LIGHT_ARRAY_X || index4 >= 107)) + return false; + fixed (Vector3* vector3Ptr1 = &this.color[index1, index2]) + fixed (Vector3* vector3Ptr2 = &this.color2[index3, index4]) + return (double) vector3Ptr1->X + (double) vector3Ptr1->Y + (double) vector3Ptr1->Z <= (double) vector3Ptr2->X + (double) vector3Ptr2->Y + (double) vector3Ptr2->Z; + } + + private struct TempLight + { + public short x; + public short y; + public Vector3 color; + } + } +} diff --git a/Terraria/Liquid.cs b/Terraria/Liquid.cs new file mode 100644 index 0000000..abc8b79 --- /dev/null +++ b/Terraria/Liquid.cs @@ -0,0 +1,813 @@ +// Type: Terraria.Liquid +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using System; + +namespace Terraria +{ + public struct Liquid + { + public static int skipCount = 0; + public static int stuckCount = 0; + public static int stuckAmount = 0; + private static int cycles = 7; + public static bool stuck = false; + public static bool quickFall = false; + private static bool quickSettle = false; + public static int panicCounter = 0; + public static bool panicMode = false; + public static int panicY = 0; + public const int MAX_LIQUID = 4096; + public static int numLiquid; + private static int wetCounter; + public short x; + public short y; + public short kill; + public short delay; + + static Liquid() + { + } + + public void Init(int nx, int ny) + { + this.x = (short) nx; + this.y = (short) ny; + this.kill = (short) 0; + this.delay = (short) 0; + } + + public static void QuickSettleOn() + { + Liquid.quickSettle = true; + Liquid.cycles = 1; + } + + public static void QuickSettleOff() + { + Liquid.quickSettle = false; + Liquid.cycles = 14; + } + + public static void QuickWater(double verbose, int minY = 3, int maxY = -1, double startPercent = 0.0) + { + if (maxY == -1) + maxY = (int) Main.maxTilesY - 3; + for (int index1 = maxY; index1 >= minY; --index1) + { + UI.main.progress = (float) ((double) (maxY - index1) / (double) (maxY - minY + 1) * verbose + startPercent); + for (int index2 = 0; index2 < 2; ++index2) + { + int num1 = 2; + int num2 = (int) Main.maxTilesX - 2; + int num3 = 1; + if (index2 == 1) + { + num1 = num2; + num2 = 2; + num3 = -1; + } + int index3 = num1; + while (index3 != num2) + { + int num4 = (int) Main.tile[index3, index1].liquid; + if (num4 > 0) + { + Main.tile[index3, index1].liquid = (byte) 0; + int num5 = -num3; + bool flag1 = false; + int x = index3; + int y = index1; + int num6 = (int) Main.tile[index3, index1].lava; + bool flag2 = true; + int num7 = 0; + while (flag2 && x > 3 && (x < (int) Main.maxTilesX - 3 && y < (int) Main.maxTilesY - 3)) + { + flag2 = false; + while ((int) Main.tile[x, y + 1].liquid == 0 && y < (int) Main.maxTilesY - 5 && ((int) Main.tile[x, y + 1].active == 0 || !Main.tileSolidNotSolidTop[(int) Main.tile[x, y + 1].type])) + { + flag2 = true; + flag1 = true; + num5 = num3; + num7 = 0; + ++y; + if (y > WorldGen.waterLine) + num6 = 32; + } + if ((int) Main.tile[x, y + 1].liquid > 0 && (int) Main.tile[x, y + 1].liquid < (int) byte.MaxValue && (int) Main.tile[x, y + 1].lava == num6) + { + int num8 = (int) byte.MaxValue - (int) Main.tile[x, y + 1].liquid; + if (num8 > num4) + num8 = num4; + Main.tile[x, y + 1].liquid += (byte) num8; + num4 -= (int) (byte) num8; + if (num4 <= 0) + break; + } + if (num7 == 0) + { + if ((int) Main.tile[x + num5, y].liquid == 0 && ((int) Main.tile[x + num5, y].active == 0 || !Main.tileSolidNotSolidTop[(int) Main.tile[x + num5, y].type])) + num7 = num5; + else if ((int) Main.tile[x - num5, y].liquid == 0 && ((int) Main.tile[x - num5, y].active == 0 || !Main.tileSolidNotSolidTop[(int) Main.tile[x - num5, y].type])) + num7 = -num5; + } + if (num7 != 0 && (int) Main.tile[x + num7, y].liquid == 0 && ((int) Main.tile[x + num7, y].active == 0 || !Main.tileSolidNotSolidTop[(int) Main.tile[x + num7, y].type])) + { + flag2 = true; + x += num7; + } + if (flag1 && !flag2) + { + flag1 = false; + flag2 = true; + num5 = -num3; + num7 = 0; + } + } + Main.tile[x, y].liquid = (byte) num4; + Main.tile[x, y].lava = (byte) num6; + if ((int) Main.tile[x - 1, y].liquid > 0 && (int) Main.tile[x - 1, y].lava != num6) + { + if (num6 != 0) + Liquid.LavaCheck(x, y); + else + Liquid.LavaCheck(x - 1, y); + } + else if ((int) Main.tile[x + 1, y].liquid > 0 && (int) Main.tile[x + 1, y].lava != num6) + { + if (num6 != 0) + Liquid.LavaCheck(x, y); + else + Liquid.LavaCheck(x + 1, y); + } + else if ((int) Main.tile[x, y - 1].liquid > 0 && (int) Main.tile[x, y - 1].lava != num6) + { + if (num6 != 0) + Liquid.LavaCheck(x, y); + else + Liquid.LavaCheck(x, y - 1); + } + else if ((int) Main.tile[x, y + 1].liquid > 0 && (int) Main.tile[x, y + 1].lava != num6) + { + if (num6 != 0) + Liquid.LavaCheck(x, y); + else + Liquid.LavaCheck(x, y + 1); + } + } + index3 += num3; + } + } + } + } + + public unsafe void Update() + { + fixed (Tile* tilePtr = &Main.tile[(int) this.x, (int) this.y]) + { + if ((int) tilePtr->active != 0 && Main.tileSolidNotSolidTop[(int) tilePtr->type]) + { + this.kill = (short) 9; + } + else + { + int num1 = (int) tilePtr->liquid; + int num2 = num1; + if ((int) this.y > (int) Main.maxTilesY - 200 && num1 > 0 && (int) tilePtr->lava == 0) + { + int num3 = 2; + if (num1 < num3) + num3 = num1; + num1 -= num3; + tilePtr->liquid = (byte) num1; + } + if (num1 == 0) + { + this.kill = (short) 9; + } + else + { + if ((int) tilePtr->lava != 0) + { + Liquid.LavaCheck((int) this.x, (int) this.y); + if (!Liquid.quickFall) + { + if ((int) this.delay < 5) + { + ++this.delay; + return; + } + else + this.delay = (short) 0; + } + } + else + { + if ((int) tilePtr[-1440].lava != 0) + Liquid.AddWater((int) this.x - 1, (int) this.y); + if ((int) tilePtr[1440].lava != 0) + Liquid.AddWater((int) this.x + 1, (int) this.y); + if ((int) tilePtr[-1].lava != 0) + Liquid.AddWater((int) this.x, (int) this.y - 1); + if ((int) tilePtr[1].lava != 0) + Liquid.AddWater((int) this.x, (int) this.y + 1); + } + if ((int) tilePtr[1].active == 0 || !Main.tileSolidNotSolidTop[(int) tilePtr[1].type]) + { + int num3 = (int) tilePtr[1].liquid; + if ((num3 <= 0 || (int) tilePtr[1].lava == (int) tilePtr->lava) && num3 < (int) byte.MaxValue) + { + int num4 = (int) byte.MaxValue - num3; + if (num4 > (int) tilePtr->liquid) + num4 = (int) tilePtr->liquid; + IntPtr num5 = (IntPtr) tilePtr; + int num6 = (int) (byte) ((uint) ((Tile*) num5)->liquid - (uint) (byte) num4); + ((Tile*) num5)->liquid = (byte) num6; + int num7 = num3 + num4; + tilePtr[1].liquid = (byte) num7; + tilePtr[1].lava = tilePtr->lava; + Liquid.AddWater((int) this.x, (int) this.y + 1); + tilePtr[1].skipLiquid = 128; + tilePtr->skipLiquid = 128; + if ((int) tilePtr->liquid > 250) + { + tilePtr->liquid = byte.MaxValue; + } + else + { + Liquid.AddWater((int) this.x - 1, (int) this.y); + Liquid.AddWater((int) this.x + 1, (int) this.y); + } + } + } + if ((int) tilePtr->liquid > 0) + { + bool flag1 = true; + bool flag2 = true; + bool flag3 = true; + bool flag4 = true; + if ((int) tilePtr[-1440].active != 0 && Main.tileSolidNotSolidTop[(int) tilePtr[-1440].type]) + flag1 = false; + else if ((int) tilePtr[-1440].liquid > 0 && (int) tilePtr[-1440].lava != (int) tilePtr->lava) + flag1 = false; + else if ((int) tilePtr[-2880].active != 0 && Main.tileSolidNotSolidTop[(int) tilePtr[-2880].type]) + flag3 = false; + else if ((int) tilePtr[-2880].liquid == 0) + flag3 = false; + else if ((int) tilePtr[-2880].liquid > 0 && (int) tilePtr[-2880].lava != (int) tilePtr->lava) + flag3 = false; + if ((int) tilePtr[1440].active != 0 && Main.tileSolidNotSolidTop[(int) tilePtr[1440].type]) + flag2 = false; + else if ((int) tilePtr[1440].liquid > 0 && (int) tilePtr[1440].lava != (int) tilePtr->lava) + flag2 = false; + else if ((int) tilePtr[2880].active != 0 && Main.tileSolidNotSolidTop[(int) tilePtr[2880].type]) + flag4 = false; + else if ((int) tilePtr[2880].liquid == 0) + flag4 = false; + else if ((int) tilePtr[2880].liquid > 0 && (int) tilePtr[2880].lava != (int) tilePtr->lava) + flag4 = false; + int num3 = 0; + if ((int) tilePtr->liquid < 3) + num3 = -1; + if (flag1 && flag2) + { + if (flag3 && flag4) + { + bool flag5 = true; + bool flag6 = true; + if ((int) tilePtr[-4320].active != 0 && Main.tileSolidNotSolidTop[(int) tilePtr[-4320].type]) + flag5 = false; + else if ((int) tilePtr[-4320].liquid == 0) + flag5 = false; + else if ((int) tilePtr[-4320].lava != (int) tilePtr->lava) + flag5 = false; + if ((int) tilePtr[4320].active != 0 && Main.tileSolidNotSolidTop[(int) tilePtr[4320].type]) + flag6 = false; + else if ((int) tilePtr[4320].liquid == 0) + flag6 = false; + else if ((int) tilePtr[4320].lava != (int) tilePtr->lava) + flag6 = false; + if (flag5 && flag6) + { + int num4 = ((int) tilePtr[-1440].liquid + (int) tilePtr[1440].liquid + (int) tilePtr[-2880].liquid + (int) tilePtr[2880].liquid + (int) tilePtr[-4320].liquid + (int) tilePtr[4320].liquid + (int) tilePtr->liquid + num3 + 3) / 7; + int num5 = 0; + tilePtr[-1440].lava = tilePtr->lava; + if ((int) tilePtr[-1440].liquid != num4) + { + Liquid.AddWater((int) this.x - 1, (int) this.y); + tilePtr[-1440].liquid = (byte) num4; + } + else + ++num5; + tilePtr[1440].lava = tilePtr->lava; + if ((int) tilePtr[1440].liquid != num4) + { + Liquid.AddWater((int) this.x + 1, (int) this.y); + tilePtr[1440].liquid = (byte) num4; + } + else + ++num5; + tilePtr[-2880].lava = tilePtr->lava; + if ((int) tilePtr[-2880].liquid != num4) + { + Liquid.AddWater((int) this.x - 2, (int) this.y); + tilePtr[-2880].liquid = (byte) num4; + } + else + ++num5; + tilePtr[2880].lava = tilePtr->lava; + if ((int) tilePtr[2880].liquid != num4) + { + Liquid.AddWater((int) this.x + 2, (int) this.y); + tilePtr[2880].liquid = (byte) num4; + } + else + ++num5; + tilePtr[-4320].lava = tilePtr->lava; + if ((int) tilePtr[-4320].liquid != num4) + { + Liquid.AddWater((int) this.x - 3, (int) this.y); + tilePtr[-4320].liquid = (byte) num4; + } + else + ++num5; + tilePtr[4320].lava = tilePtr->lava; + if ((int) tilePtr[4320].liquid != num4) + { + Liquid.AddWater((int) this.x + 3, (int) this.y); + tilePtr[4320].liquid = (byte) num4; + } + else + ++num5; + if ((int) tilePtr->liquid != num4 || (int) tilePtr[-1440].liquid != num4) + Liquid.AddWater((int) this.x - 1, (int) this.y); + if ((int) tilePtr->liquid != num4 || (int) tilePtr[1440].liquid != num4) + Liquid.AddWater((int) this.x + 1, (int) this.y); + if ((int) tilePtr->liquid != num4 || (int) tilePtr[-2880].liquid != num4) + Liquid.AddWater((int) this.x - 2, (int) this.y); + if ((int) tilePtr->liquid != num4 || (int) tilePtr[2880].liquid != num4) + Liquid.AddWater((int) this.x + 2, (int) this.y); + if ((int) tilePtr->liquid != num4 || (int) tilePtr[-4320].liquid != num4) + Liquid.AddWater((int) this.x - 3, (int) this.y); + if ((int) tilePtr->liquid != num4 || (int) tilePtr[4320].liquid != num4) + Liquid.AddWater((int) this.x + 3, (int) this.y); + if (num5 != 6 || (int) tilePtr[-1].liquid <= 0) + tilePtr->liquid = (byte) num4; + } + else + { + int num4 = 0; + int num5 = ((int) tilePtr[-1440].liquid + (int) tilePtr[1440].liquid + (int) tilePtr[-2880].liquid + (int) tilePtr[2880].liquid + (int) tilePtr->liquid + num3 + 2) / 5; + tilePtr[-1440].lava = tilePtr->lava; + if ((int) tilePtr[-1440].liquid != num5) + { + Liquid.AddWater((int) this.x - 1, (int) this.y); + tilePtr[-1440].liquid = (byte) num5; + } + else + ++num4; + tilePtr[1440].lava = tilePtr->lava; + if ((int) tilePtr[1440].liquid != num5) + { + Liquid.AddWater((int) this.x + 1, (int) this.y); + tilePtr[1440].liquid = (byte) num5; + } + else + ++num4; + tilePtr[-2880].lava = tilePtr->lava; + if ((int) tilePtr[-2880].liquid != num5) + { + Liquid.AddWater((int) this.x - 2, (int) this.y); + tilePtr[-2880].liquid = (byte) num5; + } + else + ++num4; + tilePtr[2880].lava = tilePtr->lava; + if ((int) tilePtr[2880].liquid != num5) + { + Liquid.AddWater((int) this.x + 2, (int) this.y); + tilePtr[2880].liquid = (byte) num5; + } + else + ++num4; + if ((int) tilePtr[-1440].liquid != num5 || (int) tilePtr->liquid != num5) + Liquid.AddWater((int) this.x - 1, (int) this.y); + if ((int) tilePtr[1440].liquid != num5 || (int) tilePtr->liquid != num5) + Liquid.AddWater((int) this.x + 1, (int) this.y); + if ((int) tilePtr[-2880].liquid != num5 || (int) tilePtr->liquid != num5) + Liquid.AddWater((int) this.x - 2, (int) this.y); + if ((int) tilePtr[2880].liquid != num5 || (int) tilePtr->liquid != num5) + Liquid.AddWater((int) this.x + 2, (int) this.y); + if (num4 != 4 || (int) tilePtr[-1].liquid <= 0) + tilePtr->liquid = (byte) num5; + } + } + else if (flag3) + { + int num4 = (int) tilePtr[-1440].liquid + (int) tilePtr[1440].liquid + (int) tilePtr[-2880].liquid + (int) tilePtr->liquid + num3 + 2 >> 2; + tilePtr[-1440].lava = tilePtr->lava; + if ((int) tilePtr[-1440].liquid != num4 || (int) tilePtr->liquid != num4) + { + Liquid.AddWater((int) this.x - 1, (int) this.y); + tilePtr[-1440].liquid = (byte) num4; + } + tilePtr[1440].lava = tilePtr->lava; + if ((int) tilePtr[1440].liquid != num4 || (int) tilePtr->liquid != num4) + { + Liquid.AddWater((int) this.x + 1, (int) this.y); + tilePtr[1440].liquid = (byte) num4; + } + tilePtr[-2880].lava = tilePtr->lava; + if ((int) tilePtr[-2880].liquid != num4 || (int) tilePtr->liquid != num4) + { + tilePtr[-2880].liquid = (byte) num4; + Liquid.AddWater((int) this.x - 2, (int) this.y); + } + tilePtr->liquid = (byte) num4; + } + else if (flag4) + { + int num4 = (int) tilePtr[-1440].liquid + (int) tilePtr[1440].liquid + (int) tilePtr[2880].liquid + (int) tilePtr->liquid + num3 + 2 >> 2; + tilePtr[-1440].lava = tilePtr->lava; + if ((int) tilePtr[-1440].liquid != num4 || (int) tilePtr->liquid != num4) + { + Liquid.AddWater((int) this.x - 1, (int) this.y); + tilePtr[-1440].liquid = (byte) num4; + } + tilePtr[1440].lava = tilePtr->lava; + if ((int) tilePtr[1440].liquid != num4 || (int) tilePtr->liquid != num4) + { + Liquid.AddWater((int) this.x + 1, (int) this.y); + tilePtr[1440].liquid = (byte) num4; + } + tilePtr[2880].lava = tilePtr->lava; + if ((int) tilePtr[2880].liquid != num4 || (int) tilePtr->liquid != num4) + { + tilePtr[2880].liquid = (byte) num4; + Liquid.AddWater((int) this.x + 2, (int) this.y); + } + tilePtr->liquid = (byte) num4; + } + else + { + int num4 = ((int) tilePtr[-1440].liquid + (int) tilePtr[1440].liquid + (int) tilePtr->liquid + num3 + 1) / 3; + tilePtr[-1440].lava = tilePtr->lava; + if ((int) tilePtr[-1440].liquid != num4) + tilePtr[-1440].liquid = (byte) num4; + if ((int) tilePtr->liquid != num4 || (int) tilePtr[-1440].liquid != num4) + Liquid.AddWater((int) this.x - 1, (int) this.y); + tilePtr[1440].lava = tilePtr->lava; + if ((int) tilePtr[1440].liquid != num4) + tilePtr[1440].liquid = (byte) num4; + if ((int) tilePtr->liquid != num4 || (int) tilePtr[1440].liquid != num4) + Liquid.AddWater((int) this.x + 1, (int) this.y); + tilePtr->liquid = (byte) num4; + } + } + else if (flag1) + { + int num4 = (int) tilePtr[-1440].liquid + (int) tilePtr->liquid + num3 + 1 >> 1; + if ((int) tilePtr[-1440].liquid != num4) + tilePtr[-1440].liquid = (byte) num4; + tilePtr[-1440].lava = tilePtr->lava; + if ((int) tilePtr->liquid != num4 || (int) tilePtr[-1440].liquid != num4) + Liquid.AddWater((int) this.x - 1, (int) this.y); + tilePtr->liquid = (byte) num4; + } + else if (flag2) + { + int num4 = (int) tilePtr[1440].liquid + (int) tilePtr->liquid + num3 + 1 >> 1; + if ((int) tilePtr[1440].liquid != num4) + tilePtr[1440].liquid = (byte) num4; + tilePtr[1440].lava = tilePtr->lava; + if ((int) tilePtr->liquid != num4 || (int) tilePtr[1440].liquid != num4) + Liquid.AddWater((int) this.x + 1, (int) this.y); + tilePtr->liquid = (byte) num4; + } + } + if ((int) tilePtr->liquid != num2) + { + if ((int) tilePtr->liquid == 254 && num2 == (int) byte.MaxValue) + { + tilePtr->liquid = byte.MaxValue; + ++this.kill; + } + else + { + Liquid.AddWater((int) this.x, (int) this.y - 1); + this.kill = (short) 0; + } + } + else + ++this.kill; + // ISSUE: __unpin statement + __unpin(tilePtr); + } + } + } + } + + public static void StartPanic() + { + if (Liquid.panicMode) + return; + WorldGen.waterLine = (int) Main.maxTilesY; + Liquid.numLiquid = 0; + LiquidBuffer.numLiquidBuffer = 0; + Liquid.panicCounter = 0; + Liquid.panicMode = true; + Liquid.panicY = (int) Main.maxTilesY - 3; + } + + public static void UpdateLiquid() + { + if (!WorldGen.gen) + { + if (!Liquid.panicMode) + { + if (Liquid.numLiquid + LiquidBuffer.numLiquidBuffer > 4000) + { + ++Liquid.panicCounter; + if (Liquid.panicCounter > 1800 || Liquid.numLiquid + LiquidBuffer.numLiquidBuffer > 13500) + Liquid.StartPanic(); + } + else + Liquid.panicCounter = 0; + } + if (Liquid.panicMode) + { + int num = 0; + while (Liquid.panicY >= 3 && num < 5) + { + ++num; + Liquid.QuickWater(0.0, Liquid.panicY, Liquid.panicY, 0.0); + --Liquid.panicY; + if (Liquid.panicY < 3) + { + Liquid.panicCounter = 0; + Liquid.panicMode = false; + WorldGen.WaterCheck(); + if (Main.netMode == 2) + Netplay.ResetSections(); + } + } + return; + } + } + Liquid.quickFall = Liquid.quickSettle || Liquid.numLiquid > 2000; + int num1 = 4096 / Liquid.cycles; + int num2 = num1 * Liquid.wetCounter; + int num3 = num1 * ++Liquid.wetCounter; + if (Liquid.wetCounter == Liquid.cycles) + num3 = Liquid.numLiquid; + if (num3 > Liquid.numLiquid) + { + num3 = Liquid.numLiquid; + Liquid.wetCounter = Liquid.cycles; + } + if (Liquid.quickFall) + { + for (int index = num2; index < num3; ++index) + { + Main.liquid[index].delay = (short) 10; + Main.liquid[index].Update(); + Main.tile[(int) Main.liquid[index].x, (int) Main.liquid[index].y].skipLiquid = 0; + } + } + else + { + for (int index = num2; index < num3; ++index) + { + if (Main.tile[(int) Main.liquid[index].x, (int) Main.liquid[index].y].skipLiquid == 0) + Main.liquid[index].Update(); + else + Main.tile[(int) Main.liquid[index].x, (int) Main.liquid[index].y].skipLiquid = 0; + } + } + if (Liquid.wetCounter < Liquid.cycles) + return; + Liquid.wetCounter = 0; + for (int l = Liquid.numLiquid - 1; l >= 0; --l) + { + if ((int) Main.liquid[l].kill > 3) + Liquid.DelWater(l); + } + int num4 = 4096 - (4096 - Liquid.numLiquid); + int num5 = LiquidBuffer.numLiquidBuffer; + if (num4 > num5) + num4 = num5; + int index1 = num5 - num4; + LiquidBuffer.numLiquidBuffer = index1; + while (--num4 >= 0) + { + Main.tile[(int) Main.liquidBuffer[index1].x, (int) Main.liquidBuffer[index1].y].checkingLiquid = 0; + Liquid.AddWater((int) Main.liquidBuffer[index1].x, (int) Main.liquidBuffer[index1].y); + ++index1; + } + if (Liquid.numLiquid > 0 && Liquid.numLiquid > Liquid.stuckAmount - 50 && Liquid.numLiquid < Liquid.stuckAmount + 50) + { + if (++Liquid.stuckCount < 10000) + return; + Liquid.stuck = true; + for (int l = Liquid.numLiquid - 1; l >= 0; --l) + Liquid.DelWater(l); + Liquid.stuck = false; + Liquid.stuckCount = 0; + } + else + { + Liquid.stuckCount = 0; + Liquid.stuckAmount = Liquid.numLiquid; + } + } + + public static unsafe void AddWater(int x, int y) + { + if (x < 5 || y < 5 || (x >= (int) Main.maxTilesX - 5 || y >= (int) Main.maxTilesY - 5)) + return; + fixed (Tile* tilePtr = &Main.tile[x, y]) + { + if ((int) tilePtr->liquid == 0 || tilePtr->checkingLiquid != 0) + return; + if (Liquid.numLiquid >= 4095) + { + LiquidBuffer.AddBuffer(x, y); + } + else + { + tilePtr->checkingLiquid = 64; + Main.liquid[Liquid.numLiquid].Init(x, y); + tilePtr->skipLiquid = 0; + ++Liquid.numLiquid; + if (Main.netMode == 2 && Liquid.numLiquid < 1365) + NetMessage.sendWater(x, y); + if ((int) tilePtr->active != 0) + { + int index = (int) tilePtr->type; + if ((index != 4 || (int) tilePtr->frameY != 176) && (Main.tileWaterDeath[index] || (int) tilePtr->lava != 0 && Main.tileLavaDeath[index])) + { + if (WorldGen.gen) + tilePtr->active = (byte) 0; + else if (WorldGen.KillTile(x, y) && Main.netMode == 2) + { + NetMessage.CreateMessage5(17, 0, x, y, 0, 0); + NetMessage.SendMessage(); + } + } + } + // ISSUE: __unpin statement + __unpin(tilePtr); + } + } + } + + public static void LavaCheck(int x, int y) + { + int num1 = (int) Main.tile[x, y - 1].liquid; + bool flag1 = (int) Main.tile[x, y - 1].lava == 0; + int num2 = (int) Main.tile[x - 1, y].liquid; + bool flag2 = (int) Main.tile[x - 1, y].lava == 0; + int num3 = (int) Main.tile[x + 1, y].liquid; + bool flag3 = (int) Main.tile[x + 1, y].lava == 0; + if (num2 > 0 && flag2 || num3 > 0 && flag3 || num1 > 0 && flag1) + { + int num4 = 0; + if (flag2) + { + num4 = num2; + Main.tile[x - 1, y].liquid = (byte) 0; + } + if (flag3) + { + num4 += num3; + Main.tile[x + 1, y].liquid = (byte) 0; + } + if (flag1) + { + num4 += num1; + Main.tile[x, y - 1].liquid = (byte) 0; + } + if (num4 < 32 || (int) Main.tile[x, y].active != 0) + return; + Main.tile[x, y].liquid = (byte) 0; + Main.tile[x, y].lava = (byte) 0; + WorldGen.PlaceTile(x, y, 56, true, true, -1, 0); + WorldGen.SquareTileFrame(x, y, -1); + if (Main.netMode != 2) + return; + NetMessage.SendTileSquare(x - 1, y - 1, 3); + } + else + { + if ((int) Main.tile[x, y + 1].active != 0 || (int) Main.tile[x, y + 1].liquid <= 0 || (int) Main.tile[x, y + 1].lava != 0) + return; + Main.tile[x, y].liquid = (byte) 0; + Main.tile[x, y].lava = (byte) 0; + Main.tile[x, y + 1].liquid = (byte) 0; + WorldGen.PlaceTile(x, y + 1, 56, true, true, -1, 0); + WorldGen.SquareTileFrame(x, y + 1, -1); + if (Main.netMode != 2) + return; + NetMessage.SendTileSquare(x - 1, y, 3); + } + } + + public static unsafe void DelWater(int l) + { + int index1 = (int) Main.liquid[l].x; + int index2 = (int) Main.liquid[l].y; + fixed (Tile* tilePtr = &Main.tile[index1, index2]) + { + int num = (int) tilePtr->liquid; + if (num < 2) + { + tilePtr->liquid = (byte) 0; + num = 0; + if ((int) tilePtr[-1440].liquid == 1) + tilePtr[-1440].liquid = (byte) 0; + if ((int) tilePtr[1440].liquid == 1) + tilePtr[1440].liquid = (byte) 0; + } + else if (num < 20) + { + if ((int) tilePtr[1].liquid < (int) byte.MaxValue && ((int) tilePtr[1].active == 0 || !Main.tileSolidNotSolidTop[(int) tilePtr[1].type]) || (int) tilePtr[-1440].liquid < num && ((int) tilePtr[-1440].active == 0 || !Main.tileSolidNotSolidTop[(int) tilePtr[-1440].type]) || (int) tilePtr[1440].liquid < num && ((int) tilePtr[1440].active == 0 || !Main.tileSolidNotSolidTop[(int) tilePtr[1440].type])) + { + tilePtr->liquid = (byte) 0; + num = 0; + } + } + else if ((int) tilePtr[1].liquid < (int) byte.MaxValue && ((int) tilePtr[1].active == 0 || !Main.tileSolidNotSolidTop[(int) tilePtr[1].type]) && !Liquid.stuck) + { + Main.liquid[l].kill = (short) 0; + return; + } + if (num < 250 && (int) tilePtr[-1].liquid > 0) + Liquid.AddWater(index1, index2 - 1); + if (num == 0) + { + tilePtr->lava = (byte) 0; + } + else + { + if ((int) tilePtr[1440].liquid > 0 && (int) tilePtr[1441].liquid < 250 && (int) tilePtr[1441].active == 0 || (int) tilePtr[-1440].liquid > 0 && (int) tilePtr[-1439].liquid < 250 && (int) tilePtr[-1439].active == 0) + { + Liquid.AddWater(index1 - 1, index2); + Liquid.AddWater(index1 + 1, index2); + } + if ((int) tilePtr->lava != 0) + { + Liquid.LavaCheck(index1, index2); + for (int i = index1 - 1; i <= index1 + 1; ++i) + { + for (int j = index2 - 1; j <= index2 + 1; ++j) + { + if ((int) Main.tile[i, j].active != 0) + { + switch (Main.tile[i, j].type) + { + case (byte) 2: + case (byte) 23: + case (byte) 109: + Main.tile[i, j].type = (byte) 0; + WorldGen.SquareTileFrame(i, j, -1); + if (Main.netMode == 2) + { + NetMessage.SendTileSquare(index1, index2, 3); + continue; + } + else + continue; + case (byte) 60: + case (byte) 70: + Main.tile[i, j].type = (byte) 59; + WorldGen.SquareTileFrame(i, j, -1); + if (Main.netMode == 2) + { + NetMessage.SendTileSquare(index1, index2, 3); + continue; + } + else + continue; + default: + continue; + } + } + } + } + } + } + if (Main.netMode == 2) + NetMessage.sendWater(index1, index2); + --Liquid.numLiquid; + tilePtr->checkingLiquid = 0; + Main.liquid[l].x = Main.liquid[Liquid.numLiquid].x; + Main.liquid[l].y = Main.liquid[Liquid.numLiquid].y; + Main.liquid[l].kill = Main.liquid[Liquid.numLiquid].kill; + if ((int) tilePtr->type >= 82 && (int) tilePtr->type <= 84) + WorldGen.CheckAlch(index1, index2); + } + } + } +} diff --git a/Terraria/LiquidBuffer.cs b/Terraria/LiquidBuffer.cs new file mode 100644 index 0000000..1f911bc --- /dev/null +++ b/Terraria/LiquidBuffer.cs @@ -0,0 +1,25 @@ +// Type: Terraria.LiquidBuffer +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +namespace Terraria +{ + public struct LiquidBuffer + { + public const int MAX_LIQUID_BUFFER = 8192; + public static int numLiquidBuffer; + public short x; + public short y; + + public static void AddBuffer(int x, int y) + { + if (LiquidBuffer.numLiquidBuffer == 8191 || Main.tile[x, y].checkingLiquid != 0) + return; + Main.tile[x, y].checkingLiquid = 64; + Main.liquidBuffer[LiquidBuffer.numLiquidBuffer].x = (short) x; + Main.liquidBuffer[LiquidBuffer.numLiquidBuffer].y = (short) y; + ++LiquidBuffer.numLiquidBuffer; + } + } +} diff --git a/Terraria/Location.cs b/Terraria/Location.cs new file mode 100644 index 0000000..e882a07 --- /dev/null +++ b/Terraria/Location.cs @@ -0,0 +1,19 @@ +// Type: Terraria.Location +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +namespace Terraria +{ + public struct Location + { + public short X; + public short Y; + + public Location(int x, int y) + { + this.X = (short) x; + this.Y = (short) y; + } + } +} diff --git a/Terraria/Main.cs b/Terraria/Main.cs new file mode 100644 index 0000000..d44bb0c --- /dev/null +++ b/Terraria/Main.cs @@ -0,0 +1,3093 @@ +// Type: Terraria.Main +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Audio; +using Microsoft.Xna.Framework.GamerServices; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Input; +using Microsoft.Xna.Framework.Net; +using System; +using System.Collections.ObjectModel; +using System.Text; +using System.Threading; +using Terraria.Achievements; + +namespace Terraria +{ + public sealed class Main : Game + { + private static readonly string[] CUE_NAMES = new string[19] + { + "Music_1", + "Music_2", + "Music_3", + "Music_4", + "Music_5", + "Music_6", + "Music_7", + "Music_8", + "Music_9", + "Music_10", + "Music_11", + "Music_12", + "Music_13", + "Desert", + "FloatingIsland", + "Tutorial", + "Boss4", + "Ocean", + "Snow" + }; + private static readonly Main.Music[] MUSIC_BOX_TO_SONG = new Main.Music[19] + { + Main.Music.MUSIC_1, + Main.Music.MUSIC_2, + Main.Music.MUSIC_3, + Main.Music.MUSIC_6, + Main.Music.MUSIC_4, + Main.Music.MUSIC_5, + Main.Music.MUSIC_7, + Main.Music.MUSIC_8, + Main.Music.MUSIC_10, + Main.Music.MUSIC_9, + Main.Music.MUSIC_12, + Main.Music.MUSIC_11, + Main.Music.MUSIC_13, + Main.Music.DESERT, + Main.Music.FLOATING_ISLAND, + Main.Music.TUTORIAL, + Main.Music.BOSS4, + Main.Music.OCEAN, + Main.Music.SNOW + }; + public static readonly Item.ID[] SONG_TO_MUSIC_BOX = new Item.ID[19] + { + Item.ID.MUSIC_BOX_OVERWORLD_DAY, + Item.ID.MUSIC_BOX_EERIE, + Item.ID.MUSIC_BOX_NIGHT, + Item.ID.MUSIC_BOX_UNDERGROUND, + Item.ID.MUSIC_BOX_BOSS1, + Item.ID.MUSIC_BOX_TITLE, + Item.ID.MUSIC_BOX_JUNGLE, + Item.ID.MUSIC_BOX_CORRUPTION, + Item.ID.MUSIC_BOX_THE_HALLOW, + Item.ID.MUSIC_BOX_UNDERGROUND_CORRUPTION, + Item.ID.MUSIC_BOX_UNDERGROUND_HALLOW, + Item.ID.MUSIC_BOX_BOSS2, + Item.ID.MUSIC_BOX_BOSS3, + Item.ID.MUSIC_BOX_DESERT, + Item.ID.MUSIC_BOX_SPACE, + Item.ID.MUSIC_BOX_TUTORIAL, + Item.ID.MUSIC_BOX_BOSS4, + Item.ID.MUSIC_BOX_OCEAN, + Item.ID.MUSIC_BOX_SNOW + }; + public static UI[] ui = new UI[4]; + public static AchievementSystem AchievementSystem = new AchievementSystem(); + public static int musicBox = -1; + public static float musicVolume = 0.75f; + public static float soundVolume = 1f; + public static float harpNote = 0.0f; + public static bool[] projHostile = new bool[120]; + public static Recipe[] recipe = new Recipe[342]; + public static Chest[] shop = new Chest[10]; + public static int renderCount = 0; + public static StringBuilder strBuilder = new StringBuilder(4096, 4096); + public static bool isGameStarted = false; + public static bool isGamePaused = false; + public static bool hardMode = false; + public static int DiscoStyle = 0; + public static Vector3 DiscoRGB = new Vector3(1f, 0.0f, 0.0f); + public static uint frameCounter = 0U; + public static int magmaBGFrame = 0; + public static int rightWorld = 80640; + public static int bottomWorld = 23040; + public static short maxTilesX = (short) 5040; + public static short maxTilesY = (short) 1440; + public static int maxSectionsX = (int) Main.maxTilesX / 40; + public static int maxSectionsY = (int) Main.maxTilesY / 30; + public static string[] tileName = new string[135]; + public static Liquid[] liquid = new Liquid[4096]; + public static LiquidBuffer[] liquidBuffer = new LiquidBuffer[8192]; + public static Main.Music curMusic = Main.Music.NUM_SONGS; + public static Main.Music newMusic = Main.Music.NUM_SONGS; + public static bool checkWorldId = false; + public static bool checkUserGeneratedContent = false; + public static int worldSurface = 360; + public static int worldSurfacePixels = Main.worldSurface << 4; + public static Color[] teamColor = new Color[5]; + public static Time gameTime = new Time(); + public static Time menuTime = new Time(); + public static float demonTorch = 1f; + public static float demonTorchDir = -0.01f; + public static FastRandom rand = new FastRandom(); + public static SfxInstancePool[] soundDig = new SfxInstancePool[3]; + public static SfxInstancePool[] soundTink = new SfxInstancePool[3]; + public static SfxInstancePool[] soundPlayerHit = new SfxInstancePool[3]; + public static SfxInstancePool[] soundFemaleHit = new SfxInstancePool[3]; + public static SfxInstancePool[] soundItem = new SfxInstancePool[37]; + public static SfxInstancePool[] soundNPCHit = new SfxInstancePool[11]; + public static SfxInstancePool[] soundNPCKilled = new SfxInstancePool[15]; + public static SfxInstancePool[] soundZombie = new SfxInstancePool[5]; + public static SfxInstancePool[] soundRoar = new SfxInstancePool[2]; + public static SfxInstancePool[] soundSplash = new SfxInstancePool[2]; + public static Cue[] music = new Cue[19]; + public static float[] musicFade = new float[19]; + public static bool[] tileLighted = new bool[150]; + public static bool[] tileMergeDirt = new bool[150]; + public static bool[] tileCut = new bool[150]; + public static short[] tileShine = new short[150]; + public static bool[] tileShine2 = new bool[150]; + public static bool[] wallHouse = new bool[32]; + public static bool[] tileStone = new bool[150]; + public static bool[] tileAxe = new bool[150]; + public static bool[] tileHammer = new bool[150]; + public static bool[] tileWaterDeath = new bool[150]; + public static bool[] tileLavaDeath = new bool[150]; + public static bool[] tileTable = new bool[150]; + public static bool[] tileBlockLight = new bool[150]; + public static bool[] tileNoSunLight = new bool[150]; + public static bool[] tileDungeon = new bool[150]; + public static bool[] tileSolidTop = new bool[150]; + public static bool[] tileSolid = new bool[150]; + public static bool[] tileSolidNotSolidTop = new bool[150]; + public static bool[] tileSolidAndAttach = new bool[150]; + public static bool[] tileNoAttach = new bool[150]; + public static bool[] tileNoFail = new bool[150]; + public static bool[] tileFrameImportant = new bool[150]; + public static DustPool dust = new DustPool((WorldView) null, 256); + public static Tile[,] tile = new Tile[5040, 1440]; + public static Item[] item = new Item[201]; + public static NPC[] npc = new NPC[197]; + public static Gore[] gore = new Gore[128]; + public static Projectile[] projectile = new Projectile[512]; + public static CombatText[] combatText = new CombatText[32]; + public static Chest[] chest = new Chest[1000]; + public static Sign[] sign = new Sign[1000]; + public static ChatLine[] chatLine = new ChatLine[7]; + public static Player[] player = new Player[9]; + public static bool hasFocus = true; + public static int invasionType = 0; + public static float invasionX = 0.0f; + public static int invasionSize = 0; + public static int invasionDelay = 0; + public static int invasionWarn = 0; + public static int netMode = 0; + private static int saveIconCounter = 0; + private static int activeSaves = 0; + private static Texture2D[] splashTexture = new Texture2D[4]; + private static short showSplash = (short) 0; + public static bool isTrial = true; + public static Tutorial tutorialState = Tutorial.NUM_TUTORIALS; + public static CompiledText tutorialText = (CompiledText) null; + private short splashDelay = (short) 240; + public const int screenWidth = 960; + public const int screenHeight = 540; + public const int WORLD_SMALL_W = 4200; + public const int WORLD_SMALL_H = 1200; + public const int WORLD_LARGE_W = 5040; + public const int WORLD_LARGE_H = 1440; + public const int WORLD_MEDIUM_W = 4620; + public const int WORLD_MEDIUM_H = 1320; + public const bool NET_VERBOSE = false; + public const int MAX_CHESTS = 1000; + public const int MAX_ITEMS = 200; + public const int MAX_ITEM_SOUNDS = 37; + public const int MAX_NPC_HIT_SOUNDS = 11; + public const int MAX_NPC_KILLED_SOUNDS = 15; + public const int MAX_LIQUID_TYPES = 2; + public const int MAX_MUSIC = 19; + public const int PLAYER_DATA_VERSION = 6; + public const int SETTINGS_DATA_VERSION = 5; + public const int OLD_WORLD_DATA_VERSION = 46; + public const int NEW_WORLD_DATA_VERSION = 49; + public const int NETWORK_VERSION = 1; + public const string versionNumber = "Xbox360 v0.7.6"; + public const int worldRate = 1; + public const bool IGNORE_ERRORS = false; + public const int zoneX = 99; + public const int zoneY = 87; + public const bool showFrameRate = false; + public const int leftWorld = 0; + public const int topWorld = 0; + public const int SECTION_WIDTH = 40; + public const int SECTION_HEIGHT = 30; + public const int MAX_TILESETS = 150; + public const int MAX_TILENAMES = 135; + public const int MAX_WALL_TYPES = 32; + public const int MAX_COMBAT_TEXT = 32; + public const int chatLength = 600; + public const int numChatLines = 7; + private const int maxItemUpdates = 5; + public const int SAVE_ICON_SPRITE = 642; + public const int SAVE_ICON_MESSAGE_TIME = 480; + private const int SAVE_ICON_MIN_TIME = 180; + private const int SPLASH_NUM_LOGOS = 4; + private const int SPLASH_FADE_IN = 16; + private const int SPLASH_FADE_OUT = 16; + private const int SPLASH_DELAY = 120; + private const int SPLASH_DELAY_RATING = 240; + private const int UPSELL_NUM_SCREENS = 1; + private const int UPSELL_DELAY = 600; + public static Thread worldGenThread; + private Thread loadingThread; + private static GraphicsDeviceManager graphics; + public static SpriteBatch spriteBatch; + public static short dungeonX; + public static short dungeonY; + public static string worldName; + public static int worldID; + public static int worldTimestamp; + public static int rockLayer; + public static int rockLayerPixels; + public static int magmaLayer; + public static int magmaLayerPixels; + public static Texture2D whiteTexture; + public static SfxInstancePool soundMech; + public static SfxInstancePool soundPlayerKilled; + public static SfxInstancePool soundGrass; + public static SfxInstancePool soundGrab; + public static SfxInstancePool soundPixie; + public static SfxInstancePool soundDoorOpen; + public static SfxInstancePool soundDoorClosed; + public static SfxInstancePool soundMenuOpen; + public static SfxInstancePool soundMenuClose; + public static SfxInstancePool soundMenuTick; + public static SfxInstancePool soundShatter; + public static SfxInstancePool soundDoubleJump; + public static SfxInstancePool soundRun; + public static SfxInstancePool soundCoins; + public static SfxInstancePool soundUnlock; + public static SfxInstancePool soundChat; + public static SfxInstancePool soundMaxMana; + public static SfxInstancePool soundDrown; + public static AudioEngine audioEngine; + public static SoundBank soundBank; + public static WaveBank waveBank; + public static short spawnTileX; + public static short spawnTileY; + public static int netPlayCounter; + public static int lastItemUpdate; + public static bool saveOnExit; + private short splashCounter; + private short splashLogo; + private bool upsellLoaded; + public static bool isRunningSlowly; + public static bool isHDTV; + public static bool TutorialMaskLS; + public static bool TutorialMaskRS; + public static bool TutorialMaskRSpress; + public static bool TutorialMaskA; + public static bool TutorialMaskB; + public static bool TutorialMaskX; + public static bool TutorialMaskY; + public static bool TutorialMaskLB; + public static bool TutorialMaskRB; + public static bool TutorialMaskLT; + public static bool TutorialMaskRT; + public static bool TutorialMaskBack; + private static int tutorialInputDelay; + private static uint tutorialVar; + private static uint tutorialVar2; + private static Location tutorialHouse; + + static Main() + { + } + + public Main() + { + Main.graphics = new GraphicsDeviceManager((Game) this); + Main.graphics.SynchronizeWithVerticalRetrace = true; + this.IsFixedTimeStep = true; + this.Content.RootDirectory = "Content"; + } + + public static ulong GetWorldId() + { + return (ulong) Main.worldID << 32 | (ulong) (uint) Main.worldTimestamp; + } + + protected override void Initialize() + { + base.Initialize(); + Main.menuTime.reset(86.4f); + Main.gameTime.reset(1f); + NPC.clrNames(); + NPC.setNames(); + Main.tileShine2[6] = true; + Main.tileShine2[7] = true; + Main.tileShine2[8] = true; + Main.tileShine2[9] = true; + Main.tileShine2[12] = true; + Main.tileShine2[21] = true; + Main.tileShine2[22] = true; + Main.tileShine2[25] = true; + Main.tileShine2[45] = true; + Main.tileShine2[46] = true; + Main.tileShine2[47] = true; + Main.tileShine2[63] = true; + Main.tileShine2[64] = true; + Main.tileShine2[65] = true; + Main.tileShine2[66] = true; + Main.tileShine2[67] = true; + Main.tileShine2[68] = true; + Main.tileShine2[107] = true; + Main.tileShine2[108] = true; + Main.tileShine2[111] = true; + Main.tileShine2[117] = true; + Main.tileShine2[121] = true; + Main.tileShine2[122] = true; + Main.tileShine[6] = (short) 1150; + Main.tileShine[7] = (short) 1100; + Main.tileShine[8] = (short) 1000; + Main.tileShine[9] = (short) 1050; + Main.tileShine[12] = (short) 1000; + Main.tileShine[21] = (short) 1200; + Main.tileShine[22] = (short) 1150; + Main.tileShine[45] = (short) 1900; + Main.tileShine[46] = (short) 2000; + Main.tileShine[47] = (short) 2100; + Main.tileShine[63] = (short) 900; + Main.tileShine[64] = (short) 900; + Main.tileShine[65] = (short) 900; + Main.tileShine[66] = (short) 900; + Main.tileShine[67] = (short) 900; + Main.tileShine[68] = (short) 900; + Main.tileShine[107] = (short) 950; + Main.tileShine[108] = (short) 900; + Main.tileShine[109] = (short) 9000; + Main.tileShine[110] = (short) 9000; + Main.tileShine[111] = (short) 850; + Main.tileShine[116] = (short) 9000; + Main.tileShine[117] = (short) 9000; + Main.tileShine[118] = (short) 8000; + Main.tileShine[121] = (short) 1850; + Main.tileShine[122] = (short) 1800; + Main.tileShine[125] = (short) 600; + Main.tileShine[129] = (short) 300; + Main.tileHammer[141] = true; + Main.tileHammer[4] = true; + Main.tileHammer[10] = true; + Main.tileHammer[11] = true; + Main.tileHammer[12] = true; + Main.tileHammer[13] = true; + Main.tileHammer[14] = true; + Main.tileHammer[15] = true; + Main.tileHammer[16] = true; + Main.tileHammer[17] = true; + Main.tileHammer[18] = true; + Main.tileHammer[19] = true; + Main.tileHammer[21] = true; + Main.tileHammer[26] = true; + Main.tileHammer[28] = true; + Main.tileHammer[29] = true; + Main.tileHammer[31] = true; + Main.tileHammer[33] = true; + Main.tileHammer[34] = true; + Main.tileHammer[35] = true; + Main.tileHammer[36] = true; + Main.tileHammer[42] = true; + Main.tileHammer[48] = true; + Main.tileHammer[49] = true; + Main.tileHammer[50] = true; + Main.tileHammer[54] = true; + Main.tileHammer[55] = true; + Main.tileHammer[77] = true; + Main.tileHammer[78] = true; + Main.tileHammer[79] = true; + Main.tileHammer[81] = true; + Main.tileHammer[85] = true; + Main.tileHammer[86] = true; + Main.tileHammer[87] = true; + Main.tileHammer[88] = true; + Main.tileHammer[89] = true; + Main.tileHammer[90] = true; + Main.tileHammer[91] = true; + Main.tileHammer[92] = true; + Main.tileHammer[93] = true; + Main.tileHammer[94] = true; + Main.tileHammer[95] = true; + Main.tileHammer[96] = true; + Main.tileHammer[97] = true; + Main.tileHammer[98] = true; + Main.tileHammer[99] = true; + Main.tileHammer[100] = true; + Main.tileHammer[101] = true; + Main.tileHammer[102] = true; + Main.tileHammer[103] = true; + Main.tileHammer[104] = true; + Main.tileHammer[105] = true; + Main.tileHammer[106] = true; + Main.tileHammer[114] = true; + Main.tileHammer[125] = true; + Main.tileHammer[126] = true; + Main.tileHammer[128] = true; + Main.tileHammer[129] = true; + Main.tileHammer[132] = true; + Main.tileHammer[133] = true; + Main.tileHammer[134] = true; + Main.tileHammer[135] = true; + Main.tileHammer[136] = true; + Main.tileFrameImportant[139] = true; + Main.tileHammer[139] = true; + Main.tileLighted[149] = true; + Main.tileFrameImportant[149] = true; + Main.tileHammer[149] = true; + Main.tileFrameImportant[142] = true; + Main.tileHammer[142] = true; + Main.tileFrameImportant[143] = true; + Main.tileHammer[143] = true; + Main.tileFrameImportant[144] = true; + Main.tileHammer[144] = true; + Main.tileStone[131] = true; + Main.tileFrameImportant[136] = true; + Main.tileFrameImportant[137] = true; + Main.tileFrameImportant[138] = true; + Main.tileBlockLight[137] = true; + Main.tileSolid[137] = true; + Main.tileBlockLight[145] = true; + Main.tileSolid[145] = true; + Main.tileMergeDirt[145] = true; + Main.tileBlockLight[146] = true; + Main.tileSolid[146] = true; + Main.tileMergeDirt[146] = true; + Main.tileBlockLight[147] = true; + Main.tileSolid[147] = true; + Main.tileMergeDirt[147] = true; + Main.tileBlockLight[148] = true; + Main.tileSolid[148] = true; + Main.tileMergeDirt[148] = true; + Main.tileBlockLight[138] = true; + Main.tileSolid[138] = true; + Main.tileBlockLight[140] = true; + Main.tileSolid[140] = true; + Main.tileAxe[5] = true; + Main.tileAxe[30] = true; + Main.tileAxe[72] = true; + Main.tileAxe[80] = true; + Main.tileAxe[124] = true; + Main.tileLighted[4] = true; + Main.tileLighted[17] = true; + Main.tileLighted[19] = true; + Main.tileLighted[22] = true; + Main.tileLighted[26] = true; + Main.tileLighted[31] = true; + Main.tileLighted[33] = true; + Main.tileLighted[34] = true; + Main.tileLighted[35] = true; + Main.tileLighted[36] = true; + Main.tileLighted[37] = true; + Main.tileLighted[42] = true; + Main.tileLighted[49] = true; + Main.tileLighted[58] = true; + Main.tileLighted[61] = true; + Main.tileLighted[70] = true; + Main.tileLighted[71] = true; + Main.tileLighted[72] = true; + Main.tileLighted[76] = true; + Main.tileLighted[77] = true; + Main.tileLighted[83] = true; + Main.tileLighted[84] = true; + Main.tileLighted[92] = true; + Main.tileLighted[93] = true; + Main.tileLighted[95] = true; + Main.tileLighted[98] = true; + Main.tileLighted[100] = true; + Main.tileLighted[109] = true; + Main.tileLighted[125] = true; + Main.tileLighted[126] = true; + Main.tileLighted[129] = true; + Main.tileLighted[133] = true; + Main.tileLighted[140] = true; + Main.tileMergeDirt[1] = true; + Main.tileMergeDirt[6] = true; + Main.tileMergeDirt[7] = true; + Main.tileMergeDirt[8] = true; + Main.tileMergeDirt[9] = true; + Main.tileMergeDirt[22] = true; + Main.tileMergeDirt[25] = true; + Main.tileMergeDirt[30] = true; + Main.tileMergeDirt[37] = true; + Main.tileMergeDirt[38] = true; + Main.tileMergeDirt[39] = true; + Main.tileMergeDirt[40] = true; + Main.tileMergeDirt[41] = true; + Main.tileMergeDirt[43] = true; + Main.tileMergeDirt[44] = true; + Main.tileMergeDirt[45] = true; + Main.tileMergeDirt[46] = true; + Main.tileMergeDirt[47] = true; + Main.tileMergeDirt[53] = true; + Main.tileMergeDirt[56] = true; + Main.tileMergeDirt[107] = true; + Main.tileMergeDirt[108] = true; + Main.tileMergeDirt[111] = true; + Main.tileMergeDirt[112] = true; + Main.tileMergeDirt[116] = true; + Main.tileMergeDirt[117] = true; + Main.tileMergeDirt[123] = true; + Main.tileMergeDirt[140] = true; + Main.tileMergeDirt[122] = true; + Main.tileMergeDirt[121] = true; + Main.tileMergeDirt[120] = true; + Main.tileMergeDirt[119] = true; + Main.tileMergeDirt[118] = true; + Main.tileFrameImportant[3] = true; + Main.tileFrameImportant[4] = true; + Main.tileFrameImportant[5] = true; + Main.tileFrameImportant[10] = true; + Main.tileFrameImportant[11] = true; + Main.tileFrameImportant[12] = true; + Main.tileFrameImportant[13] = true; + Main.tileFrameImportant[14] = true; + Main.tileFrameImportant[15] = true; + Main.tileFrameImportant[16] = true; + Main.tileFrameImportant[17] = true; + Main.tileFrameImportant[18] = true; + Main.tileFrameImportant[20] = true; + Main.tileFrameImportant[21] = true; + Main.tileFrameImportant[24] = true; + Main.tileFrameImportant[26] = true; + Main.tileFrameImportant[27] = true; + Main.tileFrameImportant[28] = true; + Main.tileFrameImportant[29] = true; + Main.tileFrameImportant[31] = true; + Main.tileFrameImportant[33] = true; + Main.tileFrameImportant[34] = true; + Main.tileFrameImportant[35] = true; + Main.tileFrameImportant[36] = true; + Main.tileFrameImportant[42] = true; + Main.tileFrameImportant[50] = true; + Main.tileFrameImportant[55] = true; + Main.tileFrameImportant[61] = true; + Main.tileFrameImportant[71] = true; + Main.tileFrameImportant[72] = true; + Main.tileFrameImportant[73] = true; + Main.tileFrameImportant[74] = true; + Main.tileFrameImportant[77] = true; + Main.tileFrameImportant[78] = true; + Main.tileFrameImportant[79] = true; + Main.tileFrameImportant[81] = true; + Main.tileFrameImportant[82] = true; + Main.tileFrameImportant[83] = true; + Main.tileFrameImportant[84] = true; + Main.tileFrameImportant[85] = true; + Main.tileFrameImportant[86] = true; + Main.tileFrameImportant[87] = true; + Main.tileFrameImportant[88] = true; + Main.tileFrameImportant[89] = true; + Main.tileFrameImportant[90] = true; + Main.tileFrameImportant[91] = true; + Main.tileFrameImportant[92] = true; + Main.tileFrameImportant[93] = true; + Main.tileFrameImportant[94] = true; + Main.tileFrameImportant[95] = true; + Main.tileFrameImportant[96] = true; + Main.tileFrameImportant[97] = true; + Main.tileFrameImportant[98] = true; + Main.tileFrameImportant[99] = true; + Main.tileFrameImportant[101] = true; + Main.tileFrameImportant[102] = true; + Main.tileFrameImportant[103] = true; + Main.tileFrameImportant[104] = true; + Main.tileFrameImportant[105] = true; + Main.tileFrameImportant[100] = true; + Main.tileFrameImportant[106] = true; + Main.tileFrameImportant[110] = true; + Main.tileFrameImportant[113] = true; + Main.tileFrameImportant[114] = true; + Main.tileFrameImportant[125] = true; + Main.tileFrameImportant[126] = true; + Main.tileFrameImportant[128] = true; + Main.tileFrameImportant[129] = true; + Main.tileFrameImportant[132] = true; + Main.tileFrameImportant[133] = true; + Main.tileFrameImportant[134] = true; + Main.tileFrameImportant[135] = true; + Main.tileFrameImportant[141] = true; + Main.tileCut[3] = true; + Main.tileCut[24] = true; + Main.tileCut[28] = true; + Main.tileCut[32] = true; + Main.tileCut[51] = true; + Main.tileCut[52] = true; + Main.tileCut[61] = true; + Main.tileCut[62] = true; + Main.tileCut[69] = true; + Main.tileCut[71] = true; + Main.tileCut[73] = true; + Main.tileCut[74] = true; + Main.tileCut[82] = true; + Main.tileCut[83] = true; + Main.tileCut[84] = true; + Main.tileCut[110] = true; + Main.tileCut[113] = true; + Main.tileCut[115] = true; + Main.tileLavaDeath[104] = true; + Main.tileLavaDeath[110] = true; + Main.tileLavaDeath[113] = true; + Main.tileLavaDeath[115] = true; + Main.tileSolid[(int) sbyte.MaxValue] = true; + Main.tileSolid[130] = true; + Main.tileBlockLight[130] = true; + Main.tileSolid[107] = true; + Main.tileBlockLight[107] = true; + Main.tileSolid[108] = true; + Main.tileBlockLight[108] = true; + Main.tileSolid[111] = true; + Main.tileBlockLight[111] = true; + Main.tileSolid[109] = true; + Main.tileBlockLight[109] = true; + Main.tileSolid[110] = false; + Main.tileNoAttach[110] = true; + Main.tileNoFail[110] = true; + Main.tileSolid[112] = true; + Main.tileBlockLight[112] = true; + Main.tileSolid[116] = true; + Main.tileBlockLight[116] = true; + Main.tileSolid[117] = true; + Main.tileBlockLight[117] = true; + Main.tileSolid[123] = true; + Main.tileBlockLight[123] = true; + Main.tileSolid[118] = true; + Main.tileBlockLight[118] = true; + Main.tileSolid[119] = true; + Main.tileBlockLight[119] = true; + Main.tileSolid[120] = true; + Main.tileBlockLight[120] = true; + Main.tileSolid[121] = true; + Main.tileBlockLight[121] = true; + Main.tileSolid[122] = true; + Main.tileBlockLight[122] = true; + Main.tileBlockLight[115] = true; + Main.tileSolid[0] = true; + Main.tileBlockLight[0] = true; + Main.tileSolid[1] = true; + Main.tileBlockLight[1] = true; + Main.tileSolid[2] = true; + Main.tileBlockLight[2] = true; + Main.tileSolid[3] = false; + Main.tileNoAttach[3] = true; + Main.tileNoFail[3] = true; + Main.tileSolid[4] = false; + Main.tileNoAttach[4] = true; + Main.tileNoFail[4] = true; + Main.tileNoFail[24] = true; + Main.tileSolid[5] = false; + Main.tileSolid[6] = true; + Main.tileBlockLight[6] = true; + Main.tileSolid[7] = true; + Main.tileBlockLight[7] = true; + Main.tileSolid[8] = true; + Main.tileBlockLight[8] = true; + Main.tileSolid[9] = true; + Main.tileBlockLight[9] = true; + Main.tileBlockLight[10] = true; + Main.tileSolid[10] = true; + Main.tileNoAttach[10] = true; + Main.tileBlockLight[10] = true; + Main.tileSolid[11] = false; + Main.tileSolidTop[19] = true; + Main.tileSolid[19] = true; + Main.tileSolid[22] = true; + Main.tileSolid[23] = true; + Main.tileSolid[25] = true; + Main.tileSolid[30] = true; + Main.tileNoFail[32] = true; + Main.tileBlockLight[32] = true; + Main.tileSolid[37] = true; + Main.tileBlockLight[37] = true; + Main.tileSolid[38] = true; + Main.tileBlockLight[38] = true; + Main.tileSolid[39] = true; + Main.tileBlockLight[39] = true; + Main.tileSolid[40] = true; + Main.tileBlockLight[40] = true; + Main.tileSolid[41] = true; + Main.tileBlockLight[41] = true; + Main.tileSolid[43] = true; + Main.tileBlockLight[43] = true; + Main.tileSolid[44] = true; + Main.tileBlockLight[44] = true; + Main.tileSolid[45] = true; + Main.tileBlockLight[45] = true; + Main.tileSolid[46] = true; + Main.tileBlockLight[46] = true; + Main.tileSolid[47] = true; + Main.tileBlockLight[47] = true; + Main.tileSolid[48] = true; + Main.tileBlockLight[48] = true; + Main.tileSolid[53] = true; + Main.tileBlockLight[53] = true; + Main.tileSolid[54] = true; + Main.tileBlockLight[52] = true; + Main.tileSolid[56] = true; + Main.tileBlockLight[56] = true; + Main.tileSolid[57] = true; + Main.tileBlockLight[57] = true; + Main.tileSolid[58] = true; + Main.tileBlockLight[58] = true; + Main.tileSolid[59] = true; + Main.tileBlockLight[59] = true; + Main.tileSolid[60] = true; + Main.tileBlockLight[60] = true; + Main.tileSolid[63] = true; + Main.tileBlockLight[63] = true; + Main.tileStone[63] = true; + Main.tileStone[130] = true; + Main.tileSolid[64] = true; + Main.tileBlockLight[64] = true; + Main.tileStone[64] = true; + Main.tileSolid[65] = true; + Main.tileBlockLight[65] = true; + Main.tileStone[65] = true; + Main.tileSolid[66] = true; + Main.tileBlockLight[66] = true; + Main.tileStone[66] = true; + Main.tileSolid[67] = true; + Main.tileBlockLight[67] = true; + Main.tileStone[67] = true; + Main.tileSolid[68] = true; + Main.tileBlockLight[68] = true; + Main.tileStone[68] = true; + Main.tileSolid[75] = true; + Main.tileBlockLight[75] = true; + Main.tileSolid[76] = true; + Main.tileBlockLight[76] = true; + Main.tileSolid[70] = true; + Main.tileBlockLight[70] = true; + Main.tileNoFail[50] = true; + Main.tileNoAttach[50] = true; + Main.tileDungeon[41] = true; + Main.tileDungeon[43] = true; + Main.tileDungeon[44] = true; + Main.tileBlockLight[30] = true; + Main.tileBlockLight[25] = true; + Main.tileBlockLight[23] = true; + Main.tileBlockLight[22] = true; + Main.tileBlockLight[62] = true; + Main.tileSolidTop[18] = true; + Main.tileSolidTop[14] = true; + Main.tileSolidTop[16] = true; + Main.tileSolidTop[114] = true; + Main.tileNoAttach[13] = true; + Main.tileNoAttach[14] = true; + Main.tileNoAttach[15] = true; + Main.tileNoAttach[16] = true; + Main.tileNoAttach[17] = true; + Main.tileNoAttach[18] = true; + Main.tileNoAttach[19] = true; + Main.tileNoAttach[21] = true; + Main.tileNoAttach[20] = true; + Main.tileNoAttach[27] = true; + Main.tileNoAttach[114] = true; + Main.tileTable[14] = true; + Main.tileTable[18] = true; + Main.tileTable[19] = true; + Main.tileTable[114] = true; + Main.tileNoAttach[86] = true; + Main.tileNoAttach[87] = true; + Main.tileNoAttach[88] = true; + Main.tileNoAttach[89] = true; + Main.tileNoAttach[90] = true; + Main.tileLavaDeath[86] = true; + Main.tileLavaDeath[87] = true; + Main.tileLavaDeath[88] = true; + Main.tileLavaDeath[89] = true; + Main.tileLavaDeath[125] = true; + Main.tileLavaDeath[126] = true; + Main.tileLavaDeath[101] = true; + Main.tileTable[101] = true; + Main.tileNoAttach[101] = true; + Main.tileLavaDeath[102] = true; + Main.tileNoAttach[102] = true; + Main.tileNoAttach[94] = true; + Main.tileNoAttach[95] = true; + Main.tileNoAttach[96] = true; + Main.tileNoAttach[97] = true; + Main.tileNoAttach[98] = true; + Main.tileNoAttach[99] = true; + Main.tileLavaDeath[94] = true; + Main.tileLavaDeath[95] = true; + Main.tileLavaDeath[96] = true; + Main.tileLavaDeath[97] = true; + Main.tileLavaDeath[98] = true; + Main.tileLavaDeath[99] = true; + Main.tileLavaDeath[100] = true; + Main.tileLavaDeath[103] = true; + Main.tileTable[87] = true; + Main.tileTable[88] = true; + Main.tileSolidTop[87] = true; + Main.tileSolidTop[88] = true; + Main.tileSolidTop[101] = true; + Main.tileNoAttach[91] = true; + Main.tileLavaDeath[91] = true; + Main.tileNoAttach[92] = true; + Main.tileLavaDeath[92] = true; + Main.tileNoAttach[93] = true; + Main.tileLavaDeath[93] = true; + Main.tileWaterDeath[4] = true; + Main.tileWaterDeath[51] = true; + Main.tileWaterDeath[93] = true; + Main.tileWaterDeath[98] = true; + Main.tileLavaDeath[3] = true; + Main.tileLavaDeath[5] = true; + Main.tileLavaDeath[10] = true; + Main.tileLavaDeath[11] = true; + Main.tileLavaDeath[12] = true; + Main.tileLavaDeath[13] = true; + Main.tileLavaDeath[14] = true; + Main.tileLavaDeath[15] = true; + Main.tileLavaDeath[16] = true; + Main.tileLavaDeath[17] = true; + Main.tileLavaDeath[18] = true; + Main.tileLavaDeath[19] = true; + Main.tileLavaDeath[20] = true; + Main.tileLavaDeath[27] = true; + Main.tileLavaDeath[28] = true; + Main.tileLavaDeath[29] = true; + Main.tileLavaDeath[32] = true; + Main.tileLavaDeath[33] = true; + Main.tileLavaDeath[34] = true; + Main.tileLavaDeath[35] = true; + Main.tileLavaDeath[36] = true; + Main.tileLavaDeath[42] = true; + Main.tileLavaDeath[49] = true; + Main.tileLavaDeath[50] = true; + Main.tileLavaDeath[52] = true; + Main.tileLavaDeath[55] = true; + Main.tileLavaDeath[61] = true; + Main.tileLavaDeath[62] = true; + Main.tileLavaDeath[69] = true; + Main.tileLavaDeath[71] = true; + Main.tileLavaDeath[72] = true; + Main.tileLavaDeath[73] = true; + Main.tileLavaDeath[74] = true; + Main.tileLavaDeath[79] = true; + Main.tileLavaDeath[80] = true; + Main.tileLavaDeath[81] = true; + Main.tileLavaDeath[106] = true; + Main.wallHouse[1] = true; + Main.wallHouse[4] = true; + Main.wallHouse[5] = true; + Main.wallHouse[6] = true; + Main.wallHouse[10] = true; + Main.wallHouse[11] = true; + Main.wallHouse[12] = true; + Main.wallHouse[16] = true; + Main.wallHouse[17] = true; + Main.wallHouse[18] = true; + Main.wallHouse[19] = true; + Main.wallHouse[20] = true; + Main.wallHouse[21] = true; + Main.wallHouse[22] = true; + Main.wallHouse[23] = true; + Main.wallHouse[24] = true; + Main.wallHouse[25] = true; + Main.wallHouse[26] = true; + Main.wallHouse[27] = true; + Main.wallHouse[29] = true; + Main.wallHouse[30] = true; + Main.wallHouse[31] = true; + for (int index = 149; index >= 0; --index) + { + Main.tileSolidNotSolidTop[index] = Main.tileSolid[index] & !Main.tileSolidTop[index]; + Main.tileSolidAndAttach[index] = Main.tileSolid[index] & !Main.tileNoAttach[index]; + } + Main.tileNoFail[32] = true; + Main.tileNoFail[61] = true; + Main.tileNoFail[69] = true; + Main.tileNoFail[73] = true; + Main.tileNoFail[74] = true; + Main.tileNoFail[82] = true; + Main.tileNoFail[83] = true; + Main.tileNoFail[84] = true; + Main.tileNoFail[110] = true; + Main.tileNoFail[113] = true; + for (int index = 0; index < 150; ++index) + { + if (Main.tileSolid[index]) + Main.tileNoSunLight[index] = true; + } + Main.tileNoSunLight[19] = false; + Main.tileNoSunLight[11] = true; + Main.dust.Init(); + for (int index = 0; index < 201; ++index) + Main.item[index].Init(); + for (int index = 0; index < 197; ++index) + { + Main.npc[index] = new NPC(); + Main.npc[index].whoAmI = (short) index; + } + for (int index = 0; index < 9; ++index) + { + Main.player[index] = new Player(); + Main.player[index].whoAmI = (byte) index; + } + for (int index = 0; index < 512; ++index) + Main.projectile[index].Init(); + for (int index = 0; index < 128; ++index) + Main.gore[index].Init(); + Cloud.Initialize(); + for (int index = 0; index < 32; ++index) + Main.combatText[index].Init(); + Recipe.SetupRecipes(); + for (int index = 0; index < 7; ++index) + Main.chatLine[index].Init(); + Main.teamColor[0] = Color.White; + Main.teamColor[1] = new Color(230, 40, 20); + Main.teamColor[2] = new Color(20, 200, 30); + Main.teamColor[3] = new Color(75, 90, (int) byte.MaxValue); + Main.teamColor[4] = new Color(200, 180, 0); + Projectile projectile = new Projectile(); + for (int Type = 1; Type < 120; ++Type) + { + projectile.SetDefaults(Type); + Main.projHostile[Type] = projectile.hostile; + } + } + + private void InitializePostSplash() + { + UI.Initialize(this); + WorldView.Initialize(this.GraphicsDevice); + for (int index = 0; index < 4; ++index) + Main.ui[index] = new UI(); + Main.ui[0].setView(WorldView.Type.FULLSCREEN, true); + for (int index = 0; index < 4; ++index) + Main.ui[index].Initialize((PlayerIndex) index); + Item obj = new Item(); + for (int Type = 631; Type > 0; --Type) + { + obj.SetDefaults(Type, 1, false); + if ((int) obj.headSlot > 0) + Item.headType[(int) obj.headSlot] = obj.type; + else if ((int) obj.bodySlot > 0) + Item.bodyType[(int) obj.bodySlot] = obj.type; + else if ((int) obj.legSlot > 0) + Item.legType[(int) obj.legSlot] = obj.type; + } + Main.shop[0] = new Chest(); + Main.shop[1] = new Chest(); + Main.shop[1].SetupShop(1, (Player) null); + Main.shop[2] = new Chest(); + Main.shop[2].SetupShop(2, (Player) null); + Main.shop[3] = new Chest(); + Main.shop[3].SetupShop(3, (Player) null); + Main.shop[4] = new Chest(); + Main.shop[4].SetupShop(4, (Player) null); + Main.shop[5] = new Chest(); + Main.shop[5].SetupShop(5, (Player) null); + Main.shop[6] = new Chest(); + Main.shop[6].SetupShop(6, (Player) null); + Main.shop[7] = new Chest(); + Main.shop[7].SetupShop(7, (Player) null); + Main.shop[8] = new Chest(); + Main.shop[8].SetupShop(8, (Player) null); + Main.shop[9] = new Chest(); + Main.shop[9].SetupShop(9, (Player) null); + Star.SpawnStars(); + Projectile.Initialize(); + ((Collection) this.Components).Add((IGameComponent) new GamerServicesComponent((Game) this)); + SignedInGamer.add_SignedIn(new EventHandler(Main.SignedInGamer_SignedIn)); + SignedInGamer.add_SignedOut(new EventHandler(Main.SignedInGamer_SignedOut)); + NetworkSession.add_InviteAccepted(new EventHandler(Netplay.NetworkSession_InviteAccepted)); + } + + protected override void LoadContent() + { + this.GraphicsDevice.DepthStencilState = DepthStencilState.None; + this.GraphicsDevice.RasterizerState = RasterizerState.CullNone; + Main.graphics.PreferredBackBufferWidth = 960; + Main.graphics.PreferredBackBufferHeight = 540; + Main.graphics.ApplyChanges(); + Main.isHDTV = Main.graphics.GraphicsDevice.Adapter.CurrentDisplayMode.Height >= 720; + Main.spriteBatch = new SpriteBatch(this.GraphicsDevice); + string assetName = Lang.setSystemLang(); + if (assetName != null) + { + Main.splashTexture[0] = this.Content.Load(assetName); + } + else + { + this.splashLogo = (short) 1; + this.splashDelay = (short) 120; + } + Main.splashTexture[1] = this.Content.Load("Images/logo_1"); + this.loadingThread = new Thread(new ThreadStart(this.LoadingThread)); + this.loadingThread.IsBackground = true; + this.loadingThread.Start(); + } + + private void LoadingThread() + { + Thread.CurrentThread.SetProcessorAffinity(new int[1] + { + 5 + }); + try + { + for (int index = 2; index < 4; ++index) + Main.splashTexture[index] = this.Content.Load("Images/logo_" + (object) index); + Main.audioEngine = new AudioEngine("Content/TerrariaMusic.xgs"); + Main.soundBank = new SoundBank(Main.audioEngine, "Content/Sound Bank.xsb"); + Main.waveBank = new WaveBank(Main.audioEngine, "Content/Wave Bank.xwb"); + for (int index = 0; index < 19; ++index) + Main.music[index] = Main.soundBank.GetCue(Main.CUE_NAMES[index]); + Main.soundMech = new SfxInstancePool(this.Content, "Sounds/Mech_0", 3); + Main.soundGrab = new SfxInstancePool(this.Content, "Sounds/Grab", 3); + Main.soundPixie = new SfxInstancePool(this.Content, "Sounds/Pixie", 2); + Main.soundDig[0] = new SfxInstancePool(this.Content, "Sounds/Dig_0", 3); + Main.soundDig[1] = new SfxInstancePool(this.Content, "Sounds/Dig_1", 3); + Main.soundDig[2] = new SfxInstancePool(this.Content, "Sounds/Dig_2", 3); + Main.soundTink[0] = new SfxInstancePool(this.Content, "Sounds/Tink_0", 3); + Main.soundTink[1] = new SfxInstancePool(this.Content, "Sounds/Tink_1", 3); + Main.soundTink[2] = new SfxInstancePool(this.Content, "Sounds/Tink_2", 3); + Main.soundPlayerHit[0] = new SfxInstancePool(this.Content, "Sounds/Player_Hit_0", 3); + Main.soundPlayerHit[1] = new SfxInstancePool(this.Content, "Sounds/Player_Hit_1", 3); + Main.soundPlayerHit[2] = new SfxInstancePool(this.Content, "Sounds/Player_Hit_2", 3); + Main.soundFemaleHit[0] = new SfxInstancePool(this.Content, "Sounds/Female_Hit_0", 3); + Main.soundFemaleHit[1] = new SfxInstancePool(this.Content, "Sounds/Female_Hit_1", 3); + Main.soundFemaleHit[2] = new SfxInstancePool(this.Content, "Sounds/Female_Hit_2", 3); + Main.soundPlayerKilled = new SfxInstancePool(this.Content, "Sounds/Player_Killed", 3); + Main.soundChat = new SfxInstancePool(this.Content, "Sounds/Chat", 2); + Main.soundGrass = new SfxInstancePool(this.Content, "Sounds/Grass", 6); + Main.soundDoorOpen = new SfxInstancePool(this.Content, "Sounds/Door_Opened", 3); + Main.soundDoorClosed = new SfxInstancePool(this.Content, "Sounds/Door_Closed", 3); + Main.soundMenuTick = new SfxInstancePool(this.Content, "Sounds/Menu_Tick", 3); + Main.soundMenuOpen = new SfxInstancePool(this.Content, "Sounds/Menu_Open", 3); + Main.soundMenuClose = new SfxInstancePool(this.Content, "Sounds/Menu_Close", 3); + Main.soundShatter = new SfxInstancePool(this.Content, "Sounds/Shatter", 4); + Main.soundZombie[0] = new SfxInstancePool(this.Content, "Sounds/Zombie_0", 4); + Main.soundZombie[1] = new SfxInstancePool(this.Content, "Sounds/Zombie_1", 4); + Main.soundZombie[2] = new SfxInstancePool(this.Content, "Sounds/Zombie_2", 4); + Main.soundZombie[3] = new SfxInstancePool(this.Content, "Sounds/Zombie_3", 4); + Main.soundZombie[4] = new SfxInstancePool(this.Content, "Sounds/Zombie_4", 4); + Main.soundRoar[0] = new SfxInstancePool(this.Content, "Sounds/Roar_0", 2); + Main.soundRoar[1] = new SfxInstancePool(this.Content, "Sounds/Roar_1", 2); + Main.soundSplash[0] = new SfxInstancePool(this.Content, "Sounds/Splash_0", 4); + Main.soundSplash[1] = new SfxInstancePool(this.Content, "Sounds/Splash_1", 4); + Main.soundDoubleJump = new SfxInstancePool(this.Content, "Sounds/Double_Jump", 3); + Main.soundRun = new SfxInstancePool(this.Content, "Sounds/Run", 7); + Main.soundCoins = new SfxInstancePool(this.Content, "Sounds/Coins", 4); + Main.soundUnlock = new SfxInstancePool(this.Content, "Sounds/Unlock", 4); + Main.soundMaxMana = new SfxInstancePool(this.Content, "Sounds/MaxMana", 4); + Main.soundDrown = new SfxInstancePool(this.Content, "Sounds/Drown", 4); + for (int index = 0; index < 37; ++index) + { + int num = index + 1; + int maxInstances = 3; + if (num != 9 && num != 10 && (num != 24 && num != 26) && num != 34) + maxInstances = 2; + Main.soundItem[index] = new SfxInstancePool(this.Content, "Sounds/Item_" + (object) (index + 1), maxInstances); + } + for (int index = 0; index < 11; ++index) + Main.soundNPCHit[index] = new SfxInstancePool(this.Content, "Sounds/NPC_Hit_" + (object) (index + 1), 4); + for (int index = 0; index < 15; ++index) + Main.soundNPCKilled[index] = new SfxInstancePool(this.Content, "Sounds/NPC_Killed_" + (object) (index + 1), 3); + } + catch + { + Main.musicVolume = 0.0f; + Main.soundVolume = 0.0f; + } + _sheetTiles.LoadContent(this.Content); + _sheetSprites.LoadContent(this.Content); + WorldView.LoadContent(this.Content); + Main.whiteTexture = new Texture2D(this.GraphicsDevice, 1, 1, false, SurfaceFormat.Bgr565); + Main.whiteTexture.SetData(new ushort[1] + { + ushort.MaxValue + }); + UI.LoadContent(this.Content); + CRC32.Initialize(); + } + + protected override void UnloadContent() + { + } + + private void UpdateMusic(Player mainPlayer) + { + try + { + if (Main.curMusic != Main.Music.NUM_SONGS && Main.music[(int) Main.curMusic].IsPaused) + Main.music[(int) Main.curMusic].Resume(); + if ((double) Main.musicVolume == 0.0) + { + Main.newMusic = Main.Music.NUM_SONGS; + } + else + { + bool flag = true; + for (int index = 0; index < 4; ++index) + { + if (Main.ui[index].menuType != MenuType.MAIN) + { + flag = false; + break; + } + } + if (flag) + Main.newMusic = UI.main.menuMode != MenuMode.CREDITS ? Main.Music.MUSIC_6 : Main.Music.TUTORIAL; + else if (Main.IsTutorial()) + { + Main.newMusic = Main.Music.TUTORIAL; + } + else + { + int num1 = 0; + bool result = false; + Rectangle rectangle = new Rectangle(); + rectangle.Width = 10000; + rectangle.Height = 10000; + WorldView worldView = mainPlayer.view; + for (int index = 0; index < 196; ++index) + { + if ((int) Main.npc[index].active != 0) + { + int num2 = (int) Main.npc[index].type; + if (num2 == 134 || num2 >= 143 && num2 <= 145) + { + rectangle.X = Main.npc[index].aabb.X + ((int) Main.npc[index].width >> 1) - 5000; + rectangle.Y = Main.npc[index].aabb.Y + ((int) Main.npc[index].height >> 1) - 5000; + worldView.viewArea.Intersects(ref rectangle, out result); + if (result) + { + num1 = 3; + break; + } + } + else if (num2 == 113 || num2 == 114 || (num2 == 125 || num2 == 126)) + { + rectangle.X = Main.npc[index].aabb.X + ((int) Main.npc[index].width >> 1) - 5000; + rectangle.Y = Main.npc[index].aabb.Y + ((int) Main.npc[index].height >> 1) - 5000; + worldView.viewArea.Intersects(ref rectangle, out result); + if (result) + { + num1 = 2; + break; + } + } + else if (num2 == 4 || num2 == 166) + { + rectangle.X = Main.npc[index].aabb.X + ((int) Main.npc[index].width >> 1) - 5000; + rectangle.Y = Main.npc[index].aabb.Y + ((int) Main.npc[index].height >> 1) - 5000; + worldView.viewArea.Intersects(ref rectangle, out result); + if (result) + { + num1 = 4; + break; + } + } + else if (Main.npc[index].boss || num2 >= 13 && num2 <= 15 || (num2 >= 26 && num2 <= 29 || num2 == 111)) + { + rectangle.X = Main.npc[index].aabb.X + ((int) Main.npc[index].width >> 1) - 5000; + rectangle.Y = Main.npc[index].aabb.Y + ((int) Main.npc[index].height >> 1) - 5000; + worldView.viewArea.Intersects(ref rectangle, out result); + if (result) + { + num1 = 1; + break; + } + } + } + } + if (num1 > 0) + { + switch (num1) + { + case 1: + Main.newMusic = Main.Music.MUSIC_5; + break; + case 2: + Main.newMusic = Main.Music.MUSIC_12; + break; + case 3: + Main.newMusic = Main.Music.MUSIC_13; + break; + case 4: + Main.newMusic = Main.Music.BOSS4; + break; + } + } + else if (worldView.screenPosition.Y > (int) Main.maxTilesY - 200 << 4) + Main.newMusic = Main.Music.MUSIC_2; + else if (mainPlayer.zoneEvil) + Main.newMusic = worldView.screenPosition.Y <= Main.worldSurfacePixels + 540 ? Main.Music.MUSIC_8 : Main.Music.MUSIC_10; + else if ((double) worldView.atmo < 1.0) + Main.newMusic = Main.Music.FLOATING_ISLAND; + else if ((worldView.screenPosition.X < 3200 || worldView.screenPosition.X > ((int) Main.maxTilesX - 200 << 4) - 960) && worldView.screenPosition.Y <= Main.worldSurfacePixels) + Main.newMusic = Main.Music.OCEAN; + else if (mainPlayer.zoneMeteor || mainPlayer.zoneDungeon) + Main.newMusic = Main.Music.MUSIC_2; + else if (mainPlayer.zoneJungle) + Main.newMusic = Main.Music.MUSIC_7; + else if (mainPlayer.view.sandTiles > 1000) + Main.newMusic = Main.Music.DESERT; + else if (mainPlayer.view.snowTiles > 80) + Main.newMusic = Main.Music.SNOW; + else if (worldView.screenPosition.Y > Main.worldSurfacePixels) + Main.newMusic = !mainPlayer.zoneHoly ? Main.Music.MUSIC_4 : Main.Music.MUSIC_11; + else if (Main.gameTime.dayTime) + Main.newMusic = !mainPlayer.zoneHoly ? Main.Music.MUSIC_1 : Main.Music.MUSIC_9; + else if (!Main.gameTime.dayTime) + Main.newMusic = !Main.gameTime.bloodMoon ? Main.Music.MUSIC_3 : Main.Music.MUSIC_2; + for (int index = 0; Main.musicBox < 0 && index < 4; ++index) + { + if (Main.ui[index].view != null) + Main.musicBox = Main.ui[index].view.musicBox; + } + if (Main.musicBox >= 0) + Main.newMusic = Main.MUSIC_BOX_TO_SONG[Main.musicBox]; + } + } + Main.curMusic = Main.newMusic; + for (int index = 0; index < 19; ++index) + { + if ((Main.Music) index == Main.curMusic) + { + if (!Main.music[index].IsPlaying) + { + Main.music[index] = Main.soundBank.GetCue(Main.CUE_NAMES[index]); + Main.music[index].Play(); + } + else + { + Main.musicFade[index] += 0.005f; + if ((double) Main.musicFade[index] > 1.0) + Main.musicFade[index] = 1f; + } + Main.music[index].SetVariable("Volume", Main.musicFade[index] * Main.musicVolume); + } + else if (Main.music[index].IsPlaying) + { + if (Main.curMusic == Main.Music.NUM_SONGS) + { + Main.musicFade[index] = 0.0f; + Main.music[index].Stop(AudioStopOptions.Immediate); + } + else if ((double) Main.musicFade[(int) Main.curMusic] > 0.25) + { + Main.musicFade[index] -= 0.005f; + if ((double) Main.musicFade[index] <= 0.0) + { + Main.musicFade[index] = 0.0f; + Main.music[index].Stop(AudioStopOptions.Immediate); + } + else + Main.music[index].SetVariable("Volume", Main.musicFade[index] * Main.musicVolume); + } + } + else + Main.musicFade[index] = 0.0f; + } + } + catch + { + Main.musicVolume = 0.0f; + } + } + + protected override void Update(GameTime dt) + { + try + { + base.Update(dt); + } + catch + { + } + Main.isRunningSlowly = dt.IsRunningSlowly; + ++Main.frameCounter; + switch (Main.showSplash) + { + case (short) 0: + break; + case (short) 1: + this.loadingThread.Join(); + this.loadingThread = (Thread) null; + Main.showSplash = (short) 2; + this.InitializePostSplash(); + break; + default: + for (int index = 0; index < 4; ++index) + Main.ui[index].UpdateGamePad(); + if (Main.tutorialState < Tutorial.THE_END) + Main.UpdateTutorial(); + for (int index = 0; index < 4; ++index) + Main.ui[index].Update(); + Main.dust.UpdateDust(); + if (UI.quit) + { + this.Quit(); + break; + } + else + { + UI.UpdateOnce(); + Main.AchievementSystem.Update(); + Main.audioEngine.Update(); + WorldGen.destroyObject = false; + this.UpdateMusic(UI.main.player); + Main.hasFocus = this.IsActive; + Main.isGamePaused = !Main.hasFocus && Main.netMode == 0; + if (Main.isGamePaused) + break; + if (Netplay.session != null) + { + if (!Netplay.disconnect) + { + if (Netplay.hookEvents) + Netplay.HookSessionEvents(); + if (Main.netMode == 1) + Main.UpdateClient(); + else + Main.UpdateServer(); + } + else if (Netplay.stopSession) + Netplay.Disconnect(); + } + if (Netplay.invite != null) + Netplay.InviteAccepted(); + if (Main.netMode == 0) + { + if (UI.main.menuType == MenuType.PAUSE) + { + bool flag = true; + for (int index = 0; index < 4; ++index) + { + if (Main.ui[index].menuType == MenuType.NONE) + { + flag = false; + break; + } + } + if (flag) + { + Main.isGamePaused = true; + break; + } + } + } + else if (Main.checkWorldId) + { + for (int index = 0; index < 4; ++index) + { + UI ui = Main.ui[index]; + if (ui.view != null && ui.menuType == MenuType.NONE) + { + Main.checkWorldId = false; + if (ui.CheckBlacklist()) + break; + } + } + } + Star.UpdateStars(); + Cloud.UpdateClouds(); + for (int index = 0; index < 7; ++index) + { + if (Main.chatLine[index].showTime > 0) + --Main.chatLine[index].showTime; + } + for (int index = 0; index < 4; ++index) + { + if (Main.ui[index].view != null && Main.ui[index].menuType == MenuType.MAIN) + { + Main.UpdateMenuTime(); + break; + } + } + if (!Main.isGameStarted) + break; + if (Main.netMode != 0 && Main.checkUserGeneratedContent) + { + Main.checkUserGeneratedContent = false; + UI.main.CheckUserGeneratedContent(); + } + if (Main.DiscoStyle == 0) + { + Main.DiscoRGB.Y += 0.02745098f; + if ((double) Main.DiscoRGB.Y >= 1.0) + { + Main.DiscoRGB.Y = 1f; + Main.DiscoStyle = 1; + } + Main.DiscoRGB.X -= 0.02745098f; + if ((double) Main.DiscoRGB.X < 0.0) + Main.DiscoRGB.X = 0.0f; + } + else if (Main.DiscoStyle == 1) + { + Main.DiscoRGB.Z += 0.02745098f; + if ((double) Main.DiscoRGB.Z >= 1.0) + { + Main.DiscoRGB.Z = 1f; + Main.DiscoStyle = 2; + } + Main.DiscoRGB.Y -= 0.02745098f; + if ((double) Main.DiscoRGB.Y < 0.0) + Main.DiscoRGB.Y = 0.0f; + } + else + { + Main.DiscoRGB.X += 0.02745098f; + if ((double) Main.DiscoRGB.X >= 1.0) + { + Main.DiscoRGB.X = 1f; + Main.DiscoStyle = 0; + } + Main.DiscoRGB.Z -= 0.02745098f; + if ((double) Main.DiscoRGB.Z < 0.0) + Main.DiscoRGB.Z = 0.0f; + } + if (((int) Main.frameCounter & 7) == 0 && ++Main.magmaBGFrame >= 3) + Main.magmaBGFrame = 0; + Main.demonTorch += Main.demonTorchDir; + if ((double) Main.demonTorch > 1.0) + { + Main.demonTorch = 1f; + Main.demonTorchDir = -Main.demonTorchDir; + } + else if ((double) Main.demonTorch < 0.0) + { + Main.demonTorch = 0.0f; + Main.demonTorchDir = -Main.demonTorchDir; + } + if (Main.netMode != 1) + { + WorldGen.UpdateWorld(); + Main.UpdateInvasion(); + } + Main.musicBox = -1; + for (int i = 0; i < 8; ++i) + { + if ((int) Main.player[i].active != 0) + Main.player[i].UpdatePlayer(i); + } + if (Main.netMode != 1 && Main.tutorialState >= Tutorial.THE_END) + NPC.SpawnNPC(); + for (int index = 0; index < 8; ++index) + { + Main.player[index].activeNPCs = 0.0f; + Main.player[index].townNPCs = 0.0f; + } + if (NPC.wof >= 0 && (int) Main.npc[NPC.wof].active == 0) + NPC.wof = -1; + for (int i = 195; i >= 0; --i) + { + if ((int) Main.npc[i].active != 0) + Main.npc[i].UpdateNPC(i); + } + for (int index = 0; index < 128; ++index) + { + if ((int) Main.gore[index].active != 0) + Main.gore[index].Update(); + } + for (int i = 0; i < 512; ++i) + { + if ((int) Main.projectile[i].active != 0) + Main.projectile[i].Update(i); + } + for (int i = 0; i < 200; ++i) + { + if ((int) Main.item[i].active != 0) + Main.item[i].UpdateItem(i); + } + CombatText.UpdateCombatText(); + Main.UpdateTime(); + break; + } + } + } + + private static void UpdateMenuTime() + { + Main.menuTime.update(); + if (Main.netMode != 1) + return; + Main.UpdateTime(); + } + + private void DrawSplash(GameTime dt) + { + this.GraphicsDevice.Clear(new Color()); + base.Draw(dt); + if ((int) this.splashCounter == (int) this.splashDelay + 16 + 16) + { + Main.splashTexture[(int) this.splashLogo].Dispose(); + Main.splashTexture[(int) this.splashLogo] = (Texture2D) null; + this.splashDelay = (short) 120; + this.splashCounter = (short) 0; + if ((int) ++this.splashLogo == 4) + { + Main.showSplash = (short) 1; + return; + } + } + ++this.splashCounter; + Main.spriteBatch.Begin(); + int num = (int) this.splashCounter >= 16 ? ((int) this.splashCounter > 16 + (int) this.splashDelay ? (int) byte.MaxValue - ((int) this.splashCounter - (int) this.splashDelay - 16) * (int) byte.MaxValue / 16 : (int) byte.MaxValue) : (int) this.splashCounter * (int) byte.MaxValue / 16; + Main.spriteBatch.Draw(Main.splashTexture[(int) this.splashLogo], new Vector2() + { + X = (float) (960 - Main.splashTexture[(int) this.splashLogo].Width >> 1), + Y = (float) (540 - Main.splashTexture[(int) this.splashLogo].Height >> 1) + }, new Color(num, num, num, num)); + Main.spriteBatch.End(); + } + + public void LoadUpsell() + { + if (!this.upsellLoaded) + { + this.upsellLoaded = true; + for (int index = 0; index < 1; ++index) + Main.splashTexture[index] = this.Content.Load(string.Concat(new object[4] + { + (object) "UI/Upsell/0", + (object) (index + 1), + (object) "_", + (object) Lang.languageId + })); + } + this.splashLogo = (short) 0; + this.splashCounter = (short) 0; + } + + public void DrawUpsell() + { + ++this.splashCounter; + int num = (int) this.splashCounter >= 16 ? (int) byte.MaxValue : (int) this.splashCounter * (int) byte.MaxValue / 16; + Main.spriteBatch.Draw(Main.splashTexture[(int) this.splashLogo], new Vector2() + { + X = (float) (960 - Main.splashTexture[(int) this.splashLogo].Width >> 1), + Y = (float) (540 - Main.splashTexture[(int) this.splashLogo].Height >> 1) + }, new Color(num, num, num, num)); + } + + protected override void Draw(GameTime dt) + { + if ((int) Main.showSplash == 0) + { + this.DrawSplash(dt); + } + else + { + ++Main.renderCount; + for (int index = 0; index < 4; ++index) + Main.ui[index].PrepareDraw(Main.renderCount); + if (Main.renderCount > 4) + { + Main.renderCount = 0; + Lighting.tempLightCount = 0; + } + this.GraphicsDevice.SetRenderTarget((RenderTarget2D) null); + this.GraphicsDevice.Clear(new Color()); + base.Draw(dt); + for (int index = 0; index < 4; ++index) + Main.ui[index].Draw(); + WorldView.restoreViewport(); + Main.spriteBatch.Begin(); + for (int index = 0; index < 4; ++index) + { + if (Main.ui[index].menuType != MenuType.MAIN) + { + Main.DrawChat(); + break; + } + } + if (Main.saveIconCounter > 0 || Main.activeSaves > 0) + { + --Main.saveIconCounter; + SpriteSheet<_sheetSprites>.Draw(642, 878, 479, Color.White, (float) Main.saveIconCounter * 0.05235988f, 1f); + } + Main.spriteBatch.End(); + } + } + + private static void UpdateInvasion() + { + if (Main.invasionType <= 0) + return; + if (Main.invasionSize <= 0) + { + if (Main.invasionType == 1) + { + NPC.downedGoblins = true; + UI.SetTriggerStateForAll(Trigger.KilledGoblinArmy); + NetMessage.CreateMessage0(7); + NetMessage.SendMessage(); + } + else if (Main.invasionType == 2) + NPC.downedFrost = true; + Main.InvasionWarning(); + Main.invasionType = 0; + Main.invasionDelay = 7; + } + if ((double) Main.invasionX == (double) Main.spawnTileX) + return; + float num = 1f; + if ((double) Main.invasionX > (double) Main.spawnTileX) + { + Main.invasionX -= num; + if ((double) Main.invasionX <= (double) Main.spawnTileX) + { + Main.invasionX = (float) Main.spawnTileX; + Main.InvasionWarning(); + } + else + --Main.invasionWarn; + } + else if ((double) Main.invasionX < (double) Main.spawnTileX) + { + Main.invasionX += num; + if ((double) Main.invasionX >= (double) Main.spawnTileX) + { + Main.invasionX = (float) Main.spawnTileX; + Main.InvasionWarning(); + } + else + --Main.invasionWarn; + } + if (Main.invasionWarn > 0) + return; + Main.invasionWarn = 3600; + Main.InvasionWarning(); + } + + private static void InvasionWarning() + { + NetMessage.SendText(Main.invasionSize > 0 ? ((double) Main.invasionX >= (double) Main.spawnTileX ? ((double) Main.invasionX <= (double) Main.spawnTileX ? (Main.invasionType != 2 ? 3 : 7) : (Main.invasionType != 2 ? 2 : 6)) : (Main.invasionType != 2 ? 1 : 5)) : (Main.invasionType != 2 ? 0 : 4), 175, 75, (int) byte.MaxValue, -1); + } + + public static void StartInvasion(int type = 1) + { + if (Main.invasionType != 0 || Main.invasionDelay != 0) + return; + int num = 0; + for (int index = 0; index < 8; ++index) + { + if ((int) Main.player[index].active != 0 && (int) Main.player[index].statLifeMax >= 200) + ++num; + } + if (num <= 0) + return; + Main.invasionType = type; + Main.invasionSize = 80 + 40 * num; + Main.invasionWarn = 0; + if (Main.rand.Next(2) == 0) + Main.invasionX = 0.0f; + else + Main.invasionX = (float) Main.maxTilesX; + } + + private static void UpdateClient() + { + if (Main.isGameStarted) + ++Main.netPlayCounter; + Netplay.session.Update(); + NetMessage.CheckBytesClient(); + } + + private static void UpdateServer() + { + if (Main.isGameStarted) + { + ++Main.netPlayCounter; + for (int index1 = Netplay.clients.Count - 1; index1 >= 0; --index1) + { + NetClient client = Netplay.clients[index1]; + for (int index2 = ((ReadOnlyCollection) client.machine.Gamers).Count - 1; index2 >= 0; --index2) + { + Player player = ((ReadOnlyCollection) client.machine.Gamers)[index2].Tag as Player; + if ((int) player.active != 0) + { + int sectionX = (player.aabb.X >> 4) / 40; + int sectionY = (player.aabb.Y >> 4) / 30; + NetMessage.SendSection(client, sectionX, sectionY); + if ((double) player.velocity.X > 0.0) + { + if (NetMessage.SendSection(client, sectionX + 1, sectionY) || NetMessage.SendSection(client, sectionX + 1, sectionY - 1) || (NetMessage.SendSection(client, sectionX + 1, sectionY + 1) || NetMessage.SendSection(client, sectionX + 2, sectionY)) || (NetMessage.SendSection(client, sectionX + 2, sectionY - 1) || !NetMessage.SendSection(client, sectionX + 2, sectionY + 1))) + ; + } + else if ((double) player.velocity.X < 0.0 && !NetMessage.SendSection(client, sectionX - 1, sectionY) && (!NetMessage.SendSection(client, sectionX - 1, sectionY - 1) && !NetMessage.SendSection(client, sectionX - 1, sectionY + 1)) && (!NetMessage.SendSection(client, sectionX - 2, sectionY) && !NetMessage.SendSection(client, sectionX - 2, sectionY - 1))) + NetMessage.SendSection(client, sectionX - 2, sectionY + 1); + if ((double) player.velocity.Y > 0.0) + { + if (NetMessage.SendSection(client, sectionX, sectionY + 1) || NetMessage.SendSection(client, sectionX + 1, sectionY + 1) || (NetMessage.SendSection(client, sectionX - 1, sectionY + 1) || NetMessage.SendSection(client, sectionX + 2, sectionY + 1)) || !NetMessage.SendSection(client, sectionX - 2, sectionY + 1)) + ; + } + else if ((double) player.velocity.Y < 0.0 && !NetMessage.SendSection(client, sectionX, sectionY - 1) && (!NetMessage.SendSection(client, sectionX + 1, sectionY - 1) && !NetMessage.SendSection(client, sectionX - 1, sectionY - 1)) && !NetMessage.SendSection(client, sectionX + 2, sectionY - 1)) + NetMessage.SendSection(client, sectionX - 2, sectionY - 1); + } + } + } + } + try + { + Netplay.session.Update(); + } + catch (Exception ex) + { + } + if (Main.netMode == 0) + { + Netplay.CheckOfflineSession(); + } + else + { + NetMessage.CheckBytesServer(); + using (GamerCollection.GamerCollectionEnumerator enumerator = Netplay.session.RemoteGamers.GetEnumerator()) + { + while (enumerator.MoveNext()) + { + NetworkGamer current = enumerator.Current; + Player player = current.Tag as Player; + if (player.kill) + { + player.kill = false; + player.active = (byte) 0; + current.Machine.RemoveFromSession(); + } + } + } + } + } + + public static void NewText(string newText, int R, int G, int B) + { + for (int index = 6; index > 0; --index) + Main.chatLine[index] = Main.chatLine[index - 1]; + Main.chatLine[0].color = new Color(R, G, B); + Main.chatLine[0].text = newText; + Main.chatLine[0].showTime = 600; + Main.PlaySound(12); + } + + public static void DrawChat() + { + int num1 = 0; + float num2 = 0.0f; + for (int index = 0; index < 7; ++index) + { + if (Main.chatLine[index].showTime > 0) + { + Vector2 vector2 = UI.fontSmallOutline.MeasureString(Main.chatLine[index].text); + if ((double) vector2.X > (double) num2) + num2 = vector2.X; + ++num1; + } + } + if (num1 == 0 || (double) num2 == 0.0) + return; + Main.DrawRect(new Rectangle(48, 440 - num1 * 22, (int) num2 + 12, num1 * 22 + 12), new Color(32, 32, 32, 32), true); + for (int index = 0; index < 7; ++index) + { + if (Main.chatLine[index].showTime > 0) + { + float num3 = (float) UI.mouseTextBrightness * 0.003921569f; + Main.spriteBatch.DrawString(UI.fontSmallOutline, Main.chatLine[index].text, new Vector2(54f, (float) (439 - (index + 1) * 22)), new Color((int) (byte) ((double) Main.chatLine[index].color.R * (double) num3), (int) (byte) ((double) Main.chatLine[index].color.G * (double) num3), (int) (byte) ((double) Main.chatLine[index].color.B * (double) num3), (int) UI.mouseTextBrightness)); + } + } + } + + private static void UpdateTime() + { + bool wasBloodMoon = Main.gameTime.bloodMoon; + if (Main.gameTime.update()) + { + WorldGen.spawnNPC = 0; + NPC.checkForSpawnsTimer = (short) 0; + if (Main.gameTime.dayTime) + { + Time.checkXMas(); + if (Main.invasionDelay > 0) + --Main.invasionDelay; + if (Main.netMode != 1) + { + if (WorldGen.shadowOrbSmashed && Main.rand.Next(NPC.downedGoblins ? 15 : 3) == 0) + Main.StartInvasion(1); + for (int index = 0; index < 8; ++index) + { + if ((int) Main.player[index].active != 0) + Main.player[index].SunMoonTransition(wasBloodMoon); + } + } + } + else if (Main.netMode != 1) + { + if (WorldGen.shadowOrbSmashed && Main.rand.Next(50) == 0) + WorldGen.spawnMeteor = true; + if (!NPC.downedBoss1) + { + for (int index1 = 0; index1 < 8; ++index1) + { + if ((int) Main.player[index1].active != 0 && (int) Main.player[index1].statLifeMax >= 200 && (int) Main.player[index1].statDefense > 10) + { + if (Main.rand.Next(3) == 0) + { + int num = 0; + for (int index2 = 0; index2 < 196; ++index2) + { + if (Main.npc[index2].townNPC && (int) Main.npc[index2].active != 0 && ++num >= 4) + { + WorldGen.spawnEye = true; + NetMessage.SendText(9, 50, (int) byte.MaxValue, 130, -1); + break; + } + } + break; + } + else + break; + } + } + } + if (!WorldGen.spawnEye && (int) Main.gameTime.moonPhase != 4 && Main.rand.Next(9) == 0) + { + for (int index = 0; index < 8; ++index) + { + if ((int) Main.player[index].active != 0 && (int) Main.player[index].statLifeMax > 120) + { + Main.gameTime.bloodMoon = true; + NetMessage.SendText(8, 50, (int) byte.MaxValue, 130, -1); + break; + } + } + } + for (int index = 0; index < 8; ++index) + { + if ((int) Main.player[index].active != 0) + Main.player[index].SunMoonTransition(false); + } + } + if (Main.netMode != 2) + return; + NetMessage.CreateMessage0(7); + NetMessage.SendMessage(); + } + else if (Main.gameTime.dayTime) + { + if (Main.netMode == 1) + return; + NPC.checkForTownSpawns(); + } + else if ((double) Main.gameTime.time > 16200.0) + { + if (!WorldGen.spawnMeteor) + return; + WorldGen.spawnMeteor = false; + WorldGen.dropMeteor(); + } + else + { + if ((double) Main.gameTime.time <= 4860.0 || !WorldGen.spawnEye || Main.netMode == 1) + return; + for (int index = 0; index < 8; ++index) + { + Player p = Main.player[index]; + if ((int) p.active != 0 && !p.dead && p.aabb.Y < Main.worldSurfacePixels) + { + NPC.SpawnOnPlayer(p, 4); + WorldGen.spawnEye = false; + break; + } + } + } + } + + public static int DamageVar(int dmg) + { + return (int) Math.Round((double) dmg * (1.0 + (double) Main.rand.Next(-15, 16) * 0.01)); + } + + public static double CalculateDamage(int Damage, int Defense) + { + double num = (double) Damage - (double) Defense * 0.5; + if (num < 1.0) + num = 1.0; + return num; + } + + public static void PlaySound(int type, int x, int y, int style = 1) + { + if ((double) Main.soundVolume == 0.0) + return; + try + { + float num1 = Main.soundVolume; + float num2 = 0.0f; + bool flag; + if (UI.numActiveViews > 1) + { + flag = WorldView.AnyViewContains(x, y); + } + else + { + flag = new Rectangle() + { + X = (UI.current.view.screenPosition.X - 960), + Y = (UI.current.view.screenPosition.Y - 540), + Width = 2880, + Height = 1620 + }.Contains(x, y); + if (flag) + { + Vector2 vector2 = new Vector2((float) (UI.current.view.screenPosition.X + 480), (float) (UI.current.view.screenPosition.Y + 270)); + float num3 = Math.Abs((float) x - vector2.X); + float num4 = Math.Abs((float) y - vector2.Y); + float num5 = (float) (1.0 - Math.Sqrt((double) num3 * (double) num3 + (double) num4 * (double) num4) * (1.0 / 640.0)); + if ((double) num5 > 1.0) + num5 = 1f; + num1 = num5 * Main.soundVolume; + if ((double) num1 <= 0.0) + return; + num2 = (float) (((double) x - (double) vector2.X) * 0.000520833360496908); + if ((double) num2 < -1.0) + num2 = -1f; + else if ((double) num2 > 1.0) + num2 = 1f; + } + } + if (!flag) + return; + if (type == 0) + { + int index = Main.rand.Next(3); + Main.soundDig[index].Play((double) num1, (double) num2, (double) Main.rand.Next(-10, 11) * 0.01); + } + else if (type == 1) + { + int index = Main.rand.Next(3); + Main.soundPlayerHit[index].Play((double) num1, (double) num2, 0.0); + } + else if (type == 2) + { + if (style == 1) + { + int num3 = Main.rand.Next(3); + if (num3 != 0) + style = num3 + 17; + } + double volume = (double) num1; + double pitch; + if (style == 26 || style == 35) + { + volume *= 0.75; + pitch = (double) Main.harpNote; + } + else + pitch = (double) Main.rand.Next(-6, 7) * 0.01; + Main.soundItem[style - 1].Play(volume, (double) num2, pitch); + } + else if (type == 3) + Main.soundNPCHit[style - 1].Play((double) num1, (double) num2, (double) Main.rand.Next(-10, 11) * 0.01); + else if (type == 4) + { + if (style == 10 && Main.soundNPCKilled[style - 1].IsPlaying()) + return; + Main.soundNPCKilled[style - 1].Play((double) num1, (double) num2, (double) Main.rand.Next(-10, 11) * 0.01); + } + else if (type == 5) + Main.soundPlayerKilled.Play((double) num1, (double) num2, 0.0); + else if (type == 6) + Main.soundGrass.Play((double) num1, (double) num2, (double) Main.rand.Next(-30, 31) * 0.01); + else if (type == 7) + Main.soundGrab.Play((double) num1, (double) num2, (double) Main.rand.Next(-10, 11) * 0.01); + else if (type == 8) + Main.soundDoorOpen.Play((double) num1, (double) num2, (double) Main.rand.Next(-20, 21) * 0.01); + else if (type == 9) + Main.soundDoorClosed.Play((double) num1, (double) num2, (double) Main.rand.Next(-20, 21) * 0.01); + else if (type == 13) + Main.soundShatter.Play((double) num1, (double) num2, 0.0); + else if (type == 14) + { + int index = Main.rand.Next(3); + Main.soundZombie[index].Play((double) num1 * 0.4, (double) num2, 0.0); + } + else if (type == 15) + { + if (Main.soundRoar[style].IsPlaying()) + return; + Main.soundRoar[style].Play((double) num1, (double) num2, 0.0); + } + else if (type == 16) + Main.soundDoubleJump.Play((double) num1, (double) num2, (double) Main.rand.Next(-10, 11) * 0.01); + else if (type == 17) + Main.soundRun.Play((double) num1, (double) num2, (double) Main.rand.Next(-10, 11) * 0.01); + else if (type == 19) + Main.soundSplash[style].Play((double) num1, (double) num2, (double) Main.rand.Next(-10, 11) * 0.01); + else if (type == 20) + { + int index = Main.rand.Next(3); + Main.soundFemaleHit[index].Play((double) num1, (double) num2, 0.0); + } + else if (type == 21) + { + int index = Main.rand.Next(3); + Main.soundTink[index].Play((double) num1, (double) num2, 0.0); + } + else if (type == 22) + Main.soundUnlock.Play((double) num1, (double) num2, 0.0); + else if (type == 26) + { + int index = Main.rand.Next(3, 5); + Main.soundZombie[index].Play((double) num1 * 0.9, (double) num2, (double) Main.rand.Next(-10, 11) * 0.01); + } + else if (type == 27) + { + Main.soundPixie.UpdateOrPlay((double) num1, (double) num2, (double) Main.rand.Next(-10, 11) * 0.01); + } + else + { + if (type != 28 || Main.soundMech.IsPlaying()) + return; + Main.soundMech.Play((double) num1, (double) num2, (double) Main.rand.Next(-10, 11) * 0.00999999977648258); + } + } + catch + { + } + } + + public static void PlaySound(int type) + { + if ((double) Main.soundVolume == 0.0) + return; + try + { + float num = Main.soundVolume; + switch (type) + { + case 1: + int index1 = Main.rand.Next(3); + Main.soundPlayerHit[index1].Play((double) num, 0.0, 0.0); + break; + case 7: + Main.soundGrab.Play((double) num, 0.0, (double) Main.rand.Next(-10, 11) * 0.01); + break; + case 10: + Main.soundMenuOpen.Play((double) num, 0.0, 0.0); + break; + case 11: + Main.soundMenuClose.Play((double) num, 0.0, 0.0); + break; + case 12: + Main.soundMenuTick.Play((double) num, 0.0, 0.0); + break; + case 18: + Main.soundCoins.Play((double) num, 0.0, 0.0); + break; + case 20: + int index2 = Main.rand.Next(3); + Main.soundFemaleHit[index2].Play((double) num, 0.0, 0.0); + break; + case 23: + Main.soundDrown.Play((double) num, 0.0, 0.0); + break; + case 24: + Main.soundChat.Play((double) num, 0.0, 0.0); + break; + case 25: + Main.soundMaxMana.Play((double) num, 0.0, 0.0); + break; + } + } + catch + { + } + } + + private static void UpdateTutorial() + { + if (UI.main.menuType != MenuType.NONE) + return; + if (Main.tutorialInputDelay > 0) + --Main.tutorialInputDelay; + Vector2 leftThumbStick = Main.TutorialMaskLS ? new Vector2() : UI.main.gpState.ThumbSticks.Left; + Vector2 rightThumbStick = Main.TutorialMaskRS ? new Vector2() : UI.main.gpState.ThumbSticks.Right; + float leftTrigger = Main.TutorialMaskLT ? 0.0f : UI.main.gpState.Triggers.Left; + float rightTrigger = Main.TutorialMaskRT ? 0.0f : UI.main.gpState.Triggers.Right; + Buttons buttons = (Buttons) 0; + if (!Main.TutorialMaskA && UI.main.gpState.IsButtonDown(Buttons.A)) + buttons |= Buttons.A; + if (!Main.TutorialMaskB && UI.main.gpState.IsButtonDown(Buttons.B)) + buttons |= Buttons.B; + if (!Main.TutorialMaskX && UI.main.gpState.IsButtonDown(Buttons.X)) + buttons |= Buttons.X; + if (!Main.TutorialMaskY && UI.main.gpState.IsButtonDown(Buttons.Y)) + buttons |= Buttons.Y; + if (!Main.TutorialMaskBack && UI.main.gpState.IsButtonDown(Buttons.Back)) + buttons |= Buttons.Back; + if (!Main.TutorialMaskLB && UI.main.gpState.IsButtonDown(Buttons.LeftShoulder)) + buttons |= Buttons.LeftShoulder; + if (!Main.TutorialMaskRB && UI.main.gpState.IsButtonDown(Buttons.RightShoulder)) + buttons |= Buttons.RightShoulder; + if (!Main.TutorialMaskLS && UI.main.gpState.IsButtonDown(Buttons.DPadLeft)) + buttons |= Buttons.DPadLeft; + if (!Main.TutorialMaskLS && UI.main.gpState.IsButtonDown(Buttons.DPadRight)) + buttons |= Buttons.DPadRight; + if (!Main.TutorialMaskLS && UI.main.gpState.IsButtonDown(Buttons.DPadUp)) + buttons |= Buttons.DPadUp; + if (!Main.TutorialMaskLS && UI.main.gpState.IsButtonDown(Buttons.DPadDown)) + buttons |= Buttons.DPadDown; + if (!Main.TutorialMaskLS && UI.main.gpState.IsButtonDown(Buttons.LeftStick)) + buttons |= Buttons.LeftStick; + if (!Main.TutorialMaskRSpress && UI.main.gpState.IsButtonDown(Buttons.RightStick)) + buttons |= Buttons.RightStick; + if (UI.main.gpState.IsButtonDown(Buttons.Start)) + buttons |= Buttons.Start; + UI.main.gpState = new GamePadState(leftThumbStick, rightThumbStick, leftTrigger, rightTrigger, new Buttons[1] + { + buttons + }); + switch (Main.tutorialState) + { + case Tutorial.BACK_WALL_INFO_1: + case Tutorial.HOUSE_INFO_1: + case Tutorial.HOUSE_DONE_1: + case Tutorial.THE_GUIDE_1: + case Tutorial.HAMMER_1: + case Tutorial.CONGRATS_1: + case Tutorial.MINED_ORE_1: + case Tutorial.CURSOR_SWITCH_1: + case Tutorial.DAY_NIGHT_1: + case Tutorial.USE_BENCH_1: + case Tutorial.INVENTORY_2: + case Tutorial.MOVEMENT_1: + case Tutorial.DROP_1: + case Tutorial.EQUIPSCREEN_1: + case Tutorial.CHEST_1: + case Tutorial.CRAFTSCREEN_1: + case Tutorial.INTRO: + case Tutorial.MONSTER_INFO_1: + case Tutorial.POTIONS_1: + case Tutorial.TORCH_1: + if (Main.tutorialInputDelay == 0) + { + Main.NextTutorial(1); + break; + } + else + break; + } + switch (Main.tutorialState) + { + case Tutorial.BACK_WALL_INFO_2: + case Tutorial.HOUSE_INFO_2: + case Tutorial.HOUSE_DONE_2: + case Tutorial.THE_GUIDE_2: + case Tutorial.HAMMER_2: + case Tutorial.CONGRATS_2: + case Tutorial.MINED_ORE_2: + case Tutorial.CURSOR_SWITCH_2: + case Tutorial.DAY_NIGHT_2: + case Tutorial.USE_BENCH_2: + case Tutorial.INVENTORY_3: + case Tutorial.MOVEMENT_2: + case Tutorial.DROP_2: + case Tutorial.EQUIPSCREEN_2: + case Tutorial.CHEST_2: + case Tutorial.CRAFTSCREEN_2: + case Tutorial.INTRO_2: + case Tutorial.MONSTER_INFO_2: + case Tutorial.POTIONS_2: + case Tutorial.TORCH_2: + if (!UI.main.IsButtonTriggered(Buttons.B)) + break; + UI.main.ClearButtonTriggers(); + Main.TutorialMaskB = (int) Main.tutorialVar != 0; + Main.NextTutorial(1); + break; + default: + Player player = UI.main.player; + switch (Main.tutorialState) + { + case Tutorial.MOVE: + if ((double) UI.main.gpState.ThumbSticks.Left.LengthSquared() > 1.0 / 64.0) + ++Main.tutorialVar; + if (Main.tutorialVar <= 4U || Main.tutorialInputDelay != 0) + return; + UI.main.AchievementTriggers.SetState(Trigger.FirstTutorialTaskCompleted, true); + Main.NextTutorial(1); + return; + case Tutorial.JUMP: + if (UI.main.totalJumps - Main.tutorialVar < 1U) + return; + Main.NextTutorial(1); + return; + case Tutorial.FALL_DOWN: + if (!player.controlDown) + return; + int index1 = (int) player.position.X + 10 >> 4; + int num1 = (int) player.position.Y + 42 >> 4; + if ((int) Main.tile[index1, num1 - 1].type != 19 && (int) Main.tile[index1 - 1, num1 - 1].type != 19 && (int) Main.tile[index1 + 1, num1 - 1].type != 19) + return; + Main.NextTutorial(1); + return; + case Tutorial.JUMP_OUT: + if (UI.main.totalJumps - Main.tutorialVar < 1U) + return; + int index2 = (int) player.position.X + 10 >> 4; + int num2 = (int) player.position.Y + 42 >> 4; + if ((int) Main.tile[index2, num2 + 1].type != 19 && (int) Main.tile[index2 - 1, num2 + 1].type != 19 && (int) Main.tile[index2 + 1, num2 + 1].type != 19) + return; + Main.NextTutorial(1); + return; + case Tutorial.CURSOR: + if ((double) UI.main.gpState.ThumbSticks.Right.LengthSquared() > 1.0 / 64.0) + ++Main.tutorialVar; + if (UI.main.IsButtonTriggered(Buttons.RightTrigger)) + ++Main.tutorialVar2; + if (Main.tutorialInputDelay != 0 || Main.tutorialVar <= 0U || Main.tutorialVar2 <= 0U) + return; + Main.NextTutorial(1); + return; + case Tutorial.HOTBAR: + if (Main.tutorialInputDelay != 0 || (int) player.selectedItem != 0) + return; + Main.NextTutorial(1); + return; + case Tutorial.SWORD_ATTACK: + if (UI.main.totalSlimes > Main.tutorialVar) + { + Item.NewItem((int) player.position.X, (int) player.position.Y, 1, 1, 23, 1, false, 0); + Main.NextTutorial(1); + return; + } + else + { + if (Main.tutorialVar2 <= 0U || (int) --Main.tutorialVar2 != 0) + return; + Main.tutorialVar2 = 900U; + int index3 = NPC.NewNPC(player.aabb.X - 480, player.aabb.Y - 540, 1, 0); + Main.npc[index3].SetDefaults("Green Slime"); + return; + } + case Tutorial.MONSTER_INFO_1: + return; + case Tutorial.MONSTER_INFO_2: + return; + case Tutorial.POTIONS_1: + return; + case Tutorial.POTIONS_2: + return; + case Tutorial.TORCH_1: + return; + case Tutorial.TORCH_2: + return; + case Tutorial.SELECT_AXE: + if (Main.tutorialInputDelay != 0 || (int) player.inventory[(int) player.selectedItem].axe <= 0) + return; + Main.NextTutorial(1); + return; + case Tutorial.USE_AXE: + if (UI.main.totalChops <= Main.tutorialVar) + return; + Main.NextTutorial(1); + return; + case Tutorial.INVENTORY: + if ((int) UI.main.inventoryMode != 1) + return; + Main.NextTutorial(1); + return; + case Tutorial.INVENTORY_2: + return; + case Tutorial.INVENTORY_3: + return; + case Tutorial.MOVEMENT_1: + return; + case Tutorial.MOVEMENT_2: + return; + case Tutorial.DROP_1: + return; + case Tutorial.DROP_2: + return; + case Tutorial.EQUIPMENT: + if (UI.main.inventorySection != UI.InventorySection.EQUIP) + return; + Main.NextTutorial(1); + return; + case Tutorial.EQUIPSCREEN_1: + return; + case Tutorial.EQUIPSCREEN_2: + return; + case Tutorial.CHEST_1: + return; + case Tutorial.CHEST_2: + return; + case Tutorial.CRAFTING: + if (UI.main.inventorySection != UI.InventorySection.CRAFTING) + return; + Main.NextTutorial(1); + return; + case Tutorial.CRAFT_TORCH: + if (UI.main.totalTorchesCrafted <= Main.tutorialVar) + return; + Main.NextTutorial(1); + return; + case Tutorial.CRAFTSCREEN_1: + return; + case Tutorial.CRAFTSCREEN_2: + return; + case Tutorial.CRAFT_CATEGORIES: + if (UI.main.IsButtonTriggered(Buttons.LeftTrigger) || UI.main.IsButtonTriggered(Buttons.RightTrigger)) + ++Main.tutorialVar; + if (Main.tutorialVar <= 0U || Main.tutorialInputDelay != 0) + return; + Main.NextTutorial(1); + return; + case Tutorial.CRAFTING_EXIT: + if ((int) UI.main.inventoryMode != 0) + return; + Main.NextTutorial(1); + return; + case Tutorial.SELECT_PICK: + if (Main.tutorialInputDelay != 0 || (int) player.inventory[(int) player.selectedItem].pick <= 0) + return; + Main.NextTutorial(1); + return; + case Tutorial.USE_PICK: + if (UI.main.totalCopper - Main.tutorialVar < 55U) + return; + Main.NextTutorial(1); + return; + case Tutorial.MINED_ORE_1: + return; + case Tutorial.MINED_ORE_2: + return; + case Tutorial.WOOD_PLATFORM: + if (UI.main.totalWoodPlatformsCrafted - Main.tutorialVar >= 5U) + { + Main.NextTutorial(2); + return; + } + else + { + if ((int) --Main.tutorialVar2 != 0) + return; + Main.NextTutorial(1); + return; + } + case Tutorial.WOOD_PLATFORM_TIME_OUT: + if (UI.main.totalWoodPlatformsCrafted - Main.tutorialVar < 5U) + return; + Main.NextTutorial(1); + return; + case Tutorial.SELECT_PLATFORM: + if (Main.tutorialInputDelay != 0 || (int) player.inventory[(int) player.selectedItem].type != 94) + return; + Main.NextTutorial(1); + return; + case Tutorial.BUILD_CURSOR: + if (Main.tutorialInputDelay != 0 || UI.main.smartCursor) + return; + Main.TutorialMaskRSpress = true; + Main.NextTutorial(1); + return; + case Tutorial.PLACING_1: + if (UI.main.totalWoodPlatformsPlaced <= Main.tutorialVar) + return; + Main.NextTutorial(1); + return; + case Tutorial.PLACING_2: + if (player.aabb.Y >= 3360) + return; + Main.NextTutorial(1); + return; + case Tutorial.CURSOR_SWITCH_1: + return; + case Tutorial.CURSOR_SWITCH_2: + return; + case Tutorial.DAY_NIGHT_1: + return; + case Tutorial.DAY_NIGHT_2: + return; + case Tutorial.BUILD_HOUSE: + if (Main.tutorialInputDelay == 0) + { + Main.NextTutorial(1); + goto case Tutorial.BUILD_HOUSE_EXTRA_INFO; + } + else + goto case Tutorial.BUILD_HOUSE_EXTRA_INFO; + case Tutorial.BUILD_HOUSE_EXTRA_INFO: + if (((int) Main.frameCounter & 31) != 0) + return; + int x = (int) UI.main.mouseX + UI.main.view.screenPosition.X >> 4; + int y = (int) UI.main.mouseY + UI.main.view.screenPosition.Y >> 4; + bool flag = WorldGen.StartSpaceCheck(x, y); + if (!flag) + { + --x; + flag = WorldGen.StartSpaceCheck(x, y); + if (!flag) + { + x += 2; + flag = WorldGen.StartSpaceCheck(x, y); + } + if (!flag) + { + --x; + ++y; + flag = WorldGen.StartSpaceCheck(x, y); + } + } + if (!flag) + return; + Main.tutorialHouse.X = (short) x; + Main.tutorialHouse.Y = (short) y; + Main.NextTutorial(Main.tutorialState == Tutorial.BUILD_HOUSE ? 2 : 1); + return; + case Tutorial.BUILD_HOUSE_2: + if (Main.tutorialInputDelay == 0) + { + Main.NextTutorial(1); + goto case Tutorial.BUILD_HOUSE_2_EXTRA_INFO; + } + else + goto case Tutorial.BUILD_HOUSE_2_EXTRA_INFO; + case Tutorial.BUILD_HOUSE_2_EXTRA_INFO: + if (((int) Main.frameCounter & 31) != 0 || UI.main.totalAxed - Main.tutorialVar < 3U && UI.main.totalPicked - Main.tutorialVar2 < 3U || WorldGen.StartSpaceCheck((int) Main.tutorialHouse.X, (int) Main.tutorialHouse.Y)) + return; + Main.NextTutorial(Main.tutorialState == Tutorial.BUILD_HOUSE_2 ? 2 : 1); + return; + case Tutorial.CRAFT_WORKBENCH: + case Tutorial.CRAFT_WORKBENCH_EXTRA_INFO: + if (((int) Main.frameCounter & 31) != 0) + return; + int num3 = (int) player.position.X + 10 >> 4; + int num4 = ((int) player.position.Y + 42 >> 4) - 1; + for (int index3 = num3 - 5; index3 < num3 + 5; ++index3) + { + for (int index4 = num4 - 5; index4 < num4 + 5; ++index4) + { + if ((int) Main.tile[index3, index4].type == 18) + { + Main.NextTutorial(Main.tutorialState == Tutorial.CRAFT_WORKBENCH ? 2 : 1); + return; + } + } + } + return; + case Tutorial.USE_BENCH_1: + return; + case Tutorial.USE_BENCH_2: + return; + case Tutorial.CRAFT_DOOR: + case Tutorial.CRAFT_DOOR_EXTRA_INFO: + if (Main.tutorialInputDelay != 0 || !player.hasItemInInventory(25)) + return; + Main.NextTutorial(Main.tutorialState == Tutorial.CRAFT_DOOR ? 2 : 1); + return; + case Tutorial.PLACE_DOOR: + if (((int) Main.frameCounter & 31) != 0 || !WorldGen.StartSpaceCheck((int) Main.tutorialHouse.X, (int) Main.tutorialHouse.Y) || !WorldGen.houseTile[10] && !WorldGen.houseTile[11]) + return; + Main.NextTutorial(1); + return; + case Tutorial.USE_DOOR: + if (Main.tutorialInputDelay != 0 || UI.main.totalDoorsOpened <= Main.tutorialVar && UI.main.totalDoorsClosed <= Main.tutorialVar2) + return; + Main.NextTutorial(1); + return; + case Tutorial.BACK_WALL_INFO_1: + return; + case Tutorial.BACK_WALL_INFO_2: + return; + case Tutorial.CRAFT_WALL: + case Tutorial.CRAFT_WALL_EXTRA_INFO: + if (Main.tutorialInputDelay != 0 || UI.main.totalWallsCrafted - Main.tutorialVar < 32U) + return; + Main.NextTutorial(Main.tutorialState == Tutorial.CRAFT_WALL ? 2 : 1); + return; + case Tutorial.PLACE_WALL: + if (Main.tutorialInputDelay != 0 || UI.main.totalWallsPlaced - Main.tutorialVar < 8U) + return; + Main.NextTutorial(1); + return; + case Tutorial.BACK_WALL: + if (((int) Main.frameCounter & 31) != 0 || !WorldGen.StartRoomCheck((int) Main.tutorialHouse.X, (int) Main.tutorialHouse.Y)) + return; + Main.NextTutorial(1); + return; + case Tutorial.HOUSE_INFO_1: + return; + case Tutorial.HOUSE_INFO_2: + return; + case Tutorial.PLACE_CHAIR: + if (((int) Main.frameCounter & 31) != 0 || !WorldGen.StartRoomCheck((int) Main.tutorialHouse.X, (int) Main.tutorialHouse.Y)) + return; + WorldGen.RoomNeeds(); + if (!WorldGen.roomChair) + return; + Main.NextTutorial(1); + return; + case Tutorial.PLACE_TORCH: + if (((int) Main.frameCounter & 31) != 0 || !WorldGen.StartRoomCheck((int) Main.tutorialHouse.X, (int) Main.tutorialHouse.Y) || !WorldGen.RoomNeeds()) + return; + Main.NextTutorial(1); + return; + default: + return; + } + } + } + + private static void NextTutorial(int steps = 1) + { + if (Main.tutorialState >= Tutorial.THE_END) + return; + Main.SetTutorial(Main.tutorialState + steps); + } + + public static void SetTutorial(Tutorial t) + { + Main.tutorialState = t; + if (t == Tutorial.NUM_TUTORIALS) + { + Main.TutorialMaskLS = false; + Main.TutorialMaskRS = false; + Main.TutorialMaskRSpress = false; + Main.TutorialMaskA = false; + Main.TutorialMaskB = false; + Main.TutorialMaskX = false; + Main.TutorialMaskY = false; + Main.TutorialMaskLB = false; + Main.TutorialMaskRB = false; + Main.TutorialMaskLT = false; + Main.TutorialMaskRT = false; + Main.TutorialMaskBack = false; + } + else + { + Main.tutorialInputDelay = 180; + string text = Lang.tutorial(t); + Player player = UI.main.player; + switch (t) + { + case Tutorial.INTRO: + Main.TutorialMaskLS = true; + Main.TutorialMaskRS = true; + Main.TutorialMaskRSpress = true; + Main.TutorialMaskA = true; + Main.TutorialMaskB = true; + Main.TutorialMaskX = true; + Main.TutorialMaskY = true; + Main.TutorialMaskLB = true; + Main.TutorialMaskRB = true; + Main.TutorialMaskLT = true; + Main.TutorialMaskRT = true; + Main.TutorialMaskBack = true; + UI.main.smartCursor = true; + break; + case Tutorial.INTRO_2: + case Tutorial.MONSTER_INFO_2: + case Tutorial.POTIONS_2: + case Tutorial.TORCH_2: + case Tutorial.INVENTORY_3: + case Tutorial.MOVEMENT_2: + case Tutorial.DROP_2: + case Tutorial.EQUIPSCREEN_2: + case Tutorial.CHEST_2: + case Tutorial.CRAFTSCREEN_2: + case Tutorial.MINED_ORE_2: + case Tutorial.CURSOR_SWITCH_2: + case Tutorial.DAY_NIGHT_2: + case Tutorial.USE_BENCH_2: + case Tutorial.BACK_WALL_INFO_2: + case Tutorial.HOUSE_INFO_2: + case Tutorial.HOUSE_DONE_2: + case Tutorial.THE_GUIDE_2: + case Tutorial.HAMMER_2: + case Tutorial.CONGRATS_2: + text = Lang.tutorial(t - 1) + text; + Main.tutorialVar = Main.TutorialMaskB ? 1U : 0U; + Main.TutorialMaskB = false; + break; + case Tutorial.MOVE: + Main.TutorialMaskLS = false; + Main.tutorialVar = 0U; + break; + case Tutorial.JUMP: + Main.TutorialMaskA = false; + Main.tutorialVar = UI.main.totalJumps; + break; + case Tutorial.JUMP_OUT: + Main.tutorialVar = UI.main.totalJumps; + break; + case Tutorial.CURSOR: + Main.TutorialMaskRT = false; + Main.TutorialMaskRS = false; + Main.tutorialVar = 0U; + Main.tutorialVar2 = 0U; + break; + case Tutorial.HOTBAR: + Main.TutorialMaskLB = false; + Main.TutorialMaskRB = false; + break; + case Tutorial.SWORD_ATTACK: + Main.tutorialVar = UI.main.totalSlimes; + Main.tutorialVar2 = 120U; + break; + case Tutorial.MONSTER_INFO_1: + for (int index = 195; index >= 0; --index) + { + if ((int) Main.npc[index].type == 1 && (int) Main.npc[index].active != 0) + { + Main.npc[index].HitEffect(0, 999.0); + Main.npc[index].active = (byte) 0; + } + } + break; + case Tutorial.USE_AXE: + Main.tutorialVar = UI.main.totalChops; + break; + case Tutorial.INVENTORY: + Main.TutorialMaskY = false; + Main.TutorialMaskB = true; + break; + case Tutorial.INVENTORY_2: + Main.TutorialMaskLB = true; + Main.TutorialMaskRB = true; + break; + case Tutorial.EQUIPMENT: + Main.TutorialMaskRB = false; + Main.TutorialMaskLB = false; + Main.TutorialMaskRT = false; + Main.TutorialMaskLT = false; + break; + case Tutorial.CRAFT_TORCH: + Main.TutorialMaskX = false; + Main.tutorialVar = UI.main.totalTorchesCrafted; + break; + case Tutorial.CRAFT_CATEGORIES: + Main.tutorialVar = 0U; + break; + case Tutorial.CRAFTING_EXIT: + Main.TutorialMaskB = false; + break; + case Tutorial.USE_PICK: + Main.tutorialVar = UI.main.totalCopper; + break; + case Tutorial.WOOD_PLATFORM: + Main.tutorialVar = UI.main.totalWoodPlatformsCrafted; + Main.tutorialVar2 = 600U; + break; + case Tutorial.BUILD_CURSOR: + Main.TutorialMaskRSpress = false; + break; + case Tutorial.PLACING_1: + Main.tutorialVar = UI.main.totalWoodPlatformsPlaced; + break; + case Tutorial.PLACING_2: + text = Lang.tutorial(t - 1) + text; + break; + case Tutorial.CURSOR_SWITCH_1: + Main.TutorialMaskRSpress = false; + break; + case Tutorial.BUILD_HOUSE: + Main.tutorialInputDelay = 1800; + break; + case Tutorial.BUILD_HOUSE_EXTRA_INFO: + case Tutorial.BUILD_HOUSE_2_EXTRA_INFO: + text = Lang.tutorial(t - 1) + text; + break; + case Tutorial.BUILD_HOUSE_2: + Main.tutorialVar = UI.main.totalAxed; + Main.tutorialVar2 = UI.main.totalPicked; + Main.tutorialInputDelay = 600; + break; + case Tutorial.CRAFT_WORKBENCH: + if (player.CountInventory(9) < 10) + { + Main.tutorialState = t + 1; + text = text + Lang.tutorial(Main.tutorialState); + break; + } + else + break; + case Tutorial.CRAFT_DOOR: + if (player.CountInventory(9) < 6) + { + Main.tutorialState = t + 1; + text = text + Lang.tutorial(Main.tutorialState); + break; + } + else + break; + case Tutorial.USE_DOOR: + Main.tutorialVar = UI.main.totalDoorsOpened; + Main.tutorialVar2 = UI.main.totalDoorsClosed; + break; + case Tutorial.CRAFT_WALL: + Main.tutorialVar = UI.main.totalWallsCrafted; + if (player.CountInventory(9) < 6) + { + Main.tutorialState = t + 1; + text = text + Lang.tutorial(Main.tutorialState); + break; + } + else + break; + case Tutorial.PLACE_WALL: + Main.tutorialVar = UI.main.totalWallsPlaced; + break; + case Tutorial.THE_END: + Main.gameTime.dayRate = 1f; + UI.main.AchievementTriggers.SetState(Trigger.AllTutorialTasksCompleted, true); + break; + } + if (text != null) + Main.tutorialText = new CompiledText(text, 470, UI.styleFontSmallOutline, CompiledText.MarkupType.Html); + else + Main.tutorialText = (CompiledText) null; + } + } + + public static bool IsTutorial() + { + return Main.tutorialState != Tutorial.NUM_TUTORIALS; + } + + public static void StartTutorial() + { + Player player = new Player(); + player.name = UI.main.signedInGamer.Gamertag; + player.selectedItem = (sbyte) 1; + UI.main.createCharacterGUI.Randomize(player); + UI.main.setPlayer(player); + Main.SetTutorial(Tutorial.INTRO); + WorldGen.playWorld(); + } + + public static void StartGame() + { + UI ui = UI.main; + Main.PlaySound(11); + for (int index = 0; index < 7; ++index) + Main.chatLine[index].Init(); + for (int index = 0; index < 8; ++index) + { + if (index != (int) ui.myPlayer) + Main.player[index].active = (byte) 0; + Main.player[index].announced = false; + } + if (Main.IsTutorial()) + GamerPresenceExtensions.SetPresenceModeString(UI.main.signedInGamer.Presence, "Tutorial"); + else if (ui.isOnline) + { + Main.netMode = 2; + GamerPresenceExtensions.SetPresenceModeString(ui.signedInGamer.Presence, "Online"); + } + else + GamerPresenceExtensions.SetPresenceModeString(ui.signedInGamer.Presence, "Offline"); + Netplay.StartServer(); + Main.musicBox = -1; + Main.gameTime = WorldGen.tempTime; + ui.InitGame(); + Netplay.sessionReadyEvent.WaitOne(); + ui.player.Spawn(); + ui.menuType = MenuType.NONE; + ui.view.onStartGame(); + MiniMap.onStartGame(); + GC.Collect(); + Main.isGameStarted = true; + } + + public static void JoinGame(UI startUI) + { + GamerPresenceExtensions.SetPresenceModeString(startUI.signedInGamer.Presence, Main.netMode == 0 ? "Offline" : "Online"); + Main.PlaySound(11); + startUI.InitGame(); + startUI.player.Spawn(); + if (Main.netMode == 2) + NetMessage.syncPlayer((int) startUI.myPlayer); + startUI.menuType = MenuType.NONE; + startUI.view.onStartGame(); + MiniMap.onStartGame(); + Main.isGameStarted = true; + } + + public static void DrawSolidRect(Rectangle rect, Color color) + { + Main.spriteBatch.Draw(Main.whiteTexture, rect, color); + } + + public static void DrawSolidRect(ref Rectangle rect, Color color) + { + Main.spriteBatch.Draw(Main.whiteTexture, rect, color); + } + + public static void DrawRect(int texId, Rectangle rect, int alpha, int shift = 0) + { + Rectangle s = new Rectangle(); + Rectangle dest = rect; + Vector2 pos = new Vector2(); + Color c = new Color(alpha >> shift, alpha >> shift, alpha >> shift, alpha); + s.X = s.Y = 8; + s.Width = s.Height = 36; + pos.X = (float) (rect.X - 8); + pos.Y = (float) (rect.Y - 8); + SpriteSheet<_sheetSprites>.DrawStretched(texId, s, ref dest, c); + s.X = 9; + s.Y = 0; + s.Width = 34; + s.Height = 8; + dest.Y -= 8; + dest.Height = 8; + SpriteSheet<_sheetSprites>.DrawStretched(texId, s, ref dest, c); + s.Y = 44; + dest.Y = rect.Y + rect.Height; + SpriteSheet<_sheetSprites>.DrawStretched(texId, s, ref dest, c); + s.Width = 8; + s.Y = 0; + s.X = 0; + SpriteSheet<_sheetSprites>.Draw(texId, ref pos, ref s, c); + s.Y = 44; + pos.Y = (float) (rect.Y + rect.Height); + SpriteSheet<_sheetSprites>.Draw(texId, ref pos, ref s, c); + pos.X = (float) (rect.X + rect.Width); + s.X = 44; + s.Y = 44; + SpriteSheet<_sheetSprites>.Draw(texId, ref pos, ref s, c); + pos.Y = (float) (rect.Y - 8); + s.Y = 0; + SpriteSheet<_sheetSprites>.Draw(texId, ref pos, ref s, c); + s.Height = 34; + s.Y = 9; + dest.Width = 8; + dest.Height = rect.Height; + dest.X += rect.Width; + dest.Y = rect.Y; + SpriteSheet<_sheetSprites>.DrawStretched(texId, s, ref dest, c); + s.X = 0; + dest.X = rect.X - 8; + SpriteSheet<_sheetSprites>.DrawStretched(texId, s, ref dest, c); + } + + public static void DrawRectStraightBottom(int texId, Rectangle rect, int alpha, int shift = 0) + { + Rectangle s = new Rectangle(); + Rectangle dest = rect; + Vector2 pos = new Vector2(); + Color c = new Color(alpha >> shift, alpha >> shift, alpha >> shift, alpha); + s.X = s.Y = 8; + s.Width = s.Height = 36; + pos.X = (float) (rect.X - 8); + pos.Y = (float) (rect.Y - 8); + dest.Height += 7; + SpriteSheet<_sheetSprites>.DrawStretched(texId, s, ref dest, c); + s.X = 9; + s.Y = 0; + s.Width = 34; + s.Height = 8; + dest.Y -= 8; + dest.Height = 8; + SpriteSheet<_sheetSprites>.DrawStretched(texId, s, ref dest, c); + s.Y = 51; + s.Height = 1; + dest.X -= 7; + dest.Y = rect.Y + rect.Height + 7; + dest.Width += 14; + dest.Height = 1; + SpriteSheet<_sheetSprites>.DrawStretched(texId, s, ref dest, c); + s.Width = 8; + s.Height = 8; + s.Y = 0; + s.X = 0; + SpriteSheet<_sheetSprites>.Draw(texId, ref pos, ref s, c); + pos.X = (float) (rect.X + rect.Width); + pos.Y = (float) (rect.Y - 8); + s.X = 44; + s.Y = 0; + SpriteSheet<_sheetSprites>.Draw(texId, ref pos, ref s, c); + s.Height = 34; + s.Y = 9; + dest.Width = 8; + dest.Height = rect.Height + 8; + dest.X = rect.X + rect.Width; + dest.Y = rect.Y; + SpriteSheet<_sheetSprites>.DrawStretched(texId, s, ref dest, c); + s.X = 0; + dest.X = rect.X - 8; + SpriteSheet<_sheetSprites>.DrawStretched(texId, s, ref dest, c); + } + + public static void DrawRectOpenAtBottom(int texId, Rectangle rect, int alpha, int shift = 0) + { + Rectangle s = new Rectangle(); + Rectangle dest = rect; + Vector2 pos = new Vector2(); + Color c = new Color(alpha >> shift, alpha >> shift, alpha >> shift, alpha); + s.X = s.Y = 8; + s.Width = 36; + s.Height = 36; + dest.Height += 8; + pos.X = (float) (rect.X - 8); + pos.Y = (float) (rect.Y - 8); + SpriteSheet<_sheetSprites>.DrawStretched(texId, s, ref dest, c); + s.X = 9; + s.Y = 0; + s.Width = 34; + s.Height = 8; + dest.Y -= 8; + dest.Height = 8; + SpriteSheet<_sheetSprites>.DrawStretched(texId, s, ref dest, c); + s.Width = 8; + s.Y = 0; + s.X = 0; + SpriteSheet<_sheetSprites>.Draw(texId, ref pos, ref s, c); + pos.X = (float) (rect.X + rect.Width); + pos.Y = (float) (rect.Y - 8); + s.X = 44; + s.Y = 0; + SpriteSheet<_sheetSprites>.Draw(texId, ref pos, ref s, c); + s.Height = 34; + s.Y = 9; + dest.Width = 8; + dest.Height = rect.Height + 8; + dest.X += rect.Width; + dest.Y = rect.Y; + SpriteSheet<_sheetSprites>.DrawStretched(texId, s, ref dest, c); + s.X = 0; + dest.X = rect.X - 8; + SpriteSheet<_sheetSprites>.DrawStretched(texId, s, ref dest, c); + } + + public static void DrawRectOpenAtTop(int texId, Rectangle rect, int alpha, int shift = 0) + { + Rectangle s = new Rectangle(); + Rectangle dest = rect; + Vector2 pos = new Vector2(); + Color c = new Color(alpha >> shift, alpha >> shift, alpha >> shift, alpha); + s.X = s.Y = 8; + s.Width = s.Height = 36; + pos.X = (float) (rect.X - 8); + pos.Y = (float) (rect.Y - 8); + SpriteSheet<_sheetSprites>.DrawStretched(texId, s, ref dest, c); + s.X = 9; + s.Width = 34; + s.Height = 8; + dest.Height = 8; + s.Y = 44; + dest.Y = rect.Y + rect.Height; + SpriteSheet<_sheetSprites>.DrawStretched(texId, s, ref dest, c); + s.Width = 8; + s.X = 0; + s.Y = 44; + pos.Y = (float) (rect.Y + rect.Height); + SpriteSheet<_sheetSprites>.Draw(texId, ref pos, ref s, c); + pos.X = (float) (rect.X + rect.Width); + s.X = 44; + s.Y = 44; + SpriteSheet<_sheetSprites>.Draw(texId, ref pos, ref s, c); + s.Height = 34; + s.Y = 9; + dest.Width = 8; + dest.Height = rect.Height; + dest.X += rect.Width; + dest.Y = rect.Y; + SpriteSheet<_sheetSprites>.DrawStretched(texId, s, ref dest, c); + s.X = 0; + dest.X = rect.X - 8; + SpriteSheet<_sheetSprites>.DrawStretched(texId, s, ref dest, c); + } + + public static void DrawRect(Rectangle rect, Color color, bool center = true) + { + rect.X += 2; + rect.Y += 2; + rect.Width -= 4; + rect.Height -= 4; + if (center) + { + Main.spriteBatch.Draw(Main.whiteTexture, rect, color); + color.A >>= 3; + } + Rectangle destinationRectangle = rect; + destinationRectangle.Y -= 2; + destinationRectangle.Height = 2; + Main.spriteBatch.Draw(Main.whiteTexture, destinationRectangle, color); + destinationRectangle.X -= 2; + destinationRectangle.Y += 2; + destinationRectangle.Height = rect.Height; + destinationRectangle.Width = 2; + Main.spriteBatch.Draw(Main.whiteTexture, destinationRectangle, color); + destinationRectangle.X += rect.Width + 2; + Main.spriteBatch.Draw(Main.whiteTexture, destinationRectangle, color); + destinationRectangle.X = rect.X; + destinationRectangle.Y += rect.Height; + destinationRectangle.Width = rect.Width; + destinationRectangle.Height = 2; + Main.spriteBatch.Draw(Main.whiteTexture, destinationRectangle, color); + } + + public static void ShowSaveIcon() + { + if (Main.saveIconCounter <= 0) + Main.saveIconCounter = 180; + ++Main.activeSaves; + } + + public static void HideSaveIcon() + { + --Main.activeSaves; + } + + public static bool IsSaveIconVisible() + { + if (Main.saveIconCounter <= 0) + return Main.activeSaves > 0; + else + return true; + } + + private void Quit() + { + Netplay.disconnect = true; + this.Exit(); + } + + private static void SignedInGamer_SignedIn(object sender, SignedInEventArgs e) + { + SignedInGamer gamer = e.Gamer; + Main.isTrial = Guide.IsTrialMode; + Main.checkUserGeneratedContent = true; + } + + private static void SignedInGamer_SignedOut(object sender, SignedOutEventArgs e) + { + PlayerIndex playerIndex = e.Gamer.PlayerIndex; + Main.ui[(int) playerIndex].SignOut(); + } + + public enum Music : byte + { + MUSIC_1 = (byte) 0, + MUSIC_2 = (byte) 1, + MUSIC_3 = (byte) 2, + MUSIC_4 = (byte) 3, + MUSIC_5 = (byte) 4, + MUSIC_6 = (byte) 5, + MUSIC_7 = (byte) 6, + MUSIC_8 = (byte) 7, + MUSIC_9 = (byte) 8, + MUSIC_10 = (byte) 9, + MUSIC_11 = (byte) 10, + MUSIC_12 = (byte) 11, + MUSIC_13 = (byte) 12, + DESERT = (byte) 13, + FLOATING_ISLAND = (byte) 14, + TUTORIAL = (byte) 15, + BOSS4 = (byte) 16, + OCEAN = (byte) 17, + SNOW = (byte) 18, + NONE = (byte) 19, + NUM_SONGS = (byte) 19, + } + } +} diff --git a/Terraria/Mech.cs b/Terraria/Mech.cs new file mode 100644 index 0000000..b6a7092 --- /dev/null +++ b/Terraria/Mech.cs @@ -0,0 +1,14 @@ +// Type: Terraria.Mech +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +namespace Terraria +{ + internal struct Mech + { + public short X; + public short Y; + public int Time; + } +} diff --git a/Terraria/MenuMode.cs b/Terraria/MenuMode.cs new file mode 100644 index 0000000..a6c05e7 --- /dev/null +++ b/Terraria/MenuMode.cs @@ -0,0 +1,50 @@ +// Type: Terraria.MenuMode +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +namespace Terraria +{ + public enum MenuMode : byte + { + NONE, + PAUSE, + BLACKLIST, + BLACKLIST_REMOVE, + MAP, + WELCOME, + TITLE, + CHARACTER_SELECT, + CREATE_CHARACTER, + CONFIRM_LEAVE_CREATE_CHARACTER, + NAME_CHARACTER, + CONFIRM_DELETE_CHARACTER, + WORLD_SELECT, + GAME_MODE, + WORLD_SIZE, + NAME_WORLD, + CONFIRM_DELETE_WORLD, + STATUS_SCREEN, + WAITING_SCREEN, + WAITING_FOR_PLAYER_ID, + WAITING_FOR_PUBLIC_SLOT, + OPTIONS, + CONTROLS, + SETTINGS, + VOLUME, + NETPLAY, + ERROR, + LOAD_FAILED_NO_BACKUP, + LEADERBOARDS, + HOW_TO_PLAY, + SHOW_SIGN_IN, + SIGN_IN, + SIGN_IN_FAILED, + CREDITS, + EXIT, + EXIT_UGC_BLOCKED, + QUIT, + UPSELL, + NUM_MENUS, + } +} diff --git a/Terraria/MenuType.cs b/Terraria/MenuType.cs new file mode 100644 index 0000000..4506f32 --- /dev/null +++ b/Terraria/MenuType.cs @@ -0,0 +1,14 @@ +// Type: Terraria.MenuType +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +namespace Terraria +{ + public enum MenuType : byte + { + MAIN, + NONE, + PAUSE, + } +} diff --git a/Terraria/MessageBox.cs b/Terraria/MessageBox.cs new file mode 100644 index 0000000..d0eb64a --- /dev/null +++ b/Terraria/MessageBox.cs @@ -0,0 +1,139 @@ +// Type: Terraria.MessageBox +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.GamerServices; +using System; +using System.Collections.Generic; + +namespace Terraria +{ + public static class MessageBox + { + public static IAsyncResult mbResult = (IAsyncResult) null; + private static List queue = new List(); + public static MessageBox.Message current; + public static int? choice; + + static MessageBox() + { + MessageBox.current.playerIndex = (sbyte) -1; + } + + public static void Show(PlayerIndex controller, string caption, string contents, string[] options, bool autoUpdate = true) + { + lock (MessageBox.queue) + { + MessageBox.Message local_0; + local_0.autoUpdate = autoUpdate; + local_0.playerIndex = (sbyte) controller; + local_0.caption = caption; + local_0.contents = contents; + local_0.options = options; + if ((int) MessageBox.current.playerIndex < 0) + { + MessageBox.current = local_0; + } + else + { + if (!(MessageBox.current.contents != contents)) + return; + for (int local_1 = MessageBox.queue.Count - 1; local_1 >= 0; --local_1) + { + if (contents == MessageBox.queue[local_1].contents) + return; + } + MessageBox.queue.Add(local_0); + } + } + } + + private static void NextMessage() + { + if (MessageBox.queue.Count > 0) + { + MessageBox.current = MessageBox.queue[0]; + MessageBox.queue.RemoveAt(0); + } + else + { + MessageBox.current.autoUpdate = false; + MessageBox.current.playerIndex = (sbyte) -1; + } + } + + public static bool IsVisible() + { + return (int) MessageBox.current.playerIndex >= 0; + } + + public static bool IsAutoUpdate() + { + return MessageBox.current.autoUpdate; + } + + public static bool Update() + { + if ((int) MessageBox.current.playerIndex >= 0) + { + lock (MessageBox.queue) + { + if (!Guide.IsVisible) + { + try + { + MessageBox.mbResult = Guide.BeginShowMessageBox((PlayerIndex) MessageBox.current.playerIndex, MessageBox.current.caption, MessageBox.current.contents, (IEnumerable) MessageBox.current.options, 0, MessageBoxIcon.None, (AsyncCallback) null, (object) null); + } + catch (GuideAlreadyVisibleException exception_0) + { + } + } + else if (MessageBox.mbResult != null) + { + if (MessageBox.mbResult.IsCompleted) + { + MessageBox.choice = Guide.EndShowMessageBox(MessageBox.mbResult); + MessageBox.mbResult = (IAsyncResult) null; + MessageBox.NextMessage(); + return true; + } + } + } + } + return false; + } + + public static int GetResult() + { + if (!MessageBox.choice.HasValue) + return -1; + else + return MessageBox.choice.Value; + } + + public static void RemoveMessagesFor(PlayerIndex controller) + { + while ((PlayerIndex) MessageBox.current.playerIndex == controller) + { + if (MessageBox.mbResult == null) + MessageBox.NextMessage(); + } + for (int index = MessageBox.queue.Count - 1; index >= 0; --index) + { + if ((PlayerIndex) MessageBox.queue[index].playerIndex == controller) + MessageBox.queue.RemoveAt(index); + } + } + + public struct Message + { + public bool autoUpdate; + public sbyte playerIndex; + public string caption; + public string contents; + public string[] options; + } + } +} diff --git a/Terraria/MiniMap.cs b/Terraria/MiniMap.cs new file mode 100644 index 0000000..1fdac98 --- /dev/null +++ b/Terraria/MiniMap.cs @@ -0,0 +1,595 @@ +// Type: Terraria.MiniMap +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Threading; + +namespace Terraria +{ + public sealed class MiniMap + { + private static readonly uint[] WallColors = new uint[32] + { + 0U, + 4282532418U, + 4283972910U, + 4281410885U, + 4283051548U, + 4282729797U, + 4283432960U, + 4278190176U, + 4278210560U, + 4282908751U, + 4286007047U, + 4286743170U, + 4282325255U, + 4282320647U, + 4278190176U, + 4278211840U, + 4283972910U, + 4278190147U, + 4278204160U, + 4281532471U, + 4278190176U, + 4279378988U, + 4285621091U, + 4283318338U, + 4282396723U, + 4278919998U, + 4282145594U, + 4282001693U, + 4283520101U, + 4289331200U, + 4278233600U, + 4288256443U + }; + private static readonly uint[] TileColors = new uint[150] + { + 4287720015U, + 4286611584U, + 4280080478U, + 4279067940U, + 4294786563U, + 4284696113U, + 4285225294U, + 4291188253U, + 4290356247U, + 4292468703U, + 4278255602U, + 4278255602U, + 4294901760U, + 4278255602U, + 4278255602U, + 4278255602U, + 4278255602U, + 4278255602U, + 4278255602U, + 4285217304U, + 4279067940U, + 4292720640U, + 4284637095U, + 4287465951U, + 4287465951U, + 4283124354U, + 4287627519U, + 4291100436U, + 4287375142U, + 4278255602U, + 4285024564U, + 4278190080U, + 4286210447U, + 4294786563U, + 4294786563U, + 4294786563U, + 4294786563U, + 4292845449U, + 4287664272U, + 4289855743U, + 4289485645U, + 4283716760U, + 4293890123U, + 4281968721U, + 4289855743U, + 4294956308U, + 4293256677U, + 4294924544U, + 4285361517U, + 4281044991U, + 4278255602U, + uint.MaxValue, + 4279067940U, + 4294957624U, + 1090519039U, + 4294946398U, + 4283912621U, + 4282664012U, + 4284883490U, + 4284236873U, + 4287616797U, + 4287616797U, + 4287286812U, + 4280976122U, + 4280976122U, + 4280976122U, + 4280976122U, + 4280976122U, + 4280976122U, + 4284362807U, + 4284317695U, + 4289834627U, + 4288057198U, + 4279067940U, + 4279067940U, + 4289855743U, + 4291166237U, + 4292149264U, + 4278255602U, + 4278255602U, + 4278232320U, + 4293219136U, + 4294932480U, + 4294932480U, + 4294932480U, + 4290822336U, + 4294902015U, + 4278255602U, + 4278255602U, + 4278255602U, + 4278255602U, + 4278255602U, + 4278255602U, + 4278255602U, + 4278255602U, + 4278255602U, + 4278255602U, + 4294902015U, + 4294902015U, + 4294901968U, + 4294902015U, + 4294902015U, + 4294902015U, + 4294902015U, + 4294902015U, + 4278255602U, + 4278255602U, + 4278931599U, + 4284197289U, + 4283351523U, + 4280194632U, + 4286585396U, + 4284965498U, + 4280194632U, + 4286536773U, + 4281499553U, + 4292199621U, + 4290096318U, + 4292199621U, + 4282335049U, + 4288051837U, + 4280645291U, + 4287741813U, + 4284044115U, + 4284236854U, + 4286686719U, + 4292598747U, + 4285051848U, + 4287653968U, + 4278208889U, + 4289045925U, + 4279900698U, + 4291363587U, + 4287172626U, + 4288065159U, + 4294799986U, + 4291608768U, + 4287401100U, + 4284703587U, + 4288242499U, + 4286084531U, + 4289536803U, + 4291363587U, + 4291363587U, + 4291363587U, + 4294901760U, + 4278255360U, + 4293848831U, + 4291611886U, + 4294901760U + }; + private float mapScale = 1f; + private short mapDestH = (short) 486; + private const int SCROLL_SPEED = 8; + private const float SCALE_SPEED = 0.05f; + private const float MIN_SCALE = 1f; + private const float MAX_SCALE = 4f; + private const int MAP_OFFSET_X = 290; + private const int MAP_OFFSET_X_SPLITSCREEN = 340; + private const int MAP_TEXTURE_SLICES = 4; + private static short width; + private static short height; + private static short texWidth; + private short mapX; + private short mapY; + public volatile bool isThreadDone; + private int alpha; + private Texture2D[] mapTexture; + + static MiniMap() + { + } + + public static void onStartGame() + { + MiniMap.width = (short) ((int) Main.maxTilesX - 68); + MiniMap.height = (short) ((int) Main.maxTilesY - 68); + MiniMap.texWidth = (short) ((int) MiniMap.width / 4); + } + + public void UpdateMap(UI ui) + { + int num1 = ui.view.SAFE_AREA_OFFSET_L + (UI.numActiveViews > 1 ? 340 : 290); + int num2 = (int) ui.view.viewWidth - ui.view.SAFE_AREA_OFFSET_R - num1; + int num3 = (int) Main.maxTilesX; + int num4 = (int) Main.maxTilesY; + if (ui.IsAlternateLeftButtonDown()) + this.mapX -= (short) 8; + if (ui.IsAlternateRightButtonDown()) + this.mapX += (short) 8; + if (ui.IsAlternateUpButtonDown()) + this.mapY -= (short) 8; + if (ui.IsAlternateDownButtonDown()) + this.mapY += (short) 8; + float left = ui.gpState.Triggers.Left; + if ((double) left > 0.125) + { + this.mapScale -= 0.05f * left; + if ((double) this.mapScale < 1.0) + this.mapScale = 1f; + } + float right = ui.gpState.Triggers.Right; + if ((double) right > 0.125) + { + this.mapScale += 0.05f * right; + if ((double) this.mapScale > 4.0) + this.mapScale = 4f; + } + int num5 = (int) ((double) num2 * (1.0 / (double) this.mapScale - 1.0) * 0.5); + int num6 = (int) MiniMap.width - num2 - num5; + if ((int) this.mapX < num5) + this.mapX = (short) num5; + else if ((int) this.mapX > num6) + this.mapX = (short) num6; + int num7 = (int) ((double) this.mapDestH * (1.0 / (double) this.mapScale - 1.0) * 0.5); + int num8 = (int) MiniMap.height - (int) this.mapDestH - num7; + if ((int) this.mapY < num7) + { + this.mapY = (short) num7; + } + else + { + if ((int) this.mapY <= num8) + return; + this.mapY = (short) num8; + } + } + + public void CreateMap(UI ui) + { + if (this.isThreadDone) + this.DestroyMap(); + this.alpha = 0; + this.mapTexture = new Texture2D[4]; + for (int index = 3; index >= 0; --index) + this.mapTexture[index] = new Texture2D(WorldView.graphicsDevice, (int) MiniMap.texWidth, (int) MiniMap.height, false, SurfaceFormat.Bgr565); + new Thread(new ParameterizedThreadStart(this.CreateMapThread)) + { + IsBackground = true + }.Start((object) ui); + } + + public unsafe void CreateMapThread(object arg) + { + Thread.CurrentThread.SetProcessorAffinity(new int[1] + { + 4 + }); + UI ui = (UI) arg; + int length = (int) MiniMap.texWidth * (int) MiniMap.height; + ushort[] data = new ushort[length]; + sbyte[] numArray1 = new sbyte[(int) MiniMap.height]; + sbyte[] numArray2 = new sbyte[(int) MiniMap.width]; + Player player = ui.player; + for (int index1 = 3; index1 >= 0; --index1) + { + fixed (ushort* numPtr1 = &data[length - 1]) + { + ushort* numPtr2 = numPtr1; + for (int index2 = (int) MiniMap.height - 1; index2 >= 0; --index2) + { + int num1 = (int) MiniMap.texWidth - 1; + int index3 = num1 + index1 * (int) MiniMap.texWidth; + while (num1 >= 0) + { + fixed (Tile* tilePtr = &Main.tile[index3 + 34, index2 + 34]) + { + if ((tilePtr->flags & Tile.Flags.VISITED) == ~(Tile.Flags.WALLFRAME_MASK | Tile.Flags.HIGHLIGHT_MASK | Tile.Flags.VISITED | Tile.Flags.WIRE | Tile.Flags.CHECKING_LIQUID | Tile.Flags.SKIP_LIQUID)) + { + if ((int) numArray1[index2] > 0) + --numArray1[index2]; + if ((int) numArray2[index3] > 0) + --numArray2[index3]; + } + else + { + if ((int) numArray1[index2] < 4) + ++numArray1[index2]; + if ((int) numArray2[index3] < 4) + ++numArray2[index3]; + } + if ((int) numArray1[index2] <= 0 && (int) numArray2[index3] <= 0) + { + *numPtr2 = (ushort) 0; + } + else + { + int num2 = (int) numArray1[index2] >= (int) numArray2[index3] ? ((int) numArray1[index2] <= (int) numArray2[index3] ? (int) numArray1[index2] * (int) numArray1[index2] + (int) numArray2[index3] * (int) numArray2[index3] : (int) numArray1[index2] * (int) numArray1[index2] + ((int) numArray2[index3] + 1) * 4) : ((int) numArray1[index2] + 1) * 4 + (int) numArray2[index3] * (int) numArray2[index3]; + uint num3; + uint num4; + uint num5; + uint num6; + if ((int) tilePtr->active != 0) + { + num3 = MiniMap.TileColors[(int) tilePtr->type]; + } + else + { + int index4 = (int) tilePtr->wall; + if (index4 == 0) + { + if (index2 < Main.worldSurface) + { + num4 = (uint) ((index2 >> 1) * (int) ui.view.time.bgColor.R / Main.worldSurface); + num5 = (uint) index2 * (uint) ui.view.time.bgColor.G / (uint) (int) ((double) Main.worldSurface * 1.20000004768372); + num6 = (uint) ((index2 << 1) * (int) ui.view.time.bgColor.B / Main.worldSurface); + if (num6 > (uint) byte.MaxValue) + { + num6 = (uint) byte.MaxValue; + goto label_27; + } + else + goto label_27; + } + else if (index2 < Main.rockLayer) + { + num4 = 84U; + num5 = 57U; + num6 = 42U; + goto label_27; + } + else if (index2 >= (int) Main.maxTilesY - 200) + { + num4 = 51U; + num5 = 0U; + num6 = 0U; + goto label_27; + } + else + { + num4 = 72U; + num5 = 64U; + num6 = 57U; + goto label_27; + } + } + else + num3 = MiniMap.WallColors[index4]; + } + num6 = num3 & (uint) byte.MaxValue; + num5 = num3 >> 8 & (uint) byte.MaxValue; + num4 = num3 >> 16 & (uint) byte.MaxValue; +label_27: + uint num7 = (uint) tilePtr->liquid; + if (num7 > 0U) + { + if ((int) tilePtr->lava == 32) + { + num4 = (num4 * ((uint) byte.MaxValue - num7) >> 8) + num7; + num6 >>= 1; + } + else + { + num4 >>= 1; + num6 = (num6 * ((uint) byte.MaxValue - num7) >> 8) + num7; + } + num5 >>= 1; + } + if (num2 < 32) + { + num4 = (uint) ((ulong) num4 * (ulong) num2) >> 5; + num5 = (uint) ((ulong) num5 * (ulong) num2) >> 5; + num6 = (uint) ((ulong) num6 * (ulong) num2) >> 5; + } + *numPtr2 = (ushort) ((uint) ((int) (num4 >> 3) << 11 | (int) (num5 >> 2) << 5) | num6 >> 3); + } + --numPtr2; + } + --num1; + --index3; + } + } + } + this.mapTexture[index1].SetData(data); + } + int num8 = ui.view.SAFE_AREA_OFFSET_L + (UI.numActiveViews > 1 ? 340 : 290); + int num9 = (int) ui.view.viewWidth - ui.view.SAFE_AREA_OFFSET_R - num8; + int num10 = (int) MiniMap.width - num9; + int num11 = (int) MiniMap.height - (int) this.mapDestH; + this.mapX = (short) ((player.aabb.X >> 4) - 34 - (num9 >> 1)); + if ((int) this.mapX < 0) + this.mapX = (short) 0; + else if ((int) this.mapX > num10) + this.mapX = (short) num10; + this.mapY = (short) ((player.aabb.Y >> 4) - 34 - ((int) this.mapDestH >> 1)); + if ((int) this.mapY < 0) + this.mapY = (short) 0; + else if ((int) this.mapY > num11) + this.mapY = (short) num11; + this.isThreadDone = true; + } + + public void DestroyMap() + { + this.isThreadDone = false; + if (this.mapTexture == null) + return; + for (int index = 0; index < 4; ++index) + { + this.mapTexture[index].Dispose(); + this.mapTexture[index] = (Texture2D) null; + } + this.mapTexture = (Texture2D[]) null; + } + + public void DrawMap(WorldView view) + { + int num1 = view.SAFE_AREA_OFFSET_L + (UI.numActiveViews > 1 ? 340 : 290); + int num2 = view.SAFE_AREA_OFFSET_T; + this.mapDestH = (short) (540 - view.SAFE_AREA_OFFSET_T - view.SAFE_AREA_OFFSET_B - 36); + int val1 = (int) view.viewWidth - view.SAFE_AREA_OFFSET_R - num1; + if (!this.isThreadDone) + { + Main.spriteBatch.Begin(SpriteSortMode.Deferred, (BlendState) null, (SamplerState) null, (DepthStencilState) null, (RasterizerState) null, (Effect) view.screenProjection); + SpriteSheet<_sheetSprites>.Draw(1012, num1 + (val1 >> 1), num2 + ((int) this.mapDestH >> 1), Color.White, (float) Main.frameCounter * 0.1047198f, 1f); + } + else + { + this.alpha += 16; + if (this.alpha > (int) byte.MaxValue) + this.alpha = (int) byte.MaxValue; + int num3 = num1 + (val1 >> 1); + int num4 = num2 + ((int) this.mapDestH >> 1); + Matrix matrix1 = Matrix.CreateTranslation((float) -num3, (float) -num4, 0.0f) * Matrix.CreateScale(this.mapScale, this.mapScale, 1f) * Matrix.CreateTranslation((float) num3, (float) num4, 0.0f); + view.screenProjection.View = matrix1; + Rectangle rectangle = new Rectangle(); + if (view.isFullScreen()) + { + rectangle.X = num1; + rectangle.Y = num2; + rectangle.Width = val1; + rectangle.Height = (int) this.mapDestH; + } + else + { + rectangle.X = (num1 >> 1) + view.activeViewport.X; + rectangle.Y = (num2 >> 1) + view.activeViewport.Y; + rectangle.Width = val1 >> 1; + rectangle.Height = (int) this.mapDestH >> 1; + } + WorldView.graphicsDevice.ScissorRectangle = rectangle; + Main.spriteBatch.Begin(SpriteSortMode.Deferred, (BlendState) null, (SamplerState) null, (DepthStencilState) null, WorldView.scissorTest, (Effect) view.screenProjection); + int num5 = (int) this.mapX / (int) MiniMap.texWidth; + int num6 = ((int) this.mapX + val1 - 1) / (int) MiniMap.texWidth; + if (num6 >= this.mapTexture.Length) + num6 = this.mapTexture.Length - 1; + Vector2 vector2_1 = new Vector2((float) num1, (float) num2); + Rectangle rect = new Rectangle(); + rect.X = (int) this.mapX - num5 * (int) MiniMap.texWidth; + rect.Y = (int) this.mapY; + rect.Width = Math.Min(val1, (int) MiniMap.texWidth - rect.X); + rect.Height = (int) this.mapDestH; + Color c = new Color(this.alpha, this.alpha, this.alpha, this.alpha); + for (int index = num5; index <= num6; ++index) + { + Main.spriteBatch.Draw(this.mapTexture[index], vector2_1, new Rectangle?(rect), c); + vector2_1.X += (float) rect.Width; + rect.X = 0; + rect.Width = (int) MiniMap.texWidth; + } + switch (Main.magmaBGFrame) + { + case 0: + rect.X = 659; + rect.Y = 10; + break; + case 1: + rect.X = 659; + rect.Y = 0; + break; + default: + rect.X = 759; + rect.Y = 10; + break; + } + rect.Width = 10; + rect.Height = 10; + for (int index1 = 195; index1 >= 0; --index1) + { + NPC npc = Main.npc[index1]; + if ((int) npc.active != 0) + { + int index2 = npc.aabb.X >> 4; + int index3 = npc.aabb.Y >> 4; + if (index2 >= 0 && index3 >= 0 && (index2 < (int) Main.maxTilesX && index3 < (int) Main.maxTilesY) && (Main.tile[index2, index3].flags & Tile.Flags.VISITED) == Tile.Flags.VISITED) + { + int num7 = index2 - (34 + (int) this.mapX); + if (num7 >= 0 && num7 + 4 < val1) + { + int num8 = index3 - (34 + (int) this.mapY); + if (num8 >= 0 && num8 + 4 < (int) this.mapDestH) + { + int headTextureId = npc.getHeadTextureId(); + if (headTextureId < 0) + { + c = new Color(106, 0, 66, (int) sbyte.MaxValue); + c.R = (byte) ((int) c.R * (int) UI.cursorColor.A >> 8); + c.G = (byte) ((int) c.G * (int) UI.cursorColor.A >> 8); + c.B = (byte) ((int) c.B * (int) UI.cursorColor.A >> 8); + c.A = (byte) ((int) c.A * (int) UI.cursorColor.A >> 8); + SpriteSheet<_sheetSprites>.DrawCentered(218, num1 + num7, num2 + num8, rect, c); + } + else + SpriteSheet<_sheetSprites>.DrawScaled(1255 + headTextureId, num1 + num7, num2 + num8, 0.5f, new Color(248, 248, 248, 248), (int) npc.spriteDirection < 0 ? SpriteEffects.None : SpriteEffects.FlipHorizontally); + } + } + } + } + } + Main.spriteBatch.End(); + Matrix world = view.screenProjection.World; + float num9 = (float) (11.0 / 16.0 + 1.0 / 16.0 * Math.Sin((double) Main.frameCounter * (1.0 / 12.0))); + Matrix matrix2 = Matrix.CreateTranslation(-10f, -8f, 0.0f) * Matrix.CreateScale(num9, num9, 1f); + for (int index1 = 7; index1 >= 0; --index1) + { + Player player = Main.player[index1]; + if ((int) player.active != 0 && !player.dead) + { + int index2 = player.aabb.X >> 4; + int index3 = player.aabb.Y >> 4; + if ((Main.tile[index2, index3].flags & Tile.Flags.VISITED) != ~(Tile.Flags.WALLFRAME_MASK | Tile.Flags.HIGHLIGHT_MASK | Tile.Flags.VISITED | Tile.Flags.WIRE | Tile.Flags.CHECKING_LIQUID | Tile.Flags.SKIP_LIQUID)) + { + int num7 = index2 - (34 + (int) this.mapX); + int num8 = index3 - (34 + (int) this.mapY); + Vector2 vector2_2 = player.position; + player.position.X = (float) view.screenPosition.X; + player.position.Y = (float) view.screenPosition.Y; + view.screenProjection.World = matrix2 * Matrix.CreateTranslation((float) (num1 + num7), (float) (num2 + num8), 0.0f); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, (BlendState) null, (SamplerState) null, (DepthStencilState) null, WorldView.scissorTest, (Effect) view.screenProjection); + player.Draw(view, true, true); + Main.spriteBatch.End(); + player.position = vector2_2; + player.aabb.X = (int) vector2_2.X; + player.aabb.Y = (int) vector2_2.Y; + } + } + } + view.screenProjection.World = world; + view.screenProjection.View = Matrix.Identity; + Main.spriteBatch.Begin(SpriteSortMode.Deferred, (BlendState) null, (SamplerState) null, (DepthStencilState) null, (RasterizerState) null, (Effect) view.screenProjection); + } + } + } +} diff --git a/Terraria/NPC.cs b/Terraria/NPC.cs new file mode 100644 index 0000000..996842a --- /dev/null +++ b/Terraria/NPC.cs @@ -0,0 +1,18664 @@ +// Type: Terraria.NPC +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Net; +using System; +using Terraria.Achievements; + +namespace Terraria +{ + public sealed class NPC + { + public static string[] chrName = new string[125]; + public static byte[] npcFrameCount = new byte[168] + { + (byte) 1, + (byte) 2, + (byte) 2, + (byte) 3, + (byte) 6, + (byte) 2, + (byte) 2, + (byte) 1, + (byte) 1, + (byte) 1, + (byte) 1, + (byte) 1, + (byte) 1, + (byte) 1, + (byte) 1, + (byte) 1, + (byte) 2, + (byte) 16, + (byte) 14, + (byte) 16, + (byte) 14, + (byte) 15, + (byte) 16, + (byte) 2, + (byte) 10, + (byte) 1, + (byte) 16, + (byte) 16, + (byte) 16, + (byte) 3, + (byte) 1, + (byte) 15, + (byte) 3, + (byte) 1, + (byte) 3, + (byte) 1, + (byte) 1, + (byte) 16, + (byte) 16, + (byte) 1, + (byte) 1, + (byte) 1, + (byte) 3, + (byte) 3, + (byte) 15, + (byte) 3, + (byte) 7, + (byte) 7, + (byte) 4, + (byte) 5, + (byte) 5, + (byte) 5, + (byte) 3, + (byte) 3, + (byte) 16, + (byte) 6, + (byte) 3, + (byte) 6, + (byte) 6, + (byte) 2, + (byte) 5, + (byte) 3, + (byte) 2, + (byte) 7, + (byte) 7, + (byte) 4, + (byte) 2, + (byte) 8, + (byte) 1, + (byte) 5, + (byte) 1, + (byte) 2, + (byte) 4, + (byte) 16, + (byte) 5, + (byte) 4, + (byte) 4, + (byte) 15, + (byte) 15, + (byte) 15, + (byte) 15, + (byte) 2, + (byte) 4, + (byte) 6, + (byte) 6, + (byte) 18, + (byte) 16, + (byte) 1, + (byte) 1, + (byte) 1, + (byte) 1, + (byte) 1, + (byte) 1, + (byte) 4, + (byte) 3, + (byte) 1, + (byte) 1, + (byte) 1, + (byte) 1, + (byte) 1, + (byte) 1, + (byte) 5, + (byte) 6, + (byte) 7, + (byte) 16, + (byte) 1, + (byte) 1, + (byte) 16, + (byte) 16, + (byte) 12, + (byte) 20, + (byte) 21, + (byte) 1, + (byte) 2, + (byte) 2, + (byte) 3, + (byte) 6, + (byte) 1, + (byte) 1, + (byte) 1, + (byte) 15, + (byte) 4, + (byte) 11, + (byte) 1, + (byte) 14, + (byte) 6, + (byte) 6, + (byte) 3, + (byte) 1, + (byte) 2, + (byte) 2, + (byte) 1, + (byte) 3, + (byte) 4, + (byte) 1, + (byte) 2, + (byte) 1, + (byte) 4, + (byte) 2, + (byte) 1, + (byte) 15, + (byte) 3, + (byte) 16, + (byte) 4, + (byte) 5, + (byte) 7, + (byte) 3, + (byte) 5, + (byte) 4, + (byte) 15, + (byte) 2, + (byte) 6, + (byte) 15, + (byte) 11, + (byte) 15, + (byte) 15, + (byte) 3, + (byte) 3, + (byte) 3, + (byte) 1, + (byte) 1, + (byte) 1, + (byte) 1, + (byte) 1, + (byte) 1, + (byte) 2, + (byte) 6, + (byte) 2 + }; + public static int wof = -1; + public static int wofF = 0; + private static bool noSpawnCycle = false; + public static short checkForSpawnsTimer = (short) 0; + public static bool downedBoss1 = false; + public static bool downedBoss2 = false; + public static bool downedBoss3 = false; + public static bool savedGoblin = false; + public static bool savedWizard = false; + public static bool savedMech = false; + public static bool downedGoblins = false; + public static bool downedFrost = false; + public static bool downedClown = false; + private static int spawnRate = 600; + private static int maxSpawns = 5; + public Vector2[] oldPos = new Vector2[10]; + public int realLife = -1; + public float npcSlots = 1f; + public Buff[] buff = new Buff[5]; + public bool[] buffImmune = new bool[41]; + public byte[] immune = new byte[9]; + public sbyte direction = (sbyte) 1; + public sbyte directionY = (sbyte) 1; + public byte target = (byte) 8; + public float scale = 1f; + public float knockBackResist = 1f; + public sbyte spriteDirection = (sbyte) -1; + public short homeTileX = (short) -1; + public short homeTileY = (short) -1; + public short oldHomeTileX = (short) -1; + public short oldHomeTileY = (short) -1; + public const int MAX_NPCS = 196; + private const int spawnSpaceX = 3; + private const int spawnSpaceY = 3; + public const int sWidth = 1920; + public const int sHeight = 1080; + public const int safeRangeX = 62; + public const int safeRangeY = 34; + private const int spawnRangeX = 84; + private const int spawnRangeY = 46; + private const int activeRangeX = 3264; + private const int activeRangeY = 1836; + private const int townRangeX = 1920; + private const int townRangeY = 1080; + private const int activeTime = 750; + private const int defaultSpawnRate = 600; + private const int defaultMaxSpawns = 5; + private const int DRAW_MY_NAME_ON_STRIKE = 96; + public const int DRAW_MY_NAME_ON_NEARBY = 32; + public const int MAX_TYPES = 168; + public const int MAX_NAMED_TYPES = 125; + public const int MAX_BUFFS = 5; + public const int MAX_TOWN_NPCS = 10; + public static int wofT; + public static int wofB; + public short netSpam; + public short netSkip; + public bool netAlways; + public bool wet; + public byte wetCount; + public bool lavaWet; + public bool poisoned; + public bool confused; + public int lifeRegenCount; + public byte active; + public byte type; + public bool justHit; + public bool noGravity; + public bool noTileCollide; + public bool netUpdate; + public bool netUpdate2; + public bool collideX; + public bool collideY; + public bool boss; + public bool behindTiles; + public bool lavaImmune; + public bool dontTakeDamage; + public short drawMyName; + public bool townNPC; + public bool homeless; + public bool friendly; + private bool closeDoor; + private bool oldHomeless; + public Vector2 oldPosition; + public Vector2 oldVelocity; + public Vector2 position; + public Vector2 velocity; + public Rectangle aabb; + public ushort width; + public ushort height; + public byte aiAction; + public byte aiStyle; + public float ai0; + public float ai1; + public float ai2; + public float ai3; + public int localAI0; + public int localAI1; + public int localAI2; + public int localAI3; + public int timeLeft; + public int damage; + public int defense; + public int defDamage; + public short defDefense; + public short soundDelay; + public short soundHit; + public short soundKilled; + public int healthBarLife; + public int life; + public int lifeMax; + public Rectangle targetRect; + public float frameCounter; + public short frameY; + public short frameHeight; + public Color color; + public byte alpha; + public sbyte oldDirection; + public sbyte oldDirectionY; + public short oldTarget; + public short whoAmI; + public float rotation; + public float value; + public short netID; + public short doorX; + public short doorY; + public short friendlyRegen; + public string name; + public string displayName; + + static NPC() + { + } + + public static void clrNames() + { + for (int index = 0; index < 125; ++index) + NPC.chrName[index] = (string) null; + } + + public bool hasName() + { + if ((int) this.type < 125) + return NPC.chrName[(int) this.type] != null; + else + return false; + } + + public string getName() + { + return NPC.chrName[(int) this.type]; + } + + public static void setNames() + { + if (NPC.chrName[18] == null) + { + string str; + switch (WorldGen.genRand.Next(23)) + { + case 0: + str = "Molly"; + break; + case 1: + str = "Amy"; + break; + case 2: + str = "Claire"; + break; + case 3: + str = "Emily"; + break; + case 4: + str = "Katie"; + break; + case 5: + str = "Madeline"; + break; + case 6: + str = "Katelyn"; + break; + case 7: + str = "Emma"; + break; + case 8: + str = "Abigail"; + break; + case 9: + str = "Carly"; + break; + case 10: + str = "Jenna"; + break; + case 11: + str = "Heather"; + break; + case 12: + str = "Katherine"; + break; + case 13: + str = "Caitlin"; + break; + case 14: + str = "Kaitlin"; + break; + case 15: + str = "Holly"; + break; + case 16: + str = "Kaitlyn"; + break; + case 17: + str = "Hannah"; + break; + case 18: + str = "Kathryn"; + break; + case 19: + str = "Lorraine"; + break; + case 20: + str = "Helen"; + break; + case 21: + str = "Kayla"; + break; + default: + str = "Allison"; + break; + } + NPC.chrName[18] = str; + } + if (NPC.chrName[124] == null) + { + string str; + switch (WorldGen.genRand.Next(24)) + { + case 0: + str = "Shayna"; + break; + case 1: + str = "Korrie"; + break; + case 2: + str = "Ginger"; + break; + case 3: + str = "Brooke"; + break; + case 4: + str = "Jenny"; + break; + case 5: + str = "Autumn"; + break; + case 6: + str = "Nancy"; + break; + case 7: + str = "Ella"; + break; + case 8: + str = "Kayla"; + break; + case 9: + str = "Beth"; + break; + case 10: + str = "Sophia"; + break; + case 11: + str = "Marshanna"; + break; + case 12: + str = "Lauren"; + break; + case 13: + str = "Trisha"; + break; + case 14: + str = "Shirlena"; + break; + case 15: + str = "Sheena"; + break; + case 16: + str = "Ellen"; + break; + case 17: + str = "Amy"; + break; + case 18: + str = "Dawn"; + break; + case 19: + str = "Susana"; + break; + case 20: + str = "Meredith"; + break; + case 21: + str = "Selene"; + break; + case 22: + str = "Terra"; + break; + default: + str = "Sally"; + break; + } + NPC.chrName[124] = str; + } + if (NPC.chrName[19] == null) + { + string str; + switch (WorldGen.genRand.Next(23)) + { + case 0: + str = "DeShawn"; + break; + case 1: + str = "DeAndre"; + break; + case 2: + str = "Marquis"; + break; + case 3: + str = "Darnell"; + break; + case 4: + str = "Terrell"; + break; + case 5: + str = "Malik"; + break; + case 6: + str = "Trevon"; + break; + case 7: + str = "Tyrone"; + break; + case 8: + str = "Willie"; + break; + case 9: + str = "Dominique"; + break; + case 10: + str = "Demetrius"; + break; + case 11: + str = "Reginald"; + break; + case 12: + str = "Jamal"; + break; + case 13: + str = "Maurice"; + break; + case 14: + str = "Jalen"; + break; + case 15: + str = "Darius"; + break; + case 16: + str = "Xavier"; + break; + case 17: + str = "Terrance"; + break; + case 18: + str = "Andre"; + break; + case 19: + str = "Dante"; + break; + case 20: + str = "Brimst"; + break; + case 21: + str = "Bronson"; + break; + default: + str = "Darryl"; + break; + } + NPC.chrName[19] = str; + } + if (NPC.chrName[22] == null) + { + string str; + switch (WorldGen.genRand.Next(35)) + { + case 0: + str = "Jake"; + break; + case 1: + str = "Connor"; + break; + case 2: + str = "Tanner"; + break; + case 3: + str = "Wyatt"; + break; + case 4: + str = "Cody"; + break; + case 5: + str = "Dustin"; + break; + case 6: + str = "Luke"; + break; + case 7: + str = "Jack"; + break; + case 8: + str = "Scott"; + break; + case 9: + str = "Logan"; + break; + case 10: + str = "Cole"; + break; + case 11: + str = "Lucas"; + break; + case 12: + str = "Bradley"; + break; + case 13: + str = "Jacob"; + break; + case 14: + str = "Garrett"; + break; + case 15: + str = "Dylan"; + break; + case 16: + str = "Maxwell"; + break; + case 17: + str = "Steve"; + break; + case 18: + str = "Brett"; + break; + case 19: + str = "Andrew"; + break; + case 20: + str = "Harley"; + break; + case 21: + str = "Kyle"; + break; + case 22: + str = "Jake"; + break; + case 23: + str = "Ryan"; + break; + case 24: + str = "Jeffrey"; + break; + case 25: + str = "Seth"; + break; + case 26: + str = "Marty"; + break; + case 27: + str = "Brandon"; + break; + case 28: + str = "Zach"; + break; + case 29: + str = "Jeff"; + break; + case 30: + str = "Daniel"; + break; + case 31: + str = "Trent"; + break; + case 32: + str = "Kevin"; + break; + case 33: + str = "Brian"; + break; + default: + str = "Colin"; + break; + } + NPC.chrName[22] = str; + } + if (NPC.chrName[20] == null) + { + string str; + switch (WorldGen.genRand.Next(22)) + { + case 0: + str = "Alalia"; + break; + case 1: + str = "Alalia"; + break; + case 2: + str = "Alura"; + break; + case 3: + str = "Ariella"; + break; + case 4: + str = "Caelia"; + break; + case 5: + str = "Calista"; + break; + case 6: + str = "Chryseis"; + break; + case 7: + str = "Emerenta"; + break; + case 8: + str = "Elysia"; + break; + case 9: + str = "Evvie"; + break; + case 10: + str = "Faye"; + break; + case 11: + str = "Felicitae"; + break; + case 12: + str = "Lunette"; + break; + case 13: + str = "Nata"; + break; + case 14: + str = "Nissa"; + break; + case 15: + str = "Tatiana"; + break; + case 16: + str = "Rosalva"; + break; + case 17: + str = "Shea"; + break; + case 18: + str = "Tania"; + break; + case 19: + str = "Isis"; + break; + case 20: + str = "Celestia"; + break; + default: + str = "Xylia"; + break; + } + NPC.chrName[20] = str; + } + if (NPC.chrName[38] == null) + { + string str; + switch (WorldGen.genRand.Next(22)) + { + case 0: + str = "Dolbere"; + break; + case 1: + str = "Bazdin"; + break; + case 2: + str = "Durim"; + break; + case 3: + str = "Tordak"; + break; + case 4: + str = "Garval"; + break; + case 5: + str = "Morthal"; + break; + case 6: + str = "Oten"; + break; + case 7: + str = "Dolgen"; + break; + case 8: + str = "Gimli"; + break; + case 9: + str = "Gimut"; + break; + case 10: + str = "Duerthen"; + break; + case 11: + str = "Beldin"; + break; + case 12: + str = "Jarut"; + break; + case 13: + str = "Ovbere"; + break; + case 14: + str = "Norkas"; + break; + case 15: + str = "Dolgrim"; + break; + case 16: + str = "Boften"; + break; + case 17: + str = "Norsun"; + break; + case 18: + str = "Dias"; + break; + case 19: + str = "Fikod"; + break; + case 20: + str = "Urist"; + break; + default: + str = "Darur"; + break; + } + NPC.chrName[38] = str; + } + if (NPC.chrName[108] == null) + { + string str; + switch (WorldGen.genRand.Next(21)) + { + case 0: + str = "Dalamar"; + break; + case 1: + str = "Dulais"; + break; + case 2: + str = "Elric"; + break; + case 3: + str = "Arddun"; + break; + case 4: + str = "Maelor"; + break; + case 5: + str = "Leomund"; + break; + case 6: + str = "Hirael"; + break; + case 7: + str = "Gwentor"; + break; + case 8: + str = "Greum"; + break; + case 9: + str = "Gearroid"; + break; + case 10: + str = "Fizban"; + break; + case 11: + str = "Ningauble"; + break; + case 12: + str = "Seonag"; + break; + case 13: + str = "Sargon"; + break; + case 14: + str = "Merlyn"; + break; + case 15: + str = "Magius"; + break; + case 16: + str = "Berwyn"; + break; + case 17: + str = "Arwyn"; + break; + case 18: + str = "Alasdair"; + break; + case 19: + str = "Tagar"; + break; + default: + str = "Xanadu"; + break; + } + NPC.chrName[108] = str; + } + if (NPC.chrName[17] == null) + { + string str; + switch (WorldGen.genRand.Next(23)) + { + case 0: + str = "Alfred"; + break; + case 1: + str = "Barney"; + break; + case 2: + str = "Calvin"; + break; + case 3: + str = "Edmund"; + break; + case 4: + str = "Edwin"; + break; + case 5: + str = "Eugene"; + break; + case 6: + str = "Frank"; + break; + case 7: + str = "Frederick"; + break; + case 8: + str = "Gilbert"; + break; + case 9: + str = "Gus"; + break; + case 10: + str = "Wilbur"; + break; + case 11: + str = "Seymour"; + break; + case 12: + str = "Louis"; + break; + case 13: + str = "Humphrey"; + break; + case 14: + str = "Harold"; + break; + case 15: + str = "Milton"; + break; + case 16: + str = "Mortimer"; + break; + case 17: + str = "Howard"; + break; + case 18: + str = "Walter"; + break; + case 19: + str = "Finn"; + break; + case 20: + str = "Isacc"; + break; + case 21: + str = "Joseph"; + break; + default: + str = "Ralph"; + break; + } + NPC.chrName[17] = str; + } + if (NPC.chrName[54] == null) + { + string str; + switch (WorldGen.genRand.Next(24)) + { + case 0: + str = "Sebastian"; + break; + case 1: + str = "Rupert"; + break; + case 2: + str = "Clive"; + break; + case 3: + str = "Nigel"; + break; + case 4: + str = "Mervyn"; + break; + case 5: + str = "Cedric"; + break; + case 6: + str = "Pip"; + break; + case 7: + str = "Cyril"; + break; + case 8: + str = "Fitz"; + break; + case 9: + str = "Lloyd"; + break; + case 10: + str = "Arthur"; + break; + case 11: + str = "Rodney"; + break; + case 12: + str = "Graham"; + break; + case 13: + str = "Edward"; + break; + case 14: + str = "Alfred"; + break; + case 15: + str = "Edmund"; + break; + case 16: + str = "Henry"; + break; + case 17: + str = "Herald"; + break; + case 18: + str = "Roland"; + break; + case 19: + str = "Lincoln"; + break; + case 20: + str = "Lloyd"; + break; + case 21: + str = "Edgar"; + break; + case 22: + str = "Eustace"; + break; + default: + str = "Rodrick"; + break; + } + NPC.chrName[54] = str; + } + if (NPC.chrName[107] != null) + return; + string str1; + switch (WorldGen.genRand.Next(25)) + { + case 0: + str1 = "Grodax"; + break; + case 1: + str1 = "Sarx"; + break; + case 2: + str1 = "Xon"; + break; + case 3: + str1 = "Mrunok"; + break; + case 4: + str1 = "Nuxatk"; + break; + case 5: + str1 = "Tgerd"; + break; + case 6: + str1 = "Darz"; + break; + case 7: + str1 = "Smador"; + break; + case 8: + str1 = "Stazen"; + break; + case 9: + str1 = "Mobart"; + break; + case 10: + str1 = "Knogs"; + break; + case 11: + str1 = "Tkanus"; + break; + case 12: + str1 = "Negurk"; + break; + case 13: + str1 = "Nort"; + break; + case 14: + str1 = "Durnok"; + break; + case 15: + str1 = "Trogem"; + break; + case 16: + str1 = "Stezom"; + break; + case 17: + str1 = "Gnudar"; + break; + case 18: + str1 = "Ragz"; + break; + case 19: + str1 = "Fahd"; + break; + case 20: + str1 = "Xanos"; + break; + case 21: + str1 = "Arback"; + break; + case 22: + str1 = "Fjell"; + break; + case 23: + str1 = "Dalek"; + break; + default: + str1 = "Knub"; + break; + } + NPC.chrName[107] = str1; + } + + public void netDefaults(int type) + { + if (type < 0) + { + if (type == -1) + this.SetDefaults("Slimeling"); + else if (type == -2) + this.SetDefaults("Slimer2"); + else if (type == -3) + this.SetDefaults("Green Slime"); + else if (type == -4) + this.SetDefaults("Pinky"); + else if (type == -5) + this.SetDefaults("Baby Slime"); + else if (type == -6) + this.SetDefaults("Black Slime"); + else if (type == -7) + this.SetDefaults("Purple Slime"); + else if (type == -8) + this.SetDefaults("Red Slime"); + else if (type == -9) + this.SetDefaults("Yellow Slime"); + else if (type == -10) + this.SetDefaults("Jungle Slime"); + else if (type == -11) + this.SetDefaults("Little Eater"); + else if (type == -12) + this.SetDefaults("Big Eater"); + else if (type == -13) + this.SetDefaults("Short Bones"); + else if (type == -14) + this.SetDefaults("Big Boned"); + else if (type == -15) + this.SetDefaults("Heavy Skeleton"); + else if (type == -16) + this.SetDefaults("Little Stinger"); + else if (type == -17) + { + this.SetDefaults("Big Stinger"); + } + else + { + if (type != -18) + return; + this.SetDefaults("Slimeling2"); + } + } + else + this.SetDefaults(type, -1.0); + } + + public void SetDefaults(string Name) + { + if (Name == "Slimeling") + { + this.SetDefaults(81, 0.600000023841858); + this.name = Name; + this.damage = 45; + this.defense = 10; + this.life = 90; + this.knockBackResist = 1.2f; + this.value = 100f; + this.netID = (short) -1; + } + else if (Name == "Slimeling2") + { + this.SetDefaults(150, 0.600000023841858); + this.name = Name; + this.damage = 45; + this.defense = 10; + this.life = 105; + this.knockBackResist = 1.2f; + this.value = 100f; + this.netID = (short) -18; + } + else if (Name == "Slimer2") + { + this.SetDefaults(81, 0.899999976158142); + this.name = Name; + this.damage = 45; + this.defense = 20; + this.life = 90; + this.knockBackResist = 1.2f; + this.value = 100f; + this.netID = (short) -2; + } + else if (Name == "Green Slime") + { + this.SetDefaults(1, 0.899999976158142); + this.name = Name; + this.damage = 6; + this.defense = 0; + this.life = 14; + this.knockBackResist = 1.2f; + this.color = new Color(0, 220, 40, 100); + this.value = 3f; + this.netID = (short) -3; + } + else if (Name == "Pinky") + { + this.SetDefaults(1, 0.600000023841858); + this.name = Name; + this.damage = 5; + this.defense = 5; + this.life = 150; + this.knockBackResist = 1.4f; + this.color = new Color(250, 30, 90, 90); + this.value = 10000f; + this.netID = (short) -4; + } + else if (Name == "Baby Slime") + { + this.SetDefaults(1, 0.899999976158142); + this.name = Name; + this.damage = 13; + this.defense = 4; + this.life = 30; + this.knockBackResist = 0.95f; + this.alpha = (byte) 120; + this.color = new Color(0, 0, 0, 50); + this.value = 10f; + this.netID = (short) -5; + } + else if (Name == "Black Slime") + { + this.SetDefaults(1, -1.0); + this.name = Name; + this.damage = 15; + this.defense = 4; + this.life = 45; + this.color = new Color(0, 0, 0, 50); + this.value = 20f; + this.netID = (short) -6; + } + else if (Name == "Purple Slime") + { + this.SetDefaults(1, 1.20000004768372); + this.name = Name; + this.damage = 12; + this.defense = 6; + this.life = 40; + this.knockBackResist = 0.9f; + this.color = new Color(200, 0, (int) byte.MaxValue, 150); + this.value = 10f; + this.netID = (short) -7; + } + else if (Name == "Red Slime") + { + this.SetDefaults(1, -1.0); + this.name = Name; + this.damage = 12; + this.defense = 4; + this.life = 35; + this.color = new Color((int) byte.MaxValue, 30, 0, 100); + this.value = 8f; + this.netID = (short) -8; + } + else if (Name == "Yellow Slime") + { + this.SetDefaults(1, 1.20000004768372); + this.name = Name; + this.damage = 15; + this.defense = 7; + this.life = 45; + this.color = new Color((int) byte.MaxValue, (int) byte.MaxValue, 0, 100); + this.value = 10f; + this.netID = (short) -9; + } + else if (Name == "Jungle Slime") + { + this.SetDefaults(1, 1.10000002384186); + this.name = Name; + this.damage = 18; + this.defense = 6; + this.life = 60; + this.color = new Color(143, 215, 93, 100); + this.value = 500f; + this.netID = (short) -10; + } + else if (Name == "Little Eater") + { + this.SetDefaults(6, 0.850000023841858); + this.name = Name; + this.defense = (int) ((double) this.defense * (double) this.scale); + this.damage = (int) ((double) this.damage * (double) this.scale); + this.life = (int) ((double) this.life * (double) this.scale); + this.value = (float) (int) ((double) this.value * (double) this.scale); + this.npcSlots = this.npcSlots * this.scale; + this.knockBackResist *= 2f - this.scale; + this.netID = (short) -11; + } + else if (Name == "Big Eater") + { + this.SetDefaults(6, 1.14999997615814); + this.name = Name; + this.defense = (int) ((double) this.defense * (double) this.scale); + this.damage = (int) ((double) this.damage * (double) this.scale); + this.life = (int) ((double) this.life * (double) this.scale); + this.value = (float) (int) ((double) this.value * (double) this.scale); + this.npcSlots = this.npcSlots * this.scale; + this.knockBackResist *= 2f - this.scale; + this.netID = (short) -12; + } + else if (Name == "Short Bones") + { + this.SetDefaults(31, 0.899999976158142); + this.name = Name; + this.defense = (int) ((double) this.defense * (double) this.scale); + this.damage = (int) ((double) this.damage * (double) this.scale); + this.life = (int) ((double) this.life * (double) this.scale); + this.value = (float) (int) ((double) this.value * (double) this.scale); + this.netID = (short) -13; + } + else if (Name == "Big Boned") + { + this.SetDefaults(31, 1.14999997615814); + this.name = Name; + this.defense = (int) ((double) this.defense * (double) this.scale); + this.damage = (int) ((double) this.damage * (double) this.scale * 1.1); + this.life = (int) ((double) this.life * (double) this.scale * 1.1); + this.value = (float) (int) ((double) this.value * (double) this.scale); + this.npcSlots = 2f; + this.knockBackResist *= 2f - this.scale; + this.netID = (short) -14; + } + else if (Name == "Heavy Skeleton") + { + this.SetDefaults(77, 1.14999997615814); + this.name = Name; + this.defense = (int) ((double) this.defense * (double) this.scale); + this.damage = (int) ((double) this.damage * (double) this.scale * 1.1); + this.life = 400; + this.value = (float) (int) ((double) this.value * (double) this.scale); + this.npcSlots = 2f; + this.knockBackResist *= 2f - this.scale; + this.height = (ushort) 44; + this.netID = (short) -15; + } + else if (Name == "Little Stinger") + { + this.SetDefaults(42, 0.850000023841858); + this.name = Name; + this.defense = (int) ((double) this.defense * (double) this.scale); + this.damage = (int) ((double) this.damage * (double) this.scale); + this.life = (int) ((double) this.life * (double) this.scale); + this.value = (float) (int) ((double) this.value * (double) this.scale); + this.npcSlots = this.npcSlots * this.scale; + this.knockBackResist *= 2f - this.scale; + this.netID = (short) -16; + } + else if (Name == "Big Stinger") + { + this.SetDefaults(42, 1.20000004768372); + this.name = Name; + this.defense = (int) ((double) this.defense * (double) this.scale); + this.damage = (int) ((double) this.damage * (double) this.scale); + this.life = (int) ((double) this.life * (double) this.scale); + this.value = (float) (int) ((double) this.value * (double) this.scale); + this.npcSlots = this.npcSlots * this.scale; + this.knockBackResist *= 2f - this.scale; + this.netID = (short) -17; + } + this.displayName = Lang.npcName((int) this.netID); + this.lifeMax = this.life; + this.healthBarLife = this.life; + this.defDamage = this.damage; + this.defDefense = (short) this.defense; + } + + public bool canTalk() + { + if (!this.townNPC && (int) this.type != 105 && (int) this.type != 106) + return (int) this.type == 123; + else + return true; + } + + public static bool MechSpawn(int x, int y, int type) + { + int num1 = 0; + int num2 = 0; + int num3 = 0; + for (int index = 0; index < 196; ++index) + { + if ((int) Main.npc[index].active != 0 && (int) Main.npc[index].type == type) + { + ++num1; + Vector2 vector2 = new Vector2((float) x, (float) y); + float num4 = Main.npc[index].position.X - vector2.X; + float num5 = Main.npc[index].position.Y - vector2.Y; + float num6 = (float) ((double) num4 * (double) num4 + (double) num5 * (double) num5); + if ((double) num6 < 40000.0) + ++num2; + if ((double) num6 < 360000.0) + ++num3; + } + } + return num2 < 3 && num3 < 6 && num1 < 10; + } + + public int getHeadTextureId() + { + byte num = this.type; + if ((uint) num <= 54U) + { + switch (num) + { + case (byte) 17: + return 2; + case (byte) 18: + return 3; + case (byte) 19: + return 6; + case (byte) 20: + return 5; + case (byte) 22: + return 1; + case (byte) 38: + return 4; + case (byte) 54: + return 7; + } + } + else + { + switch (num) + { + case (byte) 107: + return 9; + case (byte) 108: + return 10; + case (byte) 124: + return 8; + case (byte) 142: + return 11; + } + } + return -1; + } + + public void SetDefaults(int Type, double scaleOverride = -1.0) + { + this.type = (byte) Type; + this.netID = (short) Type; + this.netAlways = false; + this.netSpam = (short) 0; + this.drawMyName = (short) 0; + for (int index = 0; index < this.oldPos.Length; ++index) + { + this.oldPos[index].X = 0.0f; + this.oldPos[index].Y = 0.0f; + } + for (int index = 0; index < 5; ++index) + { + this.buff[index].Time = (ushort) 0; + this.buff[index].Type = (ushort) 0; + } + for (int index = 0; index < 41; ++index) + this.buffImmune[index] = false; + this.buffImmune[31] = true; + this.netSkip = (short) -2; + this.realLife = -1; + this.lifeRegenCount = 0; + this.poisoned = false; + this.confused = false; + this.justHit = false; + this.dontTakeDamage = false; + this.npcSlots = 1f; + this.lavaImmune = false; + this.lavaWet = false; + this.wetCount = (byte) 0; + this.wet = false; + this.townNPC = false; + this.homeless = false; + this.homeTileX = (short) -1; + this.homeTileY = (short) -1; + this.friendly = false; + this.behindTiles = false; + this.boss = false; + this.noTileCollide = false; + this.rotation = 0.0f; + this.active = (byte) 1; + this.alpha = (byte) 0; + this.color = new Color(); + this.collideX = false; + this.collideY = false; + this.direction = (sbyte) 0; + this.oldDirection = (sbyte) 0; + this.frameCounter = 0.0f; + this.netUpdate = true; + this.netUpdate2 = false; + this.knockBackResist = 1f; + this.name = ""; + this.noGravity = false; + this.scale = 1f; + this.soundHit = (short) 0; + this.soundKilled = (short) 0; + this.spriteDirection = (sbyte) -1; + this.target = (byte) 8; + this.oldTarget = (short) this.target; + this.targetRect = new Rectangle(); + this.timeLeft = 750; + this.value = 0.0f; + this.ai0 = 0.0f; + this.ai1 = 0.0f; + this.ai2 = 0.0f; + this.ai3 = 0.0f; + this.localAI0 = 0; + this.localAI1 = 0; + this.localAI2 = 0; + this.localAI3 = 0; + if ((int) this.type == 1) + { + this.name = "Blue Slime"; + this.width = (ushort) 24; + this.height = (ushort) 18; + this.aiStyle = (byte) 1; + this.damage = 7; + this.defense = 2; + this.lifeMax = 25; + this.soundHit = (short) 1; + this.soundKilled = (short) 1; + this.alpha = (byte) 175; + this.color = new Color(0, 80, (int) byte.MaxValue, 100); + this.value = 25f; + this.buffImmune[20] = true; + this.buffImmune[31] = false; + } + else if ((int) this.type == 2) + { + this.name = "Demon Eye"; + this.width = (ushort) 30; + this.height = (ushort) 32; + this.aiStyle = (byte) 2; + this.damage = 18; + this.defense = 2; + this.lifeMax = 60; + this.soundHit = (short) 1; + this.knockBackResist = 0.8f; + this.soundKilled = (short) 1; + this.value = 75f; + this.buffImmune[31] = false; + } + else if ((int) this.type == 3) + { + this.name = "Zombie"; + this.width = (ushort) 18; + this.height = (ushort) 40; + this.aiStyle = (byte) 3; + this.damage = 14; + this.defense = 6; + this.lifeMax = 45; + this.soundHit = (short) 1; + this.soundKilled = (short) 2; + this.knockBackResist = 0.5f; + this.value = 60f; + this.buffImmune[31] = false; + } + else if ((int) this.type == 4) + { + this.name = "Eye of Cthulhu"; + this.width = (ushort) 100; + this.height = (ushort) 110; + this.aiStyle = (byte) 4; + this.damage = 15; + this.defense = 12; + this.lifeMax = 2800; + this.soundHit = (short) 1; + this.soundKilled = (short) 1; + this.knockBackResist = 0.0f; + this.noGravity = true; + this.noTileCollide = true; + this.timeLeft = 22500; + this.boss = true; + this.value = 30000f; + this.npcSlots = 5f; + } + else if ((int) this.type == 166) + { + this.name = "Ocram"; + this.width = (ushort) 100; + this.height = (ushort) 110; + this.aiStyle = (byte) 39; + this.damage = 65; + this.defense = 20; + this.lifeMax = 35000; + this.soundHit = (short) 1; + this.soundKilled = (short) 1; + this.knockBackResist = 0.0f; + this.noGravity = true; + this.noTileCollide = true; + this.timeLeft = 22500; + this.boss = true; + this.value = 100000f; + this.npcSlots = 5f; + this.buffImmune[20] = true; + } + else if ((int) this.type == 5) + { + this.name = "Servant of Cthulhu"; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.aiStyle = (byte) 5; + this.damage = 13; + this.defense = 0; + this.lifeMax = 10; + this.soundHit = (short) 1; + this.soundKilled = (short) 1; + this.noGravity = true; + this.noTileCollide = true; + } + else if ((int) this.type == 167) + { + this.name = "Servant of Ocram"; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.aiStyle = (byte) 5; + this.damage = 35; + this.defense = 5; + this.lifeMax = 130; + this.soundHit = (short) 1; + this.soundKilled = (short) 1; + this.noGravity = true; + this.noTileCollide = true; + } + else if ((int) this.type == 6) + { + this.npcSlots = 1f; + this.name = "Eater of Souls"; + this.width = (ushort) 30; + this.height = (ushort) 30; + this.aiStyle = (byte) 5; + this.damage = 22; + this.defense = 8; + this.lifeMax = 40; + this.soundHit = (short) 1; + this.soundKilled = (short) 1; + this.noGravity = true; + this.knockBackResist = 0.5f; + this.value = 90f; + } + else if ((int) this.type == 7) + { + this.npcSlots = 3.5f; + this.name = "Devourer Head"; + this.width = (ushort) 22; + this.height = (ushort) 22; + this.aiStyle = (byte) 6; + this.damage = 31; + this.defense = 2; + this.lifeMax = 100; + this.soundHit = (short) 1; + this.soundKilled = (short) 1; + this.noGravity = true; + this.noTileCollide = true; + this.knockBackResist = 0.0f; + this.behindTiles = true; + this.value = 140f; + this.netAlways = true; + } + else if ((int) this.type == 8) + { + this.name = "Devourer Body"; + this.width = (ushort) 22; + this.height = (ushort) 22; + this.aiStyle = (byte) 6; + this.netAlways = true; + this.damage = 16; + this.defense = 6; + this.lifeMax = 100; + this.soundHit = (short) 1; + this.soundKilled = (short) 1; + this.noGravity = true; + this.noTileCollide = true; + this.knockBackResist = 0.0f; + this.behindTiles = true; + this.value = 140f; + } + else if ((int) this.type == 9) + { + this.name = "Devourer Tail"; + this.width = (ushort) 22; + this.height = (ushort) 22; + this.aiStyle = (byte) 6; + this.netAlways = true; + this.damage = 13; + this.defense = 10; + this.lifeMax = 100; + this.soundHit = (short) 1; + this.soundKilled = (short) 1; + this.noGravity = true; + this.noTileCollide = true; + this.knockBackResist = 0.0f; + this.behindTiles = true; + this.value = 140f; + } + else if ((int) this.type == 10) + { + this.name = "Giant Worm Head"; + this.width = (ushort) 14; + this.height = (ushort) 14; + this.aiStyle = (byte) 6; + this.netAlways = true; + this.damage = 8; + this.defense = 0; + this.lifeMax = 30; + this.soundHit = (short) 1; + this.soundKilled = (short) 1; + this.noGravity = true; + this.noTileCollide = true; + this.knockBackResist = 0.0f; + this.behindTiles = true; + this.value = 40f; + } + else if ((int) this.type == 11) + { + this.name = "Giant Worm Body"; + this.width = (ushort) 14; + this.height = (ushort) 14; + this.aiStyle = (byte) 6; + this.netAlways = true; + this.damage = 4; + this.defense = 4; + this.lifeMax = 30; + this.soundHit = (short) 1; + this.soundKilled = (short) 1; + this.noGravity = true; + this.noTileCollide = true; + this.knockBackResist = 0.0f; + this.behindTiles = true; + this.value = 40f; + } + else if ((int) this.type == 12) + { + this.name = "Giant Worm Tail"; + this.width = (ushort) 14; + this.height = (ushort) 14; + this.aiStyle = (byte) 6; + this.netAlways = true; + this.damage = 4; + this.defense = 6; + this.lifeMax = 30; + this.soundHit = (short) 1; + this.soundKilled = (short) 1; + this.noGravity = true; + this.noTileCollide = true; + this.knockBackResist = 0.0f; + this.behindTiles = true; + this.value = 40f; + } + else if ((int) this.type == 13) + { + this.npcSlots = 5f; + this.name = "Eater of Worlds Head"; + this.width = (ushort) 38; + this.height = (ushort) 38; + this.aiStyle = (byte) 6; + this.netAlways = true; + this.damage = 22; + this.defense = 2; + this.lifeMax = 65; + this.soundHit = (short) 1; + this.soundKilled = (short) 1; + this.noGravity = true; + this.noTileCollide = true; + this.knockBackResist = 0.0f; + this.behindTiles = true; + this.value = 300f; + this.scale = 1f; + this.buffImmune[20] = true; + this.buffImmune[24] = true; + this.buffImmune[39] = true; + } + else if ((int) this.type == 14) + { + this.name = "Eater of Worlds Body"; + this.width = (ushort) 38; + this.height = (ushort) 38; + this.aiStyle = (byte) 6; + this.netAlways = true; + this.damage = 13; + this.defense = 4; + this.lifeMax = 150; + this.soundHit = (short) 1; + this.soundKilled = (short) 1; + this.noGravity = true; + this.noTileCollide = true; + this.knockBackResist = 0.0f; + this.behindTiles = true; + this.value = 300f; + this.scale = 1f; + this.buffImmune[20] = true; + this.buffImmune[24] = true; + this.buffImmune[39] = true; + } + else if ((int) this.type == 15) + { + this.name = "Eater of Worlds Tail"; + this.width = (ushort) 38; + this.height = (ushort) 38; + this.aiStyle = (byte) 6; + this.netAlways = true; + this.damage = 11; + this.defense = 8; + this.lifeMax = 220; + this.soundHit = (short) 1; + this.soundKilled = (short) 1; + this.noGravity = true; + this.noTileCollide = true; + this.knockBackResist = 0.0f; + this.behindTiles = true; + this.value = 300f; + this.scale = 1f; + this.buffImmune[20] = true; + this.buffImmune[24] = true; + this.buffImmune[39] = true; + } + else if ((int) this.type == 16) + { + this.npcSlots = 2f; + this.name = "Mother Slime"; + this.width = (ushort) 36; + this.height = (ushort) 24; + this.aiStyle = (byte) 1; + this.damage = 20; + this.defense = 7; + this.lifeMax = 90; + this.soundHit = (short) 1; + this.soundKilled = (short) 1; + this.alpha = (byte) 120; + this.color = new Color(0, 0, 0, 50); + this.value = 75f; + this.scale = 1.25f; + this.knockBackResist = 0.6f; + this.buffImmune[20] = true; + this.buffImmune[31] = false; + } + else if ((int) this.type == 17) + { + this.townNPC = true; + this.friendly = true; + this.name = "Merchant"; + this.width = (ushort) 18; + this.height = (ushort) 40; + this.aiStyle = (byte) 7; + this.damage = 10; + this.defense = 15; + this.lifeMax = 250; + this.soundHit = (short) 1; + this.soundKilled = (short) 1; + this.knockBackResist = 0.5f; + } + else if ((int) this.type == 18) + { + this.townNPC = true; + this.friendly = true; + this.name = "Nurse"; + this.width = (ushort) 18; + this.height = (ushort) 40; + this.aiStyle = (byte) 7; + this.damage = 10; + this.defense = 15; + this.lifeMax = 250; + this.soundHit = (short) 1; + this.soundKilled = (short) 1; + this.knockBackResist = 0.5f; + } + else if ((int) this.type == 19) + { + this.townNPC = true; + this.friendly = true; + this.name = "Arms Dealer"; + this.width = (ushort) 18; + this.height = (ushort) 40; + this.aiStyle = (byte) 7; + this.damage = 10; + this.defense = 15; + this.lifeMax = 250; + this.soundHit = (short) 1; + this.soundKilled = (short) 1; + this.knockBackResist = 0.5f; + } + else if ((int) this.type == 20) + { + this.townNPC = true; + this.friendly = true; + this.name = "Dryad"; + this.width = (ushort) 18; + this.height = (ushort) 40; + this.aiStyle = (byte) 7; + this.damage = 10; + this.defense = 15; + this.lifeMax = 250; + this.soundHit = (short) 1; + this.soundKilled = (short) 1; + this.knockBackResist = 0.5f; + } + else if ((int) this.type == 21) + { + this.name = "Skeleton"; + this.width = (ushort) 18; + this.height = (ushort) 40; + this.aiStyle = (byte) 3; + this.damage = 20; + this.defense = 8; + this.lifeMax = 60; + this.soundHit = (short) 2; + this.soundKilled = (short) 2; + this.knockBackResist = 0.5f; + this.value = 100f; + this.buffImmune[20] = true; + this.buffImmune[31] = false; + } + else if ((int) this.type == 22) + { + this.townNPC = true; + this.friendly = true; + this.name = "Guide"; + this.width = (ushort) 18; + this.height = (ushort) 40; + this.aiStyle = (byte) 7; + this.damage = 10; + this.defense = 15; + this.lifeMax = 250; + this.soundHit = (short) 1; + this.soundKilled = (short) 1; + this.knockBackResist = 0.5f; + } + else if ((int) this.type == 23) + { + this.name = "Meteor Head"; + this.width = (ushort) 22; + this.height = (ushort) 22; + this.aiStyle = (byte) 5; + this.damage = 40; + this.defense = 6; + this.lifeMax = 26; + this.soundHit = (short) 3; + this.soundKilled = (short) 3; + this.noGravity = true; + this.noTileCollide = true; + this.value = 80f; + this.knockBackResist = 0.4f; + this.buffImmune[20] = true; + this.buffImmune[24] = true; + this.buffImmune[39] = true; + } + else if ((int) this.type == 24) + { + this.npcSlots = 3f; + this.name = "Fire Imp"; + this.width = (ushort) 18; + this.height = (ushort) 40; + this.aiStyle = (byte) 8; + this.damage = 30; + this.defense = 16; + this.lifeMax = 70; + this.soundHit = (short) 1; + this.soundKilled = (short) 1; + this.knockBackResist = 0.5f; + this.lavaImmune = true; + this.value = 350f; + this.buffImmune[24] = true; + this.buffImmune[39] = true; + } + else if ((int) this.type == 25) + { + this.name = "Burning Sphere"; + this.width = (ushort) 16; + this.height = (ushort) 16; + this.aiStyle = (byte) 9; + this.damage = 30; + this.defense = 0; + this.lifeMax = 1; + this.soundHit = (short) 3; + this.soundKilled = (short) 3; + this.noGravity = true; + this.noTileCollide = true; + this.knockBackResist = 0.0f; + this.alpha = (byte) 100; + } + else if ((int) this.type == 26) + { + this.name = "Goblin Peon"; + this.scale = 0.9f; + this.width = (ushort) 18; + this.height = (ushort) 40; + this.aiStyle = (byte) 3; + this.damage = 12; + this.defense = 4; + this.lifeMax = 60; + this.soundHit = (short) 1; + this.soundKilled = (short) 1; + this.knockBackResist = 0.8f; + this.value = 100f; + this.buffImmune[31] = false; + } + else if ((int) this.type == 27) + { + this.name = "Goblin Thief"; + this.scale = 0.95f; + this.width = (ushort) 18; + this.height = (ushort) 40; + this.aiStyle = (byte) 3; + this.damage = 20; + this.defense = 6; + this.lifeMax = 80; + this.soundHit = (short) 1; + this.soundKilled = (short) 1; + this.knockBackResist = 0.7f; + this.value = 200f; + this.buffImmune[31] = false; + } + else if ((int) this.type == 28) + { + this.name = "Goblin Warrior"; + this.scale = 1.1f; + this.width = (ushort) 18; + this.height = (ushort) 40; + this.aiStyle = (byte) 3; + this.damage = 25; + this.defense = 8; + this.lifeMax = 110; + this.soundHit = (short) 1; + this.soundKilled = (short) 1; + this.knockBackResist = 0.5f; + this.value = 150f; + this.buffImmune[31] = false; + } + else if ((int) this.type == 29) + { + this.name = "Goblin Sorcerer"; + this.width = (ushort) 18; + this.height = (ushort) 40; + this.aiStyle = (byte) 8; + this.damage = 20; + this.defense = 2; + this.lifeMax = 40; + this.soundHit = (short) 1; + this.soundKilled = (short) 1; + this.knockBackResist = 0.6f; + this.value = 200f; + } + else if ((int) this.type == 30) + { + this.name = "Chaos Ball"; + this.width = (ushort) 16; + this.height = (ushort) 16; + this.aiStyle = (byte) 9; + this.damage = 20; + this.defense = 0; + this.lifeMax = 1; + this.soundHit = (short) 3; + this.soundKilled = (short) 3; + this.noGravity = true; + this.noTileCollide = true; + this.alpha = (byte) 100; + this.knockBackResist = 0.0f; + } + else if ((int) this.type == 31) + { + this.name = "Angry Bones"; + this.width = (ushort) 18; + this.height = (ushort) 40; + this.aiStyle = (byte) 3; + this.damage = 26; + this.defense = 8; + this.lifeMax = 80; + this.soundHit = (short) 2; + this.soundKilled = (short) 2; + this.knockBackResist = 0.8f; + this.value = 130f; + this.buffImmune[20] = true; + this.buffImmune[31] = false; + } + else if ((int) this.type == 32) + { + this.name = "Dark Caster"; + this.width = (ushort) 18; + this.height = (ushort) 40; + this.aiStyle = (byte) 8; + this.damage = 20; + this.defense = 2; + this.lifeMax = 50; + this.soundHit = (short) 2; + this.soundKilled = (short) 2; + this.knockBackResist = 0.6f; + this.value = 140f; + this.npcSlots = 2f; + this.buffImmune[20] = true; + } + else if ((int) this.type == 33) + { + this.name = "Water Sphere"; + this.width = (ushort) 16; + this.height = (ushort) 16; + this.aiStyle = (byte) 9; + this.damage = 20; + this.defense = 0; + this.lifeMax = 1; + this.soundHit = (short) 3; + this.soundKilled = (short) 3; + this.noGravity = true; + this.noTileCollide = true; + this.alpha = (byte) 100; + this.knockBackResist = 0.0f; + } + else if ((int) this.type == 34) + { + this.name = "Cursed Skull"; + this.width = (ushort) 26; + this.height = (ushort) 28; + this.aiStyle = (byte) 10; + this.damage = 35; + this.defense = 6; + this.lifeMax = 40; + this.soundHit = (short) 2; + this.soundKilled = (short) 2; + this.noGravity = true; + this.noTileCollide = true; + this.value = 150f; + this.knockBackResist = 0.2f; + this.npcSlots = 0.75f; + this.buffImmune[20] = true; + this.buffImmune[24] = true; + this.buffImmune[39] = true; + } + else if ((int) this.type == 158) + { + this.name = "Dragon Skull"; + this.width = (ushort) 56; + this.height = (ushort) 28; + this.aiStyle = (byte) 10; + this.damage = 45; + this.defense = 8; + this.lifeMax = 50; + this.soundHit = (short) 2; + this.soundKilled = (short) 2; + this.noGravity = true; + this.noTileCollide = true; + this.value = 150f; + this.knockBackResist = 0.2f; + this.npcSlots = 0.75f; + this.buffImmune[20] = true; + this.buffImmune[24] = true; + this.buffImmune[39] = true; + } + else if ((int) this.type == 35) + { + this.name = "Skeletron Head"; + this.width = (ushort) 80; + this.height = (ushort) 102; + this.aiStyle = (byte) 11; + this.damage = 32; + this.defense = 10; + this.lifeMax = 4400; + this.soundHit = (short) 2; + this.soundKilled = (short) 2; + this.noGravity = true; + this.noTileCollide = true; + this.value = 50000f; + this.knockBackResist = 0.0f; + this.boss = true; + this.npcSlots = 6f; + this.buffImmune[20] = true; + this.buffImmune[24] = true; + this.buffImmune[39] = true; + } + else if ((int) this.type == 36) + { + this.name = "Skeletron Hand"; + this.width = (ushort) 52; + this.height = (ushort) 52; + this.aiStyle = (byte) 12; + this.damage = 20; + this.defense = 14; + this.lifeMax = 600; + this.soundHit = (short) 2; + this.soundKilled = (short) 2; + this.noGravity = true; + this.noTileCollide = true; + this.knockBackResist = 0.0f; + this.buffImmune[20] = true; + this.buffImmune[24] = true; + this.buffImmune[39] = true; + } + else if ((int) this.type == 37) + { + this.townNPC = true; + this.friendly = true; + this.name = "Old Man"; + this.width = (ushort) 18; + this.height = (ushort) 40; + this.aiStyle = (byte) 7; + this.damage = 10; + this.defense = 15; + this.lifeMax = 250; + this.soundHit = (short) 1; + this.soundKilled = (short) 1; + this.knockBackResist = 0.5f; + } + else if ((int) this.type == 38) + { + this.townNPC = true; + this.friendly = true; + this.name = "Demolitionist"; + this.width = (ushort) 18; + this.height = (ushort) 40; + this.aiStyle = (byte) 7; + this.damage = 10; + this.defense = 15; + this.lifeMax = 250; + this.soundHit = (short) 1; + this.soundKilled = (short) 1; + this.knockBackResist = 0.5f; + } + else if ((int) this.type == 39) + { + this.npcSlots = 6f; + this.name = "Bone Serpent Head"; + this.width = (ushort) 22; + this.height = (ushort) 22; + this.aiStyle = (byte) 6; + this.netAlways = true; + this.damage = 30; + this.defense = 10; + this.lifeMax = 250; + this.soundHit = (short) 2; + this.soundKilled = (short) 5; + this.noGravity = true; + this.noTileCollide = true; + this.knockBackResist = 0.0f; + this.behindTiles = true; + this.value = 1200f; + this.buffImmune[20] = true; + this.buffImmune[24] = true; + this.buffImmune[39] = true; + } + else if ((int) this.type == 40) + { + this.name = "Bone Serpent Body"; + this.width = (ushort) 22; + this.height = (ushort) 22; + this.aiStyle = (byte) 6; + this.netAlways = true; + this.damage = 15; + this.defense = 12; + this.lifeMax = 250; + this.soundHit = (short) 2; + this.soundKilled = (short) 5; + this.noGravity = true; + this.noTileCollide = true; + this.knockBackResist = 0.0f; + this.behindTiles = true; + this.value = 1200f; + this.buffImmune[20] = true; + this.buffImmune[24] = true; + this.buffImmune[39] = true; + } + else if ((int) this.type == 41) + { + this.name = "Bone Serpent Tail"; + this.width = (ushort) 22; + this.height = (ushort) 22; + this.aiStyle = (byte) 6; + this.netAlways = true; + this.damage = 10; + this.defense = 18; + this.lifeMax = 250; + this.soundHit = (short) 2; + this.soundKilled = (short) 5; + this.noGravity = true; + this.noTileCollide = true; + this.knockBackResist = 0.0f; + this.behindTiles = true; + this.value = 1200f; + this.buffImmune[20] = true; + this.buffImmune[24] = true; + this.buffImmune[39] = true; + } + else if ((int) this.type == 42) + { + this.name = "Hornet"; + this.width = (ushort) 34; + this.height = (ushort) 32; + this.aiStyle = (byte) 5; + this.damage = 34; + this.defense = 12; + this.lifeMax = 50; + this.soundHit = (short) 1; + this.knockBackResist = 0.5f; + this.soundKilled = (short) 1; + this.value = 200f; + this.noGravity = true; + this.buffImmune[20] = true; + } + else if ((int) this.type == 157) + { + this.name = "Dragon Hornet"; + this.width = (ushort) 34; + this.height = (ushort) 32; + this.aiStyle = (byte) 5; + this.damage = 39; + this.defense = 17; + this.lifeMax = 65; + this.soundHit = (short) 1; + this.knockBackResist = 0.5f; + this.soundKilled = (short) 1; + this.value = 200f; + this.noGravity = true; + this.buffImmune[20] = true; + } + else if ((int) this.type == 43) + { + this.noGravity = true; + this.noTileCollide = true; + this.name = "Man Eater"; + this.width = (ushort) 30; + this.height = (ushort) 30; + this.aiStyle = (byte) 13; + this.damage = 42; + this.defense = 14; + this.lifeMax = 130; + this.soundHit = (short) 1; + this.knockBackResist = 0.0f; + this.soundKilled = (short) 1; + this.value = 350f; + this.buffImmune[20] = true; + } + else if ((int) this.type == 44) + { + this.name = "Undead Miner"; + this.width = (ushort) 18; + this.height = (ushort) 40; + this.aiStyle = (byte) 3; + this.damage = 22; + this.defense = 9; + this.lifeMax = 70; + this.soundHit = (short) 2; + this.soundKilled = (short) 2; + this.knockBackResist = 0.5f; + this.value = 250f; + this.buffImmune[20] = true; + this.buffImmune[31] = false; + } + else if ((int) this.type == 149) + { + this.name = "Vampire Miner"; + this.width = (ushort) 18; + this.height = (ushort) 40; + this.aiStyle = (byte) 3; + this.damage = 30; + this.defense = 9; + this.lifeMax = 90; + this.soundHit = (short) 2; + this.soundKilled = (short) 2; + this.knockBackResist = 0.7f; + this.value = 250f; + this.buffImmune[20] = true; + this.buffImmune[31] = false; + } + else if ((int) this.type == 45) + { + this.name = "Tim"; + this.width = (ushort) 18; + this.height = (ushort) 40; + this.aiStyle = (byte) 8; + this.damage = 20; + this.defense = 4; + this.lifeMax = 200; + this.soundHit = (short) 2; + this.soundKilled = (short) 2; + this.knockBackResist = 0.6f; + this.value = 5000f; + this.buffImmune[20] = true; + } + else if ((int) this.type == 46) + { + this.name = "Bunny"; + this.width = (ushort) 18; + this.height = (ushort) 20; + this.aiStyle = (byte) 7; + this.damage = 0; + this.defense = 0; + this.lifeMax = 5; + this.soundHit = (short) 1; + this.soundKilled = (short) 1; + } + else if ((int) this.type == 47) + { + this.name = "Corrupt Bunny"; + this.width = (ushort) 18; + this.height = (ushort) 20; + this.aiStyle = (byte) 3; + this.damage = 20; + this.defense = 4; + this.lifeMax = 70; + this.soundHit = (short) 1; + this.soundKilled = (short) 1; + this.value = 500f; + this.buffImmune[31] = false; + } + else if ((int) this.type == 48) + { + this.name = "Harpy"; + this.width = (ushort) 24; + this.height = (ushort) 34; + this.aiStyle = (byte) 14; + this.damage = 25; + this.defense = 8; + this.lifeMax = 100; + this.soundHit = (short) 1; + this.knockBackResist = 0.6f; + this.soundKilled = (short) 1; + this.value = 300f; + } + else if ((int) this.type == 49) + { + this.npcSlots = 0.5f; + this.name = "Cave Bat"; + this.width = (ushort) 22; + this.height = (ushort) 18; + this.aiStyle = (byte) 14; + this.damage = 13; + this.defense = 2; + this.lifeMax = 16; + this.soundHit = (short) 1; + this.knockBackResist = 0.8f; + this.soundKilled = (short) 4; + this.value = 90f; + this.buffImmune[31] = false; + } + else if ((int) this.type == 50) + { + this.boss = true; + this.name = "King Slime"; + this.width = (ushort) 98; + this.height = (ushort) 92; + this.aiStyle = (byte) 15; + this.damage = 40; + this.defense = 10; + this.lifeMax = 2000; + this.knockBackResist = 0.0f; + this.soundHit = (short) 1; + this.soundKilled = (short) 1; + this.alpha = (byte) 30; + this.value = 10000f; + this.scale = 1.25f; + this.buffImmune[20] = true; + } + else if ((int) this.type == 51) + { + this.npcSlots = 0.5f; + this.name = "Jungle Bat"; + this.width = (ushort) 22; + this.height = (ushort) 18; + this.aiStyle = (byte) 14; + this.damage = 20; + this.defense = 4; + this.lifeMax = 34; + this.soundHit = (short) 1; + this.knockBackResist = 0.8f; + this.soundKilled = (short) 4; + this.value = 80f; + this.buffImmune[31] = false; + } + else if ((int) this.type == 52) + { + this.name = "Doctor Bones"; + this.width = (ushort) 18; + this.height = (ushort) 40; + this.aiStyle = (byte) 3; + this.damage = 20; + this.defense = 10; + this.lifeMax = 500; + this.soundHit = (short) 1; + this.soundKilled = (short) 2; + this.knockBackResist = 0.5f; + this.value = 1000f; + this.buffImmune[31] = false; + } + else if ((int) this.type == 53) + { + this.name = "The Groom"; + this.width = (ushort) 18; + this.height = (ushort) 40; + this.aiStyle = (byte) 3; + this.damage = 14; + this.defense = 8; + this.lifeMax = 200; + this.soundHit = (short) 1; + this.soundKilled = (short) 2; + this.knockBackResist = 0.5f; + this.value = 1000f; + this.buffImmune[31] = false; + } + else if ((int) this.type == 54) + { + this.townNPC = true; + this.friendly = true; + this.name = "Clothier"; + this.width = (ushort) 18; + this.height = (ushort) 40; + this.aiStyle = (byte) 7; + this.damage = 10; + this.defense = 15; + this.lifeMax = 250; + this.soundHit = (short) 1; + this.soundKilled = (short) 1; + this.knockBackResist = 0.5f; + } + else if ((int) this.type == 55) + { + this.noGravity = true; + this.name = "Goldfish"; + this.width = (ushort) 20; + this.height = (ushort) 18; + this.aiStyle = (byte) 16; + this.damage = 0; + this.defense = 0; + this.lifeMax = 5; + this.soundHit = (short) 1; + this.soundKilled = (short) 1; + this.knockBackResist = 0.5f; + } + else if ((int) this.type == 56) + { + this.noTileCollide = true; + this.noGravity = true; + this.name = "Snatcher"; + this.width = (ushort) 30; + this.height = (ushort) 30; + this.aiStyle = (byte) 13; + this.damage = 25; + this.defense = 10; + this.lifeMax = 60; + this.soundHit = (short) 1; + this.knockBackResist = 0.0f; + this.soundKilled = (short) 1; + this.value = 90f; + this.buffImmune[20] = true; + } + else if ((int) this.type == 156) + { + this.noTileCollide = true; + this.noGravity = true; + this.name = "Dragon Snatcher"; + this.width = (ushort) 30; + this.height = (ushort) 30; + this.aiStyle = (byte) 13; + this.damage = 30; + this.defense = 15; + this.lifeMax = 75; + this.soundHit = (short) 1; + this.knockBackResist = 0.0f; + this.soundKilled = (short) 1; + this.value = 90f; + this.buffImmune[20] = true; + } + else if ((int) this.type == 57) + { + this.noGravity = true; + this.name = "Corrupt Goldfish"; + this.width = (ushort) 18; + this.height = (ushort) 20; + this.aiStyle = (byte) 16; + this.damage = 30; + this.defense = 6; + this.lifeMax = 100; + this.soundHit = (short) 1; + this.soundKilled = (short) 1; + this.value = 500f; + } + else if ((int) this.type == 58) + { + this.npcSlots = 0.5f; + this.noGravity = true; + this.name = "Piranha"; + this.width = (ushort) 18; + this.height = (ushort) 20; + this.aiStyle = (byte) 16; + this.damage = 25; + this.defense = 2; + this.lifeMax = 30; + this.soundHit = (short) 1; + this.soundKilled = (short) 1; + this.value = 50f; + } + else if ((int) this.type == 59) + { + this.name = "Lava Slime"; + this.width = (ushort) 24; + this.height = (ushort) 18; + this.aiStyle = (byte) 1; + this.damage = 15; + this.defense = 10; + this.lifeMax = 50; + this.soundHit = (short) 1; + this.soundKilled = (short) 1; + this.scale = 1.1f; + this.alpha = (byte) 50; + this.lavaImmune = true; + this.value = 120f; + this.buffImmune[20] = true; + this.buffImmune[24] = true; + this.buffImmune[39] = true; + this.buffImmune[31] = false; + } + else if ((int) this.type == 60) + { + this.npcSlots = 0.5f; + this.name = "Hellbat"; + this.width = (ushort) 22; + this.height = (ushort) 18; + this.aiStyle = (byte) 14; + this.damage = 35; + this.defense = 8; + this.lifeMax = 46; + this.soundHit = (short) 1; + this.knockBackResist = 0.8f; + this.soundKilled = (short) 4; + this.value = 120f; + this.scale = 1.1f; + this.lavaImmune = true; + this.buffImmune[24] = true; + this.buffImmune[39] = true; + this.buffImmune[31] = false; + } + else if ((int) this.type == 61) + { + this.name = "Vulture"; + this.width = (ushort) 36; + this.height = (ushort) 36; + this.aiStyle = (byte) 17; + this.damage = 15; + this.defense = 4; + this.lifeMax = 40; + this.soundHit = (short) 1; + this.knockBackResist = 0.8f; + this.soundKilled = (short) 1; + this.value = 60f; + } + else if ((int) this.type == 62) + { + this.npcSlots = 2f; + this.name = "Demon"; + this.width = (ushort) 28; + this.height = (ushort) 48; + this.aiStyle = (byte) 14; + this.damage = 32; + this.defense = 8; + this.lifeMax = 120; + this.soundHit = (short) 1; + this.knockBackResist = 0.8f; + this.soundKilled = (short) 1; + this.value = 300f; + this.lavaImmune = true; + this.buffImmune[24] = true; + this.buffImmune[39] = true; + } + else if ((int) this.type == 165) + { + this.npcSlots = 2f; + this.name = "Arch Demon"; + this.width = (ushort) 28; + this.height = (ushort) 48; + this.aiStyle = (byte) 14; + this.damage = 42; + this.defense = 8; + this.lifeMax = 140; + this.soundHit = (short) 1; + this.knockBackResist = 0.8f; + this.soundKilled = (short) 1; + this.value = 300f; + this.lavaImmune = true; + this.buffImmune[24] = true; + this.buffImmune[39] = true; + } + else if ((int) this.type == 63) + { + this.noGravity = true; + this.name = "Blue Jellyfish"; + this.width = (ushort) 26; + this.height = (ushort) 26; + this.aiStyle = (byte) 18; + this.damage = 20; + this.defense = 2; + this.lifeMax = 30; + this.soundHit = (short) 1; + this.soundKilled = (short) 1; + this.value = 100f; + this.alpha = (byte) 20; + } + else if ((int) this.type == 64) + { + this.noGravity = true; + this.name = "Pink Jellyfish"; + this.width = (ushort) 26; + this.height = (ushort) 26; + this.aiStyle = (byte) 18; + this.damage = 30; + this.defense = 6; + this.lifeMax = 70; + this.soundHit = (short) 1; + this.soundKilled = (short) 1; + this.value = 100f; + this.alpha = (byte) 20; + } + else if ((int) this.type == 65) + { + this.noGravity = true; + this.name = "Shark"; + this.width = (ushort) 100; + this.height = (ushort) 24; + this.aiStyle = (byte) 16; + this.damage = 40; + this.defense = 2; + this.lifeMax = 300; + this.soundHit = (short) 1; + this.soundKilled = (short) 1; + this.value = 400f; + this.knockBackResist = 0.7f; + } + else if ((int) this.type == 148) + { + this.noGravity = true; + this.name = "Orka"; + this.width = (ushort) 100; + this.height = (ushort) 24; + this.aiStyle = (byte) 16; + this.damage = 30; + this.defense = 4; + this.lifeMax = 350; + this.soundHit = (short) 1; + this.soundKilled = (short) 1; + this.value = 400f; + this.knockBackResist = 0.6f; + } + else if ((int) this.type == 66) + { + this.npcSlots = 2f; + this.name = "Voodoo Demon"; + this.width = (ushort) 28; + this.height = (ushort) 48; + this.aiStyle = (byte) 14; + this.damage = 32; + this.defense = 8; + this.lifeMax = 140; + this.soundHit = (short) 1; + this.knockBackResist = 0.8f; + this.soundKilled = (short) 1; + this.value = 1000f; + this.lavaImmune = true; + this.buffImmune[24] = true; + this.buffImmune[39] = true; + } + else if ((int) this.type == 67) + { + this.name = "Crab"; + this.width = (ushort) 28; + this.height = (ushort) 20; + this.aiStyle = (byte) 3; + this.damage = 20; + this.defense = 10; + this.lifeMax = 40; + this.soundHit = (short) 1; + this.soundKilled = (short) 1; + this.value = 60f; + } + else if ((int) this.type == 68) + { + this.name = "Dungeon Guardian"; + this.width = (ushort) 80; + this.height = (ushort) 102; + this.aiStyle = (byte) 11; + this.damage = 9000; + this.defense = 9000; + this.lifeMax = 9999; + this.soundHit = (short) 2; + this.soundKilled = (short) 2; + this.noGravity = true; + this.noTileCollide = true; + this.knockBackResist = 0.0f; + this.buffImmune[20] = true; + this.buffImmune[24] = true; + this.buffImmune[39] = true; + } + else if ((int) this.type == 69) + { + this.name = "Antlion"; + this.width = (ushort) 24; + this.height = (ushort) 24; + this.aiStyle = (byte) 19; + this.damage = 10; + this.defense = 6; + this.lifeMax = 45; + this.soundHit = (short) 1; + this.soundKilled = (short) 1; + this.knockBackResist = 0.0f; + this.value = 60f; + this.behindTiles = true; + } + else if ((int) this.type == 147) + { + this.name = "Albino Antlion"; + this.width = (ushort) 24; + this.height = (ushort) 24; + this.aiStyle = (byte) 19; + this.damage = 12; + this.defense = 8; + this.lifeMax = 60; + this.soundHit = (short) 1; + this.soundKilled = (short) 1; + this.knockBackResist = 0.0f; + this.value = 60f; + this.behindTiles = true; + } + else if ((int) this.type == 70) + { + this.npcSlots = 0.3f; + this.name = "Spike Ball"; + this.width = (ushort) 34; + this.height = (ushort) 34; + this.aiStyle = (byte) 20; + this.damage = 32; + this.defense = 100; + this.lifeMax = 100; + this.soundHit = (short) 1; + this.soundKilled = (short) 1; + this.knockBackResist = 0.0f; + this.noGravity = true; + this.noTileCollide = true; + this.dontTakeDamage = true; + this.scale = 1.5f; + } + else if ((int) this.type == 71) + { + this.npcSlots = 2f; + this.name = "Dungeon Slime"; + this.width = (ushort) 36; + this.height = (ushort) 24; + this.aiStyle = (byte) 1; + this.damage = 30; + this.defense = 7; + this.lifeMax = 150; + this.soundHit = (short) 1; + this.soundKilled = (short) 1; + this.alpha = (byte) 60; + this.value = 150f; + this.scale = 1.25f; + this.knockBackResist = 0.6f; + this.buffImmune[20] = true; + this.buffImmune[31] = false; + } + else if ((int) this.type == 72) + { + this.npcSlots = 0.3f; + this.name = "Blazing Wheel"; + this.width = (ushort) 34; + this.height = (ushort) 34; + this.aiStyle = (byte) 21; + this.damage = 24; + this.defense = 100; + this.lifeMax = 100; + this.alpha = (byte) 100; + this.behindTiles = true; + this.soundHit = (short) 1; + this.soundKilled = (short) 1; + this.knockBackResist = 0.0f; + this.noGravity = true; + this.dontTakeDamage = true; + this.scale = 1.2f; + this.buffImmune[20] = true; + this.buffImmune[24] = true; + this.buffImmune[39] = true; + } + else if ((int) this.type == 73) + { + this.name = "Goblin Scout"; + this.scale = 0.95f; + this.width = (ushort) 18; + this.height = (ushort) 40; + this.aiStyle = (byte) 3; + this.damage = 20; + this.defense = 6; + this.lifeMax = 80; + this.soundHit = (short) 1; + this.soundKilled = (short) 1; + this.knockBackResist = 0.7f; + this.value = 200f; + this.buffImmune[31] = false; + } + else if ((int) this.type == 74) + { + this.name = "Bird"; + this.width = (ushort) 14; + this.height = (ushort) 14; + this.aiStyle = (byte) 24; + this.damage = 0; + this.defense = 0; + this.lifeMax = 5; + this.soundHit = (short) 1; + this.knockBackResist = 0.8f; + this.soundKilled = (short) 1; + } + else if ((int) this.type == 75) + { + this.noGravity = true; + this.name = "Pixie"; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.aiStyle = (byte) 22; + this.damage = 55; + this.defense = 20; + this.lifeMax = 150; + this.soundHit = (short) 5; + this.knockBackResist = 0.6f; + this.soundKilled = (short) 7; + this.value = 350f; + this.buffImmune[20] = true; + this.buffImmune[24] = true; + this.buffImmune[39] = true; + this.buffImmune[31] = false; + } + else if ((int) this.type == 77) + { + this.name = "Armored Skeleton"; + this.width = (ushort) 18; + this.height = (ushort) 40; + this.aiStyle = (byte) 3; + this.damage = 60; + this.defense = 36; + this.lifeMax = 340; + this.soundHit = (short) 2; + this.soundKilled = (short) 2; + this.knockBackResist = 0.4f; + this.value = 400f; + this.buffImmune[20] = true; + this.buffImmune[31] = false; + } + else if ((int) this.type == 78) + { + this.name = "Mummy"; + this.width = (ushort) 18; + this.height = (ushort) 40; + this.aiStyle = (byte) 3; + this.damage = 50; + this.defense = 16; + this.lifeMax = 130; + this.soundHit = (short) 1; + this.soundKilled = (short) 6; + this.knockBackResist = 0.6f; + this.value = 600f; + this.buffImmune[31] = false; + } + else if ((int) this.type == 79) + { + this.name = "Dark Mummy"; + this.width = (ushort) 18; + this.height = (ushort) 40; + this.aiStyle = (byte) 3; + this.damage = 60; + this.defense = 18; + this.lifeMax = 180; + this.soundHit = (short) 1; + this.soundKilled = (short) 6; + this.knockBackResist = 0.5f; + this.value = 700f; + this.buffImmune[31] = false; + } + else if ((int) this.type == 152) + { + this.name = "Shadow Mummy"; + this.width = (ushort) 18; + this.height = (ushort) 40; + this.aiStyle = (byte) 3; + this.damage = 60; + this.defense = 25; + this.lifeMax = 190; + this.soundHit = (short) 1; + this.soundKilled = (short) 6; + this.knockBackResist = 0.5f; + this.value = 700f; + this.buffImmune[31] = false; + } + else if ((int) this.type == 80) + { + this.name = "Light Mummy"; + this.width = (ushort) 18; + this.height = (ushort) 40; + this.aiStyle = (byte) 3; + this.damage = 55; + this.defense = 18; + this.lifeMax = 200; + this.soundHit = (short) 1; + this.soundKilled = (short) 6; + this.knockBackResist = 0.55f; + this.value = 700f; + this.buffImmune[31] = false; + } + else if ((int) this.type == 155) + { + this.name = "Spectral Mummy"; + this.width = (ushort) 18; + this.height = (ushort) 40; + this.aiStyle = (byte) 3; + this.damage = 65; + this.defense = 10; + this.lifeMax = 270; + this.soundHit = (short) 1; + this.soundKilled = (short) 6; + this.knockBackResist = 0.55f; + this.value = 700f; + this.buffImmune[31] = false; + } + else if ((int) this.type == 81) + { + this.name = "Corrupt Slime"; + this.width = (ushort) 40; + this.height = (ushort) 30; + this.aiStyle = (byte) 1; + this.damage = 55; + this.defense = 20; + this.lifeMax = 170; + this.soundHit = (short) 1; + this.soundKilled = (short) 1; + this.alpha = (byte) 55; + this.value = 400f; + this.scale = 1.1f; + this.buffImmune[20] = true; + this.buffImmune[31] = false; + } + else if ((int) this.type == 150) + { + this.name = "Shadow Slime"; + this.width = (ushort) 40; + this.height = (ushort) 30; + this.aiStyle = (byte) 1; + this.damage = 60; + this.defense = 25; + this.lifeMax = 180; + this.soundHit = (short) 1; + this.soundKilled = (short) 1; + this.alpha = (byte) 55; + this.value = 400f; + this.scale = 1.1f; + this.buffImmune[20] = true; + this.buffImmune[31] = false; + } + else if ((int) this.type == 82) + { + this.noGravity = true; + this.noTileCollide = true; + this.name = "Wraith"; + this.width = (ushort) 24; + this.height = (ushort) 44; + this.aiStyle = (byte) 22; + this.damage = 75; + this.defense = 18; + this.lifeMax = 200; + this.soundHit = (short) 1; + this.soundKilled = (short) 6; + this.alpha = (byte) 100; + this.value = 500f; + this.buffImmune[20] = true; + this.buffImmune[24] = true; + this.buffImmune[39] = true; + this.knockBackResist = 0.7f; + } + else if ((int) this.type == 83) + { + this.name = "Cursed Hammer"; + this.width = (ushort) 40; + this.height = (ushort) 40; + this.aiStyle = (byte) 23; + this.damage = 80; + this.defense = 18; + this.lifeMax = 200; + this.soundHit = (short) 4; + this.soundKilled = (short) 6; + this.value = 1000f; + this.buffImmune[20] = true; + this.buffImmune[24] = true; + this.buffImmune[39] = true; + this.knockBackResist = 0.4f; + } + else if ((int) this.type == 151) + { + this.name = "Shadow Hammer"; + this.width = (ushort) 40; + this.height = (ushort) 40; + this.aiStyle = (byte) 23; + this.damage = 95; + this.defense = 18; + this.lifeMax = 180; + this.soundHit = (short) 4; + this.soundKilled = (short) 6; + this.value = 1000f; + this.buffImmune[20] = true; + this.buffImmune[24] = true; + this.buffImmune[39] = true; + this.knockBackResist = 0.4f; + } + else if ((int) this.type == 84) + { + this.name = "Enchanted Sword"; + this.width = (ushort) 40; + this.height = (ushort) 40; + this.aiStyle = (byte) 23; + this.damage = 80; + this.defense = 18; + this.lifeMax = 200; + this.soundHit = (short) 4; + this.soundKilled = (short) 6; + this.value = 1000f; + this.buffImmune[20] = true; + this.buffImmune[24] = true; + this.buffImmune[39] = true; + this.knockBackResist = 0.4f; + } + else if ((int) this.type == 85) + { + this.name = "Mimic"; + this.width = (ushort) 24; + this.height = (ushort) 24; + this.aiStyle = (byte) 25; + this.damage = 80; + this.defense = 30; + this.lifeMax = 500; + this.soundHit = (short) 4; + this.soundKilled = (short) 6; + this.value = 100000f; + this.knockBackResist = 0.3f; + this.buffImmune[20] = true; + this.buffImmune[24] = true; + this.buffImmune[39] = true; + } + else if ((int) this.type == 86) + { + this.name = "Unicorn"; + this.width = (ushort) 46; + this.height = (ushort) 42; + this.aiStyle = (byte) 26; + this.damage = 65; + this.defense = 30; + this.lifeMax = 400; + this.soundHit = (short) 10; + this.soundKilled = (short) 1; + this.knockBackResist = 0.3f; + this.value = 1000f; + this.buffImmune[31] = false; + } + else if ((int) this.type == 87) + { + this.noTileCollide = true; + this.npcSlots = 5f; + this.name = "Wyvern Head"; + this.width = (ushort) 32; + this.height = (ushort) 32; + this.aiStyle = (byte) 6; + this.netAlways = true; + this.damage = 80; + this.defense = 10; + this.lifeMax = 4000; + this.soundHit = (short) 7; + this.soundKilled = (short) 8; + this.noGravity = true; + this.knockBackResist = 0.0f; + this.value = 10000f; + this.scale = 1f; + this.buffImmune[20] = true; + this.buffImmune[24] = true; + this.buffImmune[39] = true; + } + else if ((int) this.type == 159) + { + this.noTileCollide = true; + this.npcSlots = 5f; + this.name = "Arch Wyvern Head"; + this.width = (ushort) 32; + this.height = (ushort) 32; + this.aiStyle = (byte) 6; + this.netAlways = true; + this.damage = 100; + this.defense = 15; + this.lifeMax = 4700; + this.soundHit = (short) 7; + this.soundKilled = (short) 8; + this.noGravity = true; + this.knockBackResist = 0.0f; + this.value = 10000f; + this.scale = 1f; + this.buffImmune[20] = true; + this.buffImmune[24] = true; + this.buffImmune[39] = true; + } + else if ((int) this.type == 88) + { + this.noTileCollide = true; + this.name = "Wyvern Legs"; + this.width = (ushort) 32; + this.height = (ushort) 32; + this.aiStyle = (byte) 6; + this.netAlways = true; + this.damage = 40; + this.defense = 20; + this.lifeMax = 4000; + this.soundHit = (short) 7; + this.soundKilled = (short) 8; + this.noGravity = true; + this.knockBackResist = 0.0f; + this.value = 10000f; + this.scale = 1f; + this.buffImmune[20] = true; + this.buffImmune[24] = true; + this.buffImmune[39] = true; + } + else if ((int) this.type == 160) + { + this.noTileCollide = true; + this.name = "Arch Wyvern Legs"; + this.width = (ushort) 32; + this.height = (ushort) 32; + this.aiStyle = (byte) 6; + this.netAlways = true; + this.damage = 50; + this.defense = 25; + this.lifeMax = 4500; + this.soundHit = (short) 7; + this.soundKilled = (short) 8; + this.noGravity = true; + this.knockBackResist = 0.0f; + this.value = 10000f; + this.scale = 1f; + this.buffImmune[20] = true; + this.buffImmune[24] = true; + this.buffImmune[39] = true; + } + else if ((int) this.type == 89) + { + this.noTileCollide = true; + this.name = "Wyvern Body"; + this.width = (ushort) 32; + this.height = (ushort) 32; + this.aiStyle = (byte) 6; + this.netAlways = true; + this.damage = 40; + this.defense = 20; + this.lifeMax = 4000; + this.soundHit = (short) 7; + this.soundKilled = (short) 8; + this.noGravity = true; + this.knockBackResist = 0.0f; + this.value = 2000f; + this.scale = 1f; + this.buffImmune[20] = true; + this.buffImmune[24] = true; + this.buffImmune[39] = true; + } + else if ((int) this.type == 161) + { + this.noTileCollide = true; + this.name = "Arch Wyvern Body"; + this.width = (ushort) 32; + this.height = (ushort) 32; + this.aiStyle = (byte) 6; + this.netAlways = true; + this.damage = 45; + this.defense = 20; + this.lifeMax = 4300; + this.soundHit = (short) 7; + this.soundKilled = (short) 8; + this.noGravity = true; + this.knockBackResist = 0.0f; + this.value = 2000f; + this.scale = 1f; + this.buffImmune[20] = true; + this.buffImmune[24] = true; + this.buffImmune[39] = true; + } + else if ((int) this.type == 90) + { + this.noTileCollide = true; + this.name = "Wyvern Body 2"; + this.width = (ushort) 32; + this.height = (ushort) 32; + this.aiStyle = (byte) 6; + this.netAlways = true; + this.damage = 40; + this.defense = 20; + this.lifeMax = 4000; + this.soundHit = (short) 7; + this.soundKilled = (short) 8; + this.noGravity = true; + this.knockBackResist = 0.0f; + this.value = 10000f; + this.scale = 1f; + this.buffImmune[20] = true; + this.buffImmune[24] = true; + this.buffImmune[39] = true; + } + else if ((int) this.type == 162) + { + this.noTileCollide = true; + this.name = "Arch Wyvern Body 2"; + this.width = (ushort) 32; + this.height = (ushort) 32; + this.aiStyle = (byte) 6; + this.netAlways = true; + this.damage = 40; + this.defense = 20; + this.lifeMax = 4000; + this.soundHit = (short) 7; + this.soundKilled = (short) 8; + this.noGravity = true; + this.knockBackResist = 0.0f; + this.value = 10000f; + this.scale = 1f; + this.buffImmune[20] = true; + this.buffImmune[24] = true; + this.buffImmune[39] = true; + } + else if ((int) this.type == 91) + { + this.noTileCollide = true; + this.name = "Wyvern Body 3"; + this.width = (ushort) 32; + this.height = (ushort) 32; + this.aiStyle = (byte) 6; + this.netAlways = true; + this.damage = 40; + this.defense = 20; + this.lifeMax = 4000; + this.soundHit = (short) 7; + this.soundKilled = (short) 8; + this.noGravity = true; + this.knockBackResist = 0.0f; + this.value = 10000f; + this.scale = 1f; + this.buffImmune[20] = true; + this.buffImmune[24] = true; + this.buffImmune[39] = true; + } + else if ((int) this.type == 163) + { + this.noTileCollide = true; + this.name = "Arch Wyvern Body 3"; + this.width = (ushort) 32; + this.height = (ushort) 32; + this.aiStyle = (byte) 6; + this.netAlways = true; + this.damage = 45; + this.defense = 20; + this.lifeMax = 4300; + this.soundHit = (short) 7; + this.soundKilled = (short) 8; + this.noGravity = true; + this.knockBackResist = 0.0f; + this.value = 10000f; + this.scale = 1f; + this.buffImmune[20] = true; + this.buffImmune[24] = true; + this.buffImmune[39] = true; + } + else if ((int) this.type == 92) + { + this.noTileCollide = true; + this.name = "Wyvern Tail"; + this.width = (ushort) 32; + this.height = (ushort) 32; + this.aiStyle = (byte) 6; + this.netAlways = true; + this.damage = 40; + this.defense = 20; + this.lifeMax = 4000; + this.soundHit = (short) 7; + this.soundKilled = (short) 8; + this.noGravity = true; + this.knockBackResist = 0.0f; + this.value = 10000f; + this.scale = 1f; + this.buffImmune[20] = true; + this.buffImmune[24] = true; + this.buffImmune[39] = true; + } + else if ((int) this.type == 164) + { + this.noTileCollide = true; + this.name = "Arch Wyvern Tail"; + this.width = (ushort) 32; + this.height = (ushort) 32; + this.aiStyle = (byte) 6; + this.netAlways = true; + this.damage = 55; + this.defense = 15; + this.lifeMax = 4000; + this.soundHit = (short) 7; + this.soundKilled = (short) 8; + this.noGravity = true; + this.knockBackResist = 0.0f; + this.value = 10000f; + this.scale = 1f; + this.buffImmune[20] = true; + this.buffImmune[24] = true; + this.buffImmune[39] = true; + } + else if ((int) this.type == 93) + { + this.npcSlots = 0.5f; + this.name = "Giant Bat"; + this.width = (ushort) 26; + this.height = (ushort) 20; + this.aiStyle = (byte) 14; + this.damage = 70; + this.defense = 20; + this.lifeMax = 160; + this.soundHit = (short) 1; + this.knockBackResist = 0.75f; + this.soundKilled = (short) 4; + this.value = 400f; + this.buffImmune[31] = false; + } + else if ((int) this.type == 94) + { + this.npcSlots = 1f; + this.name = "Corruptor"; + this.width = (ushort) 44; + this.height = (ushort) 44; + this.aiStyle = (byte) 5; + this.damage = 60; + this.defense = 32; + this.lifeMax = 230; + this.soundHit = (short) 1; + this.soundKilled = (short) 1; + this.noGravity = true; + this.knockBackResist = 0.55f; + this.value = 500f; + } + else if ((int) this.type == 95) + { + this.name = "Digger Head"; + this.width = (ushort) 22; + this.height = (ushort) 22; + this.aiStyle = (byte) 6; + this.netAlways = true; + this.damage = 45; + this.defense = 10; + this.lifeMax = 200; + this.soundHit = (short) 1; + this.soundKilled = (short) 1; + this.noGravity = true; + this.noTileCollide = true; + this.knockBackResist = 0.0f; + this.behindTiles = true; + this.scale = 0.9f; + this.value = 300f; + } + else if ((int) this.type == 96) + { + this.name = "Digger Body"; + this.width = (ushort) 22; + this.height = (ushort) 22; + this.aiStyle = (byte) 6; + this.netAlways = true; + this.damage = 28; + this.defense = 20; + this.lifeMax = 200; + this.soundHit = (short) 1; + this.soundKilled = (short) 1; + this.noGravity = true; + this.noTileCollide = true; + this.knockBackResist = 0.0f; + this.behindTiles = true; + this.scale = 0.9f; + this.value = 300f; + } + else if ((int) this.type == 97) + { + this.name = "Digger Tail"; + this.width = (ushort) 22; + this.height = (ushort) 22; + this.aiStyle = (byte) 6; + this.netAlways = true; + this.damage = 26; + this.defense = 30; + this.lifeMax = 200; + this.soundHit = (short) 1; + this.soundKilled = (short) 1; + this.noGravity = true; + this.noTileCollide = true; + this.knockBackResist = 0.0f; + this.behindTiles = true; + this.scale = 0.9f; + this.value = 300f; + } + else if ((int) this.type == 98) + { + this.npcSlots = 3.5f; + this.name = "Seeker Head"; + this.width = (ushort) 22; + this.height = (ushort) 22; + this.aiStyle = (byte) 6; + this.netAlways = true; + this.damage = 70; + this.defense = 36; + this.lifeMax = 500; + this.soundHit = (short) 1; + this.soundKilled = (short) 1; + this.noGravity = true; + this.noTileCollide = true; + this.knockBackResist = 0.0f; + this.behindTiles = true; + this.value = 700f; + } + else if ((int) this.type == 99) + { + this.name = "Seeker Body"; + this.width = (ushort) 22; + this.height = (ushort) 22; + this.aiStyle = (byte) 6; + this.netAlways = true; + this.damage = 55; + this.defense = 40; + this.lifeMax = 500; + this.soundHit = (short) 1; + this.soundKilled = (short) 1; + this.noGravity = true; + this.noTileCollide = true; + this.knockBackResist = 0.0f; + this.behindTiles = true; + this.value = 700f; + } + else if ((int) this.type == 100) + { + this.name = "Seeker Tail"; + this.width = (ushort) 22; + this.height = (ushort) 22; + this.aiStyle = (byte) 6; + this.netAlways = true; + this.damage = 40; + this.defense = 44; + this.lifeMax = 500; + this.soundHit = (short) 1; + this.soundKilled = (short) 1; + this.noGravity = true; + this.noTileCollide = true; + this.knockBackResist = 0.0f; + this.behindTiles = true; + this.value = 700f; + } + else if ((int) this.type == 101) + { + this.noGravity = true; + this.noTileCollide = true; + this.behindTiles = true; + this.name = "Clinger"; + this.width = (ushort) 30; + this.height = (ushort) 30; + this.aiStyle = (byte) 13; + this.damage = 70; + this.defense = 30; + this.lifeMax = 320; + this.soundHit = (short) 1; + this.knockBackResist = 0.2f; + this.soundKilled = (short) 1; + this.value = 600f; + } + else if ((int) this.type == 102) + { + this.npcSlots = 0.5f; + this.noGravity = true; + this.name = "Angler Fish"; + this.width = (ushort) 18; + this.height = (ushort) 20; + this.aiStyle = (byte) 16; + this.damage = 80; + this.defense = 22; + this.lifeMax = 90; + this.soundHit = (short) 1; + this.soundKilled = (short) 1; + this.value = 500f; + } + else if ((int) this.type == 103) + { + this.noGravity = true; + this.name = "Green Jellyfish"; + this.width = (ushort) 26; + this.height = (ushort) 26; + this.aiStyle = (byte) 18; + this.damage = 80; + this.defense = 30; + this.lifeMax = 120; + this.soundHit = (short) 1; + this.soundKilled = (short) 1; + this.value = 800f; + this.alpha = (byte) 20; + } + else if ((int) this.type == 104) + { + this.name = "Werewolf"; + this.width = (ushort) 18; + this.height = (ushort) 40; + this.aiStyle = (byte) 3; + this.damage = 70; + this.defense = 40; + this.lifeMax = 400; + this.soundHit = (short) 6; + this.soundKilled = (short) 1; + this.knockBackResist = 0.4f; + this.value = 1000f; + this.buffImmune[31] = false; + } + else if ((int) this.type == 105) + { + this.friendly = true; + this.name = "Bound Goblin"; + this.width = (ushort) 18; + this.height = (ushort) 34; + this.aiStyle = (byte) 0; + this.damage = 10; + this.defense = 15; + this.lifeMax = 250; + this.soundHit = (short) 1; + this.soundKilled = (short) 1; + this.knockBackResist = 0.5f; + this.scale = 0.9f; + } + else if ((int) this.type == 106) + { + this.friendly = true; + this.name = "Bound Wizard"; + this.width = (ushort) 18; + this.height = (ushort) 40; + this.aiStyle = (byte) 0; + this.damage = 10; + this.defense = 15; + this.lifeMax = 250; + this.soundHit = (short) 1; + this.soundKilled = (short) 1; + this.knockBackResist = 0.5f; + } + else if ((int) this.type == 107) + { + this.townNPC = true; + this.friendly = true; + this.name = "Goblin Tinkerer"; + this.width = (ushort) 18; + this.height = (ushort) 40; + this.aiStyle = (byte) 7; + this.damage = 10; + this.defense = 15; + this.lifeMax = 250; + this.soundHit = (short) 1; + this.soundKilled = (short) 1; + this.knockBackResist = 0.5f; + this.scale = 0.9f; + } + else if ((int) this.type == 108) + { + this.townNPC = true; + this.friendly = true; + this.name = "Wizard"; + this.width = (ushort) 18; + this.height = (ushort) 40; + this.aiStyle = (byte) 7; + this.damage = 10; + this.defense = 15; + this.lifeMax = 250; + this.soundHit = (short) 1; + this.soundKilled = (short) 1; + this.knockBackResist = 0.5f; + } + else if ((int) this.type == 109) + { + this.name = "Clown"; + this.width = (ushort) 34; + this.height = (ushort) 78; + this.aiStyle = (byte) 3; + this.damage = 50; + this.defense = 20; + this.lifeMax = 400; + this.soundHit = (short) 1; + this.soundKilled = (short) 2; + this.knockBackResist = 0.4f; + this.value = 8000f; + } + else if ((int) this.type == 110) + { + this.name = "Skeleton Archer"; + this.width = (ushort) 18; + this.height = (ushort) 40; + this.aiStyle = (byte) 3; + this.damage = 55; + this.defense = 28; + this.lifeMax = 260; + this.soundHit = (short) 2; + this.soundKilled = (short) 2; + this.knockBackResist = 0.55f; + this.value = 400f; + this.buffImmune[20] = true; + this.buffImmune[31] = false; + } + else if ((int) this.type == 111) + { + this.name = "Goblin Archer"; + this.scale = 0.95f; + this.width = (ushort) 18; + this.height = (ushort) 40; + this.aiStyle = (byte) 3; + this.damage = 20; + this.defense = 6; + this.lifeMax = 80; + this.soundHit = (short) 1; + this.soundKilled = (short) 1; + this.knockBackResist = 0.7f; + this.value = 200f; + this.buffImmune[31] = false; + } + else if ((int) this.type == 112) + { + this.name = "Vile Spit"; + this.width = (ushort) 16; + this.height = (ushort) 16; + this.aiStyle = (byte) 9; + this.damage = 65; + this.defense = 0; + this.lifeMax = 1; + this.soundHit = (short) 0; + this.soundKilled = (short) 9; + this.noGravity = true; + this.noTileCollide = true; + this.knockBackResist = 0.0f; + this.scale = 0.9f; + this.alpha = (byte) 80; + } + else if ((int) this.type == 113) + { + this.npcSlots = 10f; + this.name = "Wall of Flesh"; + this.width = (ushort) 100; + this.height = (ushort) 100; + this.aiStyle = (byte) 27; + this.damage = 50; + this.defense = 12; + this.lifeMax = 8000; + this.soundHit = (short) 8; + this.soundKilled = (short) 10; + this.noGravity = true; + this.noTileCollide = true; + this.behindTiles = true; + this.knockBackResist = 0.0f; + this.scale = 1.2f; + this.boss = true; + this.buffImmune[20] = true; + this.buffImmune[24] = true; + this.buffImmune[39] = true; + this.value = 80000f; + } + else if ((int) this.type == 114) + { + this.name = "Wall of Flesh Eye"; + this.width = (ushort) 100; + this.height = (ushort) 100; + this.aiStyle = (byte) 28; + this.damage = 50; + this.defense = 0; + this.lifeMax = 8000; + this.soundHit = (short) 8; + this.soundKilled = (short) 10; + this.noGravity = true; + this.noTileCollide = true; + this.behindTiles = true; + this.knockBackResist = 0.0f; + this.scale = 1.2f; + this.buffImmune[20] = true; + this.buffImmune[24] = true; + this.buffImmune[39] = true; + this.value = 80000f; + } + else if ((int) this.type == 115) + { + this.name = "The Hungry"; + this.width = (ushort) 30; + this.height = (ushort) 30; + this.aiStyle = (byte) 29; + this.damage = 30; + this.defense = 10; + this.lifeMax = 240; + this.soundHit = (short) 9; + this.soundKilled = (short) 11; + this.noGravity = true; + this.behindTiles = true; + this.noTileCollide = true; + this.knockBackResist = 1.1f; + } + else if ((int) this.type == 116) + { + this.name = "The Hungry II"; + this.width = (ushort) 30; + this.height = (ushort) 32; + this.aiStyle = (byte) 2; + this.damage = 30; + this.defense = 6; + this.lifeMax = 80; + this.soundHit = (short) 9; + this.knockBackResist = 0.8f; + this.soundKilled = (short) 12; + } + else if ((int) this.type == 117) + { + this.name = "Leech Head"; + this.width = (ushort) 14; + this.height = (ushort) 14; + this.aiStyle = (byte) 6; + this.netAlways = true; + this.damage = 26; + this.defense = 2; + this.lifeMax = 60; + this.soundHit = (short) 9; + this.soundKilled = (short) 12; + this.noGravity = true; + this.noTileCollide = true; + this.knockBackResist = 0.0f; + this.behindTiles = true; + } + else if ((int) this.type == 118) + { + this.name = "Leech Body"; + this.width = (ushort) 14; + this.height = (ushort) 14; + this.aiStyle = (byte) 6; + this.netAlways = true; + this.damage = 22; + this.defense = 6; + this.lifeMax = 60; + this.soundHit = (short) 9; + this.soundKilled = (short) 12; + this.noGravity = true; + this.noTileCollide = true; + this.knockBackResist = 0.0f; + this.behindTiles = true; + } + else if ((int) this.type == 119) + { + this.name = "Leech Tail"; + this.width = (ushort) 14; + this.height = (ushort) 14; + this.aiStyle = (byte) 6; + this.netAlways = true; + this.damage = 18; + this.defense = 10; + this.lifeMax = 60; + this.soundHit = (short) 9; + this.soundKilled = (short) 12; + this.noGravity = true; + this.noTileCollide = true; + this.knockBackResist = 0.0f; + this.behindTiles = true; + } + else if ((int) this.type == 120) + { + this.name = "Chaos Elemental"; + this.width = (ushort) 18; + this.height = (ushort) 40; + this.aiStyle = (byte) 3; + this.damage = 40; + this.defense = 30; + this.lifeMax = 370; + this.soundHit = (short) 1; + this.soundKilled = (short) 6; + this.knockBackResist = 0.4f; + this.value = 600f; + this.buffImmune[20] = true; + this.buffImmune[24] = true; + this.buffImmune[39] = true; + this.buffImmune[31] = false; + } + else if ((int) this.type == 154) + { + this.name = "Spectral Elemental"; + this.width = (ushort) 18; + this.height = (ushort) 40; + this.aiStyle = (byte) 3; + this.damage = 50; + this.defense = 35; + this.lifeMax = 400; + this.soundHit = (short) 1; + this.soundKilled = (short) 6; + this.knockBackResist = 0.4f; + this.value = 600f; + this.buffImmune[20] = true; + this.buffImmune[24] = true; + this.buffImmune[39] = true; + this.buffImmune[31] = false; + } + else if ((int) this.type == 121) + { + this.name = "Slimer"; + this.width = (ushort) 40; + this.height = (ushort) 30; + this.aiStyle = (byte) 14; + this.damage = 45; + this.defense = 20; + this.lifeMax = 60; + this.soundHit = (short) 1; + this.alpha = (byte) 55; + this.knockBackResist = 0.8f; + this.scale = 1.1f; + this.buffImmune[20] = true; + this.buffImmune[31] = false; + } + else if ((int) this.type == 122) + { + this.noGravity = true; + this.name = "Gastropod"; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.aiStyle = (byte) 22; + this.damage = 60; + this.defense = 22; + this.lifeMax = 220; + this.soundHit = (short) 1; + this.knockBackResist = 0.8f; + this.soundKilled = (short) 1; + this.value = 600f; + this.buffImmune[20] = true; + } + else if ((int) this.type == 153) + { + this.noGravity = true; + this.name = "Spectral Gastropod"; + this.width = (ushort) 20; + this.height = (ushort) 20; + this.aiStyle = (byte) 22; + this.damage = 60; + this.defense = 22; + this.lifeMax = 220; + this.soundHit = (short) 1; + this.knockBackResist = 0.8f; + this.soundKilled = (short) 1; + this.value = 600f; + this.buffImmune[20] = true; + } + else if ((int) this.type == 123) + { + this.friendly = true; + this.name = "Bound Mechanic"; + this.width = (ushort) 18; + this.height = (ushort) 34; + this.aiStyle = (byte) 0; + this.damage = 10; + this.defense = 15; + this.lifeMax = 250; + this.soundHit = (short) 1; + this.soundKilled = (short) 1; + this.knockBackResist = 0.5f; + this.scale = 0.9f; + } + else if ((int) this.type == 124) + { + this.townNPC = true; + this.friendly = true; + this.name = "Mechanic"; + this.width = (ushort) 18; + this.height = (ushort) 40; + this.aiStyle = (byte) 7; + this.damage = 10; + this.defense = 15; + this.lifeMax = 250; + this.soundHit = (short) 1; + this.soundKilled = (short) 1; + this.knockBackResist = 0.5f; + } + else if ((int) this.type == 125) + { + this.name = "Retinazer"; + this.width = (ushort) 100; + this.height = (ushort) 110; + this.aiStyle = (byte) 30; + this.damage = 50; + this.defense = 10; + this.lifeMax = 24000; + this.soundHit = (short) 1; + this.soundKilled = (short) 14; + this.knockBackResist = 0.0f; + this.noGravity = true; + this.noTileCollide = true; + this.timeLeft = 22500; + this.boss = true; + this.value = 120000f; + this.npcSlots = 5f; + } + else if ((int) this.type == 126) + { + this.name = "Spazmatism"; + this.width = (ushort) 100; + this.height = (ushort) 110; + this.aiStyle = (byte) 31; + this.damage = 50; + this.defense = 10; + this.lifeMax = 24000; + this.soundHit = (short) 1; + this.soundKilled = (short) 14; + this.knockBackResist = 0.0f; + this.noGravity = true; + this.noTileCollide = true; + this.timeLeft = 22500; + this.boss = true; + this.value = 120000f; + this.npcSlots = 5f; + } + else if ((int) this.type == (int) sbyte.MaxValue) + { + this.name = "Skeletron Prime"; + this.width = (ushort) 80; + this.height = (ushort) 102; + this.aiStyle = (byte) 32; + this.damage = 50; + this.defense = 25; + this.lifeMax = 30000; + this.soundHit = (short) 4; + this.soundKilled = (short) 14; + this.noGravity = true; + this.noTileCollide = true; + this.value = 120000f; + this.knockBackResist = 0.0f; + this.boss = true; + this.npcSlots = 6f; + this.buffImmune[20] = true; + this.buffImmune[24] = true; + this.buffImmune[39] = true; + } + else if ((int) this.type == 128) + { + this.name = "Prime Cannon"; + this.width = (ushort) 52; + this.height = (ushort) 52; + this.aiStyle = (byte) 35; + this.damage = 30; + this.defense = 25; + this.lifeMax = 7000; + this.soundHit = (short) 4; + this.soundKilled = (short) 14; + this.noGravity = true; + this.noTileCollide = true; + this.knockBackResist = 0.0f; + this.buffImmune[20] = true; + this.buffImmune[24] = true; + this.netAlways = true; + } + else if ((int) this.type == 129) + { + this.name = "Prime Saw"; + this.width = (ushort) 52; + this.height = (ushort) 52; + this.aiStyle = (byte) 33; + this.damage = 52; + this.defense = 40; + this.lifeMax = 10000; + this.soundHit = (short) 4; + this.soundKilled = (short) 14; + this.noGravity = true; + this.noTileCollide = true; + this.knockBackResist = 0.0f; + this.buffImmune[20] = true; + this.buffImmune[24] = true; + this.netAlways = true; + } + else if ((int) this.type == 130) + { + this.name = "Prime Vice"; + this.width = (ushort) 52; + this.height = (ushort) 52; + this.aiStyle = (byte) 34; + this.damage = 45; + this.defense = 35; + this.lifeMax = 10000; + this.soundHit = (short) 4; + this.soundKilled = (short) 14; + this.noGravity = true; + this.noTileCollide = true; + this.knockBackResist = 0.0f; + this.buffImmune[20] = true; + this.buffImmune[24] = true; + this.netAlways = true; + } + else if ((int) this.type == 131) + { + this.name = "Prime Laser"; + this.width = (ushort) 52; + this.height = (ushort) 52; + this.aiStyle = (byte) 36; + this.damage = 29; + this.defense = 20; + this.lifeMax = 6000; + this.soundHit = (short) 4; + this.soundKilled = (short) 14; + this.noGravity = true; + this.noTileCollide = true; + this.knockBackResist = 0.0f; + this.buffImmune[20] = true; + this.buffImmune[24] = true; + this.netAlways = true; + } + else if ((int) this.type == 132) + { + this.name = "Bald Zombie"; + this.width = (ushort) 18; + this.height = (ushort) 40; + this.aiStyle = (byte) 3; + this.damage = 14; + this.defense = 6; + this.lifeMax = 45; + this.soundHit = (short) 1; + this.soundKilled = (short) 2; + this.knockBackResist = 0.5f; + this.value = 60f; + this.buffImmune[31] = false; + } + else if ((int) this.type == 133) + { + this.name = "Wandering Eye"; + this.width = (ushort) 30; + this.height = (ushort) 32; + this.aiStyle = (byte) 2; + this.damage = 40; + this.defense = 20; + this.lifeMax = 300; + this.soundHit = (short) 1; + this.knockBackResist = 0.8f; + this.soundKilled = (short) 1; + this.value = 500f; + this.buffImmune[31] = false; + } + else if ((int) this.type == 134) + { + this.npcSlots = 5f; + this.name = "The Destroyer"; + this.width = (ushort) 38; + this.height = (ushort) 38; + this.aiStyle = (byte) 37; + this.damage = 60; + this.defense = 0; + this.lifeMax = 80000; + this.soundHit = (short) 4; + this.soundKilled = (short) 14; + this.noGravity = true; + this.noTileCollide = true; + this.knockBackResist = 0.0f; + this.behindTiles = true; + this.value = 120000f; + this.scale = 1.25f; + this.boss = true; + this.netAlways = true; + this.buffImmune[20] = true; + this.buffImmune[24] = true; + this.buffImmune[39] = true; + } + else if ((int) this.type == 135) + { + this.npcSlots = 5f; + this.name = "The Destroyer Body"; + this.width = (ushort) 38; + this.height = (ushort) 38; + this.aiStyle = (byte) 37; + this.damage = 40; + this.defense = 30; + this.lifeMax = 80000; + this.soundHit = (short) 4; + this.soundKilled = (short) 14; + this.noGravity = true; + this.noTileCollide = true; + this.knockBackResist = 0.0f; + this.behindTiles = true; + this.netAlways = true; + this.scale = 1.25f; + this.buffImmune[20] = true; + this.buffImmune[24] = true; + this.buffImmune[39] = true; + } + else if ((int) this.type == 136) + { + this.npcSlots = 5f; + this.name = "The Destroyer Tail"; + this.width = (ushort) 38; + this.height = (ushort) 38; + this.aiStyle = (byte) 37; + this.damage = 20; + this.defense = 35; + this.lifeMax = 80000; + this.soundHit = (short) 4; + this.soundKilled = (short) 14; + this.noGravity = true; + this.noTileCollide = true; + this.knockBackResist = 0.0f; + this.behindTiles = true; + this.scale = 1.25f; + this.netAlways = true; + this.buffImmune[20] = true; + this.buffImmune[24] = true; + this.buffImmune[39] = true; + } + else if ((int) this.type == 137) + { + this.name = "Illuminant Bat"; + this.width = (ushort) 26; + this.height = (ushort) 20; + this.aiStyle = (byte) 14; + this.damage = 75; + this.defense = 30; + this.lifeMax = 200; + this.soundHit = (short) 1; + this.knockBackResist = 0.75f; + this.soundKilled = (short) 6; + this.value = 500f; + this.buffImmune[20] = true; + this.buffImmune[24] = true; + this.buffImmune[39] = true; + this.buffImmune[31] = false; + } + else if ((int) this.type == 138) + { + this.name = "Illuminant Slime"; + this.width = (ushort) 24; + this.height = (ushort) 18; + this.aiStyle = (byte) 1; + this.damage = 70; + this.defense = 30; + this.lifeMax = 180; + this.soundHit = (short) 1; + this.soundKilled = (short) 6; + this.alpha = (byte) 100; + this.value = 400f; + this.buffImmune[20] = true; + this.buffImmune[24] = true; + this.buffImmune[39] = true; + this.knockBackResist = 0.85f; + this.scale = 1.05f; + this.buffImmune[31] = false; + } + else if ((int) this.type == 139) + { + this.npcSlots = 1f; + this.name = "Probe"; + this.width = (ushort) 30; + this.height = (ushort) 30; + this.aiStyle = (byte) 5; + this.damage = 50; + this.defense = 20; + this.lifeMax = 200; + this.soundHit = (short) 4; + this.soundKilled = (short) 14; + this.noGravity = true; + this.knockBackResist = 0.8f; + this.noTileCollide = true; + } + else if ((int) this.type == 140) + { + this.name = "Possessed Armor"; + this.width = (ushort) 18; + this.height = (ushort) 40; + this.aiStyle = (byte) 3; + this.damage = 55; + this.defense = 28; + this.lifeMax = 260; + this.soundHit = (short) 4; + this.soundKilled = (short) 6; + this.knockBackResist = 0.4f; + this.value = 400f; + this.buffImmune[20] = true; + this.buffImmune[31] = false; + this.buffImmune[24] = true; + } + else if ((int) this.type == 141) + { + this.name = "Toxic Sludge"; + this.width = (ushort) 34; + this.height = (ushort) 28; + this.aiStyle = (byte) 1; + this.damage = 50; + this.defense = 18; + this.lifeMax = 150; + this.soundHit = (short) 1; + this.soundKilled = (short) 1; + this.alpha = (byte) 55; + this.value = 400f; + this.scale = 1.1f; + this.buffImmune[20] = true; + this.buffImmune[31] = false; + this.knockBackResist = 0.8f; + } + else if ((int) this.type == 142) + { + this.townNPC = true; + this.friendly = true; + this.name = "Santa Claus"; + this.width = (ushort) 18; + this.height = (ushort) 40; + this.aiStyle = (byte) 7; + this.damage = 10; + this.defense = 15; + this.lifeMax = 250; + this.soundHit = (short) 1; + this.soundKilled = (short) 1; + this.knockBackResist = 0.5f; + } + else if ((int) this.type == 143) + { + this.name = "Snowman Gangsta"; + this.width = (ushort) 26; + this.height = (ushort) 40; + this.aiStyle = (byte) 38; + this.damage = 50; + this.defense = 20; + this.lifeMax = 200; + this.soundHit = (short) 11; + this.soundKilled = (short) 15; + this.knockBackResist = 0.6f; + this.value = 400f; + this.buffImmune[20] = true; + this.buffImmune[31] = false; + this.buffImmune[24] = true; + this.buffImmune[39] = true; + } + else if ((int) this.type == 144) + { + this.name = "Mister Stabby"; + this.width = (ushort) 26; + this.height = (ushort) 40; + this.aiStyle = (byte) 38; + this.damage = 65; + this.defense = 26; + this.lifeMax = 240; + this.soundHit = (short) 11; + this.soundKilled = (short) 15; + this.knockBackResist = 0.6f; + this.value = 400f; + this.buffImmune[20] = true; + this.buffImmune[31] = false; + this.buffImmune[24] = true; + this.buffImmune[39] = true; + } + else if ((int) this.type == 145) + { + this.name = "Snow Balla"; + this.width = (ushort) 26; + this.height = (ushort) 40; + this.aiStyle = (byte) 38; + this.damage = 55; + this.defense = 22; + this.lifeMax = 220; + this.soundHit = (short) 11; + this.soundKilled = (short) 15; + this.knockBackResist = 0.6f; + this.value = 400f; + this.buffImmune[20] = true; + this.buffImmune[31] = false; + this.buffImmune[24] = true; + this.buffImmune[39] = true; + } + this.frameY = (short) 0; + this.frameHeight = (short) (SpriteSheet<_sheetSprites>.src[1088 + (int) this.type].Height / (int) NPC.npcFrameCount[(int) this.type]); + if (scaleOverride > 0.0) + { + int num1 = (int) ((double) this.width * (double) this.scale); + int num2 = (int) ((double) this.height * (double) this.scale); + this.position.X += (float) (num1 >> 1); + this.position.Y += (float) num2; + this.scale = (float) scaleOverride; + this.width = (ushort) ((double) this.width * (double) this.scale); + this.height = (ushort) ((double) this.height * (double) this.scale); + if ((int) this.height == 16 || (int) this.height == 32) + ++this.height; + this.position.X -= (float) ((int) this.width >> 1); + this.position.Y -= (float) this.height; + } + else + { + this.width = (ushort) ((double) this.width * (double) this.scale); + this.height = (ushort) ((double) this.height * (double) this.scale); + } + this.aabb.X = (int) this.position.X; + this.aabb.Y = (int) this.position.Y; + this.aabb.Width = (int) this.width; + this.aabb.Height = (int) this.height; + this.healthBarLife = this.life = this.lifeMax; + this.defDamage = this.damage; + this.defDefense = (short) this.defense; + this.displayName = Lang.npcName((int) this.netID); + } + + private void BoundAI() + { + if (Main.netMode != 1) + { + for (int index = 0; index < 8; ++index) + { + if ((int) Main.player[index].active != 0 && (int) Main.player[index].talkNPC == (int) this.whoAmI) + { + if ((int) this.type == 105) + { + this.Transform(107); + return; + } + else if ((int) this.type == 106) + { + this.Transform(108); + return; + } + else if ((int) this.type == 123) + { + this.Transform(124); + return; + } + } + } + } + this.velocity.X *= 0.93f; + if ((double) this.velocity.X > -0.1 && (double) this.velocity.X < 0.1) + this.velocity.X = 0.0f; + this.TargetClosest(true); + this.spriteDirection = this.direction; + } + + private unsafe void SlimeAI() + { + bool flag = !Main.gameTime.dayTime || this.life != this.lifeMax || this.aabb.Y > Main.worldSurface << 4; + if ((int) this.type == 81) + { + flag = true; + if (Main.rand.Next(32) == 0) + { + Dust* dustPtr = Main.dust.NewDust(14, ref this.aabb, 0.0, 0.0, (int) this.alpha, this.color, 1.0); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.X *= 0.3f; + dustPtr->velocity.Y *= 0.3f; + } + } + } + else if ((int) this.type == 59) + { + Lighting.addLight(this.aabb.X + ((int) this.width >> 1) >> 4, this.aabb.Y + ((int) this.height >> 1) >> 4, new Vector3(1f, 0.3f, 0.1f)); + Dust* dustPtr = Main.dust.NewDust(6, ref this.aabb, (double) this.velocity.X * 0.200000002980232, (double) this.velocity.Y * 0.200000002980232, 100, new Color(), 1.70000004768372); + if ((IntPtr) dustPtr != IntPtr.Zero) + dustPtr->noGravity = true; + } + if ((double) this.ai2 > 1.0) + --this.ai2; + if (this.wet) + { + if (this.collideY) + this.velocity.Y = -2f; + if ((double) this.velocity.Y < 0.0) + { + if ((double) this.ai3 == (double) this.position.X) + { + this.direction = -this.direction; + this.ai2 = 200f; + } + } + else if ((double) this.velocity.Y > 0.0) + this.ai3 = this.position.X; + if ((int) this.type == 59) + { + if ((double) this.velocity.Y > 2.0) + this.velocity.Y *= 0.9f; + else if ((int) this.directionY < 0) + this.velocity.Y -= 0.8f; + this.velocity.Y -= 0.5f; + if ((double) this.velocity.Y < -10.0) + this.velocity.Y = -10f; + } + else + { + if ((double) this.velocity.Y > 2.0) + this.velocity.Y *= 0.9f; + this.velocity.Y -= 0.5f; + if ((double) this.velocity.Y < -4.0) + this.velocity.Y = -4f; + } + if ((double) this.ai2 == 1.0 && flag) + this.TargetClosest(true); + } + this.aiAction = (byte) 0; + if ((double) this.ai2 == 0.0) + { + this.ai0 = -100f; + this.ai2 = 1f; + this.TargetClosest(true); + } + if ((double) this.velocity.Y == 0.0) + { + if ((double) this.ai3 == (double) this.position.X) + { + this.direction = -this.direction; + this.ai2 = 200f; + } + this.ai3 = 0.0f; + this.velocity.X *= 0.8f; + if ((double) this.velocity.X > -0.1 && (double) this.velocity.X < 0.1) + this.velocity.X = 0.0f; + if (flag) + ++this.ai0; + ++this.ai0; + if ((int) this.type == 59) + this.ai0 += 2f; + else if ((int) this.type == 71) + this.ai0 += 3f; + else if ((int) this.type == 138) + this.ai0 += 2f; + else if ((int) this.type == 81) + { + if ((double) this.scale >= 0.0) + this.ai0 += 4f; + else + ++this.ai0; + } + if ((double) this.ai0 >= 0.0) + { + this.netUpdate = true; + if (flag && (double) this.ai2 == 1.0) + this.TargetClosest(true); + if ((double) this.ai1 == 2.0) + { + if ((int) this.type == 59) + { + this.velocity.X += 3.5f * (float) this.direction; + this.velocity.Y = -10f; + } + else + { + this.velocity.X += (float) (3 * (int) this.direction); + this.velocity.Y = -8f; + } + this.ai0 = -200f; + this.ai1 = 0.0f; + this.ai3 = this.position.X; + } + else + { + this.velocity.Y = -6f; + this.velocity.X += (float) (2 * (int) this.direction); + if ((int) this.type == 59) + this.velocity.X += (float) (2 * (int) this.direction); + this.ai0 = -120f; + ++this.ai1; + } + if ((int) this.type != 141) + return; + this.velocity.Y *= 1.3f; + this.velocity.X *= 1.2f; + } + else + { + if ((double) this.ai0 < -30.0) + return; + this.aiAction = (byte) 1; + } + } + else + { + if ((int) this.target >= 8 || ((int) this.direction != 1 || (double) this.velocity.X >= 3.0) && ((int) this.direction != -1 || (double) this.velocity.X <= -3.0)) + return; + if ((int) this.direction == -1 && (double) this.velocity.X < 0.1 || (int) this.direction == 1 && (double) this.velocity.X > -0.1) + this.velocity.X += 0.2f * (float) this.direction; + else + this.velocity.X *= 0.93f; + } + } + + private unsafe void FloatingEyeballAI() + { + this.noGravity = true; + if (this.collideX) + { + this.velocity.X = this.oldVelocity.X * -0.5f; + if ((int) this.direction == -1 && (double) this.velocity.X > 0.0 && (double) this.velocity.X < 2.0) + this.velocity.X = 2f; + else if ((int) this.direction == 1 && (double) this.velocity.X < 0.0 && (double) this.velocity.X > -2.0) + this.velocity.X = -2f; + } + if (this.collideY) + { + this.velocity.Y = this.oldVelocity.Y * -0.5f; + if ((double) this.velocity.Y > 0.0 && (double) this.velocity.Y < 1.0) + this.velocity.Y = 1f; + else if ((double) this.velocity.Y < 0.0 && (double) this.velocity.Y > -1.0) + this.velocity.Y = -1f; + } + if (((int) this.type == 2 || (int) this.type == 133) && (Main.gameTime.dayTime && this.aabb.Y <= Main.worldSurfacePixels)) + { + if (this.timeLeft > 10) + this.timeLeft = 10; + this.directionY = (double) this.velocity.Y > 0.0 ? (sbyte) 1 : (sbyte) -1; + this.direction = (double) this.velocity.X > 0.0 ? (sbyte) 1 : (sbyte) -1; + } + else + this.TargetClosest(true); + if ((int) this.type == 116) + { + this.TargetClosest(true); + Lighting.addLight(this.aabb.X + ((int) this.width >> 1) >> 4, this.aabb.Y + ((int) this.height >> 1) >> 4, new Vector3(0.3f, 0.2f, 0.1f)); + if ((int) this.direction == -1 && (double) this.velocity.X > -6.0) + { + this.velocity.X -= 0.1f; + if ((double) this.velocity.X > 6.0) + this.velocity.X -= 0.1f; + else if ((double) this.velocity.X > 0.0) + this.velocity.X -= 0.2f; + if ((double) this.velocity.X < -6.0) + this.velocity.X = -6f; + } + else if ((int) this.direction == 1 && (double) this.velocity.X < 6.0) + { + this.velocity.X += 0.1f; + if ((double) this.velocity.X < -6.0) + this.velocity.X += 0.1f; + else if ((double) this.velocity.X < 0.0) + this.velocity.X += 0.2f; + if ((double) this.velocity.X > 6.0) + this.velocity.X = 6f; + } + if ((int) this.directionY == -1 && (double) this.velocity.Y > -2.5) + { + this.velocity.Y -= 0.04f; + if ((double) this.velocity.Y > 2.5) + this.velocity.Y -= 0.05f; + else if ((double) this.velocity.Y > 0.0) + this.velocity.Y -= 0.15f; + if ((double) this.velocity.Y < -2.5) + this.velocity.Y = -2.5f; + } + else if ((int) this.directionY == 1 && (double) this.velocity.Y < 1.5) + { + this.velocity.Y += 0.04f; + if ((double) this.velocity.Y < -2.5) + this.velocity.Y += 0.05f; + else if ((double) this.velocity.Y < 0.0) + this.velocity.Y += 0.15f; + if ((double) this.velocity.Y > 2.5) + this.velocity.Y = 2.5f; + } + if (Main.rand.Next(40) == 0) + { + Dust* dustPtr = Main.dust.NewDust(this.aabb.X, this.aabb.Y + ((int) this.height >> 2), (int) this.width, (int) this.height >> 1, 5, (double) this.velocity.X, 2.0, 0, new Color(), 1.0); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.X *= 0.5f; + dustPtr->velocity.Y *= 0.1f; + } + } + } + else if ((int) this.type == 133) + { + if (this.life < this.lifeMax >> 1) + { + if ((int) this.direction == -1 && (double) this.velocity.X > -6.0) + { + this.velocity.X -= 0.1f; + if ((double) this.velocity.X > 6.0) + this.velocity.X -= 0.1f; + else if ((double) this.velocity.X > 0.0) + this.velocity.X += 0.05f; + if ((double) this.velocity.X < -6.0) + this.velocity.X = -6f; + } + else if ((int) this.direction == 1 && (double) this.velocity.X < 6.0) + { + this.velocity.X += 0.1f; + if ((double) this.velocity.X < -6.0) + this.velocity.X += 0.1f; + else if ((double) this.velocity.X < 0.0) + this.velocity.X -= 0.05f; + if ((double) this.velocity.X > 6.0) + this.velocity.X = 6f; + } + if ((int) this.directionY == -1 && (double) this.velocity.Y > -4.0) + { + this.velocity.Y -= 0.1f; + if ((double) this.velocity.Y > 4.0) + this.velocity.Y -= 0.1f; + else if ((double) this.velocity.Y > 0.0) + this.velocity.Y += 0.05f; + if ((double) this.velocity.Y < -4.0) + this.velocity.Y = -4f; + } + else if ((int) this.directionY == 1 && (double) this.velocity.Y < 4.0) + { + this.velocity.Y += 0.1f; + if ((double) this.velocity.Y < -4.0) + this.velocity.Y += 0.1f; + else if ((double) this.velocity.Y < 0.0) + this.velocity.Y -= 0.05f; + if ((double) this.velocity.Y > 4.0) + this.velocity.Y = 4f; + } + } + else + { + if ((int) this.direction == -1 && (double) this.velocity.X > -4.0) + { + this.velocity.X -= 0.1f; + if ((double) this.velocity.X > 4.0) + this.velocity.X -= 0.1f; + else if ((double) this.velocity.X > 0.0) + this.velocity.X += 0.05f; + if ((double) this.velocity.X < -4.0) + this.velocity.X = -4f; + } + else if ((int) this.direction == 1 && (double) this.velocity.X < 4.0) + { + this.velocity.X += 0.1f; + if ((double) this.velocity.X < -4.0) + this.velocity.X += 0.1f; + else if ((double) this.velocity.X < 0.0) + this.velocity.X -= 0.05f; + else if ((double) this.velocity.X > 4.0) + this.velocity.X = 4f; + } + if ((int) this.directionY == -1 && (double) this.velocity.Y > -1.5) + { + this.velocity.Y -= 0.04f; + if ((double) this.velocity.Y > 1.5) + this.velocity.Y -= 0.05f; + else if ((double) this.velocity.Y > 0.0) + this.velocity.Y += 0.03f; + else if ((double) this.velocity.Y < -1.5) + this.velocity.Y = -1.5f; + } + else if ((int) this.directionY == 1 && (double) this.velocity.Y < 1.5) + { + this.velocity.Y += 0.04f; + if ((double) this.velocity.Y < -1.5) + this.velocity.Y += 0.05f; + else if ((double) this.velocity.Y < 0.0) + this.velocity.Y -= 0.03f; + else if ((double) this.velocity.Y > 1.5) + this.velocity.Y = 1.5f; + } + } + } + else + { + if ((int) this.direction == -1 && (double) this.velocity.X > -4.0) + { + this.velocity.X -= 0.1f; + if ((double) this.velocity.X > 4.0) + this.velocity.X -= 0.1f; + else if ((double) this.velocity.X > 0.0) + this.velocity.X += 0.05f; + else if ((double) this.velocity.X < -4.0) + this.velocity.X = -4f; + } + else if ((int) this.direction == 1 && (double) this.velocity.X < 4.0) + { + this.velocity.X += 0.1f; + if ((double) this.velocity.X < -4.0) + this.velocity.X += 0.1f; + else if ((double) this.velocity.X < 0.0) + this.velocity.X -= 0.05f; + else if ((double) this.velocity.X > 4.0) + this.velocity.X = 4f; + } + if ((int) this.directionY == -1 && (double) this.velocity.Y > -1.5) + { + this.velocity.Y -= 0.04f; + if ((double) this.velocity.Y > 1.5) + this.velocity.Y -= 0.05f; + else if ((double) this.velocity.Y > 0.0) + this.velocity.Y += 0.03f; + else if ((double) this.velocity.Y < -1.5) + this.velocity.Y = -1.5f; + } + else if ((int) this.directionY == 1 && (double) this.velocity.Y < 1.5) + { + this.velocity.Y += 0.04f; + if ((double) this.velocity.Y < -1.5) + this.velocity.Y += 0.05f; + else if ((double) this.velocity.Y < 0.0) + this.velocity.Y -= 0.03f; + else if ((double) this.velocity.Y > 1.5) + this.velocity.Y = 1.5f; + } + } + if (((int) this.type == 2 || (int) this.type == 133) && Main.rand.Next(40) == 0) + { + Dust* dustPtr = Main.dust.NewDust(this.aabb.X, this.aabb.Y + ((int) this.height >> 2), (int) this.width, (int) this.height >> 1, 5, (double) this.velocity.X, 2.0, 0, new Color(), 1.0); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.X *= 0.5f; + dustPtr->velocity.Y *= 0.1f; + } + } + if (!this.wet) + return; + if ((double) this.velocity.Y > 0.0) + this.velocity.Y *= 0.95f; + this.velocity.Y -= 0.5f; + if ((double) this.velocity.Y < -4.0) + this.velocity.Y = -4f; + this.TargetClosest(true); + } + + private unsafe void WalkAI() + { + int num1 = 60; + if ((int) this.type == 120 || (int) this.type == 154) + { + num1 = 20; + if ((double) this.ai3 == -120.0) + { + this.velocity.X = 0.0f; + this.velocity.Y = 0.0f; + this.ai3 = 0.0f; + Main.PlaySound(2, this.aabb.X, this.aabb.Y, 8); + Vector2 vector2 = new Vector2(this.position.X + (float) ((int) this.width >> 1), this.position.Y + (float) ((int) this.height >> 1)); + float num2 = this.oldPos[2].X + (float) ((int) this.width >> 1) - vector2.X; + float num3 = this.oldPos[2].Y + (float) ((int) this.height >> 1) - vector2.Y; + float num4 = 2f / (float) Math.Sqrt((double) num2 * (double) num2 + (double) num3 * (double) num3); + float num5 = num2 * num4; + float num6 = num3 * num4; + for (int index = 0; index < 16; ++index) + { + Dust* dustPtr = Main.dust.NewDust(71, ref this.aabb, (double) num5, (double) num6, 200, new Color(), 2.0); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->noGravity = true; + dustPtr->velocity.X *= 2f; + } + else + break; + } + for (int index = 0; index < 16; ++index) + { + Dust* dustPtr = Main.dust.NewDust((int) this.oldPos[2].X, (int) this.oldPos[2].Y, (int) this.width, (int) this.height, 71, -(double) num5, -(double) num6, 200, new Color(), 2.0); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->noGravity = true; + dustPtr->velocity.X *= 2f; + } + else + break; + } + } + } + bool flag1 = false; + bool flag2 = true; + if ((int) this.type == 47 || (int) this.type == 67 || ((int) this.type == 109 || (int) this.type == 110) || ((int) this.type == 111 || (int) this.type == 120 || (int) this.type == 154)) + flag2 = false; + if ((int) this.type != 110 && (int) this.type != 111 || (double) this.ai2 <= 0.0) + { + if ((double) this.velocity.Y == 0.0 && ((double) this.velocity.X > 0.0 && (int) this.direction < 0 || (double) this.velocity.X < 0.0 && (int) this.direction > 0)) + flag1 = true; + if ((double) this.position.X == (double) this.oldPosition.X || (double) this.ai3 >= (double) num1 || flag1) + ++this.ai3; + else if ((double) Math.Abs(this.velocity.X) > 0.9 && (double) this.ai3 > 0.0) + --this.ai3; + if ((double) this.ai3 > (double) (num1 * 10)) + this.ai3 = 0.0f; + if (this.justHit) + this.ai3 = 0.0f; + if ((double) this.ai3 == (double) num1) + this.netUpdate = true; + } + if ((double) this.ai3 < (double) num1 && (!Main.gameTime.dayTime || this.aabb.Y > Main.worldSurfacePixels || ((int) this.type == 26 || (int) this.type == 27) || ((int) this.type == 28 || (int) this.type == 31 || ((int) this.type == 47 || (int) this.type == 67)) || ((int) this.type == 73 || (int) this.type == 77 || ((int) this.type == 78 || (int) this.type == 79) || ((int) this.type == 80 || (int) this.type == 110 || ((int) this.type == 111 || (int) this.type == 120))) || ((int) this.type == 152 || (int) this.type == 154 || (int) this.type == 155))) + { + if ((int) this.type == 3 || (int) this.type == 21 || ((int) this.type == 31 || (int) this.type == 77) || ((int) this.type == 110 || (int) this.type == 132)) + { + if (Main.rand.Next(1000) == 0) + Main.PlaySound(14, this.aabb.X, this.aabb.Y, 1); + } + else if (((int) this.type == 78 || (int) this.type == 79 || ((int) this.type == 80 || (int) this.type == 152) || (int) this.type == 155) && Main.rand.Next(500) == 0) + Main.PlaySound(26, this.aabb.X, this.aabb.Y, 1); + this.TargetClosest(true); + } + else if ((int) this.type != 110 && (int) this.type != 111 || (double) this.ai2 <= 0.0) + { + if (Main.gameTime.dayTime && this.aabb.Y >> 4 < Main.worldSurface && this.timeLeft > 10) + this.timeLeft = 10; + if ((double) this.velocity.X == 0.0) + { + if ((double) this.velocity.Y == 0.0) + { + ++this.ai0; + if ((double) this.ai0 >= 2.0) + { + this.direction = -this.direction; + this.spriteDirection = this.direction; + this.ai0 = 0.0f; + } + } + } + else + this.ai0 = 0.0f; + if ((int) this.direction == 0) + this.direction = (sbyte) 1; + } + if ((int) this.type == 120) + { + if ((double) this.velocity.X < -3.0 || (double) this.velocity.X > 3.0) + { + if ((double) this.velocity.Y == 0.0) + this.velocity.X *= 0.8f; + } + else if ((double) this.velocity.X < 3.0 && (int) this.direction == 1) + { + if ((double) this.velocity.Y == 0.0 && (double) this.velocity.X < 0.0) + this.velocity.X *= 0.99f; + this.velocity.X += 0.07f; + if ((double) this.velocity.X > 3.0) + this.velocity.X = 3f; + } + else if ((double) this.velocity.X > -3.0 && (int) this.direction == -1) + { + if ((double) this.velocity.Y == 0.0 && (double) this.velocity.X > 0.0) + this.velocity.X *= 0.99f; + this.velocity.X -= 0.07f; + if ((double) this.velocity.X < -3.0) + this.velocity.X = -3f; + } + } + else if ((int) this.type == 27 || (int) this.type == 77 || (int) this.type == 104) + { + if ((double) this.velocity.X < -2.0 || (double) this.velocity.X > 2.0) + { + if ((double) this.velocity.Y == 0.0) + this.velocity.X *= 0.8f; + } + else if ((double) this.velocity.X < 2.0 && (int) this.direction == 1) + { + this.velocity.X += 0.07f; + if ((double) this.velocity.X > 2.0) + this.velocity.X = 2f; + } + else if ((double) this.velocity.X > -2.0 && (int) this.direction == -1) + { + this.velocity.X -= 0.07f; + if ((double) this.velocity.X < -2.0) + this.velocity.X = -2f; + } + } + else if ((int) this.type == 109) + { + if ((double) this.velocity.X < -2.0 || (double) this.velocity.X > 2.0) + { + if ((double) this.velocity.Y == 0.0) + this.velocity.X *= 0.8f; + } + else if ((double) this.velocity.X < 2.0 && (int) this.direction == 1) + { + this.velocity.X += 0.04f; + if ((double) this.velocity.X > 2.0) + this.velocity.X = 2f; + } + else if ((double) this.velocity.X > -2.0 && (int) this.direction == -1) + { + this.velocity.X -= 0.04f; + if ((double) this.velocity.X < -2.0) + this.velocity.X = -2f; + } + } + else if ((int) this.type == 21 || (int) this.type == 26 || ((int) this.type == 31 || (int) this.type == 47) || ((int) this.type == 73 || (int) this.type == 140)) + { + if ((double) this.velocity.X < -1.5 || (double) this.velocity.X > 1.5) + { + if ((double) this.velocity.Y == 0.0) + this.velocity.X *= 0.8f; + } + else if ((double) this.velocity.X < 1.5 && (int) this.direction == 1) + { + this.velocity.X += 0.07f; + if ((double) this.velocity.X > 1.5) + this.velocity.X = 1.5f; + } + else if ((double) this.velocity.X > -1.5 && (int) this.direction == -1) + { + this.velocity.X -= 0.07f; + if ((double) this.velocity.X < -1.5) + this.velocity.X = -1.5f; + } + } + else if ((int) this.type == 67) + { + if ((double) this.velocity.X < -0.5 || (double) this.velocity.X > 0.5) + { + if ((double) this.velocity.Y == 0.0) + this.velocity.X *= 0.7f; + } + else if ((double) this.velocity.X < 0.5 && (int) this.direction == 1) + { + this.velocity.X += 0.03f; + if ((double) this.velocity.X > 0.5) + this.velocity.X = 0.5f; + } + else if ((double) this.velocity.X > -0.5 && (int) this.direction == -1) + { + this.velocity.X -= 0.03f; + if ((double) this.velocity.X < -0.5) + this.velocity.X = -0.5f; + } + } + else if ((int) this.type == 78 || (int) this.type == 79 || ((int) this.type == 80 || (int) this.type == 152) || (int) this.type == 155) + { + float num2 = 1f; + float num3 = 0.05f; + if (this.life < this.lifeMax >> 1) + { + num2 = 2f; + num3 = 0.1f; + } + if ((int) this.type == 79 || (int) this.type == 152) + num2 *= 1.5f; + if ((double) this.velocity.X < -(double) num2 || (double) this.velocity.X > (double) num2) + { + if ((double) this.velocity.Y == 0.0) + this.velocity.X *= 0.7f; + } + else if ((double) this.velocity.X < (double) num2 && (int) this.direction == 1) + { + this.velocity.X += num3; + if ((double) this.velocity.X > (double) num2) + this.velocity.X = num2; + } + else if ((double) this.velocity.X > -(double) num2 && (int) this.direction == -1) + { + this.velocity.X -= num3; + if ((double) this.velocity.X < -(double) num2) + this.velocity.X = -num2; + } + } + else if ((int) this.type != 110 && (int) this.type != 111) + { + if ((double) this.velocity.X < -1.0 || (double) this.velocity.X > 1.0) + { + if ((double) this.velocity.Y == 0.0) + this.velocity.X *= 0.8f; + } + else if ((double) this.velocity.X < 1.0 && (int) this.direction == 1) + { + this.velocity.X += 0.07f; + if ((double) this.velocity.X > 1.0) + this.velocity.X = 1f; + } + else if ((double) this.velocity.X > -1.0 && (int) this.direction == -1) + { + this.velocity.X -= 0.07f; + if ((double) this.velocity.X < -1.0) + this.velocity.X = -1f; + } + } + if ((int) this.type == 110 || (int) this.type == 111) + { + if (this.confused) + { + this.ai2 = 0.0f; + } + else + { + if ((double) this.ai1 > 0.0) + --this.ai1; + if (this.justHit) + { + this.ai1 = 30f; + this.ai2 = 0.0f; + } + int num2 = (int) this.type == 111 ? 180 : 70; + if ((double) this.ai2 > 0.0) + { + this.TargetClosest(true); + if ((double) this.ai1 == (double) (num2 >> 1)) + { + float num3 = 11f; + int Damage = 35; + int Type = 82; + if ((int) this.type == 111) + { + num3 = 9f; + Damage = 11; + Type = 81; + } + Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num4 = Main.player[(int) this.target].position.X + 10f - vector2.X; + float num5 = Math.Abs(num4) * 0.1f; + float num6 = Main.player[(int) this.target].position.Y + 21f - vector2.Y - num5; + float num7 = num4 + (float) Main.rand.Next(-40, 41); + float num8 = num6 + (float) Main.rand.Next(-40, 41); + float num9 = (float) Math.Sqrt((double) num7 * (double) num7 + (double) num8 * (double) num8); + this.netUpdate = true; + float num10 = num3 / num9; + float SpeedX = num7 * num10; + float SpeedY = num8 * num10; + vector2.X += SpeedX; + vector2.Y += SpeedY; + if (Main.netMode != 1) + Projectile.NewProjectile(vector2.X, vector2.Y, SpeedX, SpeedY, Type, Damage, 0.0f, 8, true); + this.ai2 = (double) Math.Abs(SpeedY) <= (double) Math.Abs(SpeedX) * 2.0 ? ((double) Math.Abs(SpeedX) <= (double) Math.Abs(SpeedY) * 2.0 ? ((double) SpeedY <= 0.0 ? 4f : 2f) : 3f) : ((double) SpeedY <= 0.0 ? 5f : 1f); + } + if ((double) this.velocity.Y != 0.0 || (double) this.ai1 <= 0.0) + { + this.ai1 = 0.0f; + this.ai2 = 0.0f; + } + else + { + this.velocity.X *= 0.9f; + this.spriteDirection = this.direction; + } + } + if ((double) this.ai2 <= 0.0 && (double) this.velocity.Y == 0.0 && ((double) this.ai1 <= 0.0 && !Main.player[(int) this.target].dead) && Collision.CanHit(ref this.aabb, ref Main.player[(int) this.target].aabb)) + { + Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num3 = Main.player[(int) this.target].position.X + 10f - vector2.X; + float num4 = Math.Abs(num3) * 0.1f; + float num5 = Main.player[(int) this.target].position.Y + 21f - vector2.Y - num4; + float num6 = num3 + (float) Main.rand.Next(-40, 41); + float num7 = num5 + (float) Main.rand.Next(-40, 41); + float num8 = (float) ((double) num6 * (double) num6 + (double) num7 * (double) num7); + if ((double) num8 < 490000.0) + { + this.netUpdate = true; + this.velocity.X *= 0.5f; + float num9 = 10f / (float) Math.Sqrt((double) num8); + float num10 = num6 * num9; + float num11 = num7 * num9; + this.ai2 = 3f; + this.ai1 = (float) num2; + this.ai2 = (double) Math.Abs(num11) <= (double) Math.Abs(num10) * 2.0 ? ((double) Math.Abs(num10) <= (double) Math.Abs(num11) * 2.0 ? ((double) num11 <= 0.0 ? 4f : 2f) : 3f) : ((double) num11 <= 0.0 ? 5f : 1f); + } + } + if ((double) this.ai2 <= 0.0) + { + if ((double) this.velocity.X < -1.0 || (double) this.velocity.X > 1.0) + { + if ((double) this.velocity.Y == 0.0) + this.velocity.X *= 0.8f; + } + else if ((double) this.velocity.X < 1.0 && (int) this.direction == 1) + { + this.velocity.X += 0.07f; + if ((double) this.velocity.X > 1.0) + this.velocity.X = 1f; + } + else if ((double) this.velocity.X > -1.0 && (int) this.direction == -1) + { + this.velocity.X -= 0.07f; + if ((double) this.velocity.X < -1.0) + this.velocity.X = -1f; + } + } + } + } + else if ((int) this.type == 109 && Main.netMode != 1 && !Main.player[(int) this.target].dead) + { + if (this.justHit) + this.ai2 = 0.0f; + ++this.ai2; + if ((double) this.ai2 > 450.0) + { + Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f - (float) ((int) this.direction * 24), this.position.Y + 4f); + int num2 = 3 * (int) this.direction; + int num3 = -5; + int index = Projectile.NewProjectile(vector2.X, vector2.Y, (float) num2, (float) num3, 75, 0, 0.0f, 8, true); + if (index >= 0) + Main.projectile[index].timeLeft = 300; + this.ai2 = 0.0f; + } + } + bool flag3 = false; + if ((double) this.velocity.Y == 0.0) + { + int index1 = this.aabb.Y + (int) this.height + 8 >> 4; + int num2 = this.aabb.X >> 4; + int num3 = this.aabb.X + (int) this.width >> 4; + for (int index2 = num2; index2 <= num3; ++index2) + { + if ((int) Main.tile[index2, index1].active != 0 && Main.tileSolid[(int) Main.tile[index2, index1].type]) + { + flag3 = true; + break; + } + } + } + if (flag3) + { + int index1 = this.aabb.Y + (int) this.height - 15 >> 4; + int index2 = ((int) this.type != 109 ? this.aabb.X + ((int) this.width >> 1) + 15 * (int) this.direction : this.aabb.X + ((int) this.width >> 1) + (((int) this.width >> 1) + 16) * (int) this.direction) >> 4; + if (flag2 && (int) Main.tile[index2, index1 - 1].type == 10 && (int) Main.tile[index2, index1 - 1].active != 0) + { + ++this.ai2; + this.ai3 = 0.0f; + if ((double) this.ai2 >= 60.0) + { + if (!Main.gameTime.bloodMoon && ((int) this.type == 3 || (int) this.type == 132)) + this.ai1 = 0.0f; + this.velocity.X = -0.5f * (float) this.direction; + ++this.ai1; + if ((int) this.type == 27) + ++this.ai1; + else if ((int) this.type == 31) + this.ai1 += 6f; + this.ai2 = 0.0f; + bool flag4 = false; + if ((double) this.ai1 >= 10.0) + { + flag4 = true; + this.ai1 = 10f; + } + WorldGen.KillTile(index2, index1 - 1, true, false, false); + if ((Main.netMode != 1 || !flag4) && (flag4 && Main.netMode != 1)) + { + if ((int) this.type == 26) + { + WorldGen.KillTile(index2, index1 - 1); + NetMessage.CreateMessage5(17, 0, index2, index1 - 1, 0, 0); + NetMessage.SendMessage(); + } + else + { + int number3 = WorldGen.OpenDoor(index2, index1, (int) this.direction); + if (number3 != 0) + { + NetMessage.CreateMessage3(19, index2, index1, number3); + NetMessage.SendMessage(); + } + else + { + this.ai3 = (float) num1; + this.netUpdate = true; + } + } + } + } + } + else + { + if ((double) this.velocity.X < 0.0 && (int) this.spriteDirection == -1 || (double) this.velocity.X > 0.0 && (int) this.spriteDirection == 1) + { + if ((int) Main.tile[index2, index1 - 2].active != 0 && Main.tileSolid[(int) Main.tile[index2, index1 - 2].type]) + { + this.velocity.Y = (int) Main.tile[index2, index1 - 3].active == 0 || !Main.tileSolid[(int) Main.tile[index2, index1 - 3].type] ? -7f : -8f; + this.netUpdate = true; + } + else if ((int) Main.tile[index2, index1 - 1].active != 0 && Main.tileSolid[(int) Main.tile[index2, index1 - 1].type]) + { + this.velocity.Y = -6f; + this.netUpdate = true; + } + else if ((int) Main.tile[index2, index1].active != 0 && Main.tileSolid[(int) Main.tile[index2, index1].type]) + { + this.velocity.Y = -5f; + this.netUpdate = true; + } + else if ((int) this.directionY < 0 && (int) this.type != 67 && ((int) Main.tile[index2, index1 + 1].active == 0 || !Main.tileSolid[(int) Main.tile[index2, index1 + 1].type]) && ((int) Main.tile[index2 + (int) this.direction, index1 + 1].active == 0 || !Main.tileSolid[(int) Main.tile[index2 + (int) this.direction, index1 + 1].type])) + { + this.velocity.Y = -8f; + this.velocity.X *= 1.5f; + this.netUpdate = true; + } + else if (flag2) + { + this.ai1 = 0.0f; + this.ai2 = 0.0f; + } + } + if ((int) this.type == 31 || (int) this.type == 47 || ((int) this.type == 77 || (int) this.type == 104)) + { + if ((double) this.velocity.Y == 0.0 && (double) Math.Abs((float) ((double) this.position.X + (double) ((int) this.width >> 1) - ((double) Main.player[(int) this.target].position.X + 10.0))) < 100.0 && (double) Math.Abs((float) ((double) this.position.Y + (double) ((int) this.height >> 1) - ((double) Main.player[(int) this.target].position.Y + 21.0))) < 50.0 && ((int) this.direction > 0 && (double) this.velocity.X >= 1.0 || (int) this.direction < 0 && (double) this.velocity.X <= -1.0)) + { + this.velocity.X *= 2f; + if ((double) this.velocity.X > 3.0) + this.velocity.X = 3f; + if ((double) this.velocity.X < -3.0) + this.velocity.X = -3f; + this.velocity.Y = -4f; + this.netUpdate = true; + } + } + else if (((int) this.type == 120 || (int) this.type == 154) && (double) this.velocity.Y < 0.0) + this.velocity.Y *= 1.1f; + } + } + else if (flag2) + { + this.ai1 = 0.0f; + this.ai2 = 0.0f; + } + if ((int) this.type != 120 && (int) this.type != 154 || (Main.netMode == 1 || (double) this.ai3 < (double) num1)) + return; + int num12 = Main.player[(int) this.target].aabb.X >> 4; + int num13 = Main.player[(int) this.target].aabb.Y >> 4; + int num14 = this.aabb.X >> 4; + int num15 = this.aabb.Y >> 4; + if (Math.Abs(this.aabb.X - Main.player[(int) this.target].aabb.X) + Math.Abs(this.aabb.Y - Main.player[(int) this.target].aabb.Y) > 2000) + return; + int num16 = 0; + do + { + int index1 = Main.rand.Next(num12 - 20, num12 + 20); + for (int index2 = Main.rand.Next(num13 - 20, num13 + 20); index2 < num13 + 20; ++index2) + { + if ((index2 < num13 - 4 || index2 > num13 + 4 || (index1 < num12 - 4 || index1 > num12 + 4)) && (index2 < num15 - 1 || index2 > num15 + 1 || (index1 < num14 - 1 || index1 > num14 + 1)) && ((int) Main.tile[index1, index2].active != 0 && ((int) this.type != 32 || (int) Main.tile[index1, index2 - 1].wall != 0) && ((int) Main.tile[index1, index2 - 1].lava == 0 && Main.tileSolid[(int) Main.tile[index1, index2].type] && !Collision.SolidTiles(index1 - 1, index1 + 1, index2 - 4, index2 - 1)))) + { + this.position.X = (float) (this.aabb.X = index1 * 16 - ((int) this.width >> 1)); + this.position.Y = (float) (this.aabb.Y = index2 * 16 - (int) this.height); + this.netUpdate = true; + this.ai3 = -120f; + num16 = 32; + break; + } + } + } + while (++num16 < 32); + } + + private unsafe void EyeOfCthulhuAI() + { + if ((int) this.target == 8 || Main.player[(int) this.target].dead || (int) Main.player[(int) this.target].active == 0) + this.TargetClosest(true); + bool flag = Main.player[(int) this.target].dead; + float num1 = (float) ((double) this.position.X + (double) ((int) this.width >> 1) - (double) Main.player[(int) this.target].position.X - 10.0); + float num2 = (float) Math.Atan2((double) this.position.Y + (double) this.height - 59.0 - (double) Main.player[(int) this.target].position.Y - 21.0, (double) num1) + 1.57f; + if ((double) num2 < 0.0) + num2 += 6.283f; + else if ((double) num2 > 6.28299999237061) + num2 -= 6.283f; + float num3 = 0.0f; + if ((double) this.ai0 == 0.0 && (double) this.ai1 == 0.0) + num3 = 0.02f; + if ((double) this.ai0 == 0.0 && (double) this.ai1 == 2.0 && (double) this.ai2 > 40.0) + num3 = 0.05f; + if ((double) this.ai0 == 3.0 && (double) this.ai1 == 0.0) + num3 = 0.05f; + if ((double) this.ai0 == 3.0 && (double) this.ai1 == 2.0 && (double) this.ai2 > 40.0) + num3 = 0.08f; + if ((double) this.rotation < (double) num2) + { + if ((double) num2 - (double) this.rotation > 3.1415) + this.rotation -= num3; + else + this.rotation += num3; + } + else if ((double) this.rotation > (double) num2) + { + if ((double) this.rotation - (double) num2 > 3.1415) + this.rotation += num3; + else + this.rotation -= num3; + } + if ((double) this.rotation > (double) num2 - (double) num3 && (double) this.rotation < (double) num2 + (double) num3) + this.rotation = num2; + if ((double) this.rotation < 0.0) + this.rotation += 6.283f; + else if ((double) this.rotation > 6.28299999237061) + this.rotation -= 6.283f; + if ((double) this.rotation > (double) num2 - (double) num3 && (double) this.rotation < (double) num2 + (double) num3) + this.rotation = num2; + if (Main.rand.Next(6) == 0) + { + Dust* dustPtr = Main.dust.NewDust(this.aabb.X, this.aabb.Y + ((int) this.height >> 2), (int) this.width, (int) this.height >> 1, 5, (double) this.velocity.X, 2.0, 0, new Color(), 1.0); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.X *= 0.5f; + dustPtr->velocity.Y *= 0.1f; + } + } + if (Main.gameTime.dayTime || flag) + { + this.velocity.Y -= 0.04f; + if (this.timeLeft <= 10) + return; + this.timeLeft = 10; + } + else if ((double) this.ai0 == 0.0) + { + if ((double) this.ai1 == 0.0) + { + float num4 = 5f; + float num5 = 0.04f; + Vector2 vector2_1 = new Vector2(this.position.X + (float) ((int) this.width >> 1), this.position.Y + (float) ((int) this.height >> 1)); + float num6 = Main.player[(int) this.target].position.X + 10f - vector2_1.X; + float num7 = (float) ((double) Main.player[(int) this.target].position.Y + 21.0 - 200.0) - vector2_1.Y; + float num8 = (float) Math.Sqrt((double) num6 * (double) num6 + (double) num7 * (double) num7); + float num9 = num8; + float num10 = num4 / num8; + float num11 = num6 * num10; + float num12 = num7 * num10; + if ((double) this.velocity.X < (double) num11) + { + this.velocity.X += num5; + if ((double) this.velocity.X < 0.0 && (double) num11 > 0.0) + this.velocity.X += num5; + } + else if ((double) this.velocity.X > (double) num11) + { + this.velocity.X -= num5; + if ((double) this.velocity.X > 0.0 && (double) num11 < 0.0) + this.velocity.X -= num5; + } + if ((double) this.velocity.Y < (double) num12) + { + this.velocity.Y += num5; + if ((double) this.velocity.Y < 0.0 && (double) num12 > 0.0) + this.velocity.Y += num5; + } + else if ((double) this.velocity.Y > (double) num12) + { + this.velocity.Y -= num5; + if ((double) this.velocity.Y > 0.0 && (double) num12 < 0.0) + this.velocity.Y -= num5; + } + ++this.ai2; + if ((double) this.ai2 >= 600.0) + { + this.ai1 = 1f; + this.ai2 = 0.0f; + this.ai3 = 0.0f; + this.target = (byte) 8; + this.netUpdate = true; + } + else if (this.aabb.Y + (int) this.height < Main.player[(int) this.target].aabb.Y && (double) num9 < 500.0) + { + if (!Main.player[(int) this.target].dead) + ++this.ai3; + if ((double) this.ai3 >= 110.0) + { + this.ai3 = 0.0f; + this.rotation = num2; + float num13 = Main.player[(int) this.target].position.X + 10f - vector2_1.X; + float num14 = Main.player[(int) this.target].position.Y + 21f - vector2_1.Y; + float num15 = 5f / (float) Math.Sqrt((double) num13 * (double) num13 + (double) num14 * (double) num14); + Vector2 vector2_2 = vector2_1; + Vector2 vector2_3; + vector2_3.X = num13 * num15; + vector2_3.Y = num14 * num15; + vector2_2.X += vector2_3.X * 10f; + vector2_2.Y += vector2_3.Y * 10f; + if (Main.netMode != 1) + { + int number = NPC.NewNPC((int) vector2_2.X, (int) vector2_2.Y, 5, 0); + if (number < 196) + { + Main.npc[number].velocity.X = vector2_3.X; + Main.npc[number].velocity.Y = vector2_3.Y; + NetMessage.CreateMessage1(23, number); + NetMessage.SendMessage(); + } + } + Main.PlaySound(3, (int) vector2_2.X, (int) vector2_2.Y, 1); + int num16 = 0; + while (num16 < 8 && IntPtr.Zero != (IntPtr) Main.dust.NewDust((int) vector2_2.X, (int) vector2_2.Y, 20, 20, 5, (double) vector2_3.X * 0.400000005960464, (double) vector2_3.Y * 0.400000005960464, 0, new Color(), 1.0)) + ++num16; + } + } + } + else if ((double) this.ai1 == 1.0) + { + this.rotation = num2; + float num4 = 6f; + Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num5 = Main.player[(int) this.target].position.X + 10f - vector2.X; + float num6 = Main.player[(int) this.target].position.Y + 21f - vector2.Y; + float num7 = (float) Math.Sqrt((double) num5 * (double) num5 + (double) num6 * (double) num6); + float num8 = num4 / num7; + this.velocity.X = num5 * num8; + this.velocity.Y = num6 * num8; + this.ai1 = 2f; + } + else if ((double) this.ai1 == 2.0) + { + ++this.ai2; + if ((double) this.ai2 >= 40.0) + { + this.velocity.X *= 0.98f; + this.velocity.Y *= 0.98f; + if ((double) this.velocity.X > -0.1 && (double) this.velocity.X < 0.1) + this.velocity.X = 0.0f; + if ((double) this.velocity.Y > -0.1 && (double) this.velocity.Y < 0.1) + this.velocity.Y = 0.0f; + } + else + this.rotation = (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X) - 1.57f; + if ((double) this.ai2 >= 150.0) + { + ++this.ai3; + this.ai2 = 0.0f; + this.target = (byte) 8; + this.rotation = num2; + if ((double) this.ai3 >= 3.0) + { + this.ai1 = 0.0f; + this.ai3 = 0.0f; + } + else + this.ai1 = 1f; + } + } + if (this.life >= this.lifeMax >> 1) + return; + this.ai0 = 1f; + this.ai1 = 0.0f; + this.ai2 = 0.0f; + this.ai3 = 0.0f; + this.netUpdate = true; + } + else if ((double) this.ai0 == 1.0 || (double) this.ai0 == 2.0) + { + if ((double) this.ai0 == 1.0) + { + this.ai2 += 0.005f; + if ((double) this.ai2 > 0.5) + this.ai2 = 0.5f; + } + else + { + this.ai2 -= 0.005f; + if ((double) this.ai2 < 0.0) + this.ai2 = 0.0f; + } + this.rotation += this.ai2; + ++this.ai1; + if ((double) this.ai1 == 100.0) + { + ++this.ai0; + this.ai1 = 0.0f; + if ((double) this.ai0 == 3.0) + { + this.ai2 = 0.0f; + } + else + { + Main.PlaySound(3, this.aabb.X, this.aabb.Y, 1); + Main.PlaySound(15, this.aabb.X, this.aabb.Y, 0); + for (int index = 0; index < 2; ++index) + { + Gore.NewGore(this.position, new Vector2((float) Main.rand.Next(-30, 31) * 0.2f, (float) Main.rand.Next(-30, 31) * 0.2f), 8, 1.0); + Gore.NewGore(this.position, new Vector2((float) Main.rand.Next(-30, 31) * 0.2f, (float) Main.rand.Next(-30, 31) * 0.2f), 7, 1.0); + Gore.NewGore(this.position, new Vector2((float) Main.rand.Next(-30, 31) * 0.2f, (float) Main.rand.Next(-30, 31) * 0.2f), 6, 1.0); + } + int num4 = 0; + while (num4 < 16 && IntPtr.Zero != (IntPtr) Main.dust.NewDust(5, ref this.aabb, (double) Main.rand.Next(-30, 31) * 0.2, (double) Main.rand.Next(-30, 31) * 0.2, 0, new Color(), 1.0)) + ++num4; + } + } + Main.dust.NewDust(5, ref this.aabb, (double) Main.rand.Next(-30, 31) * 0.2, (double) Main.rand.Next(-30, 31) * 0.2, 0, new Color(), 1.0); + this.velocity.X *= 0.98f; + this.velocity.Y *= 0.98f; + if ((double) this.velocity.X > -0.1 && (double) this.velocity.X < 0.1) + this.velocity.X = 0.0f; + if ((double) this.velocity.Y <= -0.1 || (double) this.velocity.Y >= 0.1) + return; + this.velocity.Y = 0.0f; + } + else + { + this.damage = 23; + this.defense = 0; + if ((double) this.ai1 == 0.0) + { + float num4 = 6f; + float num5 = 0.07f; + Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num6 = Main.player[(int) this.target].position.X + 10f - vector2.X; + float num7 = (float) ((double) Main.player[(int) this.target].position.Y + 21.0 - 120.0) - vector2.Y; + float num8 = (float) Math.Sqrt((double) num6 * (double) num6 + (double) num7 * (double) num7); + float num9 = num4 / num8; + float num10 = num6 * num9; + float num11 = num7 * num9; + if ((double) this.velocity.X < (double) num10) + { + this.velocity.X += num5; + if ((double) this.velocity.X < 0.0 && (double) num10 > 0.0) + this.velocity.X += num5; + } + else if ((double) this.velocity.X > (double) num10) + { + this.velocity.X -= num5; + if ((double) this.velocity.X > 0.0 && (double) num10 < 0.0) + this.velocity.X -= num5; + } + if ((double) this.velocity.Y < (double) num11) + { + this.velocity.Y += num5; + if ((double) this.velocity.Y < 0.0 && (double) num11 > 0.0) + this.velocity.Y += num5; + } + else if ((double) this.velocity.Y > (double) num11) + { + this.velocity.Y -= num5; + if ((double) this.velocity.Y > 0.0 && (double) num11 < 0.0) + this.velocity.Y -= num5; + } + ++this.ai2; + if ((double) this.ai2 < 200.0) + return; + this.ai1 = 1f; + this.ai2 = 0.0f; + this.ai3 = 0.0f; + this.target = (byte) 8; + this.netUpdate = true; + } + else if ((double) this.ai1 == 1.0) + { + Main.PlaySound(15, this.aabb.X, this.aabb.Y, 0); + this.rotation = num2; + float num4 = 6.8f; + Vector2 vector2 = new Vector2(this.position.X + (float) ((int) this.width >> 1), this.position.Y + (float) ((int) this.height >> 1)); + float num5 = Main.player[(int) this.target].position.X + 10f - vector2.X; + float num6 = Main.player[(int) this.target].position.Y + 21f - vector2.Y; + float num7 = (float) Math.Sqrt((double) num5 * (double) num5 + (double) num6 * (double) num6); + float num8 = num4 / num7; + this.velocity.X = num5 * num8; + this.velocity.Y = num6 * num8; + this.ai1 = 2f; + } + else + { + if ((double) this.ai1 != 2.0) + return; + ++this.ai2; + if ((double) this.ai2 >= 40.0) + { + this.velocity.X *= 0.97f; + this.velocity.Y *= 0.97f; + if ((double) this.velocity.X > -0.1 && (double) this.velocity.X < 0.1) + this.velocity.X = 0.0f; + if ((double) this.velocity.Y > -0.1 && (double) this.velocity.Y < 0.1) + this.velocity.Y = 0.0f; + } + else + this.rotation = (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X) - 1.57f; + if ((double) this.ai2 < 130.0) + return; + ++this.ai3; + this.ai2 = 0.0f; + this.target = (byte) 8; + this.rotation = num2; + if ((double) this.ai3 >= 3.0) + { + this.ai1 = 0.0f; + this.ai3 = 0.0f; + } + else + this.ai1 = 1f; + } + } + } + + private unsafe void AggressiveFlyerAI() + { + if ((int) this.target == 8 || Main.player[(int) this.target].dead) + this.TargetClosest(true); + byte num1 = this.type; + float num2; + float num3; + if ((uint) num1 <= 42U) + { + switch (num1) + { + case (byte) 5: + num2 = 5f; + num3 = 0.03f; + goto label_15; + case (byte) 6: + num2 = 4f; + num3 = 0.02f; + goto label_15; + case (byte) 23: + num2 = 1f; + num3 = 0.03f; + goto label_15; + case (byte) 42: + break; + default: + goto label_14; + } + } + else if ((int) num1 != 94) + { + if ((int) num1 != 157) + { + if ((int) num1 == 167) + { + Lighting.addLight(this.aabb.X >> 4, this.aabb.Y >> 4, new Vector3(1f, 1f, 1f)); + num2 = 9f; + num3 = 0.1f; + goto label_15; + } + else + goto label_14; + } + } + else + { + num2 = 4.2f; + num3 = 0.022f; + goto label_15; + } + num2 = 3.5f; + num3 = 0.021f; + goto label_15; +label_14: + num2 = 6f; + num3 = 0.05f; +label_15: + int num4 = this.aabb.X + ((int) this.width >> 1) & -8; + int num5 = this.aabb.Y + ((int) this.height >> 1) & -8; + float num6 = (float) ((Main.player[(int) this.target].aabb.X + 10 & -8) - num4); + float num7 = (float) ((Main.player[(int) this.target].aabb.Y + 21 & -8) - num5); + float num8 = (float) ((double) num6 * (double) num6 + (double) num7 * (double) num7); + float num9 = num8; + bool flag = false; + float SpeedX1; + float SpeedY1; + if ((double) num8 == 0.0) + { + SpeedX1 = this.velocity.X; + SpeedY1 = this.velocity.Y; + } + else + { + if ((double) num8 > 360000.0) + flag = true; + float num10 = num2 / (float) Math.Sqrt((double) num8); + SpeedX1 = num6 * num10; + SpeedY1 = num7 * num10; + } + if ((int) this.type == 6 || (int) this.type == 42 || ((int) this.type == 157 || (int) this.type == 94) || (int) this.type == 139) + { + if ((int) this.type == 42 || (int) this.type == 157 || ((int) this.type == 94 || (double) num9 > 10000.0)) + { + ++this.ai0; + if ((double) this.ai0 > 0.0) + this.velocity.Y += 23.0 / 1000.0; + else + this.velocity.Y -= 23.0 / 1000.0; + if ((double) this.ai0 < -100.0 || (double) this.ai0 > 100.0) + this.velocity.X += 23.0 / 1000.0; + else + this.velocity.X -= 23.0 / 1000.0; + if ((double) this.ai0 > 200.0) + this.ai0 = -200f; + } + if (((int) this.type == 6 || (int) this.type == 94) && (double) num9 < 22500.0) + { + this.velocity.X += SpeedX1 * 0.007f; + this.velocity.Y += SpeedY1 * 0.007f; + } + } + if (Main.player[(int) this.target].dead) + { + SpeedX1 = (float) ((double) this.direction * (double) num2 * 0.5); + SpeedY1 = num2 * -0.5f; + } + if ((double) this.velocity.X < (double) SpeedX1) + { + this.velocity.X += num3; + if ((double) this.velocity.X < 0.0 && (double) SpeedX1 > 0.0 && ((int) this.type != 6 && (int) this.type != 42) && ((int) this.type != 157 && (int) this.type != 94 && (int) this.type != 139)) + this.velocity.X += num3; + } + else if ((double) this.velocity.X > (double) SpeedX1) + { + this.velocity.X -= num3; + if ((double) this.velocity.X > 0.0 && (double) SpeedX1 < 0.0 && ((int) this.type != 6 && (int) this.type != 42) && ((int) this.type != 157 && (int) this.type != 94 && (int) this.type != 139)) + this.velocity.X -= num3; + } + if ((double) this.velocity.Y < (double) SpeedY1) + { + this.velocity.Y += num3; + if ((double) this.velocity.Y < 0.0 && (double) SpeedY1 > 0.0 && ((int) this.type != 6 && (int) this.type != 42) && ((int) this.type != 157 && (int) this.type != 94 && (int) this.type != 139)) + this.velocity.Y += num3; + } + else if ((double) this.velocity.Y > (double) SpeedY1) + { + this.velocity.Y -= num3; + if ((double) this.velocity.Y > 0.0 && (double) SpeedY1 < 0.0 && ((int) this.type != 6 && (int) this.type != 42) && ((int) this.type != 157 && (int) this.type != 94 && (int) this.type != 139)) + this.velocity.Y -= num3; + } + if ((int) this.type == 23) + { + if ((double) SpeedX1 > 0.0) + { + this.spriteDirection = (sbyte) 1; + this.rotation = (float) Math.Atan2((double) SpeedY1, (double) SpeedX1); + } + else if ((double) SpeedX1 < 0.0) + { + this.spriteDirection = (sbyte) -1; + this.rotation = (float) Math.Atan2((double) SpeedY1, (double) SpeedX1) + 3.14f; + } + } + else if ((int) this.type == 139) + { + if (this.justHit) + this.localAI0 = 0; + else if (++this.localAI0 >= 120 && Main.netMode != 1) + { + this.localAI0 = 0; + if (Collision.CanHit(ref this.aabb, ref Main.player[(int) this.target].aabb)) + { + int Damage = 25; + int Type = 84; + Projectile.NewProjectile((float) num4, (float) num5, SpeedX1, SpeedY1, Type, Damage, 0.0f, 8, true); + } + } + if (!WorldGen.SolidTile(this.aabb.X + ((int) this.width >> 1) >> 4, this.aabb.Y + ((int) this.height >> 1) >> 4)) + Lighting.addLight(this.aabb.X + ((int) this.width >> 1) >> 4, this.aabb.Y + ((int) this.height >> 1) >> 4, new Vector3(0.3f, 0.1f, 0.05f)); + if ((double) SpeedX1 > 0.0) + { + this.spriteDirection = (sbyte) 1; + this.rotation = (float) Math.Atan2((double) SpeedY1, (double) SpeedX1); + } + if ((double) SpeedX1 < 0.0) + { + this.spriteDirection = (sbyte) -1; + this.rotation = (float) Math.Atan2((double) SpeedY1, (double) SpeedX1) + 3.14f; + } + } + else if ((int) this.type == 6 || (int) this.type == 94) + this.rotation = (float) Math.Atan2((double) SpeedY1, (double) SpeedX1) - 1.57f; + else if ((int) this.type == 42 || (int) this.type == 157) + { + if ((double) SpeedX1 > 0.0) + this.spriteDirection = (sbyte) 1; + else if ((double) SpeedX1 < 0.0) + this.spriteDirection = (sbyte) -1; + this.rotation = this.velocity.X * 0.1f; + } + else + this.rotation = (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X) - 1.57f; + if ((int) this.type == 6 || (int) this.type == 23 || ((int) this.type == 42 || (int) this.type == 157) || ((int) this.type == 94 || (int) this.type == 139)) + { + float num10 = 0.7f; + if ((int) this.type == 6) + num10 = 0.4f; + if (this.collideX) + { + this.netUpdate = true; + this.velocity.X = this.oldVelocity.X * -num10; + if ((int) this.direction == -1 && (double) this.velocity.X > 0.0 && (double) this.velocity.X < 2.0) + this.velocity.X = 2f; + else if ((int) this.direction == 1 && (double) this.velocity.X < 0.0 && (double) this.velocity.X > -2.0) + this.velocity.X = -2f; + } + if (this.collideY) + { + this.netUpdate = true; + this.velocity.Y = this.oldVelocity.Y * -num10; + if ((double) this.velocity.Y > 0.0 && (double) this.velocity.Y < 1.5) + this.velocity.Y = 2f; + else if ((double) this.velocity.Y < 0.0 && (double) this.velocity.Y > -1.5) + this.velocity.Y = -2f; + } + if ((int) this.type == 23) + { + Dust* dustPtr = Main.dust.NewDust((int) ((double) this.position.X - (double) this.velocity.X), (int) ((double) this.position.Y - (double) this.velocity.Y), (int) this.width, (int) this.height, 6, (double) this.velocity.X * 0.200000002980232, (double) this.velocity.Y * 0.200000002980232, 100, new Color(), 2.0); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->noGravity = true; + dustPtr->velocity.X *= 0.3f; + dustPtr->velocity.Y *= 0.3f; + } + } + else if ((int) this.type != 42 && (int) this.type != 157 && ((int) this.type != 139 && Main.rand.Next(24) == 0)) + { + Dust* dustPtr = Main.dust.NewDust(this.aabb.X, this.aabb.Y + ((int) this.height >> 2), (int) this.width, (int) this.height >> 1, 18, (double) this.velocity.X, 2.0, 75, this.color, (double) this.scale); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.X *= 0.5f; + dustPtr->velocity.Y *= 0.1f; + } + } + } + else if (Main.rand.Next(48) == 0) + { + Dust* dustPtr = Main.dust.NewDust(this.aabb.X, this.aabb.Y + ((int) this.height >> 2), (int) this.width, (int) this.height >> 1, 5, (double) this.velocity.X, 2.0, 0, new Color(), 1.0); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.X *= 0.5f; + dustPtr->velocity.Y *= 0.1f; + } + } + if ((int) this.type == 6 || (int) this.type == 94) + { + if (this.wet) + { + if ((double) this.velocity.Y > 0.0) + this.velocity.Y *= 0.95f; + this.velocity.Y -= 0.3f; + if ((double) this.velocity.Y < -2.0) + this.velocity.Y = -2f; + } + } + else if ((int) this.type == 42 || (int) this.type == 157) + { + if (this.wet) + { + if ((double) this.velocity.Y > 0.0) + this.velocity.Y *= 0.95f; + this.velocity.Y -= 0.5f; + if ((double) this.velocity.Y < -4.0) + this.velocity.Y = -4f; + this.TargetClosest(true); + } + if ((double) this.ai1 == 101.0) + { + Main.PlaySound(2, this.aabb.X, this.aabb.Y, 17); + this.ai1 = 0.0f; + } + if (Main.netMode != 1) + { + this.ai1 += (float) Main.rand.Next(5, 20) * 0.1f * this.scale; + if ((double) this.ai1 >= 130.0) + { + if (Collision.CanHit(ref this.aabb, ref Main.player[(int) this.target].aabb)) + { + Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) ((int) this.height >> 1)); + float num10 = Main.player[(int) this.target].position.X + 10f - vector2.X + (float) Main.rand.Next(-20, 21); + float num11 = Main.player[(int) this.target].position.Y + 21f - vector2.Y + (float) Main.rand.Next(-20, 21); + if ((double) num10 < 0.0 && (double) this.velocity.X < 0.0 || (double) num10 > 0.0 && (double) this.velocity.X > 0.0) + { + float num12 = 8f / (float) Math.Sqrt((double) num10 * (double) num10 + (double) num11 * (double) num11); + float SpeedX2 = num10 * num12; + float SpeedY2 = num11 * num12; + int Damage = (int) (13.0 * (double) this.scale); + int Type = 55; + int index = Projectile.NewProjectile(vector2.X, vector2.Y, SpeedX2, SpeedY2, Type, Damage, 0.0f, 8, true); + if (index >= 0) + Main.projectile[index].timeLeft = 300; + this.ai1 = 101f; + this.netUpdate = true; + } + else + this.ai1 = 0.0f; + } + else + this.ai1 = 0.0f; + } + } + } + else if ((int) this.type == 139 && flag) + { + if ((double) this.velocity.X > 0.0 && (double) SpeedX1 > 0.0 || (double) this.velocity.X < 0.0 && (double) SpeedX1 < 0.0) + { + if ((double) Math.Abs(this.velocity.X) < 12.0) + this.velocity.X *= 1.05f; + } + else + this.velocity.X *= 0.9f; + } + if (Main.netMode != 1 && (int) this.type == 94 && !Main.player[(int) this.target].dead) + { + if (this.justHit) + this.localAI0 = 0; + ++this.localAI0; + if (this.localAI0 == 180) + { + if (Collision.CanHit(ref this.aabb, ref Main.player[(int) this.target].aabb)) + NPC.NewNPC((int) ((double) this.position.X + (double) this.velocity.X) + ((int) this.width >> 1), (int) ((double) this.position.Y + (double) this.velocity.Y) + ((int) this.height >> 1), 112, 0); + this.localAI0 = 0; + } + } + if (Main.gameTime.dayTime && (int) this.type != 6 && ((int) this.type != 23 && (int) this.type != 42) && ((int) this.type != 157 && (int) this.type != 94) || Main.player[(int) this.target].dead) + { + this.velocity.Y -= num3 * 2f; + if (this.timeLeft > 10) + this.timeLeft = 10; + } + if (((double) this.velocity.X <= 0.0 || (double) this.oldVelocity.X >= 0.0) && ((double) this.velocity.X >= 0.0 || (double) this.oldVelocity.X <= 0.0) && (((double) this.velocity.Y <= 0.0 || (double) this.oldVelocity.Y >= 0.0) && ((double) this.velocity.Y >= 0.0 || (double) this.oldVelocity.Y <= 0.0)) || this.justHit) + return; + this.netUpdate = true; + } + + private unsafe void WormAI() + { + if ((int) this.type == 117 && this.localAI1 == 0) + { + this.localAI1 = 1; + Main.PlaySound(4, this.aabb.X, this.aabb.Y, 13); + int num1 = 1; + if ((double) this.velocity.X < 0.0) + num1 = -1; + int num2 = 0; + while (num2 < 16 && IntPtr.Zero != (IntPtr) Main.dust.NewDust(this.aabb.X - 20, this.aabb.Y - 20, (int) this.width + 40, (int) this.height + 40, 5, (double) (num1 * 8), -1.0, 0, new Color(), 1.0)) + ++num2; + } + if ((int) this.type >= 13 && (int) this.type <= 15) + this.realLife = -1; + else if ((double) this.ai3 > 0.0) + this.realLife = (int) this.ai3; + if ((int) this.target == 8 || Main.player[(int) this.target].dead) + this.TargetClosest(true); + if (Main.player[(int) this.target].dead && this.timeLeft > 300) + this.timeLeft = 300; + if (Main.netMode != 1) + { + if ((int) this.type == 87 || (int) this.type == 159) + { + if ((double) this.ai0 == 0.0) + { + this.ai3 = (float) this.whoAmI; + this.realLife = (int) this.whoAmI; + int index1 = (int) this.whoAmI; + int num1 = (int) this.type - 87; + for (int index2 = 0; index2 < 14; ++index2) + { + int num2 = 89; + if (index2 == 1 || index2 == 8) + num2 = 88; + else if (index2 == 11) + num2 = 90; + else if (index2 == 12) + num2 = 91; + else if (index2 == 13) + num2 = 92; + int number = NPC.NewNPC(this.aabb.X + ((int) this.width >> 1), this.aabb.Y + (int) this.height, num2 + num1, (int) this.whoAmI); + Main.npc[number].ai3 = (float) this.whoAmI; + Main.npc[number].realLife = (int) this.whoAmI; + Main.npc[number].ai1 = (float) index1; + Main.npc[index1].ai0 = (float) number; + NetMessage.CreateMessage1(23, number); + NetMessage.SendMessage(); + index1 = number; + } + } + } + else if (((int) this.type == 7 || (int) this.type == 8 || ((int) this.type == 10 || (int) this.type == 11) || ((int) this.type == 13 || (int) this.type == 14 || ((int) this.type == 39 || (int) this.type == 40)) || ((int) this.type == 95 || (int) this.type == 96 || ((int) this.type == 98 || (int) this.type == 99) || ((int) this.type == 117 || (int) this.type == 118))) && (double) this.ai0 == 0.0) + { + if ((int) this.type == 7 || (int) this.type == 10 || ((int) this.type == 13 || (int) this.type == 39) || ((int) this.type == 95 || (int) this.type == 98 || (int) this.type == 117)) + { + if ((int) this.type < 13 || (int) this.type > 15) + { + this.ai3 = (float) this.whoAmI; + this.realLife = (int) this.whoAmI; + } + this.ai2 = (float) Main.rand.Next(8, 13); + if ((int) this.type == 10) + this.ai2 = (float) Main.rand.Next(4, 7); + else if ((int) this.type == 13) + this.ai2 = (float) Main.rand.Next(45, 56); + else if ((int) this.type == 39) + this.ai2 = (float) Main.rand.Next(12, 19); + else if ((int) this.type == 95) + this.ai2 = (float) Main.rand.Next(6, 12); + else if ((int) this.type == 98) + this.ai2 = (float) Main.rand.Next(20, 26); + else if ((int) this.type == 117) + this.ai2 = (float) Main.rand.Next(3, 6); + this.ai0 = (float) NPC.NewNPC(this.aabb.X + ((int) this.width >> 1), this.aabb.Y + (int) this.height, (int) this.type + 1, (int) this.whoAmI); + } + else + this.ai0 = (int) this.type != 8 && (int) this.type != 11 && ((int) this.type != 14 && (int) this.type != 40) && ((int) this.type != 96 && (int) this.type != 99 && (int) this.type != 118) || (double) this.ai2 <= 0.0 ? (float) NPC.NewNPC(this.aabb.X + ((int) this.width >> 1), this.aabb.Y + (int) this.height, (int) this.type + 1, (int) this.whoAmI) : (float) NPC.NewNPC(this.aabb.X + ((int) this.width >> 1), this.aabb.Y + (int) this.height, (int) this.type, (int) this.whoAmI); + if ((int) this.type < 13 || (int) this.type > 15) + { + Main.npc[(int) this.ai0].ai3 = this.ai3; + Main.npc[(int) this.ai0].realLife = this.realLife; + } + Main.npc[(int) this.ai0].ai1 = (float) this.whoAmI; + Main.npc[(int) this.ai0].ai2 = this.ai2 - 1f; + this.netUpdate = true; + } + if (((int) this.type == 8 || (int) this.type == 9 || ((int) this.type == 11 || (int) this.type == 12) || ((int) this.type == 40 || (int) this.type == 41 || ((int) this.type == 96 || (int) this.type == 97)) || ((int) this.type == 99 || (int) this.type == 100 || (int) this.type > 87 && (int) this.type <= 92 || ((int) this.type > 159 && (int) this.type <= 164 || ((int) this.type == 118 || (int) this.type == 119)))) && ((int) Main.npc[(int) this.ai1].active == 0 || (int) Main.npc[(int) this.ai1].aiStyle != (int) this.aiStyle)) + { + this.life = 0; + this.HitEffect(0, 10.0); + this.active = (byte) 0; + if (Main.netMode != 2) + return; + NetMessage.SendNpcHurt((int) this.whoAmI, -1); + return; + } + else if ((int) this.type == 7 || (int) this.type == 8 || ((int) this.type == 10 || (int) this.type == 11) || ((int) this.type == 39 || (int) this.type == 40 || ((int) this.type == 95 || (int) this.type == 96)) || ((int) this.type == 98 || (int) this.type == 99 || (int) this.type >= 87 && (int) this.type < 92 || ((int) this.type >= 159 && (int) this.type < 164 || ((int) this.type == 117 || (int) this.type == 118)))) + { + if ((int) Main.npc[(int) this.ai0].active == 0 || (int) Main.npc[(int) this.ai0].aiStyle != (int) this.aiStyle) + { + this.life = 0; + this.HitEffect(0, 10.0); + this.active = (byte) 0; + if (Main.netMode != 2) + return; + NetMessage.SendNpcHurt((int) this.whoAmI, -1); + return; + } + } + else if ((int) this.type >= 13 && (int) this.type <= 15) + { + if ((int) Main.npc[(int) this.ai1].active == 0 && (int) Main.npc[(int) this.ai0].active == 0 || (int) this.type == 13 && (int) Main.npc[(int) this.ai0].active == 0 || (int) this.type == 15 && (int) Main.npc[(int) this.ai1].active == 0) + { + this.life = 0; + this.HitEffect(0, 10.0); + this.active = (byte) 0; + } + if ((int) this.type == 14) + { + if ((int) Main.npc[(int) this.ai1].active == 0 || (int) Main.npc[(int) this.ai1].aiStyle != (int) this.aiStyle) + { + this.type = (byte) 13; + int num1 = (int) this.whoAmI; + float num2 = (float) this.life / (float) this.lifeMax; + float num3 = this.ai0; + this.SetDefaults((int) this.type, -1.0); + this.life = (int) ((double) this.lifeMax * (double) num2); + this.ai0 = num3; + this.TargetClosest(true); + this.netUpdate = true; + this.whoAmI = (short) num1; + } + else if ((int) Main.npc[(int) this.ai0].active == 0 || (int) Main.npc[(int) this.ai0].aiStyle != (int) this.aiStyle) + { + int num1 = (int) this.whoAmI; + float num2 = (float) this.life / (float) this.lifeMax; + float num3 = this.ai1; + this.SetDefaults((int) this.type, -1.0); + this.life = (int) ((double) this.lifeMax * (double) num2); + this.ai1 = num3; + this.TargetClosest(true); + this.netUpdate = true; + this.whoAmI = (short) num1; + } + } + if (this.life == 0) + { + bool flag = true; + for (int index = 0; index < 196; ++index) + { + if ((int) Main.npc[index].type >= 13 && (int) Main.npc[index].type <= 15 && (int) Main.npc[index].active != 0) + { + flag = false; + break; + } + } + if (flag) + { + this.boss = true; + this.NPCLoot(); + } + } + if ((int) this.active == 0) + { + NetMessage.SendNpcHurt((int) this.whoAmI, -1); + return; + } + } + } + int num4 = (this.aabb.X >> 4) - 1; + int num5 = (this.aabb.X + (int) this.width >> 4) + 2; + int num6 = (this.aabb.Y >> 4) - 1; + int num7 = (this.aabb.Y + (int) this.height >> 4) + 2; + if (num4 < 0) + num4 = 0; + if (num5 > (int) Main.maxTilesX) + num5 = (int) Main.maxTilesX; + if (num6 < 0) + num6 = 0; + if (num7 > (int) Main.maxTilesY) + num7 = (int) Main.maxTilesY; + bool flag1 = (int) this.type >= 87 && (int) this.type <= 92 || (int) this.type >= 159 && (int) this.type <= 164; + if (!flag1) + { + for (int i = num4; i < num5; ++i) + { + for (int j = num6; j < num7; ++j) + { + if (Main.tile[i, j].canStandOnTop() || (int) Main.tile[i, j].liquid > 64) + { + Vector2 vector2; + vector2.X = (float) (i * 16); + vector2.Y = (float) (j * 16); + if ((double) this.position.X + (double) this.width > (double) vector2.X && (double) this.position.X < (double) vector2.X + 16.0 && ((double) this.position.Y + (double) this.height > (double) vector2.Y && (double) this.position.Y < (double) vector2.Y + 16.0)) + { + flag1 = true; + if (Main.rand.Next(100) == 0 && (int) this.type != 117 && (int) Main.tile[i, j].active != 0) + WorldGen.KillTile(i, j, true, true, false); + } + } + } + } + } + if (!flag1 && ((int) this.type == 7 || (int) this.type == 10 || ((int) this.type == 13 || (int) this.type == 39) || ((int) this.type == 95 || (int) this.type == 98 || (int) this.type == 117))) + { + bool flag2 = true; + for (int index = 0; index < 8; ++index) + { + if ((int) Main.player[index].active != 0 && this.aabb.Intersects(new Rectangle(Main.player[index].aabb.X - 1000, Main.player[index].aabb.Y - 1000, 2000, 2000))) + { + flag2 = false; + break; + } + } + if (flag2) + flag1 = true; + } + if ((int) this.type >= 87 && (int) this.type <= 92 || (int) this.type >= 159 && (int) this.type <= 164) + { + if ((double) this.velocity.X < 0.0) + this.spriteDirection = (sbyte) 1; + else if ((double) this.velocity.X > 0.0) + this.spriteDirection = (sbyte) -1; + } + float num8 = 8f; + float num9 = 0.07f; + if ((int) this.type == 95) + { + num8 = 5.5f; + num9 = 0.045f; + } + else if ((int) this.type == 10) + { + num8 = 6f; + num9 = 0.05f; + } + else if ((int) this.type == 13) + { + num8 = 10f; + num9 = 0.07f; + } + else if ((int) this.type == 87 || (int) this.type == 159) + { + num8 = 11f; + num9 = 0.25f; + } + else if ((int) this.type == 117 && NPC.wof >= 0) + { + float num1 = (float) Main.npc[NPC.wof].life / (float) Main.npc[NPC.wof].lifeMax; + if ((double) num1 < 0.5) + { + ++num8; + num9 += 0.1f; + } + if ((double) num1 < 0.25) + { + ++num8; + num9 += 0.1f; + } + if ((double) num1 < 0.1) + { + num8 += 2f; + num9 += 0.1f; + } + } + Vector2 vector2_1 = this.position; + vector2_1.X += (float) ((int) this.width >> 1); + vector2_1.Y += (float) ((int) this.height >> 1); + if ((double) this.ai1 > 0.0 && (double) this.ai1 < 196.0) + { + vector2_1.X = this.position.X + (float) ((int) this.width >> 1); + vector2_1.Y = this.position.Y + (float) ((int) this.height >> 1); + float num1 = Main.npc[(int) this.ai1].position.X + (float) ((int) Main.npc[(int) this.ai1].width >> 1) - vector2_1.X; + float num2 = Main.npc[(int) this.ai1].position.Y + (float) ((int) Main.npc[(int) this.ai1].height >> 1) - vector2_1.Y; + this.rotation = (float) (Math.Atan2((double) num2, (double) num1) + Math.PI / 2.0); + float num3 = (float) ((double) num1 * (double) num1 + (double) num2 * (double) num2); + bool flag2 = (int) this.type >= 87 && (int) this.type <= 92 || (int) this.type >= 159 && (int) this.type <= 164; + if ((double) num3 > 0.0) + { + float num10 = (float) Math.Sqrt((double) num3); + float num11 = (num10 - (flag2 ? 30f : (float) this.width)) / num10; + num1 *= num11; + float num12 = num2 * num11; + this.position.X += num1; + this.position.Y += num12; + this.aabb.X = (int) this.position.X; + this.aabb.Y = (int) this.position.Y; + } + this.velocity.X = 0.0f; + this.velocity.Y = 0.0f; + if (!flag2) + return; + if ((double) num1 < 0.0) + { + this.spriteDirection = (sbyte) 1; + } + else + { + if ((double) num1 <= 0.0) + return; + this.spriteDirection = (sbyte) -1; + } + } + else + { + float num1 = (float) (Main.player[(int) this.target].aabb.X + 10 & -16); + float num2 = (float) (Main.player[(int) this.target].aabb.Y + 21 & -16); + vector2_1.X = (float) ((int) vector2_1.X & -16); + vector2_1.Y = (float) ((int) vector2_1.Y & -16); + float num3 = num1 - vector2_1.X; + float num10 = num2 - vector2_1.Y; + if (!flag1) + { + this.TargetClosest(true); + this.velocity.Y += 0.11f; + if ((double) this.velocity.Y > (double) num8) + this.velocity.Y = num8; + if ((double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y) < (double) num8 * 0.4) + { + if ((double) this.velocity.X < 0.0) + this.velocity.X -= num9 * 1.1f; + else + this.velocity.X += num9 * 1.1f; + } + else if ((double) this.velocity.Y == (double) num8) + { + if ((double) this.velocity.X < (double) num3) + this.velocity.X += num9; + else if ((double) this.velocity.X > (double) num3) + this.velocity.X -= num9; + } + else if ((double) this.velocity.Y > 4.0) + { + if ((double) this.velocity.X < 0.0) + this.velocity.X += num9 * 0.9f; + else + this.velocity.X -= num9 * 0.9f; + } + } + else + { + float num11 = (float) Math.Sqrt((double) num3 * (double) num3 + (double) num10 * (double) num10); + if ((int) this.soundDelay == 0 && (int) this.type != 87 && ((int) this.type != 159 && (int) this.type != 117)) + { + int num12 = (int) ((double) num11 * 0.025000000372529); + if (num12 < 10) + num12 = 10; + else if (num12 > 20) + num12 = 20; + this.soundDelay = (short) num12; + Main.PlaySound(15, this.aabb.X, this.aabb.Y, 1); + } + float num13 = Math.Abs(num3); + float num14 = Math.Abs(num10); + float num15 = num8 / num11; + float num16 = num3 * num15; + float num17 = num10 * num15; + if (((int) this.type == 7 || (int) this.type == 13) && !Main.player[(int) this.target].zoneEvil) + { + bool flag2 = true; + for (int index = 0; index < 8; ++index) + { + if ((int) Main.player[index].active != 0 && !Main.player[index].dead && Main.player[index].zoneEvil) + { + flag2 = false; + break; + } + } + if (flag2) + { + if (Main.netMode != 1 && this.aabb.Y >> 4 > Main.rockLayer + (int) Main.maxTilesY >> 1) + { + this.active = (byte) 0; + for (int number = (int) this.ai0; number > 0 && number < 196 && ((int) Main.npc[number].active != 0 && (int) Main.npc[number].aiStyle == (int) this.aiStyle); { + int num12; + number = num12; + } + ) + { + num12 = (int) Main.npc[number].ai0; + Main.npc[number].active = (byte) 0; + this.life = 0; + NetMessage.CreateMessage1(23, number); + NetMessage.SendMessage(); + } + NetMessage.CreateMessage1(23, (int) this.whoAmI); + NetMessage.SendMessage(); + return; + } + else + { + num16 = 0.0f; + num17 = num8; + } + } + } + bool flag3 = false; + if ((int) this.type == 87 || (int) this.type == 159) + { + if (((double) this.velocity.X > 0.0 && (double) num16 < 0.0 || (double) this.velocity.X < 0.0 && (double) num16 > 0.0 || ((double) this.velocity.Y > 0.0 && (double) num17 < 0.0 || (double) this.velocity.Y < 0.0 && (double) num17 > 0.0)) && ((double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y) > (double) num9 * 0.5 && (double) num11 < 300.0)) + { + flag3 = true; + if ((double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y) < (double) num8) + { + this.velocity.X *= 1.1f; + this.velocity.Y *= 1.1f; + } + } + if (this.aabb.Y > Main.player[(int) this.target].aabb.Y || Main.player[(int) this.target].aabb.Y > Main.worldSurfacePixels || Main.player[(int) this.target].dead) + { + flag3 = true; + if ((double) Math.Abs(this.velocity.X) < (double) num8 * 0.5) + { + if ((double) this.velocity.X == 0.0) + this.velocity.X -= (float) this.direction; + this.velocity.X *= 1.1f; + } + else if ((double) this.velocity.Y > -(double) num8) + this.velocity.Y -= num9; + } + } + if (!flag3) + { + if ((double) this.velocity.X > 0.0 && (double) num16 > 0.0 || (double) this.velocity.X < 0.0 && (double) num16 < 0.0 || ((double) this.velocity.Y > 0.0 && (double) num17 > 0.0 || (double) this.velocity.Y < 0.0 && (double) num17 < 0.0)) + { + if ((double) this.velocity.X < (double) num16) + this.velocity.X += num9; + else if ((double) this.velocity.X > (double) num16) + this.velocity.X -= num9; + if ((double) this.velocity.Y < (double) num17) + this.velocity.Y += num9; + else if ((double) this.velocity.Y > (double) num17) + this.velocity.Y -= num9; + if ((double) Math.Abs(num17) < (double) num8 * 0.2 && ((double) this.velocity.X > 0.0 && (double) num16 < 0.0 || (double) this.velocity.X < 0.0 && (double) num16 > 0.0)) + { + if ((double) this.velocity.Y > 0.0) + this.velocity.Y += num9 * 2f; + else + this.velocity.Y -= num9 * 2f; + } + if ((double) Math.Abs(num16) < (double) num8 * 0.2 && ((double) this.velocity.Y > 0.0 && (double) num17 < 0.0 || (double) this.velocity.Y < 0.0 && (double) num17 > 0.0)) + { + if ((double) this.velocity.X > 0.0) + this.velocity.X += num9 * 2f; + else + this.velocity.X -= num9 * 2f; + } + } + else if ((double) num13 > (double) num14) + { + if ((double) this.velocity.X < (double) num16) + this.velocity.X += num9 * 1.1f; + else if ((double) this.velocity.X > (double) num16) + this.velocity.X -= num9 * 1.1f; + if ((double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y) < (double) num8 * 0.5) + { + if ((double) this.velocity.Y > 0.0) + this.velocity.Y += num9; + else + this.velocity.Y -= num9; + } + } + else + { + if ((double) this.velocity.Y < (double) num17) + this.velocity.Y += num9 * 1.1f; + else if ((double) this.velocity.Y > (double) num17) + this.velocity.Y -= num9 * 1.1f; + if ((double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y) < (double) num8 * 0.5) + { + if ((double) this.velocity.X > 0.0) + this.velocity.X += num9; + else + this.velocity.X -= num9; + } + } + } + } + this.rotation = (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X) + 1.57f; + if ((int) this.type != 7 && (int) this.type != 10 && ((int) this.type != 13 && (int) this.type != 39) && ((int) this.type != 95 && (int) this.type != 98 && (int) this.type != 117)) + return; + if (flag1) + { + if (this.localAI0 != 1) + this.netUpdate = true; + this.localAI0 = 1; + } + else + { + if (this.localAI0 != 0) + this.netUpdate = true; + this.localAI0 = 0; + } + if (((double) this.velocity.X <= 0.0 || (double) this.oldVelocity.X >= 0.0) && ((double) this.velocity.X >= 0.0 || (double) this.oldVelocity.X <= 0.0) && (((double) this.velocity.Y <= 0.0 || (double) this.oldVelocity.Y >= 0.0) && ((double) this.velocity.Y >= 0.0 || (double) this.oldVelocity.Y <= 0.0)) || this.justHit) + return; + this.netUpdate = true; + } + } + + private void TownsfolkAI() + { + if ((int) this.type == 46) + { + if ((int) this.target == 8) + this.TargetClosest(true); + } + else if ((int) this.type == 107) + NPC.savedGoblin = true; + else if ((int) this.type == 108) + NPC.savedWizard = true; + else if ((int) this.type == 124) + NPC.savedMech = true; + else if ((int) this.type == 142 && Main.netMode != 1 && !Time.xMas) + { + this.StrikeNPC(9999, 0.0f, 0, false, false); + NetMessage.SendNpcHurt((int) this.whoAmI, 9999, 0.0, 0, false); + } + int index1 = this.aabb.X + ((int) this.width >> 1) >> 4; + int index2 = this.aabb.Y + (int) this.height + 1 >> 4; + bool flag1 = false; + this.directionY = (sbyte) -1; + this.direction |= (sbyte) 1; + for (int index3 = 0; index3 < 8; ++index3) + { + if ((int) Main.player[index3].active != 0 && (int) Main.player[index3].talkNPC == (int) this.whoAmI) + { + flag1 = true; + if ((double) this.ai0 != 0.0) + this.netUpdate = true; + this.ai0 = 0.0f; + this.ai1 = 300f; + this.ai2 = 100f; + this.direction = Main.player[index3].aabb.X + 10 >= this.aabb.X + ((int) this.width >> 1) ? (sbyte) 1 : (sbyte) -1; + } + } + if ((double) this.ai3 > 0.0 && (int) this.active != 0) + { + this.life = -1; + this.HitEffect(0, 10.0); + this.active = (byte) 0; + if ((int) this.type == 37) + Main.PlaySound(15, this.aabb.X, this.aabb.Y, 0); + } + if ((int) this.type == 37 && Main.netMode != 1) + { + this.homeless = false; + this.homeTileX = Main.dungeonX; + this.homeTileY = Main.dungeonY; + if (NPC.downedBoss3) + { + this.ai3 = 1f; + this.netUpdate = true; + } + } + int j = (int) this.homeTileY; + if (Main.netMode != 1 && j > 0) + { + while (!WorldGen.SolidTile((int) this.homeTileX, j) && j < (int) Main.maxTilesY - 20) + ++j; + } + if (Main.netMode != 1 && this.townNPC && !this.homeless && ((index1 != (int) this.homeTileX || index2 != j) && (!Main.gameTime.dayTime || Main.tileDungeon[(int) Main.tile[index1, index2].type]))) + { + bool flag2 = true; + Rectangle rectangle = new Rectangle(); + rectangle.X = this.aabb.X + ((int) this.width >> 1) - 960 - 62; + rectangle.Y = this.aabb.Y + ((int) this.height >> 1) - 540 - 34; + rectangle.Width = 2044; + rectangle.Height = 1148; + for (int index3 = 0; index3 < 8; ++index3) + { + if ((int) Main.player[index3].active != 0 && rectangle.Intersects(Main.player[index3].aabb)) + { + flag2 = false; + break; + } + } + if (flag2) + { + rectangle.X = (int) this.homeTileX * 16 + 8 - 960 - 62; + rectangle.Y = j * 16 + 8 - 540 - 34; + for (int index3 = 0; index3 < 8; ++index3) + { + if ((int) Main.player[index3].active != 0 && rectangle.Intersects(Main.player[index3].aabb)) + { + flag2 = false; + break; + } + } + if (flag2) + { + if ((int) this.type == 37 || !Collision.SolidTiles((int) this.homeTileX - 1, (int) this.homeTileX + 1, j - 3, j - 1)) + { + this.velocity.X = 0.0f; + this.velocity.Y = 0.0f; + this.position.X = (float) (this.aabb.X = ((int) this.homeTileX << 4) + 8 - ((int) this.width >> 1)); + this.position.Y = (float) ((j << 4) - (int) this.height) - 0.1f; + this.aabb.Y = (int) this.position.Y; + this.netUpdate = true; + } + else + { + this.homeless = true; + WorldGen.QuickFindHome((int) this.whoAmI); + } + } + } + } + if ((double) this.ai0 == 0.0) + { + if ((double) this.ai2 > 0.0) + --this.ai2; + if (!Main.gameTime.dayTime && !flag1 && (int) this.type != 46) + { + if (Main.netMode != 1) + { + if (index1 == (int) this.homeTileX && index2 == j) + { + if ((double) this.velocity.X != 0.0) + this.netUpdate = true; + if ((double) this.velocity.X > 0.1) + this.velocity.X -= 0.1f; + else if ((double) this.velocity.X < -0.1) + this.velocity.X += 0.1f; + else + this.velocity.X = 0.0f; + } + else if (!flag1) + { + this.direction = index1 <= (int) this.homeTileX ? (sbyte) 1 : (sbyte) -1; + this.ai0 = 1f; + this.ai1 = (float) (200 + Main.rand.Next(200)); + this.ai2 = 0.0f; + this.netUpdate = true; + } + } + } + else + { + if ((double) this.velocity.X > 0.1) + this.velocity.X -= 0.1f; + else if ((double) this.velocity.X < -0.1) + this.velocity.X += 0.1f; + else + this.velocity.X = 0.0f; + if (Main.netMode != 1) + { + if ((double) this.ai1 > 0.0) + --this.ai1; + if ((double) this.ai1 <= 0.0) + { + this.ai0 = 1f; + this.ai1 = (float) (200 + Main.rand.Next(200)); + if ((int) this.type == 46) + this.ai1 += (float) Main.rand.Next(200, 400); + this.ai2 = 0.0f; + this.netUpdate = true; + } + } + } + if (Main.netMode == 1 || !Main.gameTime.dayTime && (index1 != (int) this.homeTileX || index2 != j)) + return; + if (index1 < (int) this.homeTileX - 25 || index1 > (int) this.homeTileX + 25) + { + if ((double) this.ai2 != 0.0) + return; + if (index1 < (int) this.homeTileX - 50 && (int) this.direction == -1) + { + this.direction = (sbyte) 1; + this.netUpdate = true; + } + else + { + if (index1 <= (int) this.homeTileX + 50 || (int) this.direction != 1) + return; + this.direction = (sbyte) -1; + this.netUpdate = true; + } + } + else + { + if (Main.rand.Next(80) != 0 || (double) this.ai2 != 0.0) + return; + this.ai2 = 200f; + this.direction = -this.direction; + this.netUpdate = true; + } + } + else + { + if ((double) this.ai0 != 1.0) + return; + if (Main.netMode != 1 && !Main.gameTime.dayTime && (index1 == (int) this.homeTileX && index2 == (int) this.homeTileY) && (int) this.type != 46) + { + this.ai0 = 0.0f; + this.ai1 = (float) (200 + Main.rand.Next(200)); + this.ai2 = 60f; + this.netUpdate = true; + } + else + { + if (Main.netMode != 1 && !this.homeless && !Main.tileDungeon[(int) Main.tile[index1, index2].type] && (index1 < (int) this.homeTileX - 35 || index1 > (int) this.homeTileX + 35)) + { + if (this.aabb.X < (int) this.homeTileX << 4 && (int) this.direction == -1) + this.ai1 -= 5f; + else if (this.aabb.X > (int) this.homeTileX << 4 && (int) this.direction == 1) + this.ai1 -= 5f; + } + --this.ai1; + if ((double) this.ai1 <= 0.0) + { + this.ai0 = 0.0f; + this.ai1 = (float) (300 + Main.rand.Next(300)); + if ((int) this.type == 46) + this.ai1 -= (float) Main.rand.Next(100); + this.ai2 = 60f; + this.netUpdate = true; + } + if (this.closeDoor) + { + int num1 = this.aabb.X + ((int) this.width >> 1) >> 4; + if (num1 > (int) this.doorX + 2 || num1 < (int) this.doorX - 2) + { + if (WorldGen.CloseDoor((int) this.doorX, (int) this.doorY, false)) + { + this.closeDoor = false; + NetMessage.CreateMessage2(24, (int) this.doorX, (int) this.doorY); + NetMessage.SendMessage(); + } + else + { + int num2 = this.aabb.Y + ((int) this.height >> 1) >> 4; + if (num1 > (int) this.doorX + 4 || num1 < (int) this.doorX - 4 || (num2 > (int) this.doorY + 4 || num2 < (int) this.doorY - 4)) + this.closeDoor = false; + } + } + } + if ((double) this.velocity.X < -1.0 || (double) this.velocity.X > 1.0) + { + if ((double) this.velocity.Y == 0.0) + this.velocity.X *= 0.8f; + } + else if ((double) this.velocity.X < 1.15 && (int) this.direction == 1) + { + this.velocity.X += 0.07f; + if ((double) this.velocity.X > 1.0) + this.velocity.X = 1f; + } + else if ((double) this.velocity.X > -1.0 && (int) this.direction == -1) + { + this.velocity.X -= 0.07f; + if ((double) this.velocity.X > 1.0) + this.velocity.X = 1f; + } + if ((double) this.velocity.Y != 0.0) + return; + if ((double) this.position.X == (double) this.ai2) + this.direction = -this.direction; + this.ai2 = -1f; + int index3 = this.aabb.X + ((int) this.width >> 1) + 15 * (int) this.direction >> 4; + int index4 = this.aabb.Y + (int) this.height - 16 >> 4; + if (this.townNPC && (int) Main.tile[index3, index4 - 2].active != 0 && (int) Main.tile[index3, index4 - 2].type == 10 && (Main.rand.Next(10) == 0 || !Main.gameTime.dayTime)) + { + if (Main.netMode == 1) + return; + int number3 = WorldGen.OpenDoor(index3, index4 - 2, (int) this.direction); + if (number3 != 0) + { + this.closeDoor = true; + this.doorX = (short) index3; + this.doorY = (short) (index4 - 2); + NetMessage.CreateMessage3(19, index3, index4 - 2, number3); + NetMessage.SendMessage(); + this.ai1 += 80f; + } + else + this.direction = -this.direction; + this.netUpdate = true; + } + else + { + if ((double) this.velocity.X < 0.0 && (int) this.spriteDirection == -1 || (double) this.velocity.X > 0.0 && (int) this.spriteDirection == 1) + { + if ((int) Main.tile[index3, index4 - 2].active != 0 && Main.tileSolidNotSolidTop[(int) Main.tile[index3, index4 - 2].type]) + { + if ((int) this.direction == 1 && !Collision.SolidTiles(index3 - 2, index3 - 1, index4 - 5, index4 - 1) || (int) this.direction == -1 && !Collision.SolidTiles(index3 + 1, index3 + 2, index4 - 5, index4 - 1)) + { + if (!Collision.SolidTiles(index3, index3, index4 - 5, index4 - 3)) + this.velocity.Y = -6f; + else + this.direction = -this.direction; + } + else + this.direction = -this.direction; + this.netUpdate = true; + } + else if ((int) Main.tile[index3, index4 - 1].active != 0 && Main.tileSolidNotSolidTop[(int) Main.tile[index3, index4 - 1].type]) + { + if ((int) this.direction == 1 && !Collision.SolidTiles(index3 - 2, index3 - 1, index4 - 4, index4 - 1) || (int) this.direction == -1 && !Collision.SolidTiles(index3 + 1, index3 + 2, index4 - 4, index4 - 1)) + { + if (!Collision.SolidTiles(index3, index3, index4 - 4, index4 - 2)) + this.velocity.Y = -5f; + else + this.direction = -this.direction; + } + else + this.direction = -this.direction; + this.netUpdate = true; + } + else if ((int) Main.tile[index3, index4].active != 0 && Main.tileSolidNotSolidTop[(int) Main.tile[index3, index4].type]) + { + if ((int) this.direction == 1 && !Collision.SolidTiles(index3 - 2, index3, index4 - 3, index4 - 1) || (int) this.direction == -1 && !Collision.SolidTiles(index3, index3 + 2, index4 - 3, index4 - 1)) + this.velocity.Y = -3.6f; + else + this.direction = -this.direction; + this.netUpdate = true; + } + if (index1 >= (int) this.homeTileX - 35 && index1 <= (int) this.homeTileX + 35 && ((int) Main.tile[index3, index4 + 1].active == 0 || !Main.tileSolid[(int) Main.tile[index3, index4 + 1].type]) && (((int) Main.tile[index3 - (int) this.direction, index4 + 1].active == 0 || !Main.tileSolid[(int) Main.tile[index3 - (int) this.direction, index4 + 1].type]) && ((int) Main.tile[index3, index4 + 2].active == 0 || !Main.tileSolid[(int) Main.tile[index3, index4 + 2].type])) && (((int) Main.tile[index3 - (int) this.direction, index4 + 2].active == 0 || !Main.tileSolid[(int) Main.tile[index3 - (int) this.direction, index4 + 2].type]) && ((int) Main.tile[index3, index4 + 3].active == 0 || !Main.tileSolid[(int) Main.tile[index3, index4 + 3].type]) && (((int) Main.tile[index3 - (int) this.direction, index4 + 3].active == 0 || !Main.tileSolid[(int) Main.tile[index3 - (int) this.direction, index4 + 3].type]) && ((int) Main.tile[index3, index4 + 4].active == 0 || !Main.tileSolid[(int) Main.tile[index3, index4 + 4].type]))) && (((int) Main.tile[index3 - (int) this.direction, index4 + 4].active == 0 || !Main.tileSolid[(int) Main.tile[index3 - (int) this.direction, index4 + 4].type]) && (int) this.type != 46)) + { + this.direction = -this.direction; + this.velocity.X = -this.velocity.X; + this.netUpdate = true; + } + if ((double) this.velocity.Y < 0.0) + this.ai2 = this.position.X; + } + if ((double) this.velocity.Y >= 0.0) + return; + if (this.wet) + this.velocity.Y *= 1.2f; + if ((int) this.type != 46) + return; + this.velocity.Y *= 1.2f; + } + } + } + } + + private unsafe void SorcererAI() + { + this.TargetClosest(true); + this.velocity.X *= 0.93f; + if ((double) this.velocity.X > -0.1 && (double) this.velocity.X < 0.1) + this.velocity.X = 0.0f; + if ((double) this.ai0 == 0.0) + this.ai0 = 500f; + if ((double) this.ai2 != 0.0 && (double) this.ai3 != 0.0) + { + Main.PlaySound(2, this.aabb.X, this.aabb.Y, 8); + for (int index = 0; index < 42; ++index) + { + Dust* dustPtr; + if ((int) this.type == 29 || (int) this.type == 45) + { + dustPtr = Main.dust.NewDust(27, ref this.aabb, 0.0, 0.0, 100, new Color(), (double) Main.rand.Next(1, 3)); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + if ((double) dustPtr->scale > 1.0) + dustPtr->noGravity = true; + } + else + break; + } + else if ((int) this.type == 32) + { + dustPtr = Main.dust.NewDust(29, ref this.aabb, 0.0, 0.0, 100, new Color(), 2.5); + if ((IntPtr) dustPtr != IntPtr.Zero) + dustPtr->noGravity = true; + else + break; + } + else + { + dustPtr = Main.dust.NewDust(6, ref this.aabb, 0.0, 0.0, 100, new Color(), 2.5); + if ((IntPtr) dustPtr != IntPtr.Zero) + dustPtr->noGravity = true; + else + break; + } + dustPtr->velocity.X *= 3f; + dustPtr->velocity.Y *= 3f; + } + this.position.X = (float) ((double) this.ai2 * 16.0 - (double) ((int) this.width >> 1) + 8.0); + this.position.Y = this.ai3 * 16f - (float) this.height; + this.aabb.X = (int) this.position.X; + this.aabb.Y = (int) this.position.Y; + this.velocity.X = 0.0f; + this.velocity.Y = 0.0f; + this.ai2 = 0.0f; + this.ai3 = 0.0f; + Main.PlaySound(2, this.aabb.X, this.aabb.Y, 8); + for (int index = 0; index < 42; ++index) + { + Dust* dustPtr; + if ((int) this.type == 29 || (int) this.type == 45) + { + dustPtr = Main.dust.NewDust(27, ref this.aabb, 0.0, 0.0, 100, new Color(), (double) Main.rand.Next(1, 3)); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + if ((double) dustPtr->scale > 1.0) + dustPtr->noGravity = true; + } + else + break; + } + else if ((int) this.type == 32) + { + dustPtr = Main.dust.NewDust(29, ref this.aabb, 0.0, 0.0, 100, new Color(), 2.5); + if ((IntPtr) dustPtr != IntPtr.Zero) + dustPtr->noGravity = true; + else + break; + } + else + { + dustPtr = Main.dust.NewDust(6, ref this.aabb, 0.0, 0.0, 100, new Color(), 2.5); + if ((IntPtr) dustPtr != IntPtr.Zero) + dustPtr->noGravity = true; + else + break; + } + dustPtr->velocity.X *= 3f; + dustPtr->velocity.Y *= 3f; + } + } + ++this.ai0; + if ((double) this.ai0 == 100.0 || (double) this.ai0 == 200.0 || (double) this.ai0 == 300.0) + { + this.ai1 = 30f; + this.netUpdate = true; + } + else if ((double) this.ai0 >= 650.0 && Main.netMode != 1) + { + this.ai0 = 1f; + int num1 = Main.player[(int) this.target].aabb.X >> 4; + int num2 = Main.player[(int) this.target].aabb.Y >> 4; + int num3 = this.aabb.X >> 4; + int num4 = this.aabb.Y >> 4; + int num5 = 20; + int num6 = 0; + bool flag1 = false; + if (Math.Abs(this.aabb.X - Main.player[(int) this.target].aabb.X) + Math.Abs(this.aabb.Y - Main.player[(int) this.target].aabb.Y) > 2000) + { + num6 = 100; + flag1 = true; + } + while (!flag1 && num6 < 100) + { + ++num6; + int index1 = Main.rand.Next(num1 - num5, num1 + num5); + for (int index2 = Main.rand.Next(num2 - num5, num2 + num5); index2 < num2 + num5; ++index2) + { + if ((index2 < num2 - 4 || index2 > num2 + 4 || (index1 < num1 - 4 || index1 > num1 + 4)) && (index2 < num4 - 1 || index2 > num4 + 1 || (index1 < num3 - 1 || index1 > num3 + 1)) && (int) Main.tile[index1, index2].active != 0) + { + bool flag2 = true; + if ((int) this.type == 32 && (int) Main.tile[index1, index2 - 1].wall == 0) + flag2 = false; + else if ((int) Main.tile[index1, index2 - 1].lava != 0) + flag2 = false; + if (flag2 && Main.tileSolid[(int) Main.tile[index1, index2].type] && !Collision.SolidTiles(index1 - 1, index1 + 1, index2 - 4, index2 - 1)) + { + this.ai1 = 20f; + this.ai2 = (float) index1; + this.ai3 = (float) index2; + flag1 = true; + break; + } + } + } + } + this.netUpdate = true; + } + if ((double) this.ai1 > 0.0) + { + --this.ai1; + if ((double) this.ai1 == 25.0) + { + Main.PlaySound(2, this.aabb.X, this.aabb.Y, 8); + if (Main.netMode != 1) + { + if ((int) this.type == 29 || (int) this.type == 45) + NPC.NewNPC(this.aabb.X + ((int) this.width >> 1), this.aabb.Y - 8, 30, 0); + else if ((int) this.type == 32) + NPC.NewNPC(this.aabb.X + ((int) this.width >> 1), this.aabb.Y - 8, 33, 0); + else + NPC.NewNPC(this.aabb.X + ((int) this.width >> 1) + (int) this.direction * 8, this.aabb.Y + 20, 25, 0); + } + } + } + if ((int) this.type == 29 || (int) this.type == 45) + { + if (Main.rand.Next(5) != 0) + return; + Dust* dustPtr = Main.dust.NewDust(this.aabb.X, this.aabb.Y + 2, (int) this.width, (int) this.height, 27, (double) this.velocity.X * 0.200000002980232, (double) this.velocity.Y * 0.200000002980232, 100, new Color(), 1.5); + if ((IntPtr) dustPtr == IntPtr.Zero) + return; + dustPtr->noGravity = true; + dustPtr->velocity.X *= 0.5f; + dustPtr->velocity.Y = -2f; + } + else if ((int) this.type == 32) + { + if (Main.rand.Next(2) != 0) + return; + Dust* dustPtr = Main.dust.NewDust(this.aabb.X, this.aabb.Y + 2, (int) this.width, (int) this.height, 29, (double) this.velocity.X * 0.200000002980232, (double) this.velocity.Y * 0.200000002980232, 100, new Color(), 2.0); + if ((IntPtr) dustPtr == IntPtr.Zero) + return; + dustPtr->noGravity = true; + dustPtr->velocity.X *= 1f; + dustPtr->velocity.Y *= 1f; + } + else + { + if (Main.rand.Next(2) != 0) + return; + Dust* dustPtr = Main.dust.NewDust(this.aabb.X, this.aabb.Y + 2, (int) this.width, (int) this.height, 6, (double) this.velocity.X * 0.200000002980232, (double) this.velocity.Y * 0.200000002980232, 100, new Color(), 2.0); + if ((IntPtr) dustPtr == IntPtr.Zero) + return; + dustPtr->noGravity = true; + dustPtr->velocity.X *= 1f; + dustPtr->velocity.Y *= 1f; + } + } + + private unsafe void SphereAI() + { + if ((int) this.target == 8) + { + this.TargetClosest(true); + float num1 = 6f; + if ((int) this.type == 25) + num1 = 5f; + if ((int) this.type == 112) + num1 = 7f; + Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num2 = Main.player[(int) this.target].position.X + 10f - vector2.X; + float num3 = Main.player[(int) this.target].position.Y + 21f - vector2.Y; + float num4 = (float) Math.Sqrt((double) num2 * (double) num2 + (double) num3 * (double) num3); + float num5 = num1 / num4; + this.velocity.X = num2 * num5; + this.velocity.Y = num3 * num5; + } + if ((int) this.type == 112) + { + ++this.ai0; + if ((double) this.ai0 > 3.0) + this.ai0 = 3f; + if ((double) this.ai0 == 2.0) + { + this.position.X += this.velocity.X; + this.position.Y += this.velocity.Y; + this.aabb.X = (int) this.position.X; + this.aabb.Y = (int) this.position.Y; + Main.PlaySound(4, this.aabb.X, this.aabb.Y, 9); + for (int index = 0; index < 16; ++index) + { + Dust* dustPtr = Main.dust.NewDust(this.aabb.X, this.aabb.Y + 2, (int) this.width, (int) this.height, 18, 0.0, 0.0, 100, new Color(), 1.79999995231628); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.X *= 1.3f; + dustPtr->velocity.Y *= 1.3f; + dustPtr->velocity.X += this.velocity.X; + dustPtr->velocity.Y += this.velocity.Y; + dustPtr->noGravity = true; + } + else + break; + } + } + if (Collision.SolidCollision(ref this.position, (int) this.width, (int) this.height)) + { + if (Main.netMode != 1) + { + int num1 = this.aabb.X + ((int) this.width >> 1) >> 4; + int num2 = this.aabb.Y + ((int) this.height >> 1) >> 4; + int num3 = 8; + for (int index1 = num1 - num3; index1 <= num1 + num3; ++index1) + { + for (int index2 = num2 - num3; index2 < num2 + num3; ++index2) + { + if ((double) (Math.Abs(index1 - num1) + Math.Abs(index2 - num2)) < (double) num3 * 0.5) + { + if ((int) Main.tile[index1, index2].type == 2) + { + Main.tile[index1, index2].type = (byte) 23; + WorldGen.SquareTileFrame(index1, index2, -1); + NetMessage.SendTile(index1, index2); + } + else if ((int) Main.tile[index1, index2].type == 1) + { + Main.tile[index1, index2].type = (byte) 25; + WorldGen.SquareTileFrame(index1, index2, -1); + NetMessage.SendTile(index1, index2); + } + else if ((int) Main.tile[index1, index2].type == 53) + { + Main.tile[index1, index2].type = (byte) 112; + WorldGen.SquareTileFrame(index1, index2, -1); + NetMessage.SendTile(index1, index2); + } + else if ((int) Main.tile[index1, index2].type == 109) + { + Main.tile[index1, index2].type = (byte) 23; + WorldGen.SquareTileFrame(index1, index2, -1); + NetMessage.SendTile(index1, index2); + } + else if ((int) Main.tile[index1, index2].type == 117) + { + Main.tile[index1, index2].type = (byte) 25; + WorldGen.SquareTileFrame(index1, index2, -1); + NetMessage.SendTile(index1, index2); + } + else if ((int) Main.tile[index1, index2].type == 116) + { + Main.tile[index1, index2].type = (byte) 112; + WorldGen.SquareTileFrame(index1, index2, -1); + NetMessage.SendTile(index1, index2); + } + } + } + } + } + this.StrikeNPC(999, 0.0f, 0, false, false); + } + } + if (this.timeLeft > 100) + this.timeLeft = 100; + for (int index = 0; index < 2; ++index) + { + Dust* dustPtr; + if ((int) this.type == 30) + { + dustPtr = Main.dust.NewDust(this.aabb.X, this.aabb.Y + 2, (int) this.width, (int) this.height, 27, (double) this.velocity.X * 0.200000002980232, (double) this.velocity.Y * 0.200000002980232, 100, new Color(), 2.0); + if ((IntPtr) dustPtr == IntPtr.Zero) + break; + } + else if ((int) this.type == 33) + { + dustPtr = Main.dust.NewDust(this.aabb.X, this.aabb.Y + 2, (int) this.width, (int) this.height, 29, (double) this.velocity.X * 0.200000002980232, (double) this.velocity.Y * 0.200000002980232, 100, new Color(), 2.0); + if ((IntPtr) dustPtr == IntPtr.Zero) + break; + } + else if ((int) this.type == 112) + { + dustPtr = Main.dust.NewDust(this.aabb.X, this.aabb.Y + 2, (int) this.width, (int) this.height, 18, (double) this.velocity.X * 0.100000001490116, (double) this.velocity.Y * 0.100000001490116, 80, new Color(), 1.29999995231628); + if ((IntPtr) dustPtr == IntPtr.Zero) + break; + } + else + { + Lighting.addLight(this.aabb.X + ((int) this.width >> 1) >> 4, this.aabb.Y + ((int) this.height >> 1) >> 4, new Vector3(1f, 0.3f, 0.1f)); + dustPtr = Main.dust.NewDust(this.aabb.X, this.aabb.Y + 2, (int) this.width, (int) this.height, 6, (double) this.velocity.X * 0.200000002980232, (double) this.velocity.Y * 0.200000002980232, 100, new Color(), 2.0); + } + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->noGravity = true; + dustPtr->velocity.X *= 0.3f; + dustPtr->velocity.Y *= 0.3f; + if ((int) this.type == 30) + { + dustPtr->velocity.X -= this.velocity.X * 0.2f; + dustPtr->velocity.Y -= this.velocity.Y * 0.2f; + } + } + } + this.rotation += 0.4f * (float) this.direction; + } + + private void SkullHeadAI() + { + float num1 = 1f; + float num2 = 11.0 / 1000.0; + this.TargetClosest(true); + Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num3 = Main.player[(int) this.target].position.X + 10f - vector2.X; + float num4 = Main.player[(int) this.target].position.Y + 21f - vector2.Y; + float num5 = (float) Math.Sqrt((double) num3 * (double) num3 + (double) num4 * (double) num4); + float num6 = num5; + ++this.ai1; + if ((double) this.ai1 > 600.0) + { + num2 *= 8f; + num1 = 4f; + if ((double) this.ai1 > 650.0) + this.ai1 = 0.0f; + } + else if ((double) num6 < 250.0) + { + this.ai0 += 0.9f; + if ((double) this.ai0 > 0.0) + this.velocity.Y += 0.019f; + else + this.velocity.Y -= 0.019f; + if ((double) this.ai0 < -100.0 || (double) this.ai0 > 100.0) + this.velocity.X += 0.019f; + else + this.velocity.X -= 0.019f; + if ((double) this.ai0 > 200.0) + this.ai0 = -200f; + } + if ((double) num6 > 350.0) + { + num1 = 5f; + num2 = 0.3f; + } + else if ((double) num6 > 300.0) + { + num1 = 3f; + num2 = 0.2f; + } + else if ((double) num6 > 250.0) + { + num1 = 1.5f; + num2 = 0.1f; + } + float num7 = num1 / num5; + float num8 = num3 * num7; + float num9 = num4 * num7; + if (Main.player[(int) this.target].dead) + { + num8 = (float) ((double) this.direction * (double) num1 * 0.5); + num9 = num1 * -0.5f; + } + if ((double) this.velocity.X < (double) num8) + this.velocity.X += num2; + else if ((double) this.velocity.X > (double) num8) + this.velocity.X -= num2; + if ((double) this.velocity.Y < (double) num9) + this.velocity.Y += num2; + else if ((double) this.velocity.Y > (double) num9) + this.velocity.Y -= num2; + if ((double) num8 > 0.0) + { + this.spriteDirection = (sbyte) -1; + this.rotation = (float) Math.Atan2((double) num9, (double) num8); + } + else + { + if ((double) num8 >= 0.0) + return; + this.spriteDirection = (sbyte) 1; + this.rotation = (float) Math.Atan2((double) num9, (double) num8) + 3.14f; + } + } + + private unsafe void SkeletronAI() + { + if ((double) this.ai0 == 0.0 && Main.netMode != 1) + { + this.TargetClosest(true); + this.ai0 = 1f; + if ((int) this.type != 68) + { + int index1 = NPC.NewNPC(this.aabb.X + ((int) this.width >> 1), this.aabb.Y + ((int) this.height >> 1), 36, (int) this.whoAmI); + Main.npc[index1].ai0 = -1f; + Main.npc[index1].ai1 = (float) this.whoAmI; + Main.npc[index1].target = this.target; + Main.npc[index1].netUpdate = true; + int index2 = NPC.NewNPC(this.aabb.X + ((int) this.width >> 1), this.aabb.Y + ((int) this.height >> 1), 36, (int) this.whoAmI); + Main.npc[index2].ai0 = 1f; + Main.npc[index2].ai1 = (float) this.whoAmI; + Main.npc[index2].ai3 = 150f; + Main.npc[index2].target = this.target; + Main.npc[index2].netUpdate = true; + } + } + if ((int) this.type == 68 && (double) this.ai1 != 3.0 && (double) this.ai1 != 2.0) + { + Main.PlaySound(15, this.aabb.X, this.aabb.Y, 0); + this.ai1 = 2f; + } + if (Main.player[(int) this.target].dead || Math.Abs(this.aabb.X - Main.player[(int) this.target].aabb.X) > 2000 || Math.Abs(this.aabb.Y - Main.player[(int) this.target].aabb.Y) > 2000) + { + this.TargetClosest(true); + if (Main.player[(int) this.target].dead || Math.Abs(this.aabb.X - Main.player[(int) this.target].aabb.X) > 2000 || Math.Abs(this.aabb.Y - Main.player[(int) this.target].aabb.Y) > 2000) + this.ai1 = 3f; + } + if (Main.gameTime.dayTime && (double) this.ai1 != 3.0 && (double) this.ai1 != 2.0) + { + this.ai1 = 2f; + Main.PlaySound(15, this.aabb.X, this.aabb.Y, 0); + } + if ((double) this.ai1 == 0.0) + { + this.defense = 10; + ++this.ai2; + if ((double) this.ai2 >= 800.0) + { + this.ai2 = 0.0f; + this.ai1 = 1f; + this.TargetClosest(true); + this.netUpdate = true; + } + this.rotation = this.velocity.X * 0.06666667f; + if (this.aabb.Y > Main.player[(int) this.target].aabb.Y - 250) + { + if ((double) this.velocity.Y > 0.0) + this.velocity.Y *= 0.98f; + this.velocity.Y -= 0.02f; + if ((double) this.velocity.Y > 2.0) + this.velocity.Y = 2f; + } + else if (this.aabb.Y < Main.player[(int) this.target].aabb.Y - 250) + { + if ((double) this.velocity.Y < 0.0) + this.velocity.Y *= 0.98f; + this.velocity.Y += 0.02f; + if ((double) this.velocity.Y < -2.0) + this.velocity.Y = -2f; + } + if (this.aabb.X + ((int) this.width >> 1) > Main.player[(int) this.target].aabb.X + 10) + { + if ((double) this.velocity.X > 0.0) + this.velocity.X *= 0.98f; + this.velocity.X -= 0.05f; + if ((double) this.velocity.X > 8.0) + this.velocity.X = 8f; + } + else if (this.aabb.X + ((int) this.width >> 1) < Main.player[(int) this.target].aabb.X + 10) + { + if ((double) this.velocity.X < 0.0) + this.velocity.X *= 0.98f; + this.velocity.X += 0.05f; + if ((double) this.velocity.X < -8.0) + this.velocity.X = -8f; + } + } + else if ((double) this.ai1 == 1.0) + { + this.defense = 0; + ++this.ai2; + if ((double) this.ai2 == 2.0) + Main.PlaySound(15, this.aabb.X, this.aabb.Y, 0); + if ((double) this.ai2 >= 400.0) + { + this.ai2 = 0.0f; + this.ai1 = 0.0f; + } + this.rotation += (float) this.direction * 0.3f; + Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num1 = Main.player[(int) this.target].position.X + 10f - vector2.X; + float num2 = Main.player[(int) this.target].position.Y + 21f - vector2.Y; + float num3 = 1.5f / (float) Math.Sqrt((double) num1 * (double) num1 + (double) num2 * (double) num2); + this.velocity.X = num1 * num3; + this.velocity.Y = num2 * num3; + } + else if ((double) this.ai1 == 2.0) + { + this.damage = 9999; + this.defense = 9999; + this.rotation += (float) this.direction * 0.3f; + Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num1 = Main.player[(int) this.target].position.X + 10f - vector2.X; + float num2 = Main.player[(int) this.target].position.Y + 21f - vector2.Y; + float num3 = 8f / (float) Math.Sqrt((double) num1 * (double) num1 + (double) num2 * (double) num2); + this.velocity.X = num1 * num3; + this.velocity.Y = num2 * num3; + } + else if ((double) this.ai1 == 3.0) + { + this.velocity.Y += 0.1f; + if ((double) this.velocity.Y < 0.0) + this.velocity.Y *= 0.95f; + this.velocity.X *= 0.95f; + if (this.timeLeft > 500) + this.timeLeft = 500; + } + if ((double) this.ai1 == 2.0 || (double) this.ai1 == 3.0 || (int) this.type == 68) + return; + Dust* dustPtr1 = Main.dust.NewDust(this.aabb.X + ((int) this.width >> 1) - 15 - (int) ((double) this.velocity.X * 5.0), this.aabb.Y + (int) this.height - 2, 30, 10, 5, (double) this.velocity.X * -0.200000002980232, 3.0, 0, new Color(), 2.0); + if ((IntPtr) dustPtr1 != IntPtr.Zero) + { + dustPtr1->noGravity = true; + dustPtr1->velocity.X *= 1.3f; + dustPtr1->velocity.X += this.velocity.X * 0.4f; + dustPtr1->velocity.Y += 2f + this.velocity.Y; + } + for (int index = 0; index < 2; ++index) + { + Dust* dustPtr2 = Main.dust.NewDust(this.aabb.X, this.aabb.Y + 120, (int) this.width, 60, 5, (double) this.velocity.X, (double) this.velocity.Y, 0, new Color(), 2.0); + if ((IntPtr) dustPtr2 == IntPtr.Zero) + break; + dustPtr2->noGravity = true; + dustPtr2->velocity -= this.velocity; + dustPtr2->velocity.Y += 5f; + } + } + + private void SkeletronHandAI() + { + this.spriteDirection = (sbyte) -(double) this.ai0; + if ((int) Main.npc[(int) this.ai1].active == 0 || (int) Main.npc[(int) this.ai1].aiStyle != 11) + { + this.ai2 += 10f; + if ((double) this.ai2 > 50.0 || Main.netMode != 2) + { + this.life = -1; + this.HitEffect(0, 10.0); + this.active = (byte) 0; + return; + } + } + if ((double) this.ai2 == 0.0 || (double) this.ai2 == 3.0) + { + if ((double) Main.npc[(int) this.ai1].ai1 == 3.0 && this.timeLeft > 10) + this.timeLeft = 10; + if ((double) Main.npc[(int) this.ai1].ai1 != 0.0) + { + if (this.aabb.Y > Main.npc[(int) this.ai1].aabb.Y - 100) + { + if ((double) this.velocity.Y > 0.0) + this.velocity.Y *= 0.96f; + this.velocity.Y -= 0.07f; + if ((double) this.velocity.Y > 6.0) + this.velocity.Y = 6f; + } + else if (this.aabb.Y < Main.npc[(int) this.ai1].aabb.Y - 100) + { + if ((double) this.velocity.Y < 0.0) + this.velocity.Y *= 0.96f; + this.velocity.Y += 0.07f; + if ((double) this.velocity.Y < -6.0) + this.velocity.Y = -6f; + } + if (this.aabb.X + ((int) this.width >> 1) > Main.npc[(int) this.ai1].aabb.X + ((int) Main.npc[(int) this.ai1].width >> 1) - 120 * (int) this.ai0) + { + if ((double) this.velocity.X > 0.0) + this.velocity.X *= 0.96f; + this.velocity.X -= 0.1f; + if ((double) this.velocity.X > 8.0) + this.velocity.X = 8f; + } + else if (this.aabb.X + ((int) this.width >> 1) < Main.npc[(int) this.ai1].aabb.X + ((int) Main.npc[(int) this.ai1].width >> 1) - 120 * (int) this.ai0) + { + if ((double) this.velocity.X < 0.0) + this.velocity.X *= 0.96f; + this.velocity.X += 0.1f; + if ((double) this.velocity.X < -8.0) + this.velocity.X = -8f; + } + } + else + { + ++this.ai3; + if ((double) this.ai3 >= 300.0) + { + ++this.ai2; + this.ai3 = 0.0f; + this.netUpdate = true; + } + if (this.aabb.Y > Main.npc[(int) this.ai1].aabb.Y + 230) + { + if ((double) this.velocity.Y > 0.0) + this.velocity.Y *= 0.96f; + this.velocity.Y -= 0.04f; + if ((double) this.velocity.Y > 3.0) + this.velocity.Y = 3f; + } + else if (this.aabb.Y < Main.npc[(int) this.ai1].aabb.Y + 230) + { + if ((double) this.velocity.Y < 0.0) + this.velocity.Y *= 0.96f; + this.velocity.Y += 0.04f; + if ((double) this.velocity.Y < -3.0) + this.velocity.Y = -3f; + } + if (this.aabb.X + ((int) this.width >> 1) > Main.npc[(int) this.ai1].aabb.X + ((int) Main.npc[(int) this.ai1].width >> 1) - 200 * (int) this.ai0) + { + if ((double) this.velocity.X > 0.0) + this.velocity.X *= 0.96f; + this.velocity.X -= 0.07f; + if ((double) this.velocity.X > 8.0) + this.velocity.X = 8f; + } + else if (this.aabb.X + ((int) this.width >> 1) < Main.npc[(int) this.ai1].aabb.X + ((int) Main.npc[(int) this.ai1].width >> 1) - 200 * (int) this.ai0) + { + if ((double) this.velocity.X < 0.0) + this.velocity.X *= 0.96f; + this.velocity.X += 0.07f; + if ((double) this.velocity.X < -8.0) + this.velocity.X = -8f; + } + } + Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num = (float) ((double) Main.npc[(int) this.ai1].position.X + (double) ((int) Main.npc[(int) this.ai1].width >> 1) - 200.0 * (double) this.ai0) - vector2.X; + this.rotation = (float) Math.Atan2((double) (Main.npc[(int) this.ai1].position.Y + 230f - vector2.Y), (double) num) + 1.57f; + } + else if ((double) this.ai2 == 1.0) + { + Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num1 = (float) ((double) Main.npc[(int) this.ai1].position.X + (double) ((int) Main.npc[(int) this.ai1].width >> 1) - 200.0 * (double) this.ai0) - vector2.X; + this.rotation = (float) Math.Atan2((double) (Main.npc[(int) this.ai1].position.Y + 230f - vector2.Y), (double) num1) + 1.57f; + this.velocity.X *= 0.95f; + this.velocity.Y -= 0.1f; + if ((double) this.velocity.Y < -8.0) + this.velocity.Y = -8f; + if (this.aabb.Y >= Main.npc[(int) this.ai1].aabb.Y - 200) + return; + this.TargetClosest(true); + this.ai2 = 2f; + vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num2 = Main.player[(int) this.target].position.X + 10f - vector2.X; + float num3 = Main.player[(int) this.target].position.Y + 21f - vector2.Y; + float num4 = 18f / (float) Math.Sqrt((double) num2 * (double) num2 + (double) num3 * (double) num3); + this.velocity.X = num2 * num4; + this.velocity.Y = num3 * num4; + this.netUpdate = true; + } + else if ((double) this.ai2 == 2.0) + { + if (this.aabb.Y <= Main.player[(int) this.target].aabb.Y && (double) this.velocity.Y >= 0.0) + return; + this.ai2 = 3f; + } + else if ((double) this.ai2 == 4.0) + { + Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num1 = (float) ((double) Main.npc[(int) this.ai1].position.X + (double) ((int) Main.npc[(int) this.ai1].width >> 1) - 200.0 * (double) this.ai0) - vector2.X; + this.rotation = (float) Math.Atan2((double) (Main.npc[(int) this.ai1].position.Y + 230f - vector2.Y), (double) num1) + 1.57f; + this.velocity.Y *= 0.95f; + this.velocity.X += (float) (0.100000001490116 * -(double) this.ai0); + if ((double) this.velocity.X < -8.0) + this.velocity.X = -8f; + if ((double) this.velocity.X > 8.0) + this.velocity.X = 8f; + if (this.aabb.X + ((int) this.width >> 1) >= Main.npc[(int) this.ai1].aabb.X + ((int) Main.npc[(int) this.ai1].width >> 1) - 500 && this.aabb.X + ((int) this.width >> 1) <= Main.npc[(int) this.ai1].aabb.X + ((int) Main.npc[(int) this.ai1].width >> 1) + 500) + return; + this.TargetClosest(true); + this.ai2 = 5f; + vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num2 = Main.player[(int) this.target].position.X + 10f - vector2.X; + float num3 = Main.player[(int) this.target].position.Y + 21f - vector2.Y; + float num4 = 17f / (float) Math.Sqrt((double) num2 * (double) num2 + (double) num3 * (double) num3); + this.velocity.X = num2 * num4; + this.velocity.Y = num3 * num4; + this.netUpdate = true; + } + else + { + if ((double) this.ai2 != 5.0 || ((double) this.velocity.X <= 0.0 || this.aabb.X + ((int) this.width >> 1) <= Main.player[(int) this.target].aabb.X + 10) && ((double) this.velocity.X >= 0.0 || this.aabb.X + ((int) this.width >> 1) >= Main.player[(int) this.target].aabb.X + 10)) + return; + this.ai2 = 0.0f; + } + } + + private void PlantAI() + { + if ((int) Main.tile[(int) this.ai0, (int) this.ai1].active == 0) + { + this.life = -1; + this.HitEffect(0, 10.0); + this.active = (byte) 0; + } + else + { + this.TargetClosest(true); + float num1 = 0.035f; + float num2 = 150f; + if ((int) this.type == 43) + num2 = 250f; + if ((int) this.type == 101) + num2 = 175f; + ++this.ai2; + if ((double) this.ai2 > 300.0) + { + num2 = (float) (int) ((double) num2 * 1.29999995231628); + if ((double) this.ai2 > 450.0) + this.ai2 = 0.0f; + } + Vector2 vector2 = new Vector2((float) ((double) this.ai0 * 16.0 + 8.0), (float) ((double) this.ai1 * 16.0 + 8.0)); + float num3 = Main.player[(int) this.target].position.X + 10f - (float) ((int) this.width >> 1) - vector2.X; + float num4 = Main.player[(int) this.target].position.Y + 21f - (float) ((int) this.height >> 1) - vector2.Y; + float num5 = (float) ((double) num3 * (double) num3 + (double) num4 * (double) num4); + if ((double) num5 > (double) num2 * (double) num2) + { + float num6 = num2 / (float) Math.Sqrt((double) num5); + num3 *= num6; + num4 *= num6; + } + if ((double) this.position.X < (double) this.ai0 * 16.0 + 8.0 + (double) num3) + { + this.velocity.X += num1; + if ((double) this.velocity.X < 0.0 && (double) num3 > 0.0) + this.velocity.X += num1 * 1.5f; + } + else if ((double) this.position.X > (double) this.ai0 * 16.0 + 8.0 + (double) num3) + { + this.velocity.X -= num1; + if ((double) this.velocity.X > 0.0 && (double) num3 < 0.0) + this.velocity.X -= num1 * 1.5f; + } + if ((double) this.position.Y < (double) this.ai1 * 16.0 + 8.0 + (double) num4) + { + this.velocity.Y += num1; + if ((double) this.velocity.Y < 0.0 && (double) num4 > 0.0) + this.velocity.Y += num1 * 1.5f; + } + else if ((double) this.position.Y > (double) this.ai1 * 16.0 + 8.0 + (double) num4) + { + this.velocity.Y -= num1; + if ((double) this.velocity.Y > 0.0 && (double) num4 < 0.0) + this.velocity.Y -= num1 * 1.5f; + } + if ((int) this.type == 43) + { + if ((double) this.velocity.X > 3.0) + this.velocity.X = 3f; + else if ((double) this.velocity.X < -3.0) + this.velocity.X = -3f; + if ((double) this.velocity.Y > 3.0) + this.velocity.Y = 3f; + else if ((double) this.velocity.Y < -3.0) + this.velocity.Y = -3f; + } + else + { + if ((double) this.velocity.X > 2.0) + this.velocity.X = 2f; + else if ((double) this.velocity.X < -2.0) + this.velocity.X = -2f; + if ((double) this.velocity.Y > 2.0) + this.velocity.Y = 2f; + else if ((double) this.velocity.Y < -2.0) + this.velocity.Y = -2f; + } + if ((double) num3 > 0.0) + { + this.spriteDirection = (sbyte) 1; + this.rotation = (float) Math.Atan2((double) num4, (double) num3); + } + else if ((double) num3 < 0.0) + { + this.spriteDirection = (sbyte) -1; + this.rotation = (float) Math.Atan2((double) num4, (double) num3) + 3.14f; + } + if (this.collideX) + { + this.netUpdate = true; + this.velocity.X = this.oldVelocity.X * -0.7f; + if ((double) this.velocity.X > 0.0 && (double) this.velocity.X < 2.0) + this.velocity.X = 2f; + else if ((double) this.velocity.X < 0.0 && (double) this.velocity.X > -2.0) + this.velocity.X = -2f; + } + if (this.collideY) + { + this.netUpdate = true; + this.velocity.Y = this.oldVelocity.Y * -0.7f; + if ((double) this.velocity.Y > 0.0 && (double) this.velocity.Y < 2.0) + this.velocity.Y = 2f; + else if ((double) this.velocity.Y < 0.0 && (double) this.velocity.Y > -2.0) + this.velocity.Y = -2f; + } + if (Main.netMode == 1 || (int) this.type != 101 || Main.player[(int) this.target].dead) + return; + if (this.justHit) + this.localAI0 = 0; + if (++this.localAI0 < 120) + return; + if (!Collision.SolidCollision(ref this.position, (int) this.width, (int) this.height) && Collision.CanHit(ref this.aabb, ref Main.player[(int) this.target].aabb)) + { + vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num6 = Main.player[(int) this.target].position.X + 10f - vector2.X + (float) Main.rand.Next(-10, 11); + float num7 = Main.player[(int) this.target].position.Y + 21f - vector2.Y + (float) Main.rand.Next(-10, 11); + float num8 = 10f / (float) Math.Sqrt((double) num6 * (double) num6 + (double) num7 * (double) num7); + float SpeedX = num6 * num8; + float SpeedY = num7 * num8; + int index = Projectile.NewProjectile(vector2.X, vector2.Y, SpeedX, SpeedY, 96, 22, 0.0f, 8, true); + if (index >= 0) + Main.projectile[index].timeLeft = 300; + this.localAI0 = 0; + } + else + this.localAI0 = 100; + } + } + + private unsafe void FlyerAI() + { + if ((int) this.type == 60) + { + Dust* dustPtr = Main.dust.NewDust(6, ref this.aabb, (double) this.velocity.X * 0.200000002980232, (double) this.velocity.Y * 0.200000002980232, 100, new Color(), 2.0); + if ((IntPtr) dustPtr != IntPtr.Zero) + dustPtr->noGravity = true; + } + this.noGravity = true; + if (this.collideX) + { + this.velocity.X = this.oldVelocity.X * -0.5f; + if ((int) this.direction == -1 && (double) this.velocity.X > 0.0 && (double) this.velocity.X < 2.0) + this.velocity.X = 2f; + else if ((int) this.direction == 1 && (double) this.velocity.X < 0.0 && (double) this.velocity.X > -2.0) + this.velocity.X = -2f; + } + if (this.collideY) + { + this.velocity.Y = this.oldVelocity.Y * -0.5f; + if ((double) this.velocity.Y > 0.0 && (double) this.velocity.Y < 1.0) + this.velocity.Y = 1f; + else if ((double) this.velocity.Y < 0.0 && (double) this.velocity.Y > -1.0) + this.velocity.Y = -1f; + } + this.TargetClosest(true); + if ((int) this.direction == -1 && (double) this.velocity.X > -4.0) + { + this.velocity.X -= 0.1f; + if ((double) this.velocity.X > 4.0) + this.velocity.X -= 0.1f; + else if ((double) this.velocity.X > 0.0) + this.velocity.X += 0.05f; + else if ((double) this.velocity.X < -4.0) + this.velocity.X = -4f; + } + else if ((int) this.direction == 1 && (double) this.velocity.X < 4.0) + { + this.velocity.X += 0.1f; + if ((double) this.velocity.X < -4.0) + this.velocity.X += 0.1f; + else if ((double) this.velocity.X < 0.0) + this.velocity.X -= 0.05f; + else if ((double) this.velocity.X > 4.0) + this.velocity.X = 4f; + } + if ((int) this.directionY == -1 && (double) this.velocity.Y > -1.5) + { + this.velocity.Y -= 0.04f; + if ((double) this.velocity.Y > 1.5) + this.velocity.Y -= 0.05f; + else if ((double) this.velocity.Y > 0.0) + this.velocity.Y += 0.03f; + else if ((double) this.velocity.Y < -1.5) + this.velocity.Y = -1.5f; + } + else if ((int) this.directionY == 1 && (double) this.velocity.Y < 1.5) + { + this.velocity.Y += 0.04f; + if ((double) this.velocity.Y < -1.5) + this.velocity.Y += 0.05f; + else if ((double) this.velocity.Y < 0.0) + this.velocity.Y -= 0.03f; + else if ((double) this.velocity.Y > 1.5) + this.velocity.Y = 1.5f; + } + if ((int) this.type == 49 || (int) this.type == 51 || ((int) this.type == 60 || (int) this.type == 62) || ((int) this.type == 165 || (int) this.type == 66 || ((int) this.type == 93 || (int) this.type == 137))) + { + if (this.wet) + { + if ((double) this.velocity.Y > 0.0) + this.velocity.Y *= 0.95f; + this.velocity.Y -= 0.5f; + if ((double) this.velocity.Y < -4.0) + this.velocity.Y = -4f; + this.TargetClosest(true); + } + if ((int) this.type == 60) + { + if ((int) this.direction == -1 && (double) this.velocity.X > -4.0) + { + this.velocity.X -= 0.1f; + if ((double) this.velocity.X > 4.0) + this.velocity.X -= 0.07f; + else if ((double) this.velocity.X > 0.0) + this.velocity.X += 0.03f; + if ((double) this.velocity.X < -4.0) + this.velocity.X = -4f; + } + else if ((int) this.direction == 1 && (double) this.velocity.X < 4.0) + { + this.velocity.X += 0.1f; + if ((double) this.velocity.X < -4.0) + this.velocity.X += 0.07f; + else if ((double) this.velocity.X < 0.0) + this.velocity.X -= 0.03f; + if ((double) this.velocity.X > 4.0) + this.velocity.X = 4f; + } + if ((int) this.directionY == -1 && (double) this.velocity.Y > -1.5) + { + this.velocity.Y -= 0.04f; + if ((double) this.velocity.Y > 1.5) + this.velocity.Y -= 0.03f; + else if ((double) this.velocity.Y > 0.0) + this.velocity.Y += 0.02f; + if ((double) this.velocity.Y < -1.5) + this.velocity.Y = -1.5f; + } + else if ((int) this.directionY == 1 && (double) this.velocity.Y < 1.5) + { + this.velocity.Y += 0.04f; + if ((double) this.velocity.Y < -1.5) + this.velocity.Y += 0.03f; + else if ((double) this.velocity.Y < 0.0) + this.velocity.Y -= 0.02f; + if ((double) this.velocity.Y > 1.5) + this.velocity.Y = 1.5f; + } + } + else + { + if ((int) this.direction == -1 && (double) this.velocity.X > -4.0) + { + this.velocity.X -= 0.1f; + if ((double) this.velocity.X > 4.0) + this.velocity.X -= 0.1f; + else if ((double) this.velocity.X > 0.0) + this.velocity.X += 0.05f; + if ((double) this.velocity.X < -4.0) + this.velocity.X = -4f; + } + else if ((int) this.direction == 1 && (double) this.velocity.X < 4.0) + { + this.velocity.X += 0.1f; + if ((double) this.velocity.X < -4.0) + this.velocity.X += 0.1f; + else if ((double) this.velocity.X < 0.0) + this.velocity.X -= 0.05f; + if ((double) this.velocity.X > 4.0) + this.velocity.X = 4f; + } + if ((int) this.directionY == -1 && (double) this.velocity.Y > -1.5) + { + this.velocity.Y -= 0.04f; + if ((double) this.velocity.Y > 1.5) + this.velocity.Y -= 0.05f; + else if ((double) this.velocity.Y > 0.0) + this.velocity.Y += 0.03f; + if ((double) this.velocity.Y < -1.5) + this.velocity.Y = -1.5f; + } + else if ((int) this.directionY == 1 && (double) this.velocity.Y < 1.5) + { + this.velocity.Y += 0.04f; + if ((double) this.velocity.Y < -1.5) + this.velocity.Y += 0.05f; + else if ((double) this.velocity.Y < 0.0) + this.velocity.Y -= 0.03f; + if ((double) this.velocity.Y > 1.5) + this.velocity.Y = 1.5f; + } + } + } + ++this.ai1; + if ((double) this.ai1 > 200.0) + { + if (!Main.player[(int) this.target].wet && Collision.CanHit(ref this.aabb, ref Main.player[(int) this.target].aabb)) + this.ai1 = 0.0f; + float num1 = 0.2f; + float num2 = 0.1f; + float num3 = 4f; + float num4 = 1.5f; + if ((int) this.type == 48 || (int) this.type == 62 || ((int) this.type == 165 || (int) this.type == 66)) + { + num1 = 0.12f; + num2 = 0.07f; + num3 = 3f; + num4 = 1.25f; + } + if ((double) this.ai1 > 1000.0) + this.ai1 = 0.0f; + ++this.ai2; + if ((double) this.ai2 > 0.0) + { + if ((double) this.velocity.Y < (double) num4) + this.velocity.Y += num2; + } + else if ((double) this.velocity.Y > -(double) num4) + this.velocity.Y -= num2; + if ((double) this.ai2 < -150.0 || (double) this.ai2 > 150.0) + { + if ((double) this.velocity.X < (double) num3) + this.velocity.X += num1; + } + else if ((double) this.velocity.X > -(double) num3) + this.velocity.X -= num1; + if ((double) this.ai2 > 300.0) + this.ai2 = -300f; + } + if (Main.netMode == 1) + return; + if ((int) this.type == 48) + { + ++this.ai0; + if ((double) this.ai0 == 30.0 || (double) this.ai0 == 60.0 || (double) this.ai0 == 90.0) + { + if (!Collision.CanHit(ref this.aabb, ref Main.player[(int) this.target].aabb)) + return; + Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num1 = Main.player[(int) this.target].position.X + 10f - vector2.X + (float) Main.rand.Next(-100, 101); + float num2 = Main.player[(int) this.target].position.Y + 21f - vector2.Y + (float) Main.rand.Next(-100, 101); + float num3 = 6f / (float) Math.Sqrt((double) num1 * (double) num1 + (double) num2 * (double) num2); + float SpeedX = num1 * num3; + float SpeedY = num2 * num3; + int index = Projectile.NewProjectile(vector2.X, vector2.Y, SpeedX, SpeedY, 38, 15, 0.0f, 8, true); + if (index < 0) + return; + Main.projectile[index].timeLeft = 300; + } + else + { + if ((double) this.ai0 < (double) (400 + Main.rand.Next(400))) + return; + this.ai0 = 0.0f; + } + } + else + { + if ((int) this.type != 62 && (int) this.type != 165 && (int) this.type != 66) + return; + ++this.ai0; + if ((double) this.ai0 == 20.0 || (double) this.ai0 == 40.0 || ((double) this.ai0 == 60.0 || (double) this.ai0 == 80.0)) + { + if (!Collision.CanHit(ref this.aabb, ref Main.player[(int) this.target].aabb)) + return; + Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num1 = Main.player[(int) this.target].position.X + 10f - vector2.X + (float) Main.rand.Next(-100, 101); + float num2 = Main.player[(int) this.target].position.Y + 21f - vector2.Y + (float) Main.rand.Next(-100, 101); + float num3 = 0.2f / (float) Math.Sqrt((double) num1 * (double) num1 + (double) num2 * (double) num2); + float SpeedX = num1 * num3; + float SpeedY = num2 * num3; + int index = Projectile.NewProjectile(vector2.X, vector2.Y, SpeedX, SpeedY, 44, 21, 0.0f, 8, true); + if (index < 0) + return; + Main.projectile[index].timeLeft = 300; + } + else + { + if ((double) this.ai0 < (double) (300 + Main.rand.Next(300))) + return; + this.ai0 = 0.0f; + } + } + } + + private unsafe void KingSlimeAI() + { + this.aiAction = (byte) 0; + if ((double) this.ai3 == 0.0 && this.life > 0) + this.ai3 = (float) this.lifeMax; + if ((double) this.ai2 == 0.0) + { + this.ai0 = -100f; + this.ai2 = 1f; + this.TargetClosest(true); + } + if ((double) this.velocity.Y == 0.0) + { + this.velocity.X *= 0.8f; + if ((double) this.velocity.X > -0.1 && (double) this.velocity.X < 0.1) + this.velocity.X = 0.0f; + double num = (double) this.life / (double) this.lifeMax; + if (num < 0.1) + this.ai0 += 13f; + else if (num < 0.2) + this.ai0 += 9f; + else if (num < 0.4) + this.ai0 += 6f; + else if (num < 0.6) + this.ai0 += 4f; + else if (num < 0.8) + this.ai0 += 3f; + else + this.ai0 += 2f; + if ((double) this.ai0 >= 0.0) + { + this.netUpdate = true; + this.TargetClosest(true); + if ((double) this.ai1 == 3.0) + { + this.velocity.Y = -13f; + this.velocity.X += 3.5f * (float) this.direction; + this.ai0 = -200f; + this.ai1 = 0.0f; + } + else if ((double) this.ai1 == 2.0) + { + this.velocity.Y = -6f; + this.velocity.X += 4.5f * (float) this.direction; + this.ai0 = -120f; + ++this.ai1; + } + else + { + this.velocity.Y = -8f; + this.velocity.X += 4f * (float) this.direction; + this.ai0 = -120f; + ++this.ai1; + } + } + else if ((double) this.ai0 >= -30.0) + this.aiAction = (byte) 1; + } + else if ((int) this.target < 8 && ((int) this.direction == 1 && (double) this.velocity.X < 3.0 || (int) this.direction == -1 && (double) this.velocity.X > -3.0)) + { + if ((int) this.direction == -1 && (double) this.velocity.X < 0.1 || (int) this.direction == 1 && (double) this.velocity.X > -0.1) + this.velocity.X += 0.2f * (float) this.direction; + else + this.velocity.X *= 0.93f; + } + Dust* dustPtr = Main.dust.NewDust(4, ref this.aabb, (double) this.velocity.X, (double) this.velocity.Y, (int) byte.MaxValue, new Color(0, 80, (int) byte.MaxValue, 80), (double) this.scale * 1.20000004768372); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->noGravity = true; + dustPtr->velocity.X *= 0.5f; + dustPtr->velocity.Y *= 0.5f; + } + if (this.life <= 0) + return; + float num1 = (float) ((double) ((float) this.life / (float) this.lifeMax) * 0.5 + 0.75); + if ((double) num1 != (double) this.scale) + { + this.position.X += (float) ((int) this.width >> 1); + this.position.Y += (float) this.height; + this.scale = num1; + this.width = (ushort) (98.0 * (double) this.scale); + this.height = (ushort) (92.0 * (double) this.scale); + this.position.X -= (float) ((int) this.width >> 1); + this.position.Y -= (float) this.height; + this.aabb.X = (int) this.position.X; + this.aabb.Y = (int) this.position.Y; + this.aabb.Width = (int) this.width; + this.aabb.Height = (int) this.height; + } + if (Main.netMode == 1 || (double) (this.life + (int) ((double) this.lifeMax * 0.05)) >= (double) this.ai3) + return; + this.ai3 = (float) this.life; + int num2 = Main.rand.Next(1, 4); + for (int index = 0; index < num2; ++index) + { + int number = NPC.NewNPC(this.aabb.X + Main.rand.Next((int) this.width - 32), this.aabb.Y + Main.rand.Next((int) this.height - 32), 1, 0); + if (number < 196) + { + Main.npc[number].SetDefaults(1, -1.0); + Main.npc[number].velocity.X = (float) Main.rand.Next(-15, 16) * 0.1f; + Main.npc[number].velocity.Y = (float) Main.rand.Next(-30, 1) * 0.1f; + Main.npc[number].ai1 = (float) Main.rand.Next(3); + NetMessage.CreateMessage1(23, number); + NetMessage.SendMessage(); + } + } + } + + private void FishAI() + { + if ((int) this.direction == 0) + this.TargetClosest(true); + if (this.wet) + { + bool flag = false; + if ((int) this.type != 55) + { + this.TargetClosest(false); + if (Main.player[(int) this.target].wet && !Main.player[(int) this.target].dead) + flag = true; + } + if (!flag) + { + if (this.collideX) + { + this.velocity.X = -this.velocity.X; + this.direction = -this.direction; + this.netUpdate = true; + } + if (this.collideY) + { + this.netUpdate = true; + this.velocity.Y = -this.velocity.Y; + if ((double) this.velocity.Y < 0.0) + { + this.directionY = (sbyte) -1; + this.ai0 = -1f; + } + else if ((double) this.velocity.Y > 0.0) + { + this.directionY = (sbyte) 1; + this.ai0 = 1f; + } + } + } + if ((int) this.type == 102) + Lighting.addLight(this.aabb.X + ((int) this.width >> 1) + (int) this.direction * ((int) this.width + 8) >> 4, this.aabb.Y + 2 >> 4, new Vector3(0.07f, 0.04f, 0.025f)); + if (flag) + { + this.TargetClosest(true); + if ((int) this.type == 65 || (int) this.type == 102 || (int) this.type == 148) + { + this.velocity.X += (float) this.direction * 0.15f; + this.velocity.Y += (float) this.directionY * 0.15f; + if ((double) this.velocity.X > 5.0) + this.velocity.X = 5f; + else if ((double) this.velocity.X < -5.0) + this.velocity.X = -5f; + if ((double) this.velocity.Y > 3.0) + this.velocity.Y = 3f; + else if ((double) this.velocity.Y < -3.0) + this.velocity.Y = -3f; + } + else + { + this.velocity.X += (float) this.direction * 0.1f; + this.velocity.Y += (float) this.directionY * 0.1f; + if ((double) this.velocity.X > 3.0) + this.velocity.X = 3f; + else if ((double) this.velocity.X < -3.0) + this.velocity.X = -3f; + if ((double) this.velocity.Y > 2.0) + this.velocity.Y = 2f; + else if ((double) this.velocity.Y < -2.0) + this.velocity.Y = -2f; + } + } + else + { + this.velocity.X += (float) this.direction * 0.1f; + if ((double) this.velocity.X < -1.0 || (double) this.velocity.X > 1.0) + this.velocity.X *= 0.95f; + if ((double) this.ai0 == -1.0) + { + this.velocity.Y -= 0.01f; + if ((double) this.velocity.Y < -0.3) + this.ai0 = 1f; + } + else + { + this.velocity.Y += 0.01f; + if ((double) this.velocity.Y > 0.3) + this.ai0 = -1f; + } + int index = this.aabb.X + ((int) this.width >> 1) >> 4; + int num = this.aabb.Y + ((int) this.height >> 1) >> 4; + if ((int) Main.tile[index, num - 1].liquid > 128) + { + if ((int) Main.tile[index, num + 1].active != 0) + this.ai0 = -1f; + else if ((int) Main.tile[index, num + 2].active != 0) + this.ai0 = -1f; + } + if ((double) this.velocity.Y > 0.4 || (double) this.velocity.Y < -0.4) + this.velocity.Y *= 0.95f; + } + } + else + { + if ((double) this.velocity.Y == 0.0) + { + if ((int) this.type == 65 || (int) this.type == 148) + { + this.velocity.X *= 0.94f; + if ((double) this.velocity.X > -0.200000002980232 && (double) this.velocity.X < 0.200000002980232) + this.velocity.X = 0.0f; + } + else if (Main.netMode != 1) + { + this.velocity.Y = (float) Main.rand.Next(-50, -20) * 0.1f; + this.velocity.X = (float) Main.rand.Next(-20, 20) * 0.1f; + this.netUpdate = true; + } + } + this.velocity.Y += 0.3f; + if ((double) this.velocity.Y > 10.0) + this.velocity.Y = 10f; + this.ai0 = 1f; + } + this.rotation = (float) ((double) this.velocity.Y * (double) this.direction * 0.100000001490116); + if ((double) this.rotation < -0.200000002980232) + { + this.rotation = -0.2f; + } + else + { + if ((double) this.rotation <= 0.200000002980232) + return; + this.rotation = 0.2f; + } + } + + private void VultureAI() + { + this.noGravity = true; + if ((double) this.ai0 == 0.0) + { + this.noGravity = false; + this.TargetClosest(true); + if (Main.netMode != 1) + { + if ((double) this.velocity.X != 0.0 || (double) this.velocity.Y < 0.0 || (double) this.velocity.Y > 0.300000011920929) + { + this.ai0 = 1f; + this.netUpdate = true; + } + else if (this.life < this.lifeMax || Main.player[(int) this.target].aabb.Intersects(new Rectangle(this.aabb.X - 100, this.aabb.Y - 100, (int) this.width + 200, (int) this.height + 200))) + { + this.ai0 = 1f; + this.velocity.Y -= 6f; + this.netUpdate = true; + } + } + } + else if (!Main.player[(int) this.target].dead) + { + if (this.collideX) + { + this.velocity.X = this.oldVelocity.X * -0.5f; + if ((int) this.direction == -1 && (double) this.velocity.X > 0.0 && (double) this.velocity.X < 2.0) + this.velocity.X = 2f; + else if ((int) this.direction == 1 && (double) this.velocity.X < 0.0 && (double) this.velocity.X > -2.0) + this.velocity.X = -2f; + } + if (this.collideY) + { + this.velocity.Y = this.oldVelocity.Y * -0.5f; + if ((double) this.velocity.Y > 0.0 && (double) this.velocity.Y < 1.0) + this.velocity.Y = 1f; + else if ((double) this.velocity.Y < 0.0 && (double) this.velocity.Y > -1.0) + this.velocity.Y = -1f; + } + this.TargetClosest(true); + if ((int) this.direction == -1 && (double) this.velocity.X > -3.0) + { + this.velocity.X -= 0.1f; + if ((double) this.velocity.X > 3.0) + this.velocity.X -= 0.1f; + else if ((double) this.velocity.X > 0.0) + this.velocity.X -= 0.05f; + else if ((double) this.velocity.X < -3.0) + this.velocity.X = -3f; + } + else if ((int) this.direction == 1 && (double) this.velocity.X < 3.0) + { + this.velocity.X += 0.1f; + if ((double) this.velocity.X < -3.0) + this.velocity.X += 0.1f; + else if ((double) this.velocity.X < 0.0) + this.velocity.X += 0.05f; + else if ((double) this.velocity.X > 3.0) + this.velocity.X = 3f; + } + int num1 = Math.Abs(this.aabb.X + ((int) this.width >> 1) - (Main.player[(int) this.target].aabb.X + 10)); + int num2 = Main.player[(int) this.target].aabb.Y - ((int) this.height >> 1); + if (num1 > 50) + num2 -= 100; + if (this.aabb.Y < num2) + { + this.velocity.Y += 0.05f; + if ((double) this.velocity.Y < 0.0) + this.velocity.Y += 0.01f; + } + else + { + this.velocity.Y -= 0.05f; + if ((double) this.velocity.Y > 0.0) + this.velocity.Y -= 0.01f; + } + if ((double) this.velocity.Y < -3.0) + this.velocity.Y = -3f; + if ((double) this.velocity.Y > 3.0) + this.velocity.Y = 3f; + } + if (!this.wet) + return; + if ((double) this.velocity.Y > 0.0) + this.velocity.Y *= 0.95f; + this.velocity.Y -= 0.5f; + if ((double) this.velocity.Y < -4.0) + this.velocity.Y = -4f; + this.TargetClosest(true); + } + + private void JellyfishAI() + { + Lighting.addLight(this.aabb.X + ((int) this.height >> 1) >> 4, this.aabb.Y + ((int) this.height >> 1) >> 4, (int) this.type != 63 ? ((int) this.type != 103 ? new Vector3(0.35f, 0.05f, 0.2f) : new Vector3(0.05f, 0.45f, 0.1f)) : new Vector3(0.05f, 0.15f, 0.4f)); + if ((int) this.direction == 0) + this.TargetClosest(true); + if (this.wet) + { + if (this.collideX) + { + this.velocity.X = -this.velocity.X; + this.direction = -this.direction; + } + if (this.collideY) + { + this.velocity.Y = -this.velocity.Y; + if ((double) this.velocity.Y < 0.0) + { + this.directionY = (sbyte) -1; + this.ai0 = -1f; + } + else if ((double) this.velocity.Y > 0.0) + { + this.directionY = (sbyte) 1; + this.ai0 = 1f; + } + } + bool flag = false; + if (!this.friendly) + { + this.TargetClosest(false); + if (Main.player[(int) this.target].wet && !Main.player[(int) this.target].dead) + flag = true; + } + if (flag) + { + this.rotation = (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X) + 1.57f; + this.velocity.X *= 0.98f; + this.velocity.Y *= 0.98f; + float num1 = 0.2f; + if ((int) this.type == 103) + { + this.velocity.X *= 0.98f; + this.velocity.Y *= 0.98f; + num1 = 0.6f; + } + if ((double) this.velocity.X <= -(double) num1 || (double) this.velocity.X >= (double) num1 || ((double) this.velocity.Y <= -(double) num1 || (double) this.velocity.Y >= (double) num1)) + return; + this.TargetClosest(true); + float num2 = (int) this.type == 103 ? 9f : 7f; + Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num3 = Main.player[(int) this.target].position.X + 10f - vector2.X; + float num4 = Main.player[(int) this.target].position.Y + 21f - vector2.Y; + float num5 = (float) Math.Sqrt((double) num3 * (double) num3 + (double) num4 * (double) num4); + float num6 = num2 / num5; + float num7 = num3 * num6; + float num8 = num4 * num6; + this.velocity.X = num7; + this.velocity.Y = num8; + } + else + { + this.velocity.X += (float) this.direction * 0.02f; + this.rotation = this.velocity.X * 0.4f; + if ((double) this.velocity.X < -1.0 || (double) this.velocity.X > 1.0) + this.velocity.X *= 0.95f; + if ((double) this.ai0 == -1.0) + { + this.velocity.Y -= 0.01f; + if ((double) this.velocity.Y < -1.0) + this.ai0 = 1f; + } + else + { + this.velocity.Y += 0.01f; + if ((double) this.velocity.Y > 1.0) + this.ai0 = -1f; + } + int index = this.aabb.X + ((int) this.width >> 1) >> 4; + int num = this.aabb.Y + ((int) this.height >> 1) >> 4; + if ((int) Main.tile[index, num - 1].liquid > 128) + { + if ((int) Main.tile[index, num + 1].active != 0) + this.ai0 = -1f; + else if ((int) Main.tile[index, num + 2].active != 0) + this.ai0 = -1f; + } + else + this.ai0 = 1f; + if ((double) this.velocity.Y <= 1.2 && (double) this.velocity.Y >= -1.2) + return; + this.velocity.Y *= 0.99f; + } + } + else + { + this.rotation += this.velocity.X * 0.1f; + if ((double) this.velocity.Y == 0.0) + { + this.velocity.X *= 0.98f; + if ((double) this.velocity.X > -0.01 && (double) this.velocity.X < 0.01) + this.velocity.X = 0.0f; + } + this.velocity.Y += 0.2f; + if ((double) this.velocity.Y > 10.0) + this.velocity.Y = 10f; + this.ai0 = 1f; + } + } + + private unsafe void AntlionAI() + { + this.TargetClosest(true); + Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num1 = Main.player[(int) this.target].position.X + 10f - vector2.X; + float num2 = Main.player[(int) this.target].position.Y - vector2.Y; + float num3 = 12f / (float) Math.Sqrt((double) num1 * (double) num1 + (double) num2 * (double) num2); + float SpeedX = num1 * num3; + float SpeedY = num2 * num3; + bool flag = false; + if ((int) this.directionY < 0) + { + this.rotation = (float) (Math.Atan2((double) SpeedY, (double) SpeedX) + 1.57); + flag = (double) this.rotation >= -1.2 && (double) this.rotation <= 1.2; + if ((double) this.rotation < -0.8) + this.rotation = -0.8f; + else if ((double) this.rotation > 0.8) + this.rotation = 0.8f; + if ((double) this.velocity.X != 0.0) + { + this.velocity.X *= 0.9f; + if ((double) this.velocity.X > -0.1 || (double) this.velocity.X < 0.1) + { + this.netUpdate = true; + this.velocity.X = 0.0f; + } + } + } + if ((double) this.ai0 > 0.0) + { + if ((double) this.ai0 == 200.0) + Main.PlaySound(2, this.aabb.X, this.aabb.Y, 5); + --this.ai0; + } + if (Main.netMode != 1) + { + if (flag) + { + if ((double) this.ai0 == 0.0) + { + if (Collision.CanHit(ref this.aabb, ref Main.player[(int) this.target].aabb)) + { + this.ai0 = 200f; + int Damage = 10; + int Type = 31; + int number = Projectile.NewProjectile(vector2.X, vector2.Y, SpeedX, SpeedY, Type, Damage, 0.0f, 8, false); + if (number >= 0) + { + Main.projectile[number].ai0 = 2f; + Main.projectile[number].timeLeft = 300; + Main.projectile[number].friendly = false; + NetMessage.SendProjectile(number, SendDataOptions.Reliable); + this.netUpdate = true; + } + } + } + } + } + try + { + int index1 = this.aabb.X >> 4; + int index2 = this.aabb.X + ((int) this.width >> 1) >> 4; + int index3 = this.aabb.X + (int) this.width >> 4; + int index4 = this.aabb.Y + (int) this.height >> 4; + if ((int) Main.tile[index1, index4].active != 0 && Main.tileSolid[(int) Main.tile[index1, index4].type] || (int) Main.tile[index2, index4].active != 0 && Main.tileSolid[(int) Main.tile[index2, index4].type] || (int) Main.tile[index3, index4].active != 0 && Main.tileSolid[(int) Main.tile[index3, index4].type]) + { + this.noGravity = true; + this.noTileCollide = true; + this.velocity.Y = -0.2f; + } + else + { + this.noGravity = false; + this.noTileCollide = false; + if (Main.rand.Next(3) != 0) + return; + Dust* dustPtr = Main.dust.NewDust(this.aabb.X - 4, this.aabb.Y + (int) this.height - 8, (int) this.width + 8, 24, 32, 0.0, (double) this.velocity.Y * 0.5, 0, new Color(), 1.0); + if ((IntPtr) dustPtr == IntPtr.Zero) + return; + dustPtr->velocity.X *= 0.4f; + dustPtr->velocity.Y *= -1f; + if (Main.rand.Next(2) != 0) + return; + dustPtr->noGravity = true; + dustPtr->scale += 0.2f; + } + } + catch + { + } + } + + private void SpinningSpikeballAI() + { + if ((double) this.ai0 == 0.0) + { + if (Main.netMode != 1) + { + this.TargetClosest(true); + this.direction = -this.direction; + this.directionY = -this.directionY; + this.position.Y += (float) (((int) this.height >> 1) + 8); + this.ai1 = this.position.X + (float) ((int) this.width >> 1); + this.ai2 = this.position.Y + (float) ((int) this.height >> 1); + if ((int) this.direction == 0) + this.direction = (sbyte) 1; + if ((int) this.directionY == 0) + this.directionY = (sbyte) 1; + this.ai3 = (float) (1.0 + (double) Main.rand.Next(15) * 0.100000001490116); + this.velocity.Y = (float) ((int) this.directionY * 6) * this.ai3; + ++this.ai0; + this.netUpdate = true; + } + else + { + this.ai1 = this.position.X + (float) ((int) this.width >> 1); + this.ai2 = this.position.Y + (float) ((int) this.height >> 1); + } + } + else + { + float num1 = 6f * this.ai3; + float num2 = 0.2f * this.ai3; + float num3 = (float) ((double) num1 / (double) num2 * 0.5); + if ((double) this.ai0 >= 1.0 && (double) this.ai0 < (double) (int) num3) + { + this.velocity.Y = (float) this.directionY * num1; + ++this.ai0; + } + else if ((double) this.ai0 >= (double) (int) num3) + { + this.netUpdate = true; + this.velocity.Y = 0.0f; + this.directionY = -this.directionY; + this.velocity.X = num1 * (float) this.direction; + this.ai0 = -1f; + } + else + { + if ((int) this.directionY > 0) + { + if ((double) this.velocity.Y >= (double) num1) + { + this.netUpdate = true; + this.directionY = -this.directionY; + this.velocity.Y = num1; + } + } + else if ((int) this.directionY < 0 && (double) this.velocity.Y <= -(double) num1) + { + this.directionY = -this.directionY; + this.velocity.Y = -num1; + } + if ((int) this.direction > 0) + { + if ((double) this.velocity.X >= (double) num1) + { + this.direction = -this.direction; + this.velocity.X = num1; + } + } + else if ((int) this.direction < 0 && (double) this.velocity.X <= -(double) num1) + { + this.direction = -this.direction; + this.velocity.X = -num1; + } + this.velocity.X += num2 * (float) this.direction; + this.velocity.Y += num2 * (float) this.directionY; + } + } + } + + private void GravityDiskAI() + { + if ((double) this.ai0 == 0.0) + { + this.TargetClosest(true); + this.directionY = (sbyte) 1; + this.ai0 = 1f; + } + int num = 6; + if ((double) this.ai1 == 0.0) + { + this.rotation += (float) ((int) this.direction * (int) this.directionY) * 0.13f; + if (this.collideY) + this.ai0 = 2f; + if (!this.collideY && (double) this.ai0 == 2.0) + { + this.direction = -this.direction; + this.ai1 = 1f; + this.ai0 = 1f; + } + if (this.collideX) + { + this.directionY = -this.directionY; + this.ai1 = 1f; + } + } + else + { + this.rotation -= (float) ((int) this.direction * (int) this.directionY) * 0.13f; + if (this.collideX) + this.ai0 = 2f; + if (!this.collideX && (double) this.ai0 == 2.0) + { + this.directionY = -this.directionY; + this.ai1 = 0.0f; + this.ai0 = 1f; + } + if (this.collideY) + { + this.direction = -this.direction; + this.ai1 = 0.0f; + } + } + this.velocity.X = (float) (num * (int) this.direction); + this.velocity.Y = (float) (num * (int) this.directionY); + Lighting.addLight(this.aabb.X + ((int) this.width >> 1) >> 4, this.aabb.Y + ((int) this.height >> 1) >> 4, new Vector3(0.9f, 0.3f + (float) (270 - (int) UI.mouseTextBrightness) * (1.0 / 400.0), 0.2f)); + } + + private unsafe void MoreFlyerAI() + { + bool flag1 = false; + if (this.justHit) + this.ai2 = 0.0f; + if ((double) this.ai2 >= 0.0) + { + float num1 = 16f; + bool flag2 = false; + bool flag3 = false; + if ((double) this.position.X > (double) this.ai0 - (double) num1 && (double) this.position.X < (double) this.ai0 + (double) num1) + flag2 = true; + else if ((double) this.velocity.X < 0.0 && (int) this.direction > 0 || (double) this.velocity.X > 0.0 && (int) this.direction < 0) + flag2 = true; + float num2 = num1 + 24f; + if ((double) this.position.Y > (double) this.ai1 - (double) num2 && (double) this.position.Y < (double) this.ai1 + (double) num2) + flag3 = true; + if (flag2 && flag3) + { + ++this.ai2; + if ((double) this.ai2 >= 30.0 && (double) num2 == 16.0) + flag1 = true; + if ((double) this.ai2 >= 60.0) + { + this.ai2 = -200f; + this.direction = -this.direction; + this.velocity.X = -this.velocity.X; + this.collideX = false; + } + } + else + { + this.ai0 = this.position.X; + this.ai1 = this.position.Y; + this.ai2 = 0.0f; + } + this.TargetClosest(true); + } + else + { + ++this.ai2; + this.direction = Main.player[(int) this.target].aabb.X + 10 <= this.aabb.X + ((int) this.width >> 1) ? (sbyte) 1 : (sbyte) -1; + } + int index1 = (this.aabb.X + ((int) this.width >> 1) >> 4) + ((int) this.direction << 1); + int num3 = this.aabb.Y + (int) this.height >> 4; + bool flag4 = true; + bool flag5 = false; + int num4 = 3; + if ((int) this.type == 122 || (int) this.type == 153) + { + if (this.justHit) + { + this.ai3 = 0.0f; + this.localAI1 = 0; + } + float num1 = 7f; + Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num2 = Main.player[(int) this.target].position.X + 10f - vector2.X; + float num5 = Main.player[(int) this.target].position.Y + 21f - vector2.Y; + float num6 = (float) Math.Sqrt((double) num2 * (double) num2 + (double) num5 * (double) num5); + float num7 = num1 / num6; + float SpeedX = num2 * num7; + float SpeedY = num5 * num7; + if (Main.netMode != 1 && (double) this.ai3 == 32.0) + Projectile.NewProjectile(vector2.X, vector2.Y, SpeedX, SpeedY, 84, 25, 0.0f, 8, true); + num4 = 8; + if ((double) this.ai3 > 0.0) + { + ++this.ai3; + if ((double) this.ai3 >= 64.0) + this.ai3 = 0.0f; + } + if (Main.netMode != 1 && (double) this.ai3 == 0.0) + { + ++this.localAI1; + if (this.localAI1 > 120 && Collision.CanHit(ref this.aabb, ref Main.player[(int) this.target].aabb)) + { + this.localAI1 = 0; + this.ai3 = 1f; + this.netUpdate = true; + } + } + } + else if ((int) this.type == 75) + { + num4 = 4; + if (Main.rand.Next(7) == 0) + { + Dust* dustPtr = Main.dust.NewDust(55, ref this.aabb, 0.0, 0.0, 200, this.color, 1.0); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.X *= 0.3f; + dustPtr->velocity.Y *= 0.3f; + } + } + if (Main.rand.Next(42) == 0) + Main.PlaySound(27, this.aabb.X, this.aabb.Y, 1); + } + for (int index2 = num3; index2 < num3 + num4; ++index2) + { + if ((int) Main.tile[index1, index2].active != 0 && Main.tileSolid[(int) Main.tile[index1, index2].type] || (int) Main.tile[index1, index2].liquid > 0) + { + if (index2 <= num3 + 1) + flag5 = true; + flag4 = false; + break; + } + } + if (flag1) + { + flag5 = false; + flag4 = true; + } + if (flag4) + { + if ((int) this.type == 75) + { + this.velocity.Y += 0.2f; + if ((double) this.velocity.Y > 2.0) + this.velocity.Y = 2f; + } + else + { + this.velocity.Y += 0.1f; + if ((double) this.velocity.Y > 3.0) + this.velocity.Y = 3f; + } + } + else + { + if ((int) this.type == 75) + { + if ((int) this.directionY < 0 && (double) this.velocity.Y > 0.0 || flag5) + this.velocity.Y -= 0.2f; + } + else if ((int) this.directionY < 0 && (double) this.velocity.Y > 0.0) + this.velocity.Y -= 0.1f; + if ((double) this.velocity.Y < -4.0) + this.velocity.Y = -4f; + } + if ((int) this.type == 75 && this.wet) + { + this.velocity.Y -= 0.2f; + if ((double) this.velocity.Y < -2.0) + this.velocity.Y = -2f; + } + if (this.collideX) + { + this.velocity.X = this.oldVelocity.X * -0.4f; + if ((int) this.direction == -1 && (double) this.velocity.X > 0.0 && (double) this.velocity.X < 1.0) + this.velocity.X = 1f; + else if ((int) this.direction == 1 && (double) this.velocity.X < 0.0 && (double) this.velocity.X > -1.0) + this.velocity.X = -1f; + } + if (this.collideY) + { + this.velocity.Y = this.oldVelocity.Y * -0.25f; + if ((double) this.velocity.Y > 0.0 && (double) this.velocity.Y < 1.0) + this.velocity.Y = 1f; + else if ((double) this.velocity.Y < 0.0 && (double) this.velocity.Y > -1.0) + this.velocity.Y = -1f; + } + float num8 = (int) this.type == 75 ? 3f : 2f; + if ((int) this.direction == -1 && (double) this.velocity.X > -(double) num8) + { + this.velocity.X -= 0.1f; + if ((double) this.velocity.X > (double) num8) + this.velocity.X -= 0.1f; + else if ((double) this.velocity.X > 0.0) + this.velocity.X += 0.05f; + else if ((double) this.velocity.X < -(double) num8) + this.velocity.X = -num8; + } + else if ((int) this.direction == 1 && (double) this.velocity.X < (double) num8) + { + this.velocity.X += 0.1f; + if ((double) this.velocity.X < -(double) num8) + this.velocity.X += 0.1f; + else if ((double) this.velocity.X < 0.0) + this.velocity.X -= 0.05f; + else if ((double) this.velocity.X > (double) num8) + this.velocity.X = num8; + } + if ((int) this.directionY == -1 && (double) this.velocity.Y > -1.5) + { + this.velocity.Y -= 0.04f; + if ((double) this.velocity.Y > 1.5) + this.velocity.Y -= 0.05f; + else if ((double) this.velocity.Y > 0.0) + this.velocity.Y += 0.03f; + else if ((double) this.velocity.Y < -1.5) + this.velocity.Y = -1.5f; + } + else if ((int) this.directionY == 1 && (double) this.velocity.Y < 1.5) + { + this.velocity.Y += 0.04f; + if ((double) this.velocity.Y < -1.5) + this.velocity.Y += 0.05f; + else if ((double) this.velocity.Y < 0.0) + this.velocity.Y -= 0.03f; + else if ((double) this.velocity.Y > 1.5) + this.velocity.Y = 1.5f; + } + if ((int) this.type != 122 && (int) this.type != 153) + return; + Lighting.addLight(this.aabb.X >> 4, this.aabb.Y >> 4, new Vector3(0.4f, 0.0f, 0.25f)); + } + + private void EnchantedWeaponAI() + { + this.noGravity = true; + this.noTileCollide = true; + Vector3 rgb = new Vector3(0.05f, 0.2f, 0.3f); + switch ((NPC.ID) this.type) + { + case NPC.ID.CURSED_HAMMER: + rgb = new Vector3(0.2f, 0.05f, 0.3f); + break; + case NPC.ID.SHADOW_HAMMER: + rgb = new Vector3(0.3f, 0.05f, 0.2f); + break; + } + Lighting.addLight(this.aabb.X + ((int) this.width >> 1) >> 4, this.aabb.Y + ((int) this.height >> 1) >> 4, rgb); + if ((int) this.target == 8 || Main.player[(int) this.target].dead) + this.TargetClosest(true); + if ((double) this.ai0 == 0.0) + { + float num1 = 9f; + Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num2 = Main.player[(int) this.target].position.X + 10f - vector2.X; + float num3 = Main.player[(int) this.target].position.Y + 21f - vector2.Y; + float num4 = (float) Math.Sqrt((double) num2 * (double) num2 + (double) num3 * (double) num3); + float num5 = num1 / num4; + float num6 = num2 * num5; + float num7 = num3 * num5; + this.velocity.X = num6; + this.velocity.Y = num7; + this.rotation = (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X) + 0.785f; + this.ai0 = 1f; + this.ai1 = 0.0f; + } + else if ((double) this.ai0 == 1.0) + { + if (this.justHit) + { + this.ai0 = 2f; + this.ai1 = 0.0f; + } + this.velocity.X *= 0.99f; + this.velocity.Y *= 0.99f; + ++this.ai1; + if ((double) this.ai1 < 100.0) + return; + this.ai0 = 2f; + this.ai1 = 0.0f; + this.velocity.X = 0.0f; + this.velocity.Y = 0.0f; + } + else + { + if (this.justHit) + { + this.ai0 = 2f; + this.ai1 = 0.0f; + } + this.velocity.X *= 0.96f; + this.velocity.Y *= 0.96f; + ++this.ai1; + this.rotation += (float) (0.100000001490116 + (double) (this.ai1 / 120f) * 0.400000005960464) * (float) this.direction; + if ((double) this.ai1 < 120.0) + return; + this.netUpdate = true; + this.ai0 = 0.0f; + this.ai1 = 0.0f; + } + } + + private void BirdAI() + { + this.noGravity = true; + if ((double) this.ai0 == 0.0) + { + this.noGravity = false; + this.TargetClosest(true); + if (Main.netMode != 1) + { + if ((double) this.velocity.X != 0.0 || (double) this.velocity.Y < 0.0 || (double) this.velocity.Y > 0.3) + { + this.ai0 = 1f; + this.netUpdate = true; + this.direction = -this.direction; + } + else if (this.life < this.lifeMax || Main.player[(int) this.target].aabb.Intersects(new Rectangle(this.aabb.X - 100, this.aabb.Y - 100, (int) this.width + 200, (int) this.height + 200))) + { + this.ai0 = 1f; + this.velocity.Y -= 6f; + this.netUpdate = true; + this.direction = -this.direction; + } + } + } + else if (!Main.player[(int) this.target].dead) + { + if (this.collideX) + { + this.direction = -this.direction; + this.velocity.X = this.oldVelocity.X * -0.5f; + if ((int) this.direction == -1 && (double) this.velocity.X > 0.0 && (double) this.velocity.X < 2.0) + this.velocity.X = 2f; + else if ((int) this.direction == 1 && (double) this.velocity.X < 0.0 && (double) this.velocity.X > -2.0) + this.velocity.X = -2f; + } + if (this.collideY) + { + this.velocity.Y = this.oldVelocity.Y * -0.5f; + if ((double) this.velocity.Y > 0.0 && (double) this.velocity.Y < 1.0) + this.velocity.Y = 1f; + else if ((double) this.velocity.Y < 0.0 && (double) this.velocity.Y > -1.0) + this.velocity.Y = -1f; + } + if ((int) this.direction == -1 && (double) this.velocity.X > -3.0) + { + this.velocity.X -= 0.1f; + if ((double) this.velocity.X > 3.0) + this.velocity.X -= 0.1f; + else if ((double) this.velocity.X > 0.0) + this.velocity.X -= 0.05f; + else if ((double) this.velocity.X < -3.0) + this.velocity.X = -3f; + } + else if ((int) this.direction == 1 && (double) this.velocity.X < 3.0) + { + this.velocity.X += 0.1f; + if ((double) this.velocity.X < -3.0) + this.velocity.X += 0.1f; + else if ((double) this.velocity.X < 0.0) + this.velocity.X += 0.05f; + else if ((double) this.velocity.X > 3.0) + this.velocity.X = 3f; + } + int index1 = (this.aabb.X + ((int) this.width >> 1) >> 4) + (int) this.direction; + int num = this.aabb.Y + (int) this.height >> 4; + bool flag1 = true; + bool flag2 = false; + try + { + for (int index2 = num; index2 < num + 15; ++index2) + { + if ((int) Main.tile[index1, index2].active != 0 && Main.tileSolid[(int) Main.tile[index1, index2].type] || (int) Main.tile[index1, index2].liquid > 0) + { + if (index2 < num + 5) + flag2 = true; + flag1 = false; + break; + } + } + } + catch + { + flag2 = true; + flag1 = false; + } + if (flag1) + this.velocity.Y += 0.1f; + else + this.velocity.Y -= 0.1f; + if (flag2) + this.velocity.Y -= 0.2f; + if ((double) this.velocity.Y > 3.0) + this.velocity.Y = 3f; + else if ((double) this.velocity.Y < -4.0) + this.velocity.Y = -4f; + } + if (!this.wet) + return; + if ((double) this.velocity.Y > 0.0) + this.velocity.Y *= 0.95f; + this.velocity.Y -= 0.5f; + if ((double) this.velocity.Y < -4.0) + this.velocity.Y = -4f; + this.TargetClosest(true); + } + + private void MimicAI() + { + if ((double) this.ai3 == 0.0) + { + this.position.X += 8f; + this.aabb.X += 8; + int num = this.aabb.Y >> 4; + this.ai3 = num <= (int) Main.maxTilesY - 200 ? (num <= Main.worldSurface ? 1f : 2f) : 3f; + } + if ((double) this.ai0 == 0.0) + { + this.TargetClosest(true); + if (Main.netMode == 1) + return; + if ((double) this.velocity.X != 0.0 || (double) this.velocity.Y < 0.0 || (double) this.velocity.Y > 0.3) + { + this.ai0 = 1f; + this.netUpdate = true; + } + else + { + if (this.life >= this.lifeMax && !new Rectangle(this.aabb.X - 100, this.aabb.Y - 100, (int) this.width + 200, (int) this.height + 200).Intersects(Main.player[(int) this.target].aabb)) + return; + this.ai0 = 1f; + this.netUpdate = true; + } + } + else if ((double) this.velocity.Y == 0.0) + { + ++this.ai2; + int num = 20; + if ((double) this.ai1 == 0.0) + num = 12; + if ((double) this.ai2 < (double) num) + { + this.velocity.X *= 0.9f; + } + else + { + this.ai2 = 0.0f; + this.TargetClosest(true); + this.spriteDirection = this.direction; + ++this.ai1; + if ((double) this.ai1 == 2.0) + { + this.velocity.X = (float) this.direction * 2.5f; + this.velocity.Y = -8f; + this.ai1 = 0.0f; + } + else + { + this.velocity.X = (float) this.direction * 3.5f; + this.velocity.Y = -4f; + } + this.netUpdate = true; + } + } + else if ((int) this.direction == 1 && (double) this.velocity.X < 1.0) + { + this.velocity.X += 0.1f; + } + else + { + if ((int) this.direction != -1 || (double) this.velocity.X <= -1.0) + return; + this.velocity.X -= 0.1f; + } + } + + private void UnicornAI() + { + int num = 30; + bool flag = false; + if ((double) this.velocity.Y == 0.0 && ((double) this.velocity.X > 0.0 && (int) this.direction < 0 || (double) this.velocity.X < 0.0 && (int) this.direction > 0)) + { + flag = true; + ++this.ai3; + } + if ((double) this.position.X == (double) this.oldPosition.X || (double) this.ai3 >= (double) num || flag) + ++this.ai3; + else if ((double) this.ai3 > 0.0) + --this.ai3; + if ((double) this.ai3 > (double) (num * 10)) + this.ai3 = 0.0f; + if (this.justHit) + this.ai3 = 0.0f; + if ((double) this.ai3 == (double) num) + this.netUpdate = true; + if ((double) this.ai3 < (double) num) + { + this.TargetClosest(true); + } + else + { + if ((double) this.velocity.X == 0.0) + { + if ((double) this.velocity.Y == 0.0) + { + ++this.ai0; + if ((double) this.ai0 >= 2.0) + { + this.direction = -this.direction; + this.spriteDirection = this.direction; + this.ai0 = 0.0f; + } + } + } + else + this.ai0 = 0.0f; + this.directionY = (sbyte) -1; + if ((int) this.direction == 0) + this.direction = (sbyte) 1; + } + if ((double) this.velocity.Y == 0.0 || this.wet || (double) this.velocity.X <= 0.0 && (int) this.direction < 0 || (double) this.velocity.X >= 0.0 && (int) this.direction > 0) + { + if ((double) this.velocity.X < -6.0 || (double) this.velocity.X > 6.0) + { + if ((double) this.velocity.Y == 0.0) + this.velocity.X *= 0.8f; + } + else if ((double) this.velocity.X < 6.0 && (int) this.direction == 1) + { + this.velocity.X += 0.07f; + if ((double) this.velocity.X > 6.0) + this.velocity.X = 6f; + } + else if ((double) this.velocity.X > -6.0 && (int) this.direction == -1) + { + this.velocity.X -= 0.07f; + if ((double) this.velocity.X < -6.0) + this.velocity.X = -6f; + } + } + if ((double) this.velocity.Y != 0.0) + return; + int index1 = (int) ((double) this.position.X + (double) this.velocity.X * 5.0) + ((int) this.width >> 1) + (((int) this.width >> 1) + 2) * (int) this.direction >> 4; + int index2 = this.aabb.Y + (int) this.height - 15 >> 4; + if (((double) this.velocity.X >= 0.0 || (int) this.spriteDirection != -1) && ((double) this.velocity.X <= 0.0 || (int) this.spriteDirection != 1)) + return; + if ((int) Main.tile[index1, index2 - 2].active != 0 && Main.tileSolid[(int) Main.tile[index1, index2 - 2].type]) + { + if ((int) Main.tile[index1, index2 - 3].active != 0 && Main.tileSolid[(int) Main.tile[index1, index2 - 3].type]) + { + this.velocity.Y = -8.5f; + this.netUpdate = true; + } + else + { + this.velocity.Y = -7.5f; + this.netUpdate = true; + } + } + else if ((int) Main.tile[index1, index2 - 1].active != 0 && Main.tileSolid[(int) Main.tile[index1, index2 - 1].type]) + { + this.velocity.Y = -7f; + this.netUpdate = true; + } + else if ((int) Main.tile[index1, index2].active != 0 && Main.tileSolid[(int) Main.tile[index1, index2].type]) + { + this.velocity.Y = -6f; + this.netUpdate = true; + } + else + { + if ((int) this.directionY >= 0 && (double) Math.Abs(this.velocity.X) <= 3.0 || (int) Main.tile[index1, index2 + 1].active != 0 && Main.tileSolid[(int) Main.tile[index1, index2 + 1].type] || (int) Main.tile[index1 + (int) this.direction, index2 + 1].active != 0 && Main.tileSolid[(int) Main.tile[index1 + (int) this.direction, index2 + 1].type]) + return; + this.velocity.Y = -8f; + this.netUpdate = true; + } + } + + private void WallOfFleshMouthAI() + { + if (this.aabb.X < 160 || this.aabb.X > ((int) Main.maxTilesX - 10) * 16) + { + this.active = (byte) 0; + } + else + { + if (this.localAI0 == 0) + { + this.localAI0 = 1; + NPC.wofB = -1; + NPC.wofT = -1; + } + ++this.ai1; + if ((double) this.ai2 == 0.0) + { + if ((double) this.life < (double) this.lifeMax * 0.5) + ++this.ai1; + if ((double) this.life < (double) this.lifeMax * 0.2) + ++this.ai1; + if ((double) this.ai1 > 2700.0) + this.ai2 = 1f; + } + if ((double) this.ai2 > 0.0 && (double) this.ai1 > 60.0) + { + int num = 3; + if ((double) this.life < (double) this.lifeMax * 0.3) + ++num; + ++this.ai2; + this.ai1 = 0.0f; + if ((double) this.ai2 > (double) num) + this.ai2 = 0.0f; + if (Main.netMode != 1) + { + int index = NPC.NewNPC(this.aabb.X + ((int) this.width >> 1), this.aabb.Y + ((int) this.height >> 1) + 20, 117, 1); + Main.npc[index].velocity.X = (float) ((int) this.direction << 3); + } + } + ++this.localAI3; + if (this.localAI3 >= 600 + Main.rand.Next(1000)) + { + this.localAI3 = -Main.rand.Next(200); + Main.PlaySound(4, this.aabb.X, this.aabb.Y, 10); + } + NPC.wof = (int) this.whoAmI; + int num1 = this.aabb.X >> 4; + int num2 = this.aabb.X + (int) this.width >> 4; + int num3 = this.aabb.Y + ((int) this.height >> 1) >> 4; + int num4 = 0; + int j1 = num3 + 7; + while (num4 < 15 && j1 < (int) Main.maxTilesY - 10) + { + ++j1; + for (int i = num1; i <= num2; ++i) + { + try + { + if (!WorldGen.SolidTile(i, j1)) + { + if ((int) Main.tile[i, j1].liquid <= 0) + continue; + } + ++num4; + } + catch + { + num4 += 15; + } + } + } + int num5 = j1 + 4; + if (NPC.wofB == -1) + NPC.wofB = num5 * 16; + else if (NPC.wofB > num5 * 16) + { + --NPC.wofB; + if (NPC.wofB < num5 * 16) + NPC.wofB = num5 * 16; + } + else if (NPC.wofB < num5 * 16) + { + ++NPC.wofB; + if (NPC.wofB > num5 * 16) + NPC.wofB = num5 * 16; + } + int num6 = 0; + int j2 = num3 - 7; + while (num6 < 15 && j2 > (int) Main.maxTilesY - 200) + { + --j2; + for (int i = num1; i <= num2; ++i) + { + try + { + if (!WorldGen.SolidTile(i, j2)) + { + if ((int) Main.tile[i, j2].liquid <= 0) + continue; + } + ++num6; + } + catch + { + num6 += 15; + } + } + } + int num7 = j2 - 4; + if (NPC.wofT == -1) + NPC.wofT = num7 * 16; + else if (NPC.wofT > num7 * 16) + { + --NPC.wofT; + if (NPC.wofT < num7 * 16) + NPC.wofT = num7 * 16; + } + else if (NPC.wofT < num7 * 16) + { + ++NPC.wofT; + if (NPC.wofT > num7 * 16) + NPC.wofT = num7 * 16; + } + int num8 = (NPC.wofB + NPC.wofT >> 1) - ((int) this.height >> 1); + this.velocity.Y = 0.0f; + this.position.Y = (float) num8; + this.aabb.Y = num8; + float num9 = 1.5f; + if (this.life < (this.lifeMax >> 1) + (this.lifeMax >> 2)) + num9 += 0.25f; + if (this.life < this.lifeMax >> 1) + num9 += 0.4f; + if (this.life < this.lifeMax >> 2) + num9 += 0.5f; + if (this.life < this.lifeMax / 10) + num9 += 0.6f; + if ((double) this.velocity.X == 0.0) + { + this.TargetClosest(true); + this.velocity.X = (float) this.direction; + } + if ((double) this.velocity.X < 0.0) + { + this.velocity.X = -num9; + this.direction = (sbyte) -1; + } + else + { + this.velocity.X = num9; + this.direction = (sbyte) 1; + } + this.spriteDirection = this.direction; + Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num10 = Main.player[(int) this.target].position.X + 10f - vector2.X; + float num11 = Main.player[(int) this.target].position.Y + 21f - vector2.Y; + float num12 = (float) Math.Sqrt((double) num10 * (double) num10 + (double) num11 * (double) num11); + float num13 = num10 * num12; + float num14 = num11 * num12; + this.rotation = (int) this.direction <= 0 ? (Main.player[(int) this.target].aabb.X + 10 >= this.aabb.X + ((int) this.width >> 1) ? 0.0f : (float) Math.Atan2((double) num14, (double) num13) + 3.14f) : (Main.player[(int) this.target].aabb.X + 10 <= this.aabb.X + ((int) this.width >> 1) ? 0.0f : (float) Math.Atan2(-(double) num14, -(double) num13) + 3.14f); + if (this.localAI0 != 1 || Main.netMode == 1) + return; + this.localAI0 = 2; + int index1 = NPC.NewNPC(this.aabb.X, (NPC.wofB + NPC.wofT >> 1) + NPC.wofT >> 1, 114, (int) this.whoAmI); + Main.npc[index1].ai0 = 1f; + int index2 = NPC.NewNPC(this.aabb.X, (NPC.wofB + NPC.wofT >> 1) + NPC.wofB >> 1, 114, (int) this.whoAmI); + Main.npc[index2].ai0 = -1f; + int Y = (NPC.wofB + NPC.wofT >> 1) + NPC.wofB >> 1; + for (int index3 = 0; index3 < 11; ++index3) + { + int index4 = NPC.NewNPC(this.aabb.X, Y, 115, (int) this.whoAmI); + Main.npc[index4].ai0 = (float) ((double) index3 * 0.100000001490116 - 0.0500000007450581); + } + } + } + + private void WallOfFleshEyesAI() + { + if (NPC.wof < 0) + { + this.active = (byte) 0; + } + else + { + this.realLife = NPC.wof; + this.TargetClosest(true); + this.position.X = Main.npc[NPC.wof].position.X; + this.aabb.X = Main.npc[NPC.wof].aabb.X; + this.direction = Main.npc[NPC.wof].direction; + this.spriteDirection = this.direction; + int num1 = NPC.wofB + NPC.wofT >> 1; + int num2 = ((double) this.ai0 <= 0.0 ? num1 + NPC.wofB >> 1 : num1 + NPC.wofT >> 1) - ((int) this.height >> 1); + if (this.aabb.Y > num2 + 1) + this.velocity.Y = -1f; + else if (this.aabb.Y < num2 - 1) + { + this.velocity.Y = 1f; + } + else + { + this.velocity.Y = 0.0f; + this.aabb.Y = num2; + this.position.Y = (float) num2; + } + if ((double) this.velocity.Y > 5.0) + this.velocity.Y = 5f; + else if ((double) this.velocity.Y < -5.0) + this.velocity.Y = -5f; + Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num3 = Main.player[(int) this.target].position.X + 10f - vector2.X; + float num4 = Main.player[(int) this.target].position.Y + 21f - vector2.Y; + float num5 = (float) Math.Sqrt((double) num3 * (double) num3 + (double) num4 * (double) num4); + float num6 = num3 * num5; + float num7 = num4 * num5; + bool flag = true; + if ((int) this.direction > 0) + { + if (Main.player[(int) this.target].aabb.X + 10 > this.aabb.X + ((int) this.width >> 1)) + { + this.rotation = (float) Math.Atan2(-(double) num7, -(double) num6) + 3.14f; + } + else + { + this.rotation = 0.0f; + flag = false; + } + } + else if (Main.player[(int) this.target].aabb.X + 10 < this.aabb.X + ((int) this.width >> 1)) + { + this.rotation = (float) Math.Atan2((double) num7, (double) num6) + 3.14f; + } + else + { + this.rotation = 0.0f; + flag = false; + } + if (Main.netMode == 1) + return; + int num8 = 4; + ++this.localAI1; + if ((double) Main.npc[NPC.wof].life < (double) Main.npc[NPC.wof].lifeMax * 0.75) + { + ++this.localAI1; + ++num8; + } + if ((double) Main.npc[NPC.wof].life < (double) Main.npc[NPC.wof].lifeMax * 0.5) + { + ++this.localAI1; + ++num8; + } + if ((double) Main.npc[NPC.wof].life < (double) Main.npc[NPC.wof].lifeMax * 0.25) + { + ++this.localAI1; + num8 += 2; + } + if ((double) Main.npc[NPC.wof].life < (double) Main.npc[NPC.wof].lifeMax * 0.1) + { + this.localAI1 += 2; + num8 += 3; + } + if (this.localAI2 == 0) + { + if (this.localAI1 <= 600) + return; + this.localAI2 = 1; + this.localAI1 = 0; + } + else + { + if (this.localAI1 <= 45 || !Collision.CanHit(ref this.aabb, ref Main.player[(int) this.target].aabb)) + return; + this.localAI1 = 0; + ++this.localAI2; + if (this.localAI2 >= num8) + this.localAI2 = 0; + if (!flag) + return; + float num9 = 9f; + int Damage = 11; + if ((double) Main.npc[NPC.wof].life < (double) Main.npc[NPC.wof].lifeMax * 0.5) + { + ++Damage; + ++num9; + } + if ((double) Main.npc[NPC.wof].life < (double) Main.npc[NPC.wof].lifeMax * 0.25) + { + ++Damage; + ++num9; + } + if ((double) Main.npc[NPC.wof].life < (double) Main.npc[NPC.wof].lifeMax * 0.1) + { + Damage += 2; + num9 += 2f; + } + vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num10 = Main.player[(int) this.target].position.X + 10f - vector2.X; + float num11 = Main.player[(int) this.target].position.Y + 21f - vector2.Y; + float num12 = (float) Math.Sqrt((double) num10 * (double) num10 + (double) num11 * (double) num11); + float num13 = num9 / num12; + float SpeedX = num10 * num13; + float SpeedY = num11 * num13; + vector2.X += SpeedX; + vector2.Y += SpeedY; + Projectile.NewProjectile(vector2.X, vector2.Y, SpeedX, SpeedY, 83, Damage, 0.0f, 8, true); + } + } + } + + private void WallOfFleshTentacleAI() + { + if (NPC.wof < 0) + { + this.active = (byte) 0; + } + else + { + if (this.justHit) + this.ai1 = 10f; + this.TargetClosest(true); + float num1 = 0.1f; + float num2 = 300f; + if (Main.npc[NPC.wof].life < Main.npc[NPC.wof].lifeMax >> 2) + { + this.damage = 75; + this.defense = 40; + num2 = 900f; + } + else if (Main.npc[NPC.wof].life < Main.npc[NPC.wof].lifeMax >> 1) + { + this.damage = 60; + this.defense = 30; + num2 = 700f; + } + else if (Main.npc[NPC.wof].life < (Main.npc[NPC.wof].lifeMax >> 1) + (Main.npc[NPC.wof].lifeMax >> 2)) + { + this.damage = 45; + this.defense = 20; + num2 = 500f; + } + float x = Main.npc[NPC.wof].position.X + (float) ((int) Main.npc[NPC.wof].width >> 1); + float num3 = Main.npc[NPC.wof].position.Y; + float num4 = (float) (NPC.wofB - NPC.wofT); + float y = (float) NPC.wofT + num4 * this.ai0; + ++this.ai2; + if ((double) this.ai2 > 100.0) + { + num2 = (float) (int) ((double) num2 * 1.29999995231628); + if ((double) this.ai2 > 200.0) + this.ai2 = 0.0f; + } + Vector2 vector2 = new Vector2(x, y); + float num5 = Main.player[(int) this.target].position.X + 10f - (float) ((int) this.width >> 1) - vector2.X; + float num6 = Main.player[(int) this.target].position.Y + 21f - (float) ((int) this.height >> 1) - vector2.Y; + if ((double) this.ai1 == 0.0) + { + float num7 = (float) ((double) num5 * (double) num5 + (double) num6 * (double) num6); + if ((double) num7 > (double) num2 * (double) num2) + { + float num8 = num2 / (float) Math.Sqrt((double) num7); + num5 *= num8; + num6 *= num8; + } + if ((double) this.position.X < (double) x + (double) num5) + { + this.velocity.X += num1; + if ((double) this.velocity.X < 0.0 && (double) num5 > 0.0) + this.velocity.X += num1 * 2.5f; + } + else if ((double) this.position.X > (double) x + (double) num5) + { + this.velocity.X -= num1; + if ((double) this.velocity.X > 0.0 && (double) num5 < 0.0) + this.velocity.X -= num1 * 2.5f; + } + if ((double) this.position.Y < (double) y + (double) num6) + { + this.velocity.Y += num1; + if ((double) this.velocity.Y < 0.0 && (double) num6 > 0.0) + this.velocity.Y += num1 * 2.5f; + } + else if ((double) this.position.Y > (double) y + (double) num6) + { + this.velocity.Y -= num1; + if ((double) this.velocity.Y > 0.0 && (double) num6 < 0.0) + this.velocity.Y -= num1 * 2.5f; + } + if ((double) this.velocity.X > 4.0) + this.velocity.X = 4f; + else if ((double) this.velocity.X < -4.0) + this.velocity.X = -4f; + if ((double) this.velocity.Y > 4.0) + this.velocity.Y = 4f; + else if ((double) this.velocity.Y < -4.0) + this.velocity.Y = -4f; + } + else if ((double) this.ai1 > 0.0) + --this.ai1; + else + this.ai1 = 0.0f; + if ((double) num5 > 0.0) + { + this.spriteDirection = (sbyte) 1; + this.rotation = (float) Math.Atan2((double) num6, (double) num5); + } + else if ((double) num5 < 0.0) + { + this.spriteDirection = (sbyte) -1; + this.rotation = (float) (Math.Atan2((double) num6, (double) num5) + Math.PI); + } + Lighting.addLight(this.aabb.X + ((int) this.width >> 1) >> 4, this.aabb.Y + ((int) this.height >> 1) >> 4, new Vector3(0.3f, 0.2f, 0.1f)); + } + } + + private unsafe void RetinazerAI() + { + if ((int) this.target == 8 || Main.player[(int) this.target].dead || (int) Main.player[(int) this.target].active == 0) + this.TargetClosest(true); + bool flag = Main.player[(int) this.target].dead; + float num1 = (float) ((double) this.position.X + (double) ((int) this.width >> 1) - (double) Main.player[(int) this.target].position.X - 10.0); + float num2 = (float) Math.Atan2((double) this.position.Y + (double) this.height - 59.0 - (double) Main.player[(int) this.target].position.Y - 21.0, (double) num1) + 1.57f; + if ((double) num2 < 0.0) + num2 += 6.283f; + else if ((double) num2 > 6.28299999237061) + num2 -= 6.283f; + if ((double) this.rotation < (double) num2) + { + if ((double) num2 - (double) this.rotation > 3.1415) + this.rotation -= 0.1f; + else + this.rotation += 0.1f; + } + else if ((double) this.rotation > (double) num2) + { + if ((double) this.rotation - (double) num2 > 3.1415) + this.rotation += 0.1f; + else + this.rotation -= 0.1f; + } + if ((double) this.rotation > (double) num2 - 0.100000001490116 && (double) this.rotation < (double) num2 + 0.100000001490116) + this.rotation = num2; + if ((double) this.rotation < 0.0) + this.rotation += 6.283f; + else if ((double) this.rotation > 6.28299999237061) + this.rotation -= 6.283f; + if ((double) this.rotation > (double) num2 - 0.100000001490116 && (double) this.rotation < (double) num2 + 0.100000001490116) + this.rotation = num2; + if (Main.rand.Next(6) == 0) + { + Dust* dustPtr = Main.dust.NewDust(this.aabb.X, this.aabb.Y + ((int) this.height >> 2), (int) this.width, (int) this.height >> 1, 5, (double) this.velocity.X, 2.0, 0, new Color(), 1.0); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.X *= 0.5f; + dustPtr->velocity.Y *= 0.1f; + } + } + if (Main.gameTime.dayTime || flag) + { + this.velocity.Y -= 0.04f; + if (this.timeLeft <= 10) + return; + this.timeLeft = 10; + } + else if ((double) this.ai0 == 0.0) + { + if ((double) this.ai1 == 0.0) + { + float num3 = 7f; + float num4 = 0.1f; + int num5 = 1; + if (this.aabb.X + ((int) this.width >> 1) < Main.player[(int) this.target].aabb.X + 20) + num5 = -1; + Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num6 = Main.player[(int) this.target].position.X + 10f + (float) (num5 * 300) - vector2.X; + float num7 = (float) ((double) Main.player[(int) this.target].position.Y + 21.0 - 300.0) - vector2.Y; + float num8 = (float) Math.Sqrt((double) num6 * (double) num6 + (double) num7 * (double) num7); + float num9 = num8; + float num10 = num3 / num8; + float num11 = num6 * num10; + float num12 = num7 * num10; + if ((double) this.velocity.X < (double) num11) + { + this.velocity.X += num4; + if ((double) this.velocity.X < 0.0 && (double) num11 > 0.0) + this.velocity.X += num4; + } + else if ((double) this.velocity.X > (double) num11) + { + this.velocity.X -= num4; + if ((double) this.velocity.X > 0.0 && (double) num11 < 0.0) + this.velocity.X -= num4; + } + if ((double) this.velocity.Y < (double) num12) + { + this.velocity.Y += num4; + if ((double) this.velocity.Y < 0.0 && (double) num12 > 0.0) + this.velocity.Y += num4; + } + else if ((double) this.velocity.Y > (double) num12) + { + this.velocity.Y -= num4; + if ((double) this.velocity.Y > 0.0 && (double) num12 < 0.0) + this.velocity.Y -= num4; + } + ++this.ai2; + if ((double) this.ai2 >= 600.0) + { + this.ai1 = 1f; + this.ai2 = 0.0f; + this.ai3 = 0.0f; + this.target = (byte) 8; + this.netUpdate = true; + } + else if (this.aabb.Y + (int) this.height < Main.player[(int) this.target].aabb.Y && (double) num9 < 400.0) + { + if (!Main.player[(int) this.target].dead) + ++this.ai3; + if ((double) this.ai3 >= 60.0) + { + this.ai3 = 0.0f; + vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num13 = Main.player[(int) this.target].position.X + 10f - vector2.X; + float num14 = Main.player[(int) this.target].position.Y + 21f - vector2.Y; + if (Main.netMode != 1) + { + float num15 = 9f / (float) Math.Sqrt((double) num13 * (double) num13 + (double) num14 * (double) num14); + float num16 = num13 * num15; + float num17 = num14 * num15; + float SpeedX = num16 + (float) Main.rand.Next(-40, 41) * 0.08f; + float SpeedY = num17 + (float) Main.rand.Next(-40, 41) * 0.08f; + vector2.X += SpeedX * 15f; + vector2.Y += SpeedY * 15f; + Projectile.NewProjectile(vector2.X, vector2.Y, SpeedX, SpeedY, 83, 20, 0.0f, 8, true); + } + } + } + } + else if ((double) this.ai1 == 1.0) + { + this.rotation = num2; + float num3 = 12f; + Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num4 = Main.player[(int) this.target].position.X + 10f - vector2.X; + float num5 = Main.player[(int) this.target].position.Y + 21f - vector2.Y; + float num6 = (float) Math.Sqrt((double) num4 * (double) num4 + (double) num5 * (double) num5); + float num7 = num3 / num6; + this.velocity.X = num4 * num7; + this.velocity.Y = num5 * num7; + this.ai1 = 2f; + } + else if ((double) this.ai1 == 2.0) + { + ++this.ai2; + if ((double) this.ai2 >= 25.0) + { + this.velocity.X *= 0.96f; + this.velocity.Y *= 0.96f; + if ((double) this.velocity.X > -0.1 && (double) this.velocity.X < 0.1) + this.velocity.X = 0.0f; + if ((double) this.velocity.Y > -0.1 && (double) this.velocity.Y < 0.1) + this.velocity.Y = 0.0f; + } + else + this.rotation = (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X) - 1.57f; + if ((double) this.ai2 >= 70.0) + { + ++this.ai3; + this.ai2 = 0.0f; + this.target = (byte) 8; + this.rotation = num2; + if ((double) this.ai3 >= 4.0) + { + this.ai1 = 0.0f; + this.ai3 = 0.0f; + } + else + this.ai1 = 1f; + } + } + if ((double) this.life >= (double) this.lifeMax * 0.5) + return; + this.ai0 = 1f; + this.ai1 = 0.0f; + this.ai2 = 0.0f; + this.ai3 = 0.0f; + this.netUpdate = true; + } + else if ((double) this.ai0 == 1.0 || (double) this.ai0 == 2.0) + { + if ((double) this.ai0 == 1.0) + { + this.ai2 += 0.005f; + if ((double) this.ai2 > 0.5) + this.ai2 = 0.5f; + } + else + { + this.ai2 -= 0.005f; + if ((double) this.ai2 < 0.0) + this.ai2 = 0.0f; + } + this.rotation += this.ai2; + ++this.ai1; + if ((double) this.ai1 == 100.0) + { + ++this.ai0; + this.ai1 = 0.0f; + if ((double) this.ai0 == 3.0) + { + this.ai2 = 0.0f; + } + else + { + Main.PlaySound(3, this.aabb.X, this.aabb.Y, 1); + Main.PlaySound(15, this.aabb.X, this.aabb.Y, 0); + for (int index = 0; index < 2; ++index) + { + Gore.NewGore(this.position, new Vector2((float) Main.rand.Next(-30, 31) * 0.2f, (float) Main.rand.Next(-30, 31) * 0.2f), 143, 1.0); + Gore.NewGore(this.position, new Vector2((float) Main.rand.Next(-30, 31) * 0.2f, (float) Main.rand.Next(-30, 31) * 0.2f), 7, 1.0); + Gore.NewGore(this.position, new Vector2((float) Main.rand.Next(-30, 31) * 0.2f, (float) Main.rand.Next(-30, 31) * 0.2f), 6, 1.0); + } + int num3 = 0; + while (num3 < 16 && IntPtr.Zero != (IntPtr) Main.dust.NewDust(5, ref this.aabb, (double) Main.rand.Next(-30, 31) * 0.200000002980232, (double) Main.rand.Next(-30, 31) * 0.200000002980232, 0, new Color(), 1.0)) + ++num3; + } + } + Main.dust.NewDust(5, ref this.aabb, (double) Main.rand.Next(-30, 31) * 0.200000002980232, (double) Main.rand.Next(-30, 31) * 0.200000002980232, 0, new Color(), 1.0); + this.velocity.X *= 0.98f; + this.velocity.Y *= 0.98f; + if ((double) this.velocity.X > -0.1 && (double) this.velocity.X < 0.1) + this.velocity.X = 0.0f; + if ((double) this.velocity.Y <= -0.1 || (double) this.velocity.Y >= 0.1) + return; + this.velocity.Y = 0.0f; + } + else + { + this.damage = (int) ((double) this.defDamage * 1.5); + this.defense = (int) this.defDefense + 15; + this.soundHit = (short) 4; + if ((double) this.ai1 == 0.0) + { + float num3 = 8f; + float num4 = 0.15f; + Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num5 = Main.player[(int) this.target].position.X + 10f - vector2.X; + float num6 = (float) ((double) Main.player[(int) this.target].position.Y + 21.0 - 300.0) - vector2.Y; + float num7 = (float) Math.Sqrt((double) num5 * (double) num5 + (double) num6 * (double) num6); + float num8 = num3 / num7; + float num9 = num5 * num8; + float num10 = num6 * num8; + if ((double) this.velocity.X < (double) num9) + { + this.velocity.X += num4; + if ((double) this.velocity.X < 0.0 && (double) num9 > 0.0) + this.velocity.X += num4; + } + else if ((double) this.velocity.X > (double) num9) + { + this.velocity.X -= num4; + if ((double) this.velocity.X > 0.0 && (double) num9 < 0.0) + this.velocity.X -= num4; + } + if ((double) this.velocity.Y < (double) num10) + { + this.velocity.Y += num4; + if ((double) this.velocity.Y < 0.0 && (double) num10 > 0.0) + this.velocity.Y += num4; + } + else if ((double) this.velocity.Y > (double) num10) + { + this.velocity.Y -= num4; + if ((double) this.velocity.Y > 0.0 && (double) num10 < 0.0) + this.velocity.Y -= num4; + } + ++this.ai2; + if ((double) this.ai2 >= 300.0) + { + this.ai1 = 1f; + this.ai2 = 0.0f; + this.ai3 = 0.0f; + this.TargetClosest(true); + this.netUpdate = true; + } + vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num11 = Main.player[(int) this.target].position.X + 10f - vector2.X; + float num12 = Main.player[(int) this.target].position.Y + 21f - vector2.Y; + this.rotation = (float) Math.Atan2((double) num12, (double) num11) - 1.57f; + if (Main.netMode == 1) + return; + ++this.localAI1; + if ((double) this.life < (double) this.lifeMax * 0.75) + ++this.localAI1; + if ((double) this.life < (double) this.lifeMax * 0.5) + ++this.localAI1; + if ((double) this.life < (double) this.lifeMax * 0.25) + ++this.localAI1; + if ((double) this.life < (double) this.lifeMax * 0.1) + this.localAI1 += 2; + if (this.localAI1 <= 140 || !Collision.CanHit(ref this.aabb, ref Main.player[(int) this.target].aabb)) + return; + this.localAI1 = 0; + float num13 = 9f / (float) Math.Sqrt((double) num11 * (double) num11 + (double) num12 * (double) num12); + float SpeedX = num11 * num13; + float SpeedY = num12 * num13; + vector2.X += SpeedX * 15f; + vector2.Y += SpeedY * 15f; + Projectile.NewProjectile(vector2.X, vector2.Y, SpeedX, SpeedY, 100, 25, 0.0f, 8, true); + } + else + { + int num3 = 1; + if (this.aabb.X + ((int) this.width >> 1) < Main.player[(int) this.target].aabb.X + 20) + num3 = -1; + float num4 = 8f; + float num5 = 0.2f; + Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num6 = Main.player[(int) this.target].position.X + 10f + (float) (num3 * 340) - vector2.X; + float num7 = Main.player[(int) this.target].position.Y + 21f - vector2.Y; + float num8 = (float) Math.Sqrt((double) num6 * (double) num6 + (double) num7 * (double) num7); + float num9 = num4 / num8; + float num10 = num6 * num9; + float num11 = num7 * num9; + if ((double) this.velocity.X < (double) num10) + { + this.velocity.X += num5; + if ((double) this.velocity.X < 0.0 && (double) num10 > 0.0) + this.velocity.X += num5; + } + else if ((double) this.velocity.X > (double) num10) + { + this.velocity.X -= num5; + if ((double) this.velocity.X > 0.0 && (double) num10 < 0.0) + this.velocity.X -= num5; + } + if ((double) this.velocity.Y < (double) num11) + { + this.velocity.Y += num5; + if ((double) this.velocity.Y < 0.0 && (double) num11 > 0.0) + this.velocity.Y += num5; + } + else if ((double) this.velocity.Y > (double) num11) + { + this.velocity.Y -= num5; + if ((double) this.velocity.Y > 0.0 && (double) num11 < 0.0) + this.velocity.Y -= num5; + } + vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num12 = Main.player[(int) this.target].position.X + 10f - vector2.X; + float num13 = Main.player[(int) this.target].position.Y + 21f - vector2.Y; + this.rotation = (float) Math.Atan2((double) num13, (double) num12) - 1.57f; + if (Main.netMode != 1) + { + ++this.localAI1; + if ((double) this.life < (double) this.lifeMax * 0.75) + ++this.localAI1; + if ((double) this.life < (double) this.lifeMax * 0.5) + ++this.localAI1; + if ((double) this.life < (double) this.lifeMax * 0.25) + ++this.localAI1; + if ((double) this.life < (double) this.lifeMax * 0.1) + this.localAI1 += 2; + if (this.localAI1 > 45 && Collision.CanHit(ref this.aabb, ref Main.player[(int) this.target].aabb)) + { + this.localAI1 = 0; + float num14 = 9f / (float) Math.Sqrt((double) num12 * (double) num12 + (double) num13 * (double) num13); + float SpeedX = num12 * num14; + float SpeedY = num13 * num14; + vector2.X += SpeedX * 15f; + vector2.Y += SpeedY * 15f; + Projectile.NewProjectile(vector2.X, vector2.Y, SpeedX, SpeedY, 100, 20, 0.0f, 8, true); + } + } + ++this.ai2; + if ((double) this.ai2 < 200.0) + return; + this.ai1 = 0.0f; + this.ai2 = 0.0f; + this.ai3 = 0.0f; + this.TargetClosest(true); + this.netUpdate = true; + } + } + } + + private unsafe void SpazmatismAI() + { + if ((int) this.target == 8 || Main.player[(int) this.target].dead || (int) Main.player[(int) this.target].active == 0) + this.TargetClosest(true); + bool flag = Main.player[(int) this.target].dead; + float num1 = (float) ((double) this.position.X + (double) ((int) this.width >> 1) - (double) Main.player[(int) this.target].position.X - 10.0); + float num2 = (float) Math.Atan2((double) this.position.Y + (double) this.height - 59.0 - (double) Main.player[(int) this.target].position.Y - 21.0, (double) num1) + 1.57f; + if ((double) num2 < 0.0) + num2 += 6.283f; + else if ((double) num2 > 6.28299999237061) + num2 -= 6.283f; + if ((double) this.rotation < (double) num2) + { + if ((double) num2 - (double) this.rotation > 3.1415) + this.rotation -= 0.15f; + else + this.rotation += 0.15f; + } + else if ((double) this.rotation > (double) num2) + { + if ((double) this.rotation - (double) num2 > 3.1415) + this.rotation += 0.15f; + else + this.rotation -= 0.15f; + } + if ((double) this.rotation > (double) num2 - 0.150000005960464 && (double) this.rotation < (double) num2 + 0.150000005960464) + this.rotation = num2; + if ((double) this.rotation < 0.0) + this.rotation += 6.283f; + else if ((double) this.rotation > 6.28299999237061) + this.rotation -= 6.283f; + if ((double) this.rotation > (double) num2 - 0.150000005960464 && (double) this.rotation < (double) num2 + 0.150000005960464) + this.rotation = num2; + if (Main.rand.Next(6) == 0) + { + Dust* dustPtr = Main.dust.NewDust(this.aabb.X, this.aabb.Y + ((int) this.height >> 2), (int) this.width, (int) this.height >> 1, 5, (double) this.velocity.X, 2.0, 0, new Color(), 1.0); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.X *= 0.5f; + dustPtr->velocity.Y *= 0.1f; + } + } + if (Main.gameTime.dayTime || flag) + { + this.velocity.Y -= 0.04f; + if (this.timeLeft <= 10) + return; + this.timeLeft = 10; + } + else if ((double) this.ai0 == 0.0) + { + if ((double) this.ai1 == 0.0) + { + this.TargetClosest(true); + float num3 = 12f; + float num4 = 0.4f; + int num5 = 1; + if (this.aabb.X + ((int) this.width >> 1) < Main.player[(int) this.target].aabb.X + 20) + num5 = -1; + Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num6 = Main.player[(int) this.target].position.X + 10f + (float) (num5 * 400) - vector2.X; + float num7 = Main.player[(int) this.target].position.Y + 21f - vector2.Y; + float num8 = (float) Math.Sqrt((double) num6 * (double) num6 + (double) num7 * (double) num7); + float num9 = num3 / num8; + float num10 = num6 * num9; + float num11 = num7 * num9; + if ((double) this.velocity.X < (double) num10) + { + this.velocity.X += num4; + if ((double) this.velocity.X < 0.0 && (double) num10 > 0.0) + this.velocity.X += num4; + } + else if ((double) this.velocity.X > (double) num10) + { + this.velocity.X -= num4; + if ((double) this.velocity.X > 0.0 && (double) num10 < 0.0) + this.velocity.X -= num4; + } + if ((double) this.velocity.Y < (double) num11) + { + this.velocity.Y += num4; + if ((double) this.velocity.Y < 0.0 && (double) num11 > 0.0) + this.velocity.Y += num4; + } + else if ((double) this.velocity.Y > (double) num11) + { + this.velocity.Y -= num4; + if ((double) this.velocity.Y > 0.0 && (double) num11 < 0.0) + this.velocity.Y -= num4; + } + ++this.ai2; + if ((double) this.ai2 >= 600.0) + { + this.ai1 = 1f; + this.ai2 = 0.0f; + this.ai3 = 0.0f; + this.target = (byte) 8; + this.netUpdate = true; + } + else + { + if (!Main.player[(int) this.target].dead) + ++this.ai3; + if ((double) this.ai3 >= 60.0) + { + this.ai3 = 0.0f; + vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num12 = Main.player[(int) this.target].position.X + 10f - vector2.X; + float num13 = Main.player[(int) this.target].position.Y + 21f - vector2.Y; + if (Main.netMode != 1) + { + float num14 = 12f / (float) Math.Sqrt((double) num12 * (double) num12 + (double) num13 * (double) num13); + float num15 = num12 * num14; + float num16 = num13 * num14; + float SpeedX = num15 + (float) Main.rand.Next(-40, 41) * 0.05f; + float SpeedY = num16 + (float) Main.rand.Next(-40, 41) * 0.05f; + vector2.X += SpeedX * 4f; + vector2.Y += SpeedY * 4f; + Projectile.NewProjectile(vector2.X, vector2.Y, SpeedX, SpeedY, 96, 25, 0.0f, 8, true); + } + } + } + } + else if ((double) this.ai1 == 1.0) + { + this.rotation = num2; + float num3 = 13f; + Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num4 = Main.player[(int) this.target].position.X + 10f - vector2.X; + float num5 = Main.player[(int) this.target].position.Y + 21f - vector2.Y; + float num6 = (float) Math.Sqrt((double) num4 * (double) num4 + (double) num5 * (double) num5); + float num7 = num3 / num6; + this.velocity.X = num4 * num7; + this.velocity.Y = num5 * num7; + this.ai1 = 2f; + } + else if ((double) this.ai1 == 2.0) + { + ++this.ai2; + if ((double) this.ai2 >= 8.0) + { + this.velocity.X *= 0.9f; + this.velocity.Y *= 0.9f; + if ((double) this.velocity.X > -0.1 && (double) this.velocity.X < 0.1) + this.velocity.X = 0.0f; + if ((double) this.velocity.Y > -0.1 && (double) this.velocity.Y < 0.1) + this.velocity.Y = 0.0f; + } + else + this.rotation = (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X) - 1.57f; + if ((double) this.ai2 >= 42.0) + { + ++this.ai3; + this.ai2 = 0.0f; + this.target = (byte) 8; + this.rotation = num2; + if ((double) this.ai3 >= 10.0) + { + this.ai1 = 0.0f; + this.ai3 = 0.0f; + } + else + this.ai1 = 1f; + } + } + if ((double) this.life >= (double) this.lifeMax * 0.5) + return; + this.ai0 = 1f; + this.ai1 = 0.0f; + this.ai2 = 0.0f; + this.ai3 = 0.0f; + this.netUpdate = true; + } + else if ((double) this.ai0 == 1.0 || (double) this.ai0 == 2.0) + { + if ((double) this.ai0 == 1.0) + { + this.ai2 += 0.005f; + if ((double) this.ai2 > 0.5) + this.ai2 = 0.5f; + } + else + { + this.ai2 -= 0.005f; + if ((double) this.ai2 < 0.0) + this.ai2 = 0.0f; + } + this.rotation += this.ai2; + ++this.ai1; + if ((double) this.ai1 == 100.0) + { + ++this.ai0; + this.ai1 = 0.0f; + if ((double) this.ai0 == 3.0) + { + this.ai2 = 0.0f; + } + else + { + Main.PlaySound(3, this.aabb.X, this.aabb.Y, 1); + Main.PlaySound(15, this.aabb.X, this.aabb.Y, 0); + for (int index = 0; index < 2; ++index) + { + Gore.NewGore(this.position, new Vector2((float) Main.rand.Next(-30, 31) * 0.2f, (float) Main.rand.Next(-30, 31) * 0.2f), 144, 1.0); + Gore.NewGore(this.position, new Vector2((float) Main.rand.Next(-30, 31) * 0.2f, (float) Main.rand.Next(-30, 31) * 0.2f), 7, 1.0); + Gore.NewGore(this.position, new Vector2((float) Main.rand.Next(-30, 31) * 0.2f, (float) Main.rand.Next(-30, 31) * 0.2f), 6, 1.0); + } + int num3 = 0; + while (num3 < 16 && IntPtr.Zero != (IntPtr) Main.dust.NewDust(5, ref this.aabb, (double) Main.rand.Next(-30, 31) * 0.200000002980232, (double) Main.rand.Next(-30, 31) * 0.200000002980232, 0, new Color(), 1.0)) + ++num3; + } + } + Main.dust.NewDust(5, ref this.aabb, (double) Main.rand.Next(-30, 31) * 0.200000002980232, (double) Main.rand.Next(-30, 31) * 0.200000002980232, 0, new Color(), 1.0); + this.velocity.X *= 0.98f; + this.velocity.Y *= 0.98f; + if ((double) this.velocity.X > -0.1 && (double) this.velocity.X < 0.1) + this.velocity.X = 0.0f; + if ((double) this.velocity.Y <= -0.1 || (double) this.velocity.Y >= 0.1) + return; + this.velocity.Y = 0.0f; + } + else + { + this.soundHit = (short) 4; + this.damage = this.defDamage + (this.defDamage >> 1); + this.defense = (int) this.defDefense + 25; + if ((double) this.ai1 == 0.0) + { + float num3 = 4f; + float num4 = 0.1f; + int num5 = 1; + if (this.aabb.X + ((int) this.width >> 1) < Main.player[(int) this.target].aabb.X + 20) + num5 = -1; + Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num6 = Main.player[(int) this.target].position.X + 10f + (float) (num5 * 180) - vector2.X; + float num7 = Main.player[(int) this.target].position.Y + 21f - vector2.Y; + float num8 = (float) Math.Sqrt((double) num6 * (double) num6 + (double) num7 * (double) num7); + float num9 = num3 / num8; + float num10 = num6 * num9; + float num11 = num7 * num9; + if ((double) this.velocity.X < (double) num10) + { + this.velocity.X += num4; + if ((double) this.velocity.X < 0.0 && (double) num10 > 0.0) + this.velocity.X += num4; + } + else if ((double) this.velocity.X > (double) num10) + { + this.velocity.X -= num4; + if ((double) this.velocity.X > 0.0 && (double) num10 < 0.0) + this.velocity.X -= num4; + } + if ((double) this.velocity.Y < (double) num11) + { + this.velocity.Y += num4; + if ((double) this.velocity.Y < 0.0 && (double) num11 > 0.0) + this.velocity.Y += num4; + } + else if ((double) this.velocity.Y > (double) num11) + { + this.velocity.Y -= num4; + if ((double) this.velocity.Y > 0.0 && (double) num11 < 0.0) + this.velocity.Y -= num4; + } + ++this.ai2; + if ((double) this.ai2 >= 400.0) + { + this.ai1 = 1f; + this.ai2 = 0.0f; + this.ai3 = 0.0f; + this.target = (byte) 8; + this.netUpdate = true; + } + if (!Collision.CanHit(ref this.aabb, ref Main.player[(int) this.target].aabb)) + return; + ++this.localAI2; + if (this.localAI2 > 22) + { + this.localAI2 = 0; + Main.PlaySound(2, this.aabb.X, this.aabb.Y, 34); + } + if (Main.netMode == 1) + return; + ++this.localAI1; + if ((double) this.life < (double) this.lifeMax * 0.75) + ++this.localAI1; + if ((double) this.life < (double) this.lifeMax * 0.5) + ++this.localAI1; + if ((double) this.life < (double) this.lifeMax * 0.25) + ++this.localAI1; + if ((double) this.life < (double) this.lifeMax * 0.100000001490116) + this.localAI1 += 2; + if (this.localAI1 <= 8) + return; + this.localAI1 = 0; + vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num12 = Main.player[(int) this.target].position.X + 10f - vector2.X; + float num13 = Main.player[(int) this.target].position.Y + 21f - vector2.Y; + float num14 = 6f / (float) Math.Sqrt((double) num12 * (double) num12 + (double) num13 * (double) num13); + float num15 = num12 * num14; + float num16 = num13 * num14 + (float) Main.rand.Next(-40, 41) * 0.01f; + float num17 = num15 + (float) Main.rand.Next(-40, 41) * 0.01f; + float SpeedY = num16 + this.velocity.Y * 0.5f; + float SpeedX = num17 + this.velocity.X * 0.5f; + vector2.X -= SpeedX * 1f; + vector2.Y -= SpeedY * 1f; + Projectile.NewProjectile(vector2.X, vector2.Y, SpeedX, SpeedY, 101, 30, 0.0f, 8, true); + } + else if ((double) this.ai1 == 1.0) + { + Main.PlaySound(15, this.aabb.X, this.aabb.Y, 0); + this.rotation = num2; + float num3 = 14f; + Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num4 = Main.player[(int) this.target].position.X + 10f - vector2.X; + float num5 = Main.player[(int) this.target].position.Y + 21f - vector2.Y; + float num6 = (float) Math.Sqrt((double) num4 * (double) num4 + (double) num5 * (double) num5); + float num7 = num3 / num6; + this.velocity.X = num4 * num7; + this.velocity.Y = num5 * num7; + this.ai1 = 2f; + } + else + { + if ((double) this.ai1 != 2.0) + return; + ++this.ai2; + if ((double) this.ai2 >= 50.0) + { + this.velocity.X *= 0.93f; + this.velocity.Y *= 0.93f; + if ((double) this.velocity.X > -0.1 && (double) this.velocity.X < 0.1) + this.velocity.X = 0.0f; + if ((double) this.velocity.Y > -0.1 && (double) this.velocity.Y < 0.1) + this.velocity.Y = 0.0f; + } + else + this.rotation = (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X) - 1.57f; + if ((double) this.ai2 < 80.0) + return; + ++this.ai3; + this.ai2 = 0.0f; + this.target = (byte) 8; + this.rotation = num2; + if ((double) this.ai3 >= 6.0) + { + this.ai1 = 0.0f; + this.ai3 = 0.0f; + } + else + this.ai1 = 1f; + } + } + } + + private void SkeletronPrimeAI() + { + this.damage = this.defDamage; + this.defense = (int) this.defDefense; + if ((double) this.ai0 == 0.0 && Main.netMode != 1) + { + this.TargetClosest(true); + this.ai0 = 1f; + if ((int) this.type != 68) + { + int index1 = NPC.NewNPC(this.aabb.X + ((int) this.width >> 1), this.aabb.Y + ((int) this.height >> 1), 128, (int) this.whoAmI); + Main.npc[index1].ai0 = -1f; + Main.npc[index1].ai1 = (float) this.whoAmI; + Main.npc[index1].target = this.target; + Main.npc[index1].netUpdate = true; + int index2 = NPC.NewNPC(this.aabb.X + ((int) this.width >> 1), this.aabb.Y + ((int) this.height >> 1), 129, (int) this.whoAmI); + Main.npc[index2].ai0 = 1f; + Main.npc[index2].ai1 = (float) this.whoAmI; + Main.npc[index2].target = this.target; + Main.npc[index2].netUpdate = true; + int index3 = NPC.NewNPC(this.aabb.X + ((int) this.width >> 1), this.aabb.Y + ((int) this.height >> 1), 130, (int) this.whoAmI); + Main.npc[index3].ai0 = -1f; + Main.npc[index3].ai1 = (float) this.whoAmI; + Main.npc[index3].target = this.target; + Main.npc[index3].ai3 = 150f; + Main.npc[index3].netUpdate = true; + int index4 = NPC.NewNPC(this.aabb.X + ((int) this.width >> 1), this.aabb.Y + ((int) this.height >> 1), 131, (int) this.whoAmI); + Main.npc[index4].ai0 = 1f; + Main.npc[index4].ai1 = (float) this.whoAmI; + Main.npc[index4].target = this.target; + Main.npc[index4].netUpdate = true; + Main.npc[index4].ai3 = 150f; + } + } + if ((int) this.type == 68 && (double) this.ai1 != 3.0 && (double) this.ai1 != 2.0) + { + Main.PlaySound(15, this.aabb.X, this.aabb.Y, 0); + this.ai1 = 2f; + } + if (Main.player[(int) this.target].dead || Math.Abs(this.aabb.X - Main.player[(int) this.target].aabb.X) > 6000 || Math.Abs(this.aabb.Y - Main.player[(int) this.target].aabb.Y) > 6000) + { + this.TargetClosest(true); + if (Main.player[(int) this.target].dead || Math.Abs(this.aabb.X - Main.player[(int) this.target].aabb.X) > 6000 || Math.Abs(this.aabb.Y - Main.player[(int) this.target].aabb.Y) > 6000) + this.ai1 = 3f; + } + if (Main.gameTime.dayTime && (double) this.ai1 != 3.0 && (double) this.ai1 != 2.0) + { + this.ai1 = 2f; + Main.PlaySound(15, this.aabb.X, this.aabb.Y, 0); + } + if ((double) this.ai1 == 0.0) + { + ++this.ai2; + if ((double) this.ai2 >= 600.0) + { + this.ai2 = 0.0f; + this.ai1 = 1f; + this.TargetClosest(true); + this.netUpdate = true; + } + this.rotation = this.velocity.X * 0.06666667f; + if (this.aabb.Y > Main.player[(int) this.target].aabb.Y - 200) + { + if ((double) this.velocity.Y > 0.0) + this.velocity.Y *= 0.98f; + this.velocity.Y -= 0.1f; + if ((double) this.velocity.Y > 2.0) + this.velocity.Y = 2f; + } + else if (this.aabb.Y < Main.player[(int) this.target].aabb.Y - 500) + { + if ((double) this.velocity.Y < 0.0) + this.velocity.Y *= 0.98f; + this.velocity.Y += 0.1f; + if ((double) this.velocity.Y < -2.0) + this.velocity.Y = -2f; + } + if (this.aabb.X + ((int) this.width >> 1) > Main.player[(int) this.target].aabb.X + 10 + 100) + { + if ((double) this.velocity.X > 0.0) + this.velocity.X *= 0.98f; + this.velocity.X -= 0.1f; + if ((double) this.velocity.X <= 8.0) + return; + this.velocity.X = 8f; + } + else + { + if (this.aabb.X + ((int) this.width >> 1) >= Main.player[(int) this.target].aabb.X + 10 - 100) + return; + if ((double) this.velocity.X < 0.0) + this.velocity.X *= 0.98f; + this.velocity.X += 0.1f; + if ((double) this.velocity.X >= -8.0) + return; + this.velocity.X = -8f; + } + } + else if ((double) this.ai1 == 1.0) + { + this.defense *= 2; + this.damage *= 2; + ++this.ai2; + if ((double) this.ai2 == 2.0) + Main.PlaySound(15, this.aabb.X, this.aabb.Y, 0); + if ((double) this.ai2 >= 400.0) + { + this.ai2 = 0.0f; + this.ai1 = 0.0f; + } + this.rotation += (float) this.direction * 0.3f; + Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num1 = Main.player[(int) this.target].position.X + 10f - vector2.X; + float num2 = Main.player[(int) this.target].position.Y + 21f - vector2.Y; + float num3 = 2f / (float) Math.Sqrt((double) num1 * (double) num1 + (double) num2 * (double) num2); + this.velocity.X = num1 * num3; + this.velocity.Y = num2 * num3; + } + else if ((double) this.ai1 == 2.0) + { + this.damage = 9999; + this.defense = 9999; + this.rotation += (float) this.direction * 0.3f; + Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num1 = Main.player[(int) this.target].position.X + 10f - vector2.X; + float num2 = Main.player[(int) this.target].position.Y + 21f - vector2.Y; + float num3 = 8f / (float) Math.Sqrt((double) num1 * (double) num1 + (double) num2 * (double) num2); + this.velocity.X = num1 * num3; + this.velocity.Y = num2 * num3; + } + else + { + if ((double) this.ai1 != 3.0) + return; + this.velocity.Y += 0.1f; + if ((double) this.velocity.Y < 0.0) + this.velocity.Y *= 0.95f; + this.velocity.X *= 0.95f; + if (this.timeLeft <= 500) + return; + this.timeLeft = 500; + } + } + + private void SkeletronPrimeSawHand() + { + Vector2 vector2_1 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num1 = (float) ((double) Main.npc[(int) this.ai1].position.X + (double) ((int) Main.npc[(int) this.ai1].width >> 1) - 200.0 * (double) this.ai0) - vector2_1.X; + float num2 = Main.npc[(int) this.ai1].position.Y + 230f - vector2_1.Y; + float num3 = (float) Math.Sqrt((double) num1 * (double) num1 + (double) num2 * (double) num2); + if ((double) this.ai2 != 99.0) + { + if ((double) num3 > 800.0) + this.ai2 = 99f; + } + else if ((double) num3 < 400.0) + this.ai2 = 0.0f; + this.spriteDirection = (sbyte) -(double) this.ai0; + if ((int) Main.npc[(int) this.ai1].active == 0 || (int) Main.npc[(int) this.ai1].aiStyle != 32) + { + this.ai2 += 10f; + if ((double) this.ai2 > 50.0 || Main.netMode != 2) + { + this.life = -1; + this.HitEffect(0, 10.0); + this.active = (byte) 0; + return; + } + } + if ((double) this.ai2 == 99.0) + { + if (this.aabb.Y > Main.npc[(int) this.ai1].aabb.Y) + { + if ((double) this.velocity.Y > 0.0) + this.velocity.Y *= 0.96f; + this.velocity.Y -= 0.1f; + if ((double) this.velocity.Y > 8.0) + this.velocity.Y = 8f; + } + else if (this.aabb.Y < Main.npc[(int) this.ai1].aabb.Y) + { + if ((double) this.velocity.Y < 0.0) + this.velocity.Y *= 0.96f; + this.velocity.Y += 0.1f; + if ((double) this.velocity.Y < -8.0) + this.velocity.Y = -8f; + } + if (this.aabb.X + ((int) this.width >> 1) > Main.npc[(int) this.ai1].aabb.X + ((int) Main.npc[(int) this.ai1].width >> 1)) + { + if ((double) this.velocity.X > 0.0) + this.velocity.X *= 0.96f; + this.velocity.X -= 0.5f; + if ((double) this.velocity.X <= 12.0) + return; + this.velocity.X = 12f; + } + else + { + if (this.aabb.X + ((int) this.width >> 1) >= Main.npc[(int) this.ai1].aabb.X + ((int) Main.npc[(int) this.ai1].width >> 1)) + return; + if ((double) this.velocity.X < 0.0) + this.velocity.X *= 0.96f; + this.velocity.X += 0.5f; + if ((double) this.velocity.X >= -12.0) + return; + this.velocity.X = -12f; + } + } + else if ((double) this.ai2 == 0.0 || (double) this.ai2 == 3.0) + { + if ((double) Main.npc[(int) this.ai1].ai1 == 3.0 && this.timeLeft > 10) + this.timeLeft = 10; + if ((double) Main.npc[(int) this.ai1].ai1 != 0.0) + { + this.TargetClosest(true); + if (Main.player[(int) this.target].dead) + { + this.velocity.Y += 0.1f; + if ((double) this.velocity.Y > 16.0) + this.velocity.Y = 16f; + } + else + { + Vector2 vector2_2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num4 = Main.player[(int) this.target].position.X + 10f - vector2_2.X; + float num5 = Main.player[(int) this.target].position.Y + 21f - vector2_2.Y; + float num6 = 7f / (float) Math.Sqrt((double) num4 * (double) num4 + (double) num5 * (double) num5); + float num7 = num4 * num6; + float num8 = num5 * num6; + this.rotation = (float) Math.Atan2((double) num8, (double) num7) - 1.57f; + if ((double) this.velocity.X > (double) num7) + { + if ((double) this.velocity.X > 0.0) + this.velocity.X *= 0.97f; + this.velocity.X -= 0.05f; + } + if ((double) this.velocity.X < (double) num7) + { + if ((double) this.velocity.X < 0.0) + this.velocity.X *= 0.97f; + this.velocity.X += 0.05f; + } + if ((double) this.velocity.Y > (double) num8) + { + if ((double) this.velocity.Y > 0.0) + this.velocity.Y *= 0.97f; + this.velocity.Y -= 0.05f; + } + if ((double) this.velocity.Y < (double) num8) + { + if ((double) this.velocity.Y < 0.0) + this.velocity.Y *= 0.97f; + this.velocity.Y += 0.05f; + } + } + ++this.ai3; + if ((double) this.ai3 >= 600.0) + { + this.ai2 = 0.0f; + this.ai3 = 0.0f; + this.netUpdate = true; + } + } + else + { + ++this.ai3; + if ((double) this.ai3 >= 300.0) + { + ++this.ai2; + this.ai3 = 0.0f; + this.netUpdate = true; + } + if (this.aabb.Y > Main.npc[(int) this.ai1].aabb.Y + 320) + { + if ((double) this.velocity.Y > 0.0) + this.velocity.Y *= 0.96f; + this.velocity.Y -= 0.04f; + if ((double) this.velocity.Y > 3.0) + this.velocity.Y = 3f; + } + else if (this.aabb.Y < Main.npc[(int) this.ai1].aabb.Y + 260) + { + if ((double) this.velocity.Y < 0.0) + this.velocity.Y *= 0.96f; + this.velocity.Y += 0.04f; + if ((double) this.velocity.Y < -3.0) + this.velocity.Y = -3f; + } + if (this.aabb.X + ((int) this.width >> 1) > Main.npc[(int) this.ai1].aabb.X + ((int) Main.npc[(int) this.ai1].width >> 1)) + { + if ((double) this.velocity.X > 0.0) + this.velocity.X *= 0.96f; + this.velocity.X -= 0.3f; + if ((double) this.velocity.X > 12.0) + this.velocity.X = 12f; + } + else if (this.aabb.X + ((int) this.width >> 1) < Main.npc[(int) this.ai1].aabb.X + ((int) Main.npc[(int) this.ai1].width >> 1) - 250) + { + if ((double) this.velocity.X < 0.0) + this.velocity.X *= 0.96f; + this.velocity.X += 0.3f; + if ((double) this.velocity.X < -12.0) + this.velocity.X = -12f; + } + } + Vector2 vector2_3 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num9 = (float) ((double) Main.npc[(int) this.ai1].position.X + (double) ((int) Main.npc[(int) this.ai1].width >> 1) - 200.0 * (double) this.ai0) - vector2_3.X; + float num10 = Main.npc[(int) this.ai1].position.Y + 230f - vector2_3.Y; + Math.Sqrt((double) num9 * (double) num9 + (double) num10 * (double) num10); + this.rotation = (float) Math.Atan2((double) num10, (double) num9) + 1.57f; + } + else if ((double) this.ai2 == 1.0) + { + Vector2 vector2_2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num4 = (float) ((double) Main.npc[(int) this.ai1].position.X + (double) ((int) Main.npc[(int) this.ai1].width >> 1) - 200.0 * (double) this.ai0) - vector2_2.X; + float num5 = Main.npc[(int) this.ai1].position.Y + 230f - vector2_2.Y; + float num6 = (float) Math.Sqrt((double) num4 * (double) num4 + (double) num5 * (double) num5); + this.rotation = (float) Math.Atan2((double) num5, (double) num4) + 1.57f; + this.velocity.X *= 0.95f; + this.velocity.Y -= 0.1f; + if ((double) this.velocity.Y < -8.0) + this.velocity.Y = -8f; + if (this.aabb.Y >= Main.npc[(int) this.ai1].aabb.Y - 200) + return; + this.TargetClosest(true); + this.ai2 = 2f; + vector2_2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num7 = Main.player[(int) this.target].position.X + 10f - vector2_2.X; + float num8 = Main.player[(int) this.target].position.Y + 21f - vector2_2.Y; + float num9 = 22f / (float) Math.Sqrt((double) num7 * (double) num7 + (double) num8 * (double) num8); + this.velocity.X = num7 * num9; + this.velocity.Y = num8 * num9; + this.netUpdate = true; + } + else if ((double) this.ai2 == 2.0) + { + if ((double) this.velocity.Y >= 0.0 && this.aabb.Y <= Main.player[(int) this.target].aabb.Y) + return; + this.ai2 = 3f; + } + else if ((double) this.ai2 == 4.0) + { + this.TargetClosest(true); + Vector2 vector2_2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num4 = Main.player[(int) this.target].position.X + 10f - vector2_2.X; + float num5 = Main.player[(int) this.target].position.Y + 21f - vector2_2.Y; + float num6 = 7f / (float) Math.Sqrt((double) num4 * (double) num4 + (double) num5 * (double) num5); + float num7 = num4 * num6; + float num8 = num5 * num6; + if ((double) this.velocity.X > (double) num7) + { + if ((double) this.velocity.X > 0.0) + this.velocity.X *= 0.97f; + this.velocity.X -= 0.05f; + } + if ((double) this.velocity.X < (double) num7) + { + if ((double) this.velocity.X < 0.0) + this.velocity.X *= 0.97f; + this.velocity.X += 0.05f; + } + if ((double) this.velocity.Y > (double) num8) + { + if ((double) this.velocity.Y > 0.0) + this.velocity.Y *= 0.97f; + this.velocity.Y -= 0.05f; + } + if ((double) this.velocity.Y < (double) num8) + { + if ((double) this.velocity.Y < 0.0) + this.velocity.Y *= 0.97f; + this.velocity.Y += 0.05f; + } + ++this.ai3; + if ((double) this.ai3 >= 600.0) + { + this.ai2 = 0.0f; + this.ai3 = 0.0f; + this.netUpdate = true; + } + vector2_2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num9 = (float) ((double) Main.npc[(int) this.ai1].position.X + (double) ((int) Main.npc[(int) this.ai1].width >> 1) - 200.0 * (double) this.ai0) - vector2_2.X; + float num10 = Main.npc[(int) this.ai1].position.Y + 230f - vector2_2.Y; + float num11 = (float) Math.Sqrt((double) num9 * (double) num9 + (double) num10 * (double) num10); + this.rotation = (float) Math.Atan2((double) num10, (double) num9) + 1.57f; + } + else + { + if ((double) this.ai2 != 5.0 || ((double) this.velocity.X <= 0.0 || this.aabb.X + ((int) this.width >> 1) <= Main.player[(int) this.target].aabb.X + 10) && ((double) this.velocity.X >= 0.0 || this.aabb.X + ((int) this.width >> 1) >= Main.player[(int) this.target].aabb.X + 10)) + return; + this.ai2 = 0.0f; + } + } + + private void SkeletronPrimeViceHand() + { + this.spriteDirection = (sbyte) -(double) this.ai0; + Vector2 vector2_1 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num1 = (float) ((double) Main.npc[(int) this.ai1].position.X + (double) ((int) Main.npc[(int) this.ai1].width >> 1) - 200.0 * (double) this.ai0) - vector2_1.X; + float num2 = Main.npc[(int) this.ai1].position.Y + 230f - vector2_1.Y; + float num3 = (float) Math.Sqrt((double) num1 * (double) num1 + (double) num2 * (double) num2); + if ((double) this.ai2 != 99.0) + { + if ((double) num3 > 800.0) + this.ai2 = 99f; + } + else if ((double) num3 < 400.0) + this.ai2 = 0.0f; + if ((int) Main.npc[(int) this.ai1].active == 0 || (int) Main.npc[(int) this.ai1].aiStyle != 32) + { + this.ai2 += 10f; + if ((double) this.ai2 > 50.0 || Main.netMode != 2) + { + this.life = -1; + this.HitEffect(0, 10.0); + this.active = (byte) 0; + return; + } + } + if ((double) this.ai2 == 99.0) + { + if ((double) this.position.Y > (double) Main.npc[(int) this.ai1].position.Y) + { + if ((double) this.velocity.Y > 0.0) + this.velocity.Y *= 0.96f; + this.velocity.Y -= 0.1f; + if ((double) this.velocity.Y > 8.0) + this.velocity.Y = 8f; + } + else if ((double) this.position.Y < (double) Main.npc[(int) this.ai1].position.Y) + { + if ((double) this.velocity.Y < 0.0) + this.velocity.Y *= 0.96f; + this.velocity.Y += 0.1f; + if ((double) this.velocity.Y < -8.0) + this.velocity.Y = -8f; + } + if ((double) this.position.X + (double) ((int) this.width >> 1) > (double) Main.npc[(int) this.ai1].position.X + (double) ((int) Main.npc[(int) this.ai1].width >> 1)) + { + if ((double) this.velocity.X > 0.0) + this.velocity.X *= 0.96f; + this.velocity.X -= 0.5f; + if ((double) this.velocity.X > 12.0) + this.velocity.X = 12f; + } + if ((double) this.position.X + (double) ((int) this.width >> 1) >= (double) Main.npc[(int) this.ai1].position.X + (double) ((int) Main.npc[(int) this.ai1].width >> 1)) + return; + if ((double) this.velocity.X < 0.0) + this.velocity.X *= 0.96f; + this.velocity.X += 0.5f; + if ((double) this.velocity.X >= -12.0) + return; + this.velocity.X = -12f; + } + else if ((double) this.ai2 == 0.0 || (double) this.ai2 == 3.0) + { + if ((double) Main.npc[(int) this.ai1].ai1 == 3.0 && this.timeLeft > 10) + this.timeLeft = 10; + if ((double) Main.npc[(int) this.ai1].ai1 != 0.0) + { + this.TargetClosest(true); + this.TargetClosest(true); + if (Main.player[(int) this.target].dead) + { + this.velocity.Y += 0.1f; + if ((double) this.velocity.Y > 16.0) + this.velocity.Y = 16f; + } + else + { + Vector2 vector2_2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num4 = Main.player[(int) this.target].position.X + 10f - vector2_2.X; + float num5 = Main.player[(int) this.target].position.Y + 21f - vector2_2.Y; + float num6 = 12f / (float) Math.Sqrt((double) num4 * (double) num4 + (double) num5 * (double) num5); + float num7 = num4 * num6; + float num8 = num5 * num6; + this.rotation = (float) Math.Atan2((double) num8, (double) num7) - 1.57f; + if ((double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y) < 2.0) + { + this.rotation = (float) Math.Atan2((double) num8, (double) num7) - 1.57f; + this.velocity.X = num7; + this.velocity.Y = num8; + this.netUpdate = true; + } + else + { + this.velocity.X *= 0.97f; + this.velocity.Y *= 0.97f; + } + ++this.ai3; + if ((double) this.ai3 >= 600.0) + { + this.ai2 = 0.0f; + this.ai3 = 0.0f; + this.netUpdate = true; + } + } + } + else + { + ++this.ai3; + if ((double) this.ai3 >= 600.0) + { + ++this.ai2; + this.ai3 = 0.0f; + this.netUpdate = true; + } + if ((double) this.position.Y > (double) Main.npc[(int) this.ai1].position.Y + 300.0) + { + if ((double) this.velocity.Y > 0.0) + this.velocity.Y *= 0.96f; + this.velocity.Y -= 0.1f; + if ((double) this.velocity.Y > 3.0) + this.velocity.Y = 3f; + } + else if ((double) this.position.Y < (double) Main.npc[(int) this.ai1].position.Y + 230.0) + { + if ((double) this.velocity.Y < 0.0) + this.velocity.Y *= 0.96f; + this.velocity.Y += 0.1f; + if ((double) this.velocity.Y < -3.0) + this.velocity.Y = -3f; + } + if ((double) this.position.X + (double) ((int) this.width >> 1) > (double) Main.npc[(int) this.ai1].position.X + (double) ((int) Main.npc[(int) this.ai1].width >> 1) + 250.0) + { + if ((double) this.velocity.X > 0.0) + this.velocity.X *= 0.94f; + this.velocity.X -= 0.3f; + if ((double) this.velocity.X > 9.0) + this.velocity.X = 9f; + } + if ((double) this.position.X + (double) ((int) this.width >> 1) < (double) Main.npc[(int) this.ai1].position.X + (double) ((int) Main.npc[(int) this.ai1].width >> 1)) + { + if ((double) this.velocity.X < 0.0) + this.velocity.X *= 0.94f; + this.velocity.X += 0.2f; + if ((double) this.velocity.X < -8.0) + this.velocity.X = -8f; + } + } + Vector2 vector2_3 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num9 = (float) ((double) Main.npc[(int) this.ai1].position.X + (double) ((int) Main.npc[(int) this.ai1].width >> 1) - 200.0 * (double) this.ai0) - vector2_3.X; + float num10 = Main.npc[(int) this.ai1].position.Y + 230f - vector2_3.Y; + Math.Sqrt((double) num9 * (double) num9 + (double) num10 * (double) num10); + this.rotation = (float) Math.Atan2((double) num10, (double) num9) + 1.57f; + } + else if ((double) this.ai2 == 1.0) + { + if ((double) this.velocity.Y > 0.0) + this.velocity.Y *= 0.9f; + Vector2 vector2_2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num4 = (float) ((double) Main.npc[(int) this.ai1].position.X + (double) ((int) Main.npc[(int) this.ai1].width >> 1) - 280.0 * (double) this.ai0) - vector2_2.X; + float num5 = Main.npc[(int) this.ai1].position.Y + 230f - vector2_2.Y; + float num6 = (float) Math.Sqrt((double) num4 * (double) num4 + (double) num5 * (double) num5); + this.rotation = (float) Math.Atan2((double) num5, (double) num4) + 1.57f; + this.velocity.X = (float) (((double) this.velocity.X * 5.0 + (double) Main.npc[(int) this.ai1].velocity.X) / 6.0); + this.velocity.X += 0.5f; + this.velocity.Y -= 0.5f; + if ((double) this.velocity.Y < -9.0) + this.velocity.Y = -9f; + if ((double) this.position.Y >= (double) Main.npc[(int) this.ai1].position.Y - 280.0) + return; + this.TargetClosest(true); + this.ai2 = 2f; + vector2_2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num7 = Main.player[(int) this.target].position.X + 10f - vector2_2.X; + float num8 = Main.player[(int) this.target].position.Y + 21f - vector2_2.Y; + float num9 = 20f / (float) Math.Sqrt((double) num7 * (double) num7 + (double) num8 * (double) num8); + this.velocity.X = num7 * num9; + this.velocity.Y = num8 * num9; + this.netUpdate = true; + } + else if ((double) this.ai2 == 2.0) + { + if ((double) this.position.Y <= (double) Main.player[(int) this.target].position.Y && (double) this.velocity.Y >= 0.0) + return; + if ((double) this.ai3 >= 4.0) + { + this.ai2 = 3f; + this.ai3 = 0.0f; + } + else + { + this.ai2 = 1f; + ++this.ai3; + } + } + else if ((double) this.ai2 == 4.0) + { + Vector2 vector2_2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num4 = (float) ((double) Main.npc[(int) this.ai1].position.X + (double) ((int) Main.npc[(int) this.ai1].width >> 1) - 200.0 * (double) this.ai0) - vector2_2.X; + float num5 = Main.npc[(int) this.ai1].position.Y + 230f - vector2_2.Y; + float num6 = (float) Math.Sqrt((double) num4 * (double) num4 + (double) num5 * (double) num5); + this.rotation = (float) Math.Atan2((double) num5, (double) num4) + 1.57f; + this.velocity.Y = (float) (((double) this.velocity.Y * 5.0 + (double) Main.npc[(int) this.ai1].velocity.Y) / 6.0); + this.velocity.X += 0.5f; + if ((double) this.velocity.X > 12.0) + this.velocity.X = 12f; + if ((double) this.position.X + (double) ((int) this.width >> 1) >= (double) Main.npc[(int) this.ai1].position.X + (double) ((int) Main.npc[(int) this.ai1].width >> 1) - 500.0 && (double) this.position.X + (double) ((int) this.width >> 1) <= (double) Main.npc[(int) this.ai1].position.X + (double) ((int) Main.npc[(int) this.ai1].width >> 1) + 500.0) + return; + this.TargetClosest(true); + this.ai2 = 5f; + vector2_2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num7 = Main.player[(int) this.target].position.X + 10f - vector2_2.X; + float num8 = Main.player[(int) this.target].position.Y + 21f - vector2_2.Y; + float num9 = 17f / (float) Math.Sqrt((double) num7 * (double) num7 + (double) num8 * (double) num8); + this.velocity.X = num7 * num9; + this.velocity.Y = num8 * num9; + this.netUpdate = true; + } + else + { + if ((double) this.ai2 != 5.0 || (double) this.position.X + (double) ((int) this.width >> 1) >= (double) Main.player[(int) this.target].position.X + 10.0 - 100.0) + return; + if ((double) this.ai3 >= 4.0) + { + this.ai2 = 0.0f; + this.ai3 = 0.0f; + } + else + { + this.ai2 = 4f; + ++this.ai3; + } + } + } + + private void SkeletronPrimeCannonHand() + { + this.spriteDirection = (sbyte) -(double) this.ai0; + if ((int) Main.npc[(int) this.ai1].active == 0 || (int) Main.npc[(int) this.ai1].aiStyle != 32) + { + this.ai2 += 10f; + if ((double) this.ai2 > 50.0 || Main.netMode != 2) + { + this.life = -1; + this.HitEffect(0, 10.0); + this.active = (byte) 0; + return; + } + } + if ((double) this.ai2 == 0.0) + { + if ((double) Main.npc[(int) this.ai1].ai1 == 3.0 && this.timeLeft > 10) + this.timeLeft = 10; + if ((double) Main.npc[(int) this.ai1].ai1 != 0.0) + { + this.localAI0 += 2; + if ((double) this.position.Y > (double) Main.npc[(int) this.ai1].position.Y - 100.0) + { + if ((double) this.velocity.Y > 0.0) + this.velocity.Y *= 0.96f; + this.velocity.Y -= 0.07f; + if ((double) this.velocity.Y > 6.0) + this.velocity.Y = 6f; + } + else if ((double) this.position.Y < (double) Main.npc[(int) this.ai1].position.Y - 100.0) + { + if ((double) this.velocity.Y < 0.0) + this.velocity.Y *= 0.96f; + this.velocity.Y += 0.07f; + if ((double) this.velocity.Y < -6.0) + this.velocity.Y = -6f; + } + if ((double) this.position.X + (double) ((int) this.width >> 1) > (double) Main.npc[(int) this.ai1].position.X + (double) ((int) Main.npc[(int) this.ai1].width >> 1) - 120.0 * (double) this.ai0) + { + if ((double) this.velocity.X > 0.0) + this.velocity.X *= 0.96f; + this.velocity.X -= 0.1f; + if ((double) this.velocity.X > 8.0) + this.velocity.X = 8f; + } + if ((double) this.position.X + (double) ((int) this.width >> 1) < (double) Main.npc[(int) this.ai1].position.X + (double) ((int) Main.npc[(int) this.ai1].width >> 1) - 120.0 * (double) this.ai0) + { + if ((double) this.velocity.X < 0.0) + this.velocity.X *= 0.96f; + this.velocity.X += 0.1f; + if ((double) this.velocity.X < -8.0) + this.velocity.X = -8f; + } + } + else + { + ++this.ai3; + if ((double) this.ai3 >= 1100.0) + { + this.localAI0 = 0; + this.ai2 = 1f; + this.ai3 = 0.0f; + this.netUpdate = true; + } + if ((double) this.position.Y > (double) Main.npc[(int) this.ai1].position.Y - 150.0) + { + if ((double) this.velocity.Y > 0.0) + this.velocity.Y *= 0.96f; + this.velocity.Y -= 0.04f; + if ((double) this.velocity.Y > 3.0) + this.velocity.Y = 3f; + } + else if ((double) this.position.Y < (double) Main.npc[(int) this.ai1].position.Y - 150.0) + { + if ((double) this.velocity.Y < 0.0) + this.velocity.Y *= 0.96f; + this.velocity.Y += 0.04f; + if ((double) this.velocity.Y < -3.0) + this.velocity.Y = -3f; + } + if ((double) this.position.X + (double) ((int) this.width >> 1) > (double) Main.npc[(int) this.ai1].position.X + (double) ((int) Main.npc[(int) this.ai1].width >> 1) + 200.0) + { + if ((double) this.velocity.X > 0.0) + this.velocity.X *= 0.96f; + this.velocity.X -= 0.2f; + if ((double) this.velocity.X > 8.0) + this.velocity.X = 8f; + } + if ((double) this.position.X + (double) ((int) this.width >> 1) < (double) Main.npc[(int) this.ai1].position.X + (double) ((int) Main.npc[(int) this.ai1].width >> 1) + 160.0) + { + if ((double) this.velocity.X < 0.0) + this.velocity.X *= 0.96f; + this.velocity.X += 0.2f; + if ((double) this.velocity.X < -8.0) + this.velocity.X = -8f; + } + } + Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num1 = (float) ((double) Main.npc[(int) this.ai1].position.X + (double) ((int) Main.npc[(int) this.ai1].width >> 1) - 200.0 * (double) this.ai0) - vector2.X; + float num2 = Main.npc[(int) this.ai1].position.Y + 230f - vector2.Y; + float num3 = (float) Math.Sqrt((double) num1 * (double) num1 + (double) num2 * (double) num2); + this.rotation = (float) Math.Atan2((double) num2, (double) num1) + 1.57f; + if (Main.netMode == 1) + return; + ++this.localAI0; + if (this.localAI0 <= 140) + return; + this.localAI0 = 0; + float num4 = 12f / num3; + float num5 = -num1 * num4; + float num6 = -num2 * num4; + float SpeedX = num5 + (float) Main.rand.Next(-40, 41) * 0.01f; + float SpeedY = num6 + (float) Main.rand.Next(-40, 41) * 0.01f; + vector2.X += SpeedX * 4f; + vector2.Y += SpeedY * 4f; + Projectile.NewProjectile(vector2.X, vector2.Y, SpeedX, SpeedY, 102, 0, 0.0f, 8, true); + } + else + { + if ((double) this.ai2 != 1.0) + return; + ++this.ai3; + if ((double) this.ai3 >= 300.0) + { + this.localAI0 = 0; + this.ai2 = 0.0f; + this.ai3 = 0.0f; + this.netUpdate = true; + } + Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num1 = Main.npc[(int) this.ai1].position.X + (float) ((int) Main.npc[(int) this.ai1].width >> 1) - vector2.X; + float num2 = Main.npc[(int) this.ai1].position.Y - vector2.Y; + float num3 = (float) ((double) Main.player[(int) this.target].position.Y + 21.0 - 80.0) - vector2.Y; + float num4 = 6f / (float) Math.Sqrt((double) num1 * (double) num1 + (double) num3 * (double) num3); + float num5 = num1 * num4; + float num6 = num3 * num4; + if ((double) this.velocity.X > (double) num5) + { + if ((double) this.velocity.X > 0.0) + this.velocity.X *= 0.9f; + this.velocity.X -= 0.04f; + } + if ((double) this.velocity.X < (double) num5) + { + if ((double) this.velocity.X < 0.0) + this.velocity.X *= 0.9f; + this.velocity.X += 0.04f; + } + if ((double) this.velocity.Y > (double) num6) + { + if ((double) this.velocity.Y > 0.0) + this.velocity.Y *= 0.9f; + this.velocity.Y -= 0.08f; + } + if ((double) this.velocity.Y < (double) num6) + { + if ((double) this.velocity.Y < 0.0) + this.velocity.Y *= 0.9f; + this.velocity.Y += 0.08f; + } + this.TargetClosest(true); + vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num7 = Main.player[(int) this.target].position.X + 10f - vector2.X; + float num8 = Main.player[(int) this.target].position.Y + 21f - vector2.Y; + float num9 = (float) Math.Sqrt((double) num7 * (double) num7 + (double) num8 * (double) num8); + this.rotation = (float) Math.Atan2((double) num8, (double) num7) - 1.57f; + if (Main.netMode == 1) + return; + ++this.localAI0; + if (this.localAI0 <= 40) + return; + this.localAI0 = 0; + float num10 = 10f / num9; + float num11 = num7 * num10; + float num12 = num8 * num10; + float SpeedX = num11 + (float) Main.rand.Next(-40, 41) * 0.01f; + float SpeedY = num12 + (float) Main.rand.Next(-40, 41) * 0.01f; + vector2.X += SpeedX * 4f; + vector2.Y += SpeedY * 4f; + Projectile.NewProjectile(vector2.X, vector2.Y, SpeedX, SpeedY, 102, 0, 0.0f, 8, true); + } + } + + private void SkeletronPrimeLaserHand() + { + this.spriteDirection = (sbyte) -(double) this.ai0; + if ((int) Main.npc[(int) this.ai1].active == 0 || (int) Main.npc[(int) this.ai1].aiStyle != 32) + { + this.ai2 += 10f; + if ((double) this.ai2 > 50.0 || Main.netMode != 2) + { + this.life = -1; + this.HitEffect(0, 10.0); + this.active = (byte) 0; + return; + } + } + if ((double) this.ai2 == 0.0 || (double) this.ai2 == 3.0) + { + if ((double) Main.npc[(int) this.ai1].ai1 == 3.0 && this.timeLeft > 10) + this.timeLeft = 10; + if ((double) Main.npc[(int) this.ai1].ai1 != 0.0) + { + this.localAI0 += 3; + if ((double) this.position.Y > (double) Main.npc[(int) this.ai1].position.Y - 100.0) + { + if ((double) this.velocity.Y > 0.0) + this.velocity.Y *= 0.96f; + this.velocity.Y -= 0.07f; + if ((double) this.velocity.Y > 6.0) + this.velocity.Y = 6f; + } + else if ((double) this.position.Y < (double) Main.npc[(int) this.ai1].position.Y - 100.0) + { + if ((double) this.velocity.Y < 0.0) + this.velocity.Y *= 0.96f; + this.velocity.Y += 0.07f; + if ((double) this.velocity.Y < -6.0) + this.velocity.Y = -6f; + } + if ((double) this.position.X + (double) ((int) this.width >> 1) > (double) Main.npc[(int) this.ai1].position.X + (double) ((int) Main.npc[(int) this.ai1].width >> 1) - 120.0 * (double) this.ai0) + { + if ((double) this.velocity.X > 0.0) + this.velocity.X *= 0.96f; + this.velocity.X -= 0.1f; + if ((double) this.velocity.X > 8.0) + this.velocity.X = 8f; + } + if ((double) this.position.X + (double) ((int) this.width >> 1) < (double) Main.npc[(int) this.ai1].position.X + (double) ((int) Main.npc[(int) this.ai1].width >> 1) - 120.0 * (double) this.ai0) + { + if ((double) this.velocity.X < 0.0) + this.velocity.X *= 0.96f; + this.velocity.X += 0.1f; + if ((double) this.velocity.X < -8.0) + this.velocity.X = -8f; + } + } + else + { + ++this.ai3; + if ((double) this.ai3 >= 800.0) + { + ++this.ai2; + this.ai3 = 0.0f; + this.netUpdate = true; + } + if ((double) this.position.Y > (double) Main.npc[(int) this.ai1].position.Y - 100.0) + { + if ((double) this.velocity.Y > 0.0) + this.velocity.Y *= 0.96f; + this.velocity.Y -= 0.1f; + if ((double) this.velocity.Y > 3.0) + this.velocity.Y = 3f; + } + else if ((double) this.position.Y < (double) Main.npc[(int) this.ai1].position.Y - 100.0) + { + if ((double) this.velocity.Y < 0.0) + this.velocity.Y *= 0.96f; + this.velocity.Y += 0.1f; + if ((double) this.velocity.Y < -3.0) + this.velocity.Y = -3f; + } + if ((double) this.position.X + (double) ((int) this.width >> 1) > (double) Main.npc[(int) this.ai1].position.X + (double) ((int) Main.npc[(int) this.ai1].width >> 1) - 180.0 * (double) this.ai0) + { + if ((double) this.velocity.X > 0.0) + this.velocity.X *= 0.96f; + this.velocity.X -= 0.14f; + if ((double) this.velocity.X > 8.0) + this.velocity.X = 8f; + } + if ((double) this.position.X + (double) ((int) this.width >> 1) < (double) Main.npc[(int) this.ai1].position.X + (double) ((int) Main.npc[(int) this.ai1].width >> 1) - 180.0 * (double) this.ai0) + { + if ((double) this.velocity.X < 0.0) + this.velocity.X *= 0.96f; + this.velocity.X += 0.14f; + if ((double) this.velocity.X < -8.0) + this.velocity.X = -8f; + } + } + this.TargetClosest(true); + Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num1 = Main.player[(int) this.target].position.X + 10f - vector2.X; + float num2 = Main.player[(int) this.target].position.Y + 21f - vector2.Y; + float num3 = (float) Math.Sqrt((double) num1 * (double) num1 + (double) num2 * (double) num2); + this.rotation = (float) Math.Atan2((double) num2, (double) num1) - 1.57f; + if (Main.netMode == 1) + return; + ++this.localAI0; + if (this.localAI0 <= 200) + return; + this.localAI0 = 0; + float num4 = 8f / num3; + float num5 = num1 * num4; + float num6 = num2 * num4; + float SpeedX = num5 + (float) Main.rand.Next(-40, 41) * 0.05f; + float SpeedY = num6 + (float) Main.rand.Next(-40, 41) * 0.05f; + vector2.X += SpeedX * 8f; + vector2.Y += SpeedY * 8f; + Projectile.NewProjectile(vector2.X, vector2.Y, SpeedX, SpeedY, 100, 25, 0.0f, 8, true); + } + else + { + if ((double) this.ai2 != 1.0) + return; + ++this.ai3; + if ((double) this.ai3 >= 200.0) + { + this.localAI0 = 0; + this.ai2 = 0.0f; + this.ai3 = 0.0f; + this.netUpdate = true; + } + Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num1 = (float) ((double) Main.player[(int) this.target].position.X + 10.0 - 350.0) - vector2.X; + float num2 = (float) ((double) Main.player[(int) this.target].position.Y + 21.0 - 20.0) - vector2.Y; + float num3 = 7f / (float) Math.Sqrt((double) num1 * (double) num1 + (double) num2 * (double) num2); + float num4 = num1 * num3; + float num5 = num2 * num3; + if ((double) this.velocity.X > (double) num4) + { + if ((double) this.velocity.X > 0.0) + this.velocity.X *= 0.9f; + this.velocity.X -= 0.1f; + } + if ((double) this.velocity.X < (double) num4) + { + if ((double) this.velocity.X < 0.0) + this.velocity.X *= 0.9f; + this.velocity.X += 0.1f; + } + if ((double) this.velocity.Y > (double) num5) + { + if ((double) this.velocity.Y > 0.0) + this.velocity.Y *= 0.9f; + this.velocity.Y -= 0.03f; + } + if ((double) this.velocity.Y < (double) num5) + { + if ((double) this.velocity.Y < 0.0) + this.velocity.Y *= 0.9f; + this.velocity.Y += 0.03f; + } + this.TargetClosest(true); + vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num6 = Main.player[(int) this.target].position.X + 10f - vector2.X; + float num7 = Main.player[(int) this.target].position.Y + 21f - vector2.Y; + float num8 = (float) Math.Sqrt((double) num6 * (double) num6 + (double) num7 * (double) num7); + this.rotation = (float) Math.Atan2((double) num7, (double) num6) - 1.57f; + if (Main.netMode != 1) + return; + ++this.localAI0; + if (this.localAI0 <= 80) + return; + this.localAI0 = 0; + float num9 = 10f / num8; + float num10 = num6 * num9; + float num11 = num7 * num9; + float SpeedX = num10 + (float) Main.rand.Next(-40, 41) * 0.05f; + float SpeedY = num11 + (float) Main.rand.Next(-40, 41) * 0.05f; + vector2.X += SpeedX * 8f; + vector2.Y += SpeedY * 8f; + Projectile.NewProjectile(vector2.X, vector2.Y, SpeedX, SpeedY, 100, 25, 0.0f, 8, true); + } + } + + private void DestroyerAI() + { + if ((double) this.ai3 > 0.0) + this.realLife = (int) this.ai3; + if ((int) this.target == 8 || Main.player[(int) this.target].dead) + this.TargetClosest(true); + if ((int) this.type > 134) + { + bool flag = false; + if ((double) this.ai1 <= 0.0) + flag = true; + else if (Main.npc[(int) this.ai1].life <= 0) + flag = true; + if (flag) + { + this.life = 0; + if ((int) this.active != 0) + this.HitEffect(0, 10.0); + this.checkDead(); + } + } + if (Main.netMode != 1) + { + if ((double) this.ai0 == 0.0 && (int) this.type == 134) + { + this.ai3 = (float) this.whoAmI; + this.realLife = (int) this.whoAmI; + int index1 = (int) this.whoAmI; + int num = 80; + for (int index2 = 0; index2 <= num; ++index2) + { + int Type = 135; + if (index2 == num) + Type = 136; + int number = NPC.NewNPC(this.aabb.X + ((int) this.width >> 1), this.aabb.Y + (int) this.height, Type, (int) this.whoAmI); + Main.npc[number].ai3 = (float) this.whoAmI; + Main.npc[number].realLife = (int) this.whoAmI; + Main.npc[number].ai1 = (float) index1; + Main.npc[index1].ai0 = (float) number; + NetMessage.CreateMessage1(23, number); + NetMessage.SendMessage(); + index1 = number; + } + } + if ((int) this.type == 135) + { + this.localAI0 += Main.rand.Next(4); + if (this.localAI0 >= Main.rand.Next(1400, 26000)) + { + this.localAI0 = 0; + this.TargetClosest(true); + if (Collision.CanHit(ref this.aabb, ref Main.player[(int) this.target].aabb)) + { + Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) ((int) this.height >> 1)); + float num1 = Main.player[(int) this.target].position.X + 10f - vector2.X + (float) Main.rand.Next(-20, 21); + float num2 = Main.player[(int) this.target].position.Y + 21f - vector2.Y + (float) Main.rand.Next(-20, 21); + float num3 = 8f / (float) Math.Sqrt((double) num1 * (double) num1 + (double) num2 * (double) num2); + float num4 = num1 * num3; + float num5 = num2 * num3; + float SpeedX = num4 + (float) Main.rand.Next(-20, 21) * 0.05f; + float SpeedY = num5 + (float) Main.rand.Next(-20, 21) * 0.05f; + vector2.X += SpeedX * 5f; + vector2.Y += SpeedY * 5f; + int index = Projectile.NewProjectile(vector2.X, vector2.Y, SpeedX, SpeedY, 100, 22, 0.0f, 8, true); + if (index >= 0) + { + Main.projectile[index].timeLeft = 300; + this.netUpdate = true; + } + } + } + } + } + int num6 = ((int) this.position.X >> 4) - 1; + int num7 = ((int) this.position.X + (int) this.width >> 4) + 2; + int num8 = ((int) this.position.Y >> 4) - 1; + int num9 = ((int) this.position.Y + (int) this.height >> 4) + 2; + if (num6 < 0) + num6 = 0; + if (num7 > (int) Main.maxTilesX) + num7 = (int) Main.maxTilesX; + if (num8 < 0) + num8 = 0; + if (num9 > (int) Main.maxTilesY) + num9 = (int) Main.maxTilesY; + bool flag1 = false; + if (!flag1) + { + for (int index1 = num6; index1 < num7; ++index1) + { + for (int index2 = num8; index2 < num9; ++index2) + { + if (Main.tile[index1, index2].canStandOnTop() || (int) Main.tile[index1, index2].liquid > 64) + { + Vector2 vector2; + vector2.X = (float) (index1 * 16); + vector2.Y = (float) (index2 * 16); + if ((double) this.position.X + (double) this.width > (double) vector2.X && (double) this.position.X < (double) vector2.X + 16.0 && ((double) this.position.Y + (double) this.height > (double) vector2.Y && (double) this.position.Y < (double) vector2.Y + 16.0)) + { + flag1 = true; + break; + } + } + } + } + } + if (!flag1) + { + if ((int) this.type != 135 || (double) this.ai2 != 1.0) + Lighting.addLight((int) this.position.X + ((int) this.width >> 1) >> 4, (int) this.position.Y + ((int) this.height >> 1) >> 4, new Vector3(0.3f, 0.1f, 0.05f)); + this.localAI1 = 1; + if ((int) this.type == 134) + { + Rectangle rectangle1 = new Rectangle((int) this.position.X, (int) this.position.Y, (int) this.width, (int) this.height); + bool flag2 = true; + if ((double) this.position.Y > (double) Main.player[(int) this.target].position.Y) + { + for (int index = 0; index < 8; ++index) + { + if ((int) Main.player[index].active != 0) + { + Rectangle rectangle2 = new Rectangle(Main.player[index].aabb.X - 1000, Main.player[index].aabb.Y - 1000, 2000, 2000); + if (rectangle1.Intersects(rectangle2)) + { + flag2 = false; + break; + } + } + } + if (flag2) + flag1 = true; + } + } + } + else + this.localAI1 = 0; + float num10 = 16f; + if (Main.gameTime.dayTime || Main.player[(int) this.target].dead) + { + flag1 = false; + ++this.velocity.Y; + if ((double) this.position.Y > (double) (Main.worldSurface << 4)) + { + ++this.velocity.Y; + num10 = 32f; + } + if ((double) this.position.Y > (double) (Main.rockLayer << 4)) + { + for (int index = 0; index < 196; ++index) + { + if ((int) Main.npc[index].aiStyle == (int) this.aiStyle) + Main.npc[index].active = (byte) 0; + } + } + } + Vector2 vector2_1 = new Vector2(this.position.X + (float) ((int) this.width >> 1), this.position.Y + (float) ((int) this.height >> 1)); + if ((double) this.ai1 > 0.0 && (double) this.ai1 < 196.0) + { + float num1 = Main.npc[(int) this.ai1].position.X + (float) ((int) Main.npc[(int) this.ai1].width >> 1) - vector2_1.X; + float num2 = Main.npc[(int) this.ai1].position.Y + (float) ((int) Main.npc[(int) this.ai1].height >> 1) - vector2_1.Y; + this.rotation = (float) (Math.Atan2((double) num2, (double) num1) + Math.PI / 2.0); + float num3 = (float) ((double) num1 * (double) num1 + (double) num2 * (double) num2); + if ((double) num3 > 0.0) + { + float num4 = (float) Math.Sqrt((double) num3); + float num5 = (num4 - 44f * this.scale) / num4; + float num11 = num1 * num5; + float num12 = num2 * num5; + this.position.X += num11; + this.position.Y += num12; + this.aabb.X = (int) this.position.X; + this.aabb.Y = (int) this.position.Y; + } + this.velocity.X = 0.0f; + this.velocity.Y = 0.0f; + } + else + { + float num1 = (float) (Main.player[(int) this.target].aabb.X + 10 & -16); + float num2 = (float) (Main.player[(int) this.target].aabb.Y + 21 & -16); + vector2_1.X = (float) ((int) vector2_1.X & -16); + vector2_1.Y = (float) ((int) vector2_1.Y & -16); + float num3 = num1 - vector2_1.X; + float num4 = num2 - vector2_1.Y; + if (!flag1) + { + this.TargetClosest(true); + this.velocity.Y += 0.15f; + if ((double) this.velocity.Y > (double) num10) + this.velocity.Y = num10; + if ((double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y) < (double) num10 * 0.4) + { + if ((double) this.velocity.X < 0.0) + this.velocity.X -= 0.11f; + else + this.velocity.X += 0.11f; + } + else if ((double) this.velocity.Y == (double) num10) + { + if ((double) this.velocity.X < (double) num3) + this.velocity.X += 0.1f; + else if ((double) this.velocity.X > (double) num3) + this.velocity.X -= 0.1f; + } + else if ((double) this.velocity.Y > 4.0) + { + if ((double) this.velocity.X < 0.0) + this.velocity.X += 0.09f; + else + this.velocity.X -= 0.09f; + } + } + else + { + float num5 = (float) Math.Sqrt((double) num3 * (double) num3 + (double) num4 * (double) num4); + if ((int) this.soundDelay == 0) + { + float num11 = num5 * 0.025f; + if ((double) num11 < 10.0) + num11 = 10f; + else if ((double) num11 > 20.0) + num11 = 20f; + this.soundDelay = (short) num11; + Main.PlaySound(15, this.aabb.X, this.aabb.Y, 1); + } + float num12 = Math.Abs(num3); + float num13 = Math.Abs(num4); + float num14 = num10 / num5; + float num15 = num3 * num14; + float num16 = num4 * num14; + if (((double) this.velocity.X > 0.0 && (double) num15 > 0.0 || (double) this.velocity.X < 0.0 && (double) num15 < 0.0) && ((double) this.velocity.Y > 0.0 && (double) num16 > 0.0 || (double) this.velocity.Y < 0.0 && (double) num16 < 0.0)) + { + if ((double) this.velocity.X < (double) num15) + this.velocity.X += 0.15f; + else if ((double) this.velocity.X > (double) num15) + this.velocity.X -= 0.15f; + if ((double) this.velocity.Y < (double) num16) + this.velocity.Y += 0.15f; + else if ((double) this.velocity.Y > (double) num16) + this.velocity.Y -= 0.15f; + } + if ((double) this.velocity.X > 0.0 && (double) num15 > 0.0 || (double) this.velocity.X < 0.0 && (double) num15 < 0.0 || ((double) this.velocity.Y > 0.0 && (double) num16 > 0.0 || (double) this.velocity.Y < 0.0 && (double) num16 < 0.0)) + { + if ((double) this.velocity.X < (double) num15) + this.velocity.X += 0.1f; + else if ((double) this.velocity.X > (double) num15) + this.velocity.X -= 0.1f; + if ((double) this.velocity.Y < (double) num16) + this.velocity.Y += 0.1f; + else if ((double) this.velocity.Y > (double) num16) + this.velocity.Y -= 0.1f; + if ((double) Math.Abs(num16) < (double) num10 * 0.2 && ((double) this.velocity.X > 0.0 && (double) num15 < 0.0 || (double) this.velocity.X < 0.0 && (double) num15 > 0.0)) + { + if ((double) this.velocity.Y > 0.0) + this.velocity.Y += 0.2f; + else + this.velocity.Y -= 0.2f; + } + if ((double) Math.Abs(num15) < (double) num10 * 0.2 && ((double) this.velocity.Y > 0.0 && (double) num16 < 0.0 || (double) this.velocity.Y < 0.0 && (double) num16 > 0.0)) + { + if ((double) this.velocity.X > 0.0) + this.velocity.X += 0.2f; + else + this.velocity.X -= 0.2f; + } + } + else if ((double) num12 > (double) num13) + { + if ((double) this.velocity.X < (double) num15) + this.velocity.X += 0.11f; + else if ((double) this.velocity.X > (double) num15) + this.velocity.X -= 0.11f; + if ((double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y) < (double) num10 * 0.5) + { + if ((double) this.velocity.Y > 0.0) + this.velocity.Y += 0.1f; + else + this.velocity.Y -= 0.1f; + } + } + else + { + if ((double) this.velocity.Y < (double) num16) + this.velocity.Y += 0.11f; + else if ((double) this.velocity.Y > (double) num16) + this.velocity.Y -= 0.11f; + if ((double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y) < (double) num10 * 0.5) + { + if ((double) this.velocity.X > 0.0) + this.velocity.X += 0.1f; + else + this.velocity.X -= 0.1f; + } + } + } + this.rotation = (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X) + 1.57f; + if ((int) this.type != 134) + return; + if (flag1) + { + if (this.localAI0 != 1) + this.netUpdate = true; + this.localAI0 = 1; + } + else + { + if (this.localAI0 != 0) + this.netUpdate = true; + this.localAI0 = 0; + } + if (((double) this.velocity.X <= 0.0 || (double) this.oldVelocity.X >= 0.0) && ((double) this.velocity.X >= 0.0 || (double) this.oldVelocity.X <= 0.0) && (((double) this.velocity.Y <= 0.0 || (double) this.oldVelocity.Y >= 0.0) && ((double) this.velocity.Y >= 0.0 || (double) this.oldVelocity.Y <= 0.0)) || this.justHit) + return; + this.netUpdate = true; + } + } + + private void SnowmanAI() + { + float num1 = 4f; + float num2 = 1f; + if ((int) this.type == 143) + { + num1 = 3f; + num2 = 0.7f; + } + if ((int) this.type == 145) + { + num1 = 3.5f; + num2 = 0.8f; + } + if ((int) this.type == 143) + { + ++this.ai2; + if ((double) this.ai2 >= 120.0) + { + this.ai2 = 0.0f; + if (Main.netMode != 1) + { + Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f - (float) ((int) this.direction * 12), this.position.Y + (float) this.height * 0.5f); + float SpeedX = (float) (12 * (int) this.spriteDirection); + float SpeedY = 0.0f; + if (Main.netMode != 1) + { + int number = Projectile.NewProjectile(vector2.X, vector2.Y, SpeedX, SpeedY, 110, 25, 0.0f, 8, false); + if (number >= 0) + { + Main.projectile[number].ai0 = 2f; + Main.projectile[number].timeLeft = 300; + Main.projectile[number].friendly = false; + NetMessage.SendProjectile(number, SendDataOptions.Reliable); + this.netUpdate = true; + } + } + } + } + } + if ((int) this.type == 144 && (double) this.ai1 >= 3.0) + { + this.TargetClosest(true); + this.spriteDirection = this.direction; + if ((double) this.velocity.Y == 0.0) + { + this.velocity.X *= 0.9f; + ++this.ai2; + if ((double) this.velocity.X > -0.3 && (double) this.velocity.X < 0.3) + this.velocity.X = 0.0f; + if ((double) this.ai2 >= 200.0) + { + this.ai2 = 0.0f; + this.ai1 = 0.0f; + } + } + } + else if ((int) this.type == 145 && (double) this.ai1 >= 3.0) + { + this.TargetClosest(true); + if ((double) this.velocity.Y == 0.0) + { + this.velocity.X *= 0.9f; + ++this.ai2; + if ((double) this.velocity.X > -0.3 && (double) this.velocity.X < 0.3) + this.velocity.X = 0.0f; + if ((double) this.ai2 >= 16.0) + { + this.ai2 = 0.0f; + this.ai1 = 0.0f; + } + } + if ((double) this.velocity.X == 0.0 && (double) this.velocity.Y == 0.0 && (double) this.ai2 == 8.0) + { + Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f - (float) ((int) this.direction * 12), this.position.Y + (float) this.height * 0.25f); + float num3 = Main.player[(int) this.target].position.X + 10f - vector2.X; + float num4 = Main.player[(int) this.target].position.Y - vector2.Y; + float num5 = 10f / (float) Math.Sqrt((double) num3 * (double) num3 + (double) num4 * (double) num4); + float SpeedX = num3 * num5; + float SpeedY = num4 * num5; + if (Main.netMode != 1) + { + int number = Projectile.NewProjectile(vector2.X, vector2.Y, SpeedX, SpeedY, 109, 35, 0.0f, 8, true); + if (number >= 0) + { + Main.projectile[number].ai0 = 2f; + Main.projectile[number].timeLeft = 300; + Main.projectile[number].friendly = false; + NetMessage.SendProjectile(number, SendDataOptions.Reliable); + this.netUpdate = true; + } + } + } + } + else + { + if ((double) this.velocity.Y == 0.0) + { + if (this.localAI2 == this.aabb.X) + { + this.direction = -this.direction; + this.ai3 = 60f; + } + this.localAI2 = this.aabb.X; + if ((double) this.ai3 == 0.0) + this.TargetClosest(true); + ++this.ai0; + if ((double) this.ai0 > 2.0) + { + this.ai0 = 0.0f; + ++this.ai1; + this.velocity.Y = -8.2f; + this.velocity.X += (float) ((double) this.direction * (double) num2 * 1.10000002384186); + } + else + { + this.velocity.Y = -6f; + this.velocity.X += (float) ((double) this.direction * (double) num2 * 0.899999976158142); + } + this.spriteDirection = this.direction; + } + this.velocity.X += (float) ((double) this.direction * (double) num2 * 0.00999999977648258); + } + if ((double) this.ai3 > 0.0) + --this.ai3; + if ((double) this.velocity.X > (double) num1 && (int) this.direction > 0) + { + this.velocity.X = 4f; + } + else + { + if ((double) this.velocity.X >= -(double) num1 || (int) this.direction >= 0) + return; + this.velocity.X = -4f; + } + } + + private unsafe void OcramAI() + { + Lighting.addLight(this.aabb.X >> 4, this.aabb.Y >> 4, new Vector3(1f, 1f, 1f)); + if ((int) this.target == 8 || Main.player[(int) this.target].dead || (int) Main.player[(int) this.target].active == 0) + this.TargetClosest(true); + bool flag = Main.player[(int) this.target].dead; + float num1 = (float) ((double) this.position.X + (double) ((int) this.width >> 1) - (double) Main.player[(int) this.target].position.X - 10.0); + float num2 = (float) Math.Atan2((double) this.position.Y + (double) this.height - 59.0 - (double) Main.player[(int) this.target].position.Y - 21.0, (double) num1) + 1.57f; + if ((double) num2 < 0.0) + num2 += 6.283f; + else if ((double) num2 > 6.28299999237061) + num2 -= 6.283f; + float num3 = 0.0f; + if ((double) this.ai0 == 0.0 && (double) this.ai1 == 0.0) + num3 = 0.02f; + if ((double) this.ai0 == 0.0 && (double) this.ai1 == 2.0 && (double) this.ai2 > 40.0) + num3 = 0.05f; + if ((double) this.ai0 == 3.0 && (double) this.ai1 == 0.0) + num3 = 0.05f; + if ((double) this.ai0 == 3.0 && (double) this.ai1 == 2.0 && (double) this.ai2 > 40.0) + num3 = 0.08f; + if ((double) this.rotation < (double) num2) + { + if ((double) num2 - (double) this.rotation > 3.1415) + this.rotation -= num3; + else + this.rotation += num3; + } + else if ((double) this.rotation > (double) num2) + { + if ((double) this.rotation - (double) num2 > 3.1415) + this.rotation += num3; + else + this.rotation -= num3; + } + if ((double) this.rotation > (double) num2 - (double) num3 && (double) this.rotation < (double) num2 + (double) num3) + this.rotation = num2; + if ((double) this.rotation < 0.0) + this.rotation += 6.283f; + else if ((double) this.rotation > 6.28299999237061) + this.rotation -= 6.283f; + if ((double) this.rotation > (double) num2 - (double) num3 && (double) this.rotation < (double) num2 + (double) num3) + this.rotation = num2; + if (Main.rand.Next(6) == 0) + { + Dust* dustPtr = Main.dust.NewDust(this.aabb.X, this.aabb.Y + ((int) this.height >> 2), (int) this.width, (int) this.height >> 1, 5, (double) this.velocity.X, 2.0, 0, new Color(), 1.0); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.X *= 0.5f; + dustPtr->velocity.Y *= 0.1f; + } + } + if (Main.gameTime.dayTime || flag) + { + this.velocity.Y -= 0.04f; + if (this.timeLeft <= 10) + return; + this.timeLeft = 10; + } + else if ((double) this.ai0 == 0.0) + { + if ((double) this.ai1 == 0.0) + { + float num4 = 8f; + float num5 = 0.12f; + Vector2 vector2_1 = new Vector2(this.position.X + (float) ((int) this.width >> 1), this.position.Y + (float) ((int) this.height >> 1)); + float num6 = Main.player[(int) this.target].position.X + 10f - vector2_1.X; + float num7 = (float) ((double) Main.player[(int) this.target].position.Y + 21.0 - 200.0) - vector2_1.Y; + float num8 = (float) Math.Sqrt((double) num6 * (double) num6 + (double) num7 * (double) num7); + float num9 = num8; + float num10 = num4 / num8; + float num11 = num6 * num10; + float num12 = num7 * num10; + if ((double) this.velocity.X < (double) num11) + { + this.velocity.X += num5; + if ((double) this.velocity.X < 0.0 && (double) num11 > 0.0) + this.velocity.X += num5; + } + else if ((double) this.velocity.X > (double) num11) + { + this.velocity.X -= num5; + if ((double) this.velocity.X > 0.0 && (double) num11 < 0.0) + this.velocity.X -= num5; + } + if ((double) this.velocity.Y < (double) num12) + { + this.velocity.Y += num5; + if ((double) this.velocity.Y < 0.0 && (double) num12 > 0.0) + this.velocity.Y += num5; + } + else if ((double) this.velocity.Y > (double) num12) + { + this.velocity.Y -= num5; + if ((double) this.velocity.Y > 0.0 && (double) num12 < 0.0) + this.velocity.Y -= num5; + } + ++this.ai2; + if ((double) this.ai2 >= 600.0) + { + this.ai1 = 1f; + this.ai2 = 0.0f; + this.ai3 = 0.0f; + this.target = (byte) 8; + this.netUpdate = true; + } + else if (this.aabb.Y + (int) this.height < Main.player[(int) this.target].aabb.Y && (double) num9 < 500.0) + { + if (!Main.player[(int) this.target].dead) + ++this.ai3; + if ((double) this.ai3 >= 90.0) + { + this.TargetClosest(true); + float num13 = 9f / (float) Math.Sqrt((double) num11 * (double) num11 + (double) num12 * (double) num12); + float SpeedX = num11 * num13; + float SpeedY = num12 * num13; + vector2_1.X += SpeedX * 15f; + vector2_1.Y += SpeedY * 15f; + Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, 100, 20, 0.0f, 8, true); + } + if ((double) this.ai3 == 60.0 || (double) this.ai3 == 70.0 || ((double) this.ai3 == 80.0 || (double) this.ai3 == 90.0)) + { + this.rotation = num2; + float num13 = Main.player[(int) this.target].position.X + 10f - vector2_1.X; + float num14 = Main.player[(int) this.target].position.Y + 21f - vector2_1.Y; + float num15 = 5f / (float) Math.Sqrt((double) num13 * (double) num13 + (double) num14 * (double) num14); + Vector2 vector2_2 = vector2_1; + Vector2 vector2_3; + vector2_3.X = num13 * num15; + vector2_3.Y = num14 * num15; + vector2_2.X += vector2_3.X * 10f; + vector2_2.Y += vector2_3.Y * 10f; + if (Main.netMode != 1) + { + int number = NPC.NewNPC((int) vector2_2.X, (int) vector2_2.Y, 167, 0); + if (number < 196) + { + Main.npc[number].velocity.X = vector2_3.X; + Main.npc[number].velocity.Y = vector2_3.Y; + NetMessage.CreateMessage1(23, number); + NetMessage.SendMessage(); + } + } + Main.PlaySound(3, (int) vector2_2.X, (int) vector2_2.Y, 1); + int num16 = 0; + while (num16 < 8 && IntPtr.Zero != (IntPtr) Main.dust.NewDust((int) vector2_2.X, (int) vector2_2.Y, 20, 20, 5, (double) vector2_3.X * 0.400000005960464, (double) vector2_3.Y * 0.400000005960464, 0, new Color(), 1.0)) + ++num16; + } + if ((double) this.ai3 == 103.0) + this.ai3 = 0.0f; + } + } + else if ((double) this.ai1 == 1.0) + { + this.rotation = num2; + float num4 = 6f; + Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num5 = Main.player[(int) this.target].position.X + 10f - vector2.X; + float num6 = Main.player[(int) this.target].position.Y + 21f - vector2.Y; + float num7 = (float) Math.Sqrt((double) num5 * (double) num5 + (double) num6 * (double) num6); + float num8 = num4 / num7; + this.velocity.X = num5 * num8; + this.velocity.Y = num6 * num8; + this.ai1 = 2f; + } + else if ((double) this.ai1 == 2.0) + { + ++this.ai2; + if ((double) this.ai2 >= 40.0) + { + this.velocity.X *= 0.98f; + this.velocity.Y *= 0.98f; + if ((double) this.velocity.X > -0.1 && (double) this.velocity.X < 0.1) + this.velocity.X = 0.0f; + if ((double) this.velocity.Y > -0.1 && (double) this.velocity.Y < 0.1) + this.velocity.Y = 0.0f; + } + else + this.rotation = (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X) - 1.57f; + if ((double) this.ai2 >= 150.0) + { + ++this.ai3; + this.ai2 = 0.0f; + this.target = (byte) 8; + this.rotation = num2; + if ((double) this.ai3 >= 3.0) + { + this.ai1 = 0.0f; + this.ai3 = 0.0f; + } + else + this.ai1 = 1f; + } + } + if (this.life >= this.lifeMax >> 1) + return; + this.ai0 = 1f; + this.ai1 = 0.0f; + this.ai2 = 0.0f; + this.ai3 = 0.0f; + this.netUpdate = true; + } + else if ((double) this.ai0 == 1.0 || (double) this.ai0 == 2.0) + { + if ((double) this.ai0 == 1.0) + { + this.ai2 += 0.005f; + if ((double) this.ai2 > 0.5) + this.ai2 = 0.5f; + } + else + { + this.ai2 -= 0.005f; + if ((double) this.ai2 < 0.0) + this.ai2 = 0.0f; + } + this.rotation += this.ai2; + ++this.ai1; + if ((double) this.ai1 == 100.0) + { + ++this.ai0; + this.ai1 = 0.0f; + if ((double) this.ai0 == 3.0) + { + this.ai2 = 0.0f; + } + else + { + Main.PlaySound(3, this.aabb.X, this.aabb.Y, 1); + for (int index = 0; index < 2; ++index) + { + Gore.NewGore(this.position, new Vector2((float) Main.rand.Next(-30, 31) * 0.2f, (float) Main.rand.Next(-30, 31) * 0.2f), 174, 1.0); + Gore.NewGore(this.position, new Vector2((float) Main.rand.Next(-30, 31) * 0.2f, (float) Main.rand.Next(-30, 31) * 0.2f), 173, 1.0); + Gore.NewGore(this.position, new Vector2((float) Main.rand.Next(-30, 31) * 0.2f, (float) Main.rand.Next(-30, 31) * 0.2f), 172, 1.0); + } + int num4 = 0; + while (num4 < 16 && IntPtr.Zero != (IntPtr) Main.dust.NewDust(5, ref this.aabb, (double) Main.rand.Next(-30, 31) * 0.200000002980232, (double) Main.rand.Next(-30, 31) * 0.200000002980232, 0, new Color(), 1.0)) + ++num4; + Main.PlaySound(15, this.aabb.X, this.aabb.Y, 0); + } + } + Main.dust.NewDust(5, ref this.aabb, (double) Main.rand.Next(-30, 31) * 0.200000002980232, (double) Main.rand.Next(-30, 31) * 0.200000002980232, 0, new Color(), 1.0); + this.velocity.X *= 0.98f; + this.velocity.Y *= 0.98f; + if ((double) this.velocity.X > -0.1 && (double) this.velocity.X < 0.1) + this.velocity.X = 0.0f; + if ((double) this.velocity.Y <= -0.1 || (double) this.velocity.Y >= 0.1) + return; + this.velocity.Y = 0.0f; + } + else + { + this.damage = 50; + this.defense = 0; + if ((double) this.ai1 == 0.0) + { + float num4 = 9f; + float num5 = 0.2f; + Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num6 = Main.player[(int) this.target].position.X + 10f - vector2.X; + float num7 = (float) ((double) Main.player[(int) this.target].position.Y + 21.0 - 120.0) - vector2.Y; + float num8 = (float) Math.Sqrt((double) num6 * (double) num6 + (double) num7 * (double) num7); + float num9 = num4 / num8; + float num10 = num6 * num9; + float num11 = num7 * num9; + if ((double) this.velocity.X < (double) num10) + { + this.velocity.X += num5; + if ((double) this.velocity.X < 0.0 && (double) num10 > 0.0) + this.velocity.X += num5; + } + else if ((double) this.velocity.X > (double) num10) + { + this.velocity.X -= num5; + if ((double) this.velocity.X > 0.0 && (double) num10 < 0.0) + this.velocity.X -= num5; + } + if ((double) this.velocity.Y < (double) num11) + { + this.velocity.Y += num5; + if ((double) this.velocity.Y < 0.0 && (double) num11 > 0.0) + this.velocity.Y += num5; + } + else if ((double) this.velocity.Y > (double) num11) + { + this.velocity.Y -= num5; + if ((double) this.velocity.Y > 0.0 && (double) num11 < 0.0) + this.velocity.Y -= num5; + } + ++this.ai2; + if ((double) this.ai2 < 100.0) + return; + if ((double) this.ai2 >= 200.0) + { + this.ai1 = 1f; + this.ai2 = 0.0f; + this.ai3 = 0.0f; + this.target = (byte) 8; + this.netUpdate = true; + } + float num12 = 9f / (float) Math.Sqrt((double) num10 * (double) num10 + (double) num11 * (double) num11); + float num13 = num10 * num12; + float num14 = num11 * num12; + float SpeedX = num13 + (float) Main.rand.Next(-40, 41) * 0.08f; + float SpeedY = num14 + (float) Main.rand.Next(-40, 41) * 0.08f; + vector2.X += SpeedX * 15f; + vector2.Y += SpeedY * 15f; + Projectile.NewProjectile(vector2.X, vector2.Y, SpeedX, SpeedY, 83, 45, 0.0f, 8, true); + } + else if ((double) this.ai1 == 1.0) + { + Main.PlaySound(15, (int) this.position.X, (int) this.position.Y, 0); + this.rotation = num2; + float num4 = 6.8f; + Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num5 = Main.player[(int) this.target].position.X + 10f - vector2.X; + float num6 = Main.player[(int) this.target].position.Y + 21f - vector2.Y; + float num7 = (float) Math.Sqrt((double) num5 * (double) num5 + (double) num6 * (double) num6); + float num8 = num4 / num7; + this.velocity.X = num5 * num8; + this.velocity.Y = num6 * num8; + if ((double) this.ai1 == 1.0) + { + float num9 = 6f / (float) Math.Sqrt((double) num5 * (double) num5 + (double) num6 * (double) num6); + float num10 = num5 * num9; + float num11 = num6 * num9; + float SpeedX = num10 + (float) Main.rand.Next(-40, 41) * 0.08f; + float SpeedY = num11 + (float) Main.rand.Next(-40, 41) * 0.08f; + for (int index = 1; index <= 10; ++index) + { + vector2.X += (float) Main.rand.Next(-50, 50) * 2f; + vector2.Y += (float) Main.rand.Next(-50, 50) * 2f; + Projectile.NewProjectile(vector2.X, vector2.Y, SpeedX, SpeedY, 44, 45, 0.0f, 8, true); + } + } + this.ai1 = 2f; + } + else + { + if ((double) this.ai1 != 2.0) + return; + ++this.ai2; + if ((double) this.ai2 >= 40.0) + { + this.velocity.X *= 1f; + this.velocity.Y *= 1f; + if ((double) this.velocity.X > -0.1 && (double) this.velocity.X < 0.1) + this.velocity.X = 0.0f; + if ((double) this.velocity.Y > -0.1 && (double) this.velocity.Y < 0.1) + this.velocity.Y = 0.0f; + if ((double) this.ai2 >= 135.0) + { + ++this.ai3; + this.ai2 = 0.0f; + this.target = (byte) 8; + this.rotation = num2; + if ((double) this.ai3 >= 3.0) + { + this.ai1 = 0.0f; + this.ai3 = 0.0f; + } + else + this.ai1 = 1f; + } + if ((double) this.ai2 != 110.0 && (double) this.ai2 != 100.0 && ((double) this.ai2 != 130.0 && (double) this.ai2 != 120.0)) + return; + this.rotation = num2; + Vector2 vector2_1 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num4 = Main.player[(int) this.target].position.X + 10f - vector2_1.X; + float num5 = Main.player[(int) this.target].position.Y + 21f - vector2_1.Y; + float num6 = 5f / (float) Math.Sqrt((double) num4 * (double) num4 + (double) num5 * (double) num5); + Vector2 vector2_2 = vector2_1; + Vector2 vector2_3; + vector2_3.X = num4 * num6; + vector2_3.Y = num5 * num6; + vector2_2.X += vector2_3.X * 10f; + vector2_2.Y += vector2_3.Y * 10f; + if (Main.netMode == 1) + return; + int number = NPC.NewNPC((int) vector2_2.X, (int) vector2_2.Y, 167, 0); + if (number >= 196) + return; + Main.npc[number].velocity.X = vector2_3.X; + Main.npc[number].velocity.Y = vector2_3.Y; + NetMessage.CreateMessage1(23, number); + NetMessage.SendMessage(); + } + else + this.rotation = (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X) - 1.57f; + } + } + } + + public void FindFrame() + { + int num = 0; + if ((int) this.aiAction == 0) + num = (double) this.velocity.Y >= 0.0 ? ((double) this.velocity.Y <= 0.0 ? ((double) this.velocity.X == 0.0 ? 0 : 1) : 3) : 2; + else if ((int) this.aiAction == 1) + num = 4; + if ((int) this.type == 1 || (int) this.type == 16 || ((int) this.type == 59 || (int) this.type == 71) || ((int) this.type == 81 || (int) this.type == 150 || (int) this.type == 138)) + { + ++this.frameCounter; + if (num > 0) + ++this.frameCounter; + if (num == 4) + ++this.frameCounter; + if ((double) this.frameCounter >= 8.0) + { + this.frameY += this.frameHeight; + this.frameCounter = 0.0f; + } + if ((int) this.frameY < (int) this.frameHeight * (int) NPC.npcFrameCount[(int) this.type]) + return; + this.frameY = (short) 0; + } + else if ((int) this.type == 141) + { + this.spriteDirection = this.direction; + if ((double) this.velocity.Y != 0.0) + { + this.frameY = (short) ((int) this.frameHeight << 1); + } + else + { + ++this.frameCounter; + if ((double) this.frameCounter >= 8.0) + { + this.frameY += this.frameHeight; + this.frameCounter = 0.0f; + } + if ((int) this.frameY <= (int) this.frameHeight) + return; + this.frameY = (short) 0; + } + } + else if ((int) this.type == 143) + { + if ((double) this.velocity.Y > 0.0) + ++this.frameCounter; + else if ((double) this.velocity.Y < 0.0) + --this.frameCounter; + if ((double) this.frameCounter < 6.0) + this.frameY = this.frameHeight; + else if ((double) this.frameCounter < 12.0) + this.frameY = (short) ((int) this.frameHeight << 1); + else if ((double) this.frameCounter < 18.0) + this.frameY = (short) ((int) this.frameHeight * 3); + if ((double) this.frameCounter < 0.0) + this.frameCounter = 0.0f; + if ((double) this.frameCounter <= 17.0) + return; + this.frameCounter = 17f; + } + else if ((int) this.type == 144) + { + if ((double) this.velocity.X == 0.0 && (double) this.velocity.Y == 0.0) + { + ++this.localAI3; + if (this.localAI3 < 6) + this.frameY = (short) 0; + else if (this.localAI3 < 12) + this.frameY = this.frameHeight; + if (this.localAI3 < 11) + return; + this.localAI3 = 0; + } + else + { + if ((double) this.velocity.Y > 0.0) + ++this.frameCounter; + else if ((double) this.velocity.Y < 0.0) + --this.frameCounter; + if ((double) this.frameCounter < 6.0) + this.frameY = (short) ((int) this.frameHeight << 1); + else if ((double) this.frameCounter < 12.0) + this.frameY = (short) ((int) this.frameHeight * 3); + else if ((double) this.frameCounter < 18.0) + this.frameY = (short) ((int) this.frameHeight << 2); + if ((double) this.frameCounter < 0.0) + { + this.frameCounter = 0.0f; + } + else + { + if ((double) this.frameCounter <= 17.0) + return; + this.frameCounter = 17f; + } + } + } + else if ((int) this.type == 145) + { + if ((double) this.velocity.X == 0.0 && (double) this.velocity.Y == 0.0) + { + if ((double) this.ai2 < 4.0) + this.frameY = (short) 0; + else if ((double) this.ai2 < 8.0) + this.frameY = this.frameHeight; + else if ((double) this.ai2 < 12.0) + { + this.frameY = (short) ((int) this.frameHeight << 1); + } + else + { + if ((double) this.ai2 >= 16.0) + return; + this.frameY = (short) ((int) this.frameHeight * 3); + } + } + else + { + if ((double) this.velocity.Y > 0.0) + ++this.frameCounter; + else if ((double) this.velocity.Y < 0.0) + --this.frameCounter; + if ((double) this.frameCounter < 6.0) + this.frameY = (short) ((int) this.frameHeight << 2); + else if ((double) this.frameCounter < 12.0) + this.frameY = (short) ((int) this.frameHeight * 5); + else if ((double) this.frameCounter < 18.0) + this.frameY = (short) ((int) this.frameHeight * 6); + if ((double) this.frameCounter < 0.0) + this.frameCounter = 0.0f; + if ((double) this.frameCounter <= 17.0) + return; + this.frameCounter = 17f; + } + } + else if ((int) this.type == 50) + { + if ((double) this.velocity.Y != 0.0) + { + this.frameY = (short) ((int) this.frameHeight << 2); + } + else + { + ++this.frameCounter; + if (num > 0) + ++this.frameCounter; + if (num == 4) + ++this.frameCounter; + if ((double) this.frameCounter >= 8.0) + { + this.frameY += this.frameHeight; + this.frameCounter = 0.0f; + } + if ((int) this.frameY < (int) this.frameHeight * 4) + return; + this.frameY = (short) 0; + } + } + else if ((int) this.type == 135) + { + if ((double) this.ai2 == 0.0) + this.frameY = (short) 0; + else + this.frameY = this.frameHeight; + } + else if ((int) this.type == 85) + { + if ((double) this.ai0 == 0.0) + { + this.frameCounter = 0.0f; + this.frameY = (short) 0; + } + else + { + if ((double) this.velocity.Y == 0.0) + --this.frameCounter; + else + ++this.frameCounter; + if ((double) this.frameCounter < 0.0) + this.frameCounter = 0.0f; + else if ((double) this.frameCounter > 12.0) + this.frameCounter = 12f; + if ((double) this.frameCounter < 3.0) + this.frameY = this.frameHeight; + else if ((double) this.frameCounter < 6.0) + this.frameY = (short) ((int) this.frameHeight << 1); + else if ((double) this.frameCounter < 9.0) + this.frameY = (short) ((int) this.frameHeight * 3); + else if ((double) this.frameCounter < 12.0) + this.frameY = (short) ((int) this.frameHeight << 2); + else if ((double) this.frameCounter < 15.0) + this.frameY = (short) ((int) this.frameHeight * 5); + else if ((double) this.frameCounter < 18.0) + this.frameY = (short) ((int) this.frameHeight << 2); + else if ((double) this.frameCounter < 21.0) + { + this.frameY = (short) ((int) this.frameHeight * 3); + } + else + { + this.frameY = (short) ((int) this.frameHeight << 1); + if ((double) this.frameCounter >= 24.0) + this.frameCounter = 3f; + } + } + if ((double) this.ai3 == 2.0) + { + this.frameY = (short) ((int) this.frameY + (int) this.frameHeight * 6); + } + else + { + if ((double) this.ai3 != 3.0) + return; + this.frameY = (short) ((int) this.frameY + (int) this.frameHeight * 12); + } + } + else if ((int) this.type == 113 || (int) this.type == 114) + { + if ((double) this.ai2 == 0.0) + { + ++this.frameCounter; + if ((double) this.frameCounter >= 12.0) + { + this.frameY += this.frameHeight; + this.frameCounter = 0.0f; + } + if ((int) this.frameY < (int) this.frameHeight * (int) NPC.npcFrameCount[(int) this.type]) + return; + this.frameY = (short) 0; + } + else + { + this.frameY = (short) 0; + this.frameCounter = -60f; + } + } + else if ((int) this.type == 61) + { + this.spriteDirection = this.direction; + this.rotation = this.velocity.X * 0.1f; + if ((double) this.velocity.X == 0.0 && (double) this.velocity.Y == 0.0) + { + this.frameY = (short) 0; + this.frameCounter = 0.0f; + } + else + { + ++this.frameCounter; + if ((double) this.frameCounter < 4.0) + { + this.frameY = this.frameHeight; + } + else + { + this.frameY = (short) ((int) this.frameHeight << 1); + if ((double) this.frameCounter < 7.0) + return; + this.frameCounter = 0.0f; + } + } + } + else if ((int) this.type == 122 || (int) this.type == 153) + { + this.spriteDirection = this.direction; + this.rotation = this.velocity.X * 0.05f; + if ((double) this.ai3 > 0.0) + { + this.frameCounter = 0.0f; + this.frameY = (short) ((((int) this.ai3 >> 3) + 3) * (int) this.frameHeight); + } + else + { + ++this.frameCounter; + if ((double) this.frameCounter >= 8.0) + { + this.frameY += this.frameHeight; + this.frameCounter = 0.0f; + } + if ((int) this.frameY < (int) this.frameHeight * 3) + return; + this.frameY = (short) 0; + } + } + else if ((int) this.type == 74) + { + this.spriteDirection = this.direction; + this.rotation = this.velocity.X * 0.1f; + if ((double) this.velocity.X == 0.0 && (double) this.velocity.Y == 0.0) + { + this.frameY = (short) ((int) this.frameHeight << 2); + this.frameCounter = 0.0f; + } + else + { + ++this.frameCounter; + if ((double) this.frameCounter >= 4.0) + { + this.frameY += this.frameHeight; + this.frameCounter = 0.0f; + } + if ((int) this.frameY < (int) this.frameHeight * (int) NPC.npcFrameCount[(int) this.type]) + return; + this.frameY = (short) 0; + } + } + else if ((int) this.type == 62 || (int) this.type == 165 || (int) this.type == 66) + { + this.spriteDirection = this.direction; + this.rotation = this.velocity.X * 0.1f; + ++this.frameCounter; + if ((double) this.frameCounter < 6.0) + { + this.frameY = (short) 0; + } + else + { + this.frameY = this.frameHeight; + if ((double) this.frameCounter < 11.0) + return; + this.frameCounter = 0.0f; + } + } + else if ((int) this.type == 63 || (int) this.type == 64 || (int) this.type == 103) + { + ++this.frameCounter; + if ((double) this.frameCounter < 6.0) + this.frameY = (short) 0; + else if ((double) this.frameCounter < 12.0) + this.frameY = this.frameHeight; + else if ((double) this.frameCounter < 18.0) + { + this.frameY = (short) ((int) this.frameHeight << 1); + } + else + { + this.frameY = (short) ((int) this.frameHeight * 3); + if ((double) this.frameCounter < 23.0) + return; + this.frameCounter = 0.0f; + } + } + else if ((int) this.type == 2 || (int) this.type == 23 || (int) this.type == 121) + { + if ((int) this.type == 2) + { + if ((double) this.velocity.X > 0.0) + { + this.spriteDirection = (sbyte) 1; + this.rotation = (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X); + } + if ((double) this.velocity.X < 0.0) + { + this.spriteDirection = (sbyte) -1; + this.rotation = (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X) + 3.14f; + } + } + else if ((int) this.type == 121) + { + if ((double) this.velocity.X > 0.0) + this.spriteDirection = (sbyte) 1; + if ((double) this.velocity.X < 0.0) + this.spriteDirection = (sbyte) -1; + this.rotation = this.velocity.X * 0.1f; + } + if ((double) ++this.frameCounter >= 8.0) + { + this.frameY += this.frameHeight; + this.frameCounter = 0.0f; + } + if ((int) this.frameY < (int) this.frameHeight * (int) NPC.npcFrameCount[(int) this.type]) + return; + this.frameY = (short) 0; + } + else if ((int) this.type == 133) + { + if ((double) this.velocity.X > 0.0) + { + this.spriteDirection = (sbyte) 1; + this.rotation = (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X); + } + if ((double) this.velocity.X < 0.0) + { + this.spriteDirection = (sbyte) -1; + this.rotation = (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X) + 3.14f; + } + this.frameY = (double) ++this.frameCounter < 8.0 ? (short) 0 : this.frameHeight; + if ((double) this.frameCounter >= 16.0) + { + this.frameY = (short) 0; + this.frameCounter = 0.0f; + } + if ((double) this.life >= (double) this.lifeMax * 0.5) + return; + this.frameY = (short) ((int) this.frameY + ((int) this.frameHeight << 1)); + } + else if ((int) this.type == 116) + { + if ((double) this.velocity.X > 0.0) + { + this.spriteDirection = (sbyte) 1; + this.rotation = (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X); + } + if ((double) this.velocity.X < 0.0) + { + this.spriteDirection = (sbyte) -1; + this.rotation = (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X) + 3.14f; + } + if ((double) ++this.frameCounter >= 5.0) + { + this.frameY += this.frameHeight; + this.frameCounter = 0.0f; + } + if ((int) this.frameY < (int) this.frameHeight * (int) NPC.npcFrameCount[(int) this.type]) + return; + this.frameY = (short) 0; + } + else if ((int) this.type == 75) + { + this.spriteDirection = (double) this.velocity.X <= 0.0 ? (sbyte) -1 : (sbyte) 1; + this.rotation = this.velocity.X * 0.1f; + if ((double) ++this.frameCounter >= 4.0) + { + this.frameY += this.frameHeight; + this.frameCounter = 0.0f; + } + if ((int) this.frameY < (int) this.frameHeight * (int) NPC.npcFrameCount[(int) this.type]) + return; + this.frameY = (short) 0; + } + else if ((int) this.type == 55 || (int) this.type == 57 || ((int) this.type == 58 || (int) this.type == 102)) + { + this.spriteDirection = this.direction; + ++this.frameCounter; + if (this.wet) + { + if ((double) this.frameCounter < 6.0) + this.frameY = (short) 0; + else if ((double) this.frameCounter < 12.0) + this.frameY = this.frameHeight; + else if ((double) this.frameCounter < 18.0) + this.frameY = (short) ((int) this.frameHeight << 1); + else if ((double) this.frameCounter < 24.0) + this.frameY = (short) ((int) this.frameHeight * 3); + else + this.frameCounter = 0.0f; + } + else if ((double) this.frameCounter < 6.0) + this.frameY = (short) ((int) this.frameHeight << 2); + else if ((double) this.frameCounter < 12.0) + this.frameY = (short) ((int) this.frameHeight * 5); + else + this.frameCounter = 0.0f; + } + else if ((int) this.type == 69 || (int) this.type == 147) + { + if ((double) this.ai0 < 190.0) + { + if ((double) ++this.frameCounter < 6.0) + return; + this.frameCounter = 0.0f; + this.frameY += this.frameHeight; + if ((int) this.frameY / (int) this.frameHeight < (int) NPC.npcFrameCount[(int) this.type] - 1) + return; + this.frameY = (short) 0; + } + else + { + this.frameCounter = 0.0f; + this.frameY = (short) ((int) this.frameHeight * ((int) NPC.npcFrameCount[(int) this.type] - 1)); + } + } + else if ((int) this.type == 86) + { + if ((double) this.velocity.Y == 0.0 || this.wet) + this.spriteDirection = (double) this.velocity.X >= -2.0 ? ((double) this.velocity.X <= 2.0 ? this.direction : (sbyte) 1) : (sbyte) -1; + if ((double) this.velocity.Y != 0.0) + { + this.frameY = (short) ((int) this.frameHeight * 15); + this.frameCounter = 0.0f; + } + else if ((double) this.velocity.X == 0.0) + { + this.frameCounter = 0.0f; + this.frameY = (short) 0; + } + else if ((double) Math.Abs(this.velocity.X) < 3.0) + { + this.frameCounter += Math.Abs(this.velocity.X); + if ((double) this.frameCounter < 6.0) + return; + this.frameCounter = 0.0f; + this.frameY += this.frameHeight; + if ((int) this.frameY / (int) this.frameHeight >= 9) + this.frameY = this.frameHeight; + if ((int) this.frameY / (int) this.frameHeight > 0) + return; + this.frameY = this.frameHeight; + } + else + { + this.frameCounter = this.frameCounter + Math.Abs(this.velocity.X); + if ((double) this.frameCounter < 10.0) + return; + this.frameCounter = 0.0f; + this.frameY += this.frameHeight; + if ((int) this.frameY / (int) this.frameHeight >= 15) + this.frameY = (short) ((int) this.frameHeight * 9); + if ((int) this.frameY / (int) this.frameHeight > 8) + return; + this.frameY = (short) ((int) this.frameHeight * 9); + } + } + else if ((int) this.type == (int) sbyte.MaxValue) + { + if ((double) this.ai1 == 0.0) + { + ++this.frameCounter; + if ((double) this.frameCounter < 12.0) + return; + this.frameCounter = 0.0f; + this.frameY += this.frameHeight; + if ((int) this.frameY / (int) this.frameHeight < 2) + return; + this.frameY = (short) 0; + } + else + { + this.frameCounter = 0.0f; + this.frameY = (short) ((int) this.frameHeight << 1); + } + } + else if ((int) this.type == 129) + { + if ((double) this.velocity.Y == 0.0) + this.spriteDirection = this.direction; + ++this.frameCounter; + if ((double) this.frameCounter < 2.0) + return; + this.frameCounter = 0.0f; + this.frameY += this.frameHeight; + if ((int) this.frameY / (int) this.frameHeight < (int) NPC.npcFrameCount[(int) this.type]) + return; + this.frameY = (short) 0; + } + else if ((int) this.type == 130) + { + if ((double) this.velocity.Y == 0.0) + this.spriteDirection = this.direction; + ++this.frameCounter; + if ((double) this.frameCounter < 8.0) + return; + this.frameCounter = 0.0f; + this.frameY += this.frameHeight; + if ((int) this.frameY / (int) this.frameHeight < (int) NPC.npcFrameCount[(int) this.type]) + return; + this.frameY = (short) 0; + } + else if ((int) this.type == 67) + { + if ((double) this.velocity.Y == 0.0) + this.spriteDirection = this.direction; + ++this.frameCounter; + if ((double) this.frameCounter < 6.0) + return; + this.frameCounter = 0.0f; + this.frameY += this.frameHeight; + if ((int) this.frameY / (int) this.frameHeight < (int) NPC.npcFrameCount[(int) this.type]) + return; + this.frameY = (short) 0; + } + else if ((int) this.type == 109) + { + if ((double) this.velocity.Y == 0.0 && ((double) this.velocity.X <= 0.0 && (int) this.direction < 0 || (double) this.velocity.X >= 0.0 && (int) this.direction > 0)) + this.spriteDirection = this.direction; + this.frameCounter += Math.Abs(this.velocity.X); + if ((double) this.frameCounter < 7.0) + return; + this.frameCounter -= 7f; + this.frameY += this.frameHeight; + if ((int) this.frameY / (int) this.frameHeight < (int) NPC.npcFrameCount[(int) this.type]) + return; + this.frameY = (short) 0; + } + else if ((int) this.type == 83 || (int) this.type == 84 || (int) this.type == 151) + { + if ((double) this.ai0 == 2.0) + { + this.frameCounter = 0.0f; + this.frameY = (short) 0; + } + else + { + ++this.frameCounter; + if ((double) this.frameCounter < 4.0) + return; + this.frameCounter = 0.0f; + this.frameY += this.frameHeight; + if ((int) this.frameY / (int) this.frameHeight < (int) NPC.npcFrameCount[(int) this.type]) + return; + this.frameY = (short) 0; + } + } + else if ((int) this.type == 72) + { + ++this.frameCounter; + if ((double) this.frameCounter < 3.0) + return; + this.frameCounter = 0.0f; + this.frameY += this.frameHeight; + if ((int) this.frameY / (int) this.frameHeight < (int) NPC.npcFrameCount[(int) this.type]) + return; + this.frameY = (short) 0; + } + else if ((int) this.type == 65 || (int) this.type == 148) + { + this.spriteDirection = this.direction; + ++this.frameCounter; + if (!this.wet) + return; + if ((double) this.frameCounter < 6.0) + this.frameY = (short) 0; + else if ((double) this.frameCounter < 12.0) + this.frameY = this.frameHeight; + else if ((double) this.frameCounter < 18.0) + this.frameY = (short) ((int) this.frameHeight << 1); + else if ((double) this.frameCounter < 24.0) + this.frameY = (short) ((int) this.frameHeight * 3); + else + this.frameCounter = 0.0f; + } + else if ((int) this.type == 48 || (int) this.type == 49 || ((int) this.type == 51 || (int) this.type == 60) || ((int) this.type == 82 || (int) this.type == 93 || (int) this.type == 137)) + { + if ((double) this.velocity.X > 0.0) + this.spriteDirection = (sbyte) 1; + if ((double) this.velocity.X < 0.0) + this.spriteDirection = (sbyte) -1; + this.rotation = this.velocity.X * 0.1f; + ++this.frameCounter; + if ((double) this.frameCounter >= 6.0) + { + this.frameY += this.frameHeight; + this.frameCounter = 0.0f; + } + if ((int) this.frameY < (int) this.frameHeight * 4) + return; + this.frameY = (short) 0; + } + else if ((int) this.type == 42 || (int) this.type == 157) + { + ++this.frameCounter; + if ((double) this.frameCounter < 2.0) + this.frameY = (short) 0; + else if ((double) this.frameCounter < 4.0) + this.frameY = this.frameHeight; + else if ((double) this.frameCounter < 6.0) + this.frameY = (short) ((int) this.frameHeight << 1); + else if ((double) this.frameCounter < 8.0) + this.frameY = this.frameHeight; + else + this.frameCounter = 0.0f; + } + else if ((int) this.type == 43 || (int) this.type == 56 || (int) this.type == 156) + { + ++this.frameCounter; + if ((double) this.frameCounter < 6.0) + this.frameY = (short) 0; + else if ((double) this.frameCounter < 12.0) + this.frameY = this.frameHeight; + else if ((double) this.frameCounter < 18.0) + this.frameY = (short) ((int) this.frameHeight << 1); + else if ((double) this.frameCounter < 24.0) + this.frameY = this.frameHeight; + if ((double) this.frameCounter != 23.0) + return; + this.frameCounter = 0.0f; + } + else if ((int) this.type == 115) + { + ++this.frameCounter; + if ((double) this.frameCounter < 3.0) + this.frameY = (short) 0; + else if ((double) this.frameCounter < 6.0) + this.frameY = this.frameHeight; + else if ((double) this.frameCounter < 12.0) + this.frameY = (short) ((int) this.frameHeight << 1); + else if ((double) this.frameCounter < 15.0) + this.frameY = this.frameHeight; + if ((double) this.frameCounter != 15.0) + return; + this.frameCounter = 0.0f; + } + else if ((int) this.type == 101) + { + ++this.frameCounter; + if ((double) this.frameCounter > 6.0) + { + this.frameY = (short) ((int) this.frameY + ((int) this.frameHeight << 1)); + this.frameCounter = 0.0f; + } + if ((int) this.frameY <= (int) this.frameHeight * 2) + return; + this.frameY = (short) 0; + } + else if ((int) this.type == 17 || (int) this.type == 18 || ((int) this.type == 19 || (int) this.type == 20) || ((int) this.type == 22 || (int) this.type == 142 || ((int) this.type == 38 || (int) this.type == 26)) || ((int) this.type == 27 || (int) this.type == 28 || ((int) this.type == 31 || (int) this.type == 21) || ((int) this.type == 44 || (int) this.type == 54 || ((int) this.type == 37 || (int) this.type == 73))) || ((int) this.type == 77 || (int) this.type == 78 || ((int) this.type == 79 || (int) this.type == 80) || ((int) this.type == 104 || (int) this.type == 107 || ((int) this.type == 108 || (int) this.type == 120)) || ((int) this.type == 154 || (int) this.type == 124 || ((int) this.type == 140 || (int) this.type == 149) || ((int) this.type == 152 || (int) this.type == 155)))) + { + if ((double) this.velocity.Y == 0.0) + { + if ((int) this.direction == 1) + this.spriteDirection = (sbyte) 1; + else if ((int) this.direction == -1) + this.spriteDirection = (sbyte) -1; + if ((double) this.velocity.X == 0.0) + { + this.frameY = (int) this.type != 140 ? (short) 0 : this.frameHeight; + this.frameCounter = 0.0f; + } + else + { + this.frameCounter += Math.Abs(this.velocity.X) * 2f; + if ((double) ++this.frameCounter > 6.0) + { + this.frameY += this.frameHeight; + this.frameCounter = 0.0f; + } + if ((int) this.frameY / (int) this.frameHeight < (int) NPC.npcFrameCount[(int) this.type]) + return; + this.frameY = (short) ((int) this.frameHeight << 1); + } + } + else + { + this.frameCounter = 0.0f; + if ((int) this.type == 21 || (int) this.type == 31 || ((int) this.type == 44 || (int) this.type == 149) || ((int) this.type == 77 || (int) this.type == 78 || ((int) this.type == 79 || (int) this.type == 80)) || ((int) this.type == 120 || (int) this.type == 154 || ((int) this.type == 140 || (int) this.type == 152) || (int) this.type == 155)) + this.frameY = (short) 0; + else + this.frameY = this.frameHeight; + } + } + else if ((int) this.type == 110) + { + if ((double) this.velocity.Y == 0.0) + { + if ((int) this.direction != 0) + this.spriteDirection = this.direction; + if ((double) this.ai2 > 0.0) + { + this.spriteDirection = this.direction; + this.frameY = (short) ((int) this.frameHeight * (int) this.ai2); + this.frameCounter = 0.0f; + } + else + { + if ((int) this.frameY < (int) this.frameHeight * 6) + this.frameY = (short) ((int) this.frameHeight * 6); + this.frameCounter = this.frameCounter + Math.Abs(this.velocity.X) * 2f; + this.frameCounter += this.velocity.X; + if ((double) this.frameCounter > 6.0) + { + this.frameY += this.frameHeight; + this.frameCounter = 0.0f; + } + if ((int) this.frameY / (int) this.frameHeight < (int) NPC.npcFrameCount[(int) this.type]) + return; + this.frameY = (short) ((int) this.frameHeight * 6); + } + } + else + { + this.frameCounter = 0.0f; + this.frameY = (short) 0; + } + } + else if ((int) this.type == 111) + { + if ((double) this.velocity.Y == 0.0) + { + if ((int) this.direction != 0) + this.spriteDirection = this.direction; + if ((double) this.ai2 > 0.0) + { + this.spriteDirection = this.direction; + this.frameY = (short) ((int) this.frameHeight * ((int) this.ai2 - 1)); + this.frameCounter = 0.0f; + } + else + { + if ((int) this.frameY < (int) this.frameHeight * 7) + this.frameY = (short) ((int) this.frameHeight * 7); + this.frameCounter = this.frameCounter + Math.Abs(this.velocity.X) * 2f; + this.frameCounter += this.velocity.X * 1.3f; + if ((double) this.frameCounter > 6.0) + { + this.frameY += this.frameHeight; + this.frameCounter = 0.0f; + } + if ((int) this.frameY / (int) this.frameHeight < (int) NPC.npcFrameCount[(int) this.type]) + return; + this.frameY = (short) ((int) this.frameHeight * 7); + } + } + else + { + this.frameCounter = 0.0f; + this.frameY = (short) ((int) this.frameHeight * 6); + } + } + else if ((int) this.type == 3 || (int) this.type == 52 || ((int) this.type == 53 || (int) this.type == 132)) + { + if ((double) this.velocity.Y == 0.0 && (int) this.direction != 0) + this.spriteDirection = this.direction; + if ((double) this.velocity.Y != 0.0 || (int) this.direction == -1 && (double) this.velocity.X > 0.0 || (int) this.direction == 1 && (double) this.velocity.X < 0.0) + { + this.frameCounter = 0.0f; + this.frameY = (short) ((int) this.frameHeight << 1); + } + else if ((double) this.velocity.X == 0.0) + { + this.frameCounter = 0.0f; + this.frameY = (short) 0; + } + else + { + this.frameCounter = this.frameCounter + Math.Abs(this.velocity.X); + if ((double) this.frameCounter < 8.0) + this.frameY = (short) 0; + else if ((double) this.frameCounter < 16.0) + this.frameY = this.frameHeight; + else if ((double) this.frameCounter < 24.0) + this.frameY = (short) ((int) this.frameHeight << 1); + else if ((double) this.frameCounter < 32.0) + this.frameY = this.frameHeight; + else + this.frameCounter = 0.0f; + } + } + else if ((int) this.type == 46 || (int) this.type == 47) + { + if ((double) this.velocity.Y == 0.0) + { + if ((int) this.direction != 0) + this.spriteDirection = this.direction; + if ((double) this.velocity.X == 0.0) + { + this.frameY = (short) 0; + this.frameCounter = 0.0f; + } + else + { + this.frameCounter = this.frameCounter + Math.Abs(this.velocity.X); + ++this.frameCounter; + if ((double) this.frameCounter > 6.0) + { + this.frameY += this.frameHeight; + this.frameCounter = 0.0f; + } + if ((int) this.frameY / (int) this.frameHeight < (int) NPC.npcFrameCount[(int) this.type]) + return; + this.frameY = (short) 0; + } + } + else if ((double) this.velocity.Y < 0.0) + { + this.frameCounter = 0.0f; + this.frameY = (short) ((int) this.frameHeight << 2); + } + else + { + if ((double) this.velocity.Y <= 0.0) + return; + this.frameCounter = 0.0f; + this.frameY = (short) ((int) this.frameHeight * 6); + } + } + else if ((int) this.type == 4 || (int) this.type == 166 || ((int) this.type == 125 || (int) this.type == 126)) + { + if ((double) ++this.frameCounter < 7.0) + this.frameY = (short) 0; + else if ((double) this.frameCounter < 14.0) + this.frameY = this.frameHeight; + else if ((double) this.frameCounter < 21.0) + { + this.frameY = (short) ((int) this.frameHeight << 1); + } + else + { + this.frameCounter = 0.0f; + this.frameY = (short) 0; + } + if ((double) this.ai0 <= 1.0) + return; + this.frameY = (short) ((int) this.frameY + (int) this.frameHeight * 3); + } + else if ((int) this.type == 5 || (int) this.type == 167) + { + if ((double) ++this.frameCounter >= 8.0) + { + this.frameY += this.frameHeight; + this.frameCounter = 0.0f; + } + if ((int) this.frameY < (int) this.frameHeight * (int) NPC.npcFrameCount[(int) this.type]) + return; + this.frameY = (short) 0; + } + else if ((int) this.type == 94) + { + if ((double) ++this.frameCounter < 6.0) + this.frameY = (short) 0; + else if ((double) this.frameCounter < 12.0) + this.frameY = this.frameHeight; + else if ((double) this.frameCounter < 18.0) + { + this.frameY = (short) ((int) this.frameHeight << 1); + } + else + { + this.frameY = this.frameHeight; + if ((double) this.frameCounter < 23.0) + return; + this.frameCounter = 0.0f; + } + } + else if ((int) this.type == 6) + { + ++this.frameCounter; + if ((double) this.frameCounter >= 8.0) + { + this.frameY += this.frameHeight; + this.frameCounter = 0.0f; + } + if ((int) this.frameY < (int) this.frameHeight * (int) NPC.npcFrameCount[(int) this.type]) + return; + this.frameY = (short) 0; + } + else if ((int) this.type == 24) + { + if ((double) this.velocity.Y == 0.0 && (int) this.direction != 0) + this.spriteDirection = this.direction; + if ((double) this.ai1 > 0.0) + { + if ((int) this.frameY < 4) + this.frameCounter = 0.0f; + ++this.frameCounter; + if ((double) this.frameCounter <= 4.0) + this.frameY = (short) ((int) this.frameHeight << 2); + else if ((double) this.frameCounter <= 8.0) + this.frameY = (short) ((int) this.frameHeight * 5); + else if ((double) this.frameCounter <= 12.0) + this.frameY = (short) ((int) this.frameHeight * 6); + else if ((double) this.frameCounter <= 16.0) + this.frameY = (short) ((int) this.frameHeight * 7); + else if ((double) this.frameCounter <= 20.0) + { + this.frameY = (short) ((int) this.frameHeight << 3); + } + else + { + this.frameY = (short) ((int) this.frameHeight * 9); + this.frameCounter = 100f; + } + } + else + { + ++this.frameCounter; + if ((double) this.frameCounter <= 4.0) + this.frameY = (short) 0; + else if ((double) this.frameCounter <= 8.0) + this.frameY = this.frameHeight; + else if ((double) this.frameCounter <= 12.0) + { + this.frameY = (short) ((int) this.frameHeight << 1); + } + else + { + this.frameY = (short) ((int) this.frameHeight * 3); + if ((double) this.frameCounter < 16.0) + return; + this.frameCounter = 0.0f; + } + } + } + else if ((int) this.type == 29 || (int) this.type == 32 || (int) this.type == 45) + { + if ((double) this.velocity.Y == 0.0 && (int) this.direction != 0) + this.spriteDirection = this.direction; + this.frameY = (short) 0; + if ((double) this.velocity.Y != 0.0) + { + this.frameY += this.frameHeight; + } + else + { + if ((double) this.ai1 <= 0.0) + return; + this.frameY = (short) ((int) this.frameY + ((int) this.frameHeight << 1)); + } + } + else + { + if ((int) this.type != 34 && (int) this.type != 158) + return; + if ((double) ++this.frameCounter >= 4.0) + { + this.frameY += this.frameHeight; + this.frameCounter = 0.0f; + } + if ((int) this.frameY < (int) this.frameHeight * (int) NPC.npcFrameCount[(int) this.type]) + return; + this.frameY = (short) 0; + } + } + + public void TargetClosest(bool faceTarget = true) + { + int num = -1; + this.target = (byte) 0; + for (int index = 0; index < 8; ++index) + { + if ((int) Main.player[index].active != 0 && !Main.player[index].dead && (num == -1 || Math.Abs(Main.player[index].aabb.X + 10 - this.aabb.X + ((int) this.width >> 1)) + Math.Abs(Main.player[index].aabb.Y + 21 - this.aabb.Y + ((int) this.height >> 1)) < num)) + { + num = Math.Abs(Main.player[index].aabb.X + 10 - this.aabb.X + ((int) this.width >> 1)) + Math.Abs(Main.player[index].aabb.Y + 21 - this.aabb.Y + ((int) this.height >> 1)); + this.target = (byte) index; + } + } + this.targetRect = Main.player[(int) this.target].aabb; + if (Main.player[(int) this.target].dead) + faceTarget = false; + else if (faceTarget) + { + this.direction = (sbyte) 1; + if (this.targetRect.X + (this.targetRect.Width >> 1) < this.aabb.X + ((int) this.width >> 1)) + this.direction = (sbyte) -1; + this.directionY = (sbyte) 1; + if (this.targetRect.Y + (this.targetRect.Height >> 1) < this.aabb.Y + ((int) this.height >> 1)) + this.directionY = (sbyte) -1; + } + if (this.confused) + this.direction = -this.direction; + if ((int) this.direction == (int) this.oldDirection && (int) this.directionY == (int) this.oldDirectionY && (int) this.target == (int) this.oldTarget || (this.collideX || this.collideY)) + return; + this.netUpdate = true; + } + + public void CheckActive() + { + if ((int) this.active == 0 || (int) this.type == 8 || ((int) this.type == 9 || (int) this.type == 11) || ((int) this.type == 12 || (int) this.type == 14 || ((int) this.type == 15 || (int) this.type == 40)) || ((int) this.type == 41 || (int) this.type == 96 || ((int) this.type == 97 || (int) this.type == 99) || ((int) this.type == 100 || (int) this.type > 87 && (int) this.type <= 92)) || ((int) this.type > 159 && (int) this.type <= 164 || ((int) this.type == 118 || (int) this.type == 119) || ((int) this.type == 113 || (int) this.type == 114 || (int) this.type == 115) || (int) this.type >= 134 && (int) this.type <= 136)) + return; + if (this.townNPC) + { + Rectangle rectangle = new Rectangle(this.aabb.X + ((int) this.width >> 1) - 1920, this.aabb.Y + ((int) this.height >> 1) - 1080, 3840, 2160); + for (int index = 0; index < 8; ++index) + { + if ((int) Main.player[index].active != 0 && rectangle.Intersects(Main.player[index].aabb)) + Main.player[index].townNPCs += this.npcSlots; + } + } + else + { + bool flag = false; + Rectangle rectangle1 = new Rectangle(this.aabb.X + ((int) this.width >> 1) - 3264, this.aabb.Y + ((int) this.height >> 1) - 1836, 6528, 3672); + Rectangle rectangle2 = new Rectangle(this.aabb.X + ((int) this.width >> 1) - 960 - (int) this.width, this.aabb.Y + ((int) this.height >> 1) - 540 - (int) this.height, 1920 + (int) this.width * 2, 1080 + (int) this.height * 2); + for (int index = 0; index < 8; ++index) + { + if ((int) Main.player[index].active != 0) + { + if (rectangle1.Intersects(Main.player[index].aabb)) + { + flag = true; + if ((int) this.type != 25 && (int) this.type != 30 && ((int) this.type != 33 && this.lifeMax > 0)) + Main.player[index].activeNPCs += this.npcSlots; + } + else if (this.boss || (int) this.type == 7 || ((int) this.type == 10 || (int) this.type == 13) || ((int) this.type == 39 || (int) this.type == 87 || ((int) this.type == 159 || (int) this.type == 35)) || ((int) this.type == 36 || (int) this.type >= (int) sbyte.MaxValue && (int) this.type <= 131)) + flag = true; + if (rectangle2.Intersects(Main.player[index].aabb)) + this.timeLeft = 750; + } + } + if (--this.timeLeft <= 0) + flag = false; + if (flag || Main.netMode == 1) + return; + NPC.noSpawnCycle = true; + this.active = (byte) 0; + this.netSkip = (short) -1; + this.life = 0; + NetMessage.CreateMessage1(23, (int) this.whoAmI); + NetMessage.SendMessage(); + if ((int) this.aiStyle != 6) + return; + for (int number = (int) this.ai0; number > 0; number = (int) Main.npc[number].ai0) + { + if ((int) Main.npc[number].active != 0) + { + Main.npc[number].active = (byte) 0; + Main.npc[number].life = 0; + Main.npc[number].netSkip = (short) -1; + NetMessage.CreateMessage1(23, number); + NetMessage.SendMessage(); + } + } + } + } + + public static void SpawnNPC() + { + if (NPC.noSpawnCycle) + { + NPC.noSpawnCycle = false; + } + else + { + bool flag1 = false; + bool flag2 = false; + int x = 0; + int y = 0; + int num1 = 0; + for (int index = 0; index < 8; ++index) + { + if ((int) Main.player[index].active != 0) + ++num1; + } + for (int index1 = 0; index1 < 8; ++index1) + { + if ((int) Main.player[index1].active != 0 && !Main.player[index1].dead) + { + bool flag3 = false; + bool flag4 = false; + bool flag5 = false; + if (Main.invasionType > 0 && Main.invasionDelay == 0 && (Main.invasionSize > 0 && (double) Main.player[index1].position.Y < (double) (Main.worldSurfacePixels + 1080))) + { + int num2 = 3000; + if ((double) Main.player[index1].position.X > (double) Main.invasionX * 16.0 - (double) num2 && (double) Main.player[index1].position.X < (double) Main.invasionX * 16.0 + (double) num2) + flag4 = true; + } + bool flag6 = false; + NPC.spawnRate = 600; + NPC.maxSpawns = 5; + if (Main.hardMode) + { + NPC.spawnRate = 540; + NPC.maxSpawns = 6; + } + if ((double) Main.player[index1].position.Y > (double) (((int) Main.maxTilesY - 200) * 16)) + NPC.maxSpawns *= 2; + else if ((double) Main.player[index1].position.Y > (double) ((Main.rockLayer << 4) + 1080)) + { + NPC.spawnRate = (int) ((double) NPC.spawnRate * 0.4); + NPC.maxSpawns = (int) ((double) NPC.maxSpawns * 1.9); + } + else if ((double) Main.player[index1].position.Y > (double) ((Main.worldSurface << 4) + 1080)) + { + if (Main.hardMode) + { + NPC.spawnRate = (int) ((double) NPC.spawnRate * 0.45); + NPC.maxSpawns = (int) ((double) NPC.maxSpawns * 1.8); + } + else + { + NPC.spawnRate >>= 1; + NPC.maxSpawns = (int) ((double) NPC.maxSpawns * 1.7); + } + } + else if (!Main.gameTime.dayTime) + { + NPC.spawnRate = (int) ((double) NPC.spawnRate * 0.6); + NPC.maxSpawns = (int) ((double) NPC.maxSpawns * 1.3); + if (Main.gameTime.bloodMoon) + { + NPC.spawnRate = (int) ((double) NPC.spawnRate * 0.3); + NPC.maxSpawns = (int) ((double) NPC.maxSpawns * 1.8); + } + } + if (Main.player[index1].zoneDungeon) + { + NPC.spawnRate = (int) ((double) NPC.spawnRate * 0.4); + NPC.maxSpawns = (int) ((double) NPC.maxSpawns * 1.70000004768372); + } + else if (Main.player[index1].zoneJungle) + { + NPC.spawnRate = (int) ((double) NPC.spawnRate * 0.4); + NPC.maxSpawns = (int) ((double) NPC.maxSpawns * 1.5); + } + else if (Main.player[index1].zoneEvil) + { + NPC.spawnRate = (int) ((double) NPC.spawnRate * 0.65); + NPC.maxSpawns = (int) ((double) NPC.maxSpawns * 1.29999995231628); + } + else if (Main.player[index1].zoneMeteor) + { + NPC.spawnRate = (int) ((double) NPC.spawnRate * 0.4); + NPC.maxSpawns = (int) ((double) NPC.maxSpawns * 1.10000002384186); + } + if (Main.player[index1].zoneHoly && (double) Main.player[index1].position.Y > (double) ((Main.rockLayer << 4) + 1080)) + { + NPC.spawnRate = (int) ((double) NPC.spawnRate * 0.65); + NPC.maxSpawns = (int) ((double) NPC.maxSpawns * 1.29999995231628); + } + if (NPC.wof >= 0 && (double) Main.player[index1].position.Y > (double) (((int) Main.maxTilesY - 200) * 16)) + { + NPC.maxSpawns = (int) ((double) NPC.maxSpawns * 0.300000011920929); + NPC.spawnRate *= 3; + } + if ((double) Main.player[index1].activeNPCs < (double) (int) ((double) NPC.maxSpawns * 0.2)) + NPC.spawnRate = (int) ((double) NPC.spawnRate * 0.600000023841858); + else if ((double) Main.player[index1].activeNPCs < (double) (int) ((double) NPC.maxSpawns * 0.4)) + NPC.spawnRate = (int) ((double) NPC.spawnRate * 0.699999988079071); + else if ((double) Main.player[index1].activeNPCs < (double) (int) ((double) NPC.maxSpawns * 0.6)) + NPC.spawnRate = (int) ((double) NPC.spawnRate * 0.800000011920929); + else if ((double) Main.player[index1].activeNPCs < (double) (int) ((double) NPC.maxSpawns * 0.8)) + NPC.spawnRate = (int) ((double) NPC.spawnRate * 0.899999976158142); + if ((double) Main.player[index1].position.Y * 16.0 > (double) (Main.worldSurface + Main.rockLayer >> 1) || Main.player[index1].zoneEvil) + { + if ((double) Main.player[index1].activeNPCs < (double) NPC.maxSpawns * 0.2) + NPC.spawnRate = (int) ((double) NPC.spawnRate * 0.699999988079071); + else if ((double) Main.player[index1].activeNPCs < (double) NPC.maxSpawns * 0.4) + NPC.spawnRate = (int) ((double) NPC.spawnRate * 0.899999976158142); + } + if ((int) Main.player[index1].inventory[(int) Main.player[index1].selectedItem].type == 148) + { + NPC.spawnRate = (int) ((double) NPC.spawnRate * 0.75); + NPC.maxSpawns = (int) ((double) NPC.maxSpawns * 1.5); + } + if (Main.player[index1].enemySpawns) + { + NPC.spawnRate = (int) ((double) NPC.spawnRate * 0.5); + NPC.maxSpawns = (int) ((double) NPC.maxSpawns * 2.0); + } + if ((double) NPC.spawnRate < 60.0) + NPC.spawnRate = 60; + if (NPC.maxSpawns > 15) + NPC.maxSpawns = 15; + if (flag4) + { + NPC.maxSpawns = (int) (5.0 * (2.0 + 0.3 * (double) num1)); + NPC.spawnRate = 20; + } + if (Main.player[index1].zoneDungeon && !NPC.downedBoss3) + NPC.spawnRate = 10; + bool flag7 = false; + if (!flag4 && (!Main.gameTime.bloodMoon || Main.gameTime.dayTime) && (!Main.player[index1].zoneDungeon && !Main.player[index1].zoneEvil && !Main.player[index1].zoneMeteor)) + { + if ((double) Main.player[index1].townNPCs == 1.0) + { + flag3 = true; + if (Main.rand.Next(3) <= 1) + { + flag7 = true; + NPC.maxSpawns = (int) ((double) NPC.maxSpawns * 0.6); + } + else + NPC.spawnRate = (int) ((double) NPC.spawnRate * 2.0); + } + else if ((double) Main.player[index1].townNPCs == 2.0) + { + flag3 = true; + if (Main.rand.Next(3) == 0) + { + flag7 = true; + NPC.maxSpawns = (int) ((double) NPC.maxSpawns * 0.6); + } + else + NPC.spawnRate = (int) ((double) NPC.spawnRate * 3.0); + } + else if ((double) Main.player[index1].townNPCs >= 3.0) + { + flag3 = true; + flag7 = true; + NPC.maxSpawns = (int) ((double) NPC.maxSpawns * 0.6); + } + } + if ((double) Main.player[index1].activeNPCs < (double) NPC.maxSpawns && Main.rand.Next(NPC.spawnRate) == 0) + { + int num2 = Main.player[index1].aabb.X >> 4; + int num3 = Main.player[index1].aabb.Y >> 4; + int lowerBound1 = num2 - 84; + int upperBound1 = num2 + 84; + int lowerBound2 = num3 - 46; + int upperBound2 = num3 + 46; + int num4 = num2 - 62; + int num5 = num2 + 62; + int num6 = num3 - 34; + int num7 = num3 + 34; + if (lowerBound1 < 0) + lowerBound1 = 0; + else if (upperBound1 > (int) Main.maxTilesX) + upperBound1 = (int) Main.maxTilesX; + if (lowerBound2 < 0) + lowerBound2 = 0; + else if (upperBound2 > (int) Main.maxTilesY) + upperBound2 = (int) Main.maxTilesY; + for (int index2 = 0; index2 < 48; ++index2) + { + int index3 = Main.rand.Next(lowerBound1, upperBound1); + int index4 = Main.rand.Next(lowerBound2, upperBound2); + if (((int) Main.tile[index3, index4].active == 0 || !Main.tileSolid[(int) Main.tile[index3, index4].type]) && !Main.wallHouse[(int) Main.tile[index3, index4].wall]) + { + if (!flag4 && !flag7 && (index4 < (int) ((double) Main.worldSurface * 0.349999994039536) && (index3 < (int) ((double) Main.maxTilesX * 0.45) || index3 > (int) ((double) Main.maxTilesX * 0.55) || Main.hardMode) || index4 < (int) ((double) Main.worldSurface * 0.449999988079071) && Main.hardMode && Main.rand.Next(10) == 0)) + { + int num8 = (int) Main.tile[index3, index4].type; + x = index3; + y = index4; + flag6 = true; + flag2 = true; + } + if (!flag6) + { + for (int index5 = index4; index5 < (int) Main.maxTilesY; ++index5) + { + if ((int) Main.tile[index3, index5].active != 0 && Main.tileSolid[(int) Main.tile[index3, index5].type]) + { + if (index3 < num4 || index3 > num5 || (index5 < num6 || index5 > num7)) + { + int num8 = (int) Main.tile[index3, index5].type; + x = index3; + y = index5; + flag6 = true; + break; + } + else + break; + } + } + } + if (flag6) + { + int num8 = x - 1; + int num9 = x + 1; + int num10 = y - 3; + int num11 = y; + if (num8 < 0 || num9 > (int) Main.maxTilesX || (num10 < 0 || num11 > (int) Main.maxTilesY)) + { + flag6 = false; + } + else + { + for (int index5 = num8; index5 < num9; ++index5) + { + for (int index6 = num10; index6 < num11; ++index6) + { + if ((int) Main.tile[index5, index6].active != 0 && Main.tileSolid[(int) Main.tile[index5, index6].type]) + { + flag6 = false; + break; + } + else if ((int) Main.tile[index5, index6].lava != 0) + { + flag6 = false; + break; + } + } + if (!flag6) + break; + } + } + if (flag6) + break; + } + } + } + } + if (flag6) + { + Rectangle rectangle1 = new Rectangle(x * 16, y * 16, 16, 16); + for (int index2 = 0; index2 < 8; ++index2) + { + if ((int) Main.player[index2].active != 0) + { + Rectangle rectangle2 = new Rectangle(Main.player[index2].aabb.X + 10 - 960 - 62, Main.player[index2].aabb.Y + 21 - 540 - 34, 2044, 1148); + if (rectangle1.Intersects(rectangle2)) + { + flag6 = false; + break; + } + } + } + } + if (flag6) + { + if (Main.player[index1].zoneDungeon && (!Main.tileDungeon[(int) Main.tile[x, y].type] || (int) Main.tile[x, y - 1].wall == 0)) + flag6 = false; + if ((int) Main.tile[x, y - 1].liquid > 0 && (int) Main.tile[x, y - 2].liquid > 0 && (int) Main.tile[x, y - 1].lava == 0) + flag5 = true; + } + if (flag6) + { + flag1 = false; + int num2 = (int) Main.tile[x, y].type; + int number = 196; + int X = (x << 4) + 8; + int Y = y << 4; + if (flag2) + { + if (Main.hardMode && Main.rand.Next(10) == 0 && !NPC.AnyNPCs(87, 159)) + { + int Type = Main.rand.Next(2) == 0 ? 87 : 159; + NPC.NewNPC(X, Y, Type, 1); + } + else + NPC.NewNPC(X, Y, 48, 0); + } + else if (flag4) + { + if (Main.invasionType == 1) + { + if (Main.rand.Next(9) == 0) + NPC.NewNPC(X, Y, 29, 0); + else if (Main.rand.Next(5) == 0) + NPC.NewNPC(X, Y, 26, 0); + else if (Main.rand.Next(3) == 0) + NPC.NewNPC(X, Y, 111, 0); + else if (Main.rand.Next(3) == 0) + NPC.NewNPC(X, Y, 27, 0); + else + NPC.NewNPC(X, Y, 28, 0); + } + else if (Main.invasionType == 2) + { + if (Main.rand.Next(7) == 0) + NPC.NewNPC(X, Y, 145, 0); + else if (Main.rand.Next(3) == 0) + NPC.NewNPC(X, Y, 143, 0); + else + NPC.NewNPC(X, Y, 144, 0); + } + } + else if (flag5 && (x < 250 || x > (int) Main.maxTilesX - 250) && (num2 == 53 && y < Main.rockLayer)) + { + int Type; + switch (Main.rand.Next(16)) + { + case 0: + Type = 65; + break; + case 1: + Type = 148; + break; + case 2: + case 3: + case 4: + case 5: + case 6: + Type = 67; + break; + default: + Type = 64; + break; + } + NPC.NewNPC(X, Y, Type, 0); + } + else if (flag5 && (y > Main.rockLayer && Main.rand.Next(2) == 0 || num2 == 60)) + { + if (Main.hardMode && Main.rand.Next(3) > 0) + NPC.NewNPC(X, Y, 102, 0); + else + NPC.NewNPC(X, Y, 58, 0); + } + else if (flag5 && y > Main.worldSurface && Main.rand.Next(3) == 0) + { + if (Main.hardMode) + NPC.NewNPC(X, Y, 103, 0); + else + NPC.NewNPC(X, Y, 63, 0); + } + else if (flag5 && Main.rand.Next(4) == 0) + { + if (Main.player[index1].zoneEvil) + NPC.NewNPC(X, Y, 57, 0); + else + NPC.NewNPC(X, Y, 55, 0); + } + else if (NPC.downedGoblins && Main.rand.Next(20) == 0 && (!flag5 && y >= Main.rockLayer) && (y < (int) Main.maxTilesY - 210 && !NPC.savedGoblin && !NPC.AnyNPCs(105))) + NPC.NewNPC(X, Y, 105, 0); + else if (Main.hardMode && Main.rand.Next(20) == 0 && (!flag5 && y >= Main.rockLayer) && (y < (int) Main.maxTilesY - 210 && !NPC.savedWizard && !NPC.AnyNPCs(106))) + NPC.NewNPC(X, Y, 106, 0); + else if (flag7) + { + if (flag5) + { + NPC.NewNPC(X, Y, 55, 0); + } + else + { + if (num2 != 2 && num2 != 109 && (num2 != 147 && y <= Main.worldSurface)) + break; + if (Main.rand.Next(2) == 0 && y <= Main.worldSurface) + NPC.NewNPC(X, Y, 74, 0); + else + NPC.NewNPC(X, Y, 46, 0); + } + } + else if (Main.player[index1].zoneDungeon) + { + if (!NPC.downedBoss3) + number = NPC.NewNPC(X, Y, 68, 0); + else if (!NPC.savedMech && !flag5 && (Main.rand.Next(5) == 0 && y > Main.rockLayer) && !NPC.AnyNPCs(123)) + NPC.NewNPC(X, Y, 123, 0); + else if (Main.rand.Next(37) == 0) + number = NPC.NewNPC(X, Y, 71, 0); + else if (Main.rand.Next(4) == 0 && !NPC.NearSpikeBall(x, y)) + number = NPC.NewNPC(X, Y, 70, 0); + else if (Main.rand.Next(15) == 0) + number = NPC.NewNPC(X, Y, 72, 0); + else if (Main.rand.Next(9) == 0) + number = NPC.NewNPC(X, Y, Main.rand.Next(2) == 0 ? 34 : 158, 0); + else if (Main.rand.Next(7) == 0) + { + number = NPC.NewNPC(X, Y, 32, 0); + } + else + { + number = NPC.NewNPC(X, Y, 31, 0); + if (Main.rand.Next(4) == 0) + Main.npc[number].SetDefaults("Big Boned"); + else if (Main.rand.Next(5) == 0) + Main.npc[number].SetDefaults("Short Bones"); + } + } + else if (Main.player[index1].zoneMeteor) + number = NPC.NewNPC(X, Y, 23, 0); + else if (Main.player[index1].zoneEvil && Main.rand.Next(65) == 0) + number = !Main.hardMode || Main.rand.Next(4) == 0 ? NPC.NewNPC(X, Y, 7, 1) : NPC.NewNPC(X, Y, 98, 1); + else if (Main.hardMode && y > Main.worldSurface && Main.rand.Next(75) == 0) + number = NPC.NewNPC(X, Y, 85, 0); + else if (Main.hardMode && (int) Main.tile[x, y - 1].wall == 2 && Main.rand.Next(20) == 0) + number = NPC.NewNPC(X, Y, 85, 0); + else if (Main.hardMode && y <= Main.worldSurface && !Main.gameTime.dayTime && (Main.rand.Next(20) == 0 || Main.rand.Next(5) == 0 && (int) Main.gameTime.moonPhase == 4)) + number = NPC.NewNPC(X, Y, 82, 0); + else if (num2 == 60 && Main.rand.Next(500) == 0 && !Main.gameTime.dayTime) + number = NPC.NewNPC(X, Y, 52, 0); + else if (num2 == 60 && y > Main.worldSurface + Main.rockLayer >> 1) + { + if (Main.rand.Next(3) == 0) + { + number = NPC.NewNPC(X, Y, 43, 0); + Main.npc[number].ai0 = (float) x; + Main.npc[number].ai1 = (float) y; + Main.npc[number].netUpdate = true; + } + else if (Main.rand.Next(2) == 0) + { + number = NPC.NewNPC(X, Y, 42, 0); + switch (Main.rand.Next(8)) + { + case 0: + case 1: + Main.npc[number].SetDefaults("Little Stinger"); + break; + case 2: + Main.npc[number].SetDefaults("Big Stinger"); + break; + } + } + else + number = NPC.NewNPC(X, Y, 157, 0); + } + else if (num2 == 60 && Main.rand.Next(4) == 0) + number = NPC.NewNPC(X, Y, 51, 0); + else if (num2 == 60 && Main.rand.Next(8) == 0) + { + number = NPC.NewNPC(X, Y, Main.rand.Next(2) == 0 ? 56 : 156, 0); + Main.npc[number].ai0 = (float) x; + Main.npc[number].ai1 = (float) y; + Main.npc[number].netUpdate = true; + } + else if (Main.hardMode && num2 == 53 && Main.rand.Next(3) == 0) + number = NPC.NewNPC(X, Y, 78, 0); + else if (Main.hardMode && num2 == 112 && Main.rand.Next(2) == 0) + number = NPC.NewNPC(X, Y, Main.rand.Next(2) == 0 ? 79 : 152, 0); + else if (Main.hardMode && num2 == 116 && Main.rand.Next(2) == 0) + number = NPC.NewNPC(X, Y, Main.rand.Next(2) == 0 ? 80 : 155, 0); + else if (Main.hardMode && !flag5 && y < Main.rockLayer && (num2 == 116 || num2 == 117 || num2 == 109)) + number = Main.gameTime.dayTime || Main.rand.Next(2) != 0 ? (Main.rand.Next(10) != 0 ? NPC.NewNPC(X, Y, 75, 0) : NPC.NewNPC(X, Y, 86, 0)) : NPC.NewNPC(X, Y, Main.rand.Next(2) == 0 ? 122 : 153, 0); + else if (!flag3 && Main.hardMode && (Main.rand.Next(50) == 0 && !flag5) && y >= Main.rockLayer && (num2 == 116 || num2 == 117 || num2 == 109)) + number = NPC.NewNPC(X, Y, 84, 0); + else if (num2 == 22 && Main.player[index1].zoneEvil || (num2 == 23 || num2 == 25) || num2 == 112) + { + if (Main.hardMode && y >= Main.rockLayer && Main.rand.Next(3) == 0) + { + number = NPC.NewNPC(X, Y, 101, 0); + Main.npc[number].ai0 = (float) x; + Main.npc[number].ai1 = (float) y; + Main.npc[number].netUpdate = true; + } + else if (Main.hardMode && Main.rand.Next(3) == 0) + { + int Type; + switch (Main.rand.Next(3)) + { + case 0: + Type = 150; + break; + case 1: + Type = 81; + break; + default: + Type = 121; + break; + } + number = NPC.NewNPC(X, Y, Type, 0); + } + else if (Main.hardMode && y >= Main.rockLayer && Main.rand.Next(40) == 0) + number = Main.rand.Next(2) != 0 ? NPC.NewNPC(X, Y, 151, 0) : NPC.NewNPC(X, Y, 83, 0); + else if (Main.hardMode && (Main.rand.Next(2) == 0 || y > Main.rockLayer)) + { + number = NPC.NewNPC(X, Y, 94, 0); + } + else + { + number = NPC.NewNPC(X, Y, 6, 0); + if (Main.rand.Next(3) == 0) + Main.npc[number].SetDefaults("Little Eater"); + else if (Main.rand.Next(3) == 0) + Main.npc[number].SetDefaults("Big Eater"); + } + } + else if (y <= Main.worldSurface) + { + if (Main.gameTime.dayTime) + { + int num3 = Math.Abs(x - (int) Main.spawnTileX); + if (num3 < (int) Main.maxTilesX / 3 && Main.rand.Next(15) == 0 && (num2 == 2 || num2 == 109 || num2 == 147)) + NPC.NewNPC(X, Y, 46, 0); + else if (num3 < (int) Main.maxTilesX / 3 && Main.rand.Next(15) == 0 && (num2 == 2 || num2 == 109 || num2 == 147)) + NPC.NewNPC(X, Y, 74, 0); + else if (num3 > (int) Main.maxTilesX / 3 && num2 == 2 && (Main.rand.Next(300) == 0 && !NPC.AnyNPCs(50))) + number = NPC.NewNPC(X, Y, 50, 0); + else if (num2 == 53 && Main.rand.Next(5) == 0 && !flag5) + number = NPC.NewNPC(X, Y, Main.rand.Next(2) == 0 ? 69 : 147, 0); + else if (num2 == 53 && !flag5) + number = NPC.NewNPC(X, Y, 61, 0); + else if (num3 > (int) Main.maxTilesX / 3 && Main.rand.Next(15) == 0) + { + number = NPC.NewNPC(X, Y, 73, 0); + } + else + { + number = NPC.NewNPC(X, Y, 1, 0); + if (num2 == 60) + Main.npc[number].SetDefaults("Jungle Slime"); + else if (Main.rand.Next(3) == 0 || num3 < 200) + Main.npc[number].SetDefaults("Green Slime"); + else if (Main.rand.Next(10) == 0 && num3 > 400) + Main.npc[number].SetDefaults("Purple Slime"); + } + } + else if (Main.rand.Next(6) == 0 || (int) Main.gameTime.moonPhase == 4 && Main.rand.Next(2) == 0) + number = !Main.hardMode || Main.rand.Next(3) != 0 ? NPC.NewNPC(X, Y, 2, 0) : NPC.NewNPC(X, Y, 133, 0); + else if (Main.hardMode && Main.rand.Next(50) == 0 && (Main.gameTime.bloodMoon && !NPC.AnyNPCs(109))) + NPC.NewNPC(X, Y, 109, 0); + else if (Main.rand.Next(250) == 0 && Main.gameTime.bloodMoon) + NPC.NewNPC(X, Y, 53, 0); + else if ((int) Main.gameTime.moonPhase == 0 && Main.hardMode && Main.rand.Next(3) != 0) + NPC.NewNPC(X, Y, 104, 0); + else if (Main.hardMode && Main.rand.Next(3) == 0) + NPC.NewNPC(X, Y, 140, 0); + else if (Main.rand.Next(3) == 0) + NPC.NewNPC(X, Y, 132, 0); + else + NPC.NewNPC(X, Y, 3, 0); + } + else if (y <= Main.rockLayer) + { + if (!flag3 && Main.rand.Next(50) == 0) + number = !Main.hardMode ? NPC.NewNPC(X, Y, 10, 1) : NPC.NewNPC(X, Y, 95, 1); + else if (Main.hardMode && Main.rand.Next(3) == 0) + number = NPC.NewNPC(X, Y, 140, 0); + else if (Main.hardMode && Main.rand.Next(4) != 0) + { + number = NPC.NewNPC(X, Y, 141, 0); + } + else + { + number = NPC.NewNPC(X, Y, 1, 0); + if (Main.rand.Next(5) == 0) + Main.npc[number].SetDefaults("Yellow Slime"); + else if (Main.rand.Next(2) == 0) + Main.npc[number].SetDefaults("Red Slime"); + } + } + else if (y > (int) Main.maxTilesY - 190) + { + int Type = 60; + int Start = 0; + if (Main.rand.Next(40) == 0 && !NPC.AnyNPCs(39)) + { + Type = 39; + Start = 1; + } + else if (Main.rand.Next(14) == 0) + Type = 24; + else if (Main.rand.Next(8) == 0) + { + switch (Main.rand.Next(7)) + { + case 0: + Type = 66; + break; + case 1: + case 2: + case 3: + Type = 62; + break; + default: + Type = 165; + break; + } + } + else if (Main.rand.Next(3) == 0) + Type = 59; + number = NPC.NewNPC(X, Y, Type, Start); + } + else if ((num2 == 116 || num2 == 117) && (!flag3 && Main.rand.Next(8) == 0)) + number = NPC.NewNPC(X, Y, Main.rand.Next(2) == 0 ? 120 : 154, 0); + else if (!flag3 && Main.rand.Next(75) == 0 && !Main.player[index1].zoneHoly) + number = NPC.NewNPC(X, Y, Main.hardMode ? 95 : 10, 1); + else if (!Main.hardMode && Main.rand.Next(10) == 0) + number = NPC.NewNPC(X, Y, 16, 0); + else if (!Main.hardMode && Main.rand.Next(4) == 0) + { + number = NPC.NewNPC(X, Y, 1, 0); + if (Main.player[index1].zoneJungle) + Main.npc[number].SetDefaults("Jungle Slime"); + else + Main.npc[number].SetDefaults("Black Slime"); + } + else if (Main.rand.Next(2) == 0) + { + if (y > Main.rockLayer + (int) Main.maxTilesY >> 1 && Main.rand.Next(700) == 0) + number = NPC.NewNPC(X, Y, 45, 0); + else if (Main.hardMode && Main.rand.Next(10) != 0) + { + if (Main.rand.Next(2) == 0) + { + number = NPC.NewNPC(X, Y, 77, 0); + if (y > Main.rockLayer + (int) Main.maxTilesY >> 1 && Main.rand.Next(5) == 0) + Main.npc[number].SetDefaults("Heavy Skeleton"); + } + else + number = NPC.NewNPC(X, Y, 110, 0); + } + else if (Main.rand.Next(15) == 0) + { + int Type = Main.rand.Next(2) == 0 ? 44 : 149; + number = NPC.NewNPC(X, Y, Type, 0); + } + else + number = NPC.NewNPC(X, Y, 21, 0); + } + else + number = !Main.hardMode || !(Main.player[index1].zoneHoly & Main.rand.Next(2) == 0) ? (!Main.player[index1].zoneJungle ? (!Main.hardMode || !Main.player[index1].zoneHoly ? (!Main.hardMode || Main.rand.Next(6) <= 0 ? NPC.NewNPC(X, Y, 49, 0) : NPC.NewNPC(X, Y, 93, 0)) : NPC.NewNPC(X, Y, 137, 0)) : NPC.NewNPC(X, Y, 51, 0)) : NPC.NewNPC(X, Y, 138, 0); + if (number >= 196) + break; + if ((int) Main.npc[number].type == 1 && Main.rand.Next(250) == 0) + Main.npc[number].SetDefaults("Pinky"); + NetMessage.CreateMessage1(23, number); + NetMessage.SendMessage(); + break; + } + } + } + } + } + + public static bool SpawnWOF(ref Vector2 pos, bool force = false) + { + if (!force && (int) pos.Y >> 4 < (int) Main.maxTilesY - 205 || (NPC.wof >= 0 || Main.netMode == 1)) + return false; + int num1 = -16; + int X = (int) pos.X; + if (X >> 4 > (int) Main.maxTilesX >> 1) + num1 = 16; + bool flag; + do + { + flag = true; + for (int index = 0; index < 8; ++index) + { + if ((int) Main.player[index].active != 0 && Main.player[index].aabb.X > X - 1200 && Main.player[index].aabb.X < X + 1200) + { + X += num1; + flag = false; + break; + } + } + if (num1 < 0 && X >> 4 < 42 || num1 > 0 && X >> 4 > (int) Main.maxTilesX - 34) + flag = true; + } + while (!flag); + int num2 = (int) pos.Y; + int i = X >> 4; + int num3 = num2 >> 4; + int num4 = 0; + try + { + for (; WorldGen.SolidTile(i, num3 - num4) || (int) Main.tile[i, num3 - num4].liquid >= 100; ++num4) + { + if (!WorldGen.SolidTile(i, num3 + num4) && (int) Main.tile[i, num3 + num4].liquid < 100) + { + num3 += num4; + goto label_19; + } + } + num3 -= num4; + } + catch + { + } +label_19: + int Y = num3 << 4; + int index1 = NPC.NewNPC(X, Y, 113, 0); + Main.npc[index1].direction = num1 < 0 ? (sbyte) 1 : (sbyte) -1; + if (Main.npc[index1].displayName.Length == 0) + Main.npc[index1].displayName = Main.npc[index1].name; + NetMessage.SendText(Main.npc[index1].displayName, 16, 175, 75, (int) byte.MaxValue, -1); + return true; + } + + public static void SpawnOnPlayer(Player p, int Type) + { + if (Main.netMode == 1) + return; + bool flag = false; + int num1 = 0; + int num2 = 0; + int lowerBound1 = (p.aabb.X >> 4) - 168; + int upperBound1 = (p.aabb.X >> 4) + 168; + int lowerBound2 = (p.aabb.Y >> 4) - 92; + int upperBound2 = (p.aabb.Y >> 4) + 92; + int num3 = (p.aabb.X >> 4) - 62; + int num4 = (p.aabb.X >> 4) + 62; + int num5 = (p.aabb.Y >> 4) - 34; + int num6 = (p.aabb.Y >> 4) + 34; + if (lowerBound1 < 0) + lowerBound1 = 0; + if (upperBound1 > (int) Main.maxTilesX) + upperBound1 = (int) Main.maxTilesX; + if (lowerBound2 < 0) + lowerBound2 = 0; + if (upperBound2 > (int) Main.maxTilesY) + upperBound2 = (int) Main.maxTilesY; + for (int index1 = 0; index1 < 1000; ++index1) + { + for (int index2 = 0; index2 < 100; ++index2) + { + int index3 = Main.rand.Next(lowerBound1, upperBound1); + int index4 = Main.rand.Next(lowerBound2, upperBound2); + if ((int) Main.tile[index3, index4].active == 0 || !Main.tileSolid[(int) Main.tile[index3, index4].type]) + { + if (!Main.wallHouse[(int) Main.tile[index3, index4].wall] || index1 >= 999) + { + for (int index5 = index4; index5 < (int) Main.maxTilesY; ++index5) + { + if ((int) Main.tile[index3, index5].active != 0 && Main.tileSolid[(int) Main.tile[index3, index5].type]) + { + if (index3 < num3 || index3 > num4 || (index5 < num5 || index5 > num6) || index1 == 999) + { + int num7 = (int) Main.tile[index3, index5].type; + num1 = index3; + num2 = index5; + flag = true; + break; + } + else + break; + } + } + if (flag && index1 < 999) + { + int num7 = num1 - 1; + int num8 = num1 + 1; + int num9 = num2 - 3; + int num10 = num2; + if (num7 < 0) + flag = false; + if (num8 > (int) Main.maxTilesX) + flag = false; + if (num9 < 0) + flag = false; + if (num10 > (int) Main.maxTilesY) + flag = false; + if (flag) + { + for (int index5 = num7; index5 < num8; ++index5) + { + for (int index6 = num9; index6 < num10; ++index6) + { + if ((int) Main.tile[index5, index6].active != 0 && Main.tileSolid[(int) Main.tile[index5, index6].type]) + { + flag = false; + break; + } + } + } + } + } + } + else + continue; + } + if (flag || flag) + break; + } + if (flag && index1 < 999) + { + Rectangle rectangle1 = new Rectangle(num1 * 16, num2 * 16, 16, 16); + for (int index2 = 0; index2 < 8; ++index2) + { + if ((int) Main.player[index2].active != 0) + { + Rectangle rectangle2 = new Rectangle(Main.player[index2].aabb.X + 10 - 960 - 62, Main.player[index2].aabb.Y + 21 - 540 - 34, 2044, 1148); + if (rectangle1.Intersects(rectangle2)) + flag = false; + } + } + } + if (flag) + break; + } + if (!flag) + return; + int number = NPC.NewNPC(num1 * 16 + 8, num2 * 16, Type, 1); + if (number == 196) + return; + Main.npc[number].target = p.whoAmI; + Main.npc[number].timeLeft *= 20; + string prefix = Main.npc[number].displayName; + if (prefix.Length == 0) + prefix = Main.npc[number].name; + NetMessage.CreateMessage1(23, number); + NetMessage.SendMessage(); + if (Type == 125) + { + NetMessage.SendText(34, 175, 75, (int) byte.MaxValue, -1); + } + else + { + if (Type == 82 || Type == 126 || Type == 50) + return; + NetMessage.SendText(prefix, 16, 175, 75, (int) byte.MaxValue, -1); + } + } + + public static int NewNPC(int X, int Y, int Type, int Start = 0) + { + int index1 = 196; + for (int index2 = Start; index2 < 196; ++index2) + { + if ((int) Main.npc[index2].active == 0) + { + index1 = index2; + break; + } + } + if (index1 < 196) + { + Main.npc[index1].SetDefaults(Type, -1.0); + Main.npc[index1].position.X = (float) (Main.npc[index1].aabb.X = X - ((int) Main.npc[index1].width >> 1)); + Main.npc[index1].position.Y = (float) (Main.npc[index1].aabb.Y = Y - (int) Main.npc[index1].height); + Main.npc[index1].active = (byte) 1; + Main.npc[index1].timeLeft = 750; + Main.npc[index1].wet = Collision.WetCollision(ref Main.npc[index1].position, (int) Main.npc[index1].width, (int) Main.npc[index1].height); + if (Type == 50) + NetMessage.SendText(Main.npc[index1].name, 16, 175, 75, (int) byte.MaxValue, -1); + } + return index1; + } + + public void Transform(int newType) + { + Vector2 vector2 = this.velocity; + this.position.Y += (float) this.height; + sbyte num = this.spriteDirection; + this.SetDefaults(newType, -1.0); + this.spriteDirection = num; + this.TargetClosest(true); + this.velocity = vector2; + this.position.Y -= (float) this.height; + if (newType == 107 || newType == 108) + { + this.homeTileX = (short) ((int) this.position.X + ((int) this.width >> 1) >> 4); + this.homeTileY = (short) ((int) this.position.Y + (int) this.height >> 4); + this.homeless = true; + } + this.netUpdate = true; + NetMessage.CreateMessage1(23, (int) this.whoAmI); + NetMessage.SendMessage(); + } + + public double StrikeNPC(int Damage, float knockBack, int hitDirection, bool crit = false, bool noEffect = false) + { + if ((int) this.active == 0 || this.life <= 0) + return 0.0; + double dmg = Main.CalculateDamage(Damage, this.defense); + if (crit) + dmg *= 2.0; + if (Damage != 9999 && this.lifeMax > 1) + { + if (this.friendly) + CombatText.NewText(this.position, (int) this.width, (int) this.height, (int) dmg, crit); + else + CombatText.NewText(this.position, (int) this.width, (int) this.height, (int) dmg, crit); + if ((int) this.drawMyName < 96) + this.drawMyName = (short) 96; + } + if (dmg < 1.0) + return 0.0; + this.justHit = true; + if (this.townNPC) + { + this.ai0 = 1f; + this.ai1 = (float) (300 + Main.rand.Next(300)); + this.ai2 = 0.0f; + this.direction = (sbyte) hitDirection; + this.netUpdate = true; + } + if ((int) this.aiStyle == 8 && Main.netMode != 1) + { + this.ai0 = 400f; + this.TargetClosest(true); + } + if (this.realLife >= 0) + { + Main.npc[this.realLife].life -= (int) dmg; + this.life = Main.npc[this.realLife].life; + this.lifeMax = Main.npc[this.realLife].lifeMax; + } + else + this.life -= (int) dmg; + if ((double) knockBack > 0.0 && (double) this.knockBackResist > 0.0) + { + float num1 = knockBack * this.knockBackResist; + if ((double) num1 > 8.0) + num1 = 8f; + if (crit) + num1 *= 1.4f; + if (dmg * 10.0 < (double) this.lifeMax) + { + if (hitDirection < 0 && (double) this.velocity.X > -(double) num1) + { + if ((double) this.velocity.X > 0.0) + this.velocity.X -= num1; + this.velocity.X -= num1; + if ((double) this.velocity.X < -(double) num1) + this.velocity.X = -num1; + } + else if (hitDirection > 0 && (double) this.velocity.X < (double) num1) + { + if ((double) this.velocity.X < 0.0) + this.velocity.X += num1; + this.velocity.X += num1; + if ((double) this.velocity.X > (double) num1) + this.velocity.X = num1; + } + float num2 = this.noGravity ? num1 * -0.5f : num1 * -0.75f; + if ((double) this.velocity.Y > (double) num2) + { + this.velocity.Y += num2; + if ((double) this.velocity.Y < (double) num2) + this.velocity.Y = num2; + } + } + else + { + this.velocity.Y = this.noGravity ? (float) (-(double) num1 * 0.5) * this.knockBackResist : (float) (-(double) num1 * 0.75) * this.knockBackResist; + this.velocity.X = num1 * (float) hitDirection * this.knockBackResist; + } + } + if (((int) this.type == 113 || (int) this.type == 114) && this.life <= 0) + { + for (int index = 0; index < 196; ++index) + { + if ((int) Main.npc[index].active != 0 && ((int) Main.npc[index].type == 113 || (int) Main.npc[index].type == 114)) + Main.npc[index].HitEffect(hitDirection, dmg); + } + } + else if ((int) this.active != 0) + this.HitEffect(hitDirection, dmg); + if ((int) this.soundHit > 0) + Main.PlaySound(3, (int) this.position.X, (int) this.position.Y, (int) this.soundHit); + if (this.realLife >= 0) + Main.npc[this.realLife].checkDead(); + else + this.checkDead(); + return dmg; + } + + public void checkDead() + { + if ((int) this.active == 0 || this.realLife >= 0 && this.realLife != (int) this.whoAmI || this.life > 0) + return; + NPC.noSpawnCycle = true; + if (this.townNPC && (int) this.type != 37 && Main.netMode != 1) + { + string prefix = this.displayName; + if (this.displayName.Length == 0) + prefix = this.name; + NetMessage.SendText(prefix, 19, (int) byte.MaxValue, 25, 25, -1); + NPC.chrName[(int) this.type] = (string) null; + NPC.setNames(); + NetMessage.CreateMessage1(56, (int) this.type); + NetMessage.SendMessage(); + } + if (this.townNPC && Main.netMode != 1 && (this.homeless && WorldGen.spawnNPC == (int) this.type)) + WorldGen.spawnNPC = 0; + if ((int) this.soundKilled > 0) + Main.PlaySound(4, (int) this.position.X, (int) this.position.Y, (int) this.soundKilled); + this.NPCLoot(); + if ((int) this.type >= 26 && (int) this.type <= 29 || (int) this.type == 111 || (int) this.type >= 143 && (int) this.type <= 145) + --Main.invasionSize; + this.active = (byte) 0; + } + + public unsafe void NPCLoot() + { + if (Main.hardMode && this.lifeMax > 1 && (this.damage > 0 && !this.friendly) && (this.aabb.Y > Main.rockLayerPixels && (int) this.type != 121 && ((double) this.value > 0.0 && Main.rand.Next(7) == 0))) + { + Player closest = Player.FindClosest(ref this.aabb); + if (closest.zoneEvil) + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 521, 1, false, 0); + if (closest.zoneHoly) + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 520, 1, false, 0); + } + if (Time.xMas && this.lifeMax > 1 && (this.damage > 0 && !this.friendly) && ((int) this.type != 121 && (double) this.value > 0.0 && Main.rand.Next(13) == 0)) + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, Main.rand.Next(599, 602), 1, false, 0); + switch (this.type) + { + case (byte) 1: + case (byte) 16: + case (byte) 138: + case (byte) 141: + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 23, Main.rand.Next(1, 3), false, 0); + break; + case (byte) 2: + int num1 = Main.rand.Next(150); + if (num1 < 50) + { + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, num1 == 38 ? 236 : 38, 1, false, 0); + break; + } + else + break; + case (byte) 3: + case (byte) 132: + if (Main.rand.Next(50) == 0) + { + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 216, 1, false, -1); + break; + } + else + break; + case (byte) 4: + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 47, Main.rand.Next(20, 50), false, 0); + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 56, Main.rand.Next(10, 30), false, 0); + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 56, Main.rand.Next(10, 30), false, 0); + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 56, Main.rand.Next(10, 30), false, 0); + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 59, Main.rand.Next(1, 4), false, 0); + break; + case (byte) 6: + case (byte) 94: + if (Main.rand.Next(3) == 0) + { + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 68, 1, false, 0); + break; + } + else + break; + case (byte) 7: + case (byte) 8: + case (byte) 9: + if (Main.rand.Next(3) == 0) + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 68, Main.rand.Next(1, 3), false, 0); + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 69, Main.rand.Next(3, 9), false, 0); + break; + case (byte) 10: + case (byte) 11: + case (byte) 12: + case (byte) 95: + case (byte) 96: + case (byte) 97: + if (Main.rand.Next(500) == 0) + { + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 215, 1, false, 0); + break; + } + else + break; + case (byte) 13: + case (byte) 14: + case (byte) 15: + if (Main.rand.Next(2) == 0) + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 86, Main.rand.Next(1, 3), false, 0); + if (Main.rand.Next(2) == 0) + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 56, Main.rand.Next(2, 6), false, 0); + if (this.boss) + { + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 56, Main.rand.Next(10, 30), false, 0); + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 56, Main.rand.Next(10, 31), false, 0); + } + if (Main.rand.Next(3) == 0 && Player.FindClosest(ref this.aabb).canHeal()) + { + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 58, 1, false, 0); + break; + } + else + break; + case (byte) 21: + case (byte) 44: + case (byte) 149: + if (Main.rand.Next(25) == 0) + { + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 118, 1, false, 0); + break; + } + else if ((int) this.type != 21) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, Main.rand.Next(410, 412), 1, false, 0); + break; + } + else + { + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 166, Main.rand.Next(1, 4), false, 0); + break; + } + } + else + break; + case (byte) 23: + if (Main.rand.Next(50) == 0) + { + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 116, 1, false, 0); + break; + } + else + break; + case (byte) 24: + if (Main.rand.Next(300) == 0) + { + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 244, 1, false, 0); + break; + } + else + break; + case (byte) 26: + case (byte) 27: + case (byte) 28: + case (byte) 29: + case (byte) 111: + int num2 = Main.rand.Next(200); + if (num2 < 100) + { + if (num2 == 0) + { + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 160, 1, false, 0); + break; + } + else + { + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 161, Main.rand.Next(1, 6), false, 0); + break; + } + } + else + break; + case (byte) 31: + case (byte) 32: + case (byte) 34: + if (Main.rand.Next(65) == 0) + { + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 327, 1, false, 0); + break; + } + else + { + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 154, Main.rand.Next(1, 4), false, 0); + break; + } + case (byte) 42: + if (Main.rand.Next(2) == 0) + { + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 209, 1, false, 0); + break; + } + else + break; + case (byte) 43: + if (Main.rand.Next(4) == 0) + { + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 210, 1, false, 0); + break; + } + else + break; + case (byte) 45: + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 238, 1, false, 0); + break; + case (byte) 47: + if (Main.rand.Next(75) == 0) + { + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 243, 1, false, 0); + break; + } + else + break; + case (byte) 48: + if (Main.rand.Next(2) == 0) + { + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 320, 1, false, 0); + break; + } + else + break; + case (byte) 50: + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, Main.rand.Next(256, 259), 1, false, 0); + break; + case (byte) 52: + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 251, 1, false, 0); + break; + case (byte) 53: + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 239, 1, false, 0); + break; + case (byte) 54: + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 260, 1, false, 0); + break; + case (byte) 55: + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 261, 1, false, 0); + break; + case (byte) 58: + int num3 = Main.rand.Next(500); + if (num3 < 13) + { + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, num3 == 0 ? 263 : 118, 1, false, 0); + break; + } + else + break; + case (byte) 62: + if (Main.rand.Next(50) == 0) + { + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 272, 1, false, -1); + break; + } + else + break; + case (byte) 63: + case (byte) 64: + case (byte) 103: + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 282, Main.rand.Next(1, 5), false, 0); + break; + case (byte) 65: + if (Main.rand.Next(50) == 0) + { + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 268, 1, false, 0); + break; + } + else + { + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 319, 1, false, 0); + break; + } + case (byte) 66: + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 267, 1, false, 0); + break; + case (byte) 69: + case (byte) 147: + if (Main.rand.Next(7) == 0) + { + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 323, 1, false, 0); + break; + } + else + break; + case (byte) 71: + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 327, 1, false, 0); + break; + case (byte) 73: + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 362, Main.rand.Next(1, 3), false, 0); + break; + case (byte) 75: + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 501, Main.rand.Next(1, 4), false, 0); + break; + case (byte) 79: + if (Main.rand.Next(10) == 0) + { + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 527, 1, false, 0); + break; + } + else + break; + case (byte) 80: + if (Main.rand.Next(10) == 0) + { + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 528, 1, false, 0); + break; + } + else + break; + case (byte) 81: + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 23, Main.rand.Next(2, 5), false, 0); + break; + case (byte) 85: + if ((double) this.value > 0.0) + { + switch (Main.rand.Next(7)) + { + case 0: + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 437, 1, false, -1); + break; + case 1: + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 517, 1, false, -1); + break; + case 2: + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 535, 1, false, -1); + break; + case 3: + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 536, 1, false, -1); + break; + case 4: + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 532, 1, false, -1); + break; + case 5: + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 393, 1, false, -1); + break; + default: + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 554, 1, false, -1); + break; + } + } + else + break; + case (byte) 86: + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 526, 1, false, 0); + break; + case (byte) 87: + case (byte) 159: + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 575, Main.rand.Next(5, 11), false, 0); + break; + case (byte) 98: + case (byte) 101: + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 522, Main.rand.Next(2, 6), false, 0); + break; + case (byte) 102: + if (Main.rand.Next(500) == 0) + { + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 263, 1, false, 0); + break; + } + else + break; + case (byte) 104: + if (Main.rand.Next(60) == 0) + { + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 485, 1, false, -1); + break; + } + else + break; + case (byte) 109: + if (!NPC.downedClown) + { + NPC.downedClown = true; + if (Main.netMode == 2) + { + NetMessage.CreateMessage0(7); + NetMessage.SendMessage(); + break; + } + else + break; + } + else + break; + case (byte) 113: + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 367, 1, false, -1); + if (Main.rand.Next(2) == 0) + { + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, Main.rand.Next(489, 492), 1, false, -1); + } + else + { + int Type; + switch (Main.rand.Next(3)) + { + case 0: + Type = 514; + break; + case 1: + Type = 426; + break; + default: + Type = 434; + break; + } + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, Type, 1, false, -1); + } + if (Main.netMode != 1) + { + int num4 = this.aabb.X + ((int) this.width >> 1) >> 4; + int num5 = this.aabb.Y + ((int) this.height >> 1) >> 4; + int num6 = ((int) this.width >> 5) + 1; + for (int index1 = num4 - num6; index1 <= num4 + num6; ++index1) + { + for (int index2 = num5 - num6; index2 <= num5 + num6; ++index2) + { + bool flag = false; + fixed (Tile* tilePtr = &Main.tile[index1, index2]) + { + if ((index1 == num4 - num6 || index1 == num4 + num6 || (index2 == num5 - num6 || index2 == num5 + num6)) && (int) tilePtr->active == 0) + { + tilePtr->active = (byte) 1; + tilePtr->type = (byte) 140; + WorldGen.SquareTileFrame(index1, index2, -1); + flag = true; + } + if ((int) tilePtr->liquid > 0) + { + tilePtr->lava = (byte) 0; + tilePtr->liquid = (byte) 0; + flag = true; + } + } + if (flag) + NetMessage.SendTile(index1, index2); + } + } + break; + } + else + break; + case (byte) 116: + case (byte) 117: + case (byte) 118: + case (byte) 119: + case (byte) 139: + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 58, 1, false, 0); + break; + case (byte) 122: + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 23, Main.rand.Next(5, 11), false, 0); + break; + case (byte) 125: + case (byte) 126: + if (!NPC.AnyNPCs((int) this.type == 125 ? 126 : 125)) + { + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 549, Main.rand.Next(20, 31), false, 0); + break; + } + else + { + this.value = 0.0f; + this.boss = false; + break; + } + case (byte) 127: + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 547, Main.rand.Next(20, 31), false, 0); + break; + case (byte) 134: + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 548, Main.rand.Next(20, 31), false, 0); + break; + case (byte) 143: + case (byte) 144: + case (byte) 145: + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 593, Main.rand.Next(5, 11), false, 0); + break; + case (byte) 148: + if (Main.rand.Next(25) == 0) + { + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 268, 1, false, 0); + break; + } + else + break; + case (byte) 166: + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 366, Main.rand.Next(10, 30), false, 0); + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 620, Main.rand.Next(5, 10), false, 0); + if (Main.rand.Next(3) == 0) + { + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 604 + Main.rand.Next(9), 1, false, 0); + break; + } + else + break; + } + if (this.boss) + { + string prefix = this.displayName; + switch ((NPC.ID) this.type) + { + case NPC.ID.SKELETRON_HEAD: + NPC.downedBoss3 = true; + break; + case NPC.ID.RETINAZER: + case NPC.ID.SPAZMATISM: + prefix = Lang.misc[20]; + UI.SetTriggerStateForAll(Trigger.KilledTheTwins); + break; + case NPC.ID.SKELETRON_PRIME: + UI.SetTriggerStateForAll(Trigger.KilledSkeletronPrime); + break; + case NPC.ID.THE_DESTROYER_HEAD: + UI.SetTriggerStateForAll(Trigger.KilledDestroyer); + break; + case NPC.ID.EYE_OF_CTHULHU: + NPC.downedBoss1 = true; + break; + case NPC.ID.EATER_OF_WORLDS_HEAD: + case NPC.ID.EATER_OF_WORLDS_BODY: + case NPC.ID.EATER_OF_WORLDS_TAIL: + NPC.downedBoss2 = true; + break; + } + short netID = this.netID; + if (this.realLife > 0) + netID = Main.npc[this.realLife].netID; + UI.IncreaseStatisticForAll(Statistics.GetBossStatisticEntryFromNetID(netID)); + int Type = 28; + if ((int) this.type == 113) + Type = 188; + else if ((int) this.type > 113) + Type = 499; + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, Type, Main.rand.Next(5, 16), false, 0); + for (int index = Main.rand.Next(5, 10); index > 0; --index) + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 58, 1, false, 0); + if (Main.netMode != 1) + { + if ((int) this.type == 113) + WorldGen.StartHardmode(); + NetMessage.SendText(prefix, 17, 175, 75, (int) byte.MaxValue, -1); + NetMessage.CreateMessage0(7); + NetMessage.SendMessage(); + } + } + if (this.lifeMax > 1 && this.damage > 0) + { + Player closest = Player.FindClosest(ref this.aabb); + if (Main.rand.Next(6) == 0) + { + if (Main.rand.Next(2) == 0 && closest.canUseMana()) + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 184, 1, false, 0); + else if (Main.rand.Next(2) == 0 && closest.canHeal()) + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 58, 1, false, 0); + } + if (Main.rand.Next(2) == 0 && closest.canUseMana()) + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 184, 1, false, 0); + } + float num7 = this.value * (float) (1.0 + (double) Main.rand.Next(-20, 21) * 0.00999999977648258); + if (Main.rand.Next(5) == 0) + num7 *= (float) (1.0 + (double) Main.rand.Next(5, 11) * 0.00999999977648258); + if (Main.rand.Next(10) == 0) + num7 *= (float) (1.0 + (double) Main.rand.Next(10, 21) * 0.00999999977648258); + if (Main.rand.Next(15) == 0) + num7 *= (float) (1.0 + (double) Main.rand.Next(15, 31) * 0.00999999977648258); + if (Main.rand.Next(20) == 0) + num7 *= (float) (1.0 + (double) Main.rand.Next(20, 41) * 0.00999999977648258); + int num8 = (int) num7; + while (num8 > 0) + { + if (num8 > 1000000) + { + int Stack = num8 / 1000000; + if (Stack > 50 && Main.rand.Next(5) == 0) + Stack /= Main.rand.Next(1, 4); + if (Main.rand.Next(5) == 0) + Stack /= Main.rand.Next(1, 4); + if (Stack > 0) + { + num8 -= 1000000 * Stack; + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 74, Stack, false, 0); + } + } + else if (num8 > 10000) + { + int Stack = num8 / 10000; + if (Stack > 50 && Main.rand.Next(5) == 0) + Stack /= Main.rand.Next(1, 4); + if (Main.rand.Next(5) == 0) + Stack /= Main.rand.Next(1, 4); + if (Stack > 0) + { + num8 -= 10000 * Stack; + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 73, Stack, false, 0); + } + } + else if (num8 > 100) + { + int Stack = num8 / 100; + if (Stack > 50 && Main.rand.Next(5) == 0) + Stack /= Main.rand.Next(1, 4); + if (Main.rand.Next(5) == 0) + Stack /= Main.rand.Next(1, 4); + if (Stack > 0) + { + num8 -= 100 * Stack; + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 72, Stack, false, 0); + } + } + else if (num8 > 0) + { + int Stack = num8; + if (Stack > 50 && Main.rand.Next(5) == 0) + Stack /= Main.rand.Next(1, 4); + if (Main.rand.Next(5) == 0) + Stack /= Main.rand.Next(1, 4); + if (Stack < 1) + Stack = 1; + num8 -= Stack; + Item.NewItem(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height, 71, Stack, false, 0); + } + } + } + + public unsafe void HitEffect(int hitDirection = 0, double dmg = 10.0) + { + if ((int) this.type == 1 || (int) this.type == 16 || (int) this.type == 71) + { + if (this.life > 0) + { + int num = (int) (dmg / (double) this.lifeMax * 80.0); + while (num > 0 && IntPtr.Zero != (IntPtr) Main.dust.NewDust(4, ref this.aabb, (double) hitDirection, -1.0, (int) this.alpha, this.color, 1.0)) + --num; + } + else + { + int num = 0; + while (num < 48 && IntPtr.Zero != (IntPtr) Main.dust.NewDust(4, ref this.aabb, (double) (2 * hitDirection), -2.0, (int) this.alpha, this.color, 1.0)) + ++num; + if ((int) this.type != 16 || Main.netMode == 1) + return; + for (int index = Main.rand.Next(1, 3); index >= 0; --index) + { + int number = NPC.NewNPC(this.aabb.X + ((int) this.width >> 1), this.aabb.Y + (int) this.height, 1, 0); + if (number < 196) + { + Main.npc[number].SetDefaults("Baby Slime"); + Main.npc[number].velocity.X = this.velocity.X * 2f; + Main.npc[number].velocity.Y = this.velocity.Y; + Main.npc[number].velocity.X += (float) ((double) Main.rand.Next(-20, 20) * 0.100000001490116 + (double) (index * (int) this.direction) * 0.300000011920929); + Main.npc[number].velocity.Y -= (float) Main.rand.Next(10) * 0.1f + (float) index; + Main.npc[number].ai1 = (float) index; + NetMessage.CreateMessage1(23, number); + NetMessage.SendMessage(); + } + } + } + } + else if ((int) this.type == 143 || (int) this.type == 144 || (int) this.type == 145) + { + if (this.life > 0) + { + for (int index = (int) (dmg / (double) this.lifeMax * 80.0); index > 0; --index) + { + Dust* dustPtr = Main.dust.NewDust(76, ref this.aabb, (double) hitDirection, -1.0, 0, new Color(), 1.0); + if ((IntPtr) dustPtr == IntPtr.Zero) + break; + dustPtr->noGravity = true; + } + } + else + { + for (int index = 0; index < 32; ++index) + { + Dust* dustPtr = Main.dust.NewDust(76, ref this.aabb, (double) hitDirection, -1.0, 0, new Color(), 1.0); + if ((IntPtr) dustPtr == IntPtr.Zero) + break; + dustPtr->noGravity = true; + dustPtr->scale *= 1.2f; + } + } + } + else if ((int) this.type == 141) + { + if (this.life > 0) + { + int num = (int) (dmg / (double) this.lifeMax * 80.0); + while (num > 0 && IntPtr.Zero != (IntPtr) Main.dust.NewDust(4, ref this.aabb, (double) hitDirection, -1.0, (int) this.alpha, new Color(210, 230, 140), 1.0)) + --num; + } + else + { + int num = 0; + while (num < 40 && IntPtr.Zero != (IntPtr) Main.dust.NewDust(4, ref this.aabb, (double) (2 * hitDirection), -2.0, (int) this.alpha, new Color(210, 230, 140), 1.0)) + ++num; + } + } + else if ((int) this.type == 112) + { + for (int index = 0; index < 16; ++index) + { + Dust* dustPtr = Main.dust.NewDust(this.aabb.X, this.aabb.Y + 2, (int) this.width, (int) this.height, 18, 0.0, 0.0, 100, new Color(), 2.0); + if ((IntPtr) dustPtr == IntPtr.Zero) + break; + if (Main.rand.Next(2) == 0) + { + dustPtr->scale *= 0.6f; + } + else + { + dustPtr->velocity.X *= 1.4f; + dustPtr->velocity.Y *= 1.4f; + dustPtr->noGravity = true; + } + } + } + else if ((int) this.type == 81 || (int) this.type == 150 || (int) this.type == 121) + { + if (this.life > 0) + { + int num = (int) (dmg / (double) this.lifeMax * 80.0); + while (num > 0 && IntPtr.Zero != (IntPtr) Main.dust.NewDust(14, ref this.aabb, 0.0, 0.0, (int) this.alpha, this.color, 1.0)) + --num; + } + else + { + for (int index = 0; index < 42; ++index) + { + Dust* dustPtr = Main.dust.NewDust(14, ref this.aabb, (double) hitDirection, 0.0, (int) this.alpha, this.color, 1.0); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.X *= 2f; + dustPtr->velocity.Y *= 2f; + } + else + break; + } + if (Main.netMode == 1) + return; + if ((int) this.type == 121) + { + int number = NPC.NewNPC(this.aabb.X + ((int) this.width >> 1), this.aabb.Y + (int) this.height, 81, 0); + if (number >= 196) + return; + Main.npc[number].SetDefaults("Slimer2"); + Main.npc[number].velocity.X = this.velocity.X; + Main.npc[number].velocity.Y = this.velocity.Y; + Gore.NewGore(this.position, this.velocity, 94, (double) this.scale); + NetMessage.CreateMessage1(23, number); + NetMessage.SendMessage(); + } + else + { + if ((double) this.scale < 1.0) + return; + string Name = (int) this.type == 81 ? "Slimeling" : "Slimeling2"; + for (int index = Main.rand.Next(1, 3); index >= 0; --index) + { + int number = NPC.NewNPC(this.aabb.X + ((int) this.width >> 1), this.aabb.Y + (int) this.height, 1, 0); + if (number >= 196) + break; + Main.npc[number].SetDefaults(Name); + Main.npc[number].velocity.X = this.velocity.X * 3f; + Main.npc[number].velocity.Y = this.velocity.Y; + Main.npc[number].velocity.X += (float) ((double) Main.rand.Next(-10, 10) * 0.100000001490116 + (double) (index * (int) this.direction) * 0.300000011920929); + Main.npc[number].velocity.Y -= (float) Main.rand.Next(10) * 0.1f + (float) index; + Main.npc[number].ai1 = (float) index; + NetMessage.CreateMessage1(23, number); + NetMessage.SendMessage(); + } + } + } + } + else if ((int) this.type == 120 || (int) this.type == 154 || ((int) this.type == 137 || (int) this.type == 138)) + { + if (this.life > 0) + { + for (int index = 0; (double) index < dmg / (double) this.lifeMax * 50.0; ++index) + { + Dust* dustPtr = Main.dust.NewDust(71, ref this.aabb, 0.0, 0.0, 200, new Color(), 1.0); + if ((IntPtr) dustPtr == IntPtr.Zero) + break; + dustPtr->velocity.X *= 1.5f; + dustPtr->velocity.Y *= 1.5f; + } + } + else + { + for (int index = 0; index < 42; ++index) + { + Dust* dustPtr = Main.dust.NewDust(71, ref this.aabb, (double) hitDirection, 0.0, 200, new Color(), 1.0); + if ((IntPtr) dustPtr == IntPtr.Zero) + break; + dustPtr->velocity.X *= 1.5f; + dustPtr->velocity.Y *= 1.5f; + } + } + } + else if ((int) this.type == 122 || (int) this.type == 153) + { + if (this.life > 0) + { + for (int index = 0; (double) index < dmg / (double) this.lifeMax * 50.0; ++index) + { + Dust* dustPtr = Main.dust.NewDust(72, ref this.aabb, 0.0, 0.0, 200, new Color(), 1.0); + if ((IntPtr) dustPtr == IntPtr.Zero) + break; + dustPtr->velocity.X *= 1.5f; + dustPtr->velocity.Y *= 1.5f; + } + } + else + { + for (int index = 0; index < 42; ++index) + { + Dust* dustPtr = Main.dust.NewDust(72, ref this.aabb, (double) hitDirection, 0.0, 200, new Color(), 1.0); + if ((IntPtr) dustPtr == IntPtr.Zero) + break; + dustPtr->velocity.X *= 1.5f; + dustPtr->velocity.Y *= 1.5f; + } + } + } + else if ((int) this.type == 75) + { + if (this.life > 0) + { + int num = 0; + while ((double) num < dmg / (double) this.lifeMax * 50.0 && IntPtr.Zero != (IntPtr) Main.dust.NewDust(55, ref this.aabb, 0.0, 0.0, 200, this.color, 1.0)) + ++num; + } + else + { + for (int index = 0; index < 42; ++index) + { + Dust* dustPtr = Main.dust.NewDust(55, ref this.aabb, (double) hitDirection, 0.0, 200, this.color, 1.0); + if ((IntPtr) dustPtr == IntPtr.Zero) + break; + dustPtr->velocity.X *= 2f; + dustPtr->velocity.Y *= 2f; + } + } + } + else if ((int) this.type == 63 || (int) this.type == 64 || (int) this.type == 103) + { + Color newColor = new Color(50, 120, (int) byte.MaxValue, 100); + if ((int) this.type == 64) + newColor = new Color(225, 70, 140, 100); + else if ((int) this.type == 103) + newColor = new Color(70, 225, 140, 100); + if (this.life > 0) + { + int num = 0; + while ((double) num < dmg / (double) this.lifeMax * 50.0 && IntPtr.Zero != (IntPtr) Main.dust.NewDust(4, ref this.aabb, (double) hitDirection, -1.0, 0, newColor, 1.0)) + ++num; + } + else + { + int num = 0; + while (num < 16 && IntPtr.Zero != (IntPtr) Main.dust.NewDust(4, ref this.aabb, (double) (2 * hitDirection), -2.0, 0, newColor, 1.0)) + ++num; + } + } + else if ((int) this.type == 59 || (int) this.type == 60) + { + if (this.life > 0) + { + int num = 0; + while ((double) num < dmg / (double) this.lifeMax * 80.0 && IntPtr.Zero != (IntPtr) Main.dust.NewDust(6, ref this.aabb, (double) (hitDirection * 2), -1.0, (int) this.alpha, new Color(), 1.5)) + ++num; + } + else + { + int num = 0; + while (num < 32 && IntPtr.Zero != (IntPtr) Main.dust.NewDust(6, ref this.aabb, (double) (hitDirection * 2), -1.0, (int) this.alpha, new Color(), 1.5)) + ++num; + } + } + else if ((int) this.type == 50) + { + if (this.life > 0) + { + int num = 0; + while ((double) num < dmg / (double) this.lifeMax * 300.0 && IntPtr.Zero != (IntPtr) Main.dust.NewDust(4, ref this.aabb, (double) hitDirection, -1.0, 175, new Color(0, 80, (int) byte.MaxValue, 100), 1.0)) + ++num; + } + else + { + int num = 0; + while (num < 128 && IntPtr.Zero != (IntPtr) Main.dust.NewDust(4, ref this.aabb, (double) (hitDirection << 1), -2.0, 175, new Color(0, 80, (int) byte.MaxValue, 100), 1.0)) + ++num; + if (Main.netMode == 1) + return; + for (int index = Main.rand.Next(3, 7); index >= 0; --index) + { + int number = NPC.NewNPC(this.aabb.X + Main.rand.Next((int) this.width - 32), this.aabb.Y + Main.rand.Next((int) this.height - 32), 1, 0); + if (number < 196) + { + Main.npc[number].SetDefaults(1, -1.0); + Main.npc[number].velocity.X = (float) Main.rand.Next(-15, 16) * 0.1f; + Main.npc[number].velocity.Y = (float) Main.rand.Next(-30, 1) * 0.1f; + Main.npc[number].ai1 = (float) Main.rand.Next(3); + NetMessage.CreateMessage1(23, number); + NetMessage.SendMessage(); + } + } + } + } + else if ((int) this.type == 49 || (int) this.type == 51 || (int) this.type == 93) + { + if (this.life > 0) + { + int num = 0; + while ((double) num < dmg / (double) this.lifeMax * 30.0 && IntPtr.Zero != (IntPtr) Main.dust.NewDust(5, ref this.aabb, (double) hitDirection, -1.0, 0, new Color(), 1.0)) + ++num; + } + else + { + int num = 0; + while (num < 12 && IntPtr.Zero != (IntPtr) Main.dust.NewDust(5, ref this.aabb, (double) (hitDirection << 1), -2.0, 0, new Color(), 1.0)) + ++num; + if ((int) this.type == 51) + Gore.NewGore(this.position, this.velocity, 83, 1.0); + else if ((int) this.type == 93) + Gore.NewGore(this.position, this.velocity, 107, 1.0); + else + Gore.NewGore(this.position, this.velocity, 82, 1.0); + } + } + else if ((int) this.type == 46 || (int) this.type == 55 || ((int) this.type == 67 || (int) this.type == 74) || (int) this.type == 102) + { + if (this.life > 0) + { + int num = 0; + while ((double) num < dmg / (double) this.lifeMax * 20.0 && IntPtr.Zero != (IntPtr) Main.dust.NewDust(5, ref this.aabb, (double) hitDirection, -1.0, 0, new Color(), 1.0)) + ++num; + } + else + { + int num = 0; + while (num < 8 && IntPtr.Zero != (IntPtr) Main.dust.NewDust(5, ref this.aabb, (double) (hitDirection << 1), -2.0, 0, new Color(), 1.0)) + ++num; + if ((int) this.type == 46) + { + Gore.NewGore(this.position, this.velocity, 76, 1.0); + Gore.NewGore(this.position, this.velocity, 77, 1.0); + } + else if ((int) this.type == 67) + { + Gore.NewGore(this.position, this.velocity, 95, 1.0); + Gore.NewGore(this.position, this.velocity, 95, 1.0); + Gore.NewGore(this.position, this.velocity, 96, 1.0); + } + else if ((int) this.type == 74) + { + Gore.NewGore(this.position, this.velocity, 100, 1.0); + } + else + { + if ((int) this.type != 102) + return; + Gore.NewGore(this.position, this.velocity, 116, 1.0); + } + } + } + else if ((int) this.type == 47 || (int) this.type == 57 || (int) this.type == 58) + { + if (this.life > 0) + { + int num = 0; + while ((double) num < dmg / (double) this.lifeMax * 20.0 && IntPtr.Zero != (IntPtr) Main.dust.NewDust(5, ref this.aabb, (double) hitDirection, -1.0, 0, new Color(), 1.0)) + ++num; + } + else + { + int num = 0; + while (num < 8 && IntPtr.Zero != (IntPtr) Main.dust.NewDust(5, ref this.aabb, (double) (hitDirection << 1), -2.0, 0, new Color(), 1.0)) + ++num; + if ((int) this.type == 57) + Gore.NewGore(this.position, this.velocity, 84, 1.0); + else if ((int) this.type == 58) + { + Gore.NewGore(this.position, this.velocity, 85, 1.0); + } + else + { + Gore.NewGore(this.position, this.velocity, 78, 1.0); + Gore.NewGore(this.position, this.velocity, 79, 1.0); + } + } + } + else if ((int) this.type == 2) + { + if (this.life > 0) + { + int num = (int) (dmg / (double) this.lifeMax * 80.0); + while (num > 0 && IntPtr.Zero != (IntPtr) Main.dust.NewDust(5, ref this.aabb, (double) hitDirection, -1.0, 0, new Color(), 1.0)) + --num; + } + else + { + int num = 0; + while (num < 42 && IntPtr.Zero != (IntPtr) Main.dust.NewDust(5, ref this.aabb, (double) (hitDirection << 1), -2.0, 0, new Color(), 1.0)) + ++num; + Gore.NewGore(this.position, this.velocity, 1, 1.0); + Gore.NewGore(new Vector2(this.position.X + 14f, this.position.Y), this.velocity, 2, 1.0); + } + } + else if ((int) this.type == 133) + { + if (this.life > 0) + { + int num = (int) (dmg / (double) this.lifeMax * 80.0); + while (num > 0 && IntPtr.Zero != (IntPtr) Main.dust.NewDust(5, ref this.aabb, (double) hitDirection, -1.0, 0, new Color(), 1.0)) + --num; + if (this.life >= this.lifeMax >> 1 || this.localAI0 != 0) + return; + this.localAI0 = 1; + Gore.NewGore(this.position, this.velocity, 1, 1.0); + } + else + { + int num = 0; + while (num < 48 && IntPtr.Zero != (IntPtr) Main.dust.NewDust(5, ref this.aabb, (double) (hitDirection << 1), -2.0, 0, new Color(), 1.0)) + ++num; + Gore.NewGore(this.position, this.velocity, 155, 1.0); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 14f), this.velocity, 155, 1.0); + } + } + else if ((int) this.type == 69 || (int) this.type == 147) + { + if (this.life > 0) + { + int num = (int) (dmg / (double) this.lifeMax * 80.0); + while (num > 0 && IntPtr.Zero != (IntPtr) Main.dust.NewDust(5, ref this.aabb, (double) hitDirection, -1.0, 0, new Color(), 1.0)) + --num; + } + else + { + int num1 = 0; + while (num1 < 42 && IntPtr.Zero != (IntPtr) Main.dust.NewDust(5, ref this.aabb, (double) (hitDirection << 1), -2.0, 0, new Color(), 1.0)) + ++num1; + int Type = (int) this.type == 69 ? 97 : 160; + Gore.NewGore(this.position, this.velocity, Type, 1.0); + int num2; + Gore.NewGore(this.position, this.velocity, num2 = Type + 1, 1.0); + } + } + else if ((int) this.type == 61) + { + if (this.life > 0) + { + int num = (int) (dmg / (double) this.lifeMax * 80.0); + while (num > 0 && IntPtr.Zero != (IntPtr) Main.dust.NewDust(5, ref this.aabb, (double) hitDirection, -1.0, 0, new Color(), 1.0)) + --num; + } + else + { + int num = 0; + while (num < 42 && IntPtr.Zero != (IntPtr) Main.dust.NewDust(5, ref this.aabb, (double) (hitDirection << 1), -2.0, 0, new Color(), 1.0)) + ++num; + Gore.NewGore(this.position, this.velocity, 86, 1.0); + Gore.NewGore(new Vector2(this.position.X + 14f, this.position.Y), this.velocity, 87, 1.0); + Gore.NewGore(new Vector2(this.position.X + 14f, this.position.Y), this.velocity, 88, 1.0); + } + } + else if ((int) this.type == 65 || (int) this.type == 148) + { + if (this.life > 0) + { + int num = 0; + while ((double) num < dmg / (double) this.lifeMax * 150.0 && IntPtr.Zero != (IntPtr) Main.dust.NewDust(5, ref this.aabb, (double) hitDirection, -1.0, 0, new Color(), 1.0)) + ++num; + } + else + { + int num1 = 0; + while (num1 < 60 && IntPtr.Zero != (IntPtr) Main.dust.NewDust(5, ref this.aabb, (double) (hitDirection << 1), -2.0, 0, new Color(), 1.0)) + ++num1; + int Type = (int) this.type == 65 ? 89 : 162; + Vector2 Velocity = this.velocity; + Velocity.X *= 0.8f; + Velocity.Y *= 0.8f; + Gore.NewGore(this.position, Velocity, Type, 1.0); + int num2; + Gore.NewGore(new Vector2(this.position.X + 14f, this.position.Y), Velocity, num2 = Type + 1, 1.0); + int num3; + Gore.NewGore(new Vector2(this.position.X + 14f, this.position.Y), Velocity, num3 = num2 + 1, 1.0); + int num4; + Gore.NewGore(new Vector2(this.position.X + 14f, this.position.Y), Velocity, num4 = num3 + 1, 1.0); + } + } + else if ((int) this.type == 3 || (int) this.type == 52 || ((int) this.type == 53 || (int) this.type == 104) || ((int) this.type == 109 || (int) this.type == 132)) + { + if (this.life > 0) + { + int num = (int) (dmg / (double) this.lifeMax * 80.0); + while (num > 0 && IntPtr.Zero != (IntPtr) Main.dust.NewDust(5, ref this.aabb, (double) hitDirection, -1.0, 0, new Color(), 1.0)) + --num; + } + else + { + int num = 0; + while (num < 42 && IntPtr.Zero != (IntPtr) Main.dust.NewDust(5, ref this.aabb, 2.5 * (double) hitDirection, -2.5, 0, new Color(), 1.0)) + ++num; + if ((int) this.type == 104) + { + Gore.NewGore(this.position, this.velocity, 117, 1.0); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 118, 1.0); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 118, 1.0); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 119, 1.0); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 119, 1.0); + } + else if ((int) this.type == 109) + { + Gore.NewGore(this.position, this.velocity, 121, 1.0); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 122, 1.0); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 122, 1.0); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 123, 1.0); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 123, 1.0); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 46f), this.velocity, 120, 1.0); + } + else + { + if ((int) this.type == 132) + Gore.NewGore(this.position, this.velocity, 154, 1.0); + else + Gore.NewGore(this.position, this.velocity, 3, 1.0); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 4, 1.0); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 4, 1.0); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 5, 1.0); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 5, 1.0); + } + } + } + else if ((int) this.type == 83 || (int) this.type == 84 || (int) this.type == 151) + { + if (this.life > 0) + { + for (int index = 0; (double) index < dmg / (double) this.lifeMax * 50.0; ++index) + { + Dust* dustPtr = Main.dust.NewDust(31, ref this.aabb, 0.0, 0.0, 0, new Color(), 1.5); + if ((IntPtr) dustPtr == IntPtr.Zero) + break; + dustPtr->noGravity = true; + } + } + else + { + for (int index = 0; index < 16; ++index) + { + Dust* dustPtr = Main.dust.NewDust(31, ref this.aabb, 0.0, 0.0, 0, new Color(), 1.5); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.X *= 2f; + dustPtr->velocity.Y *= 2f; + dustPtr->noGravity = true; + } + else + break; + } + int index1 = Gore.NewGore(new Vector2(this.position.X, this.position.Y + (float) (((int) this.height >> 1) - 10)), new Vector2((float) Main.rand.Next(-2, 3), (float) Main.rand.Next(-2, 3)), 61, (double) this.scale); + Main.gore[index1].velocity *= 0.5f; + int index2 = Gore.NewGore(new Vector2(this.position.X, this.position.Y + (float) (((int) this.height >> 1) - 10)), new Vector2((float) Main.rand.Next(-2, 3), (float) Main.rand.Next(-2, 3)), 61, (double) this.scale); + Main.gore[index2].velocity *= 0.5f; + int index3 = Gore.NewGore(new Vector2(this.position.X, this.position.Y + (float) (((int) this.height >> 1) - 10)), new Vector2((float) Main.rand.Next(-2, 3), (float) Main.rand.Next(-2, 3)), 61, (double) this.scale); + Main.gore[index3].velocity *= 0.5f; + } + } + else if ((int) this.type == 4 || (int) this.type == 126 || (int) this.type == 125) + { + if (this.life > 0) + { + int num = (int) (dmg / (double) this.lifeMax * 80.0); + while (num > 0 && IntPtr.Zero != (IntPtr) Main.dust.NewDust(5, ref this.aabb, (double) hitDirection, -1.0, 0, new Color(), 1.0)) + --num; + } + else + { + int num = 0; + while (num < 128 && IntPtr.Zero != (IntPtr) Main.dust.NewDust(5, ref this.aabb, (double) (hitDirection << 1), -2.0, 0, new Color(), 1.0)) + ++num; + for (int index = 0; index < 2; ++index) + { + Gore.NewGore(this.position, new Vector2((float) Main.rand.Next(-30, 31) * 0.2f, (float) Main.rand.Next(-30, 31) * 0.2f), 2, 1.0); + Gore.NewGore(this.position, new Vector2((float) Main.rand.Next(-30, 31) * 0.2f, (float) Main.rand.Next(-30, 31) * 0.2f), 7, 1.0); + Gore.NewGore(this.position, new Vector2((float) Main.rand.Next(-30, 31) * 0.2f, (float) Main.rand.Next(-30, 31) * 0.2f), 9, 1.0); + if ((int) this.type == 4) + { + Gore.NewGore(this.position, new Vector2((float) Main.rand.Next(-30, 31) * 0.2f, (float) Main.rand.Next(-30, 31) * 0.2f), 10, 1.0); + Main.PlaySound(15, this.aabb.X, this.aabb.Y, 0); + } + else if ((int) this.type == 125) + Gore.NewGore(this.position, new Vector2((float) Main.rand.Next(-30, 31) * 0.2f, (float) Main.rand.Next(-30, 31) * 0.2f), 146, 1.0); + else if ((int) this.type == 126) + Gore.NewGore(this.position, new Vector2((float) Main.rand.Next(-30, 31) * 0.2f, (float) Main.rand.Next(-30, 31) * 0.2f), 145, 1.0); + } + if ((int) this.type != 125 && (int) this.type != 126) + return; + for (int index = 0; index < 8; ++index) + { + Dust* dustPtr = Main.dust.NewDust(31, ref this.aabb, 0.0, 0.0, 100, new Color(), 1.5); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.X *= 1.4f; + dustPtr->velocity.Y *= 1.4f; + } + else + break; + } + for (int index = 0; index < 4; ++index) + { + Dust* dustPtr1 = Main.dust.NewDust(6, ref this.aabb, 0.0, 0.0, 100, new Color(), 2.5); + if ((IntPtr) dustPtr1 != IntPtr.Zero) + { + dustPtr1->noGravity = true; + dustPtr1->velocity.X *= 5f; + dustPtr1->velocity.Y *= 5f; + Dust* dustPtr2 = Main.dust.NewDust(6, ref this.aabb, 0.0, 0.0, 100, new Color(), 1.5); + if ((IntPtr) dustPtr2 != IntPtr.Zero) + { + dustPtr2->velocity.X *= 3f; + dustPtr2->velocity.Y *= 3f; + } + else + break; + } + else + break; + } + int index1 = Gore.NewGore(this.position, new Vector2(), Main.rand.Next(61, 64), 1.0); + Main.gore[index1].velocity.X *= 0.4f; + ++Main.gore[index1].velocity.X; + Main.gore[index1].velocity.Y *= 0.4f; + ++Main.gore[index1].velocity.Y; + int index2 = Gore.NewGore(this.position, new Vector2(), Main.rand.Next(61, 64), 1.0); + Main.gore[index2].velocity.X *= 0.4f; + --Main.gore[index2].velocity.X; + Main.gore[index2].velocity.Y *= 0.4f; + ++Main.gore[index2].velocity.Y; + int index3 = Gore.NewGore(this.position, new Vector2(), Main.rand.Next(61, 64), 1.0); + Main.gore[index3].velocity.X *= 0.4f; + ++Main.gore[index3].velocity.X; + Main.gore[index3].velocity.Y *= 0.4f; + --Main.gore[index3].velocity.Y; + int index4 = Gore.NewGore(this.position, new Vector2(), Main.rand.Next(61, 64), 1.0); + Main.gore[index4].velocity.X *= 0.4f; + --Main.gore[index4].velocity.X; + Main.gore[index4].velocity.Y *= 0.4f; + --Main.gore[index4].velocity.Y; + } + } + else if ((int) this.type == 166) + { + if (this.life > 0) + { + int num = (int) (dmg / (double) this.lifeMax * 80.0); + while (num > 0 && IntPtr.Zero != (IntPtr) Main.dust.NewDust(5, ref this.aabb, (double) hitDirection, -1.0, 0, new Color(), 1.0)) + --num; + } + else + { + int num = 0; + while (num < 128 && IntPtr.Zero != (IntPtr) Main.dust.NewDust(5, ref this.aabb, (double) (hitDirection << 1), -2.0, 0, new Color(), 1.0)) + ++num; + for (int index = 0; index < 2; ++index) + { + Gore.NewGore(this.position, new Vector2((float) Main.rand.Next(-30, 31) * 0.2f, (float) Main.rand.Next(-30, 31) * 0.2f), 172, 1.0); + Gore.NewGore(this.position, new Vector2((float) Main.rand.Next(-30, 31) * 0.2f, (float) Main.rand.Next(-30, 31) * 0.2f), 173, 1.0); + Gore.NewGore(this.position, new Vector2((float) Main.rand.Next(-30, 31) * 0.2f, (float) Main.rand.Next(-30, 31) * 0.2f), 174, 1.0); + Gore.NewGore(this.position, new Vector2((float) Main.rand.Next(-30, 31) * 0.2f, (float) Main.rand.Next(-30, 31) * 0.2f), 172, 1.0); + Main.PlaySound(15, this.aabb.X, this.aabb.Y, 0); + } + } + } + else if ((int) this.type == 5) + { + if (this.life > 0) + { + for (int index = 0; (double) index < dmg / (double) this.lifeMax * 50.0; ++index) + Main.dust.NewDust(5, ref this.aabb, (double) hitDirection, -1.0, 0, new Color(), 1.0); + } + else + { + for (int index = 0; index < 16; ++index) + Main.dust.NewDust(5, ref this.aabb, (double) (hitDirection << 1), -2.0, 0, new Color(), 1.0); + Gore.NewGore(this.position, this.velocity, 6, 1.0); + Gore.NewGore(this.position, this.velocity, 7, 1.0); + } + } + else if ((int) this.type == 167) + { + if (this.life > 0) + { + for (int index = 0; (double) index < dmg / (double) this.lifeMax * 50.0; ++index) + Main.dust.NewDust(5, ref this.aabb, (double) hitDirection, -1.0, 0, new Color(), 1.0); + } + else + { + for (int index = 0; index < 16; ++index) + Main.dust.NewDust(5, ref this.aabb, (double) (hitDirection << 1), -2.0, 0, new Color(), 1.0); + } + } + else if ((int) this.type == 113 || (int) this.type == 114) + { + if (this.life > 0) + { + for (int index = 0; index < 16; ++index) + Main.dust.NewDust(5, ref this.aabb, (double) hitDirection, -1.0, 0, new Color(), 1.0); + } + else + { + for (int index = 0; index < 42; ++index) + Main.dust.NewDust(5, ref this.aabb, (double) (hitDirection << 1), -1.0, 0, new Color(), 1.0); + Gore.NewGore(this.position, this.velocity, 137, (double) this.scale); + if ((int) this.type == 114) + { + Gore.NewGore(new Vector2(this.position.X, this.position.Y + (float) ((int) this.height >> 1)), this.velocity, 139, (double) this.scale); + Gore.NewGore(new Vector2(this.position.X + (float) ((int) this.width >> 1), this.position.Y), this.velocity, 139, (double) this.scale); + Gore.NewGore(new Vector2(this.position.X + (float) ((int) this.width >> 1), this.position.Y + (float) ((int) this.height >> 1)), this.velocity, 137, (double) this.scale); + } + else + { + Gore.NewGore(new Vector2(this.position.X, this.position.Y + (float) ((int) this.height >> 1)), this.velocity, 138, (double) this.scale); + Gore.NewGore(new Vector2(this.position.X + (float) ((int) this.width >> 1), this.position.Y), this.velocity, 138, (double) this.scale); + Gore.NewGore(new Vector2(this.position.X + (float) ((int) this.width >> 1), this.position.Y + (float) ((int) this.height >> 1)), this.velocity, 137, (double) this.scale); + } + } + } + else if ((int) this.type == 115 || (int) this.type == 116) + { + if (this.life > 0) + { + for (int index = 0; index < 4; ++index) + Main.dust.NewDust(5, ref this.aabb, (double) hitDirection, -1.0, 0, new Color(), 1.0); + } + else if ((int) this.type == 115 && Main.netMode != 1) + { + NPC.NewNPC(this.aabb.X + ((int) this.width >> 1), this.aabb.Y + (int) this.height, 116, 0); + for (int index = 0; index < 8; ++index) + Main.dust.NewDust(5, ref this.aabb, (double) hitDirection, -1.0, 0, new Color(), 1.0); + } + else + { + for (int index = 0; index < 16; ++index) + Main.dust.NewDust(5, ref this.aabb, (double) hitDirection, -1.0, 0, new Color(), 1.0); + Gore.NewGore(this.position, this.velocity, 132, (double) this.scale); + Gore.NewGore(this.position, this.velocity, 133, (double) this.scale); + } + } + else if ((int) this.type >= 117 && (int) this.type <= 119) + { + if (this.life > 0) + { + for (int index = 0; index < 4; ++index) + Main.dust.NewDust(5, ref this.aabb, (double) hitDirection, -1.0, 0, new Color(), 1.0); + } + else + { + for (int index = 0; index < 8; ++index) + Main.dust.NewDust(5, ref this.aabb, (double) hitDirection, -1.0, 0, new Color(), 1.0); + Gore.NewGore(this.position, this.velocity, 134 + (int) this.type - 117, (double) this.scale); + } + } + else if ((int) this.type == 6 || (int) this.type == 94) + { + if (this.life > 0) + { + for (int index = (int) (dmg / (double) this.lifeMax * 80.0); index > 0; --index) + Main.dust.NewDust(18, ref this.aabb, (double) hitDirection, -1.0, (int) this.alpha, this.color, (double) this.scale); + } + else + { + for (int index = 0; index < 42; ++index) + Main.dust.NewDust(18, ref this.aabb, (double) hitDirection, -2.0, (int) this.alpha, this.color, (double) this.scale); + if ((int) this.type == 94) + { + int num = Gore.NewGore(this.position, this.velocity, 108, (double) this.scale); + num = Gore.NewGore(this.position, this.velocity, 108, (double) this.scale); + num = Gore.NewGore(this.position, this.velocity, 109, (double) this.scale); + num = Gore.NewGore(this.position, this.velocity, 110, (double) this.scale); + } + else + { + int index1 = Gore.NewGore(this.position, this.velocity, 14, (double) this.scale); + Main.gore[index1].alpha = (short) this.alpha; + int index2 = Gore.NewGore(this.position, this.velocity, 15, (double) this.scale); + Main.gore[index2].alpha = (short) this.alpha; + } + } + } + else if ((int) this.type == 101) + { + if (this.life > 0) + { + for (int index = (int) (dmg / (double) this.lifeMax * 80.0); index > 0; --index) + Main.dust.NewDust(18, ref this.aabb, (double) hitDirection, -1.0, (int) this.alpha, this.color, (double) this.scale); + } + else + { + for (int index = 0; index < 42; ++index) + Main.dust.NewDust(18, ref this.aabb, (double) hitDirection, -2.0, (int) this.alpha, this.color, (double) this.scale); + Gore.NewGore(this.position, this.velocity, 110, (double) this.scale); + Gore.NewGore(this.position, this.velocity, 114, (double) this.scale); + Gore.NewGore(this.position, this.velocity, 114, (double) this.scale); + Gore.NewGore(this.position, this.velocity, 115, (double) this.scale); + } + } + else if ((int) this.type == 7 || (int) this.type == 8 || (int) this.type == 9) + { + if (this.life > 0) + { + for (int index = (int) (dmg / (double) this.lifeMax * 80.0); index > 0; --index) + Main.dust.NewDust(18, ref this.aabb, (double) hitDirection, -1.0, (int) this.alpha, this.color, (double) this.scale); + } + else + { + for (int index = 0; index < 42; ++index) + Main.dust.NewDust(18, ref this.aabb, (double) hitDirection, -2.0, (int) this.alpha, this.color, (double) this.scale); + int index1 = Gore.NewGore(this.position, this.velocity, (int) this.type - 7 + 18, 1.0); + Main.gore[index1].alpha = (short) this.alpha; + } + } + else if ((int) this.type == 98 || (int) this.type == 99 || (int) this.type == 100) + { + if (this.life > 0) + { + for (int index = (int) (dmg / (double) this.lifeMax * 80.0); index > 0; --index) + Main.dust.NewDust(18, ref this.aabb, (double) hitDirection, -1.0, (int) this.alpha, this.color, (double) this.scale); + } + else + { + for (int index = 0; index < 42; ++index) + Main.dust.NewDust(18, ref this.aabb, (double) hitDirection, -2.0, (int) this.alpha, this.color, (double) this.scale); + int index1 = Gore.NewGore(this.position, this.velocity, 110, 1.0); + Main.gore[index1].alpha = (short) this.alpha; + } + } + else if ((int) this.type == 10 || (int) this.type == 11 || (int) this.type == 12) + { + if (this.life > 0) + { + for (int index = 0; (double) index < dmg / (double) this.lifeMax * 50.0; ++index) + Main.dust.NewDust(5, ref this.aabb, (double) hitDirection, -1.0, 0, new Color(), 1.0); + } + else + { + for (int index = 0; index < 8; ++index) + Main.dust.NewDust(5, ref this.aabb, 2.5 * (double) hitDirection, -2.5, 0, new Color(), 1.0); + Gore.NewGore(this.position, this.velocity, (int) this.type - 7 + 18, 1.0); + } + } + else if ((int) this.type == 95 || (int) this.type == 96 || (int) this.type == 97) + { + if (this.life > 0) + { + for (int index = 0; (double) index < dmg / (double) this.lifeMax * 50.0; ++index) + Main.dust.NewDust(5, ref this.aabb, (double) hitDirection, -1.0, 0, new Color(), 1.0); + } + else + { + for (int index = 0; index < 8; ++index) + Main.dust.NewDust(5, ref this.aabb, 2.5 * (double) hitDirection, -2.5, 0, new Color(), 1.0); + Gore.NewGore(this.position, this.velocity, (int) this.type - 95 + 111, 1.0); + } + } + else if ((int) this.type >= 13 && (int) this.type <= 15) + { + if (this.life > 0) + { + for (int index = (int) (dmg / (double) this.lifeMax * 80.0); index > 0; --index) + Main.dust.NewDust(18, ref this.aabb, (double) hitDirection, -1.0, (int) this.alpha, this.color, (double) this.scale); + } + else + { + for (int index = 0; index < 42; ++index) + Main.dust.NewDust(18, ref this.aabb, (double) hitDirection, -2.0, (int) this.alpha, this.color, (double) this.scale); + if ((int) this.type == 13) + { + Gore.NewGore(this.position, this.velocity, 24, 1.0); + Gore.NewGore(this.position, this.velocity, 25, 1.0); + } + else if ((int) this.type == 14) + { + Gore.NewGore(this.position, this.velocity, 26, 1.0); + Gore.NewGore(this.position, this.velocity, 27, 1.0); + } + else + { + Gore.NewGore(this.position, this.velocity, 28, 1.0); + Gore.NewGore(this.position, this.velocity, 29, 1.0); + } + } + } + else if ((int) this.type == 17) + { + if (this.life > 0) + { + for (int index = (int) (dmg / (double) this.lifeMax * 80.0); index > 0; --index) + Main.dust.NewDust(5, ref this.aabb, (double) hitDirection, -1.0, 0, new Color(), 1.0); + } + else + { + for (int index = 0; index < 42; ++index) + Main.dust.NewDust(5, ref this.aabb, 2.5 * (double) hitDirection, -2.5, 0, new Color(), 1.0); + Gore.NewGore(this.position, this.velocity, 30, 1.0); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 31, 1.0); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 31, 1.0); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 32, 1.0); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 32, 1.0); + } + } + else if ((int) this.type == 86) + { + if (this.life > 0) + { + for (int index = (int) (dmg / (double) this.lifeMax * 80.0); index > 0; --index) + Main.dust.NewDust(5, ref this.aabb, (double) hitDirection, -1.0, 0, new Color(), 1.0); + } + else + { + for (int index = 0; index < 42; ++index) + Main.dust.NewDust(5, ref this.aabb, 2.5 * (double) hitDirection, -2.5, 0, new Color(), 1.0); + Gore.NewGore(this.position, this.velocity, 101, 1.0); + Gore.NewGore(this.position, this.velocity, 102, 1.0); + Gore.NewGore(this.position, this.velocity, 103, 1.0); + Gore.NewGore(this.position, this.velocity, 103, 1.0); + Gore.NewGore(this.position, this.velocity, 104, 1.0); + Gore.NewGore(this.position, this.velocity, 104, 1.0); + Gore.NewGore(this.position, this.velocity, 105, 1.0); + } + } + else if ((int) this.type >= 105 && (int) this.type <= 108) + { + if (this.life > 0) + { + for (int index = (int) (dmg / (double) this.lifeMax * 80.0); index > 0; --index) + Main.dust.NewDust(5, ref this.aabb, (double) hitDirection, -1.0, 0, new Color(), 1.0); + } + else + { + for (int index = 0; index < 42; ++index) + Main.dust.NewDust(5, ref this.aabb, 2.5 * (double) hitDirection, -2.5, 0, new Color(), 1.0); + if ((int) this.type == 105 || (int) this.type == 107) + { + Gore.NewGore(this.position, this.velocity, 124, 1.0); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 125, 1.0); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 125, 1.0); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 126, 1.0); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 126, 1.0); + } + else + { + Gore.NewGore(this.position, this.velocity, (int) sbyte.MaxValue, 1.0); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 128, 1.0); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 128, 1.0); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 129, 1.0); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 129, 1.0); + } + } + } + else if ((int) this.type == 123 || (int) this.type == 124) + { + if (this.life > 0) + { + for (int index = (int) (dmg / (double) this.lifeMax * 80.0); index > 0; --index) + Main.dust.NewDust(5, ref this.aabb, (double) hitDirection, -1.0, 0, new Color(), 1.0); + } + else + { + for (int index = 0; index < 42; ++index) + Main.dust.NewDust(5, ref this.aabb, 2.5 * (double) hitDirection, -2.5, 0, new Color(), 1.0); + Gore.NewGore(this.position, this.velocity, 151, 1.0); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 152, 1.0); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 152, 1.0); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 153, 1.0); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 153, 1.0); + } + } + else if ((int) this.type == 22) + { + if (this.life > 0) + { + for (int index = (int) (dmg / (double) this.lifeMax * 80.0); index > 0; --index) + Main.dust.NewDust(5, ref this.aabb, (double) hitDirection, -1.0, 0, new Color(), 1.0); + } + else + { + for (int index = 0; index < 42; ++index) + Main.dust.NewDust(5, ref this.aabb, 2.5 * (double) hitDirection, -2.5, 0, new Color(), 1.0); + Gore.NewGore(this.position, this.velocity, 73, 1.0); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 74, 1.0); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 74, 1.0); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 75, 1.0); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 75, 1.0); + } + } + else if ((int) this.type == 142) + { + if (this.life > 0) + { + for (int index = (int) (dmg / (double) this.lifeMax * 80.0); index > 0; --index) + Main.dust.NewDust(5, ref this.aabb, (double) hitDirection, -1.0, 0, new Color(), 1.0); + } + else + { + for (int index = 0; index < 42; ++index) + Main.dust.NewDust(5, ref this.aabb, 2.5 * (double) hitDirection, -2.5, 0, new Color(), 1.0); + Gore.NewGore(this.position, this.velocity, 157, 1.0); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 158, 1.0); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 158, 1.0); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 159, 1.0); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 159, 1.0); + } + } + else if ((int) this.type == 37 || (int) this.type == 54) + { + if (this.life > 0) + { + for (int index = (int) (dmg / (double) this.lifeMax * 80.0); index > 0; --index) + Main.dust.NewDust(5, ref this.aabb, (double) hitDirection, -1.0, 0, new Color(), 1.0); + } + else + { + for (int index = 0; index < 42; ++index) + Main.dust.NewDust(5, ref this.aabb, 2.5 * (double) hitDirection, -2.5, 0, new Color(), 1.0); + Gore.NewGore(this.position, this.velocity, 58, 1.0); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 59, 1.0); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 59, 1.0); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 60, 1.0); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 60, 1.0); + } + } + else if ((int) this.type == 18) + { + if (this.life > 0) + { + for (int index = (int) (dmg / (double) this.lifeMax * 80.0); index > 0; --index) + Main.dust.NewDust(5, ref this.aabb, (double) hitDirection, -1.0, 0, new Color(), 1.0); + } + else + { + for (int index = 0; index < 42; ++index) + Main.dust.NewDust(5, ref this.aabb, 2.5 * (double) hitDirection, -2.5, 0, new Color(), 1.0); + Gore.NewGore(this.position, this.velocity, 33, 1.0); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 34, 1.0); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 34, 1.0); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 35, 1.0); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 35, 1.0); + } + } + else if ((int) this.type == 19) + { + if (this.life > 0) + { + for (int index = (int) (dmg / (double) this.lifeMax * 80.0); index > 0; --index) + Main.dust.NewDust(5, ref this.aabb, (double) hitDirection, -1.0, 0, new Color(), 1.0); + } + else + { + for (int index = 0; index < 42; ++index) + Main.dust.NewDust(5, ref this.aabb, 2.5 * (double) hitDirection, -2.5, 0, new Color(), 1.0); + Gore.NewGore(this.position, this.velocity, 36, 1.0); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 37, 1.0); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 37, 1.0); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 38, 1.0); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 38, 1.0); + } + } + else if ((int) this.type == 38) + { + if (this.life > 0) + { + for (int index = (int) (dmg / (double) this.lifeMax * 80.0); index > 0; --index) + Main.dust.NewDust(5, ref this.aabb, (double) hitDirection, -1.0, 0, new Color(), 1.0); + } + else + { + for (int index = 0; index < 42; ++index) + Main.dust.NewDust(5, ref this.aabb, 2.5 * (double) hitDirection, -2.5, 0, new Color(), 1.0); + Gore.NewGore(this.position, this.velocity, 64, 1.0); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 65, 1.0); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 65, 1.0); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 66, 1.0); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 66, 1.0); + } + } + else if ((int) this.type == 20) + { + if (this.life > 0) + { + for (int index = (int) (dmg / (double) this.lifeMax * 80.0); index > 0; --index) + Main.dust.NewDust(5, ref this.aabb, (double) hitDirection, -1.0, 0, new Color(), 1.0); + } + else + { + for (int index = 0; index < 42; ++index) + Main.dust.NewDust(5, ref this.aabb, 2.5 * (double) hitDirection, -2.5, 0, new Color(), 1.0); + Gore.NewGore(this.position, this.velocity, 39, 1.0); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 40, 1.0); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 40, 1.0); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 41, 1.0); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 41, 1.0); + } + } + else if ((int) this.type == 21 || (int) this.type == 31 || ((int) this.type == 32 || (int) this.type == 44) || ((int) this.type == 45 || (int) this.type == 77 || ((int) this.type == 110 || (int) this.type == 149))) + { + if (this.life > 0) + { + for (int index = 0; (double) index < dmg / (double) this.lifeMax * 50.0; ++index) + Main.dust.NewDust(26, ref this.aabb, (double) hitDirection, -1.0, 0, new Color(), 1.0); + } + else + { + for (int index = 0; index < 16; ++index) + Main.dust.NewDust(26, ref this.aabb, 2.5 * (double) hitDirection, -2.5, 0, new Color(), 1.0); + int Type1 = (int) this.type == 149 ? 166 : 42; + Gore.NewGore(this.position, this.velocity, Type1, (double) this.scale); + int Type2; + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, Type2 = Type1 + 1, (double) this.scale); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, Type2, (double) this.scale); + int Type3; + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, Type3 = Type2 + 1, (double) this.scale); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, Type3, (double) this.scale); + if ((int) this.type == 77) + { + Gore.NewGore(this.position, this.velocity, 106, (double) this.scale); + } + else + { + if ((int) this.type != 110) + return; + Gore.NewGore(this.position, this.velocity, 130, (double) this.scale); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 131, (double) this.scale); + } + } + } + else if ((int) this.type == 85) + { + int Type = 7; + if ((double) this.ai3 == 2.0) + Type = 10; + else if ((double) this.ai3 == 3.0) + Type = 37; + if (this.life > 0) + { + int num = 0; + while ((double) num < dmg / (double) this.lifeMax * 50.0 && IntPtr.Zero != (IntPtr) Main.dust.NewDust(Type, ref this.aabb, 0.0, 0.0, 0, new Color(), 1.0)) + ++num; + } + else + { + int num = 0; + while (num < 16 && IntPtr.Zero != (IntPtr) Main.dust.NewDust(Type, ref this.aabb, 0.0, 0.0, 0, new Color(), 1.0)) + ++num; + int index1 = Gore.NewGore(new Vector2(this.position.X, this.position.Y - 10f), new Vector2((float) hitDirection, 0.0f), 61, (double) this.scale); + Main.gore[index1].velocity *= 0.3f; + int index2 = Gore.NewGore(new Vector2(this.position.X, (float) ((double) this.position.Y + (double) ((int) this.height >> 1) - 10.0)), new Vector2((float) hitDirection, 0.0f), 62, (double) this.scale); + Main.gore[index2].velocity *= 0.3f; + int index3 = Gore.NewGore(new Vector2(this.position.X, (float) ((double) this.position.Y + (double) this.height - 10.0)), new Vector2((float) hitDirection, 0.0f), 63, (double) this.scale); + Main.gore[index3].velocity *= 0.3f; + } + } + else if ((int) this.type >= 87 && (int) this.type <= 92 || (int) this.type >= 159 && (int) this.type <= 164) + { + if (this.life > 0) + { + for (int index = 0; (double) index < dmg / (double) this.lifeMax * 50.0; ++index) + { + Dust* dustPtr = Main.dust.NewDust(16, ref this.aabb, 0.0, 0.0, 0, new Color(), 1.5); + if ((IntPtr) dustPtr == IntPtr.Zero) + break; + dustPtr->velocity.X *= 1.5f; + dustPtr->velocity.Y *= 1.5f; + dustPtr->noGravity = true; + } + } + else + { + for (int index = 0; index < 8; ++index) + { + Dust* dustPtr = Main.dust.NewDust(16, ref this.aabb, 0.0, 0.0, 0, new Color(), 1.5); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.X *= 2f; + dustPtr->velocity.Y *= 2f; + dustPtr->noGravity = true; + } + else + break; + } + for (int index1 = Main.rand.Next(1, 4); index1 > 0; --index1) + { + int index2 = Gore.NewGore(new Vector2(this.position.X, (float) ((double) this.position.Y + (double) ((int) this.height >> 1) - 10.0)), new Vector2((float) hitDirection, 0.0f), Main.rand.Next(11, 14), (double) this.scale); + Main.gore[index2].velocity *= 0.8f; + } + } + } + else if ((int) this.type == 78 || (int) this.type == 79 || ((int) this.type == 80 || (int) this.type == 152) || (int) this.type == 155) + { + if (this.life > 0) + { + for (int index = 0; (double) index < dmg / (double) this.lifeMax * 50.0; ++index) + { + Dust* dustPtr = Main.dust.NewDust(31, ref this.aabb, 0.0, 0.0, 0, new Color(), 1.5); + if ((IntPtr) dustPtr == IntPtr.Zero) + break; + dustPtr->velocity.X *= 2f; + dustPtr->velocity.Y *= 2f; + dustPtr->noGravity = true; + } + } + else + { + for (int index = 0; index < 16; ++index) + { + Dust* dustPtr = Main.dust.NewDust(31, ref this.aabb, 0.0, 0.0, 0, new Color(), 1.5); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.X *= 2f; + dustPtr->velocity.Y *= 2f; + dustPtr->noGravity = true; + } + else + break; + } + int index1 = Gore.NewGore(new Vector2(this.position.X, this.position.Y - 10f), new Vector2((float) hitDirection, 0.0f), 61, (double) this.scale); + Main.gore[index1].velocity *= 0.3f; + int index2 = Gore.NewGore(new Vector2(this.position.X, (float) ((double) this.position.Y + (double) ((int) this.height >> 1) - 10.0)), new Vector2((float) hitDirection, 0.0f), 62, (double) this.scale); + Main.gore[index2].velocity *= 0.3f; + int index3 = Gore.NewGore(new Vector2(this.position.X, (float) ((double) this.position.Y + (double) this.height - 10.0)), new Vector2((float) hitDirection, 0.0f), 63, (double) this.scale); + Main.gore[index3].velocity *= 0.3f; + } + } + else if ((int) this.type == 82) + { + if (this.life > 0) + { + for (int index = 0; (double) index < dmg / (double) this.lifeMax * 50.0; ++index) + { + Dust* dustPtr = Main.dust.NewDust(54, ref this.aabb, 0.0, 0.0, 50, new Color(), 1.5); + if ((IntPtr) dustPtr == IntPtr.Zero) + break; + dustPtr->velocity.X *= 2f; + dustPtr->velocity.Y *= 2f; + dustPtr->noGravity = true; + } + } + else + { + for (int index = 0; index < 16; ++index) + { + Dust* dustPtr = Main.dust.NewDust(54, ref this.aabb, 0.0, 0.0, 50, new Color(), 1.5); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.X *= 2f; + dustPtr->velocity.Y *= 2f; + dustPtr->noGravity = true; + } + else + break; + } + int index1 = Gore.NewGore(new Vector2(this.position.X, this.position.Y - 10f), new Vector2((float) hitDirection, 0.0f), 99, (double) this.scale); + Main.gore[index1].velocity *= 0.3f; + int index2 = Gore.NewGore(new Vector2(this.position.X, (float) ((double) this.position.Y + (double) ((int) this.height >> 1) - 15.0)), new Vector2((float) hitDirection, 0.0f), 99, (double) this.scale); + Main.gore[index2].velocity *= 0.3f; + int index3 = Gore.NewGore(new Vector2(this.position.X, (float) ((double) this.position.Y + (double) this.height - 20.0)), new Vector2((float) hitDirection, 0.0f), 99, (double) this.scale); + Main.gore[index3].velocity *= 0.3f; + } + } + else if ((int) this.type == 140) + { + if (this.life > 0) + return; + for (int index = 0; index < 16; ++index) + { + Dust* dustPtr = Main.dust.NewDust(54, ref this.aabb, 0.0, 0.0, 50, new Color(), 1.5); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.X *= 2f; + dustPtr->velocity.Y *= 2f; + dustPtr->noGravity = true; + } + else + break; + } + int index1 = Gore.NewGore(new Vector2(this.position.X, this.position.Y - 10f), new Vector2((float) hitDirection, 0.0f), 99, (double) this.scale); + Main.gore[index1].velocity *= 0.3f; + int index2 = Gore.NewGore(new Vector2(this.position.X, (float) ((double) this.position.Y + (double) ((int) this.height >> 1) - 15.0)), new Vector2((float) hitDirection, 0.0f), 99, (double) this.scale); + Main.gore[index2].velocity *= 0.3f; + int index3 = Gore.NewGore(new Vector2(this.position.X, (float) ((double) this.position.Y + (double) this.height - 20.0)), new Vector2((float) hitDirection, 0.0f), 99, (double) this.scale); + Main.gore[index3].velocity *= 0.3f; + } + else if ((int) this.type == 39 || (int) this.type == 40 || (int) this.type == 41) + { + if (this.life > 0) + { + for (int index = 0; (double) index < dmg / (double) this.lifeMax * 50.0; ++index) + Main.dust.NewDust(26, ref this.aabb, (double) hitDirection, -1.0, 0, new Color(), 1.0); + } + else + { + for (int index = 0; index < 16; ++index) + Main.dust.NewDust(26, ref this.aabb, 2.5 * (double) hitDirection, -2.5, 0, new Color(), 1.0); + Gore.NewGore(this.position, this.velocity, (int) this.type - 39 + 67, 1.0); + } + } + else if ((int) this.type == 34 || (int) this.type == 158) + { + if (this.life > 0) + { + for (int index = 0; (double) index < dmg / (double) this.lifeMax * 30.0; ++index) + { + Dust* dustPtr1 = Main.dust.NewDust(15, ref this.aabb, (double) this.velocity.X * -0.2, (double) this.velocity.Y * -0.2, 100, new Color(), 1.8); + if ((IntPtr) dustPtr1 == IntPtr.Zero) + break; + dustPtr1->noLight = true; + dustPtr1->noGravity = true; + dustPtr1->velocity.X *= 1.3f; + dustPtr1->velocity.Y *= 1.3f; + Dust* dustPtr2 = Main.dust.NewDust(26, ref this.aabb, (double) this.velocity.X * -0.2, (double) this.velocity.Y * -0.2, 0, new Color(), 0.9); + if ((IntPtr) dustPtr2 == IntPtr.Zero) + break; + dustPtr2->noLight = true; + dustPtr2->velocity.X *= 1.3f; + dustPtr2->velocity.Y *= 1.3f; + } + } + else + { + for (int index = 0; index < 12; ++index) + { + Dust* dustPtr1 = Main.dust.NewDust(15, ref this.aabb, (double) this.velocity.X * -0.2, (double) this.velocity.Y * -0.2, 100, new Color(), 1.8); + if ((IntPtr) dustPtr1 == IntPtr.Zero) + break; + dustPtr1->noLight = true; + dustPtr1->noGravity = true; + dustPtr1->velocity.X *= 1.3f; + dustPtr1->velocity.Y *= 1.3f; + Dust* dustPtr2 = Main.dust.NewDust(26, ref this.aabb, (double) this.velocity.X * -0.2, (double) this.velocity.Y * -0.2, 0, new Color(), 0.9); + if ((IntPtr) dustPtr2 == IntPtr.Zero) + break; + dustPtr2->noLight = true; + dustPtr2->velocity.X *= 1.3f; + dustPtr2->velocity.Y *= 1.3f; + } + } + } + else if ((int) this.type == 35 || (int) this.type == 36) + { + if (this.life > 0) + { + for (int index = (int) (dmg / (double) this.lifeMax * 80.0); index > 0; --index) + Main.dust.NewDust(26, ref this.aabb, (double) hitDirection, -1.0, 0, new Color(), 1.0); + } + else + { + for (int index = 0; index < 128; ++index) + Main.dust.NewDust(26, ref this.aabb, 2.5 * (double) hitDirection, -2.5, 0, new Color(), 1.0); + if ((int) this.type == 35) + { + Gore.NewGore(this.position, this.velocity, 54, 1.0); + Gore.NewGore(this.position, this.velocity, 55, 1.0); + } + else + { + Gore.NewGore(this.position, this.velocity, 56, 1.0); + Gore.NewGore(this.position, this.velocity, 57, 1.0); + Gore.NewGore(this.position, this.velocity, 57, 1.0); + Gore.NewGore(this.position, this.velocity, 57, 1.0); + } + } + } + else if ((int) this.type == 139) + { + if (this.life > 0) + return; + for (int index = 0; index < 8; ++index) + { + Dust* dustPtr = Main.dust.NewDust(31, ref this.aabb, 0.0, 0.0, 100, new Color(), 1.5); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.X *= 1.4f; + dustPtr->velocity.Y *= 1.4f; + } + else + break; + } + for (int index = 0; index < 4; ++index) + { + Dust* dustPtr1 = Main.dust.NewDust(6, ref this.aabb, 0.0, 0.0, 100, new Color(), 2.5); + if ((IntPtr) dustPtr1 != IntPtr.Zero) + { + dustPtr1->noGravity = true; + dustPtr1->velocity.X *= 5f; + dustPtr1->velocity.Y *= 5f; + Dust* dustPtr2 = Main.dust.NewDust(6, ref this.aabb, 0.0, 0.0, 100, new Color(), 1.5); + if ((IntPtr) dustPtr2 != IntPtr.Zero) + { + dustPtr2->velocity.X *= 3f; + dustPtr2->velocity.Y *= 3f; + } + else + break; + } + else + break; + } + int index1 = Gore.NewGore(this.position, new Vector2(), Main.rand.Next(61, 64), 1.0); + Main.gore[index1].velocity *= 0.4f; + ++Main.gore[index1].velocity.X; + ++Main.gore[index1].velocity.Y; + int index2 = Gore.NewGore(this.position, new Vector2(), Main.rand.Next(61, 64), 1.0); + Main.gore[index2].velocity *= 0.4f; + --Main.gore[index2].velocity.X; + ++Main.gore[index2].velocity.Y; + int index3 = Gore.NewGore(this.position, new Vector2(), Main.rand.Next(61, 64), 1.0); + Main.gore[index3].velocity *= 0.4f; + ++Main.gore[index3].velocity.X; + --Main.gore[index3].velocity.Y; + int index4 = Gore.NewGore(this.position, new Vector2(), Main.rand.Next(61, 64), 1.0); + Main.gore[index4].velocity *= 0.4f; + --Main.gore[index4].velocity.X; + --Main.gore[index4].velocity.Y; + } + else if ((int) this.type >= 134 && (int) this.type <= 136) + { + if ((int) this.type == 135 && this.life > 0 && (Main.netMode != 1 && (double) this.ai2 == 0.0) && Main.rand.Next(25) == 0) + { + this.ai2 = 1f; + int number = NPC.NewNPC(this.aabb.X + ((int) this.width >> 1), this.aabb.Y + (int) this.height, 139, 0); + if (Main.netMode == 2 && number < 196) + { + NetMessage.CreateMessage1(23, number); + NetMessage.SendMessage(); + } + this.netUpdate = true; + } + if (this.life > 0) + return; + Gore.NewGore(this.position, this.velocity, 156, 1.0); + if (Main.rand.Next(2) != 0) + return; + for (int index = 0; index < 8; ++index) + { + Dust* dustPtr = Main.dust.NewDust(31, ref this.aabb, 0.0, 0.0, 100, new Color(), 1.5); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.X *= 1.4f; + dustPtr->velocity.Y *= 1.4f; + } + else + break; + } + for (int index = 0; index < 4; ++index) + { + Dust* dustPtr1 = Main.dust.NewDust(6, ref this.aabb, 0.0, 0.0, 100, new Color(), 2.5); + if ((IntPtr) dustPtr1 != IntPtr.Zero) + { + dustPtr1->noGravity = true; + dustPtr1->velocity.X *= 5f; + dustPtr1->velocity.Y *= 5f; + Dust* dustPtr2 = Main.dust.NewDust(6, ref this.aabb, 0.0, 0.0, 100, new Color(), 1.5); + if ((IntPtr) dustPtr2 != IntPtr.Zero) + { + dustPtr2->velocity.X *= 3f; + dustPtr2->velocity.Y *= 3f; + } + else + break; + } + else + break; + } + int index1 = Gore.NewGore(this.position, new Vector2(), Main.rand.Next(61, 64), 1.0); + Main.gore[index1].velocity.X *= 0.4f; + ++Main.gore[index1].velocity.X; + Main.gore[index1].velocity.Y *= 0.4f; + ++Main.gore[index1].velocity.Y; + int index2 = Gore.NewGore(this.position, new Vector2(), Main.rand.Next(61, 64), 1.0); + Main.gore[index2].velocity.X *= 0.4f; + --Main.gore[index2].velocity.X; + Main.gore[index2].velocity.Y *= 0.4f; + ++Main.gore[index2].velocity.Y; + int index3 = Gore.NewGore(this.position, new Vector2(), Main.rand.Next(61, 64), 1.0); + Main.gore[index3].velocity.X *= 0.4f; + ++Main.gore[index3].velocity.X; + Main.gore[index3].velocity.Y *= 0.4f; + --Main.gore[index3].velocity.Y; + int index4 = Gore.NewGore(this.position, new Vector2(), Main.rand.Next(61, 64), 1.0); + Main.gore[index4].velocity.X *= 0.4f; + --Main.gore[index4].velocity.X; + Main.gore[index4].velocity.Y *= 0.4f; + --Main.gore[index4].velocity.Y; + } + else if ((int) this.type == (int) sbyte.MaxValue) + { + if (this.life > 0) + return; + Gore.NewGore(this.position, this.velocity, 149, 1.0); + Gore.NewGore(this.position, this.velocity, 150, 1.0); + for (int index = 0; index < 8; ++index) + { + Dust* dustPtr = Main.dust.NewDust(31, ref this.aabb, 0.0, 0.0, 100, new Color(), 1.5); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.X *= 1.4f; + dustPtr->velocity.Y *= 1.4f; + } + else + break; + } + for (int index = 0; index < 4; ++index) + { + Dust* dustPtr1 = Main.dust.NewDust(6, ref this.aabb, 0.0, 0.0, 100, new Color(), 2.5); + if ((IntPtr) dustPtr1 != IntPtr.Zero) + { + dustPtr1->noGravity = true; + dustPtr1->velocity.X *= 5f; + dustPtr1->velocity.Y *= 5f; + Dust* dustPtr2 = Main.dust.NewDust(6, ref this.aabb, 0.0, 0.0, 100, new Color(), 1.5); + if ((IntPtr) dustPtr2 != IntPtr.Zero) + { + dustPtr2->velocity.X *= 3f; + dustPtr2->velocity.Y *= 3f; + } + else + break; + } + else + break; + } + int index1 = Gore.NewGore(this.position, new Vector2(), Main.rand.Next(61, 64), 1.0); + Main.gore[index1].velocity.X *= 0.4f; + ++Main.gore[index1].velocity.X; + Main.gore[index1].velocity.Y *= 0.4f; + ++Main.gore[index1].velocity.Y; + int index2 = Gore.NewGore(this.position, new Vector2(), Main.rand.Next(61, 64), 1.0); + Main.gore[index2].velocity.X *= 0.4f; + --Main.gore[index2].velocity.X; + Main.gore[index2].velocity.Y *= 0.4f; + ++Main.gore[index2].velocity.Y; + int index3 = Gore.NewGore(this.position, new Vector2(), Main.rand.Next(61, 64), 1.0); + Main.gore[index3].velocity.X *= 0.4f; + ++Main.gore[index3].velocity.X; + Main.gore[index3].velocity.Y *= 0.4f; + --Main.gore[index3].velocity.Y; + int index4 = Gore.NewGore(this.position, new Vector2(), Main.rand.Next(61, 64), 1.0); + Main.gore[index4].velocity.X *= 0.4f; + --Main.gore[index4].velocity.X; + Main.gore[index4].velocity.Y *= 0.4f; + --Main.gore[index4].velocity.Y; + } + else if ((int) this.type >= 128 && (int) this.type <= 131) + { + if (this.life > 0) + return; + Gore.NewGore(this.position, this.velocity, 147, 1.0); + Gore.NewGore(this.position, this.velocity, 148, 1.0); + for (int index = 0; index < 8; ++index) + { + Dust* dustPtr = Main.dust.NewDust(31, ref this.aabb, 0.0, 0.0, 100, new Color(), 1.5); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.X *= 1.4f; + dustPtr->velocity.Y *= 1.4f; + } + else + break; + } + for (int index = 0; index < 4; ++index) + { + Dust* dustPtr1 = Main.dust.NewDust(6, ref this.aabb, 0.0, 0.0, 100, new Color(), 2.5); + if ((IntPtr) dustPtr1 != IntPtr.Zero) + { + dustPtr1->noGravity = true; + dustPtr1->velocity.X *= 5f; + dustPtr1->velocity.Y *= 5f; + Dust* dustPtr2 = Main.dust.NewDust(6, ref this.aabb, 0.0, 0.0, 100, new Color(), 1.5); + if ((IntPtr) dustPtr2 != IntPtr.Zero) + { + dustPtr2->velocity.X *= 3f; + dustPtr2->velocity.Y *= 3f; + } + else + break; + } + else + break; + } + int index1 = Gore.NewGore(this.position, new Vector2(), Main.rand.Next(61, 64), 1.0); + Main.gore[index1].velocity.X *= 0.4f; + ++Main.gore[index1].velocity.X; + Main.gore[index1].velocity.Y *= 0.4f; + ++Main.gore[index1].velocity.Y; + int index2 = Gore.NewGore(this.position, new Vector2(), Main.rand.Next(61, 64), 1.0); + Main.gore[index2].velocity.X *= 0.4f; + --Main.gore[index2].velocity.X; + Main.gore[index2].velocity.Y *= 0.4f; + ++Main.gore[index2].velocity.Y; + int index3 = Gore.NewGore(this.position, new Vector2(), Main.rand.Next(61, 64), 1.0); + Main.gore[index3].velocity.X *= 0.4f; + ++Main.gore[index3].velocity.X; + Main.gore[index3].velocity.Y *= 0.4f; + --Main.gore[index3].velocity.Y; + int index4 = Gore.NewGore(this.position, new Vector2(), Main.rand.Next(61, 64), 1.0); + Main.gore[index4].velocity.X *= 0.4f; + --Main.gore[index4].velocity.X; + Main.gore[index4].velocity.Y *= 0.4f; + --Main.gore[index4].velocity.Y; + } + else if ((int) this.type == 23) + { + if (this.life > 0) + { + for (int index = (int) (dmg / (double) this.lifeMax * 80.0); index > 0; --index) + { + int Type = Main.rand.Next(2) == 0 ? 6 : 25; + Main.dust.NewDust(Type, ref this.aabb, (double) hitDirection, -1.0, 0, new Color(), 1.0); + Dust* dustPtr = Main.dust.NewDust(6, ref this.aabb, (double) this.velocity.X * 0.2, (double) this.velocity.Y * 0.2, 100, new Color(), 2.0); + if ((IntPtr) dustPtr == IntPtr.Zero) + break; + dustPtr->noGravity = true; + } + } + else + { + for (int index = 0; index < 42; ++index) + { + int Type = Main.rand.Next(2) == 0 ? 6 : 25; + if (IntPtr.Zero == (IntPtr) Main.dust.NewDust(Type, ref this.aabb, (double) (hitDirection << 1), -2.0, 0, new Color(), 1.0)) + break; + } + for (int index = 0; index < 42; ++index) + { + Dust* dustPtr = Main.dust.NewDust(6, ref this.aabb, (double) this.velocity.X * 0.2, (double) this.velocity.Y * 0.2, 100, new Color(), 2.5); + if ((IntPtr) dustPtr == IntPtr.Zero) + break; + dustPtr->velocity.X *= 6f; + dustPtr->velocity.Y *= 6f; + dustPtr->noGravity = true; + } + } + } + else if ((int) this.type == 24) + { + if (this.life > 0) + { + for (int index = (int) (dmg / (double) this.lifeMax * 80.0); index > 0; --index) + { + Dust* dustPtr = Main.dust.NewDust(6, ref this.aabb, (double) this.velocity.X, (double) this.velocity.Y, 100, new Color(), 2.5); + if ((IntPtr) dustPtr == IntPtr.Zero) + break; + dustPtr->noGravity = true; + } + } + else + { + for (int index = 0; index < 42; ++index) + { + Dust* dustPtr = Main.dust.NewDust(6, ref this.aabb, (double) this.velocity.X, (double) this.velocity.Y, 100, new Color(), 2.5); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->noGravity = true; + dustPtr->velocity.X *= 2f; + dustPtr->velocity.Y *= 2f; + } + else + break; + } + Gore.NewGore(this.position, this.velocity, 45, 1.0); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 46, 1.0); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 46, 1.0); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 47, 1.0); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 47, 1.0); + } + } + else if ((int) this.type == 25) + { + Main.PlaySound(2, this.aabb.X, this.aabb.Y, 10); + for (int index = 0; index < 16; ++index) + { + Dust* dustPtr1 = Main.dust.NewDust(6, ref this.aabb, (double) this.velocity.X * -0.2, (double) this.velocity.Y * -0.2, 100, new Color(), 2.0); + if ((IntPtr) dustPtr1 == IntPtr.Zero) + break; + dustPtr1->noGravity = true; + dustPtr1->velocity *= 2f; + Dust* dustPtr2 = Main.dust.NewDust(6, ref this.aabb, (double) this.velocity.X * -0.2, (double) this.velocity.Y * -0.2, 100, new Color(), 1.0); + if ((IntPtr) dustPtr2 == IntPtr.Zero) + break; + dustPtr2->velocity.X *= 2f; + dustPtr2->velocity.Y *= 2f; + } + } + else if ((int) this.type == 33) + { + Main.PlaySound(2, this.aabb.X, this.aabb.Y, 10); + for (int index = 0; index < 16; ++index) + { + Dust* dustPtr1 = Main.dust.NewDust(29, ref this.aabb, (double) this.velocity.X * -0.200000002980232, (double) this.velocity.Y * -0.2, 100, new Color(), 2.0); + if ((IntPtr) dustPtr1 == IntPtr.Zero) + break; + dustPtr1->noGravity = true; + dustPtr1->velocity.X *= 2f; + dustPtr1->velocity.Y *= 2f; + Dust* dustPtr2 = Main.dust.NewDust(29, ref this.aabb, (double) this.velocity.X * -0.200000002980232, (double) this.velocity.Y * -0.2, 100, new Color(), 1.0); + if ((IntPtr) dustPtr2 == IntPtr.Zero) + break; + dustPtr2->velocity.X *= 2f; + dustPtr2->velocity.Y *= 2f; + } + } + else if ((int) this.type >= 26 && (int) this.type <= 29 || ((int) this.type == 73 || (int) this.type == 111)) + { + if (this.life > 0) + { + int num = (int) (dmg / (double) this.lifeMax * 80.0); + while (num > 0 && IntPtr.Zero != (IntPtr) Main.dust.NewDust(5, ref this.aabb, (double) hitDirection, -1.0, 0, new Color(), 1.0)) + --num; + } + else + { + int num = 0; + while (num < 42 && IntPtr.Zero != (IntPtr) Main.dust.NewDust(5, ref this.aabb, 2.5 * (double) hitDirection, -2.5, 0, new Color(), 1.0)) + ++num; + Gore.NewGore(this.position, this.velocity, 48, (double) this.scale); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 49, (double) this.scale); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 49, (double) this.scale); + if ((int) this.type == 111) + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 131, (double) this.scale); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 50, (double) this.scale); + Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 50, (double) this.scale); + } + } + else if ((int) this.type == 30) + { + Main.PlaySound(2, (int) this.position.X, (int) this.position.Y, 10); + for (int index = 0; index < 15; ++index) + { + Dust* dustPtr1 = Main.dust.NewDust(27, ref this.aabb, (double) this.velocity.X * -0.2, (double) this.velocity.Y * -0.2, 100, new Color(), 2.0); + if ((IntPtr) dustPtr1 == IntPtr.Zero) + break; + dustPtr1->noGravity = true; + dustPtr1->velocity.X *= 2f; + dustPtr1->velocity.Y *= 2f; + Dust* dustPtr2 = Main.dust.NewDust(27, ref this.aabb, (double) this.velocity.X * -0.2, (double) this.velocity.Y * -0.2, 100, new Color(), 1.0); + if ((IntPtr) dustPtr2 == IntPtr.Zero) + break; + dustPtr2->velocity.X *= 2f; + dustPtr2->velocity.Y *= 2f; + } + } + else if ((int) this.type == 42 || (int) this.type == 157) + { + if (this.life > 0) + { + for (int index = (int) (dmg / (double) this.lifeMax * 80.0); index > 0; --index) + Main.dust.NewDust(18, ref this.aabb, (double) hitDirection, -1.0, (int) this.alpha, this.color, (double) this.scale); + } + else + { + for (int index = 0; index < 42; ++index) + Main.dust.NewDust(18, ref this.aabb, (double) hitDirection, -2.0, (int) this.alpha, this.color, (double) this.scale); + int Type = (int) this.type == 42 ? 70 : 169; + Gore.NewGore(this.position, this.velocity, Type, (double) this.scale); + int num; + Gore.NewGore(this.position, this.velocity, num = Type + 1, (double) this.scale); + } + } + else if ((int) this.type == 43 || (int) this.type == 56 || (int) this.type == 156) + { + if (this.life > 0) + { + for (int index = (int) (dmg / (double) this.lifeMax * 80.0); index > 0; --index) + Main.dust.NewDust(40, ref this.aabb, (double) hitDirection, -1.0, (int) this.alpha, this.color, 1.20000004768372); + } + else + { + for (int index = 0; index < 42; ++index) + Main.dust.NewDust(40, ref this.aabb, (double) hitDirection, -2.0, (int) this.alpha, this.color, 1.20000004768372); + Gore.NewGore(this.position, this.velocity, 72, 1.0); + Gore.NewGore(this.position, this.velocity, 72, 1.0); + } + } + else if ((int) this.type == 48) + { + if (this.life > 0) + { + for (int index = (int) (dmg / (double) this.lifeMax * 80.0); index > 0; --index) + Main.dust.NewDust(5, ref this.aabb, (double) hitDirection, -1.0, 0, new Color(), 1.0); + } + else + { + for (int index = 0; index < 42; ++index) + Main.dust.NewDust(5, ref this.aabb, (double) (hitDirection << 1), -2.0, 0, new Color(), 1.0); + Gore.NewGore(this.position, this.velocity, 80, 1.0); + Gore.NewGore(this.position, this.velocity, 81, 1.0); + } + } + else + { + if ((int) this.type != 62 && (int) this.type != 165 && (int) this.type != 66) + return; + if (this.life > 0) + { + for (int index = (int) (dmg / (double) this.lifeMax * 80.0); index > 0; --index) + Main.dust.NewDust(5, ref this.aabb, (double) hitDirection, -1.0, 0, new Color(), 1.0); + } + else + { + for (int index = 0; index < 42; ++index) + Main.dust.NewDust(5, ref this.aabb, (double) (hitDirection << 1), -2.0, 0, new Color(), 1.0); + if ((int) this.type == 165) + { + Gore.NewGore(this.position, this.velocity, 171, 1.0); + Gore.NewGore(this.position, this.velocity, 0, 1.0); + Gore.NewGore(this.position, this.velocity, 0, 1.0); + } + else + { + Gore.NewGore(this.position, this.velocity, 93, 1.0); + Gore.NewGore(this.position, this.velocity, 94, 1.0); + Gore.NewGore(this.position, this.velocity, 94, 1.0); + } + } + } + } + + public static bool AnyNPCs(int Type) + { + for (int index = 195; index >= 0; --index) + { + if ((int) Main.npc[index].type == Type && (int) Main.npc[index].active != 0) + return true; + } + return false; + } + + public static bool AnyNPCs(int Type1, int Type2) + { + for (int index = 195; index >= 0; --index) + { + if ((int) Main.npc[index].active != 0 && ((int) Main.npc[index].type == Type1 || (int) Main.npc[index].type == Type2)) + return true; + } + return false; + } + + public static void SpawnSkeletron() + { + int number = -1; + for (int index = 0; index < 196; ++index) + { + if ((int) Main.npc[index].active != 0) + { + if ((int) Main.npc[index].type == 35) + return; + if ((int) Main.npc[index].type == 37) + { + number = index; + break; + } + } + } + if (number < 0) + return; + Main.npc[number].ai3 = 1f; + int index1 = NPC.NewNPC(Main.npc[number].aabb.X + ((int) Main.npc[number].width >> 1), Main.npc[number].aabb.Y + ((int) Main.npc[number].height >> 1), 35, 0); + Main.npc[index1].netUpdate = true; + NetMessage.CreateMessage1(23, number); + NetMessage.SendMessage(); + NetMessage.SendText("Skeletron", 16, 175, 75, (int) byte.MaxValue, -1); + } + + public static bool NearSpikeBall(int x, int y) + { + Rectangle rectangle1 = new Rectangle(x * 16 - 300, y * 16 - 300, 600, 600); + for (int index = 0; index < 196; ++index) + { + if ((int) Main.npc[index].aiStyle == 20 && (int) Main.npc[index].active != 0) + { + Rectangle rectangle2 = new Rectangle((int) Main.npc[index].ai1, (int) Main.npc[index].ai2, 20, 20); + if (rectangle1.Intersects(rectangle2)) + return true; + } + } + return false; + } + + public void AddBuff(int type, int time, bool quiet = false) + { + if (this.buffImmune[type]) + return; + if (!quiet) + { + if (Main.netMode == 1) + NetMessage.CreateMessage3(53, (int) this.whoAmI, type, time); + else + NetMessage.CreateMessage1(54, (int) this.whoAmI); + NetMessage.SendMessage(); + } + for (int index = 0; index < 5; ++index) + { + if ((int) this.buff[index].Type == type) + { + if ((int) this.buff[index].Time >= time) + return; + this.buff[index].Time = (ushort) time; + return; + } + } + int index1 = -1; + do + { + int b = -1; + for (int index2 = 0; index2 < 5; ++index2) + { + if (!this.buff[index2].IsDebuff()) + { + b = index2; + break; + } + } + if (b == -1) + return; + for (int index2 = b; index2 < 5; ++index2) + { + if ((int) this.buff[index2].Type == 0) + { + index1 = index2; + break; + } + } + if (index1 == -1) + this.DelBuff(b); + } + while (index1 == -1); + this.buff[index1].Type = (ushort) type; + this.buff[index1].Time = (ushort) time; + } + + public void DelBuff(int b) + { + this.buff[b].Time = (ushort) 0; + this.buff[b].Type = (ushort) 0; + for (int index1 = 0; index1 < 4; ++index1) + { + if ((int) this.buff[index1].Time == 0 || (int) this.buff[index1].Type == 0) + { + for (int index2 = index1 + 1; index2 < 5; ++index2) + { + this.buff[index2 - 1] = this.buff[index2]; + this.buff[index2].Time = (ushort) 0; + this.buff[index2].Type = (ushort) 0; + } + } + } + if (Main.netMode != 2) + return; + NetMessage.CreateMessage1(54, (int) this.whoAmI); + NetMessage.SendMessage(); + } + + private unsafe void FireEffect(int particleType) + { + if (Main.rand.Next(4) < 2) + { + Dust* dustPtr = Main.dust.NewDust((int) this.position.X - 2, (int) this.position.Y - 2, (int) this.width + 4, (int) this.height + 4, particleType, (double) this.velocity.X * 0.400000005960464, (double) this.velocity.Y * 0.400000005960464, 100, new Color(), 3.5); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->noGravity = true; + dustPtr->velocity.X *= 1.8f; + dustPtr->velocity.Y *= 1.8f; + dustPtr->velocity.Y -= 0.5f; + if (Main.rand.Next(4) == 0) + { + dustPtr->noGravity = false; + dustPtr->scale *= 0.5f; + } + } + } + Lighting.addLight((int) this.position.X >> 4, ((int) this.position.Y >> 4) + 1, new Vector3(1f, 0.3f, 0.1f)); + } + + public unsafe void UpdateNPC(int i) + { + this.whoAmI = (short) i; + if (this.aabb.X <= 0 || this.aabb.X + (int) this.width >= Main.rightWorld || (this.aabb.Y <= 0 || this.aabb.Y + (int) this.height >= Main.bottomWorld)) + { + this.active = (byte) 0; + } + else + { + int num1 = 0; + bool flag1 = false; + this.poisoned = false; + this.confused = false; + for (int index = 0; index < 5; ++index) + { + if ((int) this.buff[index].Type > 0 && (int) this.buff[index].Time > 0) + { + ushort num2 = this.buff[index].Type; + if ((uint) num2 <= 24U) + { + if ((int) num2 != 20) + { + if ((int) num2 == 24) + { + flag1 = true; + if (num1 > -8) + num1 = -8; + this.FireEffect(6); + } + } + else + { + this.poisoned = true; + if (num1 > -4) + num1 = -4; + if (Main.rand.Next(30) == 0) + { + Dust* dustPtr = Main.dust.NewDust(46, ref this.aabb, 0.0, 0.0, 120, new Color(), 0.200000002980232); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->noGravity = true; + dustPtr->fadeIn = 1.9f; + } + } + } + } + else + { + switch (num2) + { + case (ushort) 30: + if (num1 > -16) + num1 = -16; + if (Main.rand.Next(30) == 0) + { + Dust* dustPtr = Main.dust.NewDust(5, ref this.aabb, 0.0, 0.0, 0, new Color(), 1.0); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.Y += 0.5f; + dustPtr->velocity *= 0.25f; + continue; + } + else + continue; + } + else + continue; + case (ushort) 31: + this.confused = true; + continue; + case (ushort) 39: + if (num1 > -12) + num1 = -12; + this.FireEffect(75); + continue; + default: + continue; + } + } + } + } + if (Main.netMode != 1) + { + for (int b = 0; b < 5; ++b) + { + if ((int) this.buff[b].Type > 0 && (int) this.buff[b].Time == 0) + this.DelBuff(b); + } + } + if (!this.dontTakeDamage) + { + this.lifeRegenCount += num1; + while (this.lifeRegenCount <= -120) + { + this.lifeRegenCount += 120; + int npcId = (int) this.whoAmI; + if (this.realLife >= 0) + npcId = this.realLife; + if (--Main.npc[npcId].life <= 0) + { + Main.npc[npcId].life = 1; + if (Main.netMode != 1) + { + Main.npc[npcId].StrikeNPC(9999, 0.0f, 0, false, false); + NetMessage.SendNpcHurt(npcId, 9999, 0.0, 0, false); + } + } + } + } + if (Main.netMode != 1 && Main.gameTime.bloodMoon) + { + if ((int) this.type == 46) + this.Transform(47); + else if ((int) this.type == 55) + this.Transform(57); + } + float num3 = 10f; + float num4 = 0.3f; + float num5 = (float) Main.maxTilesX * 0.0002380952f; + float num6 = (float) ((double) this.position.Y * (1.0 / 16.0) - (60.0 + 10.0 * (double) (num5 * num5))) / (float) (Main.worldSurface / 6); + if ((double) num6 < 0.25) + num6 = 0.25f; + else if ((double) num6 > 1.0) + num6 = 1f; + float num7 = num4 * num6; + if (this.wet) + { + num7 = 0.2f; + num3 = 7f; + } + if ((int) this.soundDelay > 0) + --this.soundDelay; + if (this.life <= 0) + { + this.active = (byte) 0; + } + else + { + this.oldTarget = (short) this.target; + this.oldDirection = this.direction; + this.oldDirectionY = this.directionY; + try + { + switch (this.aiStyle) + { + case (byte) 0: + this.BoundAI(); + break; + case (byte) 1: + this.SlimeAI(); + break; + case (byte) 2: + this.FloatingEyeballAI(); + break; + case (byte) 3: + this.WalkAI(); + break; + case (byte) 4: + this.EyeOfCthulhuAI(); + break; + case (byte) 5: + this.AggressiveFlyerAI(); + break; + case (byte) 6: + this.WormAI(); + break; + case (byte) 7: + this.TownsfolkAI(); + break; + case (byte) 8: + this.SorcererAI(); + break; + case (byte) 9: + this.SphereAI(); + break; + case (byte) 10: + this.SkullHeadAI(); + break; + case (byte) 11: + this.SkeletronAI(); + break; + case (byte) 12: + this.SkeletronHandAI(); + break; + case (byte) 13: + this.PlantAI(); + break; + case (byte) 14: + this.FlyerAI(); + break; + case (byte) 15: + this.KingSlimeAI(); + break; + case (byte) 16: + this.FishAI(); + break; + case (byte) 17: + this.VultureAI(); + break; + case (byte) 18: + this.JellyfishAI(); + break; + case (byte) 19: + this.AntlionAI(); + break; + case (byte) 20: + this.SpinningSpikeballAI(); + break; + case (byte) 21: + this.GravityDiskAI(); + break; + case (byte) 22: + this.MoreFlyerAI(); + break; + case (byte) 23: + this.EnchantedWeaponAI(); + break; + case (byte) 24: + this.BirdAI(); + break; + case (byte) 25: + this.MimicAI(); + break; + case (byte) 26: + this.UnicornAI(); + break; + case (byte) 27: + this.WallOfFleshMouthAI(); + break; + case (byte) 28: + this.WallOfFleshEyesAI(); + break; + case (byte) 29: + this.WallOfFleshTentacleAI(); + break; + case (byte) 30: + this.RetinazerAI(); + break; + case (byte) 31: + this.SpazmatismAI(); + break; + case (byte) 32: + this.SkeletronPrimeAI(); + break; + case (byte) 33: + this.SkeletronPrimeSawHand(); + break; + case (byte) 34: + this.SkeletronPrimeViceHand(); + break; + case (byte) 35: + this.SkeletronPrimeCannonHand(); + break; + case (byte) 36: + this.SkeletronPrimeLaserHand(); + break; + case (byte) 37: + this.DestroyerAI(); + break; + case (byte) 38: + this.SnowmanAI(); + break; + case (byte) 39: + this.OcramAI(); + break; + } + } + catch (Exception ex) + { + this.active = (byte) 0; + return; + } + if ((int) this.type == 44 || (int) this.type == 149) + Lighting.addLight(this.aabb.X + ((int) this.width >> 1) >> 4, this.aabb.Y + 4 >> 4, new Vector3(0.9f, 0.75f, 0.5f)); + for (int index = 0; index < 9; ++index) + { + if ((int) this.immune[index] > 0) + --this.immune[index]; + } + if (!this.noGravity) + { + this.velocity.Y += num7; + if ((double) this.velocity.Y > (double) num3) + this.velocity.Y = num3; + } + if ((double) this.velocity.X < 0.00499999988824129 && (double) this.velocity.X > -0.00499999988824129) + this.velocity.X = 0.0f; + if (Main.netMode != 1 && (int) this.type != 37 && (this.friendly || (int) this.type == 46 || ((int) this.type == 55 || (int) this.type == 74))) + { + if (this.life < this.lifeMax) + { + ++this.friendlyRegen; + if ((int) this.friendlyRegen > 300) + { + this.friendlyRegen = (short) 0; + ++this.life; + this.netUpdate = true; + } + } + if ((int) this.immune[8] == 0) + { + for (int index = 0; index < 196; ++index) + { + if ((int) Main.npc[index].active != 0 && !Main.npc[index].friendly && (Main.npc[index].damage > 0 && this.aabb.Intersects(Main.npc[index].aabb))) + { + int num2 = Main.npc[index].damage; + int num8 = 6; + int num9 = 1; + if (Main.npc[index].aabb.X + ((int) Main.npc[index].width >> 1) > this.aabb.X + ((int) this.width >> 1)) + num9 = -1; + Main.npc[i].StrikeNPC(num2, (float) num8, num9, false, false); + NetMessage.SendNpcHurt(i, num2, (double) num8, num9, false); + this.netUpdate = true; + this.immune[8] = (byte) 30; + } + } + } + } + if (!this.noTileCollide) + { + bool flag2 = Collision.LavaCollision(ref this.position, (int) this.width, (int) this.height); + if (flag2) + { + this.lavaWet = true; + if (!this.lavaImmune && !this.dontTakeDamage && (Main.netMode != 1 && (int) this.immune[8] == 0)) + { + this.AddBuff(24, 420, false); + this.immune[8] = (byte) 30; + this.StrikeNPC(50, 0.0f, 0, false, false); + NetMessage.SendNpcHurt((int) this.whoAmI, 50, 0.0, 0, false); + } + } + bool flag3; + if ((int) this.type == 72) + { + flag3 = false; + this.wetCount = (byte) 0; + flag2 = false; + } + else + flag3 = Collision.WetCollision(ref this.position, (int) this.width, (int) this.height); + if (flag3) + { + if (flag1 && !this.lavaWet && Main.netMode != 1) + { + for (int b = 0; b < 5; ++b) + { + if ((int) this.buff[b].Type == 24) + { + this.DelBuff(b); + break; + } + } + } + if (!this.wet && (int) this.wetCount == 0) + { + this.wetCount = (byte) 10; + if (!flag2) + { + for (int index = 0; index < 24; ++index) + { + Dust* dustPtr = Main.dust.NewDust(this.aabb.X - 6, this.aabb.Y + ((int) this.height >> 1) - 8, (int) this.width + 12, 24, 33, 0.0, 0.0, 0, new Color(), 1.0); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.Y -= 4f; + dustPtr->velocity.X *= 2.5f; + dustPtr->scale = 1.3f; + dustPtr->alpha = (short) 100; + dustPtr->noGravity = true; + } + else + break; + } + if ((int) this.type != 1 && (int) this.type != 59 && !this.noGravity) + Main.PlaySound(19, this.aabb.X, this.aabb.Y, 0); + } + else + { + for (int index = 0; index < 7; ++index) + { + Dust* dustPtr = Main.dust.NewDust(this.aabb.X - 6, this.aabb.Y + ((int) this.height >> 1) - 8, (int) this.width + 12, 24, 35, 0.0, 0.0, 0, new Color(), 1.0); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.Y -= 1.5f; + dustPtr->velocity.X *= 2.5f; + dustPtr->scale = 1.3f; + dustPtr->alpha = (short) 100; + dustPtr->noGravity = true; + } + else + break; + } + if ((int) this.type != 1 && (int) this.type != 59 && !this.noGravity) + Main.PlaySound(19, this.aabb.X, this.aabb.Y, 1); + } + } + this.wet = true; + } + else if (this.wet) + { + this.velocity.X *= 0.5f; + this.wet = false; + if ((int) this.wetCount == 0) + { + this.wetCount = (byte) 10; + if (!this.lavaWet) + { + for (int index = 0; index < 24; ++index) + { + Dust* dustPtr = Main.dust.NewDust(this.aabb.X - 6, this.aabb.Y + ((int) this.height >> 1) - 8, (int) this.width + 12, 24, 33, 0.0, 0.0, 0, new Color(), 1.0); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.Y -= 4f; + dustPtr->velocity.X *= 2.5f; + dustPtr->scale = 1.3f; + dustPtr->alpha = (short) 100; + dustPtr->noGravity = true; + } + else + break; + } + if ((int) this.type != 1 && (int) this.type != 59 && !this.noGravity) + Main.PlaySound(19, this.aabb.X, this.aabb.Y, 0); + } + else + { + for (int index = 0; index < 7; ++index) + { + Dust* dustPtr = Main.dust.NewDust(this.aabb.X - 6, this.aabb.Y + ((int) this.height >> 1) - 8, (int) this.width + 12, 24, 35, 0.0, 0.0, 0, new Color(), 1.0); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.Y -= 1.5f; + dustPtr->velocity.X *= 2.5f; + dustPtr->scale = 1.3f; + dustPtr->alpha = (short) 100; + dustPtr->noGravity = true; + } + else + break; + } + if ((int) this.type != 1 && (int) this.type != 59 && !this.noGravity) + Main.PlaySound(19, this.aabb.X, this.aabb.Y, 1); + } + } + } + if (!this.wet) + this.lavaWet = false; + if ((int) this.wetCount > 0) + --this.wetCount; + bool flag4 = false; + if ((int) this.aiStyle == 10) + flag4 = true; + else if ((int) this.aiStyle == 14) + flag4 = true; + else if ((int) this.aiStyle == 3 && (int) this.directionY == 1) + flag4 = true; + this.oldVelocity = this.velocity; + this.collideX = false; + this.collideY = false; + if (this.wet) + { + Vector2 vector2_1 = this.velocity; + Collision.TileCollision(ref this.position, ref this.velocity, (int) this.width, (int) this.height, flag4, flag4); + if (Collision.up) + this.velocity.Y = 0.01f; + Vector2 vector2_2 = this.velocity; + vector2_2.X *= 0.5f; + vector2_2.Y *= 0.5f; + if ((double) this.velocity.X != (double) vector2_1.X) + { + vector2_2.X = this.velocity.X; + this.collideX = true; + } + if ((double) this.velocity.Y != (double) vector2_1.Y) + { + vector2_2.Y = this.velocity.Y; + this.collideY = true; + } + this.oldPosition = this.position; + this.position.X += vector2_2.X; + this.position.Y += vector2_2.Y; + } + else + { + if ((int) this.type == 72) + { + Vector2 Position = new Vector2(this.position.X + (float) ((int) this.width >> 1), this.position.Y + (float) ((int) this.height >> 1)); + int Width = 12; + int Height = 12; + Position.X -= (float) (Width >> 1); + Position.Y -= (float) (Height >> 1); + Collision.TileCollision(ref Position, ref this.velocity, Width, Height, true, true); + } + else + Collision.TileCollision(ref this.position, ref this.velocity, (int) this.width, (int) this.height, flag4, flag4); + if (Collision.up) + this.velocity.Y = 0.01f; + if ((double) this.oldVelocity.X != (double) this.velocity.X) + this.collideX = true; + if ((double) this.oldVelocity.Y != (double) this.velocity.Y) + this.collideY = true; + this.oldPosition = this.position; + this.position.X += this.velocity.X; + this.position.Y += this.velocity.Y; + } + } + else + { + this.oldPosition = this.position; + this.position.X += this.velocity.X; + this.position.Y += this.velocity.Y; + } + this.aabb.X = (int) this.position.X; + this.aabb.Y = (int) this.position.Y; + if (Main.netMode != 1 && !this.noTileCollide && (this.lifeMax > 1 && Collision.SwitchTiles(this.position, (int) this.width, (int) this.height, this.oldPosition)) && (int) this.type == 46) + { + this.ai0 = 1f; + this.ai1 = 400f; + this.ai2 = 0.0f; + } + if ((int) this.active == 0) + this.netUpdate = true; + if (Main.netMode == 2) + { + if (this.townNPC) + this.netSpam = (short) 0; + if (this.netUpdate2) + this.netUpdate = true; + if ((int) this.active == 0) + this.netSpam = (short) 0; + if (this.netUpdate) + { + if ((int) this.netSpam <= 180) + { + this.netSpam += (short) 60; + NetMessage.CreateMessage1(23, i); + NetMessage.SendMessage(); + this.netUpdate2 = false; + } + else + this.netUpdate2 = true; + } + if ((int) this.netSpam > 0) + --this.netSpam; + if ((int) this.active != 0 && this.townNPC && this.getHeadTextureId() != -1) + { + if (this.homeless != this.oldHomeless || (int) this.homeTileX != (int) this.oldHomeTileX || (int) this.homeTileY != (int) this.oldHomeTileY) + { + NetMessage.CreateMessage4(60, i, (int) Main.npc[i].homeTileX, (int) Main.npc[i].homeTileY, this.homeless ? 1 : 0); + NetMessage.SendMessage(); + } + this.oldHomeless = this.homeless; + this.oldHomeTileX = this.homeTileX; + this.oldHomeTileY = this.homeTileY; + } + } + this.FindFrame(); + this.CheckActive(); + this.netUpdate = false; + this.justHit = false; + if ((int) this.type == 120 || (int) this.type == 154 || ((int) this.type == 137 || (int) this.type == 138)) + { + for (int index = this.oldPos.Length - 1; index > 0; --index) + { + this.oldPos[index] = this.oldPos[index - 1]; + Lighting.addLight(this.aabb.X >> 4, this.aabb.Y >> 4, new Vector3(0.3f, 0.0f, 0.2f)); + } + this.oldPos[0] = this.position; + } + else + { + if ((int) this.type != 94 && ((int) this.type < 125 || (int) this.type > 131) && ((int) this.type != 139 && (int) this.type != 140)) + return; + for (int index = this.oldPos.Length - 1; index > 0; --index) + this.oldPos[index] = this.oldPos[index - 1]; + this.oldPos[0] = this.position; + } + } + } + } + + public Color GetAlpha(Color newColor) + { + float num = (float) ((int) byte.MaxValue - (int) this.alpha) / (float) byte.MaxValue; + int r = (int) ((double) newColor.R * (double) num); + int g = (int) ((double) newColor.G * (double) num); + int b = (int) ((double) newColor.B * (double) num); + int a = (int) newColor.A - (int) this.alpha; + if ((int) this.type == 25 || (int) this.type == 30 || ((int) this.type == 33 || (int) this.type == 59) || (int) this.type == 60) + return new Color(200, 200, 200, 0); + if ((int) this.type == 72) + { + r = (int) newColor.R; + g = (int) newColor.G; + b = (int) newColor.B; + } + else if ((int) this.type == 64 || (int) this.type == 63 || ((int) this.type == 75 || (int) this.type == 103)) + { + r = (int) ((double) newColor.R * 1.5); + g = (int) ((double) newColor.G * 1.5); + b = (int) ((double) newColor.B * 1.5); + if (r > (int) byte.MaxValue) + r = (int) byte.MaxValue; + if (g > (int) byte.MaxValue) + g = (int) byte.MaxValue; + if (b > (int) byte.MaxValue) + b = (int) byte.MaxValue; + } + if (a < 0) + a = 0; + if (a > (int) byte.MaxValue) + a = (int) byte.MaxValue; + return new Color(r, g, b, a); + } + + public Color GetColor(Color newColor) + { + int r = (int) this.color.R - ((int) byte.MaxValue - (int) newColor.R); + int g = (int) this.color.G - ((int) byte.MaxValue - (int) newColor.G); + int b = (int) this.color.B - ((int) byte.MaxValue - (int) newColor.B); + int a = (int) this.color.A - ((int) byte.MaxValue - (int) newColor.A); + if (r < 0) + r = 0; + if (r > (int) byte.MaxValue) + r = (int) byte.MaxValue; + if (g < 0) + g = 0; + if (g > (int) byte.MaxValue) + g = (int) byte.MaxValue; + if (b < 0) + b = 0; + if (b > (int) byte.MaxValue) + b = (int) byte.MaxValue; + if (a < 0) + a = 0; + if (a > (int) byte.MaxValue) + a = (int) byte.MaxValue; + return new Color(r, g, b, a); + } + + public string GetChat(Player player) + { + bool flag1 = false; + bool flag2 = false; + bool flag3 = false; + bool flag4 = false; + bool flag5 = false; + bool flag6 = false; + bool flag7 = false; + bool flag8 = false; + bool flag9 = false; + for (int index = 0; index < 196; ++index) + { + if ((int) Main.npc[index].active != 0) + { + if ((int) Main.npc[index].type == 17) + flag1 = true; + else if ((int) Main.npc[index].type == 18) + flag2 = true; + else if ((int) Main.npc[index].type == 19) + flag3 = true; + else if ((int) Main.npc[index].type == 20) + flag4 = true; + else if ((int) Main.npc[index].type == 37) + flag5 = true; + else if ((int) Main.npc[index].type == 38) + flag6 = true; + else if ((int) Main.npc[index].type == 124) + flag7 = true; + else if ((int) Main.npc[index].type == 107) + flag8 = true; + else if ((int) Main.npc[index].type == 22) + flag9 = true; + } + } + string str = ""; + if ((int) this.type == 17) + { + if (!NPC.downedBoss1 && Main.rand.Next(3) == 0) + str = (int) player.statLifeMax >= 200 ? ((int) player.statDefense > 10 ? Lang.dialog(player, 3) : Lang.dialog(player, 2)) : Lang.dialog(player, 1); + else if (Main.gameTime.dayTime) + { + if ((double) Main.gameTime.time < 16200.0) + { + switch (Main.rand.Next(3)) + { + case 0: + str = Lang.dialog(player, 4); + break; + case 1: + str = Lang.dialog(player, 5); + break; + default: + str = Lang.dialog(player, 6); + break; + } + } + else if ((double) Main.gameTime.time > 37800.0) + { + switch (Main.rand.Next(3)) + { + case 0: + str = Lang.dialog(player, 7); + break; + case 1: + str = Lang.dialog(player, 8); + break; + default: + str = Lang.dialog(player, 9); + break; + } + } + else + { + switch (Main.rand.Next(3)) + { + case 0: + str = Lang.dialog(player, 10); + break; + case 1: + str = Lang.dialog(player, 11); + break; + default: + str = Lang.dialog(player, 12); + break; + } + } + } + else if (Main.gameTime.bloodMoon) + { + if (flag2 && flag7 && Main.rand.Next(3) == 0) + { + str = Lang.dialog(player, 13); + } + else + { + switch (Main.rand.Next(4)) + { + case 0: + str = Lang.dialog(player, 14); + break; + case 1: + str = Lang.dialog(player, 15); + break; + case 2: + str = Lang.dialog(player, 16); + break; + default: + str = Lang.dialog(player, 17); + break; + } + } + } + else if ((double) Main.gameTime.time < 9720.0) + str = Main.rand.Next(2) != 0 ? Lang.dialog(player, 19) : Lang.dialog(player, 18); + else if ((double) Main.gameTime.time > 22680.0) + { + str = Main.rand.Next(2) != 0 ? Lang.dialog(player, 21) : Lang.dialog(player, 20); + } + else + { + switch (Main.rand.Next(3)) + { + case 0: + str = Lang.dialog(player, 22); + break; + case 1: + str = Lang.dialog(player, 23); + break; + default: + str = Lang.dialog(player, 24); + break; + } + } + } + else if ((int) this.type == 18) + { + if (Main.gameTime.bloodMoon) + { + if ((double) player.statLife < (double) player.statLifeMax * 0.66) + { + switch (Main.rand.Next(3)) + { + case 0: + str = Lang.dialog(player, 25); + break; + case 1: + str = Lang.dialog(player, 26); + break; + default: + str = Lang.dialog(player, 27); + break; + } + } + else + { + switch (Main.rand.Next(4)) + { + case 0: + str = Lang.dialog(player, 28); + break; + case 1: + str = Lang.dialog(player, 29); + break; + case 2: + str = Lang.dialog(player, 30); + break; + default: + str = Lang.dialog(player, 31); + break; + } + } + } + else if (Main.rand.Next(3) == 0 && !NPC.downedBoss3) + str = Lang.dialog(player, 32); + else if (flag6 && Main.rand.Next(4) == 0) + str = Lang.dialog(player, 33); + else if (flag3 && Main.rand.Next(4) == 0) + str = Lang.dialog(player, 34); + else if (flag9 && Main.rand.Next(4) == 0) + str = Lang.dialog(player, 35); + else if ((double) player.statLife < (double) player.statLifeMax * 0.33) + { + switch (Main.rand.Next(5)) + { + case 0: + str = Lang.dialog(player, 36); + break; + case 1: + str = Lang.dialog(player, 37); + break; + case 2: + str = Lang.dialog(player, 38); + break; + case 3: + str = Lang.dialog(player, 39); + break; + default: + str = Lang.dialog(player, 40); + break; + } + } + else if ((double) player.statLife < (double) player.statLifeMax * 0.66) + { + switch (Main.rand.Next(7)) + { + case 0: + str = Lang.dialog(player, 41); + break; + case 1: + str = Lang.dialog(player, 42); + break; + case 2: + str = Lang.dialog(player, 43); + break; + case 3: + str = Lang.dialog(player, 44); + break; + case 4: + str = Lang.dialog(player, 45); + break; + case 5: + str = Lang.dialog(player, 46); + break; + default: + str = Lang.dialog(player, 47); + break; + } + } + else + { + switch (Main.rand.Next(4)) + { + case 0: + str = Lang.dialog(player, 48); + break; + case 1: + str = Lang.dialog(player, 49); + break; + case 2: + str = Lang.dialog(player, 50); + break; + default: + str = Lang.dialog(player, 51); + break; + } + } + } + else if ((int) this.type == 19) + { + if (NPC.downedBoss3 && !Main.hardMode) + str = Lang.dialog(player, 58); + else if (flag2 && Main.rand.Next(5) == 0) + str = Lang.dialog(player, 59); + else if (flag2 && Main.rand.Next(5) == 0) + str = Lang.dialog(player, 60); + else if (flag4 && Main.rand.Next(5) == 0) + str = Lang.dialog(player, 61); + else if (flag6 && Main.rand.Next(5) == 0) + str = Lang.dialog(player, 62); + else if (flag6 && Main.rand.Next(5) == 0) + str = Lang.dialog(player, 63); + else if (Main.gameTime.bloodMoon) + { + str = Main.rand.Next(2) != 0 ? Lang.dialog(player, 65) : Lang.dialog(player, 64); + } + else + { + switch (Main.rand.Next(3)) + { + case 0: + str = Lang.dialog(player, 66); + break; + case 1: + str = Lang.dialog(player, 67); + break; + default: + str = Lang.dialog(player, 68); + break; + } + } + } + else if ((int) this.type == 20) + { + if (!NPC.downedBoss2 && Main.rand.Next(3) == 0) + str = Lang.dialog(player, 69); + else if (flag3 && Main.rand.Next(4) == 0) + str = Lang.dialog(player, 70); + else if (flag1 && Main.rand.Next(4) == 0) + str = Lang.dialog(player, 71); + else if (flag5 && Main.rand.Next(4) == 0) + str = Lang.dialog(player, 72); + else if (Main.gameTime.bloodMoon) + { + switch (Main.rand.Next(4)) + { + case 0: + str = Lang.dialog(player, 73); + break; + case 1: + str = Lang.dialog(player, 74); + break; + case 2: + str = Lang.dialog(player, 75); + break; + default: + str = Lang.dialog(player, 76); + break; + } + } + else + { + switch (Main.rand.Next(5)) + { + case 0: + str = Lang.dialog(player, 77); + break; + case 1: + str = Lang.dialog(player, 78); + break; + case 2: + str = Lang.dialog(player, 79); + break; + case 3: + str = Lang.dialog(player, 80); + break; + default: + str = Lang.dialog(player, 81); + break; + } + } + } + else if ((int) this.type == 37) + { + if (Main.gameTime.dayTime) + { + switch (Main.rand.Next(3)) + { + case 0: + str = Lang.dialog(player, 82); + break; + case 1: + str = Lang.dialog(player, 83); + break; + default: + str = Lang.dialog(player, 84); + break; + } + } + else if ((int) player.statLifeMax < 300 || (int) player.statDefense < 10) + { + switch (Main.rand.Next(4)) + { + case 0: + str = Lang.dialog(player, 85); + break; + case 1: + str = Lang.dialog(player, 86); + break; + case 2: + str = Lang.dialog(player, 87); + break; + default: + str = Lang.dialog(player, 88); + break; + } + } + else + { + switch (Main.rand.Next(4)) + { + case 0: + str = Lang.dialog(player, 89); + break; + case 1: + str = Lang.dialog(player, 90); + break; + case 2: + str = Lang.dialog(player, 91); + break; + default: + str = Lang.dialog(player, 92); + break; + } + } + } + else if ((int) this.type == 38) + { + if (!NPC.downedBoss2 && Main.rand.Next(3) == 0) + Lang.dialog(player, 93); + if (Main.gameTime.bloodMoon) + { + switch (Main.rand.Next(3)) + { + case 0: + str = Lang.dialog(player, 94); + break; + case 1: + str = Lang.dialog(player, 95); + break; + default: + str = Lang.dialog(player, 96); + break; + } + } + else if (flag3 && Main.rand.Next(5) == 0) + str = Lang.dialog(player, 97); + else if (flag3 && Main.rand.Next(5) == 0) + str = Lang.dialog(player, 98); + else if (flag2 && Main.rand.Next(4) == 0) + str = Lang.dialog(player, 99); + else if (flag4 && Main.rand.Next(4) == 0) + str = Lang.dialog(player, 100); + else if (!Main.gameTime.dayTime) + { + switch (Main.rand.Next(4)) + { + case 0: + str = Lang.dialog(player, 101); + break; + case 1: + str = Lang.dialog(player, 102); + break; + case 2: + str = Lang.dialog(player, 103); + break; + default: + str = Lang.dialog(player, 104); + break; + } + } + else + { + switch (Main.rand.Next(5)) + { + case 0: + str = Lang.dialog(player, 105); + break; + case 1: + str = Lang.dialog(player, 106); + break; + case 2: + str = Lang.dialog(player, 107); + break; + case 3: + str = Lang.dialog(player, 108); + break; + default: + str = Lang.dialog(player, 109); + break; + } + } + } + else if ((int) this.type == 54) + { + if (!flag7 && Main.rand.Next(2) == 0) + str = Lang.dialog(player, 110); + else if (Main.gameTime.bloodMoon) + str = Lang.dialog(player, 111); + else if (flag2 && Main.rand.Next(4) == 0) + str = Lang.dialog(player, 112); + else if ((int) player.head == 24) + { + str = Lang.dialog(player, 113); + } + else + { + switch (Main.rand.Next(6)) + { + case 0: + str = Lang.dialog(player, 114); + break; + case 1: + str = Lang.dialog(player, 115); + break; + case 2: + str = Lang.dialog(player, 116); + break; + case 3: + str = Lang.dialog(player, 117); + break; + case 4: + str = Lang.dialog(player, 118); + break; + default: + str = Lang.dialog(player, 119); + break; + } + } + } + else if ((int) this.type == 105) + str = Lang.dialog(player, 120); + else if ((int) this.type == 107) + { + if (this.homeless) + { + switch (Main.rand.Next(5)) + { + case 0: + str = Lang.dialog(player, 121); + break; + case 1: + str = Lang.dialog(player, 122); + break; + case 2: + str = Lang.dialog(player, 123); + break; + case 3: + str = Lang.dialog(player, 124); + break; + default: + str = Lang.dialog(player, 125); + break; + } + } + else if (flag7 && Main.rand.Next(4) == 0) + str = Lang.dialog(player, 126); + else if (!Main.gameTime.dayTime) + { + switch (Main.rand.Next(5)) + { + case 0: + str = Lang.dialog(player, (int) sbyte.MaxValue); + break; + case 1: + str = Lang.dialog(player, 128); + break; + case 2: + str = Lang.dialog(player, 129); + break; + case 3: + str = Lang.dialog(player, 130); + break; + default: + str = Lang.dialog(player, 131); + break; + } + } + else + { + switch (Main.rand.Next(5)) + { + case 0: + str = Lang.dialog(player, 132); + break; + case 1: + str = Lang.dialog(player, 133); + break; + case 2: + str = Lang.dialog(player, 134); + break; + case 3: + str = Lang.dialog(player, 135); + break; + default: + str = Lang.dialog(player, 136); + break; + } + } + } + else if ((int) this.type == 106) + str = Lang.dialog(player, 137); + else if ((int) this.type == 108) + { + if (this.homeless) + { + int num = Main.rand.Next(3); + if (num == 0) + str = Lang.dialog(player, 138); + else if (num == 1 && !player.male) + str = Lang.dialog(player, 139); + else if (num == 1) + str = Lang.dialog(player, 140); + else if (num == 2) + str = Lang.dialog(player, 141); + } + else if (player.male && flag9 && Main.rand.Next(6) == 0) + str = Lang.dialog(player, 142); + else if (player.male && flag6 && Main.rand.Next(6) == 0) + str = Lang.dialog(player, 143); + else if (player.male && flag8 && Main.rand.Next(6) == 0) + str = Lang.dialog(player, 144); + else if (!player.male && flag2 && Main.rand.Next(6) == 0) + str = Lang.dialog(player, 145); + else if (!player.male && flag7 && Main.rand.Next(6) == 0) + str = Lang.dialog(player, 146); + else if (!player.male && flag4 && Main.rand.Next(6) == 0) + str = Lang.dialog(player, 147); + else if (!Main.gameTime.dayTime) + { + switch (Main.rand.Next(3)) + { + case 0: + str = Lang.dialog(player, 148); + break; + case 1: + str = Lang.dialog(player, 149); + break; + case 2: + str = Lang.dialog(player, 150); + break; + } + } + else + { + switch (Main.rand.Next(5)) + { + case 0: + str = Lang.dialog(player, 151); + break; + case 1: + str = Lang.dialog(player, 152); + break; + case 2: + str = Lang.dialog(player, 153); + break; + case 3: + str = Lang.dialog(player, 154); + break; + default: + str = Lang.dialog(player, 155); + break; + } + } + } + else if ((int) this.type == 123) + str = Lang.dialog(player, 156); + else if ((int) this.type == 124) + { + if (this.homeless) + { + switch (Main.rand.Next(4)) + { + case 0: + str = Lang.dialog(player, 157); + break; + case 1: + str = Lang.dialog(player, 158); + break; + case 2: + str = Lang.dialog(player, 159); + break; + default: + str = Lang.dialog(player, 160); + break; + } + } + else if (Main.gameTime.bloodMoon) + { + switch (Main.rand.Next(4)) + { + case 0: + str = Lang.dialog(player, 161); + break; + case 1: + str = Lang.dialog(player, 162); + break; + case 2: + str = Lang.dialog(player, 163); + break; + default: + str = Lang.dialog(player, 164); + break; + } + } + else if (flag8 && Main.rand.Next(6) == 0) + str = Lang.dialog(player, 165); + else if (flag3 && Main.rand.Next(6) == 0) + { + str = Lang.dialog(player, 166); + } + else + { + switch (Main.rand.Next(3)) + { + case 0: + str = Lang.dialog(player, 167); + break; + case 1: + str = Lang.dialog(player, 168); + break; + default: + str = Lang.dialog(player, 169); + break; + } + } + } + else if ((int) this.type == 22) + { + if (Main.gameTime.bloodMoon) + { + switch (Main.rand.Next(3)) + { + case 0: + str = Lang.dialog(player, 170); + break; + case 1: + str = Lang.dialog(player, 171); + break; + default: + str = Lang.dialog(player, 172); + break; + } + } + else if (!Main.gameTime.dayTime) + { + str = Lang.dialog(player, 173); + } + else + { + switch (Main.rand.Next(3)) + { + case 0: + str = Lang.dialog(player, 174); + break; + case 1: + str = Lang.dialog(player, 175); + break; + default: + str = Lang.dialog(player, 176); + break; + } + } + } + else if ((int) this.type == 142) + { + switch (Main.rand.Next(3)) + { + case 0: + str = Lang.dialog(player, 224); + break; + case 1: + str = Lang.dialog(player, 225); + break; + case 2: + str = Lang.dialog(player, 226); + break; + } + } + return str; + } + + public static void checkForTownSpawns() + { + if ((int) ++NPC.checkForSpawnsTimer < 7200) + return; + NPC.checkForSpawnsTimer = (short) 0; + int num1 = 0; + for (int index = 0; index < 8; ++index) + { + if ((int) Main.player[index].active != 0) + ++num1; + } + WorldGen.spawnNPC = 0; + int num2 = 0; + int num3 = 0; + int num4 = 0; + int num5 = 0; + int num6 = 0; + int num7 = 0; + int num8 = 0; + int num9 = 0; + int num10 = 0; + int num11 = 0; + int num12 = 0; + int num13 = 0; + int num14 = 0; + bool flag1 = true; + for (int npc = 0; npc < 196; ++npc) + { + if ((int) Main.npc[npc].active != 0 && Main.npc[npc].townNPC) + { + if ((int) Main.npc[npc].type != 37 && !Main.npc[npc].homeless) + WorldGen.QuickFindHome(npc); + bool flag2 = Main.npc[npc].homeless; + if ((int) Main.npc[npc].type == 37) + { + ++num7; + flag2 = false; + } + else if ((int) Main.npc[npc].type == 17) + ++num2; + else if ((int) Main.npc[npc].type == 18) + ++num3; + else if ((int) Main.npc[npc].type == 19) + ++num5; + else if ((int) Main.npc[npc].type == 20) + ++num4; + else if ((int) Main.npc[npc].type == 22) + ++num6; + else if ((int) Main.npc[npc].type == 38) + ++num8; + else if ((int) Main.npc[npc].type == 54) + ++num9; + else if ((int) Main.npc[npc].type == 107) + ++num11; + else if ((int) Main.npc[npc].type == 108) + ++num10; + else if ((int) Main.npc[npc].type == 124) + ++num12; + else if ((int) Main.npc[npc].type == 142) + { + ++num13; + flag2 = false; + } + flag1 = flag1 && !flag2; + ++num14; + } + } + if (WorldGen.spawnNPC != 0) + return; + int num15 = 0; + bool flag3 = false; + int num16 = 0; + bool flag4 = false; + bool flag5 = false; + for (int index1 = 0; index1 < 8; ++index1) + { + if ((int) Main.player[index1].active != 0) + { + for (int index2 = 0; index2 < 48; ++index2) + { + if ((int) Main.player[index1].inventory[index2].type > 0 && (int) Main.player[index1].inventory[index2].stack > 0) + { + if ((int) Main.player[index1].inventory[index2].type == 71) + num15 += (int) Main.player[index1].inventory[index2].stack; + else if ((int) Main.player[index1].inventory[index2].type == 72) + num15 += (int) Main.player[index1].inventory[index2].stack * 100; + else if ((int) Main.player[index1].inventory[index2].type == 73) + num15 += (int) Main.player[index1].inventory[index2].stack * 10000; + else if ((int) Main.player[index1].inventory[index2].type == 74) + num15 += (int) Main.player[index1].inventory[index2].stack * 1000000; + if ((int) Main.player[index1].inventory[index2].ammo == 14 || (int) Main.player[index1].inventory[index2].useAmmo == 14) + flag4 = true; + if ((int) Main.player[index1].inventory[index2].type == 166 || (int) Main.player[index1].inventory[index2].type == 167 || ((int) Main.player[index1].inventory[index2].type == 168 || (int) Main.player[index1].inventory[index2].type == 235)) + flag5 = true; + } + } + int num17 = (int) Main.player[index1].statLifeMax / 20; + if (num17 > 5) + flag3 = true; + num16 += num17; + } + } + if (!NPC.downedBoss3 && num7 == 0) + { + int index = NPC.NewNPC((int) Main.dungeonX * 16 + 8, (int) Main.dungeonY * 16, 37, 0); + Main.npc[index].homeless = false; + Main.npc[index].homeTileX = Main.dungeonX; + Main.npc[index].homeTileY = Main.dungeonY; + } + if (num6 < 1) + WorldGen.spawnNPC = 22; + else if ((double) num15 > 5000.0 && num2 < 1) + WorldGen.spawnNPC = 17; + else if (flag3 && num3 < 1) + WorldGen.spawnNPC = 18; + else if (flag4 && num5 < 1) + WorldGen.spawnNPC = 19; + else if ((NPC.downedBoss1 || NPC.downedBoss2 || NPC.downedBoss3) && num4 < 1) + WorldGen.spawnNPC = 20; + else if (flag5 && num2 > 0 && num8 < 1) + WorldGen.spawnNPC = 38; + else if (NPC.downedBoss3 && num9 < 1) + WorldGen.spawnNPC = 54; + else if (NPC.savedGoblin && num11 < 1) + WorldGen.spawnNPC = 107; + else if (NPC.savedWizard && num10 < 1) + WorldGen.spawnNPC = 108; + else if (NPC.savedMech && num12 < 1) + { + WorldGen.spawnNPC = 124; + } + else + { + if (!NPC.downedFrost || num13 >= 1 || !Time.xMas) + return; + WorldGen.spawnNPC = 142; + } + } + + public void ApplyProjectileBuff(int type) + { + if (type == 2) + { + if (Main.rand.Next(3) != 0) + return; + this.AddBuff(24, 180, false); + } + else if (type == 15) + { + if (Main.rand.Next(2) != 0) + return; + this.AddBuff(24, 300, false); + } + else if (type == 19) + { + if (Main.rand.Next(5) != 0) + return; + this.AddBuff(24, 180, false); + } + else if (type == 33) + { + if (Main.rand.Next(5) != 0) + return; + this.AddBuff(20, 420, false); + } + else if (type == 34) + { + if (Main.rand.Next(2) != 0) + return; + this.AddBuff(24, 240, false); + } + else if (type == 35) + { + if (Main.rand.Next(4) != 0) + return; + this.AddBuff(24, 180, false); + } + else if (type == 54) + { + if (Main.rand.Next(2) != 0) + return; + this.AddBuff(20, 600, false); + } + else if (type == 63) + { + if (Main.rand.Next(3) == 0) + return; + this.AddBuff(31, 120, false); + } + else if (type == 85) + this.AddBuff(24, 1200, false); + else if (type == 95 || type == 103 || (type == 104 || type == 113)) + { + this.AddBuff(39, 420, false); + } + else + { + if (type != 98) + return; + this.AddBuff(20, 600, false); + } + } + + public void ApplyWeaponBuff(int type) + { + if (type == 121) + { + if (Main.rand.Next(2) != 0) + return; + this.AddBuff(24, 180, false); + } + else if (type == 122) + { + if (Main.rand.Next(10) != 0) + return; + this.AddBuff(24, 180, false); + } + else if (type == 190 || type == 614) + { + if (Main.rand.Next(4) != 0) + return; + this.AddBuff(20, 420, false); + } + else if (type == 217) + { + if (Main.rand.Next(5) != 0) + return; + this.AddBuff(24, 180, false); + } + else + { + if (type != 613 || Main.rand.Next(5) != 0) + return; + this.AddBuff(30, 600, false); + } + } + + public object Clone() + { + return this.MemberwiseClone(); + } + + public void DrawInfo(WorldView view) + { + if (this.realLife >= 0 && this.realLife != (int) this.whoAmI) + { + if (!view.drawNpcName[this.realLife]) + return; + Main.npc[this.realLife].DrawInfo(view); + } + else + { + view.drawNpcName[(int) this.whoAmI] = false; + string s = !this.hasName() ? this.displayName : this.getName(); + int x = this.aabb.X + ((int) this.width >> 1) - view.screenPosition.X; + int y = this.aabb.Y + (int) this.height - view.screenPosition.Y - 10; + int num1 = y + (int) UI.DrawStringCT(UI.fontSmall, s, x, y, UI.mouseTextColor); + if (this.lifeMax <= 1 || this.dontTakeDamage) + return; + int num2 = this.life - this.healthBarLife; + if (num2 != 0) + { + if (Math.Abs(num2) > 1) + this.healthBarLife += num2 >> 2; + else + this.healthBarLife = this.life; + } + Rectangle rect = new Rectangle(); + rect.X = x - 22; + rect.Y = num1 - 4; + rect.Height = 10; + rect.Width = 52; + Color color = UI.WINDOW_OUTLINE; + Main.DrawRect(rect, color, false); + rect.X += 2; + rect.Y += 2; + rect.Width = this.healthBarLife * 48 / this.lifeMax; + rect.Height = 6; + color = new Color((48 - rect.Width) * 5, rect.Width * 5, 16, 128); + Main.DrawSolidRect(ref rect, color); + if (rect.Width >= 48) + return; + color = new Color(0, 0, 0, 128); + rect.X += rect.Width; + rect.Width = 48 - rect.Width; + Main.DrawSolidRect(ref rect, color); + } + } + + public enum ID + { + NONE, + SLIME, + DEMON_EYE, + ZOMBIE, + EYE_OF_CTHULHU, + SERVANT_OF_CTHULHU, + EATER_OF_SOULS, + DEVOURER_HEAD, + DEVOURER_BODY, + DEVOURER_TAIL, + GIANT_WORM_HEAD, + GIANT_WORM_BODY, + GIANT_WORM_TAIL, + EATER_OF_WORLDS_HEAD, + EATER_OF_WORLDS_BODY, + EATER_OF_WORLDS_TAIL, + MOTHER_SLIME, + MERCHANT, + NURSE, + ARMS_DEALER, + DRYAD, + SKELETON, + GUIDE, + METEOR_HEAD, + FIRE_IMP, + BURNING_SPHERE, + GOBLIN_PEON, + GOBLIN_THIEF, + GOBLIN_WARRIOR, + GOBLIN_SORCERER, + CHAOS_BALL, + BONES, + DARK_CASTER, + WATER_SPHERE, + CURSED_SKULL, + SKELETRON_HEAD, + SKELETRON_HAND, + OLD_MAN, + DEMOLITIONIST, + BONE_SERPENT_HEAD, + BONE_SERPENT_BODY, + BONE_SERPENT_TAIL, + HORNET, + MAN_EATER, + UNDEAD_MINER, + TIM, + BUNNY, + CORRUPT_BUNNY, + HARPY, + CAVE_BAT, + KING_SLIME, + JUNGLE_BAT, + DOCTOR_BONES, + THE_GROOM, + CLOTHIER, + GOLDFISH, + SNATCHER, + CORRUPT_GOLDFISH, + PIRANHA, + LAVA_SLIME, + HELLBAT, + VULTURE, + DEMON, + BLUE_JELLYFISH, + PINK_JELLYFISH, + SHARK, + VOODOO_DEMON, + CRAB, + DUNGEON_GUARDIAN, + ANTLION, + SPIKE_BALL, + DUNGEON_SLIME, + BLAZING_WHEEL, + GOBLIN_SCOUT, + BIRD, + PIXIE, + XXX_UNUSED_XXX, + ARMORED_SKELETON, + MUMMY, + DARK_MUMMY, + LIGHT_MUMMY, + CORRUPT_SLIME, + WRAITH, + CURSED_HAMMER, + ENCHANTED_SWORD, + MIMIC, + UNICORN, + WYVERN_HEAD, + WYVERN_LEGS, + WYVERN_BODY1, + WYVERN_BODY2, + WYVERN_BODY3, + WYVERN_TAIL, + GIANT_BAT, + CORRUPTOR, + DIGGER_HEAD, + DIGGER_BODY, + DIGGER_TAIL, + SEEKER_HEAD, + SEEKER_BODY, + SEEKER_TAIL, + CLINGER, + ANGLER_FISH, + GREEN_JELLYFISH, + WEREWOLF, + BOUND_GOBLIN, + BOUND_WIZARD, + GOBLIN_TINKERER, + WIZARD, + CLOWN, + SKELETON_ARCHER, + GOBLIN_ARCHER, + VILE_SPIT, + WALL_OF_FLESH, + WALL_OF_FLESH_EYE, + THE_HUNGRY, + THE_HUNGRY_II, + LEECH_HEAD, + LEECH_BODY, + LEECH_TAIL, + CHAOS_ELEMENTAL, + SLIMER, + GASTROPOD, + BOUND_MECHANIC, + MECHANIC, + RETINAZER, + SPAZMATISM, + SKELETRON_PRIME, + PRIME_CANNON, + PRIME_SAW, + PRIME_VICE, + PRIME_LASER, + BALD_ZOMBIE, + WANDERING_EYE, + THE_DESTROYER_HEAD, + THE_DESTROYER_BODY, + THE_DESTROYER_TAIL, + ILLUMINANT_BAT, + ILLUMINANT_SLIME, + PROBE, + POSSESSED_ARMOR, + TOXIC_SLUDGE, + SANTA_CLAUS, + SNOWMAN_GANGSTA, + MISTER_STABBY, + SNOW_BALLA, + SUICIDE_SNOWMAN, + ALBINO_ANTLION, + ORKA, + VAMPIRE_MINER, + SHADOW_SLIME, + SHADOW_HAMMER, + SHADOW_MUMMY, + SPECTRAL_GASTROPOD, + SPECTRAL_ELEMENTAL, + SPECTRAL_MUMMY, + DRAGON_SNATCHER, + DRAGON_HORNET, + DRAGON_SKULL, + ARCH_WYVERN_HEAD, + ARCH_WYVERN_LEGS, + ARCH_WYVERN_BODY1, + ARCH_WYVERN_BODY2, + ARCH_WYVERN_BODY3, + ARCH_WYVERN_TAIL, + ARCH_DEMON, + OCRAM, + SERVANT_OF_OCRAM, + NUM_TYPES, + } + } +} diff --git a/Terraria/NetClient.cs b/Terraria/NetClient.cs new file mode 100644 index 0000000..9b90b27 --- /dev/null +++ b/Terraria/NetClient.cs @@ -0,0 +1,176 @@ +// Type: Terraria.NetClient +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Net; +using System.Collections.ObjectModel; + +namespace Terraria +{ + public sealed class NetClient + { + public NetworkMachine machine; + public NetworkGamer gamer; + public short serverState; + private bool isPublicSlotRequest; + public bool[] playerSlots; + public bool[,] tileSection; + + public NetClient(NetworkGamer g) + { + this.machine = g.Machine; + this.gamer = g; + this.serverState = (short) 0; + this.isPublicSlotRequest = false; + this.playerSlots = new bool[16]; + this.tileSection = new bool[(int) sbyte.MaxValue, 49]; + } + + public void RequestedPublicSlot() + { + --Netplay.session.PrivateGamerSlots; + this.isPublicSlotRequest = true; + } + + public void CanceledPublicSlot() + { + ++Netplay.session.PrivateGamerSlots; + this.isPublicSlotRequest = false; + } + + public void GamerJoined(Player player) + { + player.client = this; + int index = (int) player.whoAmI; + this.playerSlots[index] = true; + this.playerSlots[index + 8] = this.isPublicSlotRequest; + this.isPublicSlotRequest = false; + } + + public bool GamerLeft(Player player) + { + int index = (int) player.whoAmI; + this.playerSlots[index] = false; + if (this.playerSlots[index + 8]) + { + this.playerSlots[index + 8] = false; + ++Netplay.session.PrivateGamerSlots; + } + player.client = (NetClient) null; + return ((ReadOnlyCollection) this.machine.Gamers).Count == 0; + } + + public void ResetSections() + { + for (int index1 = 0; index1 < Main.maxSectionsX; ++index1) + { + for (int index2 = 0; index2 < Main.maxSectionsY; ++index2) + this.tileSection[index1, index2] = false; + } + } + + public void ResetSections(ref Vector2i min, ref Vector2i max) + { + int num1 = min.X / 40; + int num2 = min.Y / 30; + int num3 = max.X / 40; + int num4 = max.Y / 30; + for (int index1 = num1; index1 <= num3; ++index1) + { + for (int index2 = num2; index2 <= num4; ++index2) + this.tileSection[index1, index2] = false; + } + } + + public bool SectionRange(int size, int firstX, int firstY) + { + int index1 = firstX / 40; + int index2 = firstY / 30; + if (this.tileSection[index1, index2]) + return true; + int index3 = (firstY + size) / 30; + if (this.tileSection[index1, index3]) + return true; + int index4 = (firstX + size) / 40; + if (this.tileSection[index4, index2]) + return true; + else + return this.tileSection[index4, index3]; + } + + public bool IsReadyToReceive(byte[] packet) + { + if ((int) this.serverState < 10) + return false; + byte num = packet[0]; + if ((uint) num <= 20U) + { + if ((int) num != 13) + { + if ((int) num == 20) + return this.SectionRange((int) packet[1], (int) packet[2] | (int) packet[3] << 8, (int) packet[4] | (int) packet[5] << 8); + } + else + { + Player player1 = Main.player[(int) packet[1] & 7]; + if ((int) player1.netSkip == 0) + return true; + Rectangle rectangle = player1.aabb; + rectangle.X -= 2500; + rectangle.Y -= 2500; + rectangle.Width += 5000; + rectangle.Height += 5000; + for (int index = ((ReadOnlyCollection) this.machine.Gamers).Count - 1; index >= 0; --index) + { + Player player2 = ((ReadOnlyCollection) this.machine.Gamers)[index].Tag as Player; + if (rectangle.Intersects(player2.aabb)) + return true; + } + return false; + } + } + else if ((int) num == 23 || (int) num == 28) + { + NPC npc = Main.npc[(int) packet[1]]; + if (npc.life <= 0 || npc.townNPC) + return true; + Rectangle rectangle = npc.aabb; + rectangle.X -= 3000; + rectangle.Y -= 3000; + rectangle.Width += 6000; + rectangle.Height += 6000; + for (int index = ((ReadOnlyCollection) this.machine.Gamers).Count - 1; index >= 0; --index) + { + Player player = ((ReadOnlyCollection) this.machine.Gamers)[index].Tag as Player; + if (rectangle.Intersects(player.aabb)) + return true; + } + return false; + } + return true; + } + + public bool IsReadyToReceiveProjectile(ref Projectile projectile) + { + if ((int) this.serverState == 10) + { + if ((int) projectile.type == 12) + return true; + Rectangle rectangle = projectile.aabb; + rectangle.X -= 5000; + rectangle.Y -= 5000; + rectangle.Width += 10000; + rectangle.Height += 10000; + for (int index = ((ReadOnlyCollection) this.machine.Gamers).Count - 1; index >= 0; --index) + { + Player player = ((ReadOnlyCollection) this.machine.Gamers)[index].Tag as Player; + if (rectangle.Intersects(player.aabb)) + return true; + } + } + return false; + } + } +} diff --git a/Terraria/NetMessage.cs b/Terraria/NetMessage.cs new file mode 100644 index 0000000..8b4183d --- /dev/null +++ b/Terraria/NetMessage.cs @@ -0,0 +1,2596 @@ +// Type: Terraria.NetMessage +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.GamerServices; +using Microsoft.Xna.Framework.Graphics.PackedVector; +using Microsoft.Xna.Framework.Net; +using System; +using System.Collections.ObjectModel; +using System.IO; +using Terraria.Achievements; + +namespace Terraria +{ + public sealed class NetMessage + { + private static PacketWriter packetOut = new PacketWriter(65536); + public static PacketReader packetIn = new PacketReader(65536); + private static readonly byte[] PRIORITY = new byte[68] + { + (byte) 1, + (byte) 1, + (byte) 1, + (byte) 1, + (byte) 1, + (byte) 1, + (byte) 1, + (byte) 1, + (byte) 1, + (byte) 1, + (byte) 1, + (byte) 1, + (byte) 1, + (byte) 3, + (byte) 1, + (byte) 1, + (byte) 3, + (byte) 1, + (byte) 1, + (byte) 1, + (byte) 1, + (byte) 1, + (byte) 1, + (byte) 2, + (byte) 1, + (byte) 1, + (byte) 1, + (byte) 0, + (byte) 1, + (byte) 1, + (byte) 1, + (byte) 1, + (byte) 1, + (byte) 1, + (byte) 1, + (byte) 1, + (byte) 0, + (byte) 1, + (byte) 1, + (byte) 3, + (byte) 1, + (byte) 2, + (byte) 2, + (byte) 1, + (byte) 1, + (byte) 1, + (byte) 1, + (byte) 1, + (byte) 1, + (byte) 1, + (byte) 1, + (byte) 0, + (byte) 1, + (byte) 1, + (byte) 1, + (byte) 1, + (byte) 1, + (byte) 1, + (byte) 0, + (byte) 1, + (byte) 1, + (byte) 1, + (byte) 1, + (byte) 1, + (byte) 1, + (byte) 1, + (byte) 1, + (byte) 1 + }; + + static NetMessage() + { + } + + public static void CheckBytesServer() + { + LocalNetworkGamer localNetworkGamer = Netplay.gamer; + if (localNetworkGamer == null) + return; + lock (NetMessage.packetIn) + { + while (localNetworkGamer.IsDataAvailable) + { + NetworkGamer local_1; + localNetworkGamer.ReceiveData(NetMessage.packetIn, out local_1); + NetMessage.GetData((local_1.Tag as Player).client); + } + } + } + + public static void CheckBytesClient() + { + for (int index = Netplay.gamersWaitingForPlayerId.Count - 1; index >= 0; --index) + { + UI ui = Netplay.gamersWaitingForPlayerId[index]; + if (ui.localGamer.IsDataAvailable) + { + lock (NetMessage.packetIn) + { + NetworkGamer local_2; + ui.localGamer.ReceiveData(NetMessage.packetIn, out local_2); + int local_3 = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + int local_3_1 = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + ui.JoinSession(local_3_1); + ui.localGamer.Tag = (object) Main.player[local_3_1]; + NetMessage.SendHello(local_3_1); + Netplay.gamersWaitingForPlayerId.RemoveAt(index); + Netplay.gamersWaitingToSendSpawn.Add(ui); + if (Netplay.clientState <= Netplay.ClientState.WAITING_FOR_PLAYER_ID) + Netplay.clientState = Netplay.ClientState.WAITING_FOR_PLAYER_DATA_REQ; + } + } + } + if (Netplay.gamersWaitingToSendSpawn.Count > 0 && Netplay.clientState >= Netplay.ClientState.ANNOUNCING_SPAWN_LOCATION) + { + UI ui = Netplay.gamersWaitingToSendSpawn[0]; + Netplay.gamersWaitingToSendSpawn.RemoveAt(0); + ui.player.FindSpawn(); + NetMessage.CreateMessage3(8, (int) ui.myPlayer, ui.player.SpawnX, ui.player.SpawnY); + NetMessage.SendMessage(); + if (Netplay.clientState == Netplay.ClientState.ANNOUNCING_SPAWN_LOCATION) + Netplay.clientState = Netplay.ClientState.WAITING_FOR_TILE_DATA; + } + else if (Netplay.gamersWaitingToSpawn.Count > 0 && Netplay.clientState >= Netplay.ClientState.PLAYING) + { + Main.JoinGame(Netplay.gamersWaitingToSpawn[0]); + Netplay.gamersWaitingToSpawn.RemoveAt(0); + } + LocalNetworkGamer localNetworkGamer = Netplay.gamer; + if (localNetworkGamer == null) + return; + lock (NetMessage.packetIn) + { + while (localNetworkGamer.IsDataAvailable) + { + NetworkGamer local_6; + localNetworkGamer.ReceiveData(NetMessage.packetIn, out local_6); + NetMessage.GetData((NetClient) null); + } + } + } + + private static void WriteCompacted(uint value) + { + if (value < 128U) + { + ((BinaryWriter) NetMessage.packetOut).Write((byte) value); + } + else + { + uint num = (uint) ((int) value & (int) sbyte.MaxValue | 128 | (int) (value >> 7) << 8); + if (value < 16384U) + { + ((BinaryWriter) NetMessage.packetOut).Write((ushort) num); + } + else + { + ((BinaryWriter) NetMessage.packetOut).Write((ushort) ((int) num & (int) short.MaxValue | 32768)); + value >>= 14; + ((BinaryWriter) NetMessage.packetOut).Write((byte) value); + } + } + } + + private static uint ReadCompacted() + { + uint num = (uint) ((BinaryReader) NetMessage.packetIn).ReadByte(); + if (num >= 128U) + { + num = num & (uint) sbyte.MaxValue | (uint) ((BinaryReader) NetMessage.packetIn).ReadByte() << 7; + if (num >= 16384U) + num = num & 16383U | (uint) ((BinaryReader) NetMessage.packetIn).ReadByte() << 14; + } + return num; + } + + public static void CreateMessage0(int msgType) + { + ((BinaryWriter) NetMessage.packetOut).Write((byte) msgType); + switch (msgType) + { + case 57: + ((BinaryWriter) NetMessage.packetOut).Write(WorldGen.tGood); + ((BinaryWriter) NetMessage.packetOut).Write(WorldGen.tEvil); + break; + case 7: + ((BinaryWriter) NetMessage.packetOut).Write(Main.gameTime.time); + int num1 = (int) Main.gameTime.moonPhase << 2; + if (Main.gameTime.dayTime) + num1 |= 1; + if (Main.gameTime.bloodMoon) + num1 |= 2; + ((BinaryWriter) NetMessage.packetOut).Write((byte) num1); + ((BinaryWriter) NetMessage.packetOut).Write((ushort) Main.maxTilesX); + ((BinaryWriter) NetMessage.packetOut).Write((ushort) Main.maxTilesY); + ((BinaryWriter) NetMessage.packetOut).Write((ushort) Main.spawnTileX); + ((BinaryWriter) NetMessage.packetOut).Write((ushort) Main.spawnTileY); + ((BinaryWriter) NetMessage.packetOut).Write((ushort) Main.worldSurface); + ((BinaryWriter) NetMessage.packetOut).Write((ushort) Main.rockLayer); + ((BinaryWriter) NetMessage.packetOut).Write(Main.worldID); + ((BinaryWriter) NetMessage.packetOut).Write(Main.worldTimestamp); + int num2 = WorldGen.shadowOrbSmashed ? 1 : 0; + if (NPC.downedBoss1) + num2 |= 2; + if (NPC.downedBoss2) + num2 |= 4; + if (NPC.downedBoss3) + num2 |= 8; + if (Main.hardMode) + num2 |= 16; + if (NPC.downedClown) + num2 |= 32; + ((BinaryWriter) NetMessage.packetOut).Write((byte) num2); + ((BinaryWriter) NetMessage.packetOut).Write(Main.worldName); + break; + case 11: + if (Main.netMode != 2) + break; + GamerCollection allGamers = Netplay.session.AllGamers; + int count = ((ReadOnlyCollection) allGamers).Count; + ((BinaryWriter) NetMessage.packetOut).Write((byte) count); + do + { + Player player = ((ReadOnlyCollection) allGamers)[--count].Tag as Player; + ((BinaryWriter) NetMessage.packetOut).Write(player.whoAmI); + } + while (count > 0); + break; + } + } + + public static void CreateMessage1(int msgType, int number) + { + ((BinaryWriter) NetMessage.packetOut).Write((byte) msgType); + switch (msgType) + { + case 36: + ((BinaryWriter) NetMessage.packetOut).Write((byte) number); + int num1 = 0; + if (Main.player[number].zoneEvil) + num1 = 1; + if (Main.player[number].zoneMeteor) + num1 |= 2; + if (Main.player[number].zoneDungeon) + num1 |= 4; + if (Main.player[number].zoneJungle) + num1 |= 8; + if (Main.player[number].zoneHoly) + num1 |= 16; + ((BinaryWriter) NetMessage.packetOut).Write((byte) num1); + break; + case 40: + ((BinaryWriter) NetMessage.packetOut).Write((byte) number); + ((BinaryWriter) NetMessage.packetOut).Write(Main.player[number].talkNPC); + break; + case 41: + ((BinaryWriter) NetMessage.packetOut).Write((byte) number); + ((BinaryWriter) NetMessage.packetOut).Write(Main.player[number].itemRotation); + ((BinaryWriter) NetMessage.packetOut).Write(Main.player[number].itemAnimation); + break; + case 42: + ((BinaryWriter) NetMessage.packetOut).Write((byte) number); + ((BinaryWriter) NetMessage.packetOut).Write(Main.player[number].statMana); + ((BinaryWriter) NetMessage.packetOut).Write(Main.player[number].statManaMax); + break; + case 45: + ((BinaryWriter) NetMessage.packetOut).Write((byte) (number | (int) Main.player[number].team << 4)); + break; + case 49: + ((BinaryWriter) NetMessage.packetOut).Write((byte) number); + break; + case 50: + ((BinaryWriter) NetMessage.packetOut).Write((byte) number); + for (int index = 0; index < 10; ++index) + ((BinaryWriter) NetMessage.packetOut).Write((byte) Main.player[number].buff[index].Type); + break; + case 51: + ((BinaryWriter) NetMessage.packetOut).Write((byte) number); + break; + case 54: + ((BinaryWriter) NetMessage.packetOut).Write((byte) number); + for (int index = 0; index < 5; ++index) + { + uint num2 = (uint) Main.npc[number].buff[index].Type; + ((BinaryWriter) NetMessage.packetOut).Write((byte) num2); + if (num2 > 0U) + NetMessage.WriteCompacted((uint) Main.npc[number].buff[index].Time); + } + break; + case 56: + ((BinaryWriter) NetMessage.packetOut).Write((byte) number); + ((BinaryWriter) NetMessage.packetOut).Write(NPC.chrName[number]); + break; + case 58: + ((BinaryWriter) NetMessage.packetOut).Write((byte) number); + ((BinaryWriter) NetMessage.packetOut).Write(Main.harpNote); + break; + case 0: + ((BinaryWriter) NetMessage.packetOut).Write((byte) number); + break; + case 1: + ((BinaryWriter) NetMessage.packetOut).Write((byte) 1); + ((BinaryWriter) NetMessage.packetOut).Write((byte) number); + break; + case 2: + ((BinaryWriter) NetMessage.packetOut).Write((ushort) number); + break; + case 3: + ((BinaryWriter) NetMessage.packetOut).Write((byte) number); + break; + case 4: + Player player1 = Main.player[number]; + int num3 = number | (int) player1.hair << 4 | (int) player1.difficulty << 11; + if (player1.male) + num3 |= 1024; + ((BinaryWriter) NetMessage.packetOut).Write((ushort) num3); + ((BinaryWriter) NetMessage.packetOut).Write(player1.hairColor.R); + ((BinaryWriter) NetMessage.packetOut).Write(player1.hairColor.G); + ((BinaryWriter) NetMessage.packetOut).Write(player1.hairColor.B); + ((BinaryWriter) NetMessage.packetOut).Write(player1.skinColor.R); + ((BinaryWriter) NetMessage.packetOut).Write(player1.skinColor.G); + ((BinaryWriter) NetMessage.packetOut).Write(player1.skinColor.B); + ((BinaryWriter) NetMessage.packetOut).Write(player1.eyeColor.R); + ((BinaryWriter) NetMessage.packetOut).Write(player1.eyeColor.G); + ((BinaryWriter) NetMessage.packetOut).Write(player1.eyeColor.B); + ((BinaryWriter) NetMessage.packetOut).Write(player1.shirtColor.R); + ((BinaryWriter) NetMessage.packetOut).Write(player1.shirtColor.G); + ((BinaryWriter) NetMessage.packetOut).Write(player1.shirtColor.B); + ((BinaryWriter) NetMessage.packetOut).Write(player1.underShirtColor.R); + ((BinaryWriter) NetMessage.packetOut).Write(player1.underShirtColor.G); + ((BinaryWriter) NetMessage.packetOut).Write(player1.underShirtColor.B); + ((BinaryWriter) NetMessage.packetOut).Write(player1.pantsColor.R); + ((BinaryWriter) NetMessage.packetOut).Write(player1.pantsColor.G); + ((BinaryWriter) NetMessage.packetOut).Write(player1.pantsColor.B); + ((BinaryWriter) NetMessage.packetOut).Write(player1.shoeColor.R); + ((BinaryWriter) NetMessage.packetOut).Write(player1.shoeColor.G); + ((BinaryWriter) NetMessage.packetOut).Write(player1.shoeColor.B); + ((BinaryWriter) NetMessage.packetOut).Write(player1.name); + break; + case 9: + ((BinaryWriter) NetMessage.packetOut).Write((byte) number); + break; + case 12: + ((BinaryWriter) NetMessage.packetOut).Write((byte) number); + ((BinaryWriter) NetMessage.packetOut).Write((short) Main.player[number].SpawnX); + ((BinaryWriter) NetMessage.packetOut).Write((short) Main.player[number].SpawnY); + break; + case 13: + Player player2 = Main.player[number]; + int num4 = 0; + if (player2.controlUp) + num4 = 1; + if (player2.controlDown) + num4 |= 2; + if (player2.controlLeft) + num4 |= 4; + if (player2.controlRight) + num4 |= 8; + if (player2.controlJump) + num4 |= 16; + if (player2.controlUseItem) + num4 |= 32; + if ((int) player2.direction == 1) + number |= 64; + if (num4 != 0) + { + ((BinaryWriter) NetMessage.packetOut).Write((byte) (number | 128)); + ((BinaryWriter) NetMessage.packetOut).Write((byte) num4); + if ((num4 & 32) != 0) + ((BinaryWriter) NetMessage.packetOut).Write(player2.selectedItem); + } + else + ((BinaryWriter) NetMessage.packetOut).Write((byte) number); + NetMessage.packetOut.Write(player2.position); + HalfVector2 halfVector2_1 = new HalfVector2(player2.velocity); + ((BinaryWriter) NetMessage.packetOut).Write(halfVector2_1.PackedValue); + if (Main.netMode != 2 || (int) ++player2.netSkip <= 2) + break; + player2.netSkip = (sbyte) 0; + break; + case 16: + int num5 = number | ((int) Main.player[number].statLife & 4095) << 4 | (int) Main.player[number].statLifeMax << 16; + ((BinaryWriter) NetMessage.packetOut).Write(num5); + break; + case 22: + ((BinaryWriter) NetMessage.packetOut).Write((byte) number); + int num6 = (int) Main.item[number].owner; + if (num6 < 8) + { + Vector2 vector = Main.item[number].velocity; + if ((double) vector.X != 0.0 || (double) vector.Y != 0.0) + num6 |= 128; + ((BinaryWriter) NetMessage.packetOut).Write((byte) num6); + NetMessage.packetOut.Write(Main.item[number].position); + if ((num6 & 128) == 0) + break; + HalfVector2 halfVector2_2 = new HalfVector2(vector); + ((BinaryWriter) NetMessage.packetOut).Write(halfVector2_2.PackedValue); + break; + } + else + { + ((BinaryWriter) NetMessage.packetOut).Write((byte) num6); + break; + } + case 23: + ((BinaryWriter) NetMessage.packetOut).Write((byte) number); + int num7 = (int) Main.npc[number].active != 0 ? Main.npc[number].life : 0; + if (num7 <= 0) + { + ((BinaryWriter) NetMessage.packetOut).Write((byte) 0); + Main.npc[number].netSkip = (short) 0; + break; + } + else + { + NetMessage.WriteCompacted((uint) num7); + ((BinaryWriter) NetMessage.packetOut).Write(Main.npc[number].netID); + NetMessage.packetOut.Write(Main.npc[number].position); + HalfVector2 halfVector2_2 = new HalfVector2(Main.npc[number].velocity); + ((BinaryWriter) NetMessage.packetOut).Write(halfVector2_2.PackedValue); + ((BinaryWriter) NetMessage.packetOut).Write((sbyte) ((int) Main.npc[number].target | ((int) Main.npc[number].direction & 3) << 4 | (int) Main.npc[number].directionY << 6)); + int num2 = 0; + float num8 = Main.npc[number].ai0; + if ((double) num8 != 0.0) + num2 = 1; + float num9 = Main.npc[number].ai1; + if ((double) num9 != 0.0) + num2 |= 2; + float num10 = Main.npc[number].ai2; + if ((double) num10 != 0.0) + num2 |= 4; + float num11 = Main.npc[number].ai3; + if ((double) num11 != 0.0) + num2 |= 8; + ((BinaryWriter) NetMessage.packetOut).Write((byte) num2); + if ((num2 & 1) != 0) + ((BinaryWriter) NetMessage.packetOut).Write(num8); + if ((num2 & 2) != 0) + ((BinaryWriter) NetMessage.packetOut).Write(num9); + if ((num2 & 4) != 0) + ((BinaryWriter) NetMessage.packetOut).Write(num10); + if ((num2 & 8) == 0) + break; + ((BinaryWriter) NetMessage.packetOut).Write(num11); + break; + } + case 30: + if (Main.player[number].hostile) + number |= 128; + ((BinaryWriter) NetMessage.packetOut).Write((byte) number); + break; + } + } + + public static unsafe void CreateMessage2(int msgType, int number, int number2) + { + ((BinaryWriter) NetMessage.packetOut).Write((byte) msgType); + switch (msgType) + { + case 43: + ((BinaryWriter) NetMessage.packetOut).Write((byte) number); + ((BinaryWriter) NetMessage.packetOut).Write((short) number2); + break; + case 47: + ((BinaryWriter) NetMessage.packetOut).Write((byte) number); + NetMessage.WriteCompacted((uint) number2); + ((BinaryWriter) NetMessage.packetOut).Write(Main.sign[number2].x); + ((BinaryWriter) NetMessage.packetOut).Write(Main.sign[number2].y); + Main.sign[number2].text.Write((BinaryWriter) NetMessage.packetOut); + break; + case 48: + int index1 = number; + int index2 = number2; + ((BinaryWriter) NetMessage.packetOut).Write((ushort) index1); + ((BinaryWriter) NetMessage.packetOut).Write((ushort) (index2 | (int) Main.tile[index1, index2].lava << 10)); + ((BinaryWriter) NetMessage.packetOut).Write(Main.tile[index1, index2].liquid); + break; + case 59: + ((BinaryWriter) NetMessage.packetOut).Write((ushort) number); + ((BinaryWriter) NetMessage.packetOut).Write((ushort) number2); + break; + case 61: + int num1 = number2; + ((BinaryWriter) NetMessage.packetOut).Write((byte) number); + ((BinaryWriter) NetMessage.packetOut).Write((short) num1); + break; + case 64: + ((BinaryWriter) NetMessage.packetOut).Write((byte) number); + ((BinaryWriter) NetMessage.packetOut).Write((byte) number2); + break; + case 65: + ((BinaryWriter) NetMessage.packetOut).Write((byte) number); + ((BinaryWriter) NetMessage.packetOut).Write((byte) number2); + break; + case 24: + ((BinaryWriter) NetMessage.packetOut).Write((ushort) number); + ((BinaryWriter) NetMessage.packetOut).Write((ushort) number2); + break; + case 29: + NetMessage.WriteCompacted((uint) number); + ((BinaryWriter) NetMessage.packetOut).Write((byte) number2); + break; + case 32: + NetMessage.WriteCompacted((uint) number); + ((BinaryWriter) NetMessage.packetOut).Write((byte) number2); + int num2 = (int) Main.chest[number].item[number2].netID; + ((BinaryWriter) NetMessage.packetOut).Write((short) num2); + if (num2 == 0) + break; + ((BinaryWriter) NetMessage.packetOut).Write(Main.chest[number].item[number2].prefix); + ((BinaryWriter) NetMessage.packetOut).Write((byte) Main.chest[number].item[number2].stack); + break; + case 33: + ((BinaryWriter) NetMessage.packetOut).Write((short) (number2 << 5 | number)); + if (number2 < 0) + break; + ((BinaryWriter) NetMessage.packetOut).Write(Main.chest[number2].x); + ((BinaryWriter) NetMessage.packetOut).Write(Main.chest[number2].y); + break; + case 34: + ((BinaryWriter) NetMessage.packetOut).Write((ushort) number); + ((BinaryWriter) NetMessage.packetOut).Write((ushort) number2); + break; + case 35: + ((BinaryWriter) NetMessage.packetOut).Write((byte) number); + NetMessage.WriteCompacted((uint) number2); + break; + case 14: + ((BinaryWriter) NetMessage.packetOut).Write((byte) (number | number2 << 7)); + break; + case 15: + int index3 = number; + int index4 = number2; + ((BinaryWriter) NetMessage.packetOut).Write((ushort) index3); + ((BinaryWriter) NetMessage.packetOut).Write((ushort) index4); + fixed (Tile* tilePtr = &Main.tile[index3, index4]) + { + int num3 = (int) tilePtr->active; + int num4 = num3; + int num5 = (int) tilePtr->wall; + if (num5 > 0) + num4 |= 4; + int num6 = Main.netMode != 2 ? 0 : (int) tilePtr->liquid; + if (num6 > 0) + num4 |= 8 | (int) tilePtr->lava; + int num7 = num4 | tilePtr->wire; + ((BinaryWriter) NetMessage.packetOut).Write((byte) num7); + if (num3 != 0) + { + int index5 = (int) tilePtr->type; + ((BinaryWriter) NetMessage.packetOut).Write((byte) index5); + if (Main.tileFrameImportant[index5]) + { + NetMessage.WriteCompacted((uint) tilePtr->frameX); + NetMessage.WriteCompacted((uint) tilePtr->frameY); + } + } + if (num5 > 0) + ((BinaryWriter) NetMessage.packetOut).Write((byte) num5); + if (num6 > 0) + ((BinaryWriter) NetMessage.packetOut).Write((byte) num6); + } + break; + case 21: + int num8 = 0; + int num9 = (int) Main.item[number2].stack; + if (num9 > 0 && (int) Main.item[number2].active != 0) + num8 = (int) Main.item[number2].netID; + if (num8 == 0 && number2 >= 200) + { + NetMessage.ClearMessage(); + break; + } + else + { + ((BinaryWriter) NetMessage.packetOut).Write((byte) number2); + ((BinaryWriter) NetMessage.packetOut).Write((short) (num8 << 5 | number)); + if (num8 == 0) + break; + ((BinaryWriter) NetMessage.packetOut).Write(Main.item[number2].prefix); + ((BinaryWriter) NetMessage.packetOut).Write((byte) num9); + NetMessage.packetOut.Write(Main.item[number2].position); + HalfVector2 halfVector2 = new HalfVector2(Main.item[number2].velocity); + ((BinaryWriter) NetMessage.packetOut).Write(halfVector2.PackedValue); + break; + } + case 5: + int index6 = number; + int index7 = number2; + ((BinaryWriter) NetMessage.packetOut).Write((byte) index6); + ((BinaryWriter) NetMessage.packetOut).Write((byte) index7); + int num10; + int num11; + int num12; + if (index7 < 49) + { + num10 = (int) Main.player[index6].inventory[index7].stack; + num11 = (int) Main.player[index6].inventory[index7].netID; + num12 = (int) Main.player[index6].inventory[index7].prefix; + } + else + { + int index5 = index7 - 49; + num10 = (int) Main.player[index6].armor[index5].stack; + num11 = (int) Main.player[index6].armor[index5].netID; + num12 = (int) Main.player[index6].armor[index5].prefix; + } + ((BinaryWriter) NetMessage.packetOut).Write((byte) num10); + if (num10 <= 0) + break; + ((BinaryWriter) NetMessage.packetOut).Write((byte) num12); + ((BinaryWriter) NetMessage.packetOut).Write((short) num11); + break; + case 10: + ((BinaryWriter) NetMessage.packetOut).Write((byte) number); + ((BinaryWriter) NetMessage.packetOut).Write((byte) number2); + int num13 = number * 40; + int num14 = number2 * 30; + Tile[,] tileArray; + // ISSUE: cast to a reference type + // ISSUE: explicit reference operation + fixed (Tile* tilePtr1 = &^((tileArray = Main.tile) == null || tileArray.Length == 0 ? (Tile&) IntPtr.Zero : tileArray.Address(0, 0))) + { + Tile* tilePtr2 = (Tile*) null; + uint num3 = 0U; + for (int index5 = num13; index5 < num13 + 40; ++index5) + { + Tile* tilePtr3 = tilePtr1 + (num14 + index5 * 1440); + for (int index8 = 29; index8 >= 0; --index8) + { + if ((IntPtr) tilePtr2 != IntPtr.Zero && tilePtr3->isTheSameAsExcludingVisibility(ref *tilePtr2)) + { + ++num3; + } + else + { + if ((IntPtr) tilePtr2 != IntPtr.Zero) + NetMessage.WriteCompacted(num3); + num3 = 0U; + tilePtr2 = tilePtr3; + int num4 = (int) tilePtr3->active; + int num5 = num4; + int num6 = (int) tilePtr3->wall; + if (num6 > 0) + num5 |= 4; + int num7 = (int) tilePtr3->liquid; + if (num7 > 0) + num5 |= 8 | (int) tilePtr3->lava; + int num15 = num5 | tilePtr3->wire; + ((BinaryWriter) NetMessage.packetOut).Write((byte) num15); + if (num4 != 0) + { + int index9 = (int) tilePtr3->type; + ((BinaryWriter) NetMessage.packetOut).Write((byte) index9); + if (Main.tileFrameImportant[index9]) + { + NetMessage.WriteCompacted((uint) tilePtr3->frameX); + NetMessage.WriteCompacted((uint) tilePtr3->frameY); + } + } + if (num6 > 0) + ((BinaryWriter) NetMessage.packetOut).Write((byte) num6); + if (num7 > 0) + ((BinaryWriter) NetMessage.packetOut).Write((byte) num7); + } + ++tilePtr3; + } + } + NetMessage.WriteCompacted(num3); + } + break; + } + } + + public static void CreateMessage3(int msgType, int number, int number2, int number3) + { + ((BinaryWriter) NetMessage.packetOut).Write((byte) msgType); + switch (msgType) + { + case 31: + ((BinaryWriter) NetMessage.packetOut).Write((byte) number); + ((BinaryWriter) NetMessage.packetOut).Write((ushort) number2); + ((BinaryWriter) NetMessage.packetOut).Write((ushort) number3); + break; + case 46: + ((BinaryWriter) NetMessage.packetOut).Write((byte) number); + ((BinaryWriter) NetMessage.packetOut).Write((ushort) number2); + ((BinaryWriter) NetMessage.packetOut).Write((ushort) number3); + break; + case 52: + ((BinaryWriter) NetMessage.packetOut).Write((byte) number); + ((BinaryWriter) NetMessage.packetOut).Write((ushort) number2); + ((BinaryWriter) NetMessage.packetOut).Write((ushort) number3); + break; + case 53: + ((BinaryWriter) NetMessage.packetOut).Write((byte) number); + ((BinaryWriter) NetMessage.packetOut).Write((byte) number2); + NetMessage.WriteCompacted((uint) number3); + break; + case 55: + ((BinaryWriter) NetMessage.packetOut).Write((byte) number); + ((BinaryWriter) NetMessage.packetOut).Write((byte) number2); + NetMessage.WriteCompacted((uint) number3); + break; + case 8: + ((BinaryWriter) NetMessage.packetOut).Write((byte) number); + ((BinaryWriter) NetMessage.packetOut).Write((short) number2); + ((BinaryWriter) NetMessage.packetOut).Write((short) number3); + break; + case 19: + ((BinaryWriter) NetMessage.packetOut).Write((ushort) number); + ((BinaryWriter) NetMessage.packetOut).Write((ushort) number2); + ((BinaryWriter) NetMessage.packetOut).Write((sbyte) number3); + break; + case 20: + int num1 = number2; + int num2 = number3; + ((BinaryWriter) NetMessage.packetOut).Write((byte) number); + ((BinaryWriter) NetMessage.packetOut).Write((ushort) num1); + ((BinaryWriter) NetMessage.packetOut).Write((ushort) num2); + for (int index1 = num1; index1 < num1 + number; ++index1) + { + for (int index2 = num2; index2 < num2 + number; ++index2) + { + int num3 = (int) Main.tile[index1, index2].active; + int num4 = num3; + int num5 = (int) Main.tile[index1, index2].wall; + if (num5 > 0) + num4 |= 4; + int num6 = Main.netMode != 2 ? 0 : (int) Main.tile[index1, index2].liquid; + if (num6 > 0) + num4 |= 8 | (int) Main.tile[index1, index2].lava; + int num7 = num4 | Main.tile[index1, index2].wire; + ((BinaryWriter) NetMessage.packetOut).Write((byte) num7); + if (num3 != 0) + { + int index3 = (int) Main.tile[index1, index2].type; + ((BinaryWriter) NetMessage.packetOut).Write((byte) index3); + if (Main.tileFrameImportant[index3]) + { + NetMessage.WriteCompacted((uint) Main.tile[index1, index2].frameX); + NetMessage.WriteCompacted((uint) Main.tile[index1, index2].frameY); + } + } + if (num5 > 0) + ((BinaryWriter) NetMessage.packetOut).Write((byte) num5); + if (num6 > 0) + ((BinaryWriter) NetMessage.packetOut).Write((byte) num6); + } + } + break; + } + } + + public static void CreateMessage4(int msgType, int number, int number2, int number3, int number4) + { + ((BinaryWriter) NetMessage.packetOut).Write((byte) msgType); + if (msgType != 60) + return; + ((BinaryWriter) NetMessage.packetOut).Write((byte) number); + ((BinaryWriter) NetMessage.packetOut).Write((short) number2); + ((BinaryWriter) NetMessage.packetOut).Write((short) number3); + ((BinaryWriter) NetMessage.packetOut).Write((byte) number4); + } + + public static void CreateMessage5(int msgType, int number, int number2, int number3, int number4, int number5 = 0) + { + ((BinaryWriter) NetMessage.packetOut).Write((byte) msgType); + switch (msgType) + { + case 17: + ((BinaryWriter) NetMessage.packetOut).Write((byte) number); + ((BinaryWriter) NetMessage.packetOut).Write((ushort) number2); + ((BinaryWriter) NetMessage.packetOut).Write((ushort) number3); + if (number > 4) + break; + ((BinaryWriter) NetMessage.packetOut).Write((byte) number4); + if (number != 1) + break; + ((BinaryWriter) NetMessage.packetOut).Write((byte) number5); + break; + case 44: + ((BinaryWriter) NetMessage.packetOut).Write((byte) number); + ((BinaryWriter) NetMessage.packetOut).Write((sbyte) number2); + ((BinaryWriter) NetMessage.packetOut).Write((short) number3); + ((BinaryWriter) NetMessage.packetOut).Write((byte) number4); + ((BinaryWriter) NetMessage.packetOut).Write((uint) number5); + break; + } + } + + public static void SendPlayerId(NetworkGamer gamer, int playerId) + { + NetMessage.CreateMessage1(0, playerId); + NetMessage.SendMessage(gamer); + } + + public static void SendHello(int playerId) + { + NetMessage.CreateMessage1(1, playerId); + NetMessage.SendMessage(); + } + + public static void SendKick(NetClient client, int textId) + { + NetMessage.CreateMessage1(2, textId); + NetMessage.SendMessage(client); + } + + public static void SendPlayerInfoRequest(NetClient client, int playerId) + { + NetMessage.CreateMessage1(3, playerId); + NetMessage.SendMessage(client); + } + + public static void SendPlayerHurt(int playerId, int dir, int dmg, bool pvp, bool critical, uint deathText) + { + ((BinaryWriter) NetMessage.packetOut).Write((byte) 26); + ((BinaryWriter) NetMessage.packetOut).Write((byte) playerId); + ((BinaryWriter) NetMessage.packetOut).Write((sbyte) dir); + ((BinaryWriter) NetMessage.packetOut).Write((short) dmg); + ((BinaryWriter) NetMessage.packetOut).Write(pvp); + ((BinaryWriter) NetMessage.packetOut).Write(critical); + ((BinaryWriter) NetMessage.packetOut).Write(deathText); + NetMessage.SendMessage(); + } + + public static void SendProjectile(int number, SendDataOptions sendOptions = SendDataOptions.Reliable) + { + ((BinaryWriter) NetMessage.packetOut).Write((byte) 27); + int num1 = 0; + float num2 = Main.projectile[number].knockBack; + if ((double) num2 != 0.0) + num1 = 1; + int num3 = (int) Main.projectile[number].damage; + if (num3 != 0) + num1 |= 2; + float num4 = Main.projectile[number].ai0; + if ((double) num4 != 0.0) + num1 |= 4; + int num5 = Main.projectile[number].ai1; + if (num5 != 0) + num1 |= 8; + ((BinaryWriter) NetMessage.packetOut).Write((byte) ((uint) Main.projectile[number].owner | (uint) (num1 << 4))); + ((BinaryWriter) NetMessage.packetOut).Write(Main.projectile[number].type); + NetMessage.WriteCompacted((uint) Main.projectile[number].identity); + NetMessage.packetOut.Write(Main.projectile[number].position); + HalfVector2 halfVector2 = new HalfVector2(Main.projectile[number].velocity); + ((BinaryWriter) NetMessage.packetOut).Write(halfVector2.PackedValue); + if ((num1 & 1) != 0) + { + HalfSingle halfSingle = new HalfSingle(num2); + ((BinaryWriter) NetMessage.packetOut).Write(halfSingle.PackedValue); + } + if ((num1 & 2) != 0) + ((BinaryWriter) NetMessage.packetOut).Write((short) num3); + if ((num1 & 4) != 0) + ((BinaryWriter) NetMessage.packetOut).Write(num4); + if ((num1 & 8) != 0) + ((BinaryWriter) NetMessage.packetOut).Write((short) num5); + NetMessage.SendProjectileMessage(ref Main.projectile[number], sendOptions); + } + + public static void SendNpcHurt(int npcId, int dmg) + { + ((BinaryWriter) NetMessage.packetOut).Write((byte) 28); + ((BinaryWriter) NetMessage.packetOut).Write((byte) npcId); + ((BinaryWriter) NetMessage.packetOut).Write((short) dmg); + NetMessage.SendMessage(); + } + + public static void SendNpcHurt(int npcId, int dmg, double kb, int dir, bool critical = false) + { + ((BinaryWriter) NetMessage.packetOut).Write((byte) 28); + ((BinaryWriter) NetMessage.packetOut).Write((byte) npcId); + ((BinaryWriter) NetMessage.packetOut).Write((short) dmg); + if (dmg >= 0) + { + HalfSingle halfSingle = new HalfSingle((float) kb); + ((BinaryWriter) NetMessage.packetOut).Write(halfSingle.PackedValue); + dir <<= 1; + if (critical) + dir |= 1; + ((BinaryWriter) NetMessage.packetOut).Write((sbyte) dir); + } + NetMessage.SendMessage(); + } + + public static void SendText(int textId, int r, int g, int b, int player) + { + if (player < 0 || Main.player[player].client == null) + { + Main.NewText(Lang.misc[textId], r, g, b); + if (player >= 0 && Main.player[player].client == null) + return; + } + ((BinaryWriter) NetMessage.packetOut).Write((byte) 18); + ((BinaryWriter) NetMessage.packetOut).Write((byte) r); + ((BinaryWriter) NetMessage.packetOut).Write((byte) g); + ((BinaryWriter) NetMessage.packetOut).Write((byte) b); + ((BinaryWriter) NetMessage.packetOut).Write((ushort) textId); + if (player < 0) + NetMessage.SendMessage(); + else + NetMessage.SendMessage(Main.player[player].client); + } + + public static void SendText(string prefix, int textId, int r, int g, int b, int player) + { + if (player < 0 || Main.player[player].client == null) + { + Main.NewText(prefix + Lang.misc[textId], r, g, b); + if (player >= 0 && Main.player[player].client == null) + return; + } + ((BinaryWriter) NetMessage.packetOut).Write((byte) 37); + ((BinaryWriter) NetMessage.packetOut).Write((byte) r); + ((BinaryWriter) NetMessage.packetOut).Write((byte) g); + ((BinaryWriter) NetMessage.packetOut).Write((byte) b); + ((BinaryWriter) NetMessage.packetOut).Write((ushort) textId); + ((BinaryWriter) NetMessage.packetOut).Write(prefix); + if (player < 0) + NetMessage.SendMessage(); + else + NetMessage.SendMessage(Main.player[player].client); + } + + public static void SendText(int textId, string postfix, int r, int g, int b, int player) + { + if (player < 0 || Main.player[player].client == null) + { + Main.NewText(Lang.misc[textId] + postfix, r, g, b); + if (player >= 0 && Main.player[player].client == null) + return; + } + ((BinaryWriter) NetMessage.packetOut).Write((byte) 38); + ((BinaryWriter) NetMessage.packetOut).Write((byte) r); + ((BinaryWriter) NetMessage.packetOut).Write((byte) g); + ((BinaryWriter) NetMessage.packetOut).Write((byte) b); + ((BinaryWriter) NetMessage.packetOut).Write((ushort) textId); + ((BinaryWriter) NetMessage.packetOut).Write(postfix); + if (player < 0) + NetMessage.SendMessage(); + else + NetMessage.SendMessage(Main.player[player].client); + } + + public static void SendText(string text, int r, int g, int b, int player) + { + if (player < 0 || Main.player[player].client == null) + { + Main.NewText(text, r, g, b); + if (player >= 0 && Main.player[player].client == null) + return; + } + ((BinaryWriter) NetMessage.packetOut).Write((byte) 25); + ((BinaryWriter) NetMessage.packetOut).Write((byte) r); + ((BinaryWriter) NetMessage.packetOut).Write((byte) g); + ((BinaryWriter) NetMessage.packetOut).Write((byte) b); + ((BinaryWriter) NetMessage.packetOut).Write(text); + if (player < 0) + NetMessage.SendMessage(); + else + NetMessage.SendMessage(Main.player[player].client); + } + + public static void SendDeathText(string name, uint deathText, int r, int g, int b) + { + Main.NewText(name + Lang.deathMsgString(deathText), r, g, b); + ((BinaryWriter) NetMessage.packetOut).Write((byte) 63); + ((BinaryWriter) NetMessage.packetOut).Write((byte) r); + ((BinaryWriter) NetMessage.packetOut).Write((byte) g); + ((BinaryWriter) NetMessage.packetOut).Write((byte) b); + ((BinaryWriter) NetMessage.packetOut).Write(deathText); + ((BinaryWriter) NetMessage.packetOut).Write(name); + NetMessage.SendMessage(); + } + + public static void SendMessage() + { + MemoryStream memoryStream = (MemoryStream) ((BinaryWriter) NetMessage.packetOut).BaseStream; + int index1 = (int) memoryStream.GetBuffer()[0]; + SendDataOptions options = (SendDataOptions) NetMessage.PRIORITY[index1]; + if (Main.netMode == 1) + { + if (Netplay.session.Host != null) + { + try + { + Netplay.gamer.SendData(NetMessage.packetOut, options, Netplay.session.Host); + goto label_10; + } + catch + { + goto label_10; + } + } + } + for (int index2 = Netplay.clients.Count - 1; index2 >= 0; --index2) + { + NetClient netClient = Netplay.clients[index2]; + if (netClient.IsReadyToReceive(memoryStream.GetBuffer())) + { + try + { + Netplay.gamer.SendData(memoryStream.GetBuffer(), 0, NetMessage.packetOut.Length, options, netClient.gamer); + } + catch + { + } + } + } +label_10: + memoryStream.Position = 0L; + memoryStream.SetLength(0L); + } + + private static void SendProjectileMessage(ref Projectile projectile, SendDataOptions sendOptions) + { + MemoryStream memoryStream = (MemoryStream) ((BinaryWriter) NetMessage.packetOut).BaseStream; + if (Main.netMode == 1) + { + try + { + Netplay.gamer.SendData(memoryStream.GetBuffer(), 0, NetMessage.packetOut.Length, sendOptions, Netplay.session.Host); + } + catch + { + } + } + else + { + for (int index = Netplay.clients.Count - 1; index >= 0; --index) + { + NetClient netClient = Netplay.clients[index]; + if (netClient.IsReadyToReceiveProjectile(ref projectile)) + { + try + { + Netplay.gamer.SendData(memoryStream.GetBuffer(), 0, NetMessage.packetOut.Length, sendOptions, netClient.gamer); + } + catch + { + } + } + } + } + memoryStream.Position = 0L; + memoryStream.SetLength(0L); + } + + public static void SendMessage(NetClient client) + { + MemoryStream memoryStream = (MemoryStream) ((BinaryWriter) NetMessage.packetOut).BaseStream; + int index = (int) memoryStream.GetBuffer()[0]; + SendDataOptions options = (SendDataOptions) NetMessage.PRIORITY[index]; + switch (options) + { + case SendDataOptions.None: + options = SendDataOptions.Reliable; + break; + case SendDataOptions.InOrder: + options = SendDataOptions.ReliableInOrder; + break; + } + try + { + Netplay.gamer.SendData(NetMessage.packetOut, options, client.gamer); + } + catch + { + memoryStream.Position = 0L; + memoryStream.SetLength(0L); + } + } + + public static void SendMessageNoClear(NetClient client) + { + MemoryStream memoryStream = (MemoryStream) ((BinaryWriter) NetMessage.packetOut).BaseStream; + int index = (int) memoryStream.GetBuffer()[0]; + SendDataOptions options = (SendDataOptions) NetMessage.PRIORITY[index]; + switch (options) + { + case SendDataOptions.None: + options = SendDataOptions.Reliable; + break; + case SendDataOptions.InOrder: + options = SendDataOptions.ReliableInOrder; + break; + } + try + { + Netplay.gamer.SendData(memoryStream.GetBuffer(), 0, NetMessage.packetOut.Length, options, client.gamer); + } + catch + { + } + } + + public static void ClearMessage() + { + MemoryStream memoryStream = (MemoryStream) ((BinaryWriter) NetMessage.packetOut).BaseStream; + memoryStream.Position = 0L; + memoryStream.SetLength(0L); + } + + public static void SendMessageIgnore(NetClient ignoreClient) + { + MemoryStream memoryStream = (MemoryStream) ((BinaryWriter) NetMessage.packetOut).BaseStream; + int index1 = (int) memoryStream.GetBuffer()[0]; + SendDataOptions options = (SendDataOptions) NetMessage.PRIORITY[index1]; + for (int index2 = Netplay.clients.Count - 1; index2 >= 0; --index2) + { + NetClient netClient = Netplay.clients[index2]; + if (netClient != ignoreClient) + { + if (netClient.IsReadyToReceive(memoryStream.GetBuffer())) + { + try + { + Netplay.gamer.SendData(memoryStream.GetBuffer(), 0, NetMessage.packetOut.Length, options, netClient.gamer); + } + catch + { + } + } + } + } + memoryStream.Position = 0L; + memoryStream.SetLength(0L); + } + + public static void SendMessage(NetworkGamer gamer) + { + MemoryStream memoryStream = (MemoryStream) ((BinaryWriter) NetMessage.packetOut).BaseStream; + int index = (int) memoryStream.GetBuffer()[0]; + SendDataOptions options = (SendDataOptions) NetMessage.PRIORITY[index]; + try + { + Netplay.gamer.SendData(NetMessage.packetOut, options, gamer); + } + catch + { + memoryStream.Position = 0L; + memoryStream.SetLength(0L); + } + } + + private static void EchoMessage(NetClient sender) + { + MemoryStream memoryStream = (MemoryStream) ((BinaryReader) NetMessage.packetIn).BaseStream; + int index1 = (int) memoryStream.GetBuffer()[0]; + SendDataOptions options = (SendDataOptions) NetMessage.PRIORITY[index1]; + for (int index2 = Netplay.clients.Count - 1; index2 >= 0; --index2) + { + NetClient netClient = Netplay.clients[index2]; + if (netClient != sender) + { + if (netClient.IsReadyToReceive(memoryStream.GetBuffer())) + { + try + { + Netplay.gamer.SendData(memoryStream.GetBuffer(), 0, NetMessage.packetIn.Length, options, netClient.gamer); + } + catch + { + } + } + } + } + } + + private static void EchoProjectileMessage(NetClient sender, ref Projectile projectile) + { + MemoryStream memoryStream = (MemoryStream) ((BinaryReader) NetMessage.packetIn).BaseStream; + int index1 = (int) memoryStream.GetBuffer()[0]; + SendDataOptions options = (SendDataOptions) NetMessage.PRIORITY[index1]; + for (int index2 = Netplay.clients.Count - 1; index2 >= 0; --index2) + { + NetClient netClient = Netplay.clients[index2]; + if (netClient != sender) + { + if (netClient.IsReadyToReceiveProjectile(ref projectile)) + { + try + { + Netplay.gamer.SendData(memoryStream.GetBuffer(), 0, NetMessage.packetIn.Length, options, netClient.gamer); + } + catch + { + } + } + } + } + } + + public static unsafe void GetData(NetClient sender) + { + int num1 = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + if (Main.netMode == 1) + { + UI ui1 = UI.main; + if (Netplay.clientStatusMax > 0) + ++Netplay.clientStatusCount; + switch (num1) + { + case 54: + int index1 = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + for (int index2 = 0; index2 < 5; ++index2) + { + uint num2 = (uint) ((BinaryReader) NetMessage.packetIn).ReadByte(); + Main.npc[index1].buff[index2].Type = (ushort) num2; + Main.npc[index1].buff[index2].Time = num2 > 0U ? (ushort) NetMessage.ReadCompacted() : (ushort) 0; + } + break; + case 56: + int index3 = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + NPC.chrName[index3] = ((BinaryReader) NetMessage.packetIn).ReadString(); + break; + case 57: + WorldGen.tGood = ((BinaryReader) NetMessage.packetIn).ReadByte(); + WorldGen.tEvil = ((BinaryReader) NetMessage.packetIn).ReadByte(); + break; + case 63: + case 37: + case 38: + case 18: + case 25: + byte num3 = ((BinaryReader) NetMessage.packetIn).ReadByte(); + byte num4 = ((BinaryReader) NetMessage.packetIn).ReadByte(); + byte num5 = ((BinaryReader) NetMessage.packetIn).ReadByte(); + uint num6 = 0U; + string newText; + if (num1 == 18) + { + uint num2 = (uint) ((BinaryReader) NetMessage.packetIn).ReadUInt16(); + newText = Lang.misc[(IntPtr) num2]; + } + else if (num1 == 63) + { + uint encoded = ((BinaryReader) NetMessage.packetIn).ReadUInt32(); + newText = ((BinaryReader) NetMessage.packetIn).ReadString() + Lang.deathMsgString(encoded); + } + else + { + if (num1 != 25) + num6 = (uint) ((BinaryReader) NetMessage.packetIn).ReadUInt16(); + newText = ((BinaryReader) NetMessage.packetIn).ReadString(); + if (num1 == 37) + newText = newText + Lang.misc[(IntPtr) num6]; + else if (num1 == 38) + newText = Lang.misc[(IntPtr) num6] + newText; + } + Main.NewText(newText, (int) num3, (int) num4, (int) num5); + break; + case 64: + int index4 = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + UI ui2 = Main.player[index4].ui; + int num7 = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + if (ui2 != null) + { + ui2.SetTriggerState((Trigger) num7); + break; + } + else + break; + case 65: + int index5 = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + UI ui3 = Main.player[index5].ui; + int num8 = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + if (ui3 != null) + { + ui3.Statistics.incStat((StatisticEntry) num8); + break; + } + else + break; + case 49: + int num9 = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + for (int index2 = 0; index2 < 4; ++index2) + { + UI ui4 = Main.ui[index2]; + if (ui4.localGamer != null && (int) ui4.myPlayer == num9) + { + Netplay.gamersWaitingToSpawn.Add(ui4); + break; + } + } + if (Netplay.clientState >= Netplay.ClientState.WAITING_FOR_TILE_DATA) + { + Netplay.clientState = Netplay.ClientState.PLAYING; + break; + } + else + break; + case 2: + Netplay.disconnect = true; + ui1.statusText = Lang.misc[(int) ((BinaryReader) NetMessage.packetIn).ReadUInt16()]; + break; + case 3: + if (Netplay.clientState == Netplay.ClientState.WAITING_FOR_PLAYER_DATA_REQ) + Netplay.clientState = Netplay.ClientState.RECEIVED_PLAYER_DATA_REQ; + int number = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + NetMessage.CreateMessage1(4, number); + NetMessage.SendMessage(); + NetMessage.CreateMessage1(16, number); + NetMessage.SendMessage(); + NetMessage.CreateMessage1(42, number); + NetMessage.SendMessage(); + NetMessage.CreateMessage1(50, number); + NetMessage.SendMessage(); + for (int number2 = 0; number2 < 49; ++number2) + { + NetMessage.CreateMessage2(5, number, number2); + NetMessage.SendMessage(); + } + for (int index2 = 0; index2 < 11; ++index2) + { + NetMessage.CreateMessage2(5, number, index2 + 49); + NetMessage.SendMessage(); + } + NetMessage.CreateMessage0(6); + NetMessage.SendMessage(); + break; + case 7: + Main.gameTime.time = ((BinaryReader) NetMessage.packetIn).ReadSingle(); + int num10 = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + Main.gameTime.dayTime = (num10 & 1) != 0; + Main.gameTime.bloodMoon = (num10 & 2) != 0; + Main.gameTime.moonPhase = (byte) (num10 >> 2); + Main.maxTilesX = ((BinaryReader) NetMessage.packetIn).ReadInt16(); + Main.maxTilesY = ((BinaryReader) NetMessage.packetIn).ReadInt16(); + Main.spawnTileX = ((BinaryReader) NetMessage.packetIn).ReadInt16(); + Main.spawnTileY = ((BinaryReader) NetMessage.packetIn).ReadInt16(); + Main.worldSurface = (int) ((BinaryReader) NetMessage.packetIn).ReadInt16(); + Main.worldSurfacePixels = Main.worldSurface << 4; + Main.rockLayer = (int) ((BinaryReader) NetMessage.packetIn).ReadInt16(); + Main.rockLayerPixels = Main.rockLayer << 4; + int num11 = ((BinaryReader) NetMessage.packetIn).ReadInt32(); + if (num11 != Main.worldID) + { + Main.worldID = num11; + Main.checkWorldId = true; + } + int num12 = ((BinaryReader) NetMessage.packetIn).ReadInt32(); + if (num12 != Main.worldTimestamp) + { + Main.worldTimestamp = num12; + Main.checkWorldId = true; + } + int num13 = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + WorldGen.shadowOrbSmashed = (num13 & 1) != 0; + NPC.downedBoss1 = (num13 & 2) != 0; + NPC.downedBoss2 = (num13 & 4) != 0; + NPC.downedBoss3 = (num13 & 8) != 0; + Main.hardMode = (num13 & 16) != 0; + NPC.downedClown = (num13 & 32) != 0; + Main.worldName = ((BinaryReader) NetMessage.packetIn).ReadString(); + WorldGen.UpdateMagmaLayerPos(); + if (Netplay.clientState <= Netplay.ClientState.WAITING_FOR_WORLD_INFO) + { + Netplay.clientState = Netplay.ClientState.ANNOUNCING_SPAWN_LOCATION; + UI.main.NextProgressStep(Lang.menu[74]); + break; + } + else + break; + case 9: + Netplay.clientStatusMax += (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + break; + case 10: + int startX = (int) ((BinaryReader) NetMessage.packetIn).ReadByte() * 40; + int startY = (int) ((BinaryReader) NetMessage.packetIn).ReadByte() * 30; + Tile[,] tileArray; + // ISSUE: cast to a reference type + // ISSUE: explicit reference operation + fixed (Tile* tilePtr1 = &^((tileArray = Main.tile) == null || tileArray.Length == 0 ? (Tile&) IntPtr.Zero : tileArray.Address(0, 0))) + { + uint num2 = 0U; + Tile* tilePtr2 = (Tile*) null; + for (int index2 = startX; index2 < startX + 40; ++index2) + { + Tile* tilePtr3 = tilePtr1 + (startY + index2 * 1440); + for (int index6 = 29; index6 >= 0; --index6) + { + if (num2 > 0U) + { + --num2; + *tilePtr3 = *tilePtr2; + } + else + { + tilePtr2 = tilePtr3; + int num14 = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + int num15 = num14 & 1; + if (num15 != 0) + { + int num16 = (int) tilePtr3->type; + int index7 = (int) (tilePtr3->type = ((BinaryReader) NetMessage.packetIn).ReadByte()); + if (Main.tileFrameImportant[index7]) + { + tilePtr3->frameX = (short) NetMessage.ReadCompacted(); + tilePtr3->frameY = (short) NetMessage.ReadCompacted(); + } + else if (index7 != num16 || (int) tilePtr3->active == 0) + { + tilePtr3->frameX = (short) -1; + tilePtr3->frameY = (short) -1; + } + } + tilePtr3->active = (byte) num15; + tilePtr3->wall = (num14 & 4) != 0 ? ((BinaryReader) NetMessage.packetIn).ReadByte() : (byte) 0; + tilePtr3->liquid = (num14 & 8) != 0 ? ((BinaryReader) NetMessage.packetIn).ReadByte() : (byte) 0; + tilePtr3->wire = num14 & 16; + tilePtr3->lava = (byte) (num14 & 32); + num2 = NetMessage.ReadCompacted(); + } + ++tilePtr3; + } + } + } + WorldGen.SectionTileFrame(startX, startY); + break; + case 11: + int num17 = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + GamerCollection allGamers = Netplay.session.AllGamers; + if (num17 != ((ReadOnlyCollection) allGamers).Count) + { + NetMessage.CreateMessage0(11); + NetMessage.SendMessage(); + break; + } + else + { + do + { + NetworkGamer networkGamer = ((ReadOnlyCollection) allGamers)[--num17]; + int index2 = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + Player player = Main.player[index2]; + int num2 = networkGamer.IsLocal ? 1 : 0; + networkGamer.Tag = (object) player; + } + while (num17 > 0); + break; + } + case 14: + int num18 = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + int num19 = num18 & 128; + int i = num18 ^ num19; + Player player1 = Main.player[i]; + if (num19 != 0) + { + if ((int) player1.active == 0) + { + player1.Init(); + player1.active = (byte) 1; + } + Netplay.SetAsRemotePlayerSlot(i); + break; + } + else + { + player1.active = (byte) 0; + break; + } + case 23: + int index8 = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + int num20 = (int) NetMessage.ReadCompacted(); + Main.npc[index8].life = num20; + if (num20 == 0) + { + Main.npc[index8].active = (byte) 0; + break; + } + else + { + int type = (int) ((BinaryReader) NetMessage.packetIn).ReadInt16(); + if ((int) Main.npc[index8].active == 0 || (int) Main.npc[index8].netID != type) + Main.npc[index8].netDefaults(type); + Main.npc[index8].position = NetMessage.packetIn.ReadVector2(); + Main.npc[index8].aabb.X = (int) Main.npc[index8].position.X; + Main.npc[index8].aabb.Y = (int) Main.npc[index8].position.Y; + Main.npc[index8].velocity = new HalfVector2() + { + PackedValue = ((BinaryReader) NetMessage.packetIn).ReadUInt32() + }.ToVector2(); + int num2 = (int) ((BinaryReader) NetMessage.packetIn).ReadSByte(); + Main.npc[index8].target = (byte) (num2 & 15); + Main.npc[index8].direction = (sbyte) (num2 << 26 >> 30); + Main.npc[index8].directionY = (sbyte) (num2 >> 6); + int num14 = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + Main.npc[index8].ai0 = (num14 & 1) != 0 ? ((BinaryReader) NetMessage.packetIn).ReadSingle() : 0.0f; + Main.npc[index8].ai1 = (num14 & 2) != 0 ? ((BinaryReader) NetMessage.packetIn).ReadSingle() : 0.0f; + Main.npc[index8].ai2 = (num14 & 4) != 0 ? ((BinaryReader) NetMessage.packetIn).ReadSingle() : 0.0f; + Main.npc[index8].ai3 = (num14 & 8) != 0 ? ((BinaryReader) NetMessage.packetIn).ReadSingle() : 0.0f; + break; + } + } + } + else if (Main.netMode == 2) + { + switch (num1) + { + case 53: + int number1 = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + int type1 = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + int time = (int) NetMessage.ReadCompacted(); + Main.npc[number1].AddBuff(type1, time, true); + NetMessage.CreateMessage1(54, number1); + NetMessage.SendMessage(); + break; + case 61: + int index9 = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + int Type1 = (int) ((BinaryReader) NetMessage.packetIn).ReadInt16(); + if (Type1 < 0) + { + if (Main.invasionType == 0) + { + Main.invasionDelay = 0; + Main.StartInvasion(-Type1); + break; + } + else + break; + } + else + { + bool flag = true; + for (int index1 = 0; index1 < 196; ++index1) + { + if ((int) Main.npc[index1].type == Type1 && (int) Main.npc[index1].active != 0) + { + flag = false; + break; + } + } + if (flag) + { + NPC.SpawnOnPlayer(Main.player[index9], Type1); + break; + } + else + break; + } + case 62: + NPC.SpawnSkeletron(); + break; + case 66: + sender.RequestedPublicSlot(); + break; + case 67: + sender.CanceledPublicSlot(); + break; + case 34: + int index10 = (int) ((BinaryReader) NetMessage.packetIn).ReadUInt16(); + int index11 = (int) ((BinaryReader) NetMessage.packetIn).ReadUInt16(); + if ((int) Main.tile[index10, index11].type == 21 && WorldGen.KillTile(index10, index11)) + { + NetMessage.CreateMessage5(17, 0, index10, index11, 0, 0); + NetMessage.SendMessage(); + break; + } + else + break; + case 46: + int number3 = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + int number2_1 = Sign.ReadSign((int) ((BinaryReader) NetMessage.packetIn).ReadUInt16(), (int) ((BinaryReader) NetMessage.packetIn).ReadUInt16()); + if (number2_1 >= 0) + { + NetMessage.CreateMessage2(47, number3, number2_1); + NetMessage.SendMessage(sender); + break; + } + else + break; + case 11: + NetMessage.CreateMessage0(11); + NetMessage.SendMessage(sender); + break; + case 31: + int number4 = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + Player player2 = Main.player[number4]; + int chest = Chest.FindChest((int) ((BinaryReader) NetMessage.packetIn).ReadUInt16(), (int) ((BinaryReader) NetMessage.packetIn).ReadUInt16()); + if (chest >= 0 && Chest.UsingChest(chest) == -1) + { + for (int number2_2 = 0; number2_2 < 20; ++number2_2) + { + NetMessage.CreateMessage2(32, chest, number2_2); + NetMessage.SendMessage(sender); + } + NetMessage.CreateMessage2(33, number4, chest); + NetMessage.SendMessage(sender); + player2.chest = (short) chest; + break; + } + else + break; + case 1: + int num21 = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + if ((int) sender.serverState == 0) + { + if (num21 == 1) + { + sender.serverState = (short) 1; + } + else + { + NetMessage.BootPlayer((int) ((BinaryReader) NetMessage.packetIn).ReadByte(), 22); + break; + } + } + int playerId = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + NetMessage.SendPlayerInfoRequest(sender, playerId); + break; + case 6: + if ((int) sender.serverState == 1) + sender.serverState = (short) 2; + NetMessage.CreateMessage0(7); + NetMessage.SendMessage(sender); + break; + case 8: + int number5 = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + int num22 = (int) ((BinaryReader) NetMessage.packetIn).ReadInt16(); + int num23 = (int) ((BinaryReader) NetMessage.packetIn).ReadInt16(); + bool flag1 = num22 >= 0 && num23 >= 0; + if (flag1) + { + if (num22 < 10 || num22 > (int) Main.maxTilesX - 10) + flag1 = false; + else if (num23 < 10 || num23 > (int) Main.maxTilesY - 10) + flag1 = false; + } + int number6 = 9; + if (flag1) + number6 <<= 1; + if ((int) sender.serverState == 2) + sender.serverState = (short) 3; + NetMessage.CreateMessage1(9, number6); + NetMessage.SendMessage(sender); + int sectionX1 = (int) Main.spawnTileX / 40; + int sectionY1 = (int) Main.spawnTileY / 30; + NetMessage.SendSectionSquare(sender, sectionX1, sectionY1, 3); + if (flag1) + { + int sectionX2 = num22 / 40; + int sectionY2 = num23 / 30; + NetMessage.SendSectionSquare(sender, sectionX2, sectionY2, 3); + } + for (int index1 = 0; index1 < 200; ++index1) + { + if ((int) Main.item[index1].active != 0) + { + NetMessage.CreateMessage2(21, (int) UI.main.myPlayer, index1); + NetMessage.SendMessage(sender); + NetMessage.CreateMessage1(22, index1); + NetMessage.SendMessage(sender); + } + } + for (int number2 = 0; number2 < 196; ++number2) + { + NPC npc = Main.npc[number2]; + if ((int) npc.active != 0) + { + if (npc.townNPC) + { + int sectionX2 = npc.aabb.X / 640; + int sectionY2 = npc.aabb.X / 640; + NetMessage.SendSectionSquare(sender, sectionX2, sectionY2, 3); + } + NetMessage.CreateMessage1(23, number2); + NetMessage.SendMessage(sender); + } + } + NetMessage.CreateMessage1(56, 17); + NetMessage.SendMessage(sender); + NetMessage.CreateMessage1(56, 18); + NetMessage.SendMessage(sender); + NetMessage.CreateMessage1(56, 19); + NetMessage.SendMessage(sender); + NetMessage.CreateMessage1(56, 20); + NetMessage.SendMessage(sender); + NetMessage.CreateMessage1(56, 22); + NetMessage.SendMessage(sender); + NetMessage.CreateMessage1(56, 38); + NetMessage.SendMessage(sender); + NetMessage.CreateMessage1(56, 54); + NetMessage.SendMessage(sender); + NetMessage.CreateMessage1(56, 107); + NetMessage.SendMessage(sender); + NetMessage.CreateMessage1(56, 108); + NetMessage.SendMessage(sender); + NetMessage.CreateMessage1(56, 124); + NetMessage.SendMessage(sender); + NetMessage.CreateMessage0(57); + NetMessage.SendMessage(sender); + NetMessage.CreateMessage1(49, number5); + NetMessage.SendMessage(sender); + break; + } + } + switch (num1) + { + case 4: + if (Main.netMode == 2) + NetMessage.EchoMessage(sender); + int num24 = (int) ((BinaryReader) NetMessage.packetIn).ReadUInt16(); + Player player3 = Main.player[num24 & 7]; + int num25 = num24 >> 4; + player3.hair = (byte) (num25 & 63); + int num26 = num25 >> 6; + player3.male = (num26 & 1) != 0; + int num27 = num26 >> 1; + player3.difficulty = (byte) num27; + player3.hairColor.R = ((BinaryReader) NetMessage.packetIn).ReadByte(); + player3.hairColor.G = ((BinaryReader) NetMessage.packetIn).ReadByte(); + player3.hairColor.B = ((BinaryReader) NetMessage.packetIn).ReadByte(); + player3.skinColor.R = ((BinaryReader) NetMessage.packetIn).ReadByte(); + player3.skinColor.G = ((BinaryReader) NetMessage.packetIn).ReadByte(); + player3.skinColor.B = ((BinaryReader) NetMessage.packetIn).ReadByte(); + player3.eyeColor.R = ((BinaryReader) NetMessage.packetIn).ReadByte(); + player3.eyeColor.G = ((BinaryReader) NetMessage.packetIn).ReadByte(); + player3.eyeColor.B = ((BinaryReader) NetMessage.packetIn).ReadByte(); + player3.shirtColor.R = ((BinaryReader) NetMessage.packetIn).ReadByte(); + player3.shirtColor.G = ((BinaryReader) NetMessage.packetIn).ReadByte(); + player3.shirtColor.B = ((BinaryReader) NetMessage.packetIn).ReadByte(); + player3.underShirtColor.R = ((BinaryReader) NetMessage.packetIn).ReadByte(); + player3.underShirtColor.G = ((BinaryReader) NetMessage.packetIn).ReadByte(); + player3.underShirtColor.B = ((BinaryReader) NetMessage.packetIn).ReadByte(); + player3.pantsColor.R = ((BinaryReader) NetMessage.packetIn).ReadByte(); + player3.pantsColor.G = ((BinaryReader) NetMessage.packetIn).ReadByte(); + player3.pantsColor.B = ((BinaryReader) NetMessage.packetIn).ReadByte(); + player3.shoeColor.R = ((BinaryReader) NetMessage.packetIn).ReadByte(); + player3.shoeColor.G = ((BinaryReader) NetMessage.packetIn).ReadByte(); + player3.shoeColor.B = ((BinaryReader) NetMessage.packetIn).ReadByte(); + player3.oldName = player3.name; + player3.name = ((BinaryReader) NetMessage.packetIn).ReadString(); + break; + case 5: + if (Main.netMode == 2) + NetMessage.EchoMessage(sender); + int index12 = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + Player player4 = Main.player[index12]; + int index13 = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + int Stack1 = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + int pre1 = 0; + int Type2 = 0; + if (Stack1 > 0) + { + pre1 = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + Type2 = (int) ((BinaryReader) NetMessage.packetIn).ReadInt16(); + } + if (index13 < 49) + { + if (Stack1 > 0) + { + player4.inventory[index13].netDefaults(Type2, Stack1); + player4.inventory[index13].Prefix(pre1); + break; + } + else + { + player4.inventory[index13].Init(); + break; + } + } + else + { + int index1 = index13 - 49; + if (Stack1 > 0) + { + player4.armor[index1].netDefaults(Type2, Stack1); + player4.armor[index1].Prefix(pre1); + break; + } + else + { + player4.armor[index1].Init(); + break; + } + } + case 12: + int plr = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + Player player5 = Main.player[plr]; + if (Main.netMode == 1) + { + if (player5.ui != null) + player5.ui.setPlayer((Player) null); + } + else + NetMessage.EchoMessage(sender); + player5.SpawnX = (int) ((BinaryReader) NetMessage.packetIn).ReadInt16(); + player5.SpawnY = (int) ((BinaryReader) NetMessage.packetIn).ReadInt16(); + player5.Spawn(); + if (Main.netMode != 2 || (int) sender.serverState < 3) + break; + if ((int) sender.serverState == 3) + { + sender.serverState = (short) 10; + NetMessage.greetPlayer(plr); + NetMessage.syncPlayers(); + break; + } + else + { + NetMessage.syncPlayer(plr); + break; + } + case 13: + int num28 = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + Player player6 = Main.player[num28 & 63]; + player6.direction = (num28 & 64) != 0 ? (sbyte) 1 : (sbyte) -1; + int num29 = (num28 & 128) != 0 ? (int) ((BinaryReader) NetMessage.packetIn).ReadByte() : 0; + player6.controlUp = (num29 & 1) != 0; + player6.controlDown = (num29 & 2) != 0; + player6.controlLeft = (num29 & 4) != 0; + player6.controlRight = (num29 & 8) != 0; + player6.controlJump = (num29 & 16) != 0; + player6.controlUseItem = (num29 & 32) != 0; + if ((num29 & 32) != 0) + player6.selectedItem = ((BinaryReader) NetMessage.packetIn).ReadSByte(); + player6.position = NetMessage.packetIn.ReadVector2(); + player6.aabb.X = (int) player6.position.X; + player6.aabb.Y = (int) player6.position.Y; + player6.velocity = new HalfVector2() + { + PackedValue = ((BinaryReader) NetMessage.packetIn).ReadUInt32() + }.ToVector2(); + player6.fallStart = (short) (player6.aabb.Y >> 4); + if (Main.netMode != 2 || (int) sender.serverState != 10) + break; + NetMessage.EchoMessage(sender); + break; + case 15: + int index14 = (int) ((BinaryReader) NetMessage.packetIn).ReadUInt16(); + int index15 = (int) ((BinaryReader) NetMessage.packetIn).ReadUInt16(); + int num30 = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + int num31 = (int) Main.tile[index14, index15].active; + Main.tile[index14, index15].active = (byte) (num30 & 1); + Main.tile[index14, index15].wire = num30 & 16; + if ((int) Main.tile[index14, index15].active != 0) + { + int num2 = (int) Main.tile[index14, index15].type; + int index1 = (int) (Main.tile[index14, index15].type = ((BinaryReader) NetMessage.packetIn).ReadByte()); + if (Main.tileFrameImportant[index1]) + { + Main.tile[index14, index15].frameX = (short) NetMessage.ReadCompacted(); + Main.tile[index14, index15].frameY = (short) NetMessage.ReadCompacted(); + } + else if (num31 == 0 || index1 != num2) + { + Main.tile[index14, index15].frameX = (short) -1; + Main.tile[index14, index15].frameY = (short) -1; + } + } + if ((num30 & 4) != 0) + Main.tile[index14, index15].wall = ((BinaryReader) NetMessage.packetIn).ReadByte(); + if (Main.netMode != 2 && (num30 & 8) != 0) + { + Main.tile[index14, index15].lava = (byte) (num30 & 32); + Main.tile[index14, index15].liquid = ((BinaryReader) NetMessage.packetIn).ReadByte(); + } + WorldGen.TileFrame(index14, index15, 0); + WorldGen.WallFrame(index14, index15, false); + if (Main.netMode != 2) + break; + NetMessage.CreateMessage2(15, index14, index15); + NetMessage.SendMessageIgnore(sender); + break; + case 16: + int num32 = ((BinaryReader) NetMessage.packetIn).ReadInt32(); + Player player7 = Main.player[num32 & 15]; + int num33 = num32 << 16 >> 20; + player7.statLife = (short) num33; + if (num33 <= 0) + player7.dead = true; + player7.statLifeMax = (short) (num32 >> 16); + if (Main.netMode != 2) + break; + NetMessage.EchoMessage(sender); + break; + case 17: + int num34 = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + int num35 = (int) ((BinaryReader) NetMessage.packetIn).ReadUInt16(); + int num36 = (int) ((BinaryReader) NetMessage.packetIn).ReadUInt16(); + int type2 = num34 <= 4 ? (int) ((BinaryReader) NetMessage.packetIn).ReadByte() : 1; + bool fail = type2 == 1; + if (Main.netMode == 2) + { + if (!fail && (num34 == 0 || num34 == 2 || num34 == 4) && !sender.tileSection[num35 / 40, num36 / 30]) + fail = true; + NetMessage.EchoMessage(sender); + } + switch (num34) + { + case 0: + WorldGen.KillTile(num35, num36, fail, false, false); + return; + case 1: + int style = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + WorldGen.PlaceTile(num35, num36, type2, false, true, -1, style); + if (type2 != 53 || Main.netMode != 2) + return; + NetMessage.SendTile(num35, num36); + return; + case 2: + WorldGen.KillWall(num35, num36, fail); + return; + case 3: + WorldGen.PlaceWall(num35, num36, type2); + return; + case 4: + WorldGen.KillTile(num35, num36, fail, false, true); + return; + case 5: + WorldGen.PlaceWire(num35, num36); + return; + case 6: + WorldGen.KillWire(num35, num36); + return; + default: + return; + } + case 19: + if (Main.netMode == 2) + NetMessage.EchoMessage(sender); + WorldGen.OpenDoor((int) ((BinaryReader) NetMessage.packetIn).ReadUInt16(), (int) ((BinaryReader) NetMessage.packetIn).ReadUInt16(), (int) ((BinaryReader) NetMessage.packetIn).ReadSByte()); + break; + case 20: + int number7 = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + int num37 = (int) ((BinaryReader) NetMessage.packetIn).ReadUInt16(); + int num38 = (int) ((BinaryReader) NetMessage.packetIn).ReadUInt16(); + for (int index1 = num37; index1 < num37 + number7; ++index1) + { + for (int index2 = num38; index2 < num38 + number7; ++index2) + { + int num2 = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + int num3 = (int) Main.tile[index1, index2].active; + Main.tile[index1, index2].active = (byte) (num2 & 1); + Main.tile[index1, index2].wire = num2 & 16; + if ((int) Main.tile[index1, index2].active != 0) + { + int num4 = (int) Main.tile[index1, index2].type; + int index3 = (int) (Main.tile[index1, index2].type = ((BinaryReader) NetMessage.packetIn).ReadByte()); + if (Main.tileFrameImportant[index3]) + { + Main.tile[index1, index2].frameX = (short) NetMessage.ReadCompacted(); + Main.tile[index1, index2].frameY = (short) NetMessage.ReadCompacted(); + } + else if (num3 == 0 || index3 != num4) + { + Main.tile[index1, index2].frameX = (short) -1; + Main.tile[index1, index2].frameY = (short) -1; + } + } + if ((num2 & 4) != 0) + Main.tile[index1, index2].wall = ((BinaryReader) NetMessage.packetIn).ReadByte(); + if (Main.netMode != 2 && (num2 & 8) != 0) + { + Main.tile[index1, index2].lava = (byte) (num2 & 32); + Main.tile[index1, index2].liquid = ((BinaryReader) NetMessage.packetIn).ReadByte(); + } + } + } + WorldGen.RangeFrame(num37, num38, num37 + number7, num38 + number7); + if (Main.netMode != 2) + break; + NetMessage.CreateMessage3(20, number7, num37, num38); + NetMessage.SendMessageIgnore(sender); + break; + case 21: + int number2_3 = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + int num39 = (int) ((BinaryReader) NetMessage.packetIn).ReadInt16(); + int number8 = num39 & 31; + int Type3 = num39 >> 5; + if (Main.netMode == 1) + { + if (Type3 == 0) + { + Main.item[number2_3].active = (byte) 0; + break; + } + else + { + Main.item[number2_3].netDefaults(Type3, 1); + Main.item[number2_3].Prefix((int) ((BinaryReader) NetMessage.packetIn).ReadByte()); + Main.item[number2_3].stack = (short) ((BinaryReader) NetMessage.packetIn).ReadByte(); + Main.item[number2_3].position = NetMessage.packetIn.ReadVector2(); + Main.item[number2_3].velocity = new HalfVector2() + { + PackedValue = ((BinaryReader) NetMessage.packetIn).ReadUInt32() + }.ToVector2(); + Main.item[number2_3].wet = Collision.WetCollision(ref Main.item[number2_3].position, (int) Main.item[number2_3].width, (int) Main.item[number2_3].height); + break; + } + } + else if (Type3 == 0) + { + Main.item[number2_3].active = (byte) 0; + NetMessage.CreateMessage2(21, number8, number2_3); + NetMessage.SendMessage(); + break; + } + else + { + int pre2 = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + int Stack2 = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + float num2 = ((BinaryReader) NetMessage.packetIn).ReadSingle(); + float num3 = ((BinaryReader) NetMessage.packetIn).ReadSingle(); + bool flag2 = number2_3 == 200; + if (flag2) + { + Item obj = new Item(); + obj.netDefaults(Type3, Stack2); + number2_3 = (int) (short) Item.NewItem((int) num2, (int) num3, (int) obj.width, (int) obj.height, (int) obj.type, Stack2, true, 0); + } + else + { + Main.item[number2_3].position.X = num2; + Main.item[number2_3].position.Y = num3; + } + Main.item[number2_3].netDefaults(Type3, Stack2); + Main.item[number2_3].Prefix(pre2); + Main.item[number2_3].velocity = new HalfVector2() + { + PackedValue = ((BinaryReader) NetMessage.packetIn).ReadUInt32() + }.ToVector2(); + Main.item[number2_3].owner = (byte) 8; + NetMessage.CreateMessage2(21, number8, number2_3); + if (flag2) + { + NetMessage.SendMessage(); + Main.item[number2_3].ownIgnore = (byte) number8; + Main.item[number2_3].ownTime = (byte) 100; + break; + } + else + { + NetMessage.SendMessageIgnore(Main.player[number8].client); + break; + } + } + case 22: + int index16 = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + int num40 = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + int num41 = num40 & 128; + int num42 = num40 ^ num41; + Main.item[index16].owner = (byte) num42; + if (num42 < 8) + { + Main.item[index16].keepTime = (byte) 15; + Main.item[index16].position = NetMessage.packetIn.ReadVector2(); + if (num41 != 0) + { + Main.item[index16].velocity = new HalfVector2() + { + PackedValue = ((BinaryReader) NetMessage.packetIn).ReadUInt32() + }.ToVector2(); + } + else + { + Main.item[index16].velocity.X = 0.0f; + Main.item[index16].velocity.Y = 0.0f; + } + } + if (Main.netMode != 2) + break; + NetMessage.EchoMessage(sender); + break; + case 24: + if (Main.netMode == 2) + NetMessage.EchoMessage(sender); + WorldGen.CloseDoor((int) ((BinaryReader) NetMessage.packetIn).ReadUInt16(), (int) ((BinaryReader) NetMessage.packetIn).ReadUInt16(), true); + break; + case 26: + if (Main.netMode == 2) + NetMessage.EchoMessage(sender); + int index17 = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + int hitDirection1 = (int) ((BinaryReader) NetMessage.packetIn).ReadSByte(); + int Damage1 = (int) ((BinaryReader) NetMessage.packetIn).ReadInt16(); + bool pvp = ((BinaryReader) NetMessage.packetIn).ReadBoolean(); + bool Crit = ((BinaryReader) NetMessage.packetIn).ReadBoolean(); + uint deathText1 = ((BinaryReader) NetMessage.packetIn).ReadUInt32(); + Main.player[index17].Hurt(Damage1, hitDirection1, pvp, true, deathText1, Crit); + break; + case 27: + int num43 = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + int num44 = num43 >> 4; + int num45 = num43 & 15; + int Type4 = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + int num46 = (int) NetMessage.ReadCompacted(); + int index18 = 512; + for (int index1 = 0; index1 < 512; ++index1) + { + if ((int) Main.projectile[index1].owner == num45 && (int) Main.projectile[index1].identity == num46 && (int) Main.projectile[index1].active != 0) + { + index18 = index1; + break; + } + } + if (index18 == 512) + { + for (int index1 = 0; index1 < 512; ++index1) + { + if ((int) Main.projectile[index1].active == 0) + { + index18 = index1; + break; + } + } + } + if ((int) Main.projectile[index18].active == 0 || (int) Main.projectile[index18].type != Type4) + Main.projectile[index18].SetDefaults(Type4); + Main.projectile[index18].type = (byte) Type4; + Main.projectile[index18].owner = (byte) num45; + Main.projectile[index18].identity = (ushort) num46; + Main.projectile[index18].position = NetMessage.packetIn.ReadVector2(); + Main.projectile[index18].aabb.X = (int) Main.projectile[index18].position.X; + Main.projectile[index18].aabb.Y = (int) Main.projectile[index18].position.Y; + Main.projectile[index18].velocity = new HalfVector2() + { + PackedValue = ((BinaryReader) NetMessage.packetIn).ReadUInt32() + }.ToVector2(); + if ((num44 & 1) != 0) + Main.projectile[index18].knockBack = new HalfSingle() + { + PackedValue = ((BinaryReader) NetMessage.packetIn).ReadUInt16() + }.ToSingle(); + else + Main.projectile[index18].knockBack = 0.0f; + Main.projectile[index18].damage = (num44 & 2) != 0 ? ((BinaryReader) NetMessage.packetIn).ReadInt16() : (short) 0; + Main.projectile[index18].ai0 = (num44 & 4) != 0 ? ((BinaryReader) NetMessage.packetIn).ReadSingle() : 0.0f; + Main.projectile[index18].ai1 = (num44 & 8) != 0 ? (int) ((BinaryReader) NetMessage.packetIn).ReadInt16() : 0; + if (Main.netMode != 2) + break; + NetMessage.EchoProjectileMessage(sender, ref Main.projectile[index18]); + break; + case 28: + if (Main.netMode == 2) + NetMessage.EchoMessage(sender); + int number9 = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + int Damage2 = (int) ((BinaryReader) NetMessage.packetIn).ReadInt16(); + if (Damage2 >= 0) + { + float knockBack = new HalfSingle() + { + PackedValue = ((BinaryReader) NetMessage.packetIn).ReadUInt16() + }.ToSingle(); + int num2 = (int) ((BinaryReader) NetMessage.packetIn).ReadSByte(); + bool crit = (num2 & 1) != 0; + int hitDirection2 = num2 >> 1; + Main.npc[number9].StrikeNPC(Damage2, knockBack, hitDirection2, crit, false); + } + else + { + Main.npc[number9].life = 0; + if ((int) Main.npc[number9].active == 0) + break; + Main.npc[number9].HitEffect(0, 10.0); + Main.npc[number9].active = (byte) 0; + } + if (Main.netMode != 2) + break; + if (Main.npc[number9].life <= 0) + { + NetMessage.CreateMessage1(23, number9); + NetMessage.SendMessage(); + break; + } + else + { + Main.npc[number9].netUpdate = true; + break; + } + case 29: + int num47 = (int) NetMessage.ReadCompacted(); + int num48 = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + if (Main.netMode == 2) + NetMessage.EchoMessage(sender); + for (int index1 = 0; index1 < 512; ++index1) + { + if ((int) Main.projectile[index1].owner == num48 && (int) Main.projectile[index1].identity == num47 && (int) Main.projectile[index1].active != 0) + { + Main.projectile[index1].Kill(); + break; + } + } + break; + case 30: + int num49 = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + int num50 = num49 & 128; + int index19 = num49 ^ num50; + Player player8 = Main.player[index19]; + if (Main.netMode == 2) + { + NetMessage.EchoMessage(sender); + int textId = num50 != 0 ? 24 : 25; + NetMessage.SendText(player8.name, textId, (int) Main.teamColor[(int) player8.team].R, (int) Main.teamColor[(int) player8.team].G, (int) Main.teamColor[(int) player8.team].B, -1); + } + player8.hostile = num50 != 0; + break; + case 32: + int index20 = (int) NetMessage.ReadCompacted(); + int index21 = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + if (Main.chest[index20] == null) + Main.chest[index20] = new Chest(); + int Type5 = (int) ((BinaryReader) NetMessage.packetIn).ReadInt16(); + if (Type5 != 0) + { + int pre2 = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + int Stack2 = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + Main.chest[index20].item[index21].netDefaults(Type5, Stack2); + Main.chest[index20].item[index21].Prefix(pre2); + break; + } + else + { + Main.chest[index20].item[index21].Init(); + break; + } + case 33: + int num51 = (int) ((BinaryReader) NetMessage.packetIn).ReadInt16(); + Player player9 = Main.player[num51 & 31]; + int num52 = num51 >> 5; + if (player9.isLocal()) + { + int num2 = (int) player9.chest; + player9.chest = (short) num52; + if (num52 >= 0) + { + player9.chestX = ((BinaryReader) NetMessage.packetIn).ReadInt16(); + player9.chestY = ((BinaryReader) NetMessage.packetIn).ReadInt16(); + } + if (num2 == -1) + { + player9.ui.OpenInventory(); + Main.PlaySound(10); + break; + } + else if (num52 == -1) + { + if (player9.ui.inventorySection != UI.InventorySection.CHEST) + break; + player9.ui.CloseInventory(); + Main.PlaySound(11); + break; + } + else + { + if (num2 == num52) + break; + player9.ui.OpenInventory(); + Main.PlaySound(12); + break; + } + } + else + { + player9.chest = (short) num52; + if (num52 < 0) + break; + NetMessage.packetIn.Position = NetMessage.packetIn.Position + 4; + break; + } + case 35: + if (Main.netMode == 2) + NetMessage.EchoMessage(sender); + int index22 = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + int healAmount = (int) NetMessage.ReadCompacted(); + Main.player[index22].HealEffect(healAmount); + break; + case 36: + if (Main.netMode == 2) + NetMessage.EchoMessage(sender); + int index23 = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + Player player10 = Main.player[index23]; + int num53 = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + player10.zoneEvil = (num53 & 1) != 0; + player10.zoneMeteor = (num53 & 2) != 0; + player10.zoneDungeon = (num53 & 4) != 0; + player10.zoneJungle = (num53 & 8) != 0; + player10.zoneHoly = (num53 & 16) != 0; + break; + case 40: + if (Main.netMode == 2) + NetMessage.EchoMessage(sender); + int index24 = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + Main.player[index24].talkNPC = ((BinaryReader) NetMessage.packetIn).ReadInt16(); + break; + case 41: + if (Main.netMode == 2) + NetMessage.EchoMessage(sender); + int index25 = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + Player player11 = Main.player[index25]; + player11.itemRotation = ((BinaryReader) NetMessage.packetIn).ReadSingle(); + player11.itemAnimation = ((BinaryReader) NetMessage.packetIn).ReadInt16(); + player11.channel = player11.inventory[(int) player11.selectedItem].channel; + break; + case 42: + if (Main.netMode == 2) + NetMessage.EchoMessage(sender); + int index26 = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + Player player12 = Main.player[index26]; + player12.statMana = ((BinaryReader) NetMessage.packetIn).ReadInt16(); + player12.statManaMax = ((BinaryReader) NetMessage.packetIn).ReadInt16(); + break; + case 43: + if (Main.netMode == 2) + NetMessage.EchoMessage(sender); + int index27 = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + int manaAmount = (int) ((BinaryReader) NetMessage.packetIn).ReadInt16(); + Main.player[index27].ManaEffect(manaAmount); + break; + case 44: + if (Main.netMode == 2) + NetMessage.EchoMessage(sender); + int index28 = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + int hitDirection3 = (int) ((BinaryReader) NetMessage.packetIn).ReadSByte(); + int num54 = (int) ((BinaryReader) NetMessage.packetIn).ReadInt16(); + int num55 = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + uint deathText2 = ((BinaryReader) NetMessage.packetIn).ReadUInt32(); + Main.player[index28].KillMe((double) num54, hitDirection3, num55 != 0, deathText2); + break; + case 45: + int num56 = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + int index29 = num56 >> 4; + int index30 = num56 & 15; + Player player13 = Main.player[index30]; + int num57 = (int) player13.team; + player13.team = (byte) index29; + if (Main.netMode != 2) + break; + NetMessage.EchoMessage(sender); + int textId1 = 26 + index29; + for (int player1 = 0; player1 < 8; ++player1) + { + if (player1 == index30 || num57 > 0 && (int) Main.player[player1].team == num57 || index29 > 0 && (int) Main.player[player1].team == index29) + NetMessage.SendText(player13.name, textId1, (int) Main.teamColor[index29].R, (int) Main.teamColor[index29].G, (int) Main.teamColor[index29].B, player1); + } + break; + case 47: + int index31 = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + Player player14 = Main.player[index31]; + int index32 = (int) NetMessage.ReadCompacted(); + Main.sign[index32].Read(NetMessage.packetIn); + if (Main.netMode != 1 || index32 == (int) player14.sign) + break; + player14.ui.CloseInventory(); + player14.talkNPC = (short) -1; + player14.ui.editSign = false; + Main.PlaySound(10); + player14.sign = (short) index32; + player14.ui.npcChatText = Main.sign[index32].text; + break; + case 48: + int i1 = (int) ((BinaryReader) NetMessage.packetIn).ReadUInt16(); + int num58 = (int) ((BinaryReader) NetMessage.packetIn).ReadUInt16(); + int j = num58 & (int) short.MaxValue; + Main.tile[i1, j].liquid = ((BinaryReader) NetMessage.packetIn).ReadByte(); + Main.tile[i1, j].lava = (byte) (num58 >> 10 & 32); + if (Main.netMode != 2) + break; + WorldGen.SquareTileFrame(i1, j, -1); + break; + case 50: + if (Main.netMode == 2) + NetMessage.EchoMessage(sender); + int index33 = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + Player player15 = Main.player[index33]; + for (int index1 = 0; index1 < 10; ++index1) + { + int num2 = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + player15.buff[index1].Type = (ushort) num2; + player15.buff[index1].Time = num2 > 0 ? (ushort) 60 : (ushort) 0; + } + break; + case 51: + if (Main.netMode == 2) + NetMessage.EchoMessage(sender); + Player player16 = Main.player[(int) ((BinaryReader) NetMessage.packetIn).ReadByte()]; + Main.PlaySound(2, player16.aabb.X, player16.aabb.Y, 1); + break; + case 52: + if (Main.netMode == 2) + NetMessage.EchoMessage(sender); + int num59 = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + int num60 = (int) ((BinaryReader) NetMessage.packetIn).ReadUInt16(); + int num61 = (int) ((BinaryReader) NetMessage.packetIn).ReadUInt16(); + Chest.Unlock(num60, num61); + if (Main.netMode != 2) + break; + NetMessage.SendTileSquare(num60, num61, 2); + break; + case 55: + if (Main.netMode == 2) + NetMessage.EchoMessage(sender); + int index34 = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + Main.player[index34].AddBuff((int) ((BinaryReader) NetMessage.packetIn).ReadByte(), (int) NetMessage.ReadCompacted(), true); + break; + case 58: + if (Main.netMode == 2) + NetMessage.EchoMessage(sender); + int index35 = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + Player player17 = Main.player[index35]; + Main.harpNote = ((BinaryReader) NetMessage.packetIn).ReadSingle(); + Main.PlaySound(2, player17.aabb.X, player17.aabb.Y, (int) player17.inventory[(int) player17.selectedItem].type == 507 ? 35 : 26); + break; + case 59: + if (Main.netMode == 2) + NetMessage.EchoMessage(sender); + WorldGen.hitSwitch((int) ((BinaryReader) NetMessage.packetIn).ReadUInt16(), (int) ((BinaryReader) NetMessage.packetIn).ReadUInt16()); + break; + case 60: + int n = (int) ((BinaryReader) NetMessage.packetIn).ReadByte(); + int x = (int) ((BinaryReader) NetMessage.packetIn).ReadInt16(); + int y = (int) ((BinaryReader) NetMessage.packetIn).ReadInt16(); + bool flag3 = ((BinaryReader) NetMessage.packetIn).ReadBoolean(); + if (Main.netMode == 1) + { + Main.npc[n].homeless = flag3; + Main.npc[n].homeTileX = (short) x; + Main.npc[n].homeTileY = (short) y; + break; + } + else if (!flag3) + { + WorldGen.kickOut(n); + break; + } + else + { + WorldGen.moveRoom(x, y, n); + break; + } + } + } + + public static void BootPlayer(int plr, int stringId) + { + NetMessage.SendKick(Main.player[plr].client, stringId); + Main.player[plr].kill = true; + } + + public static void SendTileSquare(int tileX, int tileY, int size) + { + int num = size - 1 >> 1; + NetMessage.CreateMessage3(20, size, tileX - num, tileY - num); + NetMessage.SendMessage(); + } + + public static void SendTile(int tileX, int tileY) + { + NetMessage.CreateMessage2(15, tileX, tileY); + NetMessage.SendMessage(); + } + + public static bool SendSection(NetClient client, int sectionX, int sectionY) + { + if (sectionX < 0 || sectionY < 0 || (sectionX >= Main.maxSectionsX || sectionY >= Main.maxSectionsY) || client.tileSection[sectionX, sectionY]) + return false; + client.tileSection[sectionX, sectionY] = true; + NetMessage.CreateMessage2(10, sectionX, sectionY); + NetMessage.SendMessage(client); + return true; + } + + public static void SendSectionSquare(NetClient client, int sectionX, int sectionY, int size) + { + int num = size - 1 >> 1; + for (int sectionX1 = sectionX - num; sectionX1 <= sectionX + num; ++sectionX1) + { + for (int sectionY1 = sectionY - num; sectionY1 <= sectionY + num; ++sectionY1) + NetMessage.SendSection(client, sectionX1, sectionY1); + } + } + + public static void greetPlayer(int plr) + { + NetMessage.SendText(31, Main.player[plr].name + "!", (int) byte.MaxValue, 240, 20, plr); + string str = (string) null; + for (int index = 0; index < 8; ++index) + { + if ((int) Main.player[index].active != 0) + str = str != null ? str + ", " + Main.player[index].name : Main.player[index].name; + } + NetMessage.SendText(23, str + (object) '.', (int) byte.MaxValue, 240, 20, plr); + } + + public static void sendWater(int x, int y) + { + NetMessage.CreateMessage2(48, x, y); + if (Main.netMode == 1) + { + NetMessage.SendMessage(); + } + else + { + for (int index1 = Netplay.clients.Count - 1; index1 >= 0; --index1) + { + NetClient client = Netplay.clients[index1]; + if ((int) client.serverState >= 3) + { + int index2 = x / 40; + int index3 = y / 30; + if (client.tileSection[index2, index3]) + NetMessage.SendMessageNoClear(client); + } + } + NetMessage.ClearMessage(); + } + } + + public static void syncPlayer(int plr) + { + Player player = Main.player[plr]; + NetClient ignoreClient = player.client; + NetMessage.CreateMessage2(14, plr, (int) player.active); + NetMessage.SendMessageIgnore(ignoreClient); + if ((int) player.active != 0 && (ignoreClient == null || (int) ignoreClient.serverState == 10)) + { + NetMessage.CreateMessage1(4, plr); + NetMessage.SendMessageIgnore(ignoreClient); + NetMessage.CreateMessage1(13, plr); + NetMessage.SendMessageIgnore(ignoreClient); + NetMessage.CreateMessage1(16, plr); + NetMessage.SendMessageIgnore(ignoreClient); + NetMessage.CreateMessage1(30, plr); + NetMessage.SendMessageIgnore(ignoreClient); + NetMessage.CreateMessage1(42, plr); + NetMessage.SendMessageIgnore(ignoreClient); + NetMessage.CreateMessage1(45, plr); + NetMessage.SendMessageIgnore(ignoreClient); + NetMessage.CreateMessage1(50, plr); + NetMessage.SendMessageIgnore(ignoreClient); + for (int number2 = 0; number2 < 49; ++number2) + { + NetMessage.CreateMessage2(5, plr, number2); + NetMessage.SendMessage(); + } + for (int index = 0; index < 11; ++index) + { + NetMessage.CreateMessage2(5, plr, index + 49); + NetMessage.SendMessage(); + } + if (Main.player[plr].announced) + return; + Main.player[plr].announced = true; + NetMessage.SendText(player.name, 32, (int) byte.MaxValue, 240, 20, -1); + player.oldName = player.name; + } + else + { + if (!player.announced) + return; + player.announced = false; + NetMessage.SendText(player.oldName, 33, (int) byte.MaxValue, 240, 20, -1); + } + } + + public static void syncPlayers() + { + for (int plr = 0; plr < 8; ++plr) + NetMessage.syncPlayer(plr); + for (int number = 0; number < 196; ++number) + { + if ((int) Main.npc[number].active != 0 && Main.npc[number].townNPC && -1 != Main.npc[number].getHeadTextureId()) + { + NetMessage.CreateMessage4(60, number, (int) Main.npc[number].homeTileX, (int) Main.npc[number].homeTileY, Main.npc[number].homeless ? 1 : 0); + NetMessage.SendMessage(); + } + } + } + } +} diff --git a/Terraria/NetPlayer.cs b/Terraria/NetPlayer.cs new file mode 100644 index 0000000..51946c7 --- /dev/null +++ b/Terraria/NetPlayer.cs @@ -0,0 +1,32 @@ +// Type: Terraria.NetPlayer +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +namespace Terraria +{ + public sealed class NetPlayer + { + public Item[] inventory = new Item[49]; + public Item[] armor = new Item[11]; + public Buff[] buff = new Buff[10]; + public bool zoneDungeon; + public bool zoneEvil; + public bool zoneHoly; + public bool zoneMeteor; + public bool zoneJungle; + public sbyte selectedItem; + public bool controlUp; + public bool controlDown; + public bool controlLeft; + public bool controlRight; + public bool controlJump; + public bool controlUseItem; + public short statLifeMax; + public short statLife; + public short statMana; + public short statManaMax; + public short chest; + public short talkNPC; + } +} diff --git a/Terraria/Netplay.cs b/Terraria/Netplay.cs new file mode 100644 index 0000000..f2cd3f7 --- /dev/null +++ b/Terraria/Netplay.cs @@ -0,0 +1,590 @@ +// Type: Terraria.Netplay +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.GamerServices; +using Microsoft.Xna.Framework.Net; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Threading; + +namespace Terraria +{ + public sealed class Netplay + { + public static List gamersWhoReceivedInvite = new List(4); + public static List gamersWaitingToJoinInvite = new List(4); + public static List gamersWaitingForPlayerId = new List(4); + public static List gamersWaitingToSendSpawn = new List(4); + public static List gamersWaitingToSpawn = new List(4); + public static List clients = new List(7); + public static bool[] playerSlots = new bool[8]; + public static List availableSessions = new List(32); + private static Thread sessionFinderThread = (Thread) null; + private static volatile bool stopSessionFinderThread = false; + public static AutoResetEvent sessionReadyEvent = new AutoResetEvent(false); + public static bool disconnect; + public static bool stopSession; + public static bool hookEvents; + public static bool isJoiningRemoteInvite; + public static LocalNetworkGamer gamer; + public static NetworkSession session; + public static InviteAcceptedEventArgs invite; + public static Thread sessionThread; + public static Netplay.ClientState clientState; + public static int clientStatusCount; + public static int clientStatusMax; + + static Netplay() + { + } + + public static void Init() + { + Netplay.disconnect = false; + Netplay.hookEvents = false; + Netplay.stopSession = false; + Netplay.clientState = Netplay.ClientState.JOINING; + Netplay.clientStatusCount = 0; + Netplay.clientStatusMax = 0; + } + + public static void ResetSections() + { + for (int index = Netplay.clients.Count - 1; index >= 0; --index) + Netplay.clients[index].ResetSections(); + } + + public static void ResetSections(ref Vector2i min, ref Vector2i max) + { + for (int index = Netplay.clients.Count - 1; index >= 0; --index) + Netplay.clients[index].ResetSections(ref min, ref max); + } + + public static void CreateSession() + { + NetworkSessionType networkSessionType = Main.netMode != 0 ? NetworkSessionType.PlayerMatch : NetworkSessionType.Local; + try + { + List list = new List(1); + list.Add(UI.main.signedInGamer); + NetworkSessionProperties sessionProperties = new NetworkSessionProperties(); + ulong xuid = GamerExtensions.GetXuid((Gamer) UI.main.signedInGamer); + if (UI.main.isInviteOnly) + { + sessionProperties.set_Item(2, new int?(-559038737)); + } + else + { + sessionProperties.set_Item(0, new int?((int) xuid)); + sessionProperties.set_Item(1, new int?((int) (xuid >> 32))); + } + int num1 = 8; + int num2 = 0; + if (!Main.IsTutorial() && UI.main.isInviteOnly) + num2 = 7; + Netplay.session = NetworkSession.Create(networkSessionType, (IEnumerable) list, num1, num2, sessionProperties); + Netplay.session.AllowJoinInProgress = true; + Netplay.session.AllowHostMigration = false; + Netplay.hookEvents = true; + Netplay.session.StartGame(); + } + catch (Exception ex) + { + UI.Error(Lang.menu[5], Lang.inter[20], false); + UI.main.menuType = MenuType.MAIN; + Main.netMode = 0; + Netplay.disconnect = true; + } + } + + public static void HookSessionEvents() + { + Netplay.session.add_GamerJoined(new EventHandler(Netplay.GamerJoinedEventHandler)); + Netplay.session.add_GamerLeft(new EventHandler(Netplay.GamerLeftEventHandler)); + Netplay.session.add_GameEnded(new EventHandler(Netplay.GameEndedEventHandler)); + Netplay.session.add_SessionEnded(new EventHandler(Netplay.SessionEndedEventHandler)); + Netplay.hookEvents = false; + } + + public static void DisposeSession() + { + Netplay.session.remove_GamerJoined(new EventHandler(Netplay.GamerJoinedEventHandler)); + Netplay.session.remove_GamerLeft(new EventHandler(Netplay.GamerLeftEventHandler)); + Netplay.session.remove_GameEnded(new EventHandler(Netplay.GameEndedEventHandler)); + Netplay.session.remove_SessionEnded(new EventHandler(Netplay.SessionEndedEventHandler)); + Netplay.session.Dispose(); + Netplay.session = (NetworkSession) null; + } + + public static void Disconnect() + { + if (Netplay.session != null) + { + if (Main.netMode != 1) + { + if (Netplay.session.SessionState == NetworkSessionState.Playing) + { + Netplay.session.EndGame(); + Netplay.session.Update(); + } + Netplay.clients.Clear(); + for (int index = 7; index >= 0; --index) + Netplay.playerSlots[index] = false; + } + Netplay.DisposeSession(); + Netplay.gamer = (LocalNetworkGamer) null; + Netplay.gamersWaitingForPlayerId.Clear(); + Netplay.gamersWaitingToSendSpawn.Clear(); + Netplay.gamersWaitingToSpawn.Clear(); + for (int index = 0; index < 4; ++index) + Main.ui[index].LeaveSession(); + } + Netplay.disconnect = false; + Netplay.hookEvents = false; + Netplay.stopSession = false; + Main.netMode = 0; + } + + public static void SetAsRemotePlayerSlot(int i) + { + Player player = Main.player[i]; + UI ui = player.ui; + if (ui == null) + return; + if (player.view != null) + ui.setPlayer(-1, true); + else + ui.setPlayer((Player) null); + } + + private static void GamerJoinedEventHandler(object sender, GamerJoinedEventArgs e) + { + NetworkGamer gamer = e.Gamer; + if (Main.netMode == 0) + { + for (int index = 0; index < 4; ++index) + { + UI ui = Main.ui[index]; + if (ui.wasRemovedFromSessionWithoutOurConsent) + { + SignedInGamer signedInGamer = ui.signedInGamer; + if (signedInGamer != null && signedInGamer.Gamertag == gamer.Gamertag) + { + gamer.Tag = (object) ui.player; + return; + } + } + } + } + else if (!gamer.IsLocal) + Main.checkUserGeneratedContent = true; + int index1 = 0; + if (Main.netMode != 1) + { + while (Netplay.playerSlots[index1]) + ++index1; + Netplay.playerSlots[index1] = true; + } + if (gamer.IsLocal) + { + LocalNetworkGamer localNetworkGamer = (LocalNetworkGamer) gamer; + SignedInGamer signedInGamer = localNetworkGamer.SignedInGamer; + UI startUI = Main.ui[(int) signedInGamer.PlayerIndex]; + startUI.localGamer = localNetworkGamer; + if (Main.netMode != 1) + { + startUI.JoinSession(index1); + Player player = Main.player[index1]; + gamer.Tag = (object) player; + player.client = (NetClient) null; + if (gamer.IsHost) + Netplay.sessionReadyEvent.Set(); + else + Main.JoinGame(startUI); + } + else + Netplay.gamersWaitingForPlayerId.Add(startUI); + if (Netplay.gamer != null) + return; + Netplay.gamer = localNetworkGamer; + } + else if (Main.netMode == 2) + { + Netplay.SetAsRemotePlayerSlot(index1); + NetClient netClient = (NetClient) null; + for (int index2 = Netplay.clients.Count - 1; index2 >= 0; --index2) + { + if (Netplay.clients[index2].machine == gamer.Machine) + { + netClient = Netplay.clients[index2]; + break; + } + } + if (netClient == null) + { + netClient = new NetClient(gamer); + Netplay.clients.Add(netClient); + NetMessage.syncPlayers(); + } + Player player = Main.player[index1]; + netClient.GamerJoined(player); + gamer.Tag = (object) player; + NetMessage.SendPlayerId(gamer, index1); + } + else + { + if (Main.netMode != 1 || Netplay.gamer == null) + return; + NetMessage.CreateMessage0(11); + NetMessage.SendMessage(); + } + } + + private static void GamerLeftEventHandler(object sender, GamerLeftEventArgs e) + { + NetworkGamer gamer = e.Gamer; + Player player = gamer.Tag as Player; + if (gamer.IsLocal) + { + UI ui = Main.ui[(int) ((LocalNetworkGamer) gamer).SignedInGamer.PlayerIndex]; + if (Main.netMode == 0 && ui.wasRemovedFromSessionWithoutOurConsent) + return; + ui.LeaveSession(); + } + if (Main.netMode == 1) + return; + int number = (int) player.whoAmI; + player.active = (byte) 0; + Netplay.playerSlots[number] = false; + if (Main.netMode != 2) + return; + if (gamer.IsLocal) + { + if (UI.main.isInviteOnly) + ++Netplay.session.PrivateGamerSlots; + } + else + { + NetClient netClient = player.client; + if (netClient.GamerLeft(player)) + Netplay.clients.Remove(netClient); + else if (gamer == netClient.gamer) + netClient.gamer = ((ReadOnlyCollection) netClient.machine.Gamers)[0]; + } + NetMessage.CreateMessage2(14, number, 0); + NetMessage.SendMessage(); + if (!player.announced) + return; + player.announced = false; + NetMessage.SendText(player.oldName, 33, (int) byte.MaxValue, 240, 20, -1); + } + + private static void GameEndedEventHandler(object sender, GameEndedEventArgs e) + { + if (Main.netMode != 1) + return; + UI.Error(Lang.inter[66], Lang.inter[67], false); + Main.saveOnExit = UI.main.autoSave; + UI.main.ExitGame(); + } + + private static void SessionEndedEventHandler(object sender, NetworkSessionEndedEventArgs e) + { + if (UI.main.menuMode == MenuMode.ERROR) + return; + string desc; + switch (e.EndReason) + { + case NetworkSessionEndReason.ClientSignedOut: + Netplay.GameEndedEventHandler(sender, new GameEndedEventArgs()); + return; + case NetworkSessionEndReason.HostEndedSession: + case NetworkSessionEndReason.RemovedByHost: + desc = Lang.gen[46]; + break; + default: + desc = Main.netMode != 1 ? Lang.inter[36] : Lang.gen[46]; + break; + } + UI.Error(Lang.menu[5], desc, false); + Main.saveOnExit = UI.main.autoSave; + UI.main.ExitGame(); + } + + public static void StartServer() + { + Netplay.sessionReadyEvent.Reset(); + Thread thread = new Thread(new ThreadStart(Netplay.ServerLoop)); + thread.IsBackground = true; + thread.Start(); + Netplay.sessionThread = thread; + } + + public static void ServerLoop() + { + Thread.CurrentThread.SetProcessorAffinity(new int[1] + { + 5 + }); + Netplay.Init(); + Netplay.CreateSession(); + while (!Netplay.disconnect && Netplay.session != null) + Thread.Sleep(16); + Netplay.stopSession = true; + Netplay.sessionThread = (Thread) null; + } + + public static void StartClient() + { + Thread thread = new Thread(new ThreadStart(Netplay.ClientLoop)); + thread.IsBackground = true; + thread.Start(); + Netplay.sessionThread = thread; + } + + public static void ClientLoop() + { + Thread.CurrentThread.SetProcessorAffinity(new int[1] + { + 5 + }); + Netplay.Init(); + UI.main.player.hostile = false; + UI.main.player.NetClone(UI.main.netPlayer); + for (int index = 0; index < 8; ++index) + { + if (index != (int) UI.main.myPlayer) + Main.player[index].active = (byte) 0; + } + WorldGen.clearWorld(); + if (UI.main.menuMode == MenuMode.NETPLAY) + { + Main.netMode = 1; + try + { + if (Netplay.isJoiningRemoteInvite) + { + Netplay.isJoiningRemoteInvite = false; + Netplay.session = NetworkSession.JoinInvited((IEnumerable) Netplay.gamersWaitingToJoinInvite); + Netplay.gamersWaitingToJoinInvite.Clear(); + Netplay.gamersWhoReceivedInvite.Clear(); + } + else + Netplay.session = NetworkSession.Join(WorldSelect.Session()); + } + catch (Exception ex) + { + UI.Error(Lang.menu[5], Lang.inter[21], true); + UI.main.menuType = MenuType.MAIN; + Main.netMode = 0; + Netplay.disconnect = true; + Netplay.stopSession = true; + goto label_28; + } + Netplay.hookEvents = true; + while (!Netplay.disconnect && Netplay.session != null) + { + switch (Netplay.clientState) + { + case Netplay.ClientState.JOINING: + UI.main.FirstProgressStep(3, Lang.menu[8]); + Netplay.clientState = Netplay.ClientState.WAITING_FOR_PLAYER_ID; + break; + case Netplay.ClientState.WAITING_FOR_PLAYER_ID: + if ((double) UI.main.progress <= 0.999000012874603) + { + UI.main.progress = UI.main.progress + 1.0 / 1000.0; + break; + } + else + break; + case Netplay.ClientState.WAITING_FOR_PLAYER_DATA_REQ: + if ((double) UI.main.progress <= 0.999000012874603) + { + UI.main.progress = UI.main.progress + 1.0 / 1000.0; + break; + } + else + break; + case Netplay.ClientState.RECEIVED_PLAYER_DATA_REQ: + UI.main.NextProgressStep(Lang.menu[73]); + Netplay.clientState = Netplay.ClientState.WAITING_FOR_WORLD_INFO; + break; + case Netplay.ClientState.WAITING_FOR_WORLD_INFO: + if ((double) UI.main.progress <= 0.999000012874603) + { + UI.main.progress = UI.main.progress + 1.0 / 1000.0; + break; + } + else + break; + case Netplay.ClientState.WAITING_FOR_TILE_DATA: + if (Netplay.clientStatusMax > 0) + { + if (Netplay.clientStatusCount >= Netplay.clientStatusMax) + { + Netplay.clientStatusMax = 0; + Netplay.clientStatusCount = 0; + UI.main.progress = 1f; + break; + } + else + { + UI.main.statusText = Lang.inter[44]; + UI.main.progress = (float) Netplay.clientStatusCount / (float) Netplay.clientStatusMax; + break; + } + } + else + break; + } + Thread.Sleep(0); + } + Netplay.clientStatusCount = 0; + Netplay.clientStatusMax = 0; + Netplay.stopSession = true; + } +label_28: + Netplay.sessionThread = (Thread) null; + } + + public static void InviteAccepted() + { + PlayerIndex playerIndex = Netplay.invite.Gamer.PlayerIndex; + if (Main.isTrial) + MessageBox.Show(playerIndex, Lang.menu[5], Lang.inter[69], new string[1] + { + Lang.menu[90] + }, 1 != 0); + else if (!UI.AllPlayersCanPlayOnline()) + MessageBox.Show(playerIndex, Lang.menu[5], Lang.inter[68], new string[1] + { + Lang.menu[90] + }, 1 != 0); + else + Main.ui[(int) playerIndex].InviteAccepted(Netplay.invite); + Netplay.invite = (InviteAcceptedEventArgs) null; + } + + public static void NetworkSession_InviteAccepted(object sender, InviteAcceptedEventArgs e) + { + if (Netplay.invite != null) + return; + Netplay.invite = e; + } + + public static bool IsFindingSessions() + { + return Netplay.sessionFinderThread != null; + } + + public static void StopFindingSessions() + { + Netplay.availableSessions.Clear(); + if (Netplay.sessionFinderThread == null) + return; + Netplay.stopSessionFinderThread = true; + } + + public static void FindSessions() + { + Netplay.StopFindingSessions(); + if (!UI.main.CanPlayOnline()) + return; + if (Netplay.sessionFinderThread != null) + Netplay.sessionFinderThread.Join(); + Netplay.sessionFinderThread = new Thread(new ThreadStart(Netplay.FindSessionsThread)); + Netplay.sessionFinderThread.IsBackground = true; + Netplay.sessionFinderThread.Start(); + } + + public static void FindSessionsThread() + { + NetworkSessionProperties sessionProperties = new NetworkSessionProperties(); + UI ui = UI.main; + if (ui.HasOnline()) + { + SignedInGamer signedInGamer = ui.signedInGamer; + if (signedInGamer != null) + { + try + { + List list = new List(1); + list.Add(signedInGamer); + FriendCollection friends = signedInGamer.GetFriends(); + for (int index = ((ReadOnlyCollection) friends).Count - 1; index >= 0; --index) + { + if (!Netplay.stopSessionFinderThread) + { + FriendGamer friendGamer = ((ReadOnlyCollection) friends)[index]; + if (friendGamer.IsJoinable) + { + ulong xuid = GamerExtensions.GetXuid((Gamer) friendGamer); + sessionProperties.set_Item(0, new int?((int) xuid)); + sessionProperties.set_Item(1, new int?((int) (xuid >> 32))); + AvailableNetworkSessionCollection sessionCollection = NetworkSession.Find(NetworkSessionType.PlayerMatch, (IEnumerable) list, sessionProperties); + if (((ReadOnlyCollection) sessionCollection).Count > 0) + { + lock (Netplay.availableSessions) + Netplay.availableSessions.Add(new JoinableSession(((ReadOnlyCollection) sessionCollection)[0])); + } + if (!Netplay.stopSessionFinderThread) + Thread.Sleep(5000); + else + break; + } + } + else + break; + } + } + catch (Exception ex) + { + } + } + } + Netplay.stopSessionFinderThread = false; + Netplay.sessionFinderThread = (Thread) null; + } + + public static void CheckOfflineSession() + { + for (int index = 0; index < 4; ++index) + { + UI ui = Main.ui[index]; + if (ui.wasRemovedFromSessionWithoutOurConsent) + { + if (Netplay.session.SessionState == NetworkSessionState.Playing) + { + Netplay.session.AddLocalGamer(ui.signedInGamer); + Netplay.session.Update(); + ui.wasRemovedFromSessionWithoutOurConsent = false; + } + else if (ui == UI.main) + { + Netplay.DisposeSession(); + Netplay.CreateSession(); + Netplay.HookSessionEvents(); + ui.wasRemovedFromSessionWithoutOurConsent = false; + } + } + } + } + + public enum ClientState + { + JOINING, + WAITING_FOR_PLAYER_ID, + WAITING_FOR_PLAYER_DATA_REQ, + RECEIVED_PLAYER_DATA_REQ, + WAITING_FOR_WORLD_INFO, + ANNOUNCING_SPAWN_LOCATION, + WAITING_FOR_TILE_DATA, + PLAYING, + } + } +} diff --git a/Terraria/Pet.cs b/Terraria/Pet.cs new file mode 100644 index 0000000..b34d401 --- /dev/null +++ b/Terraria/Pet.cs @@ -0,0 +1,19 @@ +// Type: Terraria.Pet +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +namespace Terraria +{ + internal enum Pet + { + NONE = -1, + GUINEA_PIG = 0, + SLIME = 1, + TIPHIA = 2, + BAT = 3, + WEREWOLF = 4, + ZOMBIE = 5, + NUM_PETS = 6, + } +} diff --git a/Terraria/Player.cs b/Terraria/Player.cs new file mode 100644 index 0000000..67bfd83 --- /dev/null +++ b/Terraria/Player.cs @@ -0,0 +1,8873 @@ +// Type: Terraria.Player +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Input; +using Microsoft.Xna.Framework.Net; +using Microsoft.Xna.Framework.Storage; +using System; +using System.Collections; +using System.IO; +using Terraria.Achievements; +using Terraria.Leaderboards; + +namespace Terraria +{ + public sealed class Player + { + private static readonly sbyte[] TARGET_SEARCH_DIR_RIGHT = new sbyte[180] + { + (sbyte) 20, + (sbyte) 42, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) -16, + (sbyte) 32, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) -16, + (sbyte) 32, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 48, + (sbyte) 32, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) 0, + (sbyte) 16, + (sbyte) 0, + (sbyte) 16, + (sbyte) 0, + (sbyte) 16, + (sbyte) 0, + (sbyte) 16, + (sbyte) 16, + (sbyte) 0, + (sbyte) 16, + (sbyte) 0, + (sbyte) 16, + (sbyte) 0, + (sbyte) 16, + (sbyte) 0, + (sbyte) 16, + (sbyte) 0, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) 0, + (sbyte) 16, + (sbyte) 0, + (sbyte) 16, + (sbyte) 0, + (sbyte) 16, + (sbyte) 0, + (sbyte) 16, + (sbyte) 0, + (sbyte) 16, + (sbyte) 0, + (sbyte) 16, + (sbyte) 16, + (sbyte) 0, + (sbyte) 16, + (sbyte) 0, + (sbyte) 16, + (sbyte) 0, + (sbyte) 16, + (sbyte) 0, + (sbyte) 16, + (sbyte) 0, + (sbyte) 16, + (sbyte) 0, + (sbyte) 16, + (sbyte) 0, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) 0, + (sbyte) 16, + (sbyte) 0, + (sbyte) 16, + (sbyte) 0, + (sbyte) 16, + (sbyte) 0, + (sbyte) 16, + (sbyte) 0, + (sbyte) 16, + (sbyte) 0, + (sbyte) 16, + (sbyte) 0, + (sbyte) 16, + (sbyte) 0, + (sbyte) 16, + (sbyte) 16, + (sbyte) 0, + (sbyte) 16, + (sbyte) 0, + (sbyte) 16, + (sbyte) 0, + (sbyte) 16, + (sbyte) 0, + (sbyte) 16, + (sbyte) 0, + (sbyte) 16, + (sbyte) 0, + (sbyte) 16, + (sbyte) 0, + (sbyte) 16, + (sbyte) 0, + (sbyte) 16, + (sbyte) 0, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16 + }; + private static readonly sbyte[] TARGET_SEARCH_DIR_LEFT = new sbyte[180] + { + (sbyte) -16, + (sbyte) 42, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 16, + (sbyte) 32, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 16, + (sbyte) 32, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) -48, + (sbyte) 32, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 16, + (sbyte) 0, + (sbyte) 16, + (sbyte) 0, + (sbyte) 16, + (sbyte) 0, + (sbyte) 16, + (sbyte) 0, + (sbyte) 0, + (sbyte) 16, + (sbyte) 0, + (sbyte) 16, + (sbyte) 0, + (sbyte) 16, + (sbyte) 0, + (sbyte) 16, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 16, + (sbyte) 0, + (sbyte) 16, + (sbyte) 0, + (sbyte) 16, + (sbyte) 0, + (sbyte) 16, + (sbyte) 0, + (sbyte) 16, + (sbyte) 0, + (sbyte) 16, + (sbyte) 0, + (sbyte) 0, + (sbyte) 16, + (sbyte) 0, + (sbyte) 16, + (sbyte) 0, + (sbyte) 16, + (sbyte) 0, + (sbyte) 16, + (sbyte) 0, + (sbyte) 16, + (sbyte) 0, + (sbyte) 16, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 16, + (sbyte) 0, + (sbyte) 16, + (sbyte) 0, + (sbyte) 16, + (sbyte) 0, + (sbyte) 16, + (sbyte) 0, + (sbyte) 16, + (sbyte) 0, + (sbyte) 16, + (sbyte) 0, + (sbyte) 16, + (sbyte) 0, + (sbyte) 16, + (sbyte) 0, + (sbyte) 0, + (sbyte) 16, + (sbyte) 0, + (sbyte) 16, + (sbyte) 0, + (sbyte) 16, + (sbyte) 0, + (sbyte) 16, + (sbyte) 0, + (sbyte) 16, + (sbyte) 0, + (sbyte) 16, + (sbyte) 0, + (sbyte) 16, + (sbyte) 0, + (sbyte) 16, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16, + (sbyte) 0, + (sbyte) -16 + }; + public bool male = true; + public Rectangle aabb = new Rectangle(0, 0, 20, 42); + public short sign = (short) -1; + public sbyte oldSelectedItem = (sbyte) -1; + public float ghostDir = 1f; + public Buff[] buff = new Buff[10]; + public short heldProj = (short) -1; + public short breath = (short) 200; + public Item[] armor = new Item[11]; + public Item[] inventory = new Item[49]; + public Chest bank = new Chest(); + public Chest safe = new Chest(); + public string characterName = ""; + public string name = ""; + public short head = (short) -1; + public short body = (short) -1; + public short legs = (short) -1; + public Vector2 controlDir = new Vector2(); + public sbyte direction = (sbyte) 1; + private float buffR = 1f; + private float buffG = 1f; + private float buffB = 1f; + public float manaCost = 1f; + public Vector2[] shadowPos = new Vector2[3]; + public short healthBarLife = (short) 100; + public short statLifeMax = (short) 100; + public short statLife = (short) 100; + public sbyte gravDir = (sbyte) 1; + public sbyte pet = (sbyte) -1; + public short meleeCrit = (short) 4; + public short rangedCrit = (short) 4; + public short magicCrit = (short) 4; + public float meleeDamage = 1f; + public float rangedDamage = 1f; + public float magicDamage = 1f; + public float meleeSpeed = 1f; + public float moveSpeed = 1f; + public float pickSpeed = 1f; + public int SpawnX = -1; + public int SpawnY = -1; + public short[] spX = new short[200]; + public short[] spY = new short[200]; + public string[] spN = new string[200]; + public int[] spI = new int[200]; + public Player.Adj[] adjTile = new Player.Adj[135]; + public Color hairColor = new Color(215, 90, 55); + public Color skinColor = new Color((int) byte.MaxValue, 125, 90); + public Color eyeColor = new Color(105, 90, 75); + public Color shirtColor = new Color(175, 165, 140); + public Color underShirtColor = new Color(160, 180, 215); + public Color pantsColor = new Color((int) byte.MaxValue, 230, 175); + public Color shoeColor = new Color(160, 105, 60); + public sbyte grappleItemSlot = (sbyte) -1; + public short[] grappling = new short[20]; + public short chest = (short) -1; + public ushort potionDelayTime = (ushort) 3600; + public short talkNPC = (short) -1; + public short npcChatBubble = (short) -1; + public BitArray itemsFound = new BitArray(632); + public BitArray craftingStationsFound = new BitArray(135); + public BitArray recipesFound = new BitArray(342); + public BitArray recipesNew = new BitArray(342); + public string oldName = ""; + private Vector2i[] smartLocation = new Vector2i[3]; + public const int MAX_PLAYERS = 8; + public const int MAX_ARMOR = 11; + public const int MAX_INVENTORY = 48; + public const int MAX_HAIR = 36; + public const int NUM_ARMOR_HEAD = 48; + public const int NUM_ARMOR_BODY = 29; + public const int NUM_ARMOR_LEGS = 28; + public const int NAME_LEN = 16; + public const int MAX_BUFFS = 10; + public const short breathMax = (short) 200; + private const int bodyFrameHeight = 56; + private const int legFrameHeight = 56; + public const ushort width = (ushort) 20; + public const ushort height = (ushort) 42; + public const int tileRangeX = 5; + public const int tileRangeY = 4; + private const float CURSOR_SPEED = 6f; + private const int itemGrabRange = 38; + private const float itemGrabSpeed = 0.45f; + private const float itemGrabSpeedMax = 4f; + private const int rocketTimeMax = 7; + private const int SMART_RAYS = 3; + public NetClient client; + public WorldView view; + public UI ui; + public byte wings; + public short wingTime; + public byte wingFrame; + public byte wingFrameCounter; + public bool flapSound; + public bool ghost; + public byte ghostFrameCounter; + public bool pvpDeath; + public bool zoneDungeon; + public bool zoneEvil; + public bool zoneHoly; + public bool zoneMeteor; + public bool zoneJungle; + public bool boneArmor; + public float townNPCs; + public Vector2 position; + public Vector2 oldPosition; + public Vector2 velocity; + public float bodyFrameCounter; + public float legFrameCounter; + public short immuneTime; + public short immuneAlpha; + public sbyte immuneAlphaDirection; + public bool immune; + public byte team; + public sbyte netSkip; + public byte reuseDelay; + private short maxRegenDelay; + public sbyte selectedItem; + public float activeNPCs; + public short itemAnimation; + public short itemAnimationMax; + public byte itemTime; + public byte noThrow; + public short toolTime; + public float itemRotation; + public short itemWidth; + public short itemHeight; + public Vector2i itemLocation; + public float ghostFade; + public short breathCD; + public bool socialShadow; + public string setBonus; + public float headRotation; + public float bodyRotation; + public float legRotation; + public Vector2 headPosition; + public Vector2 bodyPosition; + public Vector2 legPosition; + public Vector2 headVelocity; + public Vector2 bodyVelocity; + public Vector2 legVelocity; + public bool dead; + public short respawnTimer; + public short attackCD; + public ushort potionDelay; + public byte difficulty; + public bool wet; + public byte wetCount; + public bool lavaWet; + public short hitTile; + public short hitTileX; + public short hitTileY; + public int jump; + private short bodyFrameY; + private short legFrameY; + public bool controlLeft; + public bool controlRight; + public bool controlUp; + public bool controlDown; + public bool controlJump; + public bool controlUseItem; + public bool controlUseTile; + public bool controlThrow; + public bool controlInv; + public bool controlHook; + public bool releaseJump; + public bool releaseUseItem; + public bool releaseUseTile; + public bool releaseHook; + public bool delayUseItem; + public byte active; + public byte whoAmI; + public sbyte runSoundDelay; + public bool fireWalk; + public float shadow; + public byte shadowCount; + public bool channel; + public short statDefense; + public short statAttack; + public short statMana; + public short statManaMax; + public short statManaMax2; + public int lifeRegen; + public int lifeRegenCount; + public int lifeRegenTime; + public int manaRegen; + public int manaRegenCount; + public int manaRegenDelay; + public bool manaRegenBuff; + public bool noKnockback; + public bool spaceGun; + public byte freeAmmoChance; + public byte stickyBreak; + public bool lightOrb; + public bool fairy; + public bool archery; + public bool poisoned; + public bool blind; + public bool onFire; + public bool onFire2; + public bool noItems; + public bool wereWolf; + public bool wolfAcc; + public bool rulerAcc; + public bool bleed; + public bool confused; + public bool accMerman; + public bool merman; + public bool brokenArmor; + public bool silence; + public bool slow; + public bool horrified; + public bool tongued; + public bool kbGlove; + public bool starCloak; + public bool longInvince; + public bool manaFlower; + public short tileTargetX; + public short tileTargetY; + public short tileInteractX; + public short tileInteractY; + private float relativeTargetX; + private float relativeTargetY; + public bool adjWater; + public bool oldAdjWater; + public byte hair; + public bool hostile; + public byte accWatch; + public bool accCompass; + public bool accDepthMeter; + public bool accDivingHelm; + public bool accFlipper; + public bool doubleJump; + public bool jumpAgain; + public bool spawnMax; + public byte blockRange; + public byte grapCount; + public sbyte rocketTime; + public sbyte rocketDelay; + public sbyte rocketDelay2; + public bool rocketRelease; + public bool rocketFrame; + public byte rocketBoots; + public bool canRocket; + public bool jumpBoost; + public bool noFallDmg; + public byte swimTime; + public bool killGuide; + public bool lavaImmune; + public bool gills; + public bool slowFall; + public bool findTreasure; + public bool invis; + public bool detectCreature; + public bool nightVision; + public bool enemySpawns; + public bool thorns; + public bool waterWalk; + public bool gravControl; + public short chestX; + public short chestY; + public short fallStart; + private uint totalSunMoonTransitions; + private byte hellAndBackState; + public bool kill; + public bool announced; + + static Player() + { + } + + public Player() + { + for (int index = 0; index <= 48; ++index) + { + if (index < 11) + this.armor[index].Init(); + this.inventory[index].Init(); + } + for (int index = 0; index < 20; ++index) + { + this.bank.item[index].Init(); + this.safe.item[index].Init(); + } + this.grappling[0] = (short) -1; + this.inventory[0].SetDefaults("Copper Shortsword"); + this.inventory[1].SetDefaults("Copper Pickaxe"); + this.inventory[2].SetDefaults("Copper Axe"); + this.InitKnownItems(); + this.InitKnownCraftingStations(); + } + + public void HealEffect(int healAmount) + { + CombatText.NewText(this.position, 20, 42, healAmount, false); + if (!this.isLocal()) + return; + NetMessage.CreateMessage2(35, (int) this.whoAmI, healAmount); + NetMessage.SendMessage(); + } + + public void ManaEffect(int manaAmount) + { + CombatText.NewText(this.position, 20, 42, manaAmount, false); + if (!this.isLocal()) + return; + NetMessage.CreateMessage2(43, (int) this.whoAmI, manaAmount); + NetMessage.SendMessage(); + } + + public static Player FindClosest(ref Rectangle rect) + { + Player player1 = (Player) null; + int num1 = int.MaxValue; + for (int index = 0; index < 8; ++index) + { + Player player2 = Main.player[index]; + if ((int) player2.active != 0 && !player2.dead) + { + int num2 = Math.Abs(player2.aabb.X + 10 - (rect.X + (rect.Width >> 1))) + Math.Abs(player2.aabb.Y + 21 - (rect.Y + (rect.Height >> 1))); + if (num2 < num1) + { + num1 = num2; + player1 = player2; + } + } + } + if (player1 == null) + { + for (int index = 0; index < 8; ++index) + { + player1 = Main.player[index]; + if ((int) player1.active != 0) + break; + } + } + return player1; + } + + public void toggleInv() + { + if ((int) this.ui.inventoryMode > 0) + { + Main.PlaySound(11); + this.ui.CloseInventory(); + } + else if ((int) this.talkNPC >= 0) + { + this.talkNPC = (short) -1; + this.ui.npcChatText = (UserString) null; + Main.PlaySound(11); + } + else if ((int) this.sign >= 0) + { + this.sign = (short) -1; + this.ui.editSign = false; + this.ui.npcChatText = (UserString) null; + Main.PlaySound(11); + } + else + { + Main.PlaySound(10); + this.ui.OpenInventory(); + } + } + + public void dropItemCheck() + { + if ((int) this.ui.inventoryMode == 0) + this.noThrow = (byte) 0; + else if ((int) this.noThrow > 0) + --this.noThrow; + if ((int) this.noThrow != 0 || (!this.controlThrow || (int) this.inventory[(int) this.selectedItem].type <= 0) && ((int) this.ui.inventoryMode != 0 && !this.ui.IsButtonUntriggered(Buttons.X) || ((int) this.ui.mouseItem.type <= 0 || (int) this.ui.mouseItem.stack <= 0))) + return; + Item obj = new Item(); + bool flag = false; + if (((int) this.ui.inventoryMode == 0 || this.ui.IsButtonUntriggered(Buttons.X)) && ((int) this.ui.mouseItem.type > 0 && (int) this.ui.mouseItem.stack > 0)) + { + obj = this.inventory[(int) this.selectedItem]; + this.inventory[(int) this.selectedItem] = this.ui.mouseItem; + this.delayUseItem = true; + this.controlUseItem = false; + flag = true; + } + int number2 = Item.NewItem(this.aabb.X, this.aabb.Y, 20, 42, (int) this.inventory[(int) this.selectedItem].type, 1, true, 0); + if (!flag && (int) this.inventory[(int) this.selectedItem].type == 8 && (int) this.inventory[(int) this.selectedItem].stack > 1) + { + --this.inventory[(int) this.selectedItem].stack; + } + else + { + this.inventory[(int) this.selectedItem].position = Main.item[number2].position; + Main.item[number2] = this.inventory[(int) this.selectedItem]; + this.inventory[(int) this.selectedItem].Init(); + } + Main.item[number2].noGrabDelay = (byte) 100; + Main.item[number2].velocity.Y = -2f; + Main.item[number2].velocity.X = (float) (4 * (int) this.direction) + this.velocity.X; + if ((int) this.ui.mouseItem.type > 0 && ((int) this.ui.inventoryMode == 0 || this.ui.IsButtonUntriggered(Buttons.X))) + { + this.inventory[(int) this.selectedItem] = obj; + this.ui.mouseItem.Init(); + } + NetMessage.CreateMessage2(21, (int) this.ui.myPlayer, number2); + NetMessage.SendMessage(); + } + + public void AddBuff(int type, int time, bool quiet = true) + { + if (!quiet) + { + NetMessage.CreateMessage3(55, (int) this.whoAmI, type, time); + NetMessage.SendMessage(); + } + for (int index = 0; index < 10; ++index) + { + if ((int) this.buff[index].Type == type) + { + if ((int) this.buff[index].Time >= time) + return; + this.buff[index].Time = (ushort) time; + return; + } + } + while (true) + { + int b = -1; + for (int index = 0; index < 10; ++index) + { + if (!this.buff[index].IsDebuff()) + { + b = index; + break; + } + } + if (b != -1) + { + for (int index = b; index < 10; ++index) + { + if ((int) this.buff[index].Type == 0) + { + this.buff[index].Type = (ushort) type; + this.buff[index].Time = (ushort) time; + return; + } + } + this.DelBuff(b); + } + else + break; + } + } + + public void DelBuff(Buff.ID id) + { + for (int b = 0; b < 10; ++b) + { + if ((Buff.ID) this.buff[b].Type == id) + { + this.DelBuff(b); + break; + } + } + } + + public int DelBuff(int b) + { + if ((int) this.buff[b].Type == 40) + this.pet = (sbyte) -1; + this.buff[b].Type = (ushort) 0; + this.buff[b].Time = (ushort) 0; + int num = b + 1; + for (int index1 = 0; index1 < 9; ++index1) + { + if ((int) this.buff[index1].Time == 0 || (int) this.buff[index1].Type == 0) + { + if (index1 < num) + --num; + for (int index2 = index1 + 1; index2 < 10; ++index2) + { + this.buff[index2 - 1] = this.buff[index2]; + this.buff[index2].Time = (ushort) 0; + this.buff[index2].Type = (ushort) 0; + } + } + } + return num; + } + + public bool canUseMana() + { + return (int) this.statMana < (int) this.statManaMax; + } + + public bool canHeal() + { + return (int) this.statLife < (int) this.statLifeMax; + } + + public void QuickMana() + { + if (this.noItems || (int) this.statMana == (int) this.statManaMax2) + return; + for (int index = 0; index < 48; ++index) + { + if ((int) this.inventory[index].stack > 0 && (int) this.inventory[index].type > 0 && (int) this.inventory[index].healMana > 0 && ((int) this.potionDelay == 0 || !this.inventory[index].potion)) + { + Main.PlaySound(2, this.aabb.X, this.aabb.Y, (int) this.inventory[index].useSound); + if (this.inventory[index].potion) + { + this.potionDelay = this.potionDelayTime; + this.AddBuff(21, (int) this.potionDelay, true); + } + this.statLife += this.inventory[index].healLife; + this.statMana += this.inventory[index].healMana; + if ((int) this.statLife > (int) this.statLifeMax) + this.statLife = this.statLifeMax; + if ((int) this.statMana > (int) this.statManaMax2) + this.statMana = this.statManaMax2; + if (this.isLocal()) + { + if ((int) this.inventory[index].healLife > 0) + this.HealEffect((int) this.inventory[index].healLife); + if ((int) this.inventory[index].healMana > 0) + this.ManaEffect((int) this.inventory[index].healMana); + } + if ((int) --this.inventory[index].stack > 0) + break; + this.inventory[index].Init(); + break; + } + } + } + + public void ApplyProjectileBuffPvP(int type) + { + if (type == 2) + { + if (Main.rand.Next(3) != 0) + return; + this.AddBuff(24, 180, false); + } + else if (type == 15) + { + if (Main.rand.Next(2) != 0) + return; + this.AddBuff(24, 300, false); + } + else if (type == 19) + { + if (Main.rand.Next(5) != 0) + return; + this.AddBuff(24, 180, false); + } + else if (type == 33) + { + if (Main.rand.Next(5) != 0) + return; + this.AddBuff(20, 420, false); + } + else if (type == 34) + { + if (Main.rand.Next(2) != 0) + return; + this.AddBuff(24, 240, false); + } + else if (type == 35) + { + if (Main.rand.Next(4) != 0) + return; + this.AddBuff(24, 180, false); + } + else if (type == 54) + { + if (Main.rand.Next(2) != 0) + return; + this.AddBuff(20, 600, false); + } + else if (type == 63) + { + if (Main.rand.Next(3) == 0) + return; + this.AddBuff(31, 120, true); + } + else if (type == 85) + { + this.AddBuff(24, 1200, false); + } + else + { + if (type != 95 && type != 103 && type != 104) + return; + this.AddBuff(39, 420, true); + } + } + + public void ApplyProjectileBuff(int type) + { + if (type == 55) + { + if (Main.rand.Next(3) != 0) + return; + this.AddBuff(20, 600, true); + } + else if (type == 44) + { + if (Main.rand.Next(3) != 0) + return; + this.AddBuff(22, 900, true); + } + else if (type == 82) + { + if (Main.rand.Next(3) != 0) + return; + this.AddBuff(24, 420, true); + } + else if (type == 96 || type == 101) + { + if (Main.rand.Next(3) != 0) + return; + this.AddBuff(39, 480, true); + } + else + { + if (type != 98) + return; + this.AddBuff(20, 600, true); + } + } + + public void ApplyWeaponBuffPvP(int type) + { + if (type == 121) + { + if (Main.rand.Next(2) != 0) + return; + this.AddBuff(24, 180, false); + } + else if (type == 122) + { + if (Main.rand.Next(10) != 0) + return; + this.AddBuff(24, 180, false); + } + else if (type == 190 || type == 614) + { + if (Main.rand.Next(4) != 0) + return; + this.AddBuff(20, 420, false); + } + else if (type == 217) + { + if (Main.rand.Next(5) != 0) + return; + this.AddBuff(24, 180, false); + } + else + { + if (type != 613 || Main.rand.Next(5) != 0) + return; + this.AddBuff(30, 600, false); + } + } + + private unsafe void FireEffect(int particleType) + { + this.buffB *= 0.6f; + this.buffG *= 0.7f; + if (Main.rand.Next(4) != 0) + return; + Dust* dustPtr = Main.dust.NewDust(this.aabb.X - 2, this.aabb.Y - 2, 24, 46, particleType, (double) this.velocity.X * 0.400000005960464, (double) this.velocity.Y * 0.400000005960464, 100, new Color(), 3.0); + if ((IntPtr) dustPtr == IntPtr.Zero) + return; + dustPtr->noGravity = true; + dustPtr->velocity.X *= 1.8f; + dustPtr->velocity.Y *= 1.8f; + dustPtr->velocity.Y -= 0.5f; + } + + private void Dead() + { + this.wings = (byte) 0; + this.poisoned = false; + this.onFire = false; + this.onFire2 = false; + this.blind = false; + this.gravDir = (sbyte) 1; + for (int index = 0; index < 10; ++index) + { + this.buff[index].Time = (ushort) 0; + this.buff[index].Type = (ushort) 0; + } + if (this.isLocal() && !this.ui.editSign) + this.sign = (short) -1; + if (this.isLocal() && (int) this.sign < 0) + this.ui.npcChatText = (UserString) null; + this.grappling[0] = (short) -1; + this.grappling[1] = (short) -1; + this.grappling[2] = (short) -1; + this.talkNPC = (short) -1; + this.statLife = (short) 0; + this.channel = false; + this.potionDelay = (ushort) 0; + this.chest = (short) -1; + this.itemAnimation = (short) 0; + this.immuneAlpha += (short) 2; + if ((int) this.immuneAlpha > (int) byte.MaxValue) + this.immuneAlpha = (short) byte.MaxValue; + this.headPosition += this.headVelocity; + this.bodyPosition += this.bodyVelocity; + this.legPosition += this.legVelocity; + this.headRotation += this.headVelocity.X * 0.1f; + this.bodyRotation += this.bodyVelocity.X * 0.1f; + this.legRotation += this.legVelocity.X * 0.1f; + this.headVelocity.Y += 0.1f; + this.bodyVelocity.Y += 0.1f; + this.legVelocity.Y += 0.1f; + this.headVelocity.X *= 0.99f; + this.bodyVelocity.X *= 0.99f; + this.legVelocity.X *= 0.99f; + if (!this.isLocal() || (int) --this.respawnTimer > 0 && !this.ui.IsButtonTriggered(Buttons.A)) + return; + this.ui.ClearButtonTriggers(); + if ((int) this.difficulty == 2) + { + this.ghost = true; + } + else + { + if ((int) this.ui.mouseItem.type > 0) + this.ui.OpenInventory(); + this.Spawn(); + } + } + + public void Ghost() + { + this.hellAndBackState = (byte) 0; + this.immune = false; + this.immuneAlpha = (short) 0; + this.controlUp = false; + this.controlLeft = false; + this.controlDown = false; + this.controlRight = false; + this.controlJump = false; + if (Main.hasFocus && this.ui.menuType == MenuType.NONE && (int) this.sign < 0) + { + if ((double) this.ui.gpState.ThumbSticks.Left.Y < -0.125) + this.controlDown = true; + else if ((double) this.ui.gpState.ThumbSticks.Left.Y > 0.125) + this.controlUp = true; + if ((double) this.ui.gpState.ThumbSticks.Left.X < -0.125) + this.controlLeft = true; + else if ((double) this.ui.gpState.ThumbSticks.Left.X > 0.125) + this.controlRight = true; + if (this.ui.gpState.IsButtonDown(Buttons.A) || this.ui.gpState.IsButtonDown(this.ui.BTN_JUMP2)) + this.controlJump = true; + } + if (this.controlUp || this.controlJump) + { + if ((double) this.velocity.Y > 0.0) + this.velocity.Y *= 0.9f; + this.velocity.Y -= 0.1f; + if ((double) this.velocity.Y < -3.0) + this.velocity.Y = -3f; + } + else if (this.controlDown) + { + if ((double) this.velocity.Y < 0.0) + this.velocity.Y *= 0.9f; + this.velocity.Y += 0.1f; + if ((double) this.velocity.Y > 3.0) + this.velocity.Y = 3f; + } + else if ((double) this.velocity.Y < -0.1 || (double) this.velocity.Y > 0.1) + this.velocity.Y *= 0.9f; + else + this.velocity.Y = 0.0f; + if (this.controlLeft && !this.controlRight) + { + if ((double) this.velocity.X > 0.0) + this.velocity.X *= 0.9f; + this.velocity.X -= 0.1f; + if ((double) this.velocity.X < -3.0) + this.velocity.X = -3f; + } + else if (this.controlRight && !this.controlLeft) + { + if ((double) this.velocity.X < 0.0) + this.velocity.X *= 0.9f; + this.velocity.X += 0.1f; + if ((double) this.velocity.X > 3.0) + this.velocity.X = 3f; + } + else if ((double) this.velocity.X < -0.100000001490116 || (double) this.velocity.X > 0.100000001490116) + this.velocity.X *= 0.9f; + else + this.velocity.X = 0.0f; + this.position.X += this.velocity.X; + this.position.Y += this.velocity.Y; + if ((double) this.velocity.X < 0.0) + this.direction = (sbyte) -1; + else if ((double) this.velocity.X > 0.0) + this.direction = (sbyte) 1; + ++this.ghostFrameCounter; + if ((double) this.position.X < 560.0) + { + this.position.X = 560f; + this.velocity.X = 0.0f; + } + else if ((double) this.position.X + 20.0 > (double) (Main.rightWorld - 544 - 32)) + { + this.position.X = (float) (Main.rightWorld - 544 - 32 - 20); + this.velocity.X = 0.0f; + } + if ((double) this.position.Y < 560.0) + { + this.position.Y = 560f; + if ((double) this.velocity.Y < -0.1) + this.velocity.Y = -0.1f; + } + else if ((double) this.position.Y > (double) (Main.bottomWorld - 544 - 32 - 42)) + { + this.position.Y = (float) (Main.bottomWorld - 544 - 32 - 42); + this.velocity.Y = 0.0f; + } + this.aabb.X = (int) this.position.X; + this.aabb.Y = (int) this.position.Y; + } + + private void UpdateTileInteractionLocation() + { + this.tileInteractX = (short) 0; + this.tileInteractY = (short) 0; + if (this.ui.smartCursor) + { + int x = this.aabb.X; + int y = this.aabb.Y; + int num1 = 0; + sbyte[] numArray1 = (int) this.direction > 0 ? Player.TARGET_SEARCH_DIR_RIGHT : Player.TARGET_SEARCH_DIR_LEFT; + bool flag; + do + { + int num2 = x; + sbyte[] numArray2 = numArray1; + int index1 = num1; + int num3 = 1; + int num4 = index1 + num3; + int num5 = (int) numArray2[index1]; + x = num2 + num5; + int num6 = y; + sbyte[] numArray3 = numArray1; + int index2 = num4; + int num7 = 1; + num1 = index2 + num7; + int num8 = (int) numArray3[index2]; + y = num6 + num8; + flag = this.CanInteractWithTile(x, y); + } + while (!flag && num1 < Player.TARGET_SEARCH_DIR_RIGHT.Length); + if (!flag) + return; + this.tileInteractX = (short) (x >> 4); + this.tileInteractY = (short) (y >> 4); + } + else + { + if (!this.CanInteractWithTile((int) this.tileTargetX << 4, (int) this.tileTargetY << 4)) + return; + this.tileInteractX = this.tileTargetX; + this.tileInteractY = this.tileTargetY; + } + } + + public bool CanInteractWithNPC() + { + switch (Main.tile[(int) this.tileInteractX, (int) this.tileInteractY].type) + { + case (byte) 10: + case (byte) 11: + return false; + default: + this.tileInteractX = (short) 0; + this.tileInteractY = (short) 0; + return true; + } + } + + public unsafe void UpdatePlayer(int i) + { + float num1 = 10f; + float num2 = 0.4f; + int num3 = 15; + float num4 = 5.01f; + if (this.wet) + { + if (this.merman) + { + num2 = 0.3f; + num1 = 7f; + } + else + { + num2 = 0.2f; + num1 = 5f; + num3 = 30; + num4 = 6.01f; + } + } + float num5 = 3f; + float num6 = 0.08f; + float num7 = num5; + this.heldProj = (short) -1; + float num8 = (float) Main.maxTilesX / 4200f; + float num9 = (float) ((double) this.position.Y * (1.0 / 16.0) - (60.0 + 10.0 * (double) (num8 * num8))) / (float) (Main.worldSurface / 6); + if ((double) num9 < 0.25) + num9 = 0.25f; + else if ((double) num9 > 1.0) + num9 = 1f; + float num10 = num2 * num9; + if ((int) this.statManaMax2 > 0) + this.maxRegenDelay = (short) ((int) ((1.0 - (double) this.statMana / (double) this.statManaMax2) * 60.0 * 4.0) + 45); + if ((int) ++this.shadowCount == 1) + this.shadowPos[2] = this.shadowPos[1]; + else if ((int) this.shadowCount == 2) + { + this.shadowPos[1] = this.shadowPos[0]; + } + else + { + this.shadowCount = (byte) 0; + this.shadowPos[0] = this.position; + } + if ((int) this.potionDelay > 0) + --this.potionDelay; + if ((int) this.runSoundDelay > 0) + --this.runSoundDelay; + if ((int) this.itemAnimation == 0) + this.attackCD = (short) 0; + else if ((int) this.attackCD > 0) + --this.attackCD; + if (this.isLocal()) + { + UI.current = this.ui; + this.zoneEvil = this.view.evilTiles >= 200; + this.zoneHoly = this.view.holyTiles >= 100; + this.zoneMeteor = this.view.meteorTiles >= 50; + this.zoneDungeon = false; + if (this.view.dungeonTiles >= 250 && (double) this.position.Y > (double) Main.worldSurfacePixels) + { + int index1 = this.aabb.X >> 4; + int index2 = this.aabb.Y >> 4; + int index3 = (int) Main.tile[index1, index2].wall; + if (index3 > 0 && !Main.wallHouse[index3]) + this.zoneDungeon = true; + } + this.zoneJungle = this.view.jungleTiles >= 80; + } + if (this.ghost) + this.Ghost(); + else if (this.dead) + { + this.Dead(); + } + else + { + if (this.isLocal()) + { + this.controlUp = false; + this.controlLeft = false; + this.controlDown = false; + this.controlRight = false; + bool flag1 = !this.controlJump; + this.controlJump = false; + this.controlUseItem = false; + bool flag2 = !this.controlUseTile; + this.controlUseTile = false; + this.controlThrow = false; + this.controlInv = false; + this.controlHook = false; + if (Main.hasFocus && this.ui.menuType == MenuType.NONE) + { + this.controlInv = (int) this.ui.inventoryMode > 0 ? this.ui.IsButtonTriggered(Buttons.B) : this.ui.IsButtonUntriggered(Buttons.Y); + if (this.controlInv) + this.toggleInv(); + if ((int) this.ui.inventoryMode == 0) + { + if ((int) this.sign < 0 && (int) this.talkNPC < 0) + { + GamePadThumbSticks thumbSticks = this.ui.gpState.ThumbSticks; + if ((double) thumbSticks.Left.Y < -0.5) + { + this.controlDown = true; + } + else + { + thumbSticks = this.ui.gpState.ThumbSticks; + if ((double) thumbSticks.Left.Y > 0.5) + this.controlUp = true; + } + thumbSticks = this.ui.gpState.ThumbSticks; + if ((double) thumbSticks.Left.X < -0.125) + { + this.controlLeft = true; + } + else + { + thumbSticks = this.ui.gpState.ThumbSticks; + if ((double) thumbSticks.Left.X > 0.125) + this.controlRight = true; + } + if (this.ui.gpState.IsButtonDown(this.ui.BTN_GRAPPLE)) + this.controlHook = true; + if (this.ui.gpState.IsButtonDown(Buttons.RightTrigger)) + this.controlUseItem = true; + else if ((int) this.itemTime == 0 && (int) this.itemAnimation == 0) + { + if (this.ui.IsButtonTriggered(Buttons.LeftShoulder)) + { + this.ui.hotbarItemNameTime = 210; + if ((int) this.oldSelectedItem >= 0) + { + this.selectedItem = this.oldSelectedItem; + this.oldSelectedItem = (sbyte) -1; + } + if ((int) --this.selectedItem < 0) + this.selectedItem += (sbyte) 10; + Main.PlaySound(12); + } + else if (this.ui.IsButtonTriggered(Buttons.RightShoulder)) + { + this.ui.hotbarItemNameTime = 210; + if ((int) this.oldSelectedItem >= 0) + { + this.selectedItem = this.oldSelectedItem; + this.oldSelectedItem = (sbyte) -1; + } + if ((int) ++this.selectedItem >= 10) + this.selectedItem -= (sbyte) 10; + Main.PlaySound(12); + } + else + { + int index = this.ui.UpdateQuickAccess(); + if (index >= 0) + { + if ((index > 9 || this.inventory[index].potion) && (int) this.oldSelectedItem < 0) + this.oldSelectedItem = this.selectedItem; + this.selectedItem = (sbyte) index; + if (index >= 0) + { + this.ui.hotbarItemNameTime = 210; + this.ui.quickAccessDisplayTime = 120; + if (this.inventory[index].potion) + this.controlUseItem = true; + } + } + else if ((int) this.oldSelectedItem >= 0 && ((int) this.inventory[(int) this.selectedItem].type == 0 || this.inventory[(int) this.selectedItem].potion)) + { + this.selectedItem = this.oldSelectedItem; + this.oldSelectedItem = (sbyte) -1; + } + } + } + this.controlThrow = this.ui.IsButtonTriggered(Buttons.X); + if (this.ui.IsJumpButtonDown()) + this.controlJump = !flag1 || this.ui.WasJumpButtonUp(); + if (this.ui.gpState.IsButtonDown(Buttons.B)) + this.controlUseTile = !flag2 || this.ui.gpPrevState.IsButtonUp(Buttons.B); + } + else if ((int) this.sign != -1 || this.ui.npcChatText != null) + this.ui.UpdateNpcChat(); + if (this.confused) + { + bool flag3 = this.controlLeft; + this.controlLeft = this.controlRight; + this.controlRight = flag3; + bool flag4 = this.controlUp; + this.controlUp = this.controlRight; + this.controlDown = flag4; + } + if ((int) this.chest != -1) + { + int num11 = this.aabb.X + 10 >> 4; + int num12 = this.aabb.Y + 21 >> 4; + if (num11 < (int) this.chestX - 5 || num11 > (int) this.chestX + 6 || (num12 < (int) this.chestY - 4 || num12 > (int) this.chestY + 5) || (int) Main.tile[(int) this.chestX, (int) this.chestY].active == 0) + { + Main.PlaySound(11); + this.chest = (short) -1; + } + } + } + if (this.delayUseItem) + { + this.delayUseItem = this.controlUseItem; + this.controlUseItem = false; + } + if ((int) this.itemAnimation == 0 && (int) this.itemTime == 0) + this.dropItemCheck(); + } + if (Main.netMode >= 1) + { + NetPlayer netPlayer = this.ui.netPlayer; + bool flag3 = false; + if ((int) this.statLife != (int) netPlayer.statLife || (int) this.statLifeMax != (int) netPlayer.statLifeMax) + { + netPlayer.statLife = this.statLife; + netPlayer.statLifeMax = this.statLifeMax; + NetMessage.CreateMessage1(16, i); + NetMessage.SendMessage(); + flag3 = true; + } + if ((int) this.statMana != (int) netPlayer.statMana || (int) this.statManaMax != (int) netPlayer.statManaMax) + { + netPlayer.statMana = this.statMana; + netPlayer.statManaMax = this.statManaMax; + NetMessage.CreateMessage1(42, i); + NetMessage.SendMessage(); + flag3 = true; + } + if (this.controlUp != netPlayer.controlUp) + { + netPlayer.controlUp = this.controlUp; + flag3 = true; + } + if (this.controlDown != netPlayer.controlDown) + { + netPlayer.controlDown = this.controlDown; + flag3 = true; + } + if (this.controlLeft != netPlayer.controlLeft) + { + netPlayer.controlLeft = this.controlLeft; + flag3 = true; + } + if (this.controlRight != netPlayer.controlRight) + { + netPlayer.controlRight = this.controlRight; + flag3 = true; + } + if (this.controlJump != netPlayer.controlJump) + { + netPlayer.controlJump = this.controlJump; + flag3 = true; + } + if (this.controlUseItem != netPlayer.controlUseItem) + { + netPlayer.controlUseItem = this.controlUseItem; + flag3 = true; + } + if ((int) this.selectedItem != (int) netPlayer.selectedItem) + { + netPlayer.selectedItem = this.selectedItem; + flag3 = true; + } + if (flag3) + { + NetMessage.CreateMessage1(13, i); + NetMessage.SendMessage(); + } + } + if ((double) this.velocity.Y == 0.0) + { + if (!this.noFallDmg && (int) this.wings == 0) + { + int num11 = ((this.aabb.Y >> 4) - (int) this.fallStart) * (int) this.gravDir - 25; + if (num11 > 0) + { + this.immune = false; + this.Hurt(num11 * 10, 0, false, false, Lang.deathMsg(-1, 0, 0, 0), false); + } + } + this.fallStart = (short) (this.aabb.Y >> 4); + } + else if (this.jump > 0 || (int) this.rocketDelay > 0 || (this.wet || this.slowFall) || ((double) num9 < 0.8 || this.tongued)) + this.fallStart = (short) (this.aabb.Y >> 4); + if ((int) this.ui.inventoryMode > 0) + this.delayUseItem = true; + this.tileTargetX = (short) ((int) this.ui.mouseX + this.view.screenPosition.X >> 4); + this.tileTargetY = (short) ((int) this.ui.mouseY + this.view.screenPosition.Y >> 4); + this.UpdateTileInteractionLocation(); + } + if (this.immune) + { + if ((int) --this.immuneTime <= 0) + this.immune = false; + this.immuneAlpha = (short) ((int) this.immuneAlpha + (int) this.immuneAlphaDirection * 50); + if ((int) this.immuneAlpha <= 50) + this.immuneAlphaDirection = (sbyte) 1; + else if ((int) this.immuneAlpha >= 205) + this.immuneAlphaDirection = (sbyte) -1; + } + else + this.immuneAlpha = (short) 0; + this.potionDelayTime = (ushort) 3600; + this.statDefense = (short) 0; + this.accWatch = (byte) 0; + this.accCompass = false; + this.accDepthMeter = false; + this.accDivingHelm = false; + this.lifeRegen = 0; + this.manaCost = 1f; + this.meleeSpeed = 1f; + this.meleeDamage = 1f; + this.rangedDamage = 1f; + this.magicDamage = 1f; + this.moveSpeed = 1f; + this.boneArmor = false; + this.rocketBoots = (byte) 0; + this.fireWalk = false; + this.noKnockback = false; + this.jumpBoost = false; + this.noFallDmg = false; + this.accFlipper = false; + this.spawnMax = false; + this.spaceGun = false; + this.killGuide = false; + this.lavaImmune = false; + this.gills = false; + this.slowFall = false; + this.findTreasure = false; + this.invis = false; + this.nightVision = false; + this.enemySpawns = false; + this.thorns = false; + this.waterWalk = false; + this.detectCreature = false; + this.gravControl = false; + this.statManaMax2 = this.statManaMax; + this.freeAmmoChance = (byte) 0; + this.manaRegenBuff = false; + this.meleeCrit = (short) 4; + this.rangedCrit = (short) 4; + this.magicCrit = (short) 4; + this.lightOrb = false; + this.fairy = false; + this.archery = false; + this.poisoned = false; + this.blind = false; + this.onFire = false; + this.onFire2 = false; + this.noItems = false; + this.blockRange = (byte) 0; + this.pickSpeed = 1f; + this.wereWolf = false; + this.rulerAcc = false; + this.bleed = false; + this.confused = false; + this.wings = (byte) 0; + this.brokenArmor = false; + this.silence = false; + this.slow = false; + this.horrified = false; + this.tongued = false; + this.kbGlove = false; + this.starCloak = false; + this.longInvince = false; + this.manaFlower = false; + short num13 = this.inventory[(int) this.selectedItem].crit; + this.meleeCrit += num13; + this.magicCrit += num13; + this.rangedCrit += num13; + this.buffR = 1f; + this.buffG = 1f; + this.buffB = 1f; + int num14 = 0; + for (int b = 0; b < 10; ++b) + { + if ((int) this.buff[b].Type > 0 && (int) this.buff[b].Time > 0) + { + if (this.isLocal() && (int) this.buff[b].Type != 28) + { + --this.buff[b].Time; + if (!this.buff[b].IsDebuff() && ++num14 == 5) + this.ui.SetTriggerState(Trigger.Has5Buffs); + } + switch (this.buff[b].Type) + { + case (ushort) 1: + this.lavaImmune = true; + this.fireWalk = true; + continue; + case (ushort) 2: + this.lifeRegen += 2; + continue; + case (ushort) 3: + this.moveSpeed += 0.25f; + continue; + case (ushort) 4: + this.gills = true; + continue; + case (ushort) 5: + this.statDefense += (short) 8; + continue; + case (ushort) 6: + this.manaRegenBuff = true; + continue; + case (ushort) 7: + this.magicDamage += 0.2f; + continue; + case (ushort) 8: + this.slowFall = true; + continue; + case (ushort) 9: + this.findTreasure = true; + continue; + case (ushort) 10: + this.invis = true; + continue; + case (ushort) 11: + Lighting.addLight(this.aabb.X + 10 >> 4, this.aabb.Y + 21 >> 4, new Vector3(0.8f, 0.95f, 1f)); + continue; + case (ushort) 12: + this.nightVision = true; + continue; + case (ushort) 13: + this.enemySpawns = true; + continue; + case (ushort) 14: + this.thorns = true; + continue; + case (ushort) 15: + this.waterWalk = true; + continue; + case (ushort) 16: + this.archery = true; + continue; + case (ushort) 17: + this.detectCreature = true; + continue; + case (ushort) 18: + this.gravControl = true; + continue; + case (ushort) 19: + this.lightOrb = true; + bool flag1 = true; + for (int index = 0; index < 512; ++index) + { + if ((int) Main.projectile[index].type == 18 && (int) Main.projectile[index].active != 0 && (int) Main.projectile[index].owner == (int) this.whoAmI) + { + flag1 = false; + break; + } + } + if (flag1) + { + Projectile.NewProjectile(this.position.X + 10f, this.position.Y + 21f, 0.0f, 0.0f, 18, 0, 0.0f, (int) this.whoAmI, true); + continue; + } + else + continue; + case (ushort) 20: + this.poisoned = true; + if (Main.rand.Next(52) == 0) + { + Dust* dustPtr = Main.dust.NewDust(46, ref this.aabb, 0.0, 0.0, 150, new Color(), 0.200000002980232); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->noGravity = true; + dustPtr->fadeIn = 1.9f; + } + } + this.buffR *= 0.65f; + this.buffB *= 0.75f; + continue; + case (ushort) 21: + this.potionDelay = this.buff[b].Time; + continue; + case (ushort) 22: + this.blind = true; + this.buffG *= 0.65f; + this.buffR *= 0.7f; + continue; + case (ushort) 23: + this.noItems = true; + this.buffG *= 0.8f; + this.buffR *= 0.65f; + continue; + case (ushort) 24: + this.onFire = true; + this.FireEffect(6); + continue; + case (ushort) 25: + this.statDefense -= (short) 4; + this.meleeCrit += (short) 2; + this.meleeDamage += 0.1f; + this.meleeSpeed += 0.1f; + continue; + case (ushort) 26: + ++this.statDefense; + ++this.meleeCrit; + this.meleeDamage += 0.05f; + this.meleeSpeed += 0.05f; + ++this.magicCrit; + this.magicDamage += 0.05f; + ++this.rangedCrit; + this.magicDamage += 0.05f; + this.moveSpeed += 0.1f; + continue; + case (ushort) 27: + this.fairy = true; + bool flag2 = true; + for (int index = 0; index < 512; ++index) + { + if ((int) Main.projectile[index].active != 0 && (int) Main.projectile[index].owner == (int) this.whoAmI && ((int) Main.projectile[index].type == 72 || (int) Main.projectile[index].type == 86 || (int) Main.projectile[index].type == 87)) + { + flag2 = false; + break; + } + } + if (flag2) + { + int Type = Main.rand.Next(3); + switch (Type) + { + case 0: + Type = 72; + break; + case 1: + Type = 86; + break; + case 2: + Type = 87; + break; + } + Projectile.NewProjectile(this.position.X + 10f, this.position.Y + 21f, 0.0f, 0.0f, Type, 0, 0.0f, (int) this.whoAmI, true); + continue; + } + else + continue; + case (ushort) 28: + if (this.wolfAcc && !this.merman && (!Main.gameTime.dayTime && (int) Main.gameTime.moonPhase == 0)) + { + this.wereWolf = true; + ++this.meleeCrit; + this.meleeDamage += 0.051f; + this.meleeSpeed += 0.051f; + ++this.statDefense; + this.moveSpeed += 0.05f; + continue; + } + else + { + b = this.DelBuff(b); + continue; + } + case (ushort) 29: + this.magicCrit += (short) 2; + this.magicDamage += 0.05f; + this.statManaMax2 += (short) 20; + this.manaCost -= 0.02f; + continue; + case (ushort) 30: + this.bleed = true; + if (!this.dead && Main.rand.Next(32) == 0) + { + Dust* dustPtr = Main.dust.NewDust(5, ref this.aabb, 0.0, 0.0, 0, new Color(), 1.0); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.X *= 0.25f; + dustPtr->velocity.Y += 0.5f; + dustPtr->velocity.Y *= 0.25f; + } + } + this.buffG *= 0.9f; + this.buffB *= 0.9f; + continue; + case (ushort) 31: + this.confused = true; + continue; + case (ushort) 32: + this.slow = true; + continue; + case (ushort) 33: + this.meleeDamage -= 0.051f; + this.meleeSpeed -= 0.051f; + this.statDefense -= (short) 4; + this.moveSpeed -= 0.1f; + continue; + case (ushort) 35: + this.silence = true; + continue; + case (ushort) 36: + this.brokenArmor = true; + continue; + case (ushort) 37: + if (NPC.wof >= 0 && (int) Main.npc[NPC.wof].type == 113) + { + this.horrified = true; + this.buff[b].Time = (ushort) 10; + continue; + } + else + { + b = this.DelBuff(b); + continue; + } + case (ushort) 38: + this.buff[b].Time = (ushort) 10; + this.tongued = true; + continue; + case (ushort) 39: + this.onFire2 = true; + this.FireEffect(75); + continue; + case (ushort) 40: + if ((int) this.pet >= 0) + { + this.buff[b].Time = (ushort) 18000; + this.SpawnPet(); + continue; + } + else + { + this.buff[b].Time = (ushort) 0; + continue; + } + default: + continue; + } + } + } + if (this.accMerman && this.wet && !this.lavaWet) + { + this.releaseJump = true; + this.wings = (byte) 0; + this.merman = true; + this.accFlipper = true; + this.AddBuff(34, 2, true); + } + else + this.merman = false; + this.accMerman = false; + if (this.wolfAcc && !this.merman && (!this.wereWolf && !Main.gameTime.dayTime) && (int) Main.gameTime.moonPhase == 0) + this.AddBuff(28, 60, true); + this.wolfAcc = false; + if (this.isLocal()) + { + for (int b = 0; b < 10; ++b) + { + if ((int) this.buff[b].Type > 0 && (int) this.buff[b].Time == 0) + b = this.DelBuff(b); + } + } + this.doubleJump = false; + for (int index = 0; index < 8; ++index) + { + this.statDefense += this.armor[index].defense; + this.lifeRegen += (int) this.armor[index].lifeRegen; + switch (this.armor[index].type) + { + case (short) 400: + this.magicDamage += 0.11f; + this.magicCrit += (short) 11; + this.statManaMax2 += (short) 80; + break; + case (short) 401: + this.meleeCrit += (short) 7; + this.meleeDamage += 0.14f; + break; + case (short) 402: + this.rangedDamage += 0.14f; + this.rangedCrit += (short) 8; + break; + case (short) 403: + this.rangedDamage += 0.06f; + this.meleeDamage += 0.06f; + this.magicDamage += 0.06f; + break; + case (short) 404: + this.magicCrit += (short) 4; + this.meleeCrit += (short) 4; + this.rangedCrit += (short) 4; + this.moveSpeed += 0.05f; + break; + case (short) 551: + this.magicCrit += (short) 7; + this.meleeCrit += (short) 7; + this.rangedCrit += (short) 7; + break; + case (short) 552: + this.rangedDamage += 0.07f; + this.meleeDamage += 0.07f; + this.magicDamage += 0.07f; + this.moveSpeed += 0.08f; + break; + case (short) 553: + this.rangedDamage += 0.15f; + this.rangedCrit += (short) 8; + break; + case (short) 558: + this.magicDamage += 0.12f; + this.magicCrit += (short) 12; + this.statManaMax2 += (short) 100; + break; + case (short) 559: + this.meleeCrit += (short) 10; + this.meleeDamage += 0.1f; + this.meleeSpeed += 0.1f; + break; + case (short) 604: + this.meleeCrit += (short) 15; + this.meleeDamage += 0.15f; + this.meleeSpeed += 0.15f; + break; + case (short) 605: + this.rangedDamage += 0.15f; + this.rangedCrit += (short) 10; + this.freeAmmoChance += (byte) 5; + break; + case (short) 606: + this.magicDamage += 0.15f; + this.magicCrit += (short) 15; + this.statManaMax2 += (short) 120; + break; + case (short) 607: + this.meleeCrit += (short) 5; + this.meleeDamage += 0.05f; + break; + case (short) 608: + this.rangedDamage += 0.05f; + this.rangedCrit += (short) 10; + this.freeAmmoChance += (byte) 5; + break; + case (short) 609: + this.magicDamage += 0.05f; + this.magicCrit += (short) 10; + this.manaCost -= 0.1f; + break; + case (short) 610: + this.moveSpeed += 0.12f; + this.meleeSpeed += 0.02f; + break; + case (short) 611: + this.rangedDamage += 0.1f; + this.moveSpeed += 0.1f; + this.freeAmmoChance += (byte) 10; + break; + case (short) 612: + this.magicDamage += 0.1f; + this.moveSpeed += 0.1f; + this.statManaMax2 += (short) 30; + break; + case (short) 238: + this.magicDamage += 0.15f; + break; + case (short) 268: + this.accDivingHelm = true; + break; + case (short) 371: + this.magicCrit += (short) 9; + this.statManaMax2 += (short) 40; + break; + case (short) 372: + this.moveSpeed += 0.07f; + this.meleeSpeed += 0.12f; + break; + case (short) 373: + this.rangedDamage += 0.1f; + this.rangedCrit += (short) 6; + break; + case (short) 374: + this.magicCrit += (short) 3; + this.meleeCrit += (short) 3; + this.rangedCrit += (short) 3; + break; + case (short) 375: + this.moveSpeed += 0.1f; + break; + case (short) 376: + this.magicDamage += 0.15f; + this.statManaMax2 += (short) 60; + break; + case (short) 377: + this.meleeCrit += (short) 5; + this.meleeDamage += 0.1f; + break; + case (short) 378: + this.rangedDamage += 0.12f; + this.rangedCrit += (short) 7; + break; + case (short) 379: + this.rangedDamage += 0.05f; + this.meleeDamage += 0.05f; + this.magicDamage += 0.05f; + break; + case (short) 380: + this.magicCrit += (short) 3; + this.meleeCrit += (short) 3; + this.rangedCrit += (short) 3; + break; + case (short) 123: + case (short) 124: + case (short) 125: + this.magicDamage += 0.05f; + break; + case (short) 151: + case (short) 152: + case (short) 153: + this.rangedDamage += 0.05f; + break; + case (short) 228: + case (short) 229: + case (short) 230: + this.magicCrit += (short) 3; + this.statManaMax2 += (short) 20; + break; + case (short) 100: + case (short) 101: + case (short) 102: + this.meleeSpeed += 0.07f; + break; + case (short) 111: + this.statManaMax2 += (short) 20; + break; + } + switch (this.armor[index].prefix) + { + case (byte) 62: + ++this.statDefense; + break; + case (byte) 63: + this.statDefense += (short) 2; + break; + case (byte) 64: + this.statDefense += (short) 3; + break; + case (byte) 65: + this.statDefense += (short) 4; + break; + case (byte) 66: + this.statManaMax2 += (short) 20; + break; + case (byte) 67: + ++this.meleeCrit; + ++this.rangedCrit; + ++this.magicCrit; + break; + case (byte) 68: + this.meleeCrit += (short) 2; + this.rangedCrit += (short) 2; + this.magicCrit += (short) 2; + break; + case (byte) 69: + this.meleeDamage += 0.01f; + this.rangedDamage += 0.01f; + this.magicDamage += 0.01f; + break; + case (byte) 70: + this.meleeDamage += 0.02f; + this.rangedDamage += 0.02f; + this.magicDamage += 0.02f; + break; + case (byte) 71: + this.meleeDamage += 0.03f; + this.rangedDamage += 0.03f; + this.magicDamage += 0.03f; + break; + case (byte) 72: + this.meleeDamage += 0.04f; + this.rangedDamage += 0.04f; + this.magicDamage += 0.04f; + break; + case (byte) 73: + this.moveSpeed += 0.01f; + break; + case (byte) 74: + this.moveSpeed += 0.02f; + break; + case (byte) 75: + this.moveSpeed += 0.03f; + break; + case (byte) 76: + this.moveSpeed += 0.04f; + break; + case (byte) 77: + this.meleeSpeed += 0.01f; + break; + case (byte) 78: + this.meleeSpeed += 0.02f; + break; + case (byte) 79: + this.meleeSpeed += 0.03f; + break; + case (byte) 80: + this.meleeSpeed += 0.04f; + break; + } + } + this.head = this.armor[0].headSlot; + this.body = this.armor[1].bodySlot; + this.legs = this.armor[2].legSlot; + for (int index = 3; index < 8; ++index) + { + switch (this.armor[index].type) + { + case (short) 554: + this.longInvince = true; + break; + case (short) 555: + this.manaFlower = true; + this.manaCost -= 0.08f; + break; + case (short) 562: + case (short) 563: + case (short) 564: + case (short) 565: + case (short) 566: + case (short) 567: + case (short) 568: + case (short) 569: + case (short) 570: + case (short) 571: + case (short) 572: + case (short) 573: + case (short) 574: + case (short) 626: + case (short) 627: + case (short) 628: + case (short) 629: + case (short) 630: + case (short) 631: + if (this.isLocal() && Main.musicBox < 0) + { + Main.musicBox = (int) this.armor[index].type >= 626 ? (int) this.armor[index].type - 613 : (int) this.armor[index].type - 562; + break; + } + else + break; + case (short) 576: + if (this.isLocal() && Main.rand.Next(18000) == 0 && Main.curMusic != Main.Music.NUM_SONGS) + { + this.armor[index].SetDefaults((int) Main.SONG_TO_MUSIC_BOX[(int) Main.curMusic], 1, false); + break; + } + else + break; + case (short) 485: + this.wolfAcc = true; + break; + case (short) 486: + this.rulerAcc = true; + break; + case (short) 489: + this.magicDamage += 0.15f; + break; + case (short) 490: + this.meleeDamage += 0.15f; + break; + case (short) 491: + this.rangedDamage += 0.15f; + break; + case (short) 492: + this.wings = (byte) 1; + break; + case (short) 493: + this.wings = (byte) 2; + break; + case (short) 497: + this.accMerman = true; + break; + case (short) 532: + this.starCloak = true; + break; + case (short) 535: + this.potionDelayTime = (ushort) 2700; + break; + case (short) 536: + this.kbGlove = true; + break; + case (short) 285: + this.moveSpeed += 0.1f; + break; + case (short) 393: + this.accCompass = true; + break; + case (short) 394: + this.accFlipper = true; + this.accDivingHelm = true; + break; + case (short) 395: + this.accWatch = (byte) 3; + this.accDepthMeter = true; + this.accCompass = true; + break; + case (short) 396: + this.noFallDmg = true; + this.fireWalk = true; + break; + case (short) 397: + this.noKnockback = true; + this.fireWalk = true; + break; + case (short) 399: + this.jumpBoost = true; + this.doubleJump = true; + break; + case (short) 405: + num7 = 6f; + this.rocketBoots = (byte) 2; + break; + case (short) 407: + this.blockRange = (byte) 1; + break; + case (short) 223: + this.manaCost -= 0.06f; + break; + case (short) 267: + this.killGuide = true; + break; + case (short) 193: + this.fireWalk = true; + break; + case (short) 211: + this.meleeSpeed += 0.12f; + break; + case (short) 212: + this.moveSpeed += 0.1f; + break; + case (short) 156: + this.noKnockback = true; + break; + case (short) 158: + this.noFallDmg = true; + break; + case (short) 159: + this.jumpBoost = true; + break; + case (short) 187: + this.accFlipper = true; + break; + case (short) 15: + if ((int) this.accWatch < 1) + { + this.accWatch = (byte) 1; + break; + } + else + break; + case (short) 16: + if ((int) this.accWatch < 2) + { + this.accWatch = (byte) 2; + break; + } + else + break; + case (short) 17: + this.accWatch = (byte) 3; + break; + case (short) 18: + this.accDepthMeter = true; + break; + case (short) 53: + this.doubleJump = true; + break; + case (short) 54: + num7 = 6f; + break; + case (short) 128: + this.rocketBoots = (byte) 1; + break; + } + } + Lighting.addLight(this.aabb.X + 10 + ((int) this.direction << 3) >> 4, this.aabb.Y + 2 >> 4, (int) this.head == 11 ? new Vector3(0.92f, 0.8f, 0.75f) : new Vector3(0.2f, 0.2f, 0.2f)); + this.setBonus = (string) null; + if ((int) this.head == 1 && (int) this.body == 1 && (int) this.legs == 1 || (int) this.head == 2 && (int) this.body == 2 && (int) this.legs == 2) + { + this.setBonus = Lang.setBonus(0); + this.statDefense += (short) 2; + } + else if ((int) this.head == 3 && (int) this.body == 3 && (int) this.legs == 3 || (int) this.head == 4 && (int) this.body == 4 && (int) this.legs == 4) + { + this.setBonus = Lang.setBonus(1); + this.statDefense += (short) 3; + } + else if ((int) this.head == 5 && (int) this.body == 5 && (int) this.legs == 5) + { + this.setBonus = Lang.setBonus(2); + this.moveSpeed += 0.15f; + } + else if ((int) this.head == 6 && (int) this.body == 6 && (int) this.legs == 6) + { + this.setBonus = Lang.setBonus(3); + this.spaceGun = true; + } + else if ((int) this.head == 7 && (int) this.body == 7 && (int) this.legs == 7) + { + this.setBonus = Lang.setBonus(4); + this.freeAmmoChance += (byte) 20; + } + else if ((int) this.head == 8 && (int) this.body == 8 && (int) this.legs == 8) + { + this.setBonus = Lang.setBonus(5); + this.manaCost -= 0.16f; + } + else if ((int) this.head == 9 && (int) this.body == 9 && (int) this.legs == 9) + { + this.setBonus = Lang.setBonus(6); + this.meleeDamage += 0.17f; + } + else if ((int) this.head == 11 && (int) this.body == 20 && (int) this.legs == 19) + { + this.setBonus = Lang.setBonus(7); + this.pickSpeed = 0.8f; + } + else if ((int) this.body == 17 && (int) this.legs == 16) + { + if ((int) this.head == 29) + { + this.setBonus = Lang.setBonus(8); + this.manaCost -= 0.14f; + } + else if ((int) this.head == 30) + { + this.setBonus = Lang.setBonus(9); + this.meleeSpeed += 0.15f; + } + else if ((int) this.head == 31) + { + this.setBonus = Lang.setBonus(10); + this.freeAmmoChance += (byte) 20; + } + } + else if ((int) this.body == 18 && (int) this.legs == 17) + { + if ((int) this.head == 32) + { + this.setBonus = Lang.setBonus(11); + this.manaCost -= 0.17f; + } + else if ((int) this.head == 33) + { + this.setBonus = Lang.setBonus(12); + this.meleeCrit += (short) 5; + } + else if ((int) this.head == 34) + { + this.setBonus = Lang.setBonus(13); + this.freeAmmoChance += (byte) 20; + } + } + else if ((int) this.body == 19 && (int) this.legs == 18) + { + if ((int) this.head == 35) + { + this.setBonus = Lang.setBonus(14); + this.manaCost -= 0.19f; + } + else if ((int) this.head == 36) + { + this.setBonus = Lang.setBonus(15); + this.meleeSpeed += 0.18f; + this.moveSpeed += 0.18f; + } + else if ((int) this.head == 37) + { + this.setBonus = Lang.setBonus(16); + this.freeAmmoChance += (byte) 25; + } + } + else if ((int) this.body == 24 && (int) this.legs == 23) + { + if ((int) this.head == 42) + { + this.setBonus = Lang.setBonus(17); + this.manaCost -= 0.2f; + } + else if ((int) this.head == 43) + { + this.setBonus = Lang.setBonus(18); + this.meleeSpeed += 0.19f; + this.moveSpeed += 0.19f; + } + else if ((int) this.head == 41) + { + this.setBonus = Lang.setBonus(19); + this.freeAmmoChance += (byte) 25; + } + } + else if ((int) this.head == 45 && (int) this.body == 26 && (int) this.legs == 25) + { + this.setBonus = Lang.setBonus(21); + this.meleeSpeed += 0.21f; + this.moveSpeed += 0.21f; + } + else if ((int) this.head == 46 && (int) this.body == 27 && (int) this.legs == 26) + { + this.setBonus = Lang.setBonus(22); + this.freeAmmoChance += (byte) 28; + } + else if ((int) this.head == 47 && (int) this.body == 28 && (int) this.legs == 27) + { + this.setBonus = Lang.setBonus(20); + this.manaCost -= 0.23f; + } + if (this.merman) + this.wings = (byte) 0; + if ((double) this.meleeSpeed > 4.0) + this.meleeSpeed = 4f; + if ((double) this.moveSpeed > 1.39999997615814) + this.moveSpeed = 1.4f; + if (this.slow) + this.moveSpeed *= 0.5f; + if ((int) this.statManaMax2 > 400) + this.statManaMax2 = (short) 400; + if ((int) this.statDefense < 0) + this.statDefense = (short) 0; + this.meleeSpeed = 1f / this.meleeSpeed; + if (this.onFire || this.onFire2) + { + this.lifeRegenTime = 0; + this.lifeRegen = -8; + } + else if (this.poisoned) + { + this.lifeRegenTime = 0; + this.lifeRegen = -4; + } + else if (this.bleed) + { + this.lifeRegenTime = 0; + } + else + { + double num11 = 0.0; + if (++this.lifeRegenTime >= 3600) + { + num11 = 9.0; + this.lifeRegenTime = 3600; + } + else if (this.lifeRegenTime >= 3000) + num11 = 8.0; + else if (this.lifeRegenTime >= 2400) + num11 = 7.0; + else if (this.lifeRegenTime >= 1800) + num11 = 6.0; + else if (this.lifeRegenTime >= 1500) + num11 = 5.0; + else if (this.lifeRegenTime >= 1200) + num11 = 4.0; + else if (this.lifeRegenTime >= 900) + num11 = 3.0; + else if (this.lifeRegenTime >= 600) + num11 = 2.0; + else if (this.lifeRegenTime >= 300) + num11 = 1.0; + this.lifeRegen += (int) Math.Round(((double) this.velocity.X == 0.0 || (int) this.grappling[0] > 0 ? num11 * 1.25 : num11 * 0.5) * ((double) this.statLifeMax / 400.0 * 0.85 + 0.15)); + } + this.lifeRegenCount += this.lifeRegen; + while (this.lifeRegenCount >= 120) + { + this.lifeRegenCount -= 120; + if ((int) this.statLife < (int) this.statLifeMax) + ++this.statLife; + else if ((int) this.statLife > (int) this.statLifeMax) + { + this.statLife = this.statLifeMax; + break; + } + } + while (this.lifeRegenCount <= -120) + { + this.lifeRegenCount += 120; + if ((int) --this.statLife <= 0 && this.isLocal()) + { + if (this.poisoned) + this.KillMe(10.0, 0, false, Lang.deathMsg(-1, 0, 0, 3)); + else if (this.onFire || this.onFire2) + this.KillMe(10.0, 0, false, Lang.deathMsg(-1, 0, 0, 4)); + } + } + if (this.manaRegenDelay > 0 && !this.channel) + { + --this.manaRegenDelay; + if ((double) this.velocity.X == 0.0 && (double) this.velocity.Y == 0.0 || ((int) this.grappling[0] >= 0 || this.manaRegenBuff)) + --this.manaRegenDelay; + } + if (this.manaRegenBuff && this.manaRegenDelay > 20) + this.manaRegenDelay = 20; + if (this.manaRegenDelay <= 0 && (int) this.statManaMax2 > 0) + { + this.manaRegenDelay = 0; + this.manaRegen = (int) this.statManaMax2 / 7 + 1; + if ((double) this.velocity.X == 0.0 && (double) this.velocity.Y == 0.0 || ((int) this.grappling[0] >= 0 || this.manaRegenBuff)) + this.manaRegen += (int) this.statManaMax2 >> 1; + float num11 = (float) ((double) this.statMana / (double) this.statManaMax2 * 0.800000011920929 + 0.200000002980232); + if (this.manaRegenBuff) + num11 = 1f; + this.manaRegen = (int) ((double) this.manaRegen * (double) num11); + } + else + this.manaRegen = 0; + this.manaRegenCount += this.manaRegen; + while (this.manaRegenCount >= 120) + { + bool flag = false; + this.manaRegenCount -= 120; + if ((int) this.statMana < (int) this.statManaMax2) + { + ++this.statMana; + flag = true; + } + if ((int) this.statMana >= (int) this.statManaMax2) + { + if (flag && this.isLocal()) + { + Main.PlaySound(25); + for (int index = 0; index < 4; ++index) + { + Dust* dustPtr = Main.dust.NewDust(45, ref this.aabb, 0.0, 0.0, (int) byte.MaxValue, new Color(), (double) Main.rand.Next(20, 26) * 0.100000001490116); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->noLight = true; + dustPtr->noGravity = true; + dustPtr->velocity *= 0.5f; + } + else + break; + } + } + this.statMana = this.statManaMax2; + } + } + if (this.manaRegenCount < 0) + this.manaRegenCount = 0; + if ((int) this.statMana > (int) this.statManaMax2) + this.statMana = this.statManaMax2; + float num15 = num6 * this.moveSpeed; + float num16 = num5 * this.moveSpeed; + if (this.jumpBoost) + { + num3 = 20; + num4 = 6.51f; + } + if (this.wereWolf) + { + num3 += 2; + num4 += 0.2f; + } + if (this.brokenArmor) + this.statDefense >>= 1; + if (!this.doubleJump) + this.jumpAgain = false; + else if ((double) this.velocity.Y == 0.0) + this.jumpAgain = true; + if ((int) this.grappling[0] == -1 && !this.tongued) + { + if (this.controlLeft && (double) this.velocity.X > -(double) num16) + { + if ((double) this.velocity.X > 0.200000002980232) + this.velocity.X -= 0.2f; + this.velocity.X -= num15; + if ((int) this.itemAnimation == 0 || this.inventory[(int) this.selectedItem].useTurn) + this.direction = (sbyte) -1; + } + else if (this.controlRight && (double) this.velocity.X < (double) num16) + { + if ((double) this.velocity.X < -0.200000002980232) + this.velocity.X += 0.2f; + this.velocity.X += num15; + if ((int) this.itemAnimation == 0 || this.inventory[(int) this.selectedItem].useTurn) + this.direction = (sbyte) 1; + } + else if (this.controlLeft && (double) this.velocity.X > -(double) num7) + { + if ((int) this.itemAnimation == 0 || this.inventory[(int) this.selectedItem].useTurn) + this.direction = (sbyte) -1; + if ((double) this.velocity.Y == 0.0 || (int) this.wings > 0) + { + if ((double) this.velocity.X > 0.200000002980232) + this.velocity.X -= 0.2f; + this.velocity.X -= num15 * 0.2f; + } + if ((double) this.velocity.X < -((double) num7 + (double) num16) * 0.5 && (double) this.velocity.Y == 0.0) + { + int num11 = 0; + if ((int) this.gravDir == -1) + num11 -= 42; + if ((int) this.runSoundDelay == 0 && (double) this.velocity.Y == 0.0) + { + Main.PlaySound(17, this.aabb.X, this.aabb.Y, 1); + this.runSoundDelay = (sbyte) 9; + } + Dust* dustPtr = Main.dust.NewDust(this.aabb.X - 4, this.aabb.Y + 42 + num11, 28, 4, 16, (double) this.velocity.X * -0.5, (double) this.velocity.Y * 0.5, 50, new Color(), 1.5); + if ((IntPtr) dustPtr != IntPtr.Zero) + dustPtr->velocity *= 0.2f; + } + } + else if (this.controlRight && (double) this.velocity.X < (double) num7) + { + if ((int) this.itemAnimation == 0 || this.inventory[(int) this.selectedItem].useTurn) + this.direction = (sbyte) 1; + if ((double) this.velocity.Y == 0.0 || (int) this.wings > 0) + { + if ((double) this.velocity.X < -0.200000002980232) + this.velocity.X += 0.2f; + this.velocity.X += num15 * 0.2f; + } + if ((double) this.velocity.X > ((double) num7 + (double) num16) * 0.5 && (double) this.velocity.Y == 0.0) + { + int num11 = 0; + if ((int) this.gravDir == -1) + num11 -= 42; + if ((int) this.runSoundDelay == 0 && (double) this.velocity.Y == 0.0) + { + Main.PlaySound(17, this.aabb.X, this.aabb.Y, 1); + this.runSoundDelay = (sbyte) 9; + } + Dust* dustPtr = Main.dust.NewDust(this.aabb.X - 4, this.aabb.Y + 42 + num11, 28, 4, 16, (double) this.velocity.X * -0.5, (double) this.velocity.Y * 0.5, 50, new Color(), 1.5); + if ((IntPtr) dustPtr != IntPtr.Zero) + dustPtr->velocity *= 0.2f; + } + } + else if ((double) this.velocity.Y == 0.0) + { + if ((double) this.velocity.X > 0.200000002980232) + this.velocity.X -= 0.2f; + else if ((double) this.velocity.X < -0.200000002980232) + this.velocity.X += 0.2f; + else + this.velocity.X = 0.0f; + } + else if ((double) this.velocity.X > 0.100000001490116) + this.velocity.X -= 0.1f; + else if ((double) this.velocity.X < -0.100000001490116) + this.velocity.X += 0.1f; + else + this.velocity.X = 0.0f; + if (this.gravControl) + { + if (this.controlUp && (int) this.gravDir == 1 || this.controlDown && (int) this.gravDir == -1) + { + this.gravDir = -this.gravDir; + this.fallStart = (short) (this.aabb.Y >> 4); + this.jump = 0; + Main.PlaySound(2, this.aabb.X, this.aabb.Y, 8); + } + } + else + this.gravDir = (sbyte) 1; + if (this.controlJump) + { + if (this.jump > 0) + { + if ((double) this.velocity.Y == 0.0) + { + this.jump = 0; + } + else + { + this.velocity.Y = -num4 * (float) this.gravDir; + if (this.merman) + { + if ((int) this.swimTime <= 10) + this.swimTime = (byte) 30; + } + else + --this.jump; + } + } + else if (((double) this.velocity.Y == 0.0 || this.jumpAgain || this.wet && this.accFlipper) && this.releaseJump) + { + bool flag = this.wet && this.accFlipper; + if (flag && (int) this.swimTime == 0) + this.swimTime = (byte) 30; + this.jumpAgain = false; + this.canRocket = false; + this.rocketRelease = false; + if ((double) this.velocity.Y == 0.0 && this.doubleJump) + this.jumpAgain = true; + if ((double) this.velocity.Y == 0.0 || flag) + { + this.velocity.Y = -num4 * (float) this.gravDir; + this.jump = num3; + } + else + { + int num11 = 42; + if ((int) this.gravDir == -1) + num11 = 0; + Main.PlaySound(16, this.aabb.X, this.aabb.Y, 1); + this.velocity.Y = -num4 * (float) this.gravDir; + this.jump = num3 >> 1; + for (int index = 0; index < 8; ++index) + { + Dust* dustPtr = Main.dust.NewDust(this.aabb.X - 34, this.aabb.Y + num11 - 16, 102, 32, 16, (double) this.velocity.X * -0.5, (double) this.velocity.Y * 0.5, 100, new Color(), 1.5); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.X = (float) ((double) dustPtr->velocity.X * 0.5 - (double) this.velocity.X * 0.100000001490116); + dustPtr->velocity.Y = (float) ((double) dustPtr->velocity.Y * 0.5 - (double) this.velocity.Y * 0.300000011920929); + } + else + break; + } + int index1 = Gore.NewGore(new Vector2((float) ((double) this.position.X + 10.0 - 16.0), (float) ((double) this.position.Y + (double) num11 - 16.0)), new Vector2(-this.velocity.X, -this.velocity.Y), Main.rand.Next(11, 14), 1.0); + Main.gore[index1].velocity.X = (float) ((double) Main.gore[index1].velocity.X * 0.100000001490116 - (double) this.velocity.X * 0.100000001490116); + Main.gore[index1].velocity.Y = (float) ((double) Main.gore[index1].velocity.Y * 0.100000001490116 - (double) this.velocity.Y * 0.0500000007450581); + int index2 = Gore.NewGore(new Vector2(this.position.X - 36f, (float) ((double) this.position.Y + (double) num11 - 16.0)), new Vector2(-this.velocity.X, -this.velocity.Y), Main.rand.Next(11, 14), 1.0); + Main.gore[index2].velocity.X = (float) ((double) Main.gore[index2].velocity.X * 0.100000001490116 - (double) this.velocity.X * 0.100000001490116); + Main.gore[index2].velocity.Y = (float) ((double) Main.gore[index2].velocity.Y * 0.100000001490116 - (double) this.velocity.Y * 0.0500000007450581); + int index3 = Gore.NewGore(new Vector2((float) ((double) this.position.X + 20.0 + 4.0), (float) ((double) this.position.Y + (double) num11 - 16.0)), new Vector2(-this.velocity.X, -this.velocity.Y), Main.rand.Next(11, 14), 1.0); + Main.gore[index3].velocity.X = (float) ((double) Main.gore[index3].velocity.X * 0.100000001490116 - (double) this.velocity.X * 0.100000001490116); + Main.gore[index3].velocity.Y = (float) ((double) Main.gore[index3].velocity.Y * 0.100000001490116 - (double) this.velocity.Y * 0.0500000007450581); + } + if (this.ui != null) + ++this.ui.totalJumps; + } + this.releaseJump = false; + } + else + { + this.jump = 0; + this.releaseJump = true; + this.rocketRelease = true; + } + if (this.doubleJump && !this.jumpAgain && ((int) this.gravDir == 1 && (double) this.velocity.Y < 0.0 || (int) this.gravDir == -1 && (double) this.velocity.Y > 0.0) && ((int) this.rocketBoots == 0 && !this.accFlipper)) + { + int num11 = 42; + if ((int) this.gravDir == -1) + num11 = -6; + Dust* dustPtr = Main.dust.NewDust(this.aabb.X - 4, this.aabb.Y + num11, 28, 4, 16, (double) this.velocity.X * -0.5, (double) this.velocity.Y * 0.5, 100, new Color(), 1.5); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.X = (float) ((double) dustPtr->velocity.X * 0.5 - (double) this.velocity.X * 0.100000001490116); + dustPtr->velocity.Y = (float) ((double) dustPtr->velocity.Y * 0.5 - (double) this.velocity.Y * 0.300000011920929); + } + } + if (((int) this.gravDir == 1 && (double) this.velocity.Y > -(double) num4 || (int) this.gravDir == -1 && (double) this.velocity.Y < (double) num4) && (double) this.velocity.Y != 0.0) + this.canRocket = true; + bool flag1 = false; + if ((double) this.velocity.Y == 0.0) + this.wingTime = (short) 90; + if ((int) this.wings > 0 && this.controlJump && ((int) this.wingTime > 0 && !this.jumpAgain) && (this.jump == 0 && (double) this.velocity.Y != 0.0)) + flag1 = true; + if (flag1) + { + this.velocity.Y -= 0.1f * (float) this.gravDir; + if ((int) this.gravDir == 1) + { + if ((double) this.velocity.Y > 0.0) + this.velocity.Y -= 0.5f; + else if ((double) this.velocity.Y > -(double) num4 * 0.5) + this.velocity.Y -= 0.1f; + if ((double) this.velocity.Y < -(double) num4 * 1.5) + this.velocity.Y = (float) (-(double) num4 * 1.5); + } + else + { + if ((double) this.velocity.Y < 0.0) + this.velocity.Y += 0.5f; + else if ((double) this.velocity.Y < (double) num4 * 0.5) + this.velocity.Y += 0.1f; + if ((double) this.velocity.Y > (double) num4 * 1.5) + this.velocity.Y = num4 * 1.5f; + } + --this.wingTime; + } + if (flag1 || this.jump > 0) + { + if ((int) ++this.wingFrameCounter > 4) + { + this.wingFrameCounter = (byte) 0; + this.wingFrame = (byte) ((int) this.wingFrame + 1 & 3); + } + } + else + this.wingFrame = (double) this.velocity.Y == 0.0 ? (byte) 0 : (byte) 1; + if ((int) this.wings > 0 && (int) this.rocketBoots > 0) + { + this.wingTime = (short) ((int) this.wingTime + (int) this.rocketTime * 10); + this.rocketTime = (sbyte) 0; + } + if (flag1) + { + if ((int) this.wingFrame == 3) + { + if (!this.flapSound) + { + this.flapSound = true; + Main.PlaySound(2, this.aabb.X, this.aabb.Y, 32); + } + } + else + this.flapSound = false; + } + if ((double) this.velocity.Y == 0.0) + this.rocketTime = (sbyte) 7; + if (((int) this.wingTime == 0 || (int) this.wings == 0) && ((int) this.rocketBoots > 0 && this.controlJump) && ((int) this.rocketDelay == 0 && this.canRocket && (this.rocketRelease && !this.jumpAgain))) + { + if ((int) this.rocketTime > 0) + { + --this.rocketTime; + this.rocketDelay = (sbyte) 10; + if ((int) this.rocketDelay2 <= 0) + { + if ((int) this.rocketBoots == 1) + { + Main.PlaySound(2, this.aabb.X, this.aabb.Y, 13); + this.rocketDelay2 = (sbyte) 30; + } + else if ((int) this.rocketBoots == 2) + { + Main.PlaySound(2, this.aabb.X, this.aabb.Y, 24); + this.rocketDelay2 = (sbyte) 15; + } + } + } + else + this.canRocket = false; + } + if ((int) this.rocketDelay2 > 0) + --this.rocketDelay2; + if ((int) this.rocketDelay == 0) + this.rocketFrame = false; + if ((int) this.rocketDelay > 0) + { + int num11 = 42; + if ((int) this.gravDir == -1) + num11 = 4; + this.rocketFrame = true; + if (((int) Main.frameCounter & 1) == 0) + { + int Type = 6; + float num12 = 2.5f; + int Alpha = 100; + if ((int) this.rocketBoots == 2) + { + Type = 16; + num12 = 1.5f; + Alpha = 20; + } + else if (this.socialShadow) + { + Type = 27; + num12 = 1.5f; + } + int X = this.aabb.X - 4; + int Y = this.aabb.Y + num11 - 10; + for (int index = 0; index < 2; ++index) + { + Dust* dustPtr = Main.dust.NewDust(X, Y, 8, 8, Type, 0.0, 0.0, Alpha, new Color(), (double) num12); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.X = (float) ((double) dustPtr->velocity.X * 1.0 + 2.0 - (double) this.velocity.X * 0.300000011920929); + dustPtr->velocity.Y = (float) ((double) dustPtr->velocity.Y * 1.0 + (double) (2 * (int) this.gravDir) - (double) this.velocity.Y * 0.300000011920929); + if ((int) this.rocketBoots == 1) + { + dustPtr->noGravity = true; + } + else + { + dustPtr->velocity.X *= 0.1f; + dustPtr->velocity.Y *= 0.1f; + } + X += 20; + } + else + break; + } + } + --this.rocketDelay; + this.velocity.Y -= 0.1f * (float) this.gravDir; + if ((int) this.gravDir == 1) + { + if ((double) this.velocity.Y > 0.0) + this.velocity.Y -= 0.5f; + else if ((double) this.velocity.Y > -(double) num4 * 0.5) + this.velocity.Y -= 0.1f; + if ((double) this.velocity.Y < -(double) num4 * 1.5) + this.velocity.Y = (float) (-(double) num4 * 1.5); + } + else + { + if ((double) this.velocity.Y < 0.0) + this.velocity.Y += 0.5f; + else if ((double) this.velocity.Y < (double) num4 * 0.5) + this.velocity.Y += 0.1f; + if ((double) this.velocity.Y > (double) num4 * 1.5) + this.velocity.Y = num4 * 1.5f; + } + } + else if (!flag1) + { + if (this.slowFall && (!this.controlDown && (int) this.gravDir == 1 || !this.controlUp && (int) this.gravDir == -1)) + { + if (this.controlUp && (int) this.gravDir == 1 || this.controlDown && (int) this.gravDir == -1) + this.velocity.Y += num10 / 10f * (float) this.gravDir; + else + this.velocity.Y += num10 / 3f * (float) this.gravDir; + } + else if ((int) this.wings > 0 && this.controlJump && (double) this.velocity.Y > 0.0) + { + this.fallStart = (short) (this.aabb.Y >> 4); + if ((double) this.velocity.Y > 0.0) + this.wingFrame = (byte) 2; + this.velocity.Y += num10 / 3f * (float) this.gravDir; + if ((int) this.gravDir == 1) + { + if ((double) this.velocity.Y > (double) num1 / 3.0 && !this.controlDown) + this.velocity.Y = num1 / 3f; + } + else if ((double) this.velocity.Y < -(double) num1 / 3.0 && !this.controlUp) + this.velocity.Y = (float) (-(double) num1 / 3.0); + } + else + this.velocity.Y += num10 * (float) this.gravDir; + } + if ((int) this.gravDir == 1) + { + if ((double) this.velocity.Y > (double) num1) + this.velocity.Y = num1; + if (this.slowFall && (double) this.velocity.Y > (double) num1 / 3.0 && !this.controlDown) + this.velocity.Y = num1 / 3f; + if (this.slowFall && (double) this.velocity.Y > (double) num1 / 5.0 && this.controlUp) + this.velocity.Y = num1 / 10f; + } + else + { + if ((double) this.velocity.Y < -(double) num1) + this.velocity.Y = -num1; + if (this.slowFall && (double) this.velocity.Y < -(double) num1 / 3.0 && !this.controlUp) + this.velocity.Y = (float) (-(double) num1 / 3.0); + if (this.slowFall && (double) this.velocity.Y < -(double) num1 / 5.0 && this.controlDown) + this.velocity.Y = (float) (-(double) num1 / 10.0); + } + } + fixed (Item* objPtr = Main.item) + { + Item* pNewItem = objPtr + 199; + for (int number2 = 199; number2 >= 0; --number2) + { + if ((int) pNewItem->active != 0 && (int) pNewItem->noGrabDelay == 0 && (int) pNewItem->owner == i) + { + if (this.aabb.Intersects(new Rectangle((int) pNewItem->position.X, (int) pNewItem->position.Y, (int) pNewItem->width, (int) pNewItem->height))) + { + if (this.isLocal() && ((int) this.inventory[(int) this.selectedItem].type != 0 || (int) this.itemAnimation <= 0)) + { + if ((int) pNewItem->type == 58) + { + Main.PlaySound(7, this.aabb.X, this.aabb.Y, 1); + this.statLife += (short) 20; + this.HealEffect(20); + if ((int) this.statLife > (int) this.statLifeMax) + this.statLife = this.statLifeMax; + pNewItem->Init(); + NetMessage.CreateMessage2(21, (int) this.whoAmI, number2); + NetMessage.SendMessage(); + } + else if ((int) pNewItem->type == 184) + { + Main.PlaySound(7, this.aabb.X, this.aabb.Y, 1); + this.statMana += (short) 100; + this.ManaEffect(100); + if ((int) this.statMana > (int) this.statManaMax2) + this.statMana = this.statManaMax2; + pNewItem->Init(); + NetMessage.CreateMessage2(21, (int) this.whoAmI, number2); + NetMessage.SendMessage(); + } + else if (this.GetItem(ref *pNewItem)) + { + NetMessage.CreateMessage2(21, (int) this.whoAmI, number2); + NetMessage.SendMessage(); + } + } + } + else if (new Rectangle(this.aabb.X - 38, this.aabb.Y - 38, 96, 118).Intersects(new Rectangle((int) pNewItem->position.X, (int) pNewItem->position.Y, (int) pNewItem->width, (int) pNewItem->height)) && this.ItemSpace(pNewItem)) + { + pNewItem->beingGrabbed = true; + if (this.aabb.X + 10 > (int) pNewItem->position.X + ((int) pNewItem->width >> 1)) + { + if ((double) pNewItem->velocity.X < 4.0 + (double) this.velocity.X) + pNewItem->velocity.X += 0.45f; + if ((double) pNewItem->velocity.X < 0.0) + pNewItem->velocity.X += 0.3375f; + } + else + { + if ((double) pNewItem->velocity.X > (double) this.velocity.X - 4.0) + pNewItem->velocity.X -= 0.45f; + if ((double) pNewItem->velocity.X > 0.0) + pNewItem->velocity.X -= 0.3375f; + } + if (this.aabb.Y + 21 > (int) pNewItem->position.Y + ((int) pNewItem->height >> 1)) + { + if ((double) pNewItem->velocity.Y < 4.0) + pNewItem->velocity.Y += 0.45f; + if ((double) pNewItem->velocity.Y < 0.0) + pNewItem->velocity.Y += 0.3375f; + } + else + { + if ((double) pNewItem->velocity.Y > -4.0) + pNewItem->velocity.Y -= 0.45f; + if ((double) pNewItem->velocity.Y > 0.0) + pNewItem->velocity.Y -= 0.3375f; + } + } + } + --pNewItem; + } + } + if (this.isLocal() && (int) this.talkNPC < 0) + { + if (this.controlUseTile) + { + if (this.releaseUseTile) + { + this.releaseUseTile = false; + this.controlUseTile = false; + if ((int) this.tileInteractY > 0) + this.InteractWithTile((int) this.tileInteractX << 4, (int) this.tileInteractY << 4); + else if ((int) this.npcChatBubble >= 0) + { + this.ui.npcShop = (byte) 0; + this.ui.craftGuide = false; + this.dropItemCheck(); + this.noThrow = (byte) 2; + this.sign = (short) -1; + this.chest = (short) -1; + this.ui.editSign = false; + this.talkNPC = this.npcChatBubble; + this.ui.npcChatText = (UserString) Main.npc[(int) this.talkNPC].GetChat(this); + Main.PlaySound(24); + this.ui.ClearButtonTriggers(); + } + } + } + else + this.releaseUseTile = true; + } + if (this.tongued) + { + bool flag = false; + if (NPC.wof >= 0) + { + float num11 = Main.npc[NPC.wof].position.X + (float) ((int) Main.npc[NPC.wof].width >> 1) + (float) ((int) Main.npc[NPC.wof].direction * 200); + float num12 = Main.npc[NPC.wof].position.Y + (float) ((int) Main.npc[NPC.wof].height >> 1); + Vector2 vector2 = new Vector2(this.position.X + 10f, this.position.Y + 21f); + float num17 = num11 - vector2.X; + float num18 = num12 - vector2.Y; + float num19 = (float) Math.Sqrt((double) num17 * (double) num17 + (double) num18 * (double) num18); + float num20 = 11f; + float num21; + if ((double) num19 > (double) num20) + { + num21 = num20 / num19; + } + else + { + num21 = 1f; + flag = true; + } + float num22 = num17 * num21; + float num23 = num18 * num21; + this.velocity.X = num22; + this.velocity.Y = num23; + } + else + flag = true; + if (flag && this.isLocal()) + this.DelBuff(Buff.ID.TONGUED); + } + if (this.isLocal()) + { + if (NPC.wof >= 0 && (int) Main.npc[NPC.wof].active != 0) + { + int num11 = Main.npc[NPC.wof].aabb.X + 40; + if ((int) Main.npc[NPC.wof].direction > 0) + num11 -= 96; + if (this.aabb.X + 20 > num11 && this.aabb.X < num11 + 140 && this.horrified) + { + this.noKnockback = false; + this.Hurt(50, (int) Main.npc[NPC.wof].direction, false, false, Lang.deathMsg(-1, 113, 0, -1), false); + } + if (!this.horrified) + { + if (this.aabb.Y > ((int) Main.maxTilesY - 250) * 16 && this.aabb.X > num11 - 1920 && this.aabb.X < num11 + 1920) + { + this.AddBuff(37, 10, true); + Main.PlaySound(4, Main.npc[NPC.wof].aabb.X, Main.npc[NPC.wof].aabb.Y, 10); + } + } + else if (this.aabb.Y < ((int) Main.maxTilesY - 200) * 16) + this.AddBuff(38, 10, true); + else if ((int) Main.npc[NPC.wof].direction < 0) + { + if (this.aabb.X + 10 > Main.npc[NPC.wof].aabb.X + ((int) Main.npc[NPC.wof].width >> 1) + 40) + this.AddBuff(38, 10, true); + } + else if (this.aabb.X + 10 < Main.npc[NPC.wof].aabb.X + ((int) Main.npc[NPC.wof].width >> 1) - 40) + this.AddBuff(38, 10, true); + if (this.tongued) + { + this.controlHook = false; + this.controlUseItem = false; + for (int index = 0; index < 512; ++index) + { + if ((int) Main.projectile[index].active != 0 && (int) Main.projectile[index].owner == i && (int) Main.projectile[index].aiStyle == 7) + Main.projectile[index].Kill(); + } + Vector2 vector2 = new Vector2(this.position.X + 10f, this.position.Y + 21f); + float num12 = Main.npc[NPC.wof].position.X + (float) ((int) Main.npc[NPC.wof].width / 2) - vector2.X; + float num17 = Main.npc[NPC.wof].position.Y + (float) ((int) Main.npc[NPC.wof].height / 2) - vector2.Y; + if ((double) num12 * (double) num12 + (double) num17 * (double) num17 > 9000000.0) + this.KillMe(1000.0, 0, false, Lang.deathMsg(-1, 0, 0, 5)); + else if (Main.npc[NPC.wof].aabb.X < 608 || Main.npc[NPC.wof].aabb.X > ((int) Main.maxTilesX - 38) * 16) + this.KillMe(1000.0, 0, false, Lang.deathMsg(-1, 0, 0, 6)); + } + } + this.UpdateGrappleItemSlot(); + if (this.controlHook) + { + if (this.releaseHook) + { + this.releaseHook = false; + this.QuickGrapple(); + } + } + else + this.releaseHook = true; + if ((int) this.talkNPC >= 0 && (!new Rectangle(this.aabb.X + 10 - 80, this.aabb.Y + 21 - 64, 160, 128).Intersects(Main.npc[(int) this.talkNPC].aabb) || (int) this.chest != -1 || (int) Main.npc[(int) this.talkNPC].active == 0)) + { + if ((int) this.chest == -1) + Main.PlaySound(11); + this.talkNPC = (short) -1; + this.ui.npcChatText = (UserString) null; + } + if (!this.immune) + { + for (int npcId = 0; npcId < 196; ++npcId) + { + if ((int) Main.npc[npcId].active != 0 && !Main.npc[npcId].friendly && (Main.npc[npcId].damage > 0 && this.aabb.Intersects(Main.npc[npcId].aabb))) + { + int num11 = 1; + if (Main.npc[npcId].aabb.X + ((int) Main.npc[npcId].width >> 1) < this.aabb.X + 10) + num11 = -1; + int Damage = Main.DamageVar(Main.npc[npcId].damage); + if (this.isLocal() && this.thorns && !Main.npc[npcId].dontTakeDamage) + { + int num12 = Damage / 3; + Main.npc[npcId].StrikeNPC(num12, 10f, num11, false, false); + NetMessage.SendNpcHurt(npcId, num12, 10.0, num11, false); + } + if ((int) Main.npc[npcId].netID == -6) + { + if (Main.rand.Next(4) == 0) + this.AddBuff(22, 900, true); + } + else + { + byte num12 = Main.npc[npcId].type; + if ((uint) num12 <= 104U) + { + if ((uint) num12 <= 34U) + { + switch (num12) + { + case (byte) 23: + case (byte) 25: + if (Main.rand.Next(3) == 0) + { + this.AddBuff(24, 420, true); + goto label_776; + } + else + goto label_776; + case (byte) 34: + goto label_753; + default: + goto label_776; + } + } + else + { + switch (num12) + { + case (byte) 75: + if (Main.rand.Next(10) == 0) + { + this.AddBuff(35, 420, true); + goto label_776; + } + else if (Main.rand.Next(8) == 0) + { + this.AddBuff(32, 900, true); + goto label_776; + } + else + goto label_776; + case (byte) 77: + if (Main.rand.Next(6) == 0) + { + this.AddBuff(36, 18000, true); + goto label_776; + } + else + goto label_776; + case (byte) 78: + case (byte) 82: + if (Main.rand.Next(8) == 0) + { + this.AddBuff(32, 900, true); + goto label_776; + } + else + goto label_776; + case (byte) 79: + goto label_747; + case (byte) 80: + case (byte) 93: + goto label_769; + case (byte) 81: + break; + case (byte) 83: + case (byte) 84: + goto label_753; + case (byte) 102: + case (byte) 104: + if (Main.rand.Next(8) == 0) + { + this.AddBuff(30, 2700, true); + goto label_776; + } + else + goto label_776; + case (byte) 103: + if (Main.rand.Next(5) == 0) + { + this.AddBuff(35, 420, true); + goto label_776; + } + else + goto label_776; + default: + goto label_776; + } + } + } + else if ((uint) num12 <= 112U) + { + if ((int) num12 != 109) + { + if ((int) num12 == 112 && Main.rand.Next(20) == 0) + { + this.AddBuff(33, 18000, true); + goto label_776; + } + else + goto label_776; + } + else + goto label_769; + } + else + { + switch (num12) + { + case (byte) 141: + if (Main.rand.Next(2) == 0) + { + this.AddBuff(20, 600, true); + goto label_776; + } + else + goto label_776; + case (byte) 150: + break; + case (byte) 151: + if (Main.rand.Next(4) == 0) + { + this.AddBuff(22, 900, true); + goto label_776; + } + else if (Main.rand.Next(3) == 0) + { + this.AddBuff(23, 240, true); + goto label_776; + } + else + goto label_776; + case (byte) 152: + goto label_747; + case (byte) 155: + goto label_769; + case (byte) 158: + goto label_753; + default: + goto label_776; + } + } + if (Main.rand.Next(4) == 0) + { + this.AddBuff(22, 900, true); + goto label_776; + } + else + goto label_776; +label_747: + if (Main.rand.Next(4) == 0) + { + this.AddBuff(22, 900, true); + goto label_776; + } + else if (Main.rand.Next(5) == 0) + { + this.AddBuff(35, 420, true); + goto label_776; + } + else + goto label_776; +label_753: + if (Main.rand.Next(3) == 0) + { + this.AddBuff(23, 240, true); + goto label_776; + } + else + goto label_776; +label_769: + if (Main.rand.Next(12) == 0) + this.AddBuff(31, 420, true); + } +label_776: + this.Hurt(Damage, -num11, false, false, Lang.deathMsg(-1, (int) Main.npc[npcId].netID, 0, -1), false); + } + } + } + int dmg = Collision.HurtTiles(ref this.position, ref this.velocity, 20, 42, this.fireWalk); + if (dmg != 0) + this.Hurt(Main.DamageVar(dmg), 0, false, false, Lang.deathMsg(-1, 0, 0, -1), false); + } + if ((int) this.grappling[0] >= 0) + { + this.wingFrame = (byte) 1; + if ((double) this.velocity.Y == 0.0 || this.wet && (double) this.velocity.Y > -0.02 && (double) this.velocity.Y < 0.02) + this.wingFrame = (byte) 0; + this.wingTime = (short) 90; + this.rocketTime = (sbyte) 7; + this.rocketDelay = (sbyte) 0; + this.rocketFrame = false; + this.canRocket = false; + this.rocketRelease = false; + this.fallStart = (short) (this.aabb.Y >> 4); + float num11 = 0.0f; + float num12 = 0.0f; + for (int index = 0; index < (int) this.grapCount; ++index) + { + num11 += Main.projectile[(int) this.grappling[index]].position.X + (float) ((int) Main.projectile[(int) this.grappling[index]].width >> 1); + num12 += Main.projectile[(int) this.grappling[index]].position.Y + (float) ((int) Main.projectile[(int) this.grappling[index]].height >> 1); + } + float num17 = num11 / (float) this.grapCount; + float num18 = num12 / (float) this.grapCount; + Vector2 vector2 = new Vector2(this.position.X + 10f, this.position.Y + 21f); + float num19 = num17 - vector2.X; + float num20 = num18 - vector2.Y; + float num21 = (float) ((double) num19 * (double) num19 + (double) num20 * (double) num20); + if ((double) num21 > 121.0) + { + float num22 = 11f / (float) Math.Sqrt((double) num21); + num19 *= num22; + num20 *= num22; + } + this.velocity.X = num19; + this.velocity.Y = num20; + if ((int) this.itemAnimation == 0) + { + if ((double) this.velocity.X > 0.0) + this.direction = (sbyte) 1; + else if ((double) this.velocity.X < 0.0) + this.direction = (sbyte) -1; + } + if (this.controlJump) + { + if (this.releaseJump) + { + if (((double) this.velocity.Y == 0.0 || this.wet && (double) this.velocity.Y > -0.02 && (double) this.velocity.Y < 0.02) && !this.controlDown) + { + this.velocity.Y = -num4; + this.jump = num3 >> 1; + this.releaseJump = false; + } + else + { + this.velocity.Y += 0.01f; + this.releaseJump = false; + } + if (this.doubleJump) + this.jumpAgain = true; + this.grappling[0] = (short) 0; + this.grapCount = (byte) 0; + for (int index = 0; index < 512; ++index) + { + if ((int) Main.projectile[index].owner == i && (int) Main.projectile[index].aiStyle == 7 && (int) Main.projectile[index].active != 0) + Main.projectile[index].Kill(); + } + } + } + else + this.releaseJump = true; + } + Vector2i vector2i = Collision.StickyTiles(this.position, this.velocity, 20, 42); + if (vector2i.Y != -1 && vector2i.X != -1) + { + if (this.isLocal() && ((double) this.velocity.X != 0.0 || (double) this.velocity.Y != 0.0)) + { + ++this.stickyBreak; + if ((int) this.stickyBreak > Main.rand.Next(20, 100)) + { + this.stickyBreak = (byte) 0; + if (WorldGen.KillTile(vector2i.X, vector2i.Y)) + { + NetMessage.CreateMessage5(17, 0, vector2i.X, vector2i.Y, 0, 0); + NetMessage.SendMessage(); + } + } + } + this.fallStart = (short) (this.aabb.Y >> 4); + this.jump = 0; + if ((double) this.velocity.X > 1.0) + this.velocity.X = 1f; + else if ((double) this.velocity.X < -1.0) + this.velocity.X = -1f; + if ((double) this.velocity.X > 0.75 || (double) this.velocity.X < -0.75) + this.velocity.X *= 0.85f; + else + this.velocity.X *= 0.6f; + if ((double) this.velocity.Y > 1.0) + this.velocity.Y = 1f; + else if ((double) this.velocity.Y < -5.0) + this.velocity.Y = -5f; + if ((double) this.velocity.Y < 0.0) + this.velocity.Y *= 0.96f; + else + this.velocity.Y *= 0.3f; + } + else + this.stickyBreak = (byte) 0; + bool flag5 = Collision.DrownCollision(ref this.position, 20, 42, (int) this.gravDir); + if ((int) this.armor[0].type == 250) + flag5 = true; + if ((int) this.inventory[(int) this.selectedItem].type == 186) + { + try + { + int index1 = this.aabb.X + 10 + 6 * (int) this.direction >> 4; + int num11 = 0; + if ((int) this.gravDir == -1) + num11 = 42; + int index2 = this.aabb.Y + num11 - 44 * (int) this.gravDir >> 4; + if ((int) Main.tile[index1, index2].liquid < 128) + { + if ((int) Main.tile[index1, index2].active != 0) + { + if (Main.tileSolidNotSolidTop[(int) Main.tile[index1, index2].type]) + goto label_838; + } + flag5 = false; + } + } + catch + { + } + } +label_838: + bool flag6 = flag5 ^ this.gills; + if (this.isLocal()) + { + if (this.merman) + flag6 = false; + if (flag6) + { + ++this.breathCD; + int num11 = 7; + if ((int) this.inventory[(int) this.selectedItem].type == 186) + num11 *= 2; + if (this.accDivingHelm) + num11 *= 4; + if ((int) this.breathCD >= num11) + { + this.breathCD = (short) 0; + --this.breath; + if ((int) this.breath == 0) + Main.PlaySound(23); + if ((int) this.breath <= 0) + { + this.lifeRegenTime = 0; + this.breath = (short) 0; + this.statLife -= (short) 2; + if ((int) this.statLife <= 0) + { + this.statLife = (short) 0; + this.KillMe(10.0, 0, false, Lang.deathMsg(-1, 0, 0, 1)); + } + } + } + } + else + { + this.breath += (short) 3; + if ((int) this.breath > 200) + this.breath = (short) 200; + this.breathCD = (short) 0; + } + } + if (flag6 && Main.rand.Next(20) == 0 && !this.lavaWet) + { + int num11; + if ((int) this.gravDir != -1) + { + num11 = 0; + } + else + { + int num12 = num11 = 30; + } + int num17 = num11; + if ((int) this.inventory[(int) this.selectedItem].type == 186) + Main.dust.NewDust(this.aabb.X + 10 * (int) this.direction + 4, this.aabb.Y + num17 - 54 * (int) this.gravDir, 12, 8, 34, 0.0, 0.0, 0, new Color(), 1.20000004768372); + else + Main.dust.NewDust(this.aabb.X + 12 * (int) this.direction, this.aabb.Y + num17 + 4 * (int) this.gravDir, 12, 8, 34, 0.0, 0.0, 0, new Color(), 1.20000004768372); + } + int Height = 42; + if (this.waterWalk) + Height -= 6; + bool flag7 = Collision.LavaCollision(ref this.position, 20, Height); + if (flag7) + { + if (!this.lavaImmune && !this.immune && this.isLocal()) + { + this.AddBuff(24, 420, true); + this.Hurt(80, 0, false, false, Lang.deathMsg(-1, 0, 0, 2), false); + } + this.lavaWet = true; + } + if (Collision.WetCollision(ref this.position, 20, 42)) + { + if (this.onFire && !this.lavaWet) + this.DelBuff(Buff.ID.ON_FIRE); + if (!this.wet) + { + if ((int) this.wetCount == 0) + { + this.wetCount = (byte) 10; + if (!flag7) + { + for (int index = 0; index < 32; ++index) + { + Dust* dustPtr = Main.dust.NewDust(this.aabb.X - 6, this.aabb.Y + 21 - 8, 32, 24, 33, 0.0, 0.0, 0, new Color(), 1.0); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.Y -= 4f; + dustPtr->velocity.X *= 2.5f; + dustPtr->scale = 1.3f; + dustPtr->alpha = (short) 100; + dustPtr->noGravity = true; + } + else + break; + } + Main.PlaySound(19, this.aabb.X, this.aabb.Y, 0); + } + else + { + for (int index = 0; index < 16; ++index) + { + Dust* dustPtr = Main.dust.NewDust(this.aabb.X - 6, this.aabb.Y + 21 - 8, 32, 24, 35, 0.0, 0.0, 0, new Color(), 1.0); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.Y -= 1.5f; + dustPtr->velocity.X *= 2.5f; + dustPtr->scale = 1.3f; + dustPtr->alpha = (short) 100; + dustPtr->noGravity = true; + } + else + break; + } + Main.PlaySound(19, this.aabb.X, this.aabb.Y, 1); + } + } + this.wet = true; + } + } + else if (this.wet) + { + this.wet = false; + if (this.jump > num3 / 5) + this.jump = num3 / 5; + if ((int) this.wetCount == 0) + { + this.wetCount = (byte) 16; + if (!this.lavaWet) + { + for (int index = 0; index < 24; ++index) + { + Dust* dustPtr = Main.dust.NewDust(this.aabb.X - 6, this.aabb.Y + 21, 32, 24, 33, 0.0, 0.0, 0, new Color(), 1.0); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.Y -= 4f; + dustPtr->velocity.X *= 2.5f; + dustPtr->scale = 1.3f; + dustPtr->alpha = (short) 100; + dustPtr->noGravity = true; + } + else + break; + } + Main.PlaySound(19, this.aabb.X, this.aabb.Y, 0); + } + else + { + for (int index = 0; index < 8; ++index) + { + Dust* dustPtr = Main.dust.NewDust(this.aabb.X - 6, this.aabb.Y + 21 - 8, 32, 24, 35, 0.0, 0.0, 0, new Color(), 1.0); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.Y -= 1.5f; + dustPtr->velocity.X *= 2.5f; + dustPtr->scale = 1.3f; + dustPtr->alpha = (short) 100; + dustPtr->noGravity = true; + } + else + break; + } + Main.PlaySound(19, this.aabb.X, this.aabb.Y, 1); + } + } + } + if (!this.wet) + this.lavaWet = false; + if ((int) this.wetCount > 0) + --this.wetCount; + this.oldPosition = this.position; + if (this.tongued) + { + this.position.X += this.velocity.X; + this.position.Y += this.velocity.Y; + } + else if (this.wet && !this.merman) + { + Vector2 vector2_1 = this.velocity; + Collision.TileCollision(ref this.position, ref this.velocity, 20, 42, this.controlDown, false); + Vector2 vector2_2 = this.velocity; + vector2_2.X *= 0.5f; + vector2_2.Y *= 0.5f; + if ((double) this.velocity.X != (double) vector2_1.X) + vector2_2.X = this.velocity.X; + if ((double) this.velocity.Y != (double) vector2_1.Y) + vector2_2.Y = this.velocity.Y; + this.position.X += vector2_2.X; + this.position.Y += vector2_2.Y; + } + else + { + Collision.TileCollision(ref this.position, ref this.velocity, 20, 42, this.controlDown, false); + if (this.waterWalk) + this.velocity = Collision.WaterCollision(this.position, this.velocity, 20, 42, this.controlDown); + this.position.X += this.velocity.X; + this.position.Y += this.velocity.Y; + } + if ((double) this.velocity.Y == 0.0) + { + if ((int) this.gravDir == 1 && Collision.up) + { + this.velocity.Y = 0.01f; + if (!this.merman) + this.jump = 0; + } + else if ((int) this.gravDir == -1 && Collision.down) + { + this.velocity.Y = -0.01f; + if (!this.merman) + this.jump = 0; + } + } + if (this.isLocal()) + { + switch (this.hellAndBackState) + { + case (byte) 0: + case (byte) 2: + if (this.aabb.Y < Main.worldSurfacePixels) + { + ++this.hellAndBackState; + break; + } + else + break; + case (byte) 1: + if (this.aabb.Y > Main.magmaLayerPixels) + { + ++this.hellAndBackState; + break; + } + else + break; + case (byte) 3: + ++this.hellAndBackState; + this.ui.SetTriggerState(Trigger.WentDownAndUpWithoutDyingOrWarping); + break; + } + Collision.SwitchTiles(this.position, 20, 42, this.oldPosition); + } + if ((double) this.position.X < 560.0) + { + this.position.X = 560f; + this.velocity.X = 0.0f; + } + else if ((double) this.position.X + 20.0 > (double) (Main.rightWorld - 544 - 32)) + { + this.position.X = (float) (Main.rightWorld - 544 - 32 - 20); + this.velocity.X = 0.0f; + } + if (this.ui != null) + { + if (this.aabb.Y - 42 < 560) + this.ui.SetTriggerState(Trigger.HighestPosition); + else if (this.aabb.Y + 42 > Main.bottomWorld - 544 - 32 - 42) + this.ui.SetTriggerState(Trigger.LowestPosition); + } + if ((double) this.position.Y < 560.0) + { + this.position.Y = 560f; + if ((double) this.velocity.Y < 0.11) + this.velocity.Y = 0.11f; + } + else if ((double) this.position.Y > (double) (Main.bottomWorld - 544 - 32 - 42)) + { + this.position.Y = (float) (Main.bottomWorld - 544 - 32 - 42); + this.velocity.Y = 0.0f; + } + this.aabb.X = (int) this.position.X; + this.aabb.Y = (int) this.position.Y; + this.ItemCheck(i); + this.PlayerFrame(); + if ((int) this.statLife > (int) this.statLifeMax) + this.statLife = this.statLifeMax; + this.grappling[0] = (short) -1; + this.grapCount = (byte) 0; + } + if (!this.isLocal() || Main.netMode < 1) + return; + NetPlayer netPlayer1 = this.ui.netPlayer; + bool flag8 = false; + for (int number2 = 0; number2 <= 48; ++number2) + { + if (this.inventory[number2].IsNotTheSameAs(ref netPlayer1.inventory[number2])) + { + netPlayer1.inventory[number2] = this.inventory[number2]; + NetMessage.CreateMessage2(5, i, number2); + NetMessage.SendMessage(); + } + } + for (int index = 0; index < 11; ++index) + { + if (this.armor[index].IsNotTheSameAs(ref netPlayer1.armor[index])) + { + netPlayer1.armor[index] = this.armor[index]; + NetMessage.CreateMessage2(5, i, index + 49); + NetMessage.SendMessage(); + } + } + if ((int) this.chest != (int) netPlayer1.chest) + { + netPlayer1.chest = this.chest; + NetMessage.CreateMessage2(33, i, (int) this.chest); + NetMessage.SendMessage(); + } + if ((int) this.talkNPC != (int) netPlayer1.talkNPC) + { + netPlayer1.talkNPC = this.talkNPC; + NetMessage.CreateMessage1(40, i); + NetMessage.SendMessage(); + } + if (this.zoneEvil != netPlayer1.zoneEvil) + { + netPlayer1.zoneEvil = this.zoneEvil; + flag8 = true; + } + if (this.zoneMeteor != netPlayer1.zoneMeteor) + { + netPlayer1.zoneMeteor = this.zoneMeteor; + flag8 = true; + } + if (this.zoneDungeon != netPlayer1.zoneDungeon) + { + netPlayer1.zoneDungeon = this.zoneDungeon; + flag8 = true; + } + if (this.zoneJungle != netPlayer1.zoneJungle) + { + netPlayer1.zoneJungle = this.zoneJungle; + flag8 = true; + } + if (this.zoneHoly != netPlayer1.zoneHoly) + { + netPlayer1.zoneHoly = this.zoneHoly; + flag8 = true; + } + if (flag8) + { + flag8 = false; + NetMessage.CreateMessage1(36, i); + NetMessage.SendMessage(); + } + for (int index = 0; index < 10; ++index) + { + if ((int) this.buff[index].Type != (int) netPlayer1.buff[index].Type) + { + netPlayer1.buff[index].Type = this.buff[index].Type; + flag8 = true; + } + } + if (flag8) + { + NetMessage.CreateMessage1(50, i); + NetMessage.SendMessage(); + NetMessage.CreateMessage1(13, i); + NetMessage.SendMessage(); + } + if (this.ui.localGamer == null) + return; + LeaderboardInfo.SubmitStatistics(this.ui.Statistics, (NetworkGamer) this.ui.localGamer); + } + + private unsafe bool CanInteractWithTile(int x, int y) + { + int i = x >> 4; + int j = y >> 4; + fixed (Tile* tilePtr = &Main.tile[i, j]) + { + if ((int) tilePtr->active == 0) + return false; + int num1 = (int) tilePtr->type; + switch (num1) + { + case 136: + case 139: + case 144: + case 132: + return true; + case 128: + int num2 = (int) tilePtr->frameX % 100 % 36; + if (num2 == 18) + num2 = (int) tilePtr[-1440].frameX; + return num2 >= 100; + case 104: + case 125: + return true; + case 85: + case 55: + return true; + case 97: + case 21: + case 29: + if ((int) this.talkNPC != -1) + return false; + int num3 = -1; + int num4 = (int) tilePtr->frameX; + int num5 = (int) tilePtr->frameY; + int X = i - (num4 / 18 & 1); + int Y = j - num5 / 18; + if (num1 == 29) + num3 = -2; + else if (num1 == 97) + num3 = -3; + int num6 = (int) tilePtr->frameX; + if (Main.netMode == 1 && num3 == -1 && (num6 < 72 || num6 > 106) && (num6 < 144 || num6 > 178)) + return true; + if (num3 == -1) + { + bool flag = false; + if (num6 >= 72 && num6 <= 106 || num6 >= 144 && num6 <= 178) + { + int num7 = 327; + if (num6 >= 144 && num6 <= 178) + num7 = 329; + flag = true; + for (int index = 0; index < 48; ++index) + { + if ((int) this.inventory[index].type == num7 && (int) this.inventory[index].stack > 0) + return true; + } + } + if (!flag) + num3 = Chest.FindChest(X, Y); + } + return num3 != -1; + case 79: + return true; + case 33: + case 49: + case 4: + case 13: + return !this.ui.smartCursor; + case 50: + return !this.ui.smartCursor && (int) tilePtr->frameX == 90; + case 10: + return WorldGen.CanOpenDoor(i, j); + case 11: + return WorldGen.CanCloseDoor(i, j); + default: + // ISSUE: __unpin statement + __unpin(tilePtr); + return false; + } + } + } + + private bool InteractWithTile(int x, int y) + { + int index1 = x >> 4; + int index2 = y >> 4; + if ((int) Main.tile[index1, index2].active == 0) + return false; + int num1 = (int) Main.tile[index1, index2].type; + switch (num1) + { + case 136: + case 144: + case 132: + WorldGen.hitSwitch(index1, index2); + NetMessage.CreateMessage2(59, index1, index2); + NetMessage.SendMessage(); + return true; + case 139: + Main.PlaySound(28, x, y, 0); + WorldGen.SwitchMB(index1, index2); + return true; + case 128: + int num2 = (int) Main.tile[index1, index2].frameX % 100 % 36; + if (num2 == 18) + { + --index1; + num2 = (int) Main.tile[index1, index2].frameX; + } + if (num2 < 100) + return false; + WorldGen.KillTile(index1, index2, true, false, false); + NetMessage.CreateMessage5(17, 0, index1, index2, 1, 0); + NetMessage.SendMessage(); + return true; + case 104: + string str1 = "AM"; + double num3 = (double) Main.gameTime.time; + if (!Main.gameTime.dayTime) + num3 += 54000.0; + double num4 = num3 / 86400.0 * 24.0 - 7.5 - 12.0; + if (num4 < 0.0) + num4 += 24.0; + if (num4 >= 12.0) + str1 = "PM"; + int num5 = (int) num4; + int num6 = (int) ((num4 - (double) num5) * 60.0); + string str2 = ToStringExtensions.ToStringLookup(num6); + if (num6 < 10) + str2 = "0" + str2; + if (num5 > 12) + num5 -= 12; + if (num5 == 0) + num5 = 12; + Main.NewText(Lang.inter[34] + ToStringExtensions.ToStringLookup(num5) + ":" + str2 + " " + str1, (int) byte.MaxValue, 240, 20); + return true; + case 125: + this.AddBuff(29, 36000, true); + Main.PlaySound(2, this.aabb.X, this.aabb.Y, 4); + return true; + case 85: + case 55: + bool flag1 = true; + if ((int) this.sign >= 0 && Sign.ReadSign(index1, index2) == (int) this.sign) + { + this.sign = (short) -1; + this.ui.npcChatText = (UserString) null; + this.ui.editSign = false; + Main.PlaySound(11); + flag1 = false; + } + if (flag1) + { + if (Main.netMode != 1) + { + this.talkNPC = (short) -1; + this.ui.CloseInventory(); + this.ui.editSign = false; + Main.PlaySound(10); + int index3 = Sign.ReadSign(index1, index2); + this.sign = (short) index3; + this.ui.npcChatText = Main.sign[index3].text; + this.ui.ClearButtonTriggers(); + } + else + { + int number2 = index1 - ((int) Main.tile[index1, index2].frameX / 18 & 1); + int number3 = index2 - (int) Main.tile[number2, index2].frameY / 18; + switch (Main.tile[number2, number3].type) + { + case (byte) 55: + case (byte) 85: + NetMessage.CreateMessage3(46, (int) this.whoAmI, number2, number3); + NetMessage.SendMessage(); + break; + } + } + } + return true; + case 97: + case 21: + case 29: + if ((int) this.talkNPC == -1) + { + int num7 = -1; + int num8 = (int) Main.tile[index1, index2].frameX; + int num9 = (int) Main.tile[index1, index2].frameY; + int index3 = index1 - (num8 / 18 & 1); + int index4 = index2 - num9 / 18; + if (num1 == 29) + num7 = -2; + else if (num1 == 97) + num7 = -3; + else + this.ui.chestText = num8 < 216 ? (num8 < 180 ? Lang.itemName(48) : Lang.itemName(343)) : Lang.itemName(348); + int num10 = (int) Main.tile[index3, index4].frameX; + if (Main.netMode == 1 && num7 == -1 && (num10 < 72 || num10 > 106) && (num10 < 144 || num10 > 178)) + { + if (index3 == (int) this.chestX && index4 == (int) this.chestY && (int) this.chest != -1) + { + this.chest = (short) -1; + Main.PlaySound(11); + } + else + { + NetMessage.CreateMessage3(31, (int) this.whoAmI, index3, index4); + NetMessage.SendMessage(); + } + return true; + } + else + { + if (num7 == -1) + { + bool flag2 = false; + if (num10 >= 72 && num10 <= 106 || num10 >= 144 && num10 <= 178) + { + int num11 = 327; + if (num10 >= 144 && num10 <= 178) + num11 = 329; + flag2 = true; + for (int index5 = 0; index5 < 48; ++index5) + { + if ((int) this.inventory[index5].type == num11 && (int) this.inventory[index5].stack > 0) + { + if (num11 != 329) + { + --this.inventory[index5].stack; + if ((int) this.inventory[index5].stack <= 0) + this.inventory[index5].Init(); + } + Chest.Unlock(index3, index4); + NetMessage.CreateMessage3(52, (int) this.whoAmI, index3, index4); + NetMessage.SendMessage(); + return true; + } + } + } + if (!flag2) + num7 = Chest.FindChest(index3, index4); + } + if (num7 != -1) + { + if (num7 == (int) this.chest) + { + this.chest = (short) -1; + Main.PlaySound(11); + } + else + { + if (num7 != (int) this.chest && (int) this.chest == -1) + Main.PlaySound(10); + else + Main.PlaySound(12); + this.chest = (short) num7; + this.chestX = (short) index3; + this.chestY = (short) index4; + this.ui.OpenInventory(); + } + return true; + } + } + } + return false; + case 79: + int num12 = index1; + int num13 = index2; + int num14 = num12 - (int) Main.tile[index1, index2].frameX / 18; + int x1 = (int) Main.tile[index1, index2].frameX < 72 ? num14 + 2 : num14 + 5; + int y1 = num13 - (int) Main.tile[index1, index2].frameY / 18 + 2; + if (!Player.CheckSpawn(x1, y1)) + return false; + this.ChangeSpawn(x1, y1); + Main.NewText(Lang.menu[57], (int) byte.MaxValue, 240, 20); + return true; + case 33: + case 49: + case 4: + case 13: + WorldGen.KillTile(index1, index2); + NetMessage.CreateMessage5(17, 0, index1, index2, 0, 0); + NetMessage.SendMessage(); + return true; + case 50: + if ((int) Main.tile[index1, index2].frameX != 90) + return false; + else + goto case 33; + case 10: + int number3_1 = WorldGen.OpenDoor(index1, index2, (int) this.direction); + if (number3_1 == 0) + return false; + ++this.ui.totalDoorsOpened; + NetMessage.CreateMessage3(19, index1, index2, number3_1); + NetMessage.SendMessage(); + return true; + case 11: + if (!WorldGen.CloseDoor(index1, index2, false)) + return false; + ++this.ui.totalDoorsClosed; + NetMessage.CreateMessage2(24, index1, index2); + NetMessage.SendMessage(); + return true; + default: + return false; + } + } + + public void NetClone(NetPlayer clonePlayer) + { + clonePlayer.zoneEvil = this.zoneEvil; + clonePlayer.zoneMeteor = this.zoneMeteor; + clonePlayer.zoneDungeon = this.zoneDungeon; + clonePlayer.zoneJungle = this.zoneJungle; + clonePlayer.zoneHoly = this.zoneHoly; + clonePlayer.selectedItem = this.selectedItem; + clonePlayer.controlUp = this.controlUp; + clonePlayer.controlDown = this.controlDown; + clonePlayer.controlLeft = this.controlLeft; + clonePlayer.controlRight = this.controlRight; + clonePlayer.controlJump = this.controlJump; + clonePlayer.controlUseItem = this.controlUseItem; + clonePlayer.statLife = this.statLife; + clonePlayer.statLifeMax = this.statLifeMax; + clonePlayer.statMana = this.statMana; + clonePlayer.statManaMax = this.statManaMax; + clonePlayer.chest = this.chest; + clonePlayer.talkNPC = this.talkNPC; + for (int index = 0; index <= 48; ++index) + clonePlayer.inventory[index] = this.inventory[index]; + for (int index = 0; index < 11; ++index) + clonePlayer.armor[index] = this.armor[index]; + for (int index = 0; index < 10; ++index) + clonePlayer.buff[index].Type = this.buff[index].Type; + } + + public bool SellItem(int price, int stack) + { + if (price <= 0) + return false; + Item[] objArray = new Item[48]; + for (int index = 0; index < 48; ++index) + objArray[index] = this.inventory[index]; + int num = price / 5 * stack; + if (num < 1) + num = 1; + bool flag = false; + while (num >= 1000000 && !flag) + { + int index = -1; + for (int i = 43; i >= 0; --i) + { + if (index == -1 && ((int) this.inventory[i].type == 0 || (int) this.inventory[i].stack == 0)) + index = i; + while ((int) this.inventory[i].type == 74 && (int) this.inventory[i].stack < (int) this.inventory[i].maxStack && num >= 1000000) + { + ++this.inventory[i].stack; + num -= 1000000; + this.DoCoins(i); + if ((int) this.inventory[i].stack == 0 && index == -1) + index = i; + } + } + if (num >= 1000000) + { + if (index == -1) + { + flag = true; + } + else + { + this.inventory[index].SetDefaults(74, 1, false); + num -= 1000000; + } + } + } + while (num >= 10000 && !flag) + { + int index = -1; + for (int i = 43; i >= 0; --i) + { + if (index == -1 && ((int) this.inventory[i].type == 0 || (int) this.inventory[i].stack == 0)) + index = i; + while ((int) this.inventory[i].type == 73 && (int) this.inventory[i].stack < (int) this.inventory[i].maxStack && num >= 10000) + { + ++this.inventory[i].stack; + num -= 10000; + this.DoCoins(i); + if ((int) this.inventory[i].stack == 0 && index == -1) + index = i; + } + } + if (num >= 10000) + { + if (index == -1) + { + flag = true; + } + else + { + this.inventory[index].SetDefaults(73, 1, false); + num -= 10000; + } + } + } + while (num >= 100 && !flag) + { + int index = -1; + for (int i = 43; i >= 0; --i) + { + if (index == -1 && ((int) this.inventory[i].type == 0 || (int) this.inventory[i].stack == 0)) + index = i; + while ((int) this.inventory[i].type == 72 && (int) this.inventory[i].stack < (int) this.inventory[i].maxStack && num >= 100) + { + ++this.inventory[i].stack; + num -= 100; + this.DoCoins(i); + if ((int) this.inventory[i].stack == 0 && index == -1) + index = i; + } + } + if (num >= 100) + { + if (index == -1) + { + flag = true; + } + else + { + this.inventory[index].SetDefaults(72, 1, false); + num -= 100; + } + } + } + while (num >= 1 && !flag) + { + int index = -1; + for (int i = 43; i >= 0; --i) + { + if (index == -1 && ((int) this.inventory[i].type == 0 || (int) this.inventory[i].stack == 0)) + index = i; + while ((int) this.inventory[i].type == 71 && (int) this.inventory[i].stack < (int) this.inventory[i].maxStack && num >= 1) + { + ++this.inventory[i].stack; + --num; + this.DoCoins(i); + if ((int) this.inventory[i].stack == 0 && index == -1) + index = i; + } + } + if (num >= 1) + { + if (index == -1) + { + flag = true; + } + else + { + this.inventory[index].SetDefaults(71, 1, false); + --num; + } + } + } + if (!flag) + return true; + for (int index = 0; index < 48; ++index) + this.inventory[index] = objArray[index]; + return false; + } + + public bool BuyItem(int price) + { + if (price == 0) + return true; + int num1 = 0; + Item[] objArray = new Item[44]; + for (int index = 0; index < 44; ++index) + { + objArray[index] = this.inventory[index]; + if ((int) this.inventory[index].type == 71) + num1 += (int) this.inventory[index].stack; + if ((int) this.inventory[index].type == 72) + num1 += (int) this.inventory[index].stack * 100; + if ((int) this.inventory[index].type == 73) + num1 += (int) this.inventory[index].stack * 10000; + if ((int) this.inventory[index].type == 74) + num1 += (int) this.inventory[index].stack * 1000000; + } + if (num1 < price) + return false; + int num2 = price; + while (num2 > 0) + { + if (num2 >= 1000000) + { + for (int index = 0; index < 44; ++index) + { + if ((int) this.inventory[index].type == 74) + { + while ((int) this.inventory[index].stack > 0 && num2 >= 1000000) + { + num2 -= 1000000; + --this.inventory[index].stack; + if ((int) this.inventory[index].stack == 0) + this.inventory[index].Init(); + } + } + } + } + if (num2 >= 10000) + { + for (int index = 0; index < 44; ++index) + { + if ((int) this.inventory[index].type == 73) + { + while ((int) this.inventory[index].stack > 0 && num2 >= 10000) + { + num2 -= 10000; + --this.inventory[index].stack; + if ((int) this.inventory[index].stack == 0) + this.inventory[index].Init(); + } + } + } + } + if (num2 >= 100) + { + for (int index = 0; index < 44; ++index) + { + if ((int) this.inventory[index].type == 72) + { + while ((int) this.inventory[index].stack > 0 && num2 >= 100) + { + num2 -= 100; + --this.inventory[index].stack; + if ((int) this.inventory[index].stack == 0) + this.inventory[index].Init(); + } + } + } + } + if (num2 >= 1) + { + for (int index = 0; index < 44; ++index) + { + if ((int) this.inventory[index].type == 71) + { + while ((int) this.inventory[index].stack > 0 && num2 >= 1) + { + --num2; + --this.inventory[index].stack; + if ((int) this.inventory[index].stack == 0) + this.inventory[index].Init(); + } + } + } + } + if (num2 > 0) + { + int index1 = -1; + for (int index2 = 43; index2 >= 0; --index2) + { + if ((int) this.inventory[index2].type == 0 || (int) this.inventory[index2].stack == 0) + { + index1 = index2; + break; + } + } + if (index1 >= 0) + { + bool flag = true; + if (num2 >= 10000) + { + for (int index2 = 0; index2 < 48; ++index2) + { + if ((int) this.inventory[index2].type == 74 && (int) this.inventory[index2].stack >= 1) + { + --this.inventory[index2].stack; + if ((int) this.inventory[index2].stack == 0) + this.inventory[index2].Init(); + this.inventory[index1].SetDefaults(73, 100, false); + flag = false; + break; + } + } + } + else if (num2 >= 100) + { + for (int index2 = 0; index2 < 44; ++index2) + { + if ((int) this.inventory[index2].type == 73 && (int) this.inventory[index2].stack >= 1) + { + --this.inventory[index2].stack; + if ((int) this.inventory[index2].stack == 0) + this.inventory[index2].Init(); + this.inventory[index1].SetDefaults(72, 100, false); + flag = false; + break; + } + } + } + else if (num2 >= 1) + { + for (int index2 = 0; index2 < 44; ++index2) + { + if ((int) this.inventory[index2].type == 72 && (int) this.inventory[index2].stack >= 1) + { + --this.inventory[index2].stack; + if ((int) this.inventory[index2].stack == 0) + this.inventory[index2].Init(); + this.inventory[index1].SetDefaults(71, 100, false); + flag = false; + break; + } + } + } + if (flag) + { + if (num2 < 10000) + { + for (int index2 = 0; index2 < 44; ++index2) + { + if ((int) this.inventory[index2].type == 73 && (int) this.inventory[index2].stack >= 1) + { + --this.inventory[index2].stack; + if ((int) this.inventory[index2].stack == 0) + this.inventory[index2].Init(); + this.inventory[index1].SetDefaults(72, 100, false); + flag = false; + break; + } + } + } + if (flag && num2 < 1000000) + { + for (int index2 = 0; index2 < 44; ++index2) + { + if ((int) this.inventory[index2].type == 74 && (int) this.inventory[index2].stack >= 1) + { + --this.inventory[index2].stack; + if ((int) this.inventory[index2].stack == 0) + this.inventory[index2].Init(); + this.inventory[index1].SetDefaults(73, 100, false); + break; + } + } + } + } + } + else + { + for (int index2 = 0; index2 < 44; ++index2) + this.inventory[index2] = objArray[index2]; + return false; + } + } + } + return true; + } + + public void AdjTiles() + { + for (int index = 0; index < 135; ++index) + { + this.adjTile[index].old = this.adjTile[index].i; + this.adjTile[index].i = false; + } + this.oldAdjWater = this.adjWater; + this.adjWater = false; + int num1 = this.aabb.X + 10 >> 4; + int num2 = this.aabb.Y + 42 >> 4; + for (int index1 = num1 - 4; index1 <= num1 + 4; ++index1) + { + for (int index2 = num2 - 3; index2 < num2 + 3; ++index2) + { + if ((int) Main.tile[index1, index2].active != 0) + { + int type = (int) Main.tile[index1, index2].type; + if (type < 135) + { + this.adjTile[type].i = true; + this.FoundCraftingStation(type); + if (type == 77) + { + this.adjTile[17].i = true; + this.craftingStationsFound.Set(17, true); + } + else if (type == 133) + { + this.adjTile[17].i = true; + this.adjTile[77].i = true; + this.craftingStationsFound.Set(17, true); + this.craftingStationsFound.Set(77, true); + } + else if (type == 134) + { + this.adjTile[16].i = true; + this.craftingStationsFound.Set(16, true); + } + } + } + if ((int) Main.tile[index1, index2].liquid > 200 && (int) Main.tile[index1, index2].lava == 0) + this.adjWater = true; + } + } + } + + public unsafe void PlayerFrame() + { + if ((int) this.swimTime > 0) + { + if (!this.wet) + this.swimTime = (byte) 0; + else + --this.swimTime; + } + this.head = this.armor[0].headSlot; + this.body = this.armor[1].bodySlot; + this.legs = this.armor[2].legSlot; + if (this.merman) + { + this.head = (short) 39; + this.legs = (short) 21; + this.body = (short) 22; + } + else if (this.wereWolf) + { + this.legs = (short) 20; + this.body = (short) 21; + this.head = (short) 38; + } + else + { + int num = 0; + if ((int) this.armor[8].headSlot >= 0) + { + this.head = this.armor[8].headSlot; + ++num; + } + if ((int) this.armor[9].bodySlot >= 0) + { + this.body = this.armor[9].bodySlot; + ++num; + } + if ((int) this.armor[10].legSlot >= 0) + { + this.legs = this.armor[10].legSlot; + ++num; + } + if (num == 3 && this.ui != null) + this.ui.SetTriggerState(Trigger.AllVanitySlotsEquipped); + } + if ((int) this.head == 5 && (int) this.body == 5 && (int) this.legs == 5) + { + if (Main.rand.Next(16) == 0) + Main.dust.NewDust(14, ref this.aabb, 0.0, 0.0, 200, new Color(), 1.20000004768372); + this.socialShadow = true; + } + else + { + this.socialShadow = false; + if ((int) this.head == 6 && (int) this.body == 6 && (int) this.legs == 6) + { + if ((double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y) > 1.0 && !this.rocketFrame) + { + for (int index = 0; index < 2; ++index) + { + Dust* dustPtr = Main.dust.NewDust((int) ((double) this.position.X - (double) this.velocity.X * 2.0), (int) ((double) this.position.Y - (double) this.velocity.Y * 2.0) - 2, 20, 42, 6, 0.0, 0.0, 100, new Color(), 2.0); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->noGravity = true; + dustPtr->noLight = true; + dustPtr->velocity.X -= this.velocity.X * 0.5f; + dustPtr->velocity.Y -= this.velocity.Y * 0.5f; + } + else + break; + } + } + } + else if ((int) this.head == 7 && (int) this.body == 7 && (int) this.legs == 7) + this.boneArmor = true; + else if ((int) this.head == 8 && (int) this.body == 8 && (int) this.legs == 8) + { + if ((double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y) > 1.0) + { + Dust* dustPtr = Main.dust.NewDust((int) ((double) this.position.X - (double) this.velocity.X * 2.0), (int) ((double) this.position.Y - (double) this.velocity.Y * 2.0) - 2, 20, 42, 40, 0.0, 0.0, 50, new Color(), 1.39999997615814); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->noGravity = true; + dustPtr->velocity *= 0.25f; + } + } + } + else if ((int) this.head == 9 && (int) this.body == 9 && (int) this.legs == 9) + { + if ((double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y) > 1.0 && !this.rocketFrame) + { + for (int index = 0; index < 2; ++index) + { + Dust* dustPtr = Main.dust.NewDust((int) ((double) this.position.X - (double) this.velocity.X * 2.0), (int) ((double) this.position.Y - (double) this.velocity.Y * 2.0) - 2, 20, 42, 6, 0.0, 0.0, 100, new Color(), 2.0); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->noGravity = true; + dustPtr->noLight = true; + dustPtr->velocity.X -= this.velocity.X * 0.5f; + dustPtr->velocity.Y -= this.velocity.Y * 0.5f; + } + else + break; + } + } + } + else if ((int) this.body == 18 && (int) this.legs == 17) + { + if (((int) this.head == 32 || (int) this.head == 33 || (int) this.head == 34) && Main.rand.Next(16) == 0) + { + Dust* dustPtr = Main.dust.NewDust((int) ((double) this.position.X - (double) this.velocity.X * 2.0), (int) ((double) this.position.Y - (double) this.velocity.Y * 2.0) - 2, 20, 42, 43, 0.0, 0.0, 100, new Color(), 0.300000011920929); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->fadeIn = 0.8f; + dustPtr->velocity.X = 0.0f; + dustPtr->velocity.Y = 0.0f; + } + } + } + else if ((int) this.body == 24 && (int) this.legs == 23 && ((int) this.head == 42 || (int) this.head == 43 || (int) this.head == 41) && (((double) this.velocity.X != 0.0 || (double) this.velocity.Y != 0.0) && Main.rand.Next(16) == 0)) + { + Dust* dustPtr = Main.dust.NewDust((int) ((double) this.position.X - (double) this.velocity.X * 2.0), (int) ((double) this.position.Y - (double) this.velocity.Y * 2.0) - 2, 20, 42, 43, 0.0, 0.0, 100, new Color(), 0.300000011920929); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->fadeIn = 0.8f; + dustPtr->velocity.X = 0.0f; + dustPtr->velocity.Y = 0.0f; + } + } + } + if ((int) this.itemAnimation > 0 && (int) this.inventory[(int) this.selectedItem].useStyle != 10) + { + if ((int) this.inventory[(int) this.selectedItem].useStyle == 1 || (int) this.inventory[(int) this.selectedItem].type == 0) + this.bodyFrameY = (int) this.itemAnimation >= (int) this.itemAnimationMax / 3 ? ((int) this.itemAnimation >= ((int) this.itemAnimationMax << 1) / 3 ? (short) 56 : (short) 112) : (short) 168; + else if ((int) this.inventory[(int) this.selectedItem].useStyle == 2) + this.bodyFrameY = (int) this.itemAnimation <= (int) this.itemAnimationMax >> 1 ? (short) 112 : (short) 168; + else if ((int) this.inventory[(int) this.selectedItem].useStyle == 3) + this.bodyFrameY = (int) this.itemAnimation <= ((int) this.itemAnimationMax << 1) / 3 ? (short) 168 : (short) 168; + else if ((int) this.inventory[(int) this.selectedItem].useStyle == 4) + this.bodyFrameY = (short) 112; + else if ((int) this.inventory[(int) this.selectedItem].useStyle == 5) + { + if ((int) this.inventory[(int) this.selectedItem].type == 281) + { + this.bodyFrameY = (short) 112; + } + else + { + float num = this.itemRotation * (float) this.direction; + this.bodyFrameY = (short) 168; + if ((double) num < -0.75) + { + this.bodyFrameY = (short) 112; + if ((int) this.gravDir == -1) + this.bodyFrameY = (short) 224; + } + if ((double) num > 0.6) + { + this.bodyFrameY = (short) 224; + if ((int) this.gravDir == -1) + this.bodyFrameY = (short) 112; + } + } + } + } + else if ((int) this.inventory[(int) this.selectedItem].holdStyle == 1 && (!this.wet || !this.inventory[(int) this.selectedItem].noWet)) + this.bodyFrameY = (short) 168; + else if ((int) this.inventory[(int) this.selectedItem].holdStyle == 2 && (!this.wet || !this.inventory[(int) this.selectedItem].noWet)) + this.bodyFrameY = (short) 112; + else if ((int) this.inventory[(int) this.selectedItem].holdStyle == 3) + this.bodyFrameY = (short) 168; + else if ((int) this.grappling[0] >= 0) + { + Vector2 vector2 = new Vector2(this.position.X + 10f, this.position.Y + 21f); + float num1 = 0.0f; + float num2 = 0.0f; + for (int index = 0; index < (int) this.grapCount; ++index) + { + num1 += Main.projectile[(int) this.grappling[index]].position.X + (float) ((int) Main.projectile[(int) this.grappling[index]].width >> 1); + num2 += Main.projectile[(int) this.grappling[index]].position.Y + (float) ((int) Main.projectile[(int) this.grappling[index]].height >> 1); + } + float num3 = num1 / (float) this.grapCount; + float num4 = num2 / (float) this.grapCount; + float num5 = num3 - vector2.X; + float num6 = num4 - vector2.Y; + if ((double) num6 < 0.0 && (double) Math.Abs(num6) > (double) Math.Abs(num5)) + { + this.bodyFrameY = (short) 112; + if ((int) this.gravDir == -1) + this.bodyFrameY = (short) 224; + } + else if ((double) num6 > 0.0 && (double) Math.Abs(num6) > (double) Math.Abs(num5)) + { + this.bodyFrameY = (short) 224; + if ((int) this.gravDir == -1) + this.bodyFrameY = (short) 112; + } + else + this.bodyFrameY = (short) 168; + } + else if ((int) this.swimTime > 0) + this.bodyFrameY = (int) this.swimTime <= 20 ? ((int) this.swimTime <= 10 ? (short) 0 : (short) 280) : (short) 0; + else if ((double) this.velocity.Y != 0.0) + { + this.bodyFrameY = (int) this.wings <= 0 ? (short) 280 : ((double) this.velocity.Y <= 0.0 ? (short) 336 : (!this.controlJump ? (short) 280 : (short) 336)); + this.bodyFrameCounter = 0.0f; + } + else if ((double) this.velocity.X != 0.0) + { + this.bodyFrameCounter += Math.Abs(this.velocity.X) * 1.5f; + this.bodyFrameY = this.legFrameY; + } + else + { + this.bodyFrameCounter = 0.0f; + this.bodyFrameY = (short) 0; + } + if ((int) this.swimTime > 0) + { + this.legFrameCounter += 2f; + while ((double) this.legFrameCounter > 8.0) + { + this.legFrameCounter -= 8f; + this.legFrameY += (short) 56; + } + if ((int) this.legFrameY < 392) + this.legFrameY = (short) 1064; + else if ((int) this.legFrameY > 1064) + this.legFrameY = (short) 392; + this.ResetAirTime(); + } + else if ((double) this.velocity.Y != 0.0 || (int) this.grappling[0] >= 0) + { + this.IncreaseAirTime(); + this.legFrameCounter = 0.0f; + this.legFrameY = (short) 280; + } + else if ((double) this.velocity.X != 0.0) + { + this.legFrameCounter += Math.Abs(this.velocity.X) * 1.3f; + int num = (int) this.legFrameCounter >> 3; + if (num > 0) + { + this.legFrameCounter -= (float) (num << 3); + this.legFrameY = (short) ((int) this.legFrameY + 56 * num); + if ((int) this.legFrameY == 560 || (int) this.legFrameY == 784 || (int) this.legFrameY == 1008) + this.IncreaseSteps(); + } + if ((int) this.legFrameY < 392) + this.legFrameY = (short) 1064; + else if ((int) this.legFrameY > 1064) + this.legFrameY = (short) 392; + this.ResetAirTime(); + } + else + { + this.legFrameCounter = 0.0f; + this.legFrameY = (short) 0; + this.ResetAirTime(); + } + } + + public void Init() + { + this.velocity = new Vector2(); + this.headPosition = new Vector2(); + this.bodyPosition = new Vector2(); + this.legPosition = new Vector2(); + this.headRotation = 0.0f; + this.bodyRotation = 0.0f; + this.legRotation = 0.0f; + this.immune = true; + this.immuneTime = (short) 0; + this.dead = false; + this.wet = false; + this.wetCount = (byte) 0; + this.lavaWet = false; + this.talkNPC = (short) -1; + } + + public void Spawn() + { + this.Init(); + if (this.isLocal()) + { + this.view.quickBG = 10; + this.FindSpawn(); + if (!Player.CheckSpawn(this.SpawnX, this.SpawnY)) + { + this.SpawnX = -1; + this.SpawnY = -1; + } + NetMessage.CreateMessage1(12, (int) this.whoAmI); + NetMessage.SendMessage(); + } + if (this.SpawnX >= 0 && this.SpawnY >= 0) + { + this.position.X = (float) (this.SpawnX * 16 + 8 - 10); + this.position.Y = (float) (this.SpawnY * 16 - 42); + } + else + { + this.position.X = (float) ((int) Main.spawnTileX * 16 + 8 - 10); + this.position.Y = (float) ((int) Main.spawnTileY * 16 - 42); + for (int i = (int) Main.spawnTileX - 1; i < (int) Main.spawnTileX + 2; ++i) + { + for (int j = (int) Main.spawnTileY - 3; j < (int) Main.spawnTileY; ++j) + { + if (Main.tileSolidNotSolidTop[(int) Main.tile[i, j].type]) + WorldGen.KillTile(i, j); + if ((int) Main.tile[i, j].liquid > 0) + { + Main.tile[i, j].lava = (byte) 0; + Main.tile[i, j].liquid = (byte) 0; + WorldGen.SquareTileFrame(i, j, -1); + } + } + } + } + this.shadowPos[0] = this.position; + this.shadowPos[1] = this.position; + this.shadowPos[2] = this.position; + this.aabb.X = (int) this.position.X; + this.aabb.Y = (int) this.position.Y; + this.fallStart = (short) (this.aabb.Y >> 4); + if ((int) this.statLife <= 0) + { + this.breath = (short) 200; + if (this.spawnMax) + { + this.statLife = this.statLifeMax; + this.statMana = this.statManaMax2; + } + else + this.statLife = (short) 100; + this.healthBarLife = this.statLife; + } + if (this.pvpDeath) + { + this.pvpDeath = false; + this.immuneTime = (short) 300; + this.healthBarLife = this.statLife = this.statLifeMax; + } + else + this.immuneTime = (short) 60; + if (this.isLocal()) + { + this.hellAndBackState = (byte) 0; + this.ui.worldFade = -0.25f; + this.ui.worldFadeTarget = 1f; + this.view.lighting.scrX = (short) -1; + this.updateScreenPosition(); + this.UpdateMouse(); + this.UpdatePlayer((int) this.whoAmI); + } + this.active = (byte) 1; + } + + public unsafe double Hurt(int Damage, int hitDirection, bool pvp, bool quiet, uint deathText, bool Crit = false) + { + if (this.immune) + return 0.0; + int Damage1 = Damage; + if (pvp) + Damage1 <<= 1; + double dmg = Main.CalculateDamage(Damage1, (int) this.statDefense); + if (Crit) + Damage1 <<= 1; + if (dmg >= 1.0) + { + if (this.isLocal() && !quiet) + { + NetMessage.CreateMessage1(13, (int) this.whoAmI); + NetMessage.SendMessage(); + NetMessage.CreateMessage1(16, (int) this.whoAmI); + NetMessage.SendMessage(); + NetMessage.SendPlayerHurt((int) this.whoAmI, hitDirection, Damage, pvp, false, deathText); + } + CombatText.NewText(this.position, 20, 42, (int) dmg, Crit); + this.statLife -= (short) dmg; + this.immune = true; + this.immuneTime = (short) 40; + if (this.longInvince) + this.immuneTime += (short) 40; + this.lifeRegenTime = 0; + if (pvp) + this.immuneTime = (short) 8; + if (this.isLocal() && this.starCloak) + { + for (int index1 = 0; index1 < 3; ++index1) + { + float X = this.position.X + (float) Main.rand.Next(-400, 400); + float Y = this.position.Y - (float) Main.rand.Next(500, 800); + float num1 = this.position.X + 10f - X; + float num2 = this.position.Y + 21f - Y; + float num3 = num1 + (float) Main.rand.Next(-100, 101); + float num4 = 23f / (float) Math.Sqrt((double) num3 * (double) num3 + (double) num2 * (double) num2); + float SpeedX = num3 * num4; + float SpeedY = num2 * num4; + int index2 = Projectile.NewProjectile(X, Y, SpeedX, SpeedY, 92, 30, 5f, (int) this.whoAmI, true); + if (index2 >= 0) + Main.projectile[index2].ai1 = this.aabb.Y; + else + break; + } + } + if (!this.noKnockback && hitDirection != 0) + { + this.velocity.X = 4.5f * (float) hitDirection; + this.velocity.Y = -3.5f; + } + if (this.wereWolf) + Main.PlaySound(3, this.aabb.X, this.aabb.Y, 6); + else if (this.boneArmor) + Main.PlaySound(3, this.aabb.X, this.aabb.Y, 2); + else + Main.PlaySound(this.male ? 1 : 20, this.aabb.X, this.aabb.Y, 1); + if ((int) this.statLife > 0) + { + for (int index = (int) (dmg / (double) this.statLifeMax * 80.0); index > 0; --index) + Main.dust.NewDust(this.boneArmor ? 26 : 5, ref this.aabb, (double) (2 * hitDirection), -2.0, 0, new Color(), 1.0); + } + else if (Main.IsTutorial()) + { + this.statLife = (short) 1; + } + else + { + this.statLife = (short) 0; + if (this.isLocal()) + this.KillMe(dmg, hitDirection, pvp, deathText); + } + } + if (pvp) + dmg = Main.CalculateDamage(Damage1, (int) this.statDefense); + return dmg; + } + + public void KillMeForGood() + { + this.ui.ErasePlayer((int) this.ui.selectedPlayer); + this.ui.playerPathName = (string) null; + } + + public unsafe void KillMe(double dmg, int hitDirection, bool pvp, uint deathText) + { + if (this.dead) + return; + if (pvp) + this.pvpDeath = true; + if (Main.netMode != 1) + { + float num1 = (float) Main.rand.Next(-35, 36) * 0.1f; + while ((double) num1 < 2.0 && (double) num1 > -2.0) + num1 += (float) Main.rand.Next(-30, 31) * 0.1f; + int index = Projectile.NewProjectile(this.position.X + 10f, this.position.Y + (float) ((int) this.head >> 1), (float) Main.rand.Next(10, 30) * 0.1f * (float) hitDirection + num1, (float) Main.rand.Next(-40, -20) * 0.1f, 43, 0, 0.0f, (int) this.whoAmI, true); + if (index >= 0) + { + uint num2 = Projectile.tombstoneTextIndex++ & 7U; + Projectile.tombstoneText[(IntPtr) num2] = this.name + Lang.deathMsgString(deathText); + Main.projectile[index].tombstoneTextId = (byte) num2; + } + } + if ((int) this.difficulty != 0 && this.isLocal()) + { + this.ui.trashItem.Init(); + this.DropItems(); + if ((int) this.difficulty == 2) + this.KillMeForGood(); + } + Main.PlaySound(5, this.aabb.X, this.aabb.Y, 1); + this.headVelocity.Y = (float) Main.rand.Next(-40, -10) * 0.1f; + this.bodyVelocity.Y = (float) Main.rand.Next(-40, -10) * 0.1f; + this.legVelocity.Y = (float) Main.rand.Next(-40, -10) * 0.1f; + this.headVelocity.X = (float) Main.rand.Next(-20, 21) * 0.1f + (float) (2 * hitDirection); + this.bodyVelocity.X = (float) Main.rand.Next(-20, 21) * 0.1f + (float) (2 * hitDirection); + this.legVelocity.X = (float) Main.rand.Next(-20, 21) * 0.1f + (float) (2 * hitDirection); + for (int index = 0; (double) index < 16.0 + dmg / (double) this.statLifeMax * 100.0; ++index) + Main.dust.NewDust(this.boneArmor ? 26 : 5, ref this.aabb, (double) (hitDirection << 1), -2.0, 0, new Color(), 1.0); + this.dead = true; + this.respawnTimer = (short) 420; + this.immuneAlpha = (short) 0; + if (Main.netMode != 1) + NetMessage.SendDeathText(this.name, deathText, 225, 25, 25); + if (!this.isLocal()) + return; + NetMessage.CreateMessage5(44, (int) this.whoAmI, hitDirection, (int) dmg, pvp ? 1 : 0, (int) deathText); + NetMessage.SendMessage(); + if (pvp || (int) this.difficulty != 0) + return; + this.DropCoins(); + } + + public unsafe bool ItemSpace(Item* pNewItem) + { + int num1 = (int) pNewItem->type; + switch (num1) + { + case 58: + case 184: + return true; + default: + int num2 = 40; + if (num1 == 71 || num1 == 72 || (num1 == 73 || num1 == 74)) + num2 = 44; + for (int index = 0; index < num2; ++index) + { + if ((int) this.inventory[index].type == 0 || (int) this.inventory[index].stack < (int) this.inventory[index].maxStack && (int) pNewItem->netID == (int) this.inventory[index].netID) + return true; + } + if (pNewItem->CanBePlacedInAmmoSlot()) + { + for (int index = 44; index < 48; ++index) + { + if ((int) this.inventory[index].type == 0 && pNewItem->CanBeAutoPlacedInEmptyAmmoSlot() || (int) this.inventory[index].stack < (int) this.inventory[index].maxStack && (int) pNewItem->netID == (int) this.inventory[index].netID) + return true; + } + } + else if (pNewItem->accessory) + { + for (int index = 3; index < 8; ++index) + { + if ((int) this.armor[index].netID == (int) pNewItem->netID) + return false; + } + for (int index = 3; index < 8; ++index) + { + if ((int) this.armor[index].type == 0) + return true; + } + return false; + } + else if ((int) pNewItem->headSlot >= 0) + { + if ((int) this.armor[0].type != 0) + return (int) this.armor[8].type == 0; + else + return true; + } + else if ((int) pNewItem->bodySlot >= 0) + { + if ((int) this.armor[1].type != 0) + return (int) this.armor[9].type == 0; + else + return true; + } + else if ((int) pNewItem->legSlot >= 0) + { + if ((int) this.armor[2].type != 0) + return (int) this.armor[10].type == 0; + else + return true; + } + return false; + } + } + + public void DoCoins(int i) + { + if ((int) this.inventory[i].stack != 100 || (int) this.inventory[i].type != 71 && (int) this.inventory[i].type != 72 && (int) this.inventory[i].type != 73) + return; + this.inventory[i].SetDefaults((int) this.inventory[i].type + 1, 1, false); + for (int i1 = 0; i1 < 44; ++i1) + { + if ((int) this.inventory[i1].netID == (int) this.inventory[i].netID && i1 != i && (int) this.inventory[i1].stack < (int) this.inventory[i1].maxStack) + { + ++this.inventory[i1].stack; + this.inventory[i].Init(); + this.DoCoins(i1); + } + } + } + + public bool AutoEquip(ref Item item) + { + int index = -1; + bool flag = item.vanity; + lock (this) + { + do + { + if (item.accessory) + { + for (int local_2 = 3; local_2 < 8; ++local_2) + { + if ((int) this.armor[local_2].netID == (int) item.netID) + return false; + } + for (int local_3 = 3; local_3 < 8; ++local_3) + { + if ((int) this.armor[local_3].type == 0) + { + index = local_3; + break; + } + } + } + else if ((int) item.headSlot >= 0) + index = flag ? 8 : 0; + else if ((int) item.bodySlot >= 0) + index = flag ? 9 : 1; + else if ((int) item.legSlot >= 0) + index = flag ? 10 : 2; + if (index >= 0 && (int) this.armor[index].type == 0) + { + this.armor[index] = item; + this.itemsFound.Set((int) item.type, true); + this.ui.FoundPotentialArmor((int) item.type); + item.Init(); + return true; + } + else + flag = !flag; + } + while (flag != item.vanity); + } + return false; + } + + public bool FillAmmo(ref Item item) + { + bool flag = false; + lock (this) + { + for (int local_1 = 44; local_1 < 48; ++local_1) + { + if ((int) this.inventory[local_1].type > 0 && (int) this.inventory[local_1].stack < (int) this.inventory[local_1].maxStack && (int) item.netID == (int) this.inventory[local_1].netID) + { + Main.PlaySound(7, this.aabb.X, this.aabb.Y, 1); + if ((int) item.stack + (int) this.inventory[local_1].stack <= (int) this.inventory[local_1].maxStack) + { + this.inventory[local_1].stack += item.stack; + this.view.itemTextLocal.NewText(ref item, (int) item.stack); + item.Init(); + return true; + } + else + { + short local_2 = (short) ((int) this.inventory[local_1].maxStack - (int) this.inventory[local_1].stack); + item.stack -= local_2; + this.view.itemTextLocal.NewText(ref item, (int) local_2); + this.inventory[local_1].stack = this.inventory[local_1].maxStack; + flag = true; + } + } + } + if (item.CanBeAutoPlacedInEmptyAmmoSlot()) + { + for (int local_3 = 44; local_3 < 48; ++local_3) + { + if ((int) this.inventory[local_3].type == 0) + { + this.inventory[local_3] = item; + this.itemsFound.Set((int) item.type, true); + this.view.itemTextLocal.NewText(ref item, (int) item.stack); + Main.PlaySound(7, this.aabb.X, this.aabb.Y, 1); + item.Init(); + return true; + } + } + } + } + return flag; + } + + public bool GetItem(ref Item item) + { + if ((int) item.noGrabDelay > 0) + return false; + bool flag1 = false; + bool flag2 = this.isLocal() && (int) this.ui.inventoryMode > 0 && this.ui.inventorySection == UI.InventorySection.CRAFTING && this.ui.gpState.IsButtonUp(Buttons.A); + int num1 = 40; + int num2 = 0; + if (item.CanBePlacedInCoinSlot()) + { + num2 = -4; + num1 = 44; + } + else if (item.CanBePlacedInAmmoSlot()) + { + flag1 = this.FillAmmo(ref item); + if (flag1 && ((int) item.type == 0 || (int) item.stack == 0)) + { + if (flag2) + Recipe.FindRecipes(this.ui, this.ui.craftingCategory, this.ui.craftingShowCraftable); + return true; + } + } + else if (this.AutoEquip(ref item)) + return true; + lock (this) + { + for (int local_4 = num2; local_4 < 40; ++local_4) + { + int local_5 = local_4; + if (local_5 < 0) + local_5 += 44; + if ((int) this.inventory[local_5].type > 0 && (int) this.inventory[local_5].stack < (int) this.inventory[local_5].maxStack && (int) item.netID == (int) this.inventory[local_5].netID) + { + Main.PlaySound(7, this.aabb.X, this.aabb.Y, 1); + if ((int) item.stack + (int) this.inventory[local_5].stack <= (int) this.inventory[local_5].maxStack) + { + this.inventory[local_5].stack += item.stack; + this.view.itemTextLocal.NewText(ref item, (int) item.stack); + this.DoCoins(local_5); + item.Init(); + if (flag2) + Recipe.FindRecipes(this.ui, this.ui.craftingCategory, this.ui.craftingShowCraftable); + return true; + } + else + { + short local_6 = (short) ((int) this.inventory[local_5].maxStack - (int) this.inventory[local_5].stack); + item.stack -= local_6; + this.view.itemTextLocal.NewText(ref item, (int) local_6); + this.inventory[local_5].stack = this.inventory[local_5].maxStack; + this.DoCoins(local_5); + flag1 = true; + } + } + } + if ((int) item.useStyle > 0) + { + for (int local_7 = 0; local_7 < 10; ++local_7) + { + if ((int) this.inventory[local_7].type == 0) + { + this.inventory[local_7] = item; + this.itemsFound.Set((int) item.type, true); + this.view.itemTextLocal.NewText(ref item, (int) item.stack); + this.DoCoins(local_7); + Main.PlaySound(7, this.aabb.X, this.aabb.Y, 1); + item.Init(); + if (flag2) + Recipe.FindRecipes(this.ui, this.ui.craftingCategory, this.ui.craftingShowCraftable); + return true; + } + } + } + for (int local_8 = num1 - 1; local_8 >= 0; --local_8) + { + if ((int) this.inventory[local_8].type == 0) + { + this.inventory[local_8] = item; + this.itemsFound.Set((int) item.type, true); + this.ui.FoundPotentialArmor((int) item.type); + this.view.itemTextLocal.NewText(ref item, (int) item.stack); + this.DoCoins(local_8); + Main.PlaySound(7, this.aabb.X, this.aabb.Y, 1); + item.Init(); + if (flag2) + Recipe.FindRecipes(this.ui, this.ui.craftingCategory, this.ui.craftingShowCraftable); + return true; + } + } + } + if (flag2 && flag1) + Recipe.FindRecipes(this.ui, this.ui.craftingCategory, this.ui.craftingShowCraftable); + return flag1; + } + + private void PlaceThing() + { + int index1 = (int) this.inventory[(int) this.selectedItem].createTile; + if (index1 >= 0) + { + bool flag1 = false; + if ((int) Main.tile[(int) this.tileTargetX, (int) this.tileTargetY].liquid > 0 && (int) Main.tile[(int) this.tileTargetX, (int) this.tileTargetY].lava != 0) + { + if (Main.tileSolid[index1]) + flag1 = true; + else if (Main.tileLavaDeath[index1]) + flag1 = true; + } + if (((int) Main.tile[(int) this.tileTargetX, (int) this.tileTargetY].active == 0 && !flag1 || (Main.tileCut[(int) Main.tile[(int) this.tileTargetX, (int) this.tileTargetY].type] || index1 == 23) || (index1 == 2 || index1 == 109 || (index1 == 60 || index1 == 70))) && ((int) this.itemTime == 0 && (int) this.itemAnimation > 0 && this.controlUseItem)) + { + bool flag2 = false; + if (index1 == 23 || index1 == 2 || index1 == 109) + { + if ((int) Main.tile[(int) this.tileTargetX, (int) this.tileTargetY].active != 0 && (int) Main.tile[(int) this.tileTargetX, (int) this.tileTargetY].type == 0) + flag2 = true; + } + else if (index1 == 60 || index1 == 70) + { + if ((int) Main.tile[(int) this.tileTargetX, (int) this.tileTargetY].active != 0 && (int) Main.tile[(int) this.tileTargetX, (int) this.tileTargetY].type == 59) + flag2 = true; + } + else if (index1 == 4 || index1 == 136) + { + int index2 = (int) Main.tile[(int) this.tileTargetX, (int) this.tileTargetY + 1].type; + int index3 = (int) Main.tile[(int) this.tileTargetX - 1, (int) this.tileTargetY].type; + int index4 = (int) Main.tile[(int) this.tileTargetX + 1, (int) this.tileTargetY].type; + int num1 = (int) Main.tile[(int) this.tileTargetX - 1, (int) this.tileTargetY - 1].type; + int num2 = (int) Main.tile[(int) this.tileTargetX + 1, (int) this.tileTargetY - 1].type; + int num3 = (int) Main.tile[(int) this.tileTargetX - 1, (int) this.tileTargetY - 1].type; + int num4 = (int) Main.tile[(int) this.tileTargetX + 1, (int) this.tileTargetY + 1].type; + if ((int) Main.tile[(int) this.tileTargetX, (int) this.tileTargetY + 1].active == 0) + index2 = -1; + if ((int) Main.tile[(int) this.tileTargetX - 1, (int) this.tileTargetY].active == 0) + index3 = -1; + if ((int) Main.tile[(int) this.tileTargetX + 1, (int) this.tileTargetY].active == 0) + index4 = -1; + if ((int) Main.tile[(int) this.tileTargetX - 1, (int) this.tileTargetY - 1].active == 0) + num1 = -1; + if ((int) Main.tile[(int) this.tileTargetX + 1, (int) this.tileTargetY - 1].active == 0) + num2 = -1; + if ((int) Main.tile[(int) this.tileTargetX - 1, (int) this.tileTargetY + 1].active == 0) + num3 = -1; + if ((int) Main.tile[(int) this.tileTargetX + 1, (int) this.tileTargetY + 1].active == 0) + num4 = -1; + if (index2 >= 0 && Main.tileSolidAndAttach[index2]) + flag2 = true; + else if (index3 >= 0 && (Main.tileSolidAndAttach[index3] || index3 == 124 || index3 == 5 && num1 == 5 && num3 == 5)) + flag2 = true; + else if (index4 >= 0 && (Main.tileSolidAndAttach[index4] || index4 == 124 || index4 == 5 && num2 == 5 && num4 == 5)) + flag2 = true; + } + else if (index1 == 78 || index1 == 98 || index1 == 100) + { + if ((int) Main.tile[(int) this.tileTargetX, (int) this.tileTargetY + 1].active != 0 && (Main.tileSolid[(int) Main.tile[(int) this.tileTargetX, (int) this.tileTargetY + 1].type] || Main.tileTable[(int) Main.tile[(int) this.tileTargetX, (int) this.tileTargetY + 1].type])) + flag2 = true; + } + else if (index1 == 13 || index1 == 29 || (index1 == 33 || index1 == 49) || (index1 == 50 || index1 == 103)) + { + if ((int) Main.tile[(int) this.tileTargetX, (int) this.tileTargetY + 1].active != 0 && Main.tileTable[(int) Main.tile[(int) this.tileTargetX, (int) this.tileTargetY + 1].type]) + flag2 = true; + } + else if (index1 == 51) + { + if ((int) Main.tile[(int) this.tileTargetX + 1, (int) this.tileTargetY].active != 0 || (int) Main.tile[(int) this.tileTargetX + 1, (int) this.tileTargetY].wall > 0 || ((int) Main.tile[(int) this.tileTargetX - 1, (int) this.tileTargetY].active != 0 || (int) Main.tile[(int) this.tileTargetX - 1, (int) this.tileTargetY].wall > 0) || ((int) Main.tile[(int) this.tileTargetX, (int) this.tileTargetY + 1].active != 0 || (int) Main.tile[(int) this.tileTargetX, (int) this.tileTargetY + 1].wall > 0 || ((int) Main.tile[(int) this.tileTargetX, (int) this.tileTargetY - 1].active != 0 || (int) Main.tile[(int) this.tileTargetX, (int) this.tileTargetY - 1].wall > 0))) + flag2 = true; + } + else if ((int) Main.tile[(int) this.tileTargetX + 1, (int) this.tileTargetY].active != 0 && Main.tileSolid[(int) Main.tile[(int) this.tileTargetX + 1, (int) this.tileTargetY].type] || (int) Main.tile[(int) this.tileTargetX + 1, (int) this.tileTargetY].wall > 0 || ((int) Main.tile[(int) this.tileTargetX - 1, (int) this.tileTargetY].active != 0 && Main.tileSolid[(int) Main.tile[(int) this.tileTargetX - 1, (int) this.tileTargetY].type] || (int) Main.tile[(int) this.tileTargetX - 1, (int) this.tileTargetY].wall > 0) || ((int) Main.tile[(int) this.tileTargetX, (int) this.tileTargetY + 1].active != 0 && (Main.tileSolid[(int) Main.tile[(int) this.tileTargetX, (int) this.tileTargetY + 1].type] || (int) Main.tile[(int) this.tileTargetX, (int) this.tileTargetY + 1].type == 124) || (int) Main.tile[(int) this.tileTargetX, (int) this.tileTargetY + 1].wall > 0) || ((int) Main.tile[(int) this.tileTargetX, (int) this.tileTargetY - 1].active != 0 && (Main.tileSolid[(int) Main.tile[(int) this.tileTargetX, (int) this.tileTargetY - 1].type] || (int) Main.tile[(int) this.tileTargetX, (int) this.tileTargetY - 1].type == 124) || (int) Main.tile[(int) this.tileTargetX, (int) this.tileTargetY - 1].wall > 0)) + flag2 = true; + if (index1 >= 82 && index1 <= 84) + flag2 = true; + if ((int) Main.tile[(int) this.tileTargetX, (int) this.tileTargetY].active != 0 && Main.tileCut[(int) Main.tile[(int) this.tileTargetX, (int) this.tileTargetY].type]) + { + if ((int) Main.tile[(int) this.tileTargetX, (int) this.tileTargetY + 1].type != 78) + { + if (WorldGen.KillTile((int) this.tileTargetX, (int) this.tileTargetY)) + { + NetMessage.CreateMessage5(17, 4, (int) this.tileTargetX, (int) this.tileTargetY, 0, 0); + NetMessage.SendMessage(); + } + } + else + flag2 = false; + } + if (flag2) + { + int num = (int) this.inventory[(int) this.selectedItem].placeStyle; + if (index1 == 141) + num = Main.rand.Next(2); + if (index1 == 128 || index1 == 137) + num = (int) this.direction >= 0 ? 1 : -1; + if (WorldGen.PlaceTile((int) this.tileTargetX, (int) this.tileTargetY, index1, false, false, (int) this.whoAmI, num)) + { + this.itemTime = this.inventory[(int) this.selectedItem].useTime; + NetMessage.CreateMessage5(17, 1, (int) this.tileTargetX, (int) this.tileTargetY, index1, num); + NetMessage.SendMessage(); + if (index1 == 15) + { + if ((int) this.direction == 1) + { + Main.tile[(int) this.tileTargetX, (int) this.tileTargetY].frameX += (short) 18; + Main.tile[(int) this.tileTargetX, (int) this.tileTargetY - 1].frameX += (short) 18; + } + NetMessage.SendTileSquare((int) this.tileTargetX - 1, (int) this.tileTargetY - 1, 3); + } + else if (index1 == 19) + ++this.ui.totalWoodPlatformsPlaced; + else if (index1 == 79 || index1 == 90) + NetMessage.SendTileSquare((int) this.tileTargetX, (int) this.tileTargetY, 5); + } + } + } + } + int num5 = (int) this.inventory[(int) this.selectedItem].createWall; + if (num5 >= 0 && (int) this.itemTime == 0 && ((int) this.itemAnimation > 0 && this.controlUseItem) && ((int) Main.tile[(int) this.tileTargetX + 1, (int) this.tileTargetY].active != 0 || (int) Main.tile[(int) this.tileTargetX + 1, (int) this.tileTargetY].wall > 0 || ((int) Main.tile[(int) this.tileTargetX - 1, (int) this.tileTargetY].active != 0 || (int) Main.tile[(int) this.tileTargetX - 1, (int) this.tileTargetY].wall > 0) || ((int) Main.tile[(int) this.tileTargetX, (int) this.tileTargetY + 1].active != 0 || (int) Main.tile[(int) this.tileTargetX, (int) this.tileTargetY + 1].wall > 0 || ((int) Main.tile[(int) this.tileTargetX, (int) this.tileTargetY - 1].active != 0 || (int) Main.tile[(int) this.tileTargetX, (int) this.tileTargetY - 1].wall > 0))) && ((int) Main.tile[(int) this.tileTargetX, (int) this.tileTargetY].wall != num5 && WorldGen.PlaceWall((int) this.tileTargetX, (int) this.tileTargetY, num5))) + { + ++this.ui.totalWallsPlaced; + this.itemTime = this.inventory[(int) this.selectedItem].useTime; + NetMessage.CreateMessage5(17, 3, (int) this.tileTargetX, (int) this.tileTargetY, num5, 0); + NetMessage.SendMessage(); + if ((int) this.inventory[(int) this.selectedItem].stack > 1) + { + for (int index2 = 0; index2 < 4; ++index2) + { + int index3 = (int) this.tileTargetX; + int index4 = (int) this.tileTargetY; + if (index2 == 0) + --index3; + else if (index2 == 1) + ++index3; + else if (index2 == 2) + --index4; + else + ++index4; + if ((int) Main.tile[index3, index4].wall == 0) + { + int num1 = 0; + for (int index5 = 0; index5 < 4; ++index5) + { + int index6 = index3; + int index7 = index4; + if (index5 == 0) + --index6; + else if (index5 == 1) + ++index6; + else if (index5 == 2) + --index7; + else + ++index7; + if ((int) Main.tile[index6, index7].wall == num5) + ++num1; + } + if (num1 == 4 && WorldGen.PlaceWall(index3, index4, num5)) + { + --this.inventory[(int) this.selectedItem].stack; + if ((int) this.inventory[(int) this.selectedItem].stack == 0) + this.inventory[(int) this.selectedItem].Init(); + ++this.ui.totalWallsPlaced; + NetMessage.CreateMessage5(17, 3, index3, index4, num5, 0); + NetMessage.SendMessage(); + } + } + } + } + } + if (!this.isLocal() || this.view.isFullScreen()) + return; + if (index1 >= 0 || num5 >= 0) + { + if (this.ui.smartCursor || this.ui.hotbarItemNameTime > 0) + return; + this.view.Zoom(1.5f); + } + else + this.view.Zoom(1.25f); + } + + public unsafe void ItemCheck(int i) + { + fixed (Item* objPtr = &this.inventory[(int) this.selectedItem]) + { + int num1 = (int) objPtr->damage; + if (num1 > 0) + { + if (objPtr->melee) + num1 = (int) ((double) num1 * (double) this.meleeDamage); + else if (objPtr->ranged) + num1 = (int) ((double) num1 * (double) this.rangedDamage); + else if (objPtr->magic) + num1 = (int) ((double) num1 * (double) this.magicDamage); + } + if (objPtr->autoReuse && !this.noItems) + { + this.releaseUseItem = true; + if ((int) this.itemAnimation == 1 && (int) objPtr->stack > 0) + this.itemAnimation = (int) objPtr->shoot <= 0 || this.isLocal() || !this.controlUseItem ? (short) 0 : (short) 2; + } + if ((int) this.itemAnimation == 0 && (int) this.reuseDelay > 0) + { + this.itemAnimation = (short) this.reuseDelay; + this.itemTime = this.reuseDelay; + this.reuseDelay = (byte) 0; + } + if (this.controlUseItem && this.releaseUseItem && ((int) objPtr->headSlot > 0 || (int) objPtr->bodySlot > 0 || (int) objPtr->legSlot > 0)) + { + if ((int) objPtr->useStyle == 0) + this.releaseUseItem = false; + int index1 = (int) this.tileTargetX; + int index2 = (int) this.tileTargetY; + if ((int) Main.tile[index1, index2].active != 0 && (int) Main.tile[index1, index2].type == 128) + { + int num2 = (int) Main.tile[index1, index2].frameY; + int num3 = 0; + if ((int) objPtr->bodySlot >= 0) + num3 = 1; + else if ((int) objPtr->legSlot >= 0) + num3 = 2; + int num4; + for (num4 = num2 / 18; num3 > num4; num4 = (int) Main.tile[index1, index2].frameY / 18) + ++index2; + for (; num3 < num4; num4 = (int) Main.tile[index1, index2].frameY / 18) + --index2; + int num5 = (int) Main.tile[index1, index2].frameX % 100; + if (num5 >= 36) + num5 -= 36; + int index3 = index1 - num5 / 18; + int num6 = (int) Main.tile[index3, index2].frameX; + WorldGen.KillTile(index3, index2, true, false, false); + NetMessage.CreateMessage5(17, 0, index3, index2, 1, 0); + NetMessage.SendMessage(); + int num7 = num6 % 100; + if (num4 == 0 && (int) objPtr->headSlot >= 0) + { + Main.tile[index3, index2].frameX = (short) (num7 + (int) objPtr->headSlot * 100); + NetMessage.SendTile(index3, index2); + objPtr->SetDefaults(0, 1, false); + this.ui.mouseItem.SetDefaults(0, 1, false); + this.releaseUseItem = false; + } + else if (num4 == 1 && (int) objPtr->bodySlot >= 0) + { + Main.tile[index3, index2].frameX = (short) (num7 + (int) objPtr->bodySlot * 100); + NetMessage.SendTile(index3, index2); + objPtr->SetDefaults(0, 1, false); + this.ui.mouseItem.SetDefaults(0, 1, false); + this.releaseUseItem = false; + } + else if (num4 == 2 && (int) objPtr->legSlot >= 0) + { + Main.tile[index3, index2].frameX = (short) (num7 + (int) objPtr->legSlot * 100); + NetMessage.SendTile(index3, index2); + objPtr->SetDefaults(0, 1, false); + this.ui.mouseItem.SetDefaults(0, 1, false); + this.releaseUseItem = false; + } + } + } + if (this.controlUseItem && (int) this.itemAnimation == 0 && (this.releaseUseItem && (int) objPtr->useStyle > 0)) + { + bool flag = !this.noItems; + if ((int) objPtr->shoot == 0) + this.itemRotation = 0.0f; + if (flag) + { + if ((int) objPtr->shoot == 85 || (int) objPtr->shoot == 15 || (int) objPtr->shoot == 34) + flag = !this.wet; + else if ((int) objPtr->shoot == 6 || (int) objPtr->shoot == 19 || ((int) objPtr->shoot == 33 || (int) objPtr->shoot == 52)) + { + for (int index = 0; index < 512; ++index) + { + if ((int) Main.projectile[index].active != 0 && (int) Main.projectile[index].owner == (int) this.whoAmI && (int) Main.projectile[index].type == (int) objPtr->shoot) + { + flag = false; + break; + } + } + } + else if ((int) objPtr->shoot == 106) + { + int num2 = 0; + for (int index = 0; index < 512; ++index) + { + if ((int) Main.projectile[index].active != 0 && (int) Main.projectile[index].owner == (int) this.whoAmI && ((int) Main.projectile[index].type == (int) objPtr->shoot && num2 >= (int) objPtr->stack)) + { + flag = false; + break; + } + } + } + else if ((int) objPtr->shoot == 13 || (int) objPtr->shoot == 32) + { + for (int index = 0; index < 512; ++index) + { + if ((int) Main.projectile[index].active != 0 && (int) Main.projectile[index].owner == (int) this.whoAmI && ((int) Main.projectile[index].type == (int) objPtr->shoot && (double) Main.projectile[index].ai0 != 2.0)) + { + flag = false; + break; + } + } + } + else if ((int) objPtr->shoot == 73) + { + for (int index = 0; index < 512; ++index) + { + if ((int) Main.projectile[index].active != 0 && (int) Main.projectile[index].owner == (int) this.whoAmI && (int) Main.projectile[index].type == 74) + { + flag = false; + break; + } + } + } + } + if (flag && objPtr->potion) + { + if ((int) this.potionDelay <= 0) + { + this.potionDelay = this.potionDelayTime; + this.AddBuff(21, (int) this.potionDelay, true); + } + else + { + flag = false; + this.itemTime = objPtr->useTime; + } + } + if ((int) objPtr->mana > 0 && this.silence) + flag = false; + if ((int) objPtr->mana > 0 && flag) + { + if ((int) objPtr->type != (int) sbyte.MaxValue || !this.spaceGun) + { + if ((int) this.statMana >= (int) ((double) objPtr->mana * (double) this.manaCost)) + this.statMana -= (short) ((double) objPtr->mana * (double) this.manaCost); + else if (this.manaFlower) + { + this.QuickMana(); + if ((int) this.statMana >= (int) ((double) objPtr->mana * (double) this.manaCost)) + this.statMana -= (short) ((double) objPtr->mana * (double) this.manaCost); + else + flag = false; + } + else + flag = false; + } + if (this.isLocal() && (int) objPtr->buffType != 0) + this.AddBuff((int) objPtr->buffType, (int) objPtr->buffTime, true); + } + if (this.isLocal() && (int) objPtr->buffType == 40) + this.ApplyPetBuff((int) objPtr->type); + if (Main.gameTime.dayTime) + { + if ((int) objPtr->type == 43) + flag = false; + else if ((int) objPtr->type == 544) + flag = false; + else if ((int) objPtr->type == 556) + flag = false; + else if ((int) objPtr->type == 557) + flag = false; + } + if ((int) objPtr->type == 70 && !this.zoneEvil) + flag = false; + else if (flag && this.isLocal() && (int) objPtr->shoot == 17) + { + int index1 = (int) this.ui.mouseX + this.view.screenPosition.X >> 4; + int index2 = (int) this.ui.mouseY + this.view.screenPosition.Y >> 4; + if ((int) Main.tile[index1, index2].active != 0 && ((int) Main.tile[index1, index2].type == 0 || (int) Main.tile[index1, index2].type == 2 || (int) Main.tile[index1, index2].type == 23)) + { + WorldGen.KillTile(index1, index2, false, false, true); + if ((int) Main.tile[index1, index2].active == 0) + { + NetMessage.CreateMessage5(17, 4, index1, index2, 0, 0); + NetMessage.SendMessage(); + } + else + flag = false; + } + else + flag = false; + } + if (flag && (int) objPtr->useAmmo > 0) + { + flag = false; + for (int index = 0; index < 48; ++index) + { + if ((int) this.inventory[index].ammo == (int) objPtr->useAmmo && (int) this.inventory[index].stack > 0) + { + flag = true; + break; + } + } + } + if (flag) + { + if ((int) objPtr->pick > 0 || (int) objPtr->axe > 0 || (int) objPtr->hammer > 0) + this.toolTime = (short) 1; + if ((int) this.grappling[0] >= 0) + { + if (this.controlRight) + this.direction = (sbyte) 1; + else if (this.controlLeft) + this.direction = (sbyte) -1; + } + this.channel = objPtr->channel; + this.attackCD = (short) 0; + if (objPtr->melee) + { + this.itemAnimation = (short) ((double) objPtr->useAnimation * (double) this.meleeSpeed); + this.itemAnimationMax = (short) ((double) objPtr->useAnimation * (double) this.meleeSpeed); + } + else + { + this.itemAnimation = (short) objPtr->useAnimation; + this.itemAnimationMax = (short) objPtr->useAnimation; + this.reuseDelay = objPtr->reuseDelay; + } + if ((int) objPtr->useSound > 0) + Main.PlaySound(2, this.aabb.X, this.aabb.Y, (int) objPtr->useSound); + } + if (flag && ((int) objPtr->shoot == 18 || (int) objPtr->shoot == 72 || ((int) objPtr->shoot == 86 || (int) objPtr->shoot == 87) || (int) objPtr->shoot == 111)) + { + for (int index = 0; index < 512; ++index) + { + if ((int) Main.projectile[index].active != 0 && (int) Main.projectile[index].owner == i) + { + if ((int) Main.projectile[index].type == (int) objPtr->shoot) + Main.projectile[index].Kill(); + else if ((int) objPtr->shoot == 72 && ((int) Main.projectile[index].type == 86 || (int) Main.projectile[index].type == 87)) + Main.projectile[index].Kill(); + } + } + } + } + if (!this.controlUseItem) + this.channel = false; + this.itemHeight = (short) SpriteSheet<_sheetSprites>.src[451 + (int) objPtr->type].Height; + this.itemWidth = (short) SpriteSheet<_sheetSprites>.src[451 + (int) objPtr->type].Width; + if ((int) this.itemAnimation > 0) + { + this.itemAnimationMax = !objPtr->melee ? (short) objPtr->useAnimation : (short) ((double) objPtr->useAnimation * (double) this.meleeSpeed); + if ((int) objPtr->mana > 0) + this.manaRegenDelay = (int) this.maxRegenDelay; + --this.itemAnimation; + if ((int) objPtr->useStyle == 1) + { + if ((int) this.itemAnimation < (int) this.itemAnimationMax / 3) + { + int num2 = 10; + if ((int) this.itemWidth > 32) + num2 = (int) this.itemWidth <= 64 ? 14 : 28; + this.itemLocation.X = this.aabb.X + 10 + (((int) this.itemWidth >> 1) - num2) * (int) this.direction; + this.itemLocation.Y = this.aabb.Y + 24; + } + else if ((int) this.itemAnimation < ((int) this.itemAnimationMax << 1) / 3) + { + int num2 = 10; + if ((int) this.itemWidth > 32) + num2 = (int) this.itemWidth <= 64 ? 18 : 28; + this.itemLocation.X = this.aabb.X + 10 + (((int) this.itemWidth >> 1) - num2) * (int) this.direction; + int num3 = 10; + if ((int) this.itemWidth > 32) + num3 = (int) this.itemWidth <= 64 ? 8 : 14; + this.itemLocation.Y = this.aabb.Y + num3; + } + else + { + int num2 = 6; + if ((int) this.itemWidth > 32) + num2 = (int) this.itemWidth <= 64 ? 14 : 28; + this.itemLocation.X = this.aabb.X + 10 + (((int) this.itemWidth >> 1) - num2) * (int) this.direction; + int num3 = 10; + if ((int) this.itemWidth > 32) + num3 = (int) this.itemWidth <= 64 ? 10 : 14; + this.itemLocation.Y = this.aabb.Y + num3; + } + this.itemRotation = (float) (((double) this.itemAnimation / (double) this.itemAnimationMax - 0.5) * (double) -this.direction * 3.5 - (double) this.direction * 0.300000011920929); + if ((int) this.gravDir == -1) + { + this.itemRotation = -this.itemRotation; + this.itemLocation.Y = this.aabb.Y + 42 + (this.aabb.Y - this.itemLocation.Y); + } + } + else if ((int) objPtr->useStyle == 2) + { + this.itemRotation = (float) ((double) this.itemAnimation / (double) this.itemAnimationMax * (double) ((int) this.direction << 1) + -1.39999997615814 * (double) this.direction); + if ((int) this.itemAnimation < (int) this.itemAnimationMax >> 1) + { + this.itemLocation.X = this.aabb.X + 10 + (((int) this.itemWidth >> 1) - 9 - (int) ((double) this.itemRotation * (double) (12 * (int) this.direction))) * (int) this.direction; + this.itemLocation.Y = this.aabb.Y + 38 + (int) ((double) this.itemRotation * (double) ((int) this.direction << 2)); + } + else + { + this.itemLocation.X = this.aabb.X + 10 + (((int) this.itemWidth >> 1) - 9 - (int) ((double) this.itemRotation * (double) ((int) this.direction << 4))) * (int) this.direction; + this.itemLocation.Y = this.aabb.Y + 38 + (int) ((double) this.itemRotation * (double) this.direction); + } + if ((int) this.gravDir == -1) + { + this.itemRotation = -this.itemRotation; + this.itemLocation.Y = this.aabb.Y + 42 + (this.aabb.Y - this.itemLocation.Y); + } + } + else if ((int) objPtr->useStyle == 3) + { + if ((int) this.itemAnimation > ((int) this.itemAnimationMax << 1) / 3) + { + this.itemLocation.X = -1000; + this.itemLocation.Y = -1000; + this.itemRotation = -1.3f * (float) this.direction; + } + else + { + this.itemLocation.X = this.aabb.X + 10 + (((int) this.itemWidth >> 1) - 4) * (int) this.direction; + this.itemLocation.Y = this.aabb.Y + 24; + float num2 = (float) ((double) this.itemAnimation / (double) this.itemAnimationMax * (double) this.itemWidth * (double) this.direction * (double) objPtr->scale * 1.20000004768372) - (float) (10 * (int) this.direction); + if ((double) num2 > -4.0 && (int) this.direction == -1) + num2 = -8f; + if ((double) num2 < 4.0 && (int) this.direction == 1) + num2 = 8f; + this.itemLocation.X -= (int) num2; + this.itemRotation = 0.8f * (float) this.direction; + } + if ((int) this.gravDir == -1) + { + this.itemRotation = -this.itemRotation; + this.itemLocation.Y = this.aabb.Y + 42 + (this.aabb.Y - this.itemLocation.Y); + } + } + else if ((int) objPtr->useStyle == 4) + { + this.itemRotation = 0.0f; + this.itemLocation.X = this.aabb.X + 10 + (((int) this.itemWidth >> 1) - 9 - (int) ((double) this.itemRotation * (double) (14 * (int) this.direction)) - 4) * (int) this.direction; + this.itemLocation.Y = this.aabb.Y + ((int) this.itemHeight >> 1) + 4; + if ((int) this.gravDir == -1) + { + this.itemRotation = -this.itemRotation; + this.itemLocation.Y = this.aabb.Y + 42 + (this.aabb.Y - this.itemLocation.Y); + } + } + else if ((int) objPtr->useStyle == 5) + { + this.itemLocation.X = this.aabb.X + 10 - ((int) this.itemWidth >> 1) - ((int) this.direction << 1); + this.itemLocation.Y = this.aabb.Y + 21 - ((int) this.itemHeight >> 1); + } + } + else if ((int) objPtr->holdStyle == 1) + { + this.itemLocation.X = this.aabb.X + 10 + (((int) this.itemWidth >> 1) + 2) * (int) this.direction; + if ((int) objPtr->type == 282 || (int) objPtr->type == 286) + { + this.itemLocation.X -= (int) this.direction << 1; + this.itemLocation.Y += 4; + } + this.itemLocation.Y = this.aabb.Y + 24; + this.itemRotation = 0.0f; + if ((int) this.gravDir == -1) + { + this.itemRotation = -this.itemRotation; + this.itemLocation.Y = this.aabb.Y + 42 + (this.aabb.Y - this.itemLocation.Y); + } + } + else if ((int) objPtr->holdStyle == 2) + { + this.itemLocation.X = this.aabb.X + 10 + 6 * (int) this.direction; + this.itemLocation.Y = this.aabb.Y + 16; + this.itemRotation = -0.79f * (float) this.direction; + if ((int) this.gravDir == -1) + { + this.itemRotation = -this.itemRotation; + this.itemLocation.Y = this.aabb.Y + 42 + (this.aabb.Y - this.itemLocation.Y); + } + } + else if ((int) objPtr->holdStyle == 3) + { + this.itemLocation.X = this.aabb.X + 10 - ((int) this.itemWidth >> 1) - ((int) this.direction << 1); + this.itemLocation.Y = this.aabb.Y + 21 - ((int) this.itemHeight >> 1); + this.itemRotation = 0.0f; + } + if (((int) objPtr->type == 8 || (int) objPtr->type == 523 || (int) objPtr->type >= 427 && (int) objPtr->type <= 433) && !this.wet) + { + int num2 = 0; + if ((int) objPtr->type == 523) + num2 = 8; + else if ((int) objPtr->type >= 427) + num2 = (int) objPtr->type - 426; + Vector3 rgb = num2 != 1 ? (num2 != 2 ? (num2 != 3 ? (num2 != 4 ? (num2 != 5 ? (num2 != 6 ? (num2 != 7 ? (num2 != 8 ? new Vector3(1f, 0.95f, 0.8f) : new Vector3(0.85f, 1f, 0.7f)) : new Vector3((float) (0.5 * (double) Main.demonTorch + 1.0 * (1.0 - (double) Main.demonTorch)), 0.3f, Main.demonTorch + (float) (0.5 * (1.0 - (double) Main.demonTorch)))) : new Vector3(0.9f, 0.9f, 0.0f)) : new Vector3(1.3f, 1.3f, 1.3f)) : new Vector3(0.9f, 0.0f, 0.9f)) : new Vector3(0.0f, 1f, 0.1f)) : new Vector3(1f, 0.1f, 0.1f)) : new Vector3(0.0f, 0.1f, 1.3f); + int num3 = num2; + int Type; + switch (num3) + { + case 0: + Type = 6; + break; + case 8: + Type = 75; + break; + default: + Type = 58 + num3; + break; + } + int upperBound = 20; + if ((int) this.itemAnimation > 0) + upperBound = 7; + if ((int) this.direction == -1) + { + if (Main.rand.Next(upperBound) == 0) + Main.dust.NewDust(this.itemLocation.X - 16, this.itemLocation.Y - 14 * (int) this.gravDir, 4, 4, Type, 0.0, 0.0, 100, new Color(), 1.0); + Lighting.addLight((int) ((double) (this.itemLocation.X - 12) + (double) this.velocity.X) >> 4, (int) ((double) (this.itemLocation.Y - 14) + (double) this.velocity.Y) >> 4, rgb); + } + else + { + if (Main.rand.Next(upperBound) == 0) + Main.dust.NewDust(this.itemLocation.X + 6, this.itemLocation.Y - 14 * (int) this.gravDir, 4, 4, Type, 0.0, 0.0, 100, new Color(), 1.0); + Lighting.addLight((int) ((double) (this.itemLocation.X + 12) + (double) this.velocity.X) >> 4, (int) ((double) (this.itemLocation.Y - 14) + (double) this.velocity.Y) >> 4, rgb); + } + } + if ((int) objPtr->type == 105 && !this.wet) + { + int upperBound = 20; + if ((int) this.itemAnimation > 0) + upperBound = 7; + if ((int) this.direction == -1) + { + if (Main.rand.Next(upperBound) == 0) + Main.dust.NewDust(this.itemLocation.X - 12, this.itemLocation.Y - 20 * (int) this.gravDir, 4, 4, 6, 0.0, 0.0, 100, new Color(), 1.0); + Lighting.addLight((int) ((double) (this.itemLocation.X - 16) + (double) this.velocity.X) >> 4, this.itemLocation.Y - 14 >> 4, new Vector3(1f, 0.95f, 0.8f)); + } + else + { + if (Main.rand.Next(upperBound) == 0) + Main.dust.NewDust(this.itemLocation.X + 4, this.itemLocation.Y - 20 * (int) this.gravDir, 4, 4, 6, 0.0, 0.0, 100, new Color(), 1.0); + Lighting.addLight((int) ((double) (this.itemLocation.X + 6) + (double) this.velocity.X) >> 4, this.itemLocation.Y - 14 >> 4, new Vector3(1f, 0.95f, 0.8f)); + } + } + else if ((int) objPtr->type == 148 && !this.wet) + { + int upperBound = 10; + if ((int) this.itemAnimation > 0) + upperBound = 7; + if ((int) this.direction == -1) + { + if (Main.rand.Next(upperBound) == 0) + Main.dust.NewDust(this.itemLocation.X - 12, this.itemLocation.Y - 20 * (int) this.gravDir, 4, 4, 29, 0.0, 0.0, 100, new Color(), 1.0); + Lighting.addLight((int) ((double) (this.itemLocation.X - 16) + (double) this.velocity.X) >> 4, this.itemLocation.Y - 14 >> 4, new Vector3(0.3f, 0.3f, 0.75f)); + } + else + { + if (Main.rand.Next(upperBound) == 0) + Main.dust.NewDust(this.itemLocation.X + 4, this.itemLocation.Y - 20 * (int) this.gravDir, 4, 4, 29, 0.0, 0.0, 100, new Color(), 1.0); + Lighting.addLight((int) ((double) (this.itemLocation.X + 6) + (double) this.velocity.X) >> 4, this.itemLocation.Y - 14 >> 4, new Vector3(0.3f, 0.3f, 0.75f)); + } + } + if ((int) objPtr->type == 282) + { + if ((int) this.direction == -1) + Lighting.addLight((int) ((double) (this.itemLocation.X - 16) + (double) this.velocity.X) >> 4, this.itemLocation.Y - 14 >> 4, new Vector3(0.7f, 1f, 0.8f)); + else + Lighting.addLight((int) ((double) (this.itemLocation.X + 6) + (double) this.velocity.X) >> 4, this.itemLocation.Y - 14 >> 4, new Vector3(0.7f, 1f, 0.8f)); + } + else if ((int) objPtr->type == 286) + { + if ((int) this.direction == -1) + Lighting.addLight((int) ((double) (this.itemLocation.X - 16) + (double) this.velocity.X) >> 4, this.itemLocation.Y - 14 >> 4, new Vector3(0.7f, 0.8f, 1f)); + else + Lighting.addLight((int) ((double) (this.itemLocation.X + 6) + (double) this.velocity.X) >> 4, this.itemLocation.Y - 14 >> 4, new Vector3(0.7f, 0.8f, 1f)); + } + this.releaseUseItem = !this.controlUseItem; + if ((int) this.itemTime > 0) + --this.itemTime; + if (this.isLocal()) + { + if ((int) objPtr->shoot > 0 && (int) this.itemAnimation > 0 && (int) this.itemTime == 0) + { + int Type1 = (int) objPtr->shoot; + float num2 = objPtr->shootSpeed; + if (objPtr->melee && Type1 != 25 && (Type1 != 26 && Type1 != 35)) + num2 /= this.meleeSpeed; + if (Type1 == 13 || Type1 == 32) + { + this.grappling[0] = (short) -1; + this.grapCount = (byte) 0; + for (int index = 0; index < 512; ++index) + { + if ((int) Main.projectile[index].type == 13 && (int) Main.projectile[index].active != 0 && (int) Main.projectile[index].owner == i) + Main.projectile[index].Kill(); + } + } + int Damage = num1; + float KnockBack = objPtr->knockBack; + bool flag = false; + if ((int) objPtr->useAmmo > 0) + { + int index1 = -1; + for (int index2 = 47; index2 >= 44; --index2) + { + if ((int) this.inventory[index2].ammo == (int) objPtr->useAmmo && (int) this.inventory[index2].stack > 0) + { + index1 = index2; + flag = true; + break; + } + } + if (!flag) + { + int num3 = int.MaxValue; + for (int index2 = 39; index2 >= 0; --index2) + { + if ((int) this.inventory[index2].ammo == (int) objPtr->useAmmo && (int) this.inventory[index2].stack > 0 && num3 > (int) this.inventory[index2].type) + { + num3 = (int) this.inventory[index2].type; + index1 = index2; + flag = true; + } + } + } + if (flag) + { + if ((int) this.inventory[index1].shoot > 0) + Type1 = (int) this.inventory[index1].shoot; + if (Type1 == 42) + { + if ((int) this.inventory[index1].type == 370) + { + Type1 = 65; + Damage += 5; + } + else if ((int) this.inventory[index1].type == 408) + { + Type1 = 68; + Damage += 5; + } + } + num2 += this.inventory[index1].shootSpeed; + if (this.inventory[index1].ranged) + Damage += (int) ((double) this.inventory[index1].damage * (double) this.rangedDamage); + else + Damage += (int) this.inventory[index1].damage; + if ((int) objPtr->useAmmo == 1 && this.archery) + { + if ((double) num2 < 20.0) + { + num2 *= 1.2f; + if ((double) num2 > 20.0) + num2 = 20f; + } + Damage += Damage / 5; + } + KnockBack += this.inventory[index1].knockBack; + if (((int) objPtr->type != 98 || Main.rand.Next(3) != 0) && ((int) objPtr->type != 533 || Main.rand.Next(2) != 0) && (((int) objPtr->type != 434 || (int) this.itemAnimation >= (int) objPtr->useAnimation - 2) && Main.rand.Next(100) >= (int) this.freeAmmoChance) && (Type1 != 85 || (int) this.itemAnimation >= (int) this.itemAnimationMax - 6) && (int) --this.inventory[index1].stack <= 0) + this.inventory[index1].Init(); + } + } + else + flag = true; + if (Type1 == 72) + { + int num3 = Main.rand.Next(3); + if (num3 != 0) + Type1 = num3 + 85; + } + else if (Type1 == 73) + { + for (int index = 0; index < 512; ++index) + { + if ((int) Main.projectile[index].active != 0 && (int) Main.projectile[index].owner == i) + { + if ((int) Main.projectile[index].type == 73) + Type1 = 74; + else if ((int) Main.projectile[index].type == 74) + { + flag = false; + break; + } + } + } + } + if (flag) + { + if (this.kbGlove && objPtr->mech) + KnockBack *= 1.7f; + if ((int) objPtr->type == 120) + { + if (Type1 == 1) + Type1 = 2; + } + else if ((int) objPtr->type == 615) + Type1 = 113; + else if ((int) objPtr->type == 617) + Type1 = 114; + this.itemTime = objPtr->useTime; + this.direction = (int) this.ui.mouseX + this.view.screenPosition.X > this.aabb.X + 10 ? (sbyte) 1 : (sbyte) -1; + Vector2 vector2 = new Vector2(this.position.X + 10f, this.position.Y + 21f); + if (Type1 == 9) + { + vector2.X += (float) (Main.rand.Next(601) * (int) -this.direction); + vector2.Y += (float) (-300 - Main.rand.Next(100)); + KnockBack = 0.0f; + } + else if (Type1 == 51) + vector2.Y -= (float) (6 * (int) this.gravDir); + float num3 = (float) ((int) this.ui.mouseX + this.view.screenPosition.X) - vector2.X; + float num4 = (float) ((int) this.ui.mouseY + this.view.screenPosition.Y) - vector2.Y; + float num5 = (float) Math.Sqrt((double) num3 * (double) num3 + (double) num4 * (double) num4); + float num6 = num5; + float num7 = num2 / num5; + float SpeedX1 = num3 * num7; + float SpeedY1 = num4 * num7; + if (Type1 == 12) + { + vector2.X += SpeedX1 * 3f; + vector2.Y += SpeedY1 * 3f; + } + else if (Type1 == 17) + { + vector2.X = (float) ((int) this.ui.mouseX + this.view.screenPosition.X); + vector2.Y = (float) ((int) this.ui.mouseY + this.view.screenPosition.Y); + } + if ((int) objPtr->useStyle == 5) + { + this.itemRotation = (float) Math.Atan2((double) SpeedY1 * (double) this.direction, (double) SpeedX1 * (double) this.direction); + NetMessage.CreateMessage1(13, (int) this.whoAmI); + NetMessage.SendMessage(); + NetMessage.CreateMessage1(41, (int) this.whoAmI); + NetMessage.SendMessage(); + } + if (Type1 == 76) + { + int Type2 = Type1 + Main.rand.Next(3); + float num8 = num6 / 270f; + if ((double) num8 > 1.0) + num8 = 1f; + float num9 = SpeedX1 + (float) Main.rand.Next(-40, 41) * 0.01f; + float num10 = SpeedY1 + (float) Main.rand.Next(-40, 41) * 0.01f; + float SpeedX2 = num9 * (num8 + 0.25f); + float SpeedY2 = num10 * (num8 + 0.25f); + int number = Projectile.NewProjectile(vector2.X, vector2.Y, SpeedX2, SpeedY2, Type2, Damage, KnockBack, i, false); + if (number >= 0) + { + Main.projectile[number].ai1 = 1; + float num11 = (float) ((double) num8 * 2.0 - 1.0); + if ((double) num11 < -1.0) + num11 = -1f; + else if ((double) num11 > 1.0) + num11 = 1f; + Main.projectile[number].ai0 = num11; + NetMessage.SendProjectile(number, SendDataOptions.Reliable); + } + } + else if ((int) objPtr->type == 98 || (int) objPtr->type == 533) + { + float SpeedX2 = SpeedX1 + (float) Main.rand.Next(-40, 41) * 0.01f; + float SpeedY2 = SpeedY1 + (float) Main.rand.Next(-40, 41) * 0.01f; + Projectile.NewProjectile(vector2.X, vector2.Y, SpeedX2, SpeedY2, Type1, Damage, KnockBack, i, true); + } + else if ((int) objPtr->type == 518) + { + float num8 = SpeedX1; + float num9 = SpeedY1; + float SpeedX2 = num8 + (float) Main.rand.Next(-40, 41) * 0.04f; + float SpeedY2 = num9 + (float) Main.rand.Next(-40, 41) * 0.04f; + Projectile.NewProjectile(vector2.X, vector2.Y, SpeedX2, SpeedY2, Type1, Damage, KnockBack, i, true); + } + else if ((int) objPtr->type == 534) + { + for (int index = 0; index < 4; ++index) + { + float num8 = SpeedX1; + float num9 = SpeedY1; + float SpeedX2 = num8 + (float) Main.rand.Next(-40, 41) * 0.05f; + float SpeedY2 = num9 + (float) Main.rand.Next(-40, 41) * 0.05f; + Projectile.NewProjectile(vector2.X, vector2.Y, SpeedX2, SpeedY2, Type1, Damage, KnockBack, i, true); + } + } + else if ((int) objPtr->type == 434) + { + float SpeedX2 = SpeedX1; + float SpeedY2 = SpeedY1; + if ((int) this.itemAnimation < 5) + { + float num8 = SpeedX2 + (float) Main.rand.Next(-40, 41) * 0.01f; + float num9 = SpeedY2 + (float) Main.rand.Next(-40, 41) * 0.01f; + SpeedX2 = num8 * 1.1f; + SpeedY2 = num9 * 1.1f; + } + else if ((int) this.itemAnimation < 10) + { + float num8 = SpeedX2 + (float) Main.rand.Next(-20, 21) * 0.01f; + float num9 = SpeedY2 + (float) Main.rand.Next(-20, 21) * 0.01f; + SpeedX2 = num8 * 1.05f; + SpeedY2 = num9 * 1.05f; + } + Projectile.NewProjectile(vector2.X, vector2.Y, SpeedX2, SpeedY2, Type1, Damage, KnockBack, i, true); + } + else if ((int) objPtr->buffType != 40) + { + int index = Projectile.NewProjectile(vector2.X, vector2.Y, SpeedX1, SpeedY1, Type1, Damage, KnockBack, i, true); + if (index >= 0 && Type1 == 80) + { + Main.projectile[index].ai0 = (float) this.tileTargetX; + Main.projectile[index].ai1 = (int) this.tileTargetY; + } + } + } + else if ((int) objPtr->useStyle == 5) + { + this.itemRotation = 0.0f; + NetMessage.CreateMessage1(41, (int) this.whoAmI); + NetMessage.SendMessage(); + } + } + if (this.isLocal() && ((int) objPtr->type == 509 || (int) objPtr->type == 510) && ((int) this.itemAnimation > 0 && (int) this.itemTime == 0 && this.controlUseItem)) + { + int i1 = (int) this.tileTargetX; + int j = (int) this.tileTargetY; + if ((int) objPtr->type == 509) + { + int index1 = -1; + for (int index2 = 0; index2 < 48; ++index2) + { + if ((int) this.inventory[index2].stack > 0 && (int) this.inventory[index2].type == 530) + { + index1 = index2; + break; + } + } + if (index1 >= 0 && WorldGen.PlaceWire(i1, j)) + { + if ((int) ++this.ui.totalWires == 100) + this.ui.SetTriggerState(Trigger.PlacedLotsOfWires); + --this.inventory[index1].stack; + if ((int) this.inventory[index1].stack <= 0) + this.inventory[index1].Init(); + this.itemTime = objPtr->useTime; + NetMessage.CreateMessage5(17, 5, (int) this.tileTargetX, (int) this.tileTargetY, 0, 0); + NetMessage.SendMessage(); + } + } + else if (WorldGen.KillWire(i1, j)) + { + if (this.ui.totalWires > 0U) + --this.ui.totalWires; + this.itemTime = objPtr->useTime; + NetMessage.CreateMessage5(17, 6, (int) this.tileTargetX, (int) this.tileTargetY, 0, 0); + NetMessage.SendMessage(); + } + } + if ((int) this.itemAnimation > 0 && (int) this.itemTime == 0 && ((int) objPtr->type == 507 || (int) objPtr->type == 508)) + { + this.itemTime = objPtr->useTime; + Vector2 vector2 = new Vector2(this.position.X + 10f, this.position.Y + 21f); + float num2 = (float) ((int) this.ui.mouseX + this.view.screenPosition.X) - vector2.X; + float num3 = (float) ((int) this.ui.mouseY + this.view.screenPosition.Y) - vector2.Y; + float num4 = (float) Math.Sqrt((double) num2 * (double) num2 + (double) num3 * (double) num3) / 270f; + if ((double) num4 > 1.0) + num4 = 1f; + float num5 = (float) ((double) num4 * 2.0 - 1.0); + if ((double) num5 < -1.0) + num5 = -1f; + if ((double) num5 > 1.0) + num5 = 1f; + Main.harpNote = num5; + Main.PlaySound(2, this.aabb.X, this.aabb.Y, (int) objPtr->type == 507 ? 35 : 26); + NetMessage.CreateMessage1(58, (int) this.whoAmI); + NetMessage.SendMessage(); + } + if ((int) objPtr->type >= 205 && (int) objPtr->type <= 207 && ((int) this.itemTime == 0 && (int) this.itemAnimation > 0) && this.controlUseItem) + { + if ((int) objPtr->type == 205) + { + int num2 = (int) Main.tile[(int) this.tileTargetX, (int) this.tileTargetY].lava; + int num3 = 0; + for (int index1 = (int) this.tileTargetX - 1; index1 <= (int) this.tileTargetX + 1; ++index1) + { + for (int index2 = (int) this.tileTargetY - 1; index2 <= (int) this.tileTargetY + 1; ++index2) + { + if ((int) Main.tile[index1, index2].lava == num2) + num3 += (int) Main.tile[index1, index2].liquid; + } + } + if ((int) Main.tile[(int) this.tileTargetX, (int) this.tileTargetY].liquid > 0 && num3 > 100) + { + int num4 = (int) Main.tile[(int) this.tileTargetX, (int) this.tileTargetY].lava; + if ((int) Main.tile[(int) this.tileTargetX, (int) this.tileTargetY].lava == 0) + objPtr->SetDefaults(206, 1, false); + else + objPtr->SetDefaults(207, 1, false); + Main.PlaySound(19, this.aabb.X, this.aabb.Y, 1); + this.itemTime = objPtr->useTime; + int num5 = (int) Main.tile[(int) this.tileTargetX, (int) this.tileTargetY].liquid; + Main.tile[(int) this.tileTargetX, (int) this.tileTargetY].liquid = (byte) 0; + Main.tile[(int) this.tileTargetX, (int) this.tileTargetY].lava = (byte) 0; + WorldGen.SquareTileFrame((int) this.tileTargetX, (int) this.tileTargetY, 0); + if (Main.netMode == 1) + NetMessage.sendWater((int) this.tileTargetX, (int) this.tileTargetY); + else + Liquid.AddWater((int) this.tileTargetX, (int) this.tileTargetY); + for (int index1 = (int) this.tileTargetX - 1; index1 <= (int) this.tileTargetX + 1; ++index1) + { + for (int index2 = (int) this.tileTargetY - 1; index2 <= (int) this.tileTargetY + 1; ++index2) + { + if (num5 < 256 && (int) Main.tile[index1, index2].lava == num2) + { + int num6 = (int) Main.tile[index1, index2].liquid; + if (num6 + num5 > (int) byte.MaxValue) + num6 = (int) byte.MaxValue - num5; + num5 += num6; + Main.tile[index1, index2].liquid -= (byte) num6; + Main.tile[index1, index2].lava = (int) Main.tile[index1, index2].liquid == 0 ? (byte) 0 : (byte) num4; + WorldGen.SquareTileFrame(index1, index2, 0); + if (Main.netMode == 1) + NetMessage.sendWater(index1, index2); + else + Liquid.AddWater(index1, index2); + } + } + } + } + } + else if ((int) Main.tile[(int) this.tileTargetX, (int) this.tileTargetY].liquid < 200 && ((int) Main.tile[(int) this.tileTargetX, (int) this.tileTargetY].active == 0 || !Main.tileSolidNotSolidTop[(int) Main.tile[(int) this.tileTargetX, (int) this.tileTargetY].type])) + { + if ((int) objPtr->type == 207) + { + if ((int) Main.tile[(int) this.tileTargetX, (int) this.tileTargetY].liquid == 0 || (int) Main.tile[(int) this.tileTargetX, (int) this.tileTargetY].lava != 0) + { + Main.PlaySound(19, this.aabb.X, this.aabb.Y, 1); + Main.tile[(int) this.tileTargetX, (int) this.tileTargetY].lava = (byte) 32; + Main.tile[(int) this.tileTargetX, (int) this.tileTargetY].liquid = byte.MaxValue; + WorldGen.SquareTileFrame((int) this.tileTargetX, (int) this.tileTargetY, -1); + objPtr->SetDefaults(205, 1, false); + this.itemTime = objPtr->useTime; + NetMessage.sendWater((int) this.tileTargetX, (int) this.tileTargetY); + } + } + else if ((int) Main.tile[(int) this.tileTargetX, (int) this.tileTargetY].liquid == 0 || (int) Main.tile[(int) this.tileTargetX, (int) this.tileTargetY].lava == 0) + { + Main.PlaySound(19, this.aabb.X, this.aabb.Y, 1); + Main.tile[(int) this.tileTargetX, (int) this.tileTargetY].lava = (byte) 0; + Main.tile[(int) this.tileTargetX, (int) this.tileTargetY].liquid = byte.MaxValue; + WorldGen.SquareTileFrame((int) this.tileTargetX, (int) this.tileTargetY, -1); + objPtr->SetDefaults(205, 1, false); + this.itemTime = objPtr->useTime; + NetMessage.sendWater((int) this.tileTargetX, (int) this.tileTargetY); + } + } + } + if (!this.channel) + this.toolTime = (short) this.itemTime; + else if ((int) --this.toolTime < 0) + this.toolTime = (int) objPtr->pick <= 0 ? (short) ((double) objPtr->useTime * (double) this.pickSpeed) : (short) objPtr->useTime; + if ((int) objPtr->pick > 0 || (int) objPtr->axe > 0 || (int) objPtr->hammer > 0) + { + bool flag = true; + if ((int) Main.tile[(int) this.tileTargetX, (int) this.tileTargetY].active != 0) + { + int index = (int) Main.tile[(int) this.tileTargetX, (int) this.tileTargetY].type; + if ((int) objPtr->pick > 0 && !Main.tileAxe[index] && !Main.tileHammer[index] || ((int) objPtr->axe > 0 && Main.tileAxe[index] || (int) objPtr->hammer > 0 && Main.tileHammer[index])) + flag = false; + if ((int) this.toolTime == 0 && (int) this.itemAnimation > 0 && this.controlUseItem) + { + if ((int) this.hitTileX != (int) this.tileTargetX || (int) this.hitTileY != (int) this.tileTargetY) + { + this.hitTile = (short) 0; + this.hitTileX = this.tileTargetX; + this.hitTileY = this.tileTargetY; + } + if (Main.tileNoFail[index]) + this.hitTile = (short) 100; + if (index != 27) + { + if (Main.tileHammer[index]) + { + flag = false; + if (index == 48) + this.hitTile += (short) ((int) objPtr->hammer >> 1); + else if (index == 129) + this.hitTile += (short) ((int) objPtr->hammer << 1); + else + this.hitTile += (short) objPtr->hammer; + if ((int) this.tileTargetY > Main.rockLayer && index == 77 && (int) objPtr->hammer < 60) + this.hitTile = (short) 0; + if ((int) objPtr->hammer > 0) + { + if (index == 26 && ((int) objPtr->hammer < 80 || !Main.hardMode)) + { + this.hitTile = (short) 0; + this.Hurt((int) this.statLife >> 1, (int) -this.direction, false, false, Lang.deathMsg(-1, 0, 0, -1), false); + } + if ((int) this.hitTile >= 100) + { + if (Main.netMode == 1 && index == 21) + { + WorldGen.KillTile((int) this.tileTargetX, (int) this.tileTargetY, true, false, false); + NetMessage.CreateMessage5(17, 0, (int) this.tileTargetX, (int) this.tileTargetY, 1, 0); + NetMessage.SendMessage(); + NetMessage.CreateMessage2(34, (int) this.tileTargetX, (int) this.tileTargetY); + } + else + { + this.hitTile = (short) 0; + WorldGen.KillTile((int) this.tileTargetX, (int) this.tileTargetY); + NetMessage.CreateMessage5(17, 0, (int) this.tileTargetX, (int) this.tileTargetY, 0, 0); + } + } + else + { + WorldGen.KillTile((int) this.tileTargetX, (int) this.tileTargetY, true, false, false); + NetMessage.CreateMessage5(17, 0, (int) this.tileTargetX, (int) this.tileTargetY, 1, 0); + } + NetMessage.SendMessage(); + this.itemTime = objPtr->useTime; + } + } + else if (Main.tileAxe[index]) + { + if ((int) objPtr->axe > 0) + { + if (index == 30 || index == 124) + this.hitTile += (short) ((int) objPtr->axe * 5); + else if (index == 80) + this.hitTile += (short) ((int) objPtr->axe * 3); + else + this.hitTile += (short) objPtr->axe; + if ((int) this.hitTile >= 100) + { + this.hitTile = (short) 0; + if (index == 5) + { + ++this.ui.totalChops; + WorldGen.woodSpawned = 0U; + } + ++this.ui.totalAxed; + WorldGen.KillTile((int) this.tileTargetX, (int) this.tileTargetY); + NetMessage.CreateMessage5(17, 0, (int) this.tileTargetX, (int) this.tileTargetY, 0, 0); + NetMessage.SendMessage(); + if (index == 5) + this.ui.Statistics.incWoodStat(WorldGen.woodSpawned); + } + else + { + WorldGen.KillTile((int) this.tileTargetX, (int) this.tileTargetY, true, false, false); + NetMessage.CreateMessage5(17, 0, (int) this.tileTargetX, (int) this.tileTargetY, 1, 0); + NetMessage.SendMessage(); + } + this.itemTime = objPtr->useTime; + } + } + else if ((int) objPtr->pick > 0) + { + if (index == 25 || index == 37 || (index == 41 || index == 43) || (index == 44 || index == 58 || (index == 107 || index == 117))) + { + this.hitTile += (short) ((int) objPtr->pick >> 1); + if (index == 41 || index == 43 || index == 44) + { + if ((double) this.tileTargetX < (double) Main.maxTilesX * 0.25 || (double) this.tileTargetX > (double) Main.maxTilesX * 0.75) + this.hitTile = (short) 0; + } + else if (index == 25 || index == 58 || index == 117) + { + if ((int) objPtr->pick < 65) + this.hitTile = (short) 0; + } + else if (index == 37 && (int) objPtr->pick < 55) + this.hitTile = (short) 0; + } + else if (index == 108) + this.hitTile += (short) ((int) objPtr->pick / 3); + else if (index == 111) + this.hitTile += (short) ((int) objPtr->pick >> 2); + else if (index == 0 || index == 40 || (index == 53 || index == 57) || (index == 59 || index == 123)) + this.hitTile += (short) ((int) objPtr->pick << 1); + else + this.hitTile += (short) objPtr->pick; + if (index == 22 && (int) this.tileTargetY > Main.worldSurface && (int) objPtr->pick < 55) + this.hitTile = (short) 0; + else if (index == 56 && (int) objPtr->pick < 65) + this.hitTile = (short) 0; + else if (index == 107 && (int) objPtr->pick < 100) + this.hitTile = (short) 0; + else if (index == 108 && (int) objPtr->pick < 110) + this.hitTile = (short) 0; + else if (index == 111 && (int) objPtr->pick < 120) + this.hitTile = (short) 0; + if ((int) this.hitTile >= 100 && (index == 2 || index == 23 || (index == 60 || index == 70) || index == 109)) + this.hitTile = (short) 0; + if ((int) this.hitTile >= 100) + { + switch (index) + { + case 123: + case 147: + case 112: + case 116: + case 0: + case 1: + case 53: + case 57: + case 58: + case 59: + this.ui.Statistics.incStat(StatisticEntry.Soils); + break; + case 107: + case 108: + case 111: + case 6: + case 8: + case 9: + case 22: + case 56: + this.ui.Statistics.incStat(StatisticEntry.Ore); + break; + case 7: + ++this.ui.totalCopper; + this.ui.Statistics.incStat(StatisticEntry.Ore); + break; + case 63: + case 64: + case 65: + case 66: + case 67: + case 68: + this.ui.Statistics.incStat(StatisticEntry.Gems); + break; + } + if ((int) ++this.ui.totalPicked == 10000) + this.ui.SetTriggerState(Trigger.RemovedLotsOfTiles); + this.hitTile = (short) 0; + WorldGen.KillTile((int) this.tileTargetX, (int) this.tileTargetY); + NetMessage.CreateMessage5(17, 0, (int) this.tileTargetX, (int) this.tileTargetY, 0, 0); + NetMessage.SendMessage(); + } + else + { + WorldGen.KillTile((int) this.tileTargetX, (int) this.tileTargetY, true, false, false); + NetMessage.CreateMessage5(17, 0, (int) this.tileTargetX, (int) this.tileTargetY, 1, 0); + NetMessage.SendMessage(); + } + this.itemTime = (byte) ((double) objPtr->useTime * (double) this.pickSpeed); + } + } + } + } + int index1 = (int) this.tileTargetX; + int index2 = (int) this.tileTargetY; + if (((int) Main.tile[index1, index2].wall == 0 || !WorldGen.CanKillWall(index1, index2)) && (int) Main.tile[index1, index2].active == 0) + { + int num2 = -1; + if (((int) this.ui.mouseX + this.view.screenPosition.X & 15) < 8) + num2 = 0; + int num3 = -1; + if (((int) this.ui.mouseY + this.view.screenPosition.Y & 15) < 8) + num3 = 0; + for (int index3 = (int) this.tileTargetX + num2; index3 <= (int) this.tileTargetX + num2 + 1; ++index3) + { + for (int index4 = (int) this.tileTargetY + num3; index4 <= (int) this.tileTargetY + num3 + 1; ++index4) + { + index1 = index3; + index2 = index4; + if ((int) Main.tile[index1, index2].wall > 0 && WorldGen.CanKillWall(index1, index2)) + goto label_487; + } + } + } +label_487: + if (flag && (int) Main.tile[index1, index2].wall > 0 && ((int) this.toolTime == 0 && (int) this.itemAnimation > 0) && (this.controlUseItem && (int) objPtr->hammer > 0 && WorldGen.CanKillWall(index1, index2))) + { + if ((int) this.hitTileX != index1 || (int) this.hitTileY != index2) + { + this.hitTile = (short) 0; + this.hitTileX = (short) index1; + this.hitTileY = (short) index2; + } + this.hitTile += (short) ((int) objPtr->hammer + ((int) objPtr->hammer >> 1)); + if ((int) this.hitTile >= 100) + { + this.hitTile = (short) 0; + WorldGen.KillWall(index1, index2, false); + NetMessage.CreateMessage5(17, 2, index1, index2, 0, 0); + } + else + { + WorldGen.KillWall(index1, index2, true); + NetMessage.CreateMessage5(17, 2, index1, index2, 1, 0); + } + NetMessage.SendMessage(); + this.itemTime = (byte) ((uint) objPtr->useTime >> 1); + } + } + if ((int) objPtr->type == 29) + { + if ((int) this.itemTime == 0 && (int) this.itemAnimation > 0 && (int) this.statLifeMax < 400) + { + this.itemTime = objPtr->useTime; + this.statLifeMax += (short) 20; + this.statLife += (short) 20; + this.HealEffect(20); + } + if ((int) this.statManaMax == 200 && (int) this.statLifeMax == 400) + this.ui.SetTriggerState(Trigger.MaxHealthAndMana); + } + else if ((int) objPtr->type == 109) + { + if ((int) this.itemTime == 0 && (int) this.itemAnimation > 0 && (int) this.statManaMax < 200) + { + this.itemTime = objPtr->useTime; + this.statManaMax += (short) 20; + this.statMana += (short) 20; + this.ManaEffect(20); + } + if ((int) this.statManaMax == 200 && (int) this.statLifeMax == 400) + this.ui.SetTriggerState(Trigger.MaxHealthAndMana); + } + else + this.PlaceThing(); + } + if ((int) objPtr->damage >= 0 && (int) objPtr->type > 0 && (!objPtr->noMelee && (int) this.itemAnimation > 0)) + { + bool flag1 = false; + Rectangle rectangle = new Rectangle(this.itemLocation.X, this.itemLocation.Y, (int) ((double) this.itemWidth * (double) objPtr->scale), (int) ((double) this.itemHeight * (double) objPtr->scale)); + if ((int) this.direction == -1) + rectangle.X -= rectangle.Width; + if ((int) this.gravDir == 1) + rectangle.Y -= rectangle.Height; + if ((int) objPtr->useStyle == 1) + { + if ((int) this.itemAnimation < (int) this.itemAnimationMax / 3) + { + if ((int) this.direction == -1) + rectangle.X -= (int) ((double) rectangle.Width * 1.4 - (double) rectangle.Width); + rectangle.Width = (int) ((double) rectangle.Width * 1.4); + rectangle.Y += (int) ((double) rectangle.Height * 0.5 * (double) this.gravDir); + rectangle.Height = (int) ((double) rectangle.Height * 1.1); + } + else if ((int) this.itemAnimation >= ((int) this.itemAnimationMax << 1) / 3) + { + if ((int) this.direction == 1) + rectangle.X -= (int) ((double) rectangle.Width * 1.2); + rectangle.Width = rectangle.Width * 2; + rectangle.Y -= (int) (((double) rectangle.Height * 1.4 - (double) rectangle.Height) * (double) this.gravDir); + rectangle.Height = (int) ((double) rectangle.Height * 1.4); + } + } + else if ((int) objPtr->useStyle == 3) + { + if ((int) this.itemAnimation > ((int) this.itemAnimationMax << 1) / 3) + { + flag1 = true; + } + else + { + if ((int) this.direction == -1) + rectangle.X -= (int) ((double) rectangle.Width * 1.4 - (double) rectangle.Width); + rectangle.Width = (int) ((double) rectangle.Width * 1.4); + rectangle.Y += (int) ((double) rectangle.Height * 0.6); + rectangle.Height = (int) ((double) rectangle.Height * 0.6); + } + } + if (!flag1) + { + if ((int) objPtr->type == 44 || (int) objPtr->type == 45 || ((int) objPtr->type == 46 || (int) objPtr->type == 103) || (int) objPtr->type == 104) + { + if (Main.rand.Next(18) == 0) + Main.dust.NewDust(rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height, 14, (double) ((int) this.direction * 2), 0.0, 150, new Color(), 1.29999995231628); + } + else if ((int) objPtr->type == 273) + { + if (Main.rand.Next(6) == 0) + Main.dust.NewDust(rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height, 14, (double) ((int) this.direction * 2), 0.0, 150, new Color(), 1.39999997615814); + Dust* dustPtr = Main.dust.NewDust(rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height, 27, (double) this.velocity.X * 0.200000002980232 + (double) ((int) this.direction * 3), (double) this.velocity.Y * 0.200000002980232, 100, new Color(), 1.20000004768372); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->noGravity = true; + dustPtr->velocity *= 0.5f; + } + } + else if ((int) objPtr->type == 65) + { + if (Main.rand.Next(6) == 0) + Main.dust.NewDust(rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height, 58, 0.0, 0.0, 150, new Color(), 1.20000004768372); + if (Main.rand.Next(12) == 0) + Gore.NewGore(new Vector2((float) rectangle.X, (float) rectangle.Y), new Vector2(), Main.rand.Next(16, 18), 1.0); + } + else if ((int) objPtr->type == 190 || (int) objPtr->type == 213) + { + Dust* dustPtr = Main.dust.NewDust(rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height, 40, (double) this.velocity.X * 0.200000002980232 + (double) ((int) this.direction * 3), (double) this.velocity.Y * 0.200000002980232, 0, new Color(), 1.20000004768372); + if ((IntPtr) dustPtr != IntPtr.Zero) + dustPtr->noGravity = true; + } + else if ((int) objPtr->type == 121) + { + Dust* dustPtr = Main.dust.NewDust(rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height, 6, (double) this.velocity.X * 0.200000002980232 + (double) ((int) this.direction * 3), (double) this.velocity.Y * 0.200000002980232, 100, new Color(), 2.5); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->noGravity = true; + dustPtr->velocity.X *= 2f; + dustPtr->velocity.Y *= 2f; + } + } + else if ((int) objPtr->type == 122 || (int) objPtr->type == 217) + { + Dust* dustPtr = Main.dust.NewDust(rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height, 6, (double) this.velocity.X * 0.200000002980232 + (double) ((int) this.direction * 3), (double) this.velocity.Y * 0.200000002980232, 100, new Color(), 1.89999997615814); + if ((IntPtr) dustPtr != IntPtr.Zero) + dustPtr->noGravity = true; + } + else if ((int) objPtr->type == 155) + { + Dust* dustPtr = Main.dust.NewDust(rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height, 29, (double) this.velocity.X * 0.200000002980232 + (double) ((int) this.direction * 3), (double) this.velocity.Y * 0.200000002980232, 100, new Color(), 2.0); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->noGravity = true; + dustPtr->velocity.X *= 0.5f; + dustPtr->velocity.Y *= 0.5f; + } + } + else if ((int) objPtr->type == 367 || (int) objPtr->type == 368) + { + if (Main.rand.Next(4) == 0) + { + Dust* dustPtr = Main.dust.NewDust(rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height, 57, (double) this.velocity.X * 0.200000002980232 + (double) ((int) this.direction * 3), (double) this.velocity.Y * 0.200000002980232, 100, new Color(), 1.10000002384186); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->noGravity = true; + dustPtr->velocity.X *= 0.5f; + dustPtr->velocity.X += (float) ((int) this.direction << 1); + dustPtr->velocity.Y *= 0.5f; + } + } + if (Main.rand.Next(5) == 0) + { + Dust* dustPtr = Main.dust.NewDust(rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height, 43, 0.0, 0.0, 254, new Color(), 0.300000011920929); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.X = 0.0f; + dustPtr->velocity.Y = 0.0f; + } + } + } + else if ((int) objPtr->type >= 198 && (int) objPtr->type <= 203) + Lighting.addLight((int) ((double) (this.itemLocation.X + 6) + (double) this.velocity.X) >> 4, this.itemLocation.Y - 14 >> 4, (int) objPtr->type != 198 ? ((int) objPtr->type != 199 ? ((int) objPtr->type != 200 ? ((int) objPtr->type != 201 ? ((int) objPtr->type != 202 ? new Vector3(0.45f, 0.45f, 0.05f) : new Vector3(0.4f, 0.45f, 0.5f)) : new Vector3(0.4f, 0.05f, 0.5f)) : new Vector3(0.05f, 0.5f, 0.1f)) : new Vector3(0.5f, 0.1f, 0.05f)) : new Vector3(0.05f, 0.25f, 0.6f)); + else if ((int) objPtr->type == 613) + { + Dust* dustPtr = Main.dust.NewDust(rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height, 6, (double) this.velocity.X * 0.200000002980232 + (double) ((int) this.direction * 3), (double) this.velocity.Y * 0.200000002980232, Main.rand.Next(61, 62), new Color(), 2.5); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->noGravity = true; + dustPtr->velocity.X *= 2f; + dustPtr->velocity.Y *= 2f; + } + } + if (this.isLocal()) + { + int dmg = (int) ((double) objPtr->damage * (double) this.meleeDamage); + float knockBack = objPtr->knockBack; + if (this.kbGlove) + knockBack *= 2f; + int num2 = rectangle.X >> 4; + int num3 = (rectangle.X + rectangle.Width >> 4) + 1; + int num4 = rectangle.Y >> 4; + int num5 = (rectangle.Y + rectangle.Height >> 4) + 1; + for (int index1 = num2; index1 < num3; ++index1) + { + for (int index2 = num4; index2 < num5; ++index2) + { + if (Main.tileCut[(int) Main.tile[index1, index2].type] && (int) Main.tile[index1, index2 + 1].type != 78) + { + WorldGen.KillTile(index1, index2); + NetMessage.CreateMessage5(17, 0, index1, index2, 0, 0); + NetMessage.SendMessage(); + } + } + } + for (int npcId = 0; npcId < 196; ++npcId) + { + NPC npc = Main.npc[npcId]; + if ((int) npc.active != 0 && (int) npc.immune[i] == 0 && ((int) this.attackCD == 0 && !npc.dontTakeDamage) && (!npc.friendly || (int) npc.type == 22 && this.killGuide) && (rectangle.Intersects(npc.aabb) && (npc.noTileCollide || Collision.CanHit(ref this.aabb, ref npc.aabb)))) + { + bool flag2 = Main.rand.Next(1, 101) <= (int) this.meleeCrit; + int num6 = Main.DamageVar(dmg); + npc.ApplyWeaponBuff((int) objPtr->type); + npc.StrikeNPC(num6, knockBack, (int) this.direction, flag2, false); + NetMessage.SendNpcHurt(npcId, num6, (double) knockBack, (int) this.direction, flag2); + if ((int) npc.active == 0) + { + this.ui.Statistics.incStat(Statistics.GetStatisticEntryFromNetID(npc.netID)); + if ((int) npc.type == 1) + ++this.ui.totalSlimes; + } + npc.immune[i] = (byte) this.itemAnimation; + this.attackCD = (short) ((int) this.itemAnimationMax / 3); + } + } + if (this.hostile) + { + for (int playerId = 0; playerId < 8; ++playerId) + { + if (playerId != i && (int) Main.player[playerId].active != 0 && (Main.player[playerId].hostile && !Main.player[playerId].immune) && (!Main.player[playerId].dead && ((int) Main.player[i].team == 0 || (int) Main.player[i].team != (int) Main.player[playerId].team)) && (rectangle.Intersects(Main.player[playerId].aabb) && Collision.CanHit(ref this.aabb, ref Main.player[playerId].aabb))) + { + bool flag2 = false; + if (Main.rand.Next(1, 101) <= 10) + flag2 = true; + int num6 = Main.DamageVar(dmg); + Main.player[playerId].ApplyWeaponBuffPvP((int) objPtr->type); + Main.player[playerId].Hurt(num6, (int) this.direction, true, false, Lang.deathMsg(-1, 0, 0, -1), flag2); + NetMessage.SendPlayerHurt(playerId, (int) this.direction, num6, true, flag2, Lang.deathMsg((int) this.whoAmI, 0, 0, -1)); + this.attackCD = (short) ((int) this.itemAnimationMax / 3); + } + } + } + } + } + } + if ((int) this.itemTime == 0 && (int) this.itemAnimation > 0) + { + if ((int) objPtr->healLife > 0) + { + this.statLife += objPtr->healLife; + this.itemTime = objPtr->useTime; + if (this.isLocal()) + this.HealEffect((int) objPtr->healLife); + } + if ((int) objPtr->healMana > 0) + { + this.statMana += objPtr->healMana; + this.itemTime = objPtr->useTime; + if (this.isLocal()) + this.ManaEffect((int) objPtr->healMana); + } + if ((int) objPtr->buffType > 0) + { + if (this.isLocal()) + this.AddBuff((int) objPtr->buffType, (int) objPtr->buffTime, true); + this.itemTime = objPtr->useTime; + } + if (this.isLocal()) + { + if ((int) objPtr->type == 361) + { + this.itemTime = objPtr->useTime; + Main.PlaySound(15, this.aabb.X, this.aabb.Y, 0); + if (Main.netMode != 1) + { + if (Main.invasionType == 0) + { + Main.invasionDelay = 0; + Main.StartInvasion(1); + } + } + else + { + NetMessage.CreateMessage2(61, (int) this.whoAmI, -1); + NetMessage.SendMessage(); + } + } + else if ((int) objPtr->type == 602) + { + this.itemTime = objPtr->useTime; + Main.PlaySound(15, this.aabb.X, this.aabb.Y, 0); + if (Main.netMode != 1) + { + if (Main.invasionType == 0) + { + Main.invasionDelay = 0; + Main.StartInvasion(2); + } + } + else + { + NetMessage.CreateMessage2(61, (int) this.whoAmI, -2); + NetMessage.SendMessage(); + } + } + else if ((int) objPtr->type == 43 || (int) objPtr->type == 619 || ((int) objPtr->type == 70 || (int) objPtr->type == 544) || ((int) objPtr->type == 556 || (int) objPtr->type == 557 || (int) objPtr->type == 560)) + { + bool flag = false; + for (int index = 0; index < 196; ++index) + { + if ((int) Main.npc[index].active != 0 && ((int) objPtr->type == 43 && (int) Main.npc[index].type == 4 || (int) objPtr->type == 619 && (int) Main.npc[index].type == 166 || ((int) objPtr->type == 70 && (int) Main.npc[index].type == 13 || (int) objPtr->type == 560 && (int) Main.npc[index].type == 50) || ((int) objPtr->type == 544 && (int) Main.npc[index].type == 125 || (int) objPtr->type == 544 && (int) Main.npc[index].type == 126 || ((int) objPtr->type == 556 && (int) Main.npc[index].type == 134 || (int) objPtr->type == 557 && (int) Main.npc[index].type == 128)))) + { + flag = true; + break; + } + } + if (flag) + this.itemTime = objPtr->useTime; + else if ((int) objPtr->type == 560) + { + this.itemTime = objPtr->useTime; + Main.PlaySound(15, this.aabb.X, this.aabb.Y, 0); + if (Main.netMode != 1) + { + NPC.SpawnOnPlayer(this, 50); + } + else + { + NetMessage.CreateMessage2(61, (int) this.whoAmI, 50); + NetMessage.SendMessage(); + } + } + else if ((int) objPtr->type == 43) + { + if (!Main.gameTime.dayTime) + { + this.itemTime = objPtr->useTime; + Main.PlaySound(15, this.aabb.X, this.aabb.Y, 0); + if (Main.netMode != 1) + { + NPC.SpawnOnPlayer(this, 4); + } + else + { + NetMessage.CreateMessage2(61, (int) this.whoAmI, 4); + NetMessage.SendMessage(); + } + } + } + else if ((int) objPtr->type == 619) + { + if (!Main.gameTime.dayTime && Main.hardMode) + { + this.itemTime = objPtr->useTime; + Main.PlaySound(15, this.aabb.X, this.aabb.Y, 0); + if (Main.netMode != 1) + { + NPC.SpawnOnPlayer(this, 166); + } + else + { + NetMessage.CreateMessage2(61, (int) this.whoAmI, 166); + NetMessage.SendMessage(); + } + } + } + else if ((int) objPtr->type == 70) + { + if (this.zoneEvil) + { + this.itemTime = objPtr->useTime; + Main.PlaySound(15, this.aabb.X, this.aabb.Y, 0); + if (Main.netMode != 1) + { + NPC.SpawnOnPlayer(this, 13); + } + else + { + NetMessage.CreateMessage2(61, (int) this.whoAmI, 13); + NetMessage.SendMessage(); + } + } + } + else if ((int) objPtr->type == 544) + { + if (!Main.gameTime.dayTime) + { + this.itemTime = objPtr->useTime; + Main.PlaySound(15, this.aabb.X, this.aabb.Y, 0); + if (Main.netMode != 1) + { + NPC.SpawnOnPlayer(this, 125); + NPC.SpawnOnPlayer(this, 126); + } + else + { + NetMessage.CreateMessage2(61, (int) this.whoAmI, 125); + NetMessage.SendMessage(); + NetMessage.CreateMessage2(61, (int) this.whoAmI, 126); + NetMessage.SendMessage(); + } + } + } + else if ((int) objPtr->type == 556) + { + if (!Main.gameTime.dayTime) + { + this.itemTime = objPtr->useTime; + Main.PlaySound(15, this.aabb.X, this.aabb.Y, 0); + if (Main.netMode != 1) + { + NPC.SpawnOnPlayer(this, 134); + } + else + { + NetMessage.CreateMessage2(61, (int) this.whoAmI, 134); + NetMessage.SendMessage(); + } + } + } + else if ((int) objPtr->type == 557 && !Main.gameTime.dayTime) + { + this.itemTime = objPtr->useTime; + Main.PlaySound(15, this.aabb.X, this.aabb.Y, 0); + if (Main.netMode != 1) + { + NPC.SpawnOnPlayer(this, (int) sbyte.MaxValue); + } + else + { + NetMessage.CreateMessage2(61, (int) this.whoAmI, (int) sbyte.MaxValue); + NetMessage.SendMessage(); + } + } + } + } + } + if ((int) objPtr->type == 50 && (int) this.itemAnimation > 0) + { + if ((int) this.itemTime == 0) + this.itemTime = objPtr->useTime; + else if ((int) this.itemTime == (int) objPtr->useTime >> 1) + { + for (int index = 0; index < 16; ++index) + Main.dust.NewDust(15, ref this.aabb, (double) this.velocity.X * 0.5, (double) this.velocity.Y * 0.5, 150, new Color(), 1.5); + this.grappling[0] = (short) -1; + this.grapCount = (byte) 0; + for (int index = 0; index < 512; ++index) + { + if ((int) Main.projectile[index].active != 0 && (int) Main.projectile[index].owner == i && (int) Main.projectile[index].aiStyle == 7) + Main.projectile[index].Kill(); + } + this.Spawn(); + for (int index = 0; index < 32; ++index) + Main.dust.NewDust(15, ref this.aabb, 0.0, 0.0, 150, new Color(), 1.5); + } + else if (Main.rand.Next(3) == 0) + Main.dust.NewDust(15, ref this.aabb, 0.0, 0.0, 150, new Color(), 1.10000002384186); + } + if (!this.isLocal()) + return; + if ((int) this.itemTime == (int) objPtr->useTime && objPtr->consumable) + { + bool flag = true; + if (objPtr->ranged && Main.rand.Next(100) < (int) this.freeAmmoChance) + flag = false; + if (flag) + { + if ((int) objPtr->stack > 0) + { + IntPtr num2 = (IntPtr) objPtr; + int num3 = (int) (short) ((int) ((Item*) num2)->stack - 1); + ((Item*) num2)->stack = (short) num3; + } + if ((int) objPtr->stack <= 0) + this.itemTime = (byte) this.itemAnimation; + } + } + if ((int) objPtr->stack <= 0 && (int) this.itemAnimation == 0) + objPtr->Init(); + if ((int) this.selectedItem != 48 || (int) this.itemAnimation == 0) + return; + this.ui.mouseItem = *objPtr; + } + } + + public Color GetImmuneAlpha(Color newColor) + { + if ((int) this.immuneAlpha > 125) + return new Color(); + double num = (double) ((int) byte.MaxValue - (int) this.immuneAlpha) * (1.0 / (double) byte.MaxValue); + if ((double) this.shadow > 0.0) + num *= 1.0 - (double) this.shadow; + return new Color((int) ((double) newColor.R * num), (int) ((double) newColor.G * num), (int) ((double) newColor.B * num), (int) ((double) newColor.A * num)); + } + + public Color GetImmuneAlpha2(Color newColor) + { + double num = (double) ((int) byte.MaxValue - (int) this.immuneAlpha) * (1.0 / (double) byte.MaxValue); + if ((double) this.shadow > 0.0) + num *= 1.0 - (double) this.shadow; + return new Color((int) ((double) newColor.R * num), (int) ((double) newColor.G * num), (int) ((double) newColor.B * num), (int) ((double) newColor.A * num)); + } + + public Color GetDeathAlpha(Color newColor) + { + return new Color((int) newColor.R + (int) ((double) this.immuneAlpha * 0.9), (int) newColor.G + (int) ((double) this.immuneAlpha * 0.5), (int) newColor.B + (int) ((double) this.immuneAlpha * 0.5), (int) newColor.A + (int) ((double) this.immuneAlpha * 0.4)); + } + + public bool hasItemInInventory(int type) + { + for (int index = 0; index < 49; ++index) + { + if ((int) this.inventory[index].type == type) + return true; + } + return false; + } + + public void DropCoins() + { + for (int index = 0; index <= 48; ++index) + { + if (this.inventory[index].CanBePlacedInCoinSlot()) + { + short num1 = (short) ((int) this.inventory[index].stack >> 1); + short num2 = (short) ((int) this.inventory[index].stack - (int) num1); + int number2 = Item.NewItem(this.aabb.X, this.aabb.Y, 20, 42, (int) this.inventory[index].type, (int) num2, false, 0); + this.inventory[index].stack -= num2; + if ((int) this.inventory[index].stack <= 0) + this.inventory[index].Init(); + Main.item[number2].velocity.Y = (float) Main.rand.Next(-20, 1) * 0.2f; + Main.item[number2].velocity.X = (float) Main.rand.Next(-20, 21) * 0.2f; + Main.item[number2].noGrabDelay = (byte) 100; + NetMessage.CreateMessage2(21, (int) this.whoAmI, number2); + NetMessage.SendMessage(); + if (index == 48) + this.ui.mouseItem = this.inventory[index]; + } + } + } + + public void DropItems() + { + for (int index = 0; index < 49; ++index) + { + if ((int) this.inventory[index].type > 0 && (int) this.inventory[index].netID != -13 && ((int) this.inventory[index].netID != -15 && (int) this.inventory[index].netID != -16)) + { + int number2 = Item.NewItem(this.aabb.X, this.aabb.Y, 20, 42, (int) this.inventory[index].type, 1, false, 0); + Main.item[number2].netDefaults((int) this.inventory[index].netID, (int) this.inventory[index].stack); + Main.item[number2].Prefix((int) this.inventory[index].prefix); + Main.item[number2].velocity.Y = (float) Main.rand.Next(-20, 1) * 0.2f; + Main.item[number2].velocity.X = (float) Main.rand.Next(-20, 21) * 0.2f; + Main.item[number2].noGrabDelay = (byte) 100; + NetMessage.CreateMessage2(21, (int) this.whoAmI, number2); + NetMessage.SendMessage(); + } + this.inventory[index].Init(); + if (index < 11) + { + if ((int) this.armor[index].type > 0) + { + int number2 = Item.NewItem(this.aabb.X, this.aabb.Y, 20, 42, (int) this.armor[index].type, 1, false, 0); + Main.item[number2].netDefaults((int) this.armor[index].netID, (int) this.armor[index].stack); + Main.item[number2].Prefix((int) this.armor[index].prefix); + Main.item[number2].velocity.Y = (float) Main.rand.Next(-20, 1) * 0.2f; + Main.item[number2].velocity.X = (float) Main.rand.Next(-20, 21) * 0.2f; + Main.item[number2].noGrabDelay = (byte) 100; + NetMessage.CreateMessage2(21, (int) this.whoAmI, number2); + NetMessage.SendMessage(); + } + this.armor[index].Init(); + } + } + this.inventory[0].SetDefaults("Copper Shortsword"); + this.inventory[0].Prefix(-1); + this.inventory[1].SetDefaults("Copper Pickaxe"); + this.inventory[1].Prefix(-1); + this.inventory[2].SetDefaults("Copper Axe"); + this.inventory[2].Prefix(-1); + this.ui.mouseItem.Init(); + } + + public Player ShallowCopy() + { + return (Player) this.MemberwiseClone(); + } + + public Player DeepCopy() + { + Player player = (Player) this.MemberwiseClone(); + player.buff = new Buff[10]; + player.armor = new Item[11]; + player.inventory = new Item[49]; + player.bank = new Chest(); + player.safe = new Chest(); + player.shadowPos = new Vector2[3]; + player.grappling = new short[20]; + player.adjTile = new Player.Adj[135]; + player.grappling[0] = (short) -1; + for (int index = 0; index < 10; ++index) + player.buff[index] = this.buff[index]; + for (int index = 0; index < 11; ++index) + player.armor[index] = this.armor[index]; + for (int index = 0; index <= 48; ++index) + player.inventory[index] = this.inventory[index]; + for (int index = 0; index < 20; ++index) + { + player.bank.item[index] = this.bank.item[index]; + player.safe.item[index] = this.safe.item[index]; + } + player.spX = new short[200]; + player.spY = new short[200]; + player.spN = new string[200]; + player.spI = new int[200]; + for (int index = 0; index < 200; ++index) + { + player.spX[index] = this.spX[index]; + player.spY[index] = this.spY[index]; + player.spN[index] = this.spN[index]; + player.spI[index] = this.spI[index]; + } + return player; + } + + public static bool CheckSpawn(int x, int y) + { + if (x < 10 || x > (int) Main.maxTilesX - 10 || (y < 10 || y > (int) Main.maxTilesX - 10) || ((int) Main.tile[x, y - 1].active == 0 || (int) Main.tile[x, y - 1].type != 79)) + return false; + for (int index1 = x - 1; index1 <= x + 1; ++index1) + { + for (int index2 = y - 3; index2 < y; ++index2) + { + if ((int) Main.tile[index1, index2].active != 0 && Main.tileSolidNotSolidTop[(int) Main.tile[index1, index2].type]) + return false; + } + } + return WorldGen.StartRoomCheck(x, y - 1); + } + + public void FindSpawn() + { + for (int index = 0; index < 200; ++index) + { + if (this.spN[index] == null) + { + this.SpawnX = -1; + this.SpawnY = -1; + break; + } + else if (this.spN[index] == Main.worldName && this.spI[index] == Main.worldID) + { + this.SpawnX = (int) this.spX[index]; + this.SpawnY = (int) this.spY[index]; + break; + } + } + } + + public void ChangeSpawn(int x, int y) + { + for (int index1 = 0; index1 < 200 && this.spN[index1] != null; ++index1) + { + if (this.spN[index1] == Main.worldName && this.spI[index1] == Main.worldID) + { + for (int index2 = index1; index2 > 0; --index2) + { + this.spN[index2] = this.spN[index2 - 1]; + this.spI[index2] = this.spI[index2 - 1]; + this.spX[index2] = this.spX[index2 - 1]; + this.spY[index2] = this.spY[index2 - 1]; + } + this.spX[0] = (short) x; + this.spY[0] = (short) y; + this.spN[0] = Main.worldName; + this.spI[0] = Main.worldID; + return; + } + } + for (int index = 199; index > 0; --index) + { + if (this.spN[index - 1] != null) + { + this.spN[index] = this.spN[index - 1]; + this.spI[index] = this.spI[index - 1]; + this.spX[index] = this.spX[index - 1]; + this.spY[index] = this.spY[index - 1]; + } + } + this.spX[0] = (short) x; + this.spY[0] = (short) y; + this.spN[0] = Main.worldName; + this.spI[0] = Main.worldID; + } + + public bool Save(string playerPath) + { + bool flag = true; + if (this.ui.HasPlayerStorage()) + { + if (playerPath == null || playerPath.Length == 0) + return false; + using (MemoryStream memoryStream = new MemoryStream(2048)) + { + using (BinaryWriter binaryWriter = new BinaryWriter((Stream) memoryStream)) + { + binaryWriter.Write((short) 6); + binaryWriter.Write(0U); + binaryWriter.Write(this.characterName); + binaryWriter.Write(this.difficulty); + binaryWriter.Write(this.hair); + binaryWriter.Write(this.male); + binaryWriter.Write(this.statLife); + binaryWriter.Write(this.statLifeMax); + binaryWriter.Write(this.statMana); + binaryWriter.Write(this.statManaMax); + binaryWriter.Write(this.hairColor.R); + binaryWriter.Write(this.hairColor.G); + binaryWriter.Write(this.hairColor.B); + binaryWriter.Write(this.skinColor.R); + binaryWriter.Write(this.skinColor.G); + binaryWriter.Write(this.skinColor.B); + binaryWriter.Write(this.eyeColor.R); + binaryWriter.Write(this.eyeColor.G); + binaryWriter.Write(this.eyeColor.B); + binaryWriter.Write(this.shirtColor.R); + binaryWriter.Write(this.shirtColor.G); + binaryWriter.Write(this.shirtColor.B); + binaryWriter.Write(this.underShirtColor.R); + binaryWriter.Write(this.underShirtColor.G); + binaryWriter.Write(this.underShirtColor.B); + binaryWriter.Write(this.pantsColor.R); + binaryWriter.Write(this.pantsColor.G); + binaryWriter.Write(this.pantsColor.B); + binaryWriter.Write(this.shoeColor.R); + binaryWriter.Write(this.shoeColor.G); + binaryWriter.Write(this.shoeColor.B); + lock (this) + { + for (int local_3 = 0; local_3 < 11; ++local_3) + { + binaryWriter.Write(this.armor[local_3].netID); + binaryWriter.Write(this.armor[local_3].prefix); + } + for (int local_4 = 0; local_4 < 48; ++local_4) + { + binaryWriter.Write(this.inventory[local_4].netID); + binaryWriter.Write(this.inventory[local_4].stack); + binaryWriter.Write(this.inventory[local_4].prefix); + } + for (int local_5 = 0; local_5 < 20; ++local_5) + { + binaryWriter.Write(this.bank.item[local_5].netID); + binaryWriter.Write(this.bank.item[local_5].stack); + binaryWriter.Write(this.bank.item[local_5].prefix); + } + for (int local_6 = 0; local_6 < 20; ++local_6) + { + binaryWriter.Write(this.safe.item[local_6].netID); + binaryWriter.Write(this.safe.item[local_6].stack); + binaryWriter.Write(this.safe.item[local_6].prefix); + } + for (int local_7 = 0; local_7 < 10; ++local_7) + { + binaryWriter.Write(this.buff[local_7].Type); + binaryWriter.Write(this.buff[local_7].Time); + } + } + binaryWriter.Write(this.pet); + int count1 = this.itemsFound.Length + 7 >> 3; + byte[] buffer = new byte[count1]; + this.itemsFound.CopyTo((Array) buffer, 0); + binaryWriter.Write((ushort) count1); + binaryWriter.Write(buffer, 0, count1); + int count2 = 43; + this.recipesFound.CopyTo((Array) buffer, 0); + binaryWriter.Write((ushort) count2); + binaryWriter.Write(buffer, 0, count2); + this.recipesNew.CopyTo((Array) buffer, 0); + binaryWriter.Write(buffer, 0, count2); + int count3 = 17; + this.craftingStationsFound.CopyTo((Array) buffer, 0); + binaryWriter.Write((ushort) count3); + binaryWriter.Write(buffer, 0, count3); + for (int index = 0; index < 200; ++index) + { + if (this.spN[index] == null) + { + binaryWriter.Write((short) -1); + break; + } + else + { + binaryWriter.Write(this.spX[index]); + binaryWriter.Write(this.spY[index]); + binaryWriter.Write(this.spI[index]); + binaryWriter.Write(this.spN[index]); + } + } + CRC32 crC32 = new CRC32(); + crC32.Update(memoryStream.GetBuffer(), 6, (int) memoryStream.Length - 6); + binaryWriter.Seek(2, SeekOrigin.Begin); + binaryWriter.Write(crC32.GetValue()); + Main.ShowSaveIcon(); + try + { + if (!this.ui.TestStorageSpace("Characters", playerPath, (int) memoryStream.Length)) + { + flag = false; + } + else + { + using (StorageContainer storageContainer = this.ui.OpenPlayerStorage("Characters")) + { + using (Stream stream = storageContainer.OpenFile(playerPath, FileMode.Create)) + { + stream.Write(memoryStream.GetBuffer(), 0, (int) memoryStream.Length); + stream.Close(); + } + } + } + } + catch (IOException ex) + { + this.ui.WriteError(); + flag = false; + } + catch (Exception ex) + { + } + binaryWriter.Close(); + Main.HideSaveIcon(); + } + } + } + return flag; + } + + public void Load(StorageContainer c, string playerPath) + { + try + { + using (Stream stream = c.OpenFile(playerPath, FileMode.Open)) + { + using (MemoryStream memoryStream = new MemoryStream((int) stream.Length)) + { + memoryStream.SetLength(stream.Length); + stream.Read(memoryStream.GetBuffer(), 0, (int) stream.Length); + stream.Close(); + using (BinaryReader binaryReader = new BinaryReader((Stream) memoryStream)) + { + int num1 = (int) binaryReader.ReadInt16(); + if (num1 > 6) + throw new InvalidOperationException("Invalid version"); + if (num1 >= 6) + { + CRC32 crC32 = new CRC32(); + crC32.Update(memoryStream.GetBuffer(), 6, (int) memoryStream.Length - 6); + if ((int) crC32.GetValue() != (int) binaryReader.ReadUInt32()) + throw new InvalidOperationException("Invalid CRC32"); + } + this.characterName = binaryReader.ReadString(); + this.difficulty = binaryReader.ReadByte(); + this.hair = binaryReader.ReadByte(); + this.male = binaryReader.ReadBoolean(); + this.statLife = binaryReader.ReadInt16(); + this.statLifeMax = binaryReader.ReadInt16(); + if ((int) this.statLifeMax > 400) + this.statLifeMax = (short) 400; + if ((int) this.statLife > (int) this.statLifeMax) + this.statLife = this.statLifeMax; + this.statMana = binaryReader.ReadInt16(); + this.statManaMax = binaryReader.ReadInt16(); + if ((int) this.statManaMax > 200) + this.statManaMax = (short) 200; + if ((int) this.statMana > 400) + this.statMana = (short) 400; + if (num1 == 4) + { + int num2 = (int) binaryReader.ReadUInt32(); + } + this.hairColor.R = binaryReader.ReadByte(); + this.hairColor.G = binaryReader.ReadByte(); + this.hairColor.B = binaryReader.ReadByte(); + this.skinColor.R = binaryReader.ReadByte(); + this.skinColor.G = binaryReader.ReadByte(); + this.skinColor.B = binaryReader.ReadByte(); + this.eyeColor.R = binaryReader.ReadByte(); + this.eyeColor.G = binaryReader.ReadByte(); + this.eyeColor.B = binaryReader.ReadByte(); + this.shirtColor.R = binaryReader.ReadByte(); + this.shirtColor.G = binaryReader.ReadByte(); + this.shirtColor.B = binaryReader.ReadByte(); + this.underShirtColor.R = binaryReader.ReadByte(); + this.underShirtColor.G = binaryReader.ReadByte(); + this.underShirtColor.B = binaryReader.ReadByte(); + this.pantsColor.R = binaryReader.ReadByte(); + this.pantsColor.G = binaryReader.ReadByte(); + this.pantsColor.B = binaryReader.ReadByte(); + this.shoeColor.R = binaryReader.ReadByte(); + this.shoeColor.G = binaryReader.ReadByte(); + this.shoeColor.B = binaryReader.ReadByte(); + for (int index = 0; index <= 10; ++index) + { + int Type = (int) binaryReader.ReadInt16(); + int pre = (int) binaryReader.ReadByte(); + if (Type == 0) + { + this.armor[index].Init(); + } + else + { + this.armor[index].netDefaults(Type, 1); + this.armor[index].Prefix(pre); + this.itemsFound.Set((int) this.armor[index].type, true); + } + } + for (int index = 0; index < 48; ++index) + { + int Type = (int) binaryReader.ReadInt16(); + int Stack = (int) binaryReader.ReadInt16(); + int pre = (int) binaryReader.ReadByte(); + if (Type == 0) + { + this.inventory[index].Init(); + } + else + { + this.inventory[index].netDefaults(Type, Stack); + this.inventory[index].Prefix(pre); + this.itemsFound.Set((int) this.inventory[index].type, true); + } + } + for (int index = 0; index < 20; ++index) + { + int Type = (int) binaryReader.ReadInt16(); + int Stack = (int) binaryReader.ReadInt16(); + int pre = (int) binaryReader.ReadByte(); + if (Type == 0) + { + this.bank.item[index].Init(); + } + else + { + this.bank.item[index].netDefaults(Type, Stack); + this.bank.item[index].Prefix(pre); + this.itemsFound.Set((int) this.bank.item[index].type, true); + } + } + for (int index = 0; index < 20; ++index) + { + int Type = (int) binaryReader.ReadInt16(); + int Stack = (int) binaryReader.ReadInt16(); + int pre = (int) binaryReader.ReadByte(); + if (Type == 0) + { + this.safe.item[index].Init(); + } + else + { + this.safe.item[index].netDefaults(Type, Stack); + this.safe.item[index].Prefix(pre); + this.itemsFound.Set((int) this.safe.item[index].type, true); + } + } + for (int index = 0; index < 10; ++index) + { + this.buff[index].Type = binaryReader.ReadUInt16(); + this.buff[index].Time = binaryReader.ReadUInt16(); + } + if (num1 >= 1) + this.pet = binaryReader.ReadSByte(); + if (num1 >= 2) + { + int count1 = (int) binaryReader.ReadUInt16(); + this.itemsFound = new BitArray(binaryReader.ReadBytes(count1)); + if (this.itemsFound.Length < 632) + this.itemsFound.Length = 632; + int count2 = (int) binaryReader.ReadUInt16(); + this.recipesFound = new BitArray(binaryReader.ReadBytes(count2)); + this.recipesNew = new BitArray(binaryReader.ReadBytes(count2)); + if (num1 >= 3) + { + int count3 = (int) binaryReader.ReadUInt16(); + this.craftingStationsFound = new BitArray(binaryReader.ReadBytes(count3)); + } + else + this.InitKnownCraftingStations(); + } + else + this.InitKnownItems(); + for (int index = 0; index < 200; ++index) + { + int num3 = (int) binaryReader.ReadInt16(); + if (num3 != -1) + { + this.spX[index] = (short) num3; + this.spY[index] = binaryReader.ReadInt16(); + this.spI[index] = binaryReader.ReadInt32(); + this.spN[index] = binaryReader.ReadString(); + } + else + break; + } + binaryReader.Close(); + } + } + } + this.PlayerFrame(); + } + catch + { + Main.ShowSaveIcon(); + c.DeleteFile(playerPath); + this.name = (string) null; + Main.HideSaveIcon(); + } + } + + public bool HasItem(int type) + { + for (int index = 0; index < 48; ++index) + { + if (type == (int) this.inventory[index].type) + return true; + } + return false; + } + + public void UpdateGrappleItemSlot() + { + int index1 = -1; + if (!this.noItems) + { + for (int index2 = 0; index2 < 48; ++index2) + { + if ((int) this.inventory[index2].shoot == 13 || (int) this.inventory[index2].shoot == 32 || (int) this.inventory[index2].shoot == 73) + { + index1 = index2; + break; + } + } + if (index1 >= 0) + { + int num1 = (int) this.inventory[index1].shoot; + if (num1 == 73) + { + int num2 = 0; + for (int index2 = 0; index2 < 512; ++index2) + { + if (((int) Main.projectile[index2].type == 73 || (int) Main.projectile[index2].type == 74) && ((int) Main.projectile[index2].active != 0 && (int) Main.projectile[index2].owner == (int) this.whoAmI) && ++num2 > 1) + { + index1 = -1; + break; + } + } + } + else + { + for (int index2 = 0; index2 < 512; ++index2) + { + if ((int) Main.projectile[index2].type == num1 && (int) Main.projectile[index2].active != 0 && ((int) Main.projectile[index2].owner == (int) this.whoAmI && (double) Main.projectile[index2].ai0 != 2.0)) + { + index1 = -1; + break; + } + } + } + } + } + this.grappleItemSlot = (sbyte) index1; + } + + public void QuickGrapple() + { + int index1 = (int) this.grappleItemSlot; + if (index1 < 0) + return; + Main.PlaySound(2, this.aabb.X, this.aabb.Y, (int) this.inventory[index1].useSound); + if (this.isLocal()) + { + NetMessage.CreateMessage1(51, (int) this.whoAmI); + NetMessage.SendMessage(); + } + int Type = (int) this.inventory[index1].shoot; + float num1 = this.inventory[index1].shootSpeed; + int Damage = (int) this.inventory[index1].damage; + float KnockBack = this.inventory[index1].knockBack; + if (Type == 13 || Type == 32) + { + this.grappling[0] = (short) -1; + this.grapCount = (byte) 0; + for (int index2 = 0; index2 < 512; ++index2) + { + if ((int) Main.projectile[index2].active != 0 && (int) Main.projectile[index2].owner == (int) this.whoAmI && (int) Main.projectile[index2].type == 13) + Main.projectile[index2].Kill(); + } + } + else if (Type == 73) + { + for (int index2 = 0; index2 < 512; ++index2) + { + if ((int) Main.projectile[index2].active != 0 && (int) Main.projectile[index2].owner == (int) this.whoAmI && (int) Main.projectile[index2].type == 73) + { + Type = 74; + break; + } + } + } + Vector2 vector2 = new Vector2(this.position.X + 10f, this.position.Y + 21f); + float num2 = this.controlDir.X; + float num3 = this.controlDir.Y; + float num4 = (float) ((double) num2 * (double) num2 + (double) num3 * (double) num3); + if ((double) num4 <= 0.0) + return; + float num5 = num1 / (float) Math.Sqrt((double) num4); + float SpeedX = num2 * num5; + float SpeedY = num3 * num5; + Projectile.NewProjectile(vector2.X, vector2.Y, SpeedX, SpeedY, Type, Damage, KnockBack, (int) this.whoAmI, true); + } + + public void InitKnownItems() + { + this.itemsFound.Set(9, true); + this.itemsFound.Set(23, true); + this.itemsFound.Set(3, true); + this.itemsFound.Set(2, true); + this.itemsFound.Set(38, true); + this.itemsFound.Set(31, true); + this.itemsFound.Set(68, true); + } + + public void InitKnownCraftingStations() + { + this.craftingStationsFound.Set(13, true); + this.craftingStationsFound.Set(15, true); + this.craftingStationsFound.Set(18, true); + } + + public void UpdateEditSign() + { + if ((int) this.sign == -1) + { + this.ui.editSign = false; + } + else + { + this.ui.npcChatText = this.ui.GetInputText(this.ui.npcChatText, (string) null, (string) null, true); + if (!this.ui.inputTextEnter) + return; + this.ui.inputTextEnter = false; + Main.PlaySound(12); + int number2 = (int) this.sign; + Main.sign[number2].SetText(this.ui.npcChatText); + this.ui.editSign = false; + if (Main.netMode != 1) + return; + NetMessage.CreateMessage2(47, (int) this.whoAmI, number2); + NetMessage.SendMessage(); + } + } + + public void UpdateMouse() + { + int num1 = this.aabb.X + 10 - this.view.screenPosition.X; + int num2 = this.aabb.Y + 21 - this.view.screenPosition.Y; + if (num1 > (int) this.view.viewWidth || num1 < 0 || (num2 > 540 || num2 < 0)) + { + this.ui.mouseX = (short) (((int) this.view.viewWidth >> 1) + ((int) this.direction << 5)); + this.ui.mouseY = (short) 270; + } + else + { + int num3 = (int) this.inventory[(int) this.selectedItem].tileBoost + (int) this.blockRange; + int num4 = 5 + num3 << 4; + this.relativeTargetX += this.ui.gpState.ThumbSticks.Right.X * 6f; + this.relativeTargetY -= this.ui.gpState.ThumbSticks.Right.Y * 6f; + if ((double) this.relativeTargetX <= (double) -num4) + this.relativeTargetX = (float) -(num4 - 1); + else if ((double) this.relativeTargetX >= (double) num4) + this.relativeTargetX = (float) (num4 - 1); + int num5 = (int) this.relativeTargetX; + int num6 = num1 + num5; + if (num6 < 0) + { + this.relativeTargetX -= (float) num6; + num6 = 0; + } + else if (num6 >= (int) this.view.viewWidth) + { + int num7 = (int) this.view.viewWidth - 1 - num6; + this.relativeTargetX += (float) num7; + num6 += num7; + } + this.ui.mouseX = (short) num6; + int num8 = 4 + num3 << 4; + if ((double) this.relativeTargetY <= (double) -num8) + this.relativeTargetY = (float) -(num8 - 1); + else if ((double) this.relativeTargetY >= (double) num8) + this.relativeTargetY = (float) (num8 - 1); + int num9 = num2 + (int) this.relativeTargetY; + if (num9 < 0) + { + this.relativeTargetY -= (float) num9; + num9 = 0; + } + else if (num9 >= 540) + { + int num7 = 539 - num9; + this.relativeTargetY += (float) num7; + num9 += num7; + } + this.ui.mouseY = (short) num9; + } + this.controlDir.X = (float) ((int) this.ui.mouseX - num1); + this.controlDir.Y = (float) ((int) this.ui.mouseY - num2); + } + + public unsafe void UpdateMouseSmart() + { + int num1 = this.aabb.X + 10 - this.view.screenPosition.X; + int num2 = this.aabb.Y + 21 - this.view.screenPosition.Y; + fixed (Item* objPtr = &this.inventory[(int) this.selectedItem]) + { + Vector2 right = this.ui.gpState.ThumbSticks.Right; + Vector2 vector2_1 = right; + bool flag1 = (double) right.LengthSquared() <= 1.0 / 64.0; + if (!flag1) + vector2_1.Normalize(); + Vector2 left = this.ui.gpState.ThumbSticks.Left; + Vector2 vector2_2 = left; + bool flag2 = (double) left.LengthSquared() <= 1.0 / 64.0; + if (!flag2) + vector2_2.Normalize(); + int index1 = 0; + if ((int) objPtr->type > 0) + { + if (flag1) + { + if (flag2) + { + this.controlDir.X = (float) this.direction; + this.controlDir.Y = 0.0f; + } + else + { + this.controlDir.X = vector2_2.X; + this.controlDir.Y = -vector2_2.Y; + } + } + else + { + this.controlDir.X = vector2_1.X; + this.controlDir.Y = -vector2_1.Y; + } + int num3 = (int) objPtr->tileBoost + (int) this.blockRange; + Vector2 vector2_3 = new Vector2((float) (-(double) this.controlDir.Y * 16.0), this.controlDir.X * 16f); + int num4 = this.aabb.X; + int num5 = this.aabb.Y + 21; + if ((double) this.controlDir.X >= 0.0) + num4 += 20; + double num6 = (double) num4; + double num7 = (double) num5; + for (int index2 = 2; index2 >= 0; --index2) + { + double num8 = num6 * (1.0 / 16.0); + double num9 = num7 * (1.0 / 16.0); + int num10 = (int) num8 + (5 + num3) * ((double) this.controlDir.X < 0.0 ? -1 : 1); + int num11 = (int) num9 + (5 + num3) * ((double) this.controlDir.Y < 0.0 ? -1 : 1); + int i; + int j1; + int index3; + while (true) + { + i = (int) num8; + j1 = (int) num9; + index3 = (int) Main.tile[i, j1].type; + bool flag3 = (int) objPtr->axe > 0 && Main.tileAxe[index3] || (int) objPtr->hammer > 0 && (Main.tileHammer[index3] || (int) Main.tile[i, j1].wall > 0 && WorldGen.CanKillWall(i, j1)); + if (flag3 || ((int) objPtr->pick > 0 || (int) objPtr->createTile >= 0) && ((int) Main.tile[i, j1].active != 0 && Main.tileSolid[index3]) || (int) objPtr->createWall >= 0 && (int) Main.tile[i, j1].wall == 0) + { + if (!flag3) + { + if ((int) objPtr->pick > 0) + { + if (!Main.tileAxe[index3] && !Main.tileHammer[index3] && WorldGen.CanKillTile(i, j1)) + goto label_30; + } + else if ((int) objPtr->createTile >= 0) + { + i = (int) (num8 - (double) this.controlDir.X); + if ((int) Main.tile[i, j1].active != 0 && Main.tileSolid[index3]) + { + i = (int) num8; + j1 = (int) (num9 - (double) this.controlDir.Y); + if ((int) Main.tile[i, j1].active != 0 && Main.tileSolid[index3]) + { + i = (int) (num8 - (double) this.controlDir.X); + if ((int) Main.tile[i, j1].active != 0 && Main.tileSolid[index3]) + { + i = (int) num8; + j1 = (int) num9; + goto label_31; + } + } + } + int j2 = j1; + if (!WorldGen.CanPlaceTile(i, ref j2, (int) objPtr->createTile, -1)) + { + i = (int) num8; + j1 = (int) num9; + } + else + goto label_30; + } + else + goto label_30; + } + else + break; + } +label_31: + if (i != num10 && j1 != num11) + { + num8 += (double) this.controlDir.X; + num9 += (double) this.controlDir.Y; + } + else + goto label_33; + } + if (Main.tileAxe[index3] && (!Main.tileAxe[(int) Main.tile[i, j1 - 1].type] || !Main.tileAxe[(int) Main.tile[i, j1 - 2].type])) + { + --i; + if (!Main.tileAxe[(int) Main.tile[i, j1].type] || !Main.tileAxe[(int) Main.tile[i, j1 - 1].type] || !Main.tileAxe[(int) Main.tile[i, j1 - 2].type]) + { + i += 2; + if (!Main.tileAxe[(int) Main.tile[i, j1].type] || !Main.tileAxe[(int) Main.tile[i, j1 - 1].type] || !Main.tileAxe[(int) Main.tile[i, j1 - 2].type]) + --i; + } + } +label_30: + this.smartLocation[index1].X = (i << 4) + 8; + this.smartLocation[index1].Y = (j1 << 4) + 8; + ++index1; +label_33: + if (index2 == 1) + { + double num12 = num6 - (double) vector2_3.X; + double num13 = num7 - (double) vector2_3.Y; + num6 = num12 - (double) vector2_3.X; + num7 = num13 - (double) vector2_3.Y; + } + else + { + num6 += (double) vector2_3.X; + num7 += (double) vector2_3.Y; + } + } + if (index1 > 0) + { + int index2 = 0; + if (index1 > 1) + { + int num8 = num4; + int num9 = num5; + if ((int) objPtr->createTile == 4) + { + num8 += (int) ((double) this.controlDir.X * 256.0); + num9 += (int) ((double) this.controlDir.Y * 256.0); + } + else if ((int) objPtr->pick <= 0 && (int) objPtr->hammer <= 0 && ((int) objPtr->createWall < 0 && (int) objPtr->createTile < 0) && (int) objPtr->axe > 0) + num9 += 42; + int num10 = num8 - this.smartLocation[0].X; + int num11 = num9 - this.smartLocation[0].Y; + int num12 = num10 * num10 + num11 * num11; + int index3 = 1; + do + { + int num13 = num8 - this.smartLocation[index3].X; + int num14 = num9 - this.smartLocation[index3].Y; + int num15 = num13 * num13 + num14 * num14; + if (num15 < num12) + { + num12 = num15; + index2 = index3; + } + } + while (++index3 < index1); + } + num1 = this.smartLocation[index2].X - this.view.screenPosition.X; + num2 = this.smartLocation[index2].Y - this.view.screenPosition.Y; + } + else + this.ui.cursorHighlight = 0; + } + if (flag1) + { + if (flag2) + this.controlDir.X = (float) ((int) this.direction << 4); + else if ((double) left.LengthSquared() < 0.25) + { + this.controlDir.X = vector2_2.X * 32f; + this.controlDir.Y = vector2_2.Y * -32f; + } + else + { + this.controlDir.X = left.X * 80f; + this.controlDir.Y = left.Y * -80f; + } + } + else if ((double) right.LengthSquared() < 0.25) + { + this.controlDir.X = vector2_1.X * 32f; + this.controlDir.Y = vector2_1.Y * -32f; + } + else + { + this.controlDir.X = right.X * 80f; + this.controlDir.Y = right.Y * -80f; + } + if (index1 == 0 && (int) objPtr->shoot > 0) + { + num1 += (int) this.controlDir.X; + num2 += (int) this.controlDir.Y; + } + this.ui.mouseX = (short) num1; + this.ui.mouseY = (short) num2; + } + } + + public unsafe void Draw(WorldView drawView, bool isMenu = false, bool isIcon = false) + { + this.aabb.X = (int) this.position.X; + this.aabb.Y = (int) this.position.Y; + Color newColor1; + Color newColor2; + Color newColor3; + Color newColor4; + Color newColor5; + Color newColor6; + Color newColor7; + Color newColor8; + Color newColor9; + Color newColor10; + Color newColor11; + Color newColor12; + Color c; + if (isMenu) + { + newColor1 = Color.White; + newColor2 = Color.White; + newColor3 = Color.White; + newColor4 = Color.White; + newColor5 = this.shirtColor; + newColor6 = this.underShirtColor; + newColor7 = this.pantsColor; + newColor8 = this.shoeColor; + newColor9 = this.eyeColor; + newColor10 = this.hairColor; + newColor11 = this.skinColor; + newColor12 = this.skinColor; + c = this.skinColor; + } + else + { + int x = this.aabb.X + 10 >> 4; + int y1 = (int) ((double) this.position.Y + 21.0) >> 4; + int y2 = (int) ((double) this.position.Y + 10.5) >> 4; + int y3 = (int) ((double) this.position.Y + 31.5) >> 4; + newColor5 = this.GetImmuneAlpha2(drawView.lighting.GetColorPlayer(x, y1, this.shirtColor)); + newColor6 = this.GetImmuneAlpha2(drawView.lighting.GetColorPlayer(x, y1, this.underShirtColor)); + newColor7 = this.GetImmuneAlpha2(drawView.lighting.GetColorPlayer(x, y1, this.pantsColor)); + newColor8 = this.GetImmuneAlpha2(drawView.lighting.GetColorPlayer(x, y3, this.shoeColor)); + newColor1 = this.GetImmuneAlpha2(drawView.lighting.GetColorPlayer(x, y2)); + newColor2 = this.GetImmuneAlpha2(drawView.lighting.GetColorPlayer(x, y1)); + newColor3 = this.GetImmuneAlpha2(drawView.lighting.GetColorPlayer(x, y3)); + if ((double) this.shadow > 0.0) + { + newColor4 = new Color(); + newColor9 = new Color(); + newColor10 = new Color(); + newColor11 = new Color(); + newColor12 = new Color(); + c = new Color(); + } + else + { + newColor4 = this.GetImmuneAlpha(drawView.lighting.GetColorPlayer(x, y2)); + newColor9 = this.GetImmuneAlpha(drawView.lighting.GetColorPlayer(x, y2, this.eyeColor)); + newColor10 = this.GetImmuneAlpha(drawView.lighting.GetColorPlayer(x, y2, this.hairColor)); + newColor11 = this.GetImmuneAlpha(drawView.lighting.GetColorPlayer(x, y2, this.skinColor)); + newColor12 = this.GetImmuneAlpha(drawView.lighting.GetColorPlayer(x, y1, this.skinColor)); + c = this.GetImmuneAlpha(drawView.lighting.GetColorPlayer(x, y3, this.skinColor)); + } + } + if ((double) this.buffR != 1.0 || (double) this.buffG != 1.0 || (double) this.buffB != 1.0) + { + if (this.onFire || this.onFire2) + { + newColor4 = this.GetImmuneAlpha(Color.White); + newColor9 = this.GetImmuneAlpha(this.eyeColor); + newColor10 = this.GetImmuneAlpha(this.hairColor); + newColor11 = this.GetImmuneAlpha(this.skinColor); + newColor12 = this.GetImmuneAlpha(this.skinColor); + newColor5 = this.GetImmuneAlpha(this.shirtColor); + newColor6 = this.GetImmuneAlpha(this.underShirtColor); + newColor7 = this.GetImmuneAlpha(this.pantsColor); + newColor8 = this.GetImmuneAlpha(this.shoeColor); + newColor1 = this.GetImmuneAlpha(Color.White); + newColor2 = this.GetImmuneAlpha(Color.White); + newColor3 = this.GetImmuneAlpha(Color.White); + } + else + { + Player.buffColor(ref newColor4, (double) this.buffR, (double) this.buffG, (double) this.buffB); + Player.buffColor(ref newColor9, (double) this.buffR, (double) this.buffG, (double) this.buffB); + Player.buffColor(ref newColor10, (double) this.buffR, (double) this.buffG, (double) this.buffB); + Player.buffColor(ref newColor11, (double) this.buffR, (double) this.buffG, (double) this.buffB); + Player.buffColor(ref newColor12, (double) this.buffR, (double) this.buffG, (double) this.buffB); + Player.buffColor(ref newColor5, (double) this.buffR, (double) this.buffG, (double) this.buffB); + Player.buffColor(ref newColor6, (double) this.buffR, (double) this.buffG, (double) this.buffB); + Player.buffColor(ref newColor7, (double) this.buffR, (double) this.buffG, (double) this.buffB); + Player.buffColor(ref newColor8, (double) this.buffR, (double) this.buffG, (double) this.buffB); + Player.buffColor(ref newColor1, (double) this.buffR, (double) this.buffG, (double) this.buffB); + Player.buffColor(ref newColor2, (double) this.buffR, (double) this.buffG, (double) this.buffB); + Player.buffColor(ref newColor3, (double) this.buffR, (double) this.buffG, (double) this.buffB); + } + } + SpriteEffects e1; + SpriteEffects e2; + if ((int) this.gravDir == 1) + { + if ((int) this.direction == 1) + { + e1 = SpriteEffects.None; + e2 = SpriteEffects.None; + } + else + { + e1 = SpriteEffects.FlipHorizontally; + e2 = SpriteEffects.FlipHorizontally; + } + if (!this.dead) + { + this.legPosition.Y = 0.0f; + this.headPosition.Y = 0.0f; + this.bodyPosition.Y = 0.0f; + } + } + else + { + if ((int) this.direction == 1) + { + e1 = SpriteEffects.FlipVertically; + e2 = SpriteEffects.FlipVertically; + } + else + { + e1 = SpriteEffects.FlipHorizontally | SpriteEffects.FlipVertically; + e2 = SpriteEffects.FlipHorizontally | SpriteEffects.FlipVertically; + } + if (!this.dead) + { + this.legPosition.Y = 6f; + this.headPosition.Y = 6f; + this.bodyPosition.Y = 6f; + } + } + Vector2 pivot1 = new Vector2(20f, 42f); + Vector2 pivot2 = new Vector2(20f, 28f); + Vector2 pivot3 = new Vector2(20f, 22.4f); + Vector2 pos = Vector2.Zero; + if (this.merman) + { + this.headRotation = (float) ((double) this.velocity.Y * (double) this.direction * 0.100000001490116); + if ((double) this.headRotation < -0.3) + this.headRotation = -0.3f; + if ((double) this.headRotation > 0.3) + this.headRotation = 0.3f; + } + else if (!this.dead) + this.headRotation = 0.0f; + if (!isIcon) + { + if ((int) this.wings > 0) + { + pos = new Vector2((float) (this.aabb.X - drawView.screenPosition.X + 10 - 9 * (int) this.direction), (float) (this.aabb.Y - drawView.screenPosition.Y + 21 + ((int) this.gravDir << 1))); + int id = 1484 + (int) this.wings; + int sh = SpriteSheet<_sheetSprites>.src[id].Height >> 2; + SpriteSheet<_sheetSprites>.DrawRotated(id, ref pos, sh * (int) this.wingFrame, sh, newColor2, this.bodyRotation, e1); + } + if (!this.invis) + { + pos = new Vector2((float) (20 + (int) this.bodyPosition.X + this.aabb.X - drawView.screenPosition.X - 20 + 10), (float) (28 + (int) this.bodyPosition.Y + this.aabb.Y - drawView.screenPosition.Y + 42 - 56 + 4)); + SpriteSheet<_sheetSprites>.DrawRotated(1472, ref pos, (int) this.bodyFrameY, 54, newColor12, this.bodyRotation, ref pivot2, e1); + SpriteSheet<_sheetSprites>.DrawRotated(1473, ref pos, (int) this.legFrameY, 54, c, this.legRotation, ref pivot2, e1); + } + pos = new Vector2((float) (int) ((double) this.position.X - (double) drawView.screenPosition.X - 20.0 + 10.0), (float) (int) ((double) this.position.Y - (double) drawView.screenPosition.Y + 42.0 - 56.0 + 4.0)) + this.legPosition + pivot1; + if ((int) this.legs > 0 && (int) this.legs < 28) + SpriteSheet<_sheetSprites>.DrawRotated(107 + (int) this.legs, ref pos, (int) this.legFrameY, 54, newColor3, this.legRotation, ref pivot1, e1); + else if (!this.invis) + { + if (!this.male) + { + SpriteSheet<_sheetSprites>.DrawRotated(249, ref pos, (int) this.legFrameY, 54, newColor7, this.legRotation, ref pivot1, e1); + SpriteSheet<_sheetSprites>.DrawRotated(252, ref pos, (int) this.legFrameY, 54, newColor8, this.legRotation, ref pivot1, e1); + } + else + { + SpriteSheet<_sheetSprites>.DrawRotated(1344, ref pos, (int) this.legFrameY, 54, newColor7, this.legRotation, ref pivot1, e1); + SpriteSheet<_sheetSprites>.DrawRotated(1346, ref pos, (int) this.legFrameY, 54, newColor8, this.legRotation, ref pivot1, e1); + } + } + pos.X = (float) (this.aabb.X - drawView.screenPosition.X + 10); + pos.Y = (float) (this.aabb.Y - drawView.screenPosition.Y + 42 - 56 + 4 + 28); + pos.X += this.bodyPosition.X; + pos.Y += this.bodyPosition.Y; + if ((int) this.body > 0 && (int) this.body < 29) + { + SpriteSheet<_sheetSprites>.DrawRotated((this.male ? 32 : 220) + (int) this.body, ref pos, (int) this.bodyFrameY, 54, newColor2, this.bodyRotation, ref pivot2, e1); + if (!this.invis && ((int) this.body >= 10 && (int) this.body <= 16 || (int) this.body == 20)) + SpriteSheet<_sheetSprites>.DrawRotated(1342, ref pos, (int) this.bodyFrameY, 54, newColor12, this.bodyRotation, ref pivot2, e1); + } + else if (!this.invis) + { + if (!this.male) + { + SpriteSheet<_sheetSprites>.DrawRotated(254, ref pos, (int) this.bodyFrameY, 54, newColor6, this.bodyRotation, ref pivot2, e1); + SpriteSheet<_sheetSprites>.DrawRotated(251, ref pos, (int) this.bodyFrameY, 54, newColor5, this.bodyRotation, ref pivot2, e1); + } + else + { + SpriteSheet<_sheetSprites>.DrawRotated(1348, ref pos, (int) this.bodyFrameY, 54, newColor6, this.bodyRotation, ref pivot2, e1); + SpriteSheet<_sheetSprites>.DrawRotated(1345, ref pos, (int) this.bodyFrameY, 54, newColor5, this.bodyRotation, ref pivot2, e1); + } + SpriteSheet<_sheetSprites>.DrawRotated(1342, ref pos, (int) this.bodyFrameY, 54, newColor12, this.bodyRotation, ref pivot2, e1); + } + } + pos.X = (float) (this.aabb.X - drawView.screenPosition.X - 20 + 10); + pos.Y = (float) (this.aabb.Y - drawView.screenPosition.Y + 42 - 56 + 4); + pos.X += this.headPosition.X + pivot3.X; + pos.Y += this.headPosition.Y + pivot3.Y; + if (!this.invis && (int) this.head != 38) + { + SpriteSheet<_sheetSprites>.DrawRotated(1343, ref pos, (int) this.bodyFrameY, 54, newColor11, this.headRotation, ref pivot3, e1); + SpriteSheet<_sheetSprites>.DrawRotated(1267, ref pos, (int) this.bodyFrameY, 54, newColor4, this.headRotation, ref pivot3, e1); + SpriteSheet<_sheetSprites>.DrawRotated(1268, ref pos, (int) this.bodyFrameY, 54, newColor9, this.headRotation, ref pivot3, e1); + } + if ((int) this.head == 10 || (int) this.head == 12 || (int) this.head == 28) + { + SpriteSheet<_sheetSprites>.DrawRotated(60 + (int) this.head, ref pos, (int) this.bodyFrameY, 54, newColor1, this.headRotation, ref pivot3, e1); + if (!this.invis) + { + int sy = (int) this.bodyFrameY - 336; + if (sy < 0) + sy = 0; + SpriteSheet<_sheetSprites>.DrawRotated(1269 + (int) this.hair, ref pos, sy, 54, newColor10, this.headRotation, ref pivot3, e1); + } + } + else if (((int) this.head >= 14 && (int) this.head <= 16 || ((int) this.head == 18 || (int) this.head == 21) || ((int) this.head >= 24 && (int) this.head <= 26 || ((int) this.head == 40 || (int) this.head == 44))) && !this.invis) + { + int sy = (int) this.bodyFrameY - 336; + if (sy < 0) + sy = 0; + SpriteSheet<_sheetSprites>.DrawRotated(1305 + (int) this.hair, ref pos, sy, 54, newColor10, this.headRotation, ref pivot3, e1); + } + if ((int) this.head == 23) + { + int sy = (int) this.bodyFrameY - 336; + if (sy < 0) + sy = 0; + if (!this.invis) + SpriteSheet<_sheetSprites>.DrawRotated(1269 + (int) this.hair, ref pos, sy, 54, newColor10, this.headRotation, ref pivot3, e1); + SpriteSheet<_sheetSprites>.DrawRotated(60 + (int) this.head, ref pos, sy, 54, newColor1, this.headRotation, ref pivot3, e1); + } + else if ((int) this.head == 14) + { + int num1 = (int) this.bodyFrameY; + int sh = 56; + int num2 = 0; + if (num1 == sh * 6) + sh -= 2; + else if (num1 == sh * 7) + num2 = -2; + else if (num1 == sh << 3) + num2 = -2; + else if (num1 == sh * 9) + num2 = -2; + else if (num1 == sh * 10) + num2 = -2; + else if (num1 == sh * 13) + sh -= 2; + else if (num1 == sh * 14) + num2 = -2; + else if (num1 == sh * 15) + num2 = -2; + else if (num1 == sh << 4) + num2 = -2; + int sy = num1 + num2; + pos.Y += (float) num2; + SpriteSheet<_sheetSprites>.DrawRotated(74, ref pos, sy, sh, newColor1, this.headRotation, ref pivot3, e1); + } + else if ((int) this.head > 0 && (int) this.head < 48 && (int) this.head != 28) + SpriteSheet<_sheetSprites>.DrawRotated(60 + (int) this.head, ref pos, (int) this.bodyFrameY, 54, newColor1, this.headRotation, ref pivot3, e1); + else if (!this.invis) + { + int sy = (int) this.bodyFrameY - 336; + if (sy < 0) + sy = 0; + SpriteSheet<_sheetSprites>.DrawRotated(1269 + (int) this.hair, ref pos, sy, 54, newColor10, this.headRotation, ref pivot3, e1); + } + if (isIcon) + return; + if (!isMenu) + { + if ((int) this.heldProj >= 0) + Main.projectile[(int) this.heldProj].Draw(drawView); + fixed (Item* objPtr = &this.inventory[(int) this.selectedItem]) + { + int num1 = (int) objPtr->type; + if (num1 > 0 && ((int) this.itemAnimation > 0 || (int) objPtr->holdStyle > 0) && (!this.dead && !objPtr->noUseGraphic && (!this.wet || !objPtr->noWet))) + { + int id = 451 + num1; + int num2 = SpriteSheet<_sheetSprites>.src[id].Width; + Color color = drawView.lighting.GetColor((int) ((double) this.position.X + 10.0) >> 4, (int) ((double) this.position.Y + 21.0) >> 4); + Color alpha = objPtr->GetAlpha(color); + pos.X = (float) (this.itemLocation.X - drawView.screenPosition.X); + pos.Y = (float) (this.itemLocation.Y - drawView.screenPosition.Y); + Vector2 pivot4 = new Vector2(); + if ((int) objPtr->useStyle == 5) + { + int num3 = 10; + Vector2 centerPivot = SpriteSheet<_sheetSprites>.GetCenterPivot(id); + pivot4.X = (int) this.direction == -1 ? (float) (num3 + num2) : (float) -num3; + pivot4.Y = centerPivot.Y; + int num4; + if (num1 == 95) + centerPivot.Y += (float) (2 * (int) this.gravDir); + else if (num1 == 96) + num4 = -5; + else if (num1 == 98) + { + num4 = -5; + centerPivot.Y -= (float) (2 * (int) this.gravDir); + } + else if (num1 == 534) + { + num4 = -2; + centerPivot.Y += (float) this.gravDir; + } + else if (num1 == 533) + { + num4 = -7; + centerPivot.Y -= (float) (2 * (int) this.gravDir); + } + else if (num1 == 506) + { + num4 = 0; + centerPivot.Y -= (float) (2 * (int) this.gravDir); + } + else if (num1 == 494 || num1 == 508) + num4 = -2; + else if (num1 == 434) + { + num4 = 0; + centerPivot.Y -= (float) (2 * (int) this.gravDir); + } + else if (num1 == 514) + { + num4 = 0; + centerPivot.Y += (float) (3 * (int) this.gravDir); + } + else if (num1 == 435 || num1 == 436 || (num1 == 481 || num1 == 578)) + { + num4 = -2; + centerPivot.Y -= (float) (2 * (int) this.gravDir); + } + else if (num1 == 197) + { + num4 = -5; + centerPivot.Y += (float) (4 * (int) this.gravDir); + } + else if (num1 == 126) + { + num4 = 4; + centerPivot.Y += (float) (4 * (int) this.gravDir); + } + else if (num1 == (int) sbyte.MaxValue) + { + num4 = 4; + centerPivot.Y += (float) (2 * (int) this.gravDir); + } + else if (num1 == 157) + { + num4 = 6; + centerPivot.Y += (float) (2 * (int) this.gravDir); + } + else if (num1 == 160) + num4 = -8; + else if (num1 == 164 || num1 == 219) + { + num4 = 2; + centerPivot.Y += (float) (4 * (int) this.gravDir); + } + else if (num1 == 165 || num1 == 272) + { + num4 = 4; + centerPivot.Y += (float) (4 * (int) this.gravDir); + } + else if (num1 == 266) + { + num4 = 0; + centerPivot.Y += (float) (2 * (int) this.gravDir); + } + else if (num1 == 281) + { + num4 = 6; + centerPivot.Y -= (float) (6 * (int) this.gravDir); + } + pos.X += centerPivot.X; + pos.Y += centerPivot.Y; + SpriteSheet<_sheetSprites>.Draw(id, ref pos, alpha, this.itemRotation, ref pivot4, objPtr->scale, e2); + if ((int) objPtr->color.PackedValue != 0) + SpriteSheet<_sheetSprites>.Draw(id, ref pos, objPtr->GetColor(color), this.itemRotation, ref pivot4, objPtr->scale, e2); + } + else if ((int) this.gravDir == -1) + { + pivot4.X = (float) ((num2 >> 1) - (num2 >> 1) * (int) this.direction); + pivot4.Y = 0.0f; + SpriteSheet<_sheetSprites>.Draw(id, ref pos, alpha, this.itemRotation, ref pivot4, objPtr->scale, e2); + if ((int) objPtr->color.PackedValue != 0) + SpriteSheet<_sheetSprites>.Draw(id, ref pos, objPtr->GetColor(color), this.itemRotation, ref pivot4, objPtr->scale, e2); + } + else + { + if (num1 == 507 || num1 == 425) + e2 = (int) this.gravDir != 1 ? ((int) this.direction != 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None) : ((int) this.direction != 1 ? SpriteEffects.FlipHorizontally | SpriteEffects.FlipVertically : SpriteEffects.FlipVertically); + pivot4 = new Vector2((float) ((num2 >> 1) - (num2 >> 1) * (int) this.direction), (float) SpriteSheet<_sheetSprites>.src[id].Height); + SpriteSheet<_sheetSprites>.Draw(id, ref pos, alpha, this.itemRotation, ref pivot4, objPtr->scale, e2); + if ((int) objPtr->color.PackedValue != 0) + SpriteSheet<_sheetSprites>.Draw(id, ref pos, objPtr->GetColor(color), this.itemRotation, ref pivot4, objPtr->scale, e2); + } + } + } + } + pos.X = (float) (this.aabb.X - drawView.screenPosition.X + 10); + pos.Y = (float) (this.aabb.Y - drawView.screenPosition.Y + 42 - 28 + 4); + pos.X += this.bodyPosition.X; + pos.Y += this.bodyPosition.Y; + if ((int) this.body > 0 && (int) this.body < 29) + { + SpriteSheet<_sheetSprites>.DrawRotated(4 + (int) this.body, ref pos, (int) this.bodyFrameY, 54, newColor2, this.bodyRotation, ref pivot2, e1); + if (this.invis || ((int) this.body < 10 || (int) this.body > 16) && (int) this.body != 20) + return; + SpriteSheet<_sheetSprites>.DrawRotated(1341, ref pos, (int) this.bodyFrameY, 54, newColor12, this.bodyRotation, ref pivot2, e1); + } + else + { + if (this.invis) + return; + if (!this.male) + { + SpriteSheet<_sheetSprites>.DrawRotated(253, ref pos, (int) this.bodyFrameY, 54, newColor6, this.bodyRotation, ref pivot2, e1); + SpriteSheet<_sheetSprites>.DrawRotated(250, ref pos, (int) this.bodyFrameY, 54, newColor5, this.bodyRotation, ref pivot2, e1); + } + else + SpriteSheet<_sheetSprites>.DrawRotated(1347, ref pos, (int) this.bodyFrameY, 54, newColor6, this.bodyRotation, ref pivot2, e1); + SpriteSheet<_sheetSprites>.DrawRotated(1341, ref pos, (int) this.bodyFrameY, 54, newColor12, this.bodyRotation, ref pivot2, e1); + } + } + + public void DrawGhost(WorldView drawView) + { + this.aabb.X = (int) this.position.X; + this.aabb.Y = (int) this.position.Y; + SpriteEffects e = (int) this.direction == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + int num = ((int) UI.mouseTextBrightness >> 1) + 100; + Color immuneAlpha = this.GetImmuneAlpha(drawView.lighting.GetColorPlayer(this.aabb.X + 10 >> 4, this.aabb.Y + 21 >> 4, new Color(num, num, num, num))); + int sh = SpriteSheet<_sheetSprites>.src[(int) byte.MaxValue].Height >> 2; + Vector2 pos = new Vector2((float) (this.aabb.X - drawView.screenPosition.X), (float) (this.aabb.Y - drawView.screenPosition.Y)); + SpriteSheet<_sheetSprites>.Draw((int) byte.MaxValue, ref pos, sh * ((int) this.ghostFrameCounter >> 3 & 3), sh, immuneAlpha, e); + } + + public Item armorSwap(ref Item newItem) + { + int index1 = 0; + for (int index2 = 0; index2 < this.armor.Length; ++index2) + { + if ((int) newItem.netID == (int) this.armor[index2].netID) + index1 = index2; + } + Item obj1 = newItem; + Item obj2; + if ((int) newItem.headSlot != -1) + { + int index2 = newItem.vanity ? 8 : 0; + obj2 = this.armor[index2]; + this.armor[index2] = newItem; + } + else if ((int) newItem.bodySlot != -1) + { + int index2 = newItem.vanity ? 9 : 1; + obj2 = this.armor[index2]; + this.armor[index2] = newItem; + } + else if ((int) newItem.legSlot != -1) + { + int index2 = newItem.vanity ? 10 : 2; + obj2 = this.armor[index2]; + this.armor[index2] = newItem; + } + else + { + for (int index2 = 3; index2 < 8; ++index2) + { + if ((int) this.armor[index2].type == 0) + { + index1 = index2; + break; + } + } + for (int index2 = 0; index2 < this.armor.Length; ++index2) + { + if ((int) newItem.netID == (int) this.armor[index2].netID) + index1 = index2; + } + if (index1 >= 8) + index1 = 3; + else if (index1 < 3) + index1 = 7; + obj2 = this.armor[index1]; + this.armor[index1] = newItem; + } + Main.PlaySound(7); + return obj2; + } + + public int CountInventory(int netID) + { + int num = 0; + for (int index = 47; index >= 0; --index) + { + if ((int) this.inventory[index].netID == netID) + num += (int) this.inventory[index].stack; + } + return num; + } + + public int CountEquipment(int netID) + { + int num = 0; + for (int index = 10; index >= 0; --index) + { + if ((int) this.armor[index].netID == netID) + num += (int) this.inventory[index].stack; + } + return num; + } + + public int CountPossession(int netID) + { + return this.CountInventory(netID) + this.CountEquipment(netID); + } + + public bool IsNearCraftingStation(Recipe r) + { + for (int index = (int) r.numRequiredTiles - 1; index >= 0; --index) + { + if (!this.adjTile[(int) r.requiredTile[index]].i) + return false; + } + if (!this.adjWater) + return !r.needWater; + else + return true; + } + + public bool CanCraftRecipe(Recipe r) + { + if (Main.tutorialState < Tutorial.CRAFT_TORCH || Main.tutorialState == Tutorial.CRAFT_TORCH && (int) r.createItem.type != 8) + return false; + for (int index1 = (int) r.numRequiredItems - 1; index1 >= 0; --index1) + { + int num = (int) r.requiredItem[index1].stack; + for (int index2 = 47; index2 >= 0; --index2) + { + if ((int) this.inventory[index2].netID == (int) r.requiredItem[index1].netID) + { + num -= (int) this.inventory[index2].stack; + if (num <= 0) + break; + } + } + if (num > 0) + return false; + } + return this.IsNearCraftingStation(r); + } + + public bool DiscoveredRecipe(Recipe r) + { + for (int index = (int) r.numRequiredItems - 1; index >= 0; --index) + { + if (!this.itemsFound.Get((int) r.requiredItem[index].type)) + return false; + } + for (int index = (int) r.numRequiredTiles - 1; index >= 0; --index) + { + if (!this.craftingStationsFound.Get((int) r.requiredTile[index])) + return false; + } + return true; + } + + public void UpdateRecipes() + { + for (int index = 341; index >= 0; --index) + { + if (!this.recipesFound.Get(index) && this.DiscoveredRecipe(Main.recipe[index])) + { + this.recipesFound.Set(index, true); + this.recipesNew.Set(index, true); + } + } + } + + private void ApplyPetBuff(int itemType) + { + if ((int) this.pet >= 0) + { + int num = (int) Projectile.petProj[(int) this.pet]; + for (int index = 0; index < 512; ++index) + { + if ((int) Main.projectile[index].type == num && (int) Main.projectile[index].active != 0 && (int) Main.projectile[index].owner == (int) this.whoAmI) + { + Main.projectile[index].Kill(); + break; + } + } + if (itemType == (int) Projectile.petItem[(int) this.pet]) + { + this.DelBuff(Buff.ID.PET); + return; + } + } + int index1 = Projectile.petItem.Length - 1; + while (index1 >= 0 && itemType != (int) Projectile.petItem[index1]) + --index1; + this.pet = (sbyte) index1; + this.ui.petSpawnMask |= (byte) (1 << index1); + if ((int) this.ui.petSpawnMask == 63) + this.ui.SetTriggerState(Trigger.SpawnedAllPets); + this.AddBuff(40, 3600, true); + } + + private void SpawnPet() + { + int Type = (int) Projectile.petProj[(int) this.pet]; + for (int index = 0; index < 512; ++index) + { + if ((int) Main.projectile[index].type == Type && (int) Main.projectile[index].active != 0 && (int) Main.projectile[index].owner == (int) this.whoAmI) + return; + } + Projectile.NewProjectile(this.position.X + 10f, this.position.Y + 21f, 0.0f, 0.0f, Type, 0, 0.0f, (int) this.whoAmI, true); + } + + public void AchievementTrigger(Trigger trigger) + { + if (this.isLocal()) + { + this.ui.SetTriggerState(trigger); + } + else + { + NetMessage.CreateMessage2(64, (int) this.whoAmI, (int) trigger); + NetMessage.SendMessage(this.client); + } + } + + public void IncreaseStatistic(StatisticEntry entry) + { + if (entry == StatisticEntry.Unknown) + return; + if (this.isLocal()) + { + this.ui.Statistics.incStat(entry); + } + else + { + if (this.client == null) + return; + NetMessage.CreateMessage2(65, (int) this.whoAmI, (int) entry); + NetMessage.SendMessage(this.client); + } + } + + public void SunMoonTransition(bool wasBloodMoon) + { + ++this.totalSunMoonTransitions; + if (!Main.gameTime.dayTime || this.totalSunMoonTransitions < 2U) + return; + this.AchievementTrigger(Trigger.Sunrise); + if (!wasBloodMoon) + return; + this.AchievementTrigger(Trigger.SunriseAfterBloodMoon); + } + + private void FoundCraftingStation(int type) + { + if (!this.ui.TriggerCheckEnabled(Trigger.UsedAllCraftingStations)) + return; + this.craftingStationsFound.Set(type, true); + if (!this.craftingStationsFound.Get(133) || !this.craftingStationsFound.Get(134) || (!this.craftingStationsFound.Get(101) || !this.craftingStationsFound.Get(114)) || (!this.craftingStationsFound.Get(106) || !this.craftingStationsFound.Get(96) || (!this.craftingStationsFound.Get(94) || !this.craftingStationsFound.Get(86))) || (!this.craftingStationsFound.Get(26) || !this.craftingStationsFound.Get(13) || (!this.craftingStationsFound.Get(15) || !this.craftingStationsFound.Get(18)))) + return; + this.ui.SetTriggerState(Trigger.UsedAllCraftingStations); + } + + private void IncreaseSteps() + { + if (this.ui == null) + return; + if ((int) ++this.ui.totalSteps == 42000) + this.ui.SetTriggerState(Trigger.Walked42KM); + StatisticEntry entry = StatisticEntry.GroundTravel; + if (this.wet) + entry = this.lavaWet ? StatisticEntry.LavaTravel : StatisticEntry.WaterTravel; + this.ui.Statistics.incStat(entry); + } + + private void IncreaseAirTime() + { + if (this.ui == null) + return; + ++this.ui.currentAirTime; + if (this.ui.currentAirTime < 60U) + return; + if ((int) this.ui.currentAirTime == 60) + this.ui.totalAirTime += 60U; + else + ++this.ui.totalAirTime; + if (this.ui.totalAirTime >= 216000U) + this.ui.SetTriggerState(Trigger.InTheSky); + this.ui.airTravel += this.velocity.Length(); + if ((double) this.ui.airTravel <= 20.0) + return; + this.ui.airTravel -= 20f; + this.ui.Statistics.incStat(StatisticEntry.AirTravel); + } + + private void ResetAirTime() + { + if (this.ui == null) + return; + this.ui.currentAirTime = 0U; + } + + public static void buffColor(ref Color newColor, double R, double G, double B) + { + newColor.R = (byte) ((double) newColor.R * R); + newColor.G = (byte) ((double) newColor.G * G); + newColor.B = (byte) ((double) newColor.B * B); + } + + public void updateScreenPosition() + { + this.view.screenPosition.X = this.aabb.X + 10 - ((int) this.view.viewWidth >> 1); + this.view.screenPosition.Y = this.aabb.Y + 21 - 270; + } + + public bool isLocal() + { + return this.view != null; + } + + public void DrawInfo(WorldView view) + { + int x = this.aabb.X + 10 - view.screenPosition.X; + int y = this.aabb.Y + 42 - view.screenPosition.Y; + int num1 = (int) UI.DrawStringCT(UI.fontSmallOutline, this.name, x, y, Main.teamColor[(int) this.team]); + int num2 = (int) this.statLife - (int) this.healthBarLife; + if (num2 != 0) + { + if (Math.Abs(num2) > 1) + this.healthBarLife += (short) (num2 >> 2); + else + this.healthBarLife = this.statLife; + } + Rectangle rect = new Rectangle(); + rect.X = x - 22; + rect.Y = y + num1 - 2; + rect.Height = 10; + rect.Width = 52; + Color color = UI.WINDOW_OUTLINE; + Main.DrawRect(rect, color, false); + rect.X += 2; + rect.Y += 2; + rect.Width = (int) this.healthBarLife * 48 / (int) this.statLifeMax; + rect.Height = 6; + color = new Color((48 - rect.Width) * 5, rect.Width * 5, 16, 128); + Main.DrawSolidRect(ref rect, color); + if (rect.Width >= 48) + return; + color = new Color(0, 0, 0, 128); + rect.X += rect.Width; + rect.Width = 48 - rect.Width; + Main.DrawSolidRect(ref rect, color); + } + + public struct Adj + { + public bool i; + public bool old; + } + + public enum ExtraStorage + { + SAFE = -3, + PIGGYBANK = -2, + NONE = -1, + } + } +} diff --git a/Terraria/Program.cs b/Terraria/Program.cs new file mode 100644 index 0000000..413ef5f --- /dev/null +++ b/Terraria/Program.cs @@ -0,0 +1,44 @@ +// Type: Terraria.Program +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using System; +using System.IO; +using System.Runtime.InteropServices; +using System.Threading; + +namespace Terraria +{ + internal static class Program + { + private static void Main(string[] args) + { + Marshal.PrelinkAll(typeof (Main)); + ThreadPool.SetMinThreads(0, 0); + ThreadPool.SetMaxThreads(0, 0); + using (Main main = new Main()) + { + try + { + main.Run(); + } + catch (Exception ex) + { + try + { + using (StreamWriter streamWriter = new StreamWriter("client-crashlog.txt", true)) + { + streamWriter.WriteLine((object) DateTime.Now); + streamWriter.WriteLine((object) ex); + streamWriter.WriteLine(""); + } + } + catch + { + } + } + } + } + } +} diff --git a/Terraria/Projectile.cs b/Terraria/Projectile.cs new file mode 100644 index 0000000..c40db65 --- /dev/null +++ b/Terraria/Projectile.cs @@ -0,0 +1,5988 @@ +// Type: Terraria.Projectile +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Net; +using System; + +namespace Terraria +{ + public struct Projectile + { + private static byte[] projFrameH = new byte[120]; + public static readonly byte[] petProj = new byte[6] + { + (byte) 111, + (byte) 115, + (byte) 116, + (byte) 117, + (byte) 118, + (byte) 119 + }; + private static readonly Projectile.PetAnim[] petAnimIdle = new Projectile.PetAnim[6] + { + new Projectile.PetAnim(0, 0, (int) byte.MaxValue), + new Projectile.PetAnim(0, 1, 24), + new Projectile.PetAnim(0, 2, 2), + new Projectile.PetAnim(0, 4, 4), + new Projectile.PetAnim(0, 0, (int) byte.MaxValue), + new Projectile.PetAnim(0, 0, (int) byte.MaxValue) + }; + private static readonly Projectile.PetAnim[] petAnimMove = new Projectile.PetAnim[6] + { + new Projectile.PetAnim(0, 6, 6), + new Projectile.PetAnim(0, 1, 14), + new Projectile.PetAnim(0, 2, 1), + new Projectile.PetAnim(0, 4, 3), + new Projectile.PetAnim(2, 15, 4), + new Projectile.PetAnim(0, 2, 14) + }; + private static readonly Projectile.PetAnim[] petAnimFall = new Projectile.PetAnim[6] + { + new Projectile.PetAnim(4, 4, (int) byte.MaxValue), + new Projectile.PetAnim(1, 1, (int) byte.MaxValue), + new Projectile.PetAnim(0, 2, 1), + new Projectile.PetAnim(0, 4, 3), + new Projectile.PetAnim(1, 1, (int) byte.MaxValue), + new Projectile.PetAnim(2, 2, (int) byte.MaxValue) + }; + private static readonly Projectile.PetAnim[] petAnimJump = new Projectile.PetAnim[6] + { + new Projectile.PetAnim(6, 6, (int) byte.MaxValue), + new Projectile.PetAnim(1, 1, (int) byte.MaxValue), + new Projectile.PetAnim(0, 2, 1), + new Projectile.PetAnim(0, 4, 3), + new Projectile.PetAnim(1, 1, (int) byte.MaxValue), + new Projectile.PetAnim(2, 2, (int) byte.MaxValue) + }; + private static readonly Projectile.PetAnim[] petAnimFly = new Projectile.PetAnim[6] + { + new Projectile.PetAnim(7, 7, (int) byte.MaxValue), + new Projectile.PetAnim(1, 1, (int) byte.MaxValue), + new Projectile.PetAnim(0, 2, 1), + new Projectile.PetAnim(0, 4, 3), + new Projectile.PetAnim(8, 8, (int) byte.MaxValue), + new Projectile.PetAnim(1, 1, (int) byte.MaxValue) + }; + public static readonly short[] petItem = new short[6] + { + (short) 603, + (short) 621, + (short) 622, + (short) 623, + (short) 624, + (short) 625 + }; + private static uint lastProjectileIndex = 0U; + public static uint tombstoneTextIndex = 0U; + public static string[] tombstoneText = new string[IntPtr(8)]; + public const int MAX_PROJECTILE_TYPES = 120; + public const int MAX_PROJECTILES = 512; + public const int NUM_OLD_POS = 10; + public const uint TOMBSTONE_TEXT_QUEUE = 8U; + public byte active; + public byte type; + public bool wet; + public bool lavaWet; + public bool hostile; + public bool friendly; + public bool tileCollide; + public bool ignoreWater; + public bool hide; + public bool ownerHitCheck; + public bool melee; + public bool ranged; + public bool magic; + public byte maxUpdates; + public sbyte numUpdates; + public byte wetCount; + public byte alpha; + public byte aiStyle; + public sbyte direction; + public sbyte spriteDirection; + public sbyte penetrate; + public byte owner; + public ushort width; + public ushort height; + public short whoAmI; + public Rectangle aabb; + public float knockBack; + public float light; + public Vector2 position; + public Vector2 lastPosition; + public Vector2 velocity; + public float scale; + public float rotation; + public float ai0; + public int ai1; + public int timeLeft; + public short soundDelay; + public short damage; + public ushort identity; + public bool netUpdate; + private sbyte localAI0; + public byte tombstoneTextId; + public byte frameCounter; + public byte frame; + public unsafe fixed sbyte playerImmune[8]; + public unsafe fixed float oldPos[20]; + + static Projectile() + { + } + + public static void Initialize() + { + for (int index = 1; index < 120; ++index) + Projectile.projFrameH[index] = (byte) 0; + Projectile.projFrameH[72] = (byte) (SpriteSheet<_sheetSprites>.src[1421].Height / 4); + Projectile.projFrameH[86] = (byte) (SpriteSheet<_sheetSprites>.src[1435].Height / 4); + Projectile.projFrameH[87] = (byte) (SpriteSheet<_sheetSprites>.src[1436].Height / 4); + Projectile.projFrameH[102] = (byte) (SpriteSheet<_sheetSprites>.src[1451].Height / 2); + Projectile.projFrameH[111] = (byte) (SpriteSheet<_sheetSprites>.src[1460].Height / 8); + Projectile.projFrameH[115] = (byte) (SpriteSheet<_sheetSprites>.src[1464].Height / 2); + Projectile.projFrameH[116] = (byte) (SpriteSheet<_sheetSprites>.src[1465].Height / 3); + Projectile.projFrameH[117] = (byte) (SpriteSheet<_sheetSprites>.src[1466].Height / 5); + Projectile.projFrameH[118] = (byte) (SpriteSheet<_sheetSprites>.src[1467].Height / 16); + Projectile.projFrameH[119] = (byte) (SpriteSheet<_sheetSprites>.src[1468].Height / 3); + } + + public void Init() + { + this.active = (byte) 0; + this.type = (byte) 0; + this.direction = this.spriteDirection = (sbyte) 1; + } + + public bool isLocal() + { + if ((int) this.owner != 8 || Main.netMode == 1) + return Main.player[(int) this.owner].isLocal(); + else + return true; + } + + public unsafe void SetDefaults(int Type) + { + this.ai0 = 0.0f; + this.ai1 = 0; + this.localAI0 = (sbyte) 0; + // ISSUE: reference to a compiler-generated field + fixed (sbyte* numPtr = &this.playerImmune.FixedElementField) + { + for (int index = 0; index < 8; ++index) + numPtr[index] = (sbyte) 0; + } + this.soundDelay = (short) 0; + this.spriteDirection = (sbyte) 1; + this.melee = false; + this.ranged = false; + this.magic = false; + this.ownerHitCheck = false; + this.hide = false; + this.lavaWet = false; + this.wetCount = (byte) 0; + this.wet = false; + this.ignoreWater = false; + this.hostile = false; + this.netUpdate = false; + this.numUpdates = (sbyte) 0; + this.maxUpdates = (byte) 0; + this.identity = (ushort) 0; + this.light = 0.0f; + this.penetrate = (sbyte) 1; + this.tileCollide = true; + this.position = new Vector2(); + this.velocity = new Vector2(); + this.aiStyle = (byte) 0; + this.alpha = (byte) 0; + this.type = (byte) Type; + this.active = (byte) 1; + this.rotation = 0.0f; + this.scale = 1f; + this.owner = (byte) 8; + this.timeLeft = 3600; + this.friendly = true; + this.damage = (short) 0; + this.knockBack = 0.0f; + if ((int) this.type == 1) + { + this.width = (ushort) 10; + this.height = (ushort) 10; + this.aiStyle = (byte) 1; + this.ranged = true; + } + else if ((int) this.type == 2) + { + this.width = (ushort) 10; + this.height = (ushort) 10; + this.aiStyle = (byte) 1; + this.light = 1f; + this.ranged = true; + } + else if ((int) this.type == 3) + { + this.width = (ushort) 22; + this.height = (ushort) 22; + this.aiStyle = (byte) 2; + this.penetrate = (sbyte) 4; + this.ranged = true; + } + else if ((int) this.type == 4) + { + this.width = (ushort) 10; + this.height = (ushort) 10; + this.aiStyle = (byte) 1; + this.light = 0.35f; + this.penetrate = (sbyte) 5; + this.ranged = true; + } + else if ((int) this.type == 5) + { + this.width = (ushort) 10; + this.height = (ushort) 10; + this.aiStyle = (byte) 1; + this.light = 0.4f; + this.penetrate = (sbyte) -1; + this.timeLeft = 40; + this.alpha = (byte) 100; + this.ignoreWater = true; + this.ranged = true; + } + else if ((int) this.type == 6) + { + this.width = (ushort) 22; + this.height = (ushort) 22; + this.aiStyle = (byte) 3; + this.penetrate = (sbyte) -1; + this.melee = true; + this.light = 0.4f; + } + else if ((int) this.type == 7 || (int) this.type == 8) + { + this.width = (ushort) 28; + this.height = (ushort) 28; + this.aiStyle = (byte) 4; + this.penetrate = (sbyte) -1; + this.tileCollide = false; + this.alpha = byte.MaxValue; + this.ignoreWater = true; + this.magic = true; + } + else if ((int) this.type == 9) + { + this.width = (ushort) 24; + this.height = (ushort) 24; + this.aiStyle = (byte) 5; + this.penetrate = (sbyte) 2; + this.alpha = (byte) 50; + this.scale = 0.8f; + this.tileCollide = false; + this.magic = true; + } + else if ((int) this.type == 10) + { + this.width = (ushort) 64; + this.height = (ushort) 64; + this.aiStyle = (byte) 6; + this.tileCollide = false; + this.penetrate = (sbyte) -1; + this.alpha = byte.MaxValue; + this.ignoreWater = true; + } + else if ((int) this.type == 11) + { + this.width = (ushort) 48; + this.height = (ushort) 48; + this.aiStyle = (byte) 6; + this.tileCollide = false; + this.penetrate = (sbyte) -1; + this.alpha = byte.MaxValue; + this.ignoreWater = true; + } + else if ((int) this.type == 12) + { + this.width = (ushort) 16; + this.height = (ushort) 16; + this.aiStyle = (byte) 5; + this.penetrate = (sbyte) -1; + this.alpha = (byte) 50; + this.light = 1f; + } + else if ((int) this.type == 13) + { + this.width = (ushort) 18; + this.height = (ushort) 18; + this.aiStyle = (byte) 7; + this.penetrate = (sbyte) -1; + this.tileCollide = false; + this.timeLeft *= 10; + } + else if ((int) this.type == 14) + { + this.width = (ushort) 4; + this.height = (ushort) 4; + this.aiStyle = (byte) 1; + this.penetrate = (sbyte) 1; + this.light = 0.5f; + this.alpha = byte.MaxValue; + this.maxUpdates = (byte) 1; + this.scale = 1.2f; + this.timeLeft = 600; + this.ranged = true; + } + else if ((int) this.type == 15) + { + this.width = (ushort) 16; + this.height = (ushort) 16; + this.aiStyle = (byte) 8; + this.light = 0.8f; + this.alpha = (byte) 100; + this.magic = true; + } + else if ((int) this.type == 16) + { + this.width = (ushort) 10; + this.height = (ushort) 10; + this.aiStyle = (byte) 9; + this.light = 0.8f; + this.alpha = (byte) 100; + this.magic = true; + } + else if ((int) this.type == 17) + { + this.width = (ushort) 10; + this.height = (ushort) 10; + this.aiStyle = (byte) 10; + } + else if ((int) this.type == 18) + { + this.width = (ushort) 32; + this.height = (ushort) 32; + this.aiStyle = (byte) 11; + this.light = 0.45f; + this.alpha = (byte) 150; + this.tileCollide = false; + this.penetrate = (sbyte) -1; + this.timeLeft = 18000; + this.ignoreWater = true; + this.scale = 0.8f; + } + else if ((int) this.type == 19) + { + this.width = (ushort) 22; + this.height = (ushort) 22; + this.aiStyle = (byte) 3; + this.penetrate = (sbyte) -1; + this.light = 1f; + this.melee = true; + } + else if ((int) this.type == 20) + { + this.width = (ushort) 4; + this.height = (ushort) 4; + this.aiStyle = (byte) 1; + this.penetrate = (sbyte) 3; + this.light = 0.75f; + this.alpha = byte.MaxValue; + this.maxUpdates = (byte) 2; + this.scale = 1.4f; + this.timeLeft = 600; + this.magic = true; + } + else if ((int) this.type == 21) + { + this.width = (ushort) 16; + this.height = (ushort) 16; + this.aiStyle = (byte) 2; + this.scale = 1.2f; + this.ranged = true; + } + else if ((int) this.type == 22) + { + this.width = (ushort) 18; + this.height = (ushort) 18; + this.aiStyle = (byte) 12; + this.alpha = byte.MaxValue; + this.penetrate = (sbyte) -1; + this.maxUpdates = (byte) 2; + this.ignoreWater = true; + this.magic = true; + } + else if ((int) this.type == 23) + { + this.width = (ushort) 4; + this.height = (ushort) 4; + this.aiStyle = (byte) 13; + this.penetrate = (sbyte) -1; + this.alpha = byte.MaxValue; + this.ranged = true; + } + else if ((int) this.type == 24) + { + this.width = (ushort) 14; + this.height = (ushort) 14; + this.aiStyle = (byte) 14; + this.penetrate = (sbyte) 6; + this.ranged = true; + } + else if ((int) this.type == 25) + { + this.width = (ushort) 22; + this.height = (ushort) 22; + this.aiStyle = (byte) 15; + this.penetrate = (sbyte) -1; + this.melee = true; + this.scale = 0.8f; + } + else if ((int) this.type == 26) + { + this.width = (ushort) 22; + this.height = (ushort) 22; + this.aiStyle = (byte) 15; + this.penetrate = (sbyte) -1; + this.melee = true; + this.scale = 0.8f; + } + else if ((int) this.type == 27) + { + this.width = (ushort) 16; + this.height = (ushort) 16; + this.aiStyle = (byte) 8; + this.light = 0.8f; + this.alpha = (byte) 200; + this.timeLeft = 1800; + this.penetrate = (sbyte) 10; + this.magic = true; + } + else if ((int) this.type == 28) + { + this.width = (ushort) 22; + this.height = (ushort) 22; + this.aiStyle = (byte) 16; + this.penetrate = (sbyte) -1; + } + else if ((int) this.type == 29) + { + this.width = (ushort) 10; + this.height = (ushort) 10; + this.aiStyle = (byte) 16; + this.penetrate = (sbyte) -1; + } + else if ((int) this.type == 30) + { + this.width = (ushort) 14; + this.height = (ushort) 14; + this.aiStyle = (byte) 16; + this.penetrate = (sbyte) -1; + this.ranged = true; + } + else if ((int) this.type == 31) + { + this.knockBack = 6f; + this.width = (ushort) 10; + this.height = (ushort) 10; + this.aiStyle = (byte) 10; + this.hostile = true; + this.penetrate = (sbyte) -1; + } + else if ((int) this.type == 32) + { + this.width = (ushort) 18; + this.height = (ushort) 18; + this.aiStyle = (byte) 7; + this.penetrate = (sbyte) -1; + this.tileCollide = false; + this.timeLeft = 36000; + } + else if ((int) this.type == 33) + { + this.width = (ushort) 28; + this.height = (ushort) 28; + this.aiStyle = (byte) 3; + this.scale = 0.9f; + this.penetrate = (sbyte) -1; + this.melee = true; + } + else if ((int) this.type == 34) + { + this.width = (ushort) 14; + this.height = (ushort) 14; + this.aiStyle = (byte) 9; + this.light = 0.8f; + this.alpha = (byte) 100; + this.penetrate = (sbyte) 1; + this.magic = true; + } + else if ((int) this.type == 35) + { + this.width = (ushort) 22; + this.height = (ushort) 22; + this.aiStyle = (byte) 15; + this.penetrate = (sbyte) -1; + this.melee = true; + this.scale = 0.8f; + } + else if ((int) this.type == 36) + { + this.width = (ushort) 4; + this.height = (ushort) 4; + this.aiStyle = (byte) 1; + this.penetrate = (sbyte) 2; + this.light = 0.6f; + this.alpha = byte.MaxValue; + this.maxUpdates = (byte) 1; + this.scale = 1.4f; + this.timeLeft = 600; + this.ranged = true; + } + else if ((int) this.type == 37) + { + this.width = (ushort) 22; + this.height = (ushort) 22; + this.aiStyle = (byte) 16; + this.penetrate = (sbyte) -1; + this.tileCollide = false; + } + else if ((int) this.type == 38) + { + this.width = (ushort) 14; + this.height = (ushort) 14; + this.aiStyle = (byte) 0; + this.hostile = true; + this.penetrate = (sbyte) -1; + this.aiStyle = (byte) 1; + this.tileCollide = true; + this.friendly = false; + } + else if ((int) this.type == 39) + { + this.knockBack = 6f; + this.width = (ushort) 10; + this.height = (ushort) 10; + this.aiStyle = (byte) 10; + this.hostile = true; + this.penetrate = (sbyte) -1; + } + else if ((int) this.type == 40) + { + this.knockBack = 6f; + this.width = (ushort) 10; + this.height = (ushort) 10; + this.aiStyle = (byte) 10; + this.hostile = true; + this.penetrate = (sbyte) -1; + } + else if ((int) this.type == 41) + { + this.width = (ushort) 10; + this.height = (ushort) 10; + this.aiStyle = (byte) 1; + this.penetrate = (sbyte) -1; + this.ranged = true; + this.light = 0.3f; + } + else if ((int) this.type == 114) + { + this.width = (ushort) 10; + this.height = (ushort) 10; + this.aiStyle = (byte) 1; + this.penetrate = (sbyte) -1; + this.ranged = true; + this.light = 0.4f; + } + else if ((int) this.type == 42) + { + this.knockBack = 8f; + this.width = (ushort) 10; + this.height = (ushort) 10; + this.aiStyle = (byte) 10; + this.maxUpdates = (byte) 1; + } + else if ((int) this.type == 43) + { + this.knockBack = 12f; + this.width = (ushort) 24; + this.height = (ushort) 24; + this.aiStyle = (byte) 17; + this.penetrate = (sbyte) -1; + this.friendly = false; + } + else if ((int) this.type == 44) + { + this.width = (ushort) 48; + this.height = (ushort) 48; + this.alpha = (byte) 100; + this.light = 0.2f; + this.aiStyle = (byte) 18; + this.hostile = true; + this.penetrate = (sbyte) -1; + this.tileCollide = true; + this.scale = 0.9f; + this.friendly = false; + } + else if ((int) this.type == 45) + { + this.width = (ushort) 48; + this.height = (ushort) 48; + this.alpha = (byte) 100; + this.light = 0.2f; + this.aiStyle = (byte) 18; + this.penetrate = (sbyte) 5; + this.tileCollide = true; + this.scale = 0.9f; + this.magic = true; + } + else if ((int) this.type == 46) + { + this.width = (ushort) 20; + this.height = (ushort) 20; + this.aiStyle = (byte) 19; + this.penetrate = (sbyte) -1; + this.tileCollide = false; + this.scale = 1.1f; + this.hide = true; + this.ownerHitCheck = true; + this.melee = true; + } + else if ((int) this.type == 47) + { + this.width = (ushort) 18; + this.height = (ushort) 18; + this.aiStyle = (byte) 19; + this.penetrate = (sbyte) -1; + this.tileCollide = false; + this.scale = 1.1f; + this.hide = true; + this.ownerHitCheck = true; + this.melee = true; + } + else if ((int) this.type == 48) + { + this.width = (ushort) 12; + this.height = (ushort) 12; + this.aiStyle = (byte) 2; + this.penetrate = (sbyte) 2; + this.ranged = true; + } + else if ((int) this.type == 49) + { + this.width = (ushort) 18; + this.height = (ushort) 18; + this.aiStyle = (byte) 19; + this.penetrate = (sbyte) -1; + this.tileCollide = false; + this.scale = 1.2f; + this.hide = true; + this.ownerHitCheck = true; + this.melee = true; + } + else if ((int) this.type == 50) + { + this.width = (ushort) 6; + this.height = (ushort) 6; + this.aiStyle = (byte) 14; + this.penetrate = (sbyte) -1; + this.alpha = (byte) 75; + this.light = 1f; + this.timeLeft = 18000; + this.friendly = false; + } + else if ((int) this.type == 51) + { + this.width = (ushort) 8; + this.height = (ushort) 8; + this.aiStyle = (byte) 1; + } + else if ((int) this.type == 52) + { + this.width = (ushort) 22; + this.height = (ushort) 22; + this.aiStyle = (byte) 3; + this.penetrate = (sbyte) -1; + this.melee = true; + } + else if ((int) this.type == 53) + { + this.width = (ushort) 6; + this.height = (ushort) 6; + this.aiStyle = (byte) 14; + this.penetrate = (sbyte) -1; + this.alpha = (byte) 75; + this.light = 1f; + this.timeLeft = 18000; + this.tileCollide = false; + this.friendly = false; + } + else if ((int) this.type == 54) + { + this.width = (ushort) 12; + this.height = (ushort) 12; + this.aiStyle = (byte) 2; + this.penetrate = (sbyte) 2; + this.ranged = true; + } + else if ((int) this.type == 55) + { + this.width = (ushort) 10; + this.height = (ushort) 10; + this.aiStyle = (byte) 0; + this.hostile = true; + this.friendly = false; + this.penetrate = (sbyte) -1; + this.aiStyle = (byte) 1; + this.tileCollide = true; + } + else if ((int) this.type == 56) + { + this.knockBack = 6f; + this.width = (ushort) 10; + this.height = (ushort) 10; + this.aiStyle = (byte) 10; + this.hostile = true; + this.penetrate = (sbyte) -1; + } + else if ((int) this.type == 57) + { + this.width = (ushort) 18; + this.height = (ushort) 18; + this.aiStyle = (byte) 20; + this.penetrate = (sbyte) -1; + this.tileCollide = false; + this.hide = true; + this.ownerHitCheck = true; + this.melee = true; + } + else if ((int) this.type == 58) + { + this.width = (ushort) 18; + this.height = (ushort) 18; + this.aiStyle = (byte) 20; + this.penetrate = (sbyte) -1; + this.tileCollide = false; + this.hide = true; + this.ownerHitCheck = true; + this.melee = true; + this.scale = 1.08f; + } + else if ((int) this.type == 59) + { + this.width = (ushort) 22; + this.height = (ushort) 22; + this.aiStyle = (byte) 20; + this.penetrate = (sbyte) -1; + this.tileCollide = false; + this.hide = true; + this.ownerHitCheck = true; + this.melee = true; + this.scale = 0.9f; + } + else if ((int) this.type == 60) + { + this.width = (ushort) 22; + this.height = (ushort) 22; + this.aiStyle = (byte) 20; + this.penetrate = (sbyte) -1; + this.tileCollide = false; + this.hide = true; + this.ownerHitCheck = true; + this.melee = true; + this.scale = 0.9f; + } + else if ((int) this.type == 61) + { + this.width = (ushort) 18; + this.height = (ushort) 18; + this.aiStyle = (byte) 20; + this.penetrate = (sbyte) -1; + this.tileCollide = false; + this.hide = true; + this.ownerHitCheck = true; + this.melee = true; + this.scale = 1.16f; + } + else if ((int) this.type == 62) + { + this.width = (ushort) 22; + this.height = (ushort) 22; + this.aiStyle = (byte) 20; + this.penetrate = (sbyte) -1; + this.tileCollide = false; + this.hide = true; + this.ownerHitCheck = true; + this.melee = true; + this.scale = 0.9f; + } + else if ((int) this.type == 63) + { + this.width = (ushort) 22; + this.height = (ushort) 22; + this.aiStyle = (byte) 15; + this.penetrate = (sbyte) -1; + this.melee = true; + } + else if ((int) this.type == 64) + { + this.width = (ushort) 18; + this.height = (ushort) 18; + this.aiStyle = (byte) 19; + this.penetrate = (sbyte) -1; + this.tileCollide = false; + this.scale = 1.25f; + this.hide = true; + this.ownerHitCheck = true; + this.melee = true; + } + else if ((int) this.type == 65) + { + this.knockBack = 6f; + this.width = (ushort) 10; + this.height = (ushort) 10; + this.aiStyle = (byte) 10; + this.penetrate = (sbyte) -1; + this.maxUpdates = (byte) 1; + } + else if ((int) this.type == 66) + { + this.width = (ushort) 18; + this.height = (ushort) 18; + this.aiStyle = (byte) 19; + this.penetrate = (sbyte) -1; + this.tileCollide = false; + this.scale = 1.27f; + this.hide = true; + this.ownerHitCheck = true; + this.melee = true; + } + else if ((int) this.type == 67) + { + this.knockBack = 6f; + this.width = (ushort) 10; + this.height = (ushort) 10; + this.aiStyle = (byte) 10; + this.hostile = true; + this.penetrate = (sbyte) -1; + } + else if ((int) this.type == 68) + { + this.knockBack = 6f; + this.width = (ushort) 10; + this.height = (ushort) 10; + this.aiStyle = (byte) 10; + this.penetrate = (sbyte) -1; + this.maxUpdates = (byte) 1; + } + else if ((int) this.type == 69) + { + this.width = (ushort) 14; + this.height = (ushort) 14; + this.aiStyle = (byte) 2; + this.penetrate = (sbyte) 1; + } + else if ((int) this.type == 70) + { + this.width = (ushort) 14; + this.height = (ushort) 14; + this.aiStyle = (byte) 2; + this.penetrate = (sbyte) 1; + } + else if ((int) this.type == 71) + { + this.knockBack = 6f; + this.width = (ushort) 10; + this.height = (ushort) 10; + this.aiStyle = (byte) 10; + this.hostile = true; + this.penetrate = (sbyte) -1; + } + else if ((int) this.type == 72) + { + this.width = (ushort) 18; + this.height = (ushort) 18; + this.aiStyle = (byte) 27; + this.light = 0.9f; + this.tileCollide = false; + this.penetrate = (sbyte) -1; + this.timeLeft = 18000; + this.ignoreWater = true; + this.scale = 0.8f; + } + else if ((int) this.type == 73 || (int) this.type == 74) + { + this.width = (ushort) 18; + this.height = (ushort) 18; + this.aiStyle = (byte) 7; + this.penetrate = (sbyte) -1; + this.tileCollide = false; + this.timeLeft = 36000; + this.light = 0.4f; + } + else if ((int) this.type == 75) + { + this.width = (ushort) 22; + this.height = (ushort) 22; + this.aiStyle = (byte) 16; + this.hostile = true; + this.friendly = false; + this.penetrate = (sbyte) -1; + } + else if ((int) this.type == 76 || (int) this.type == 77 || (int) this.type == 78) + { + if ((int) this.type == 76) + { + this.width = (ushort) 10; + this.height = (ushort) 22; + } + else if ((int) this.type == 77) + { + this.width = (ushort) 18; + this.height = (ushort) 24; + } + else + { + this.width = (ushort) 22; + this.height = (ushort) 24; + } + this.aiStyle = (byte) 21; + this.ranged = true; + this.alpha = (byte) 100; + this.light = 0.3f; + this.penetrate = (sbyte) -1; + this.timeLeft = 180; + } + else if ((int) this.type == 79) + { + this.width = (ushort) 10; + this.height = (ushort) 10; + this.aiStyle = (byte) 9; + this.light = 0.8f; + this.alpha = byte.MaxValue; + this.magic = true; + } + else if ((int) this.type == 80) + { + this.width = (ushort) 16; + this.height = (ushort) 16; + this.aiStyle = (byte) 22; + this.magic = true; + this.tileCollide = false; + this.light = 0.5f; + } + else if ((int) this.type == 81) + { + this.width = (ushort) 10; + this.height = (ushort) 10; + this.aiStyle = (byte) 1; + this.hostile = true; + this.friendly = false; + this.ranged = true; + } + else if ((int) this.type == 82) + { + this.width = (ushort) 10; + this.height = (ushort) 10; + this.aiStyle = (byte) 1; + this.hostile = true; + this.friendly = false; + this.ranged = true; + } + else if ((int) this.type == 83) + { + this.width = (ushort) 4; + this.height = (ushort) 4; + this.aiStyle = (byte) 1; + this.hostile = true; + this.friendly = false; + this.penetrate = (sbyte) 3; + this.light = 0.75f; + this.alpha = byte.MaxValue; + this.maxUpdates = (byte) 2; + this.scale = 1.7f; + this.timeLeft = 600; + this.magic = true; + } + else if ((int) this.type == 84) + { + this.width = (ushort) 4; + this.height = (ushort) 4; + this.aiStyle = (byte) 1; + this.hostile = true; + this.friendly = false; + this.penetrate = (sbyte) 3; + this.light = 0.75f; + this.alpha = byte.MaxValue; + this.maxUpdates = (byte) 2; + this.scale = 1.2f; + this.timeLeft = 600; + this.magic = true; + } + else if ((int) this.type == 85) + { + this.width = (ushort) 6; + this.height = (ushort) 6; + this.aiStyle = (byte) 23; + this.alpha = byte.MaxValue; + this.penetrate = (sbyte) 3; + this.maxUpdates = (byte) 2; + this.magic = true; + } + else if ((int) this.type == 86) + { + this.width = (ushort) 18; + this.height = (ushort) 18; + this.aiStyle = (byte) 27; + this.light = 0.9f; + this.tileCollide = false; + this.penetrate = (sbyte) -1; + this.timeLeft = 18000; + this.ignoreWater = true; + this.scale = 0.8f; + } + else if ((int) this.type == 87) + { + this.width = (ushort) 18; + this.height = (ushort) 18; + this.aiStyle = (byte) 27; + this.light = 0.9f; + this.tileCollide = false; + this.penetrate = (sbyte) -1; + this.timeLeft = 18000; + this.ignoreWater = true; + this.scale = 0.8f; + } + else if ((int) this.type == 88) + { + this.width = (ushort) 6; + this.height = (ushort) 6; + this.aiStyle = (byte) 1; + this.penetrate = (sbyte) 3; + this.light = 0.75f; + this.alpha = byte.MaxValue; + this.maxUpdates = (byte) 4; + this.scale = 1.4f; + this.timeLeft = 600; + this.magic = true; + } + else if ((int) this.type == 89) + { + this.width = (ushort) 4; + this.height = (ushort) 4; + this.aiStyle = (byte) 1; + this.penetrate = (sbyte) 1; + this.light = 0.5f; + this.alpha = byte.MaxValue; + this.maxUpdates = (byte) 1; + this.scale = 1.2f; + this.timeLeft = 600; + this.ranged = true; + } + else if ((int) this.type == 90) + { + this.width = (ushort) 6; + this.height = (ushort) 6; + this.aiStyle = (byte) 24; + this.penetrate = (sbyte) 1; + this.light = 0.5f; + this.alpha = (byte) 50; + this.scale = 1.2f; + this.timeLeft = 600; + this.ranged = true; + this.tileCollide = false; + } + else if ((int) this.type == 91) + { + this.width = (ushort) 10; + this.height = (ushort) 10; + this.aiStyle = (byte) 1; + this.ranged = true; + } + else if ((int) this.type == 92) + { + this.width = (ushort) 24; + this.height = (ushort) 24; + this.aiStyle = (byte) 5; + this.penetrate = (sbyte) 2; + this.alpha = (byte) 50; + this.scale = 0.8f; + this.tileCollide = false; + this.magic = true; + } + else if ((int) this.type == 93) + { + this.light = 0.15f; + this.width = (ushort) 12; + this.height = (ushort) 12; + this.aiStyle = (byte) 2; + this.penetrate = (sbyte) 2; + this.magic = true; + } + else if ((int) this.type == 94) + { + this.ignoreWater = true; + this.width = (ushort) 8; + this.height = (ushort) 8; + this.aiStyle = (byte) 24; + this.light = 0.5f; + this.alpha = (byte) 50; + this.scale = 1.2f; + this.timeLeft = 600; + this.magic = true; + this.tileCollide = true; + this.penetrate = (sbyte) 1; + // ISSUE: reference to a compiler-generated field + fixed (float* numPtr = &this.oldPos.FixedElementField) + { + for (int index = 19; index >= 0; --index) + numPtr[index] = 0.0f; + } + } + else if ((int) this.type == 95) + { + this.width = (ushort) 16; + this.height = (ushort) 16; + this.aiStyle = (byte) 8; + this.light = 0.8f; + this.alpha = (byte) 100; + this.magic = true; + this.penetrate = (sbyte) 2; + } + else if ((int) this.type == 96) + { + this.width = (ushort) 16; + this.height = (ushort) 16; + this.aiStyle = (byte) 8; + this.hostile = true; + this.friendly = false; + this.light = 0.8f; + this.alpha = (byte) 100; + this.magic = true; + this.penetrate = (sbyte) -1; + this.scale = 0.9f; + this.scale = 1.3f; + } + else if ((int) this.type == 97) + { + this.width = (ushort) 18; + this.height = (ushort) 18; + this.aiStyle = (byte) 19; + this.penetrate = (sbyte) -1; + this.tileCollide = false; + this.scale = 1.1f; + this.hide = true; + this.ownerHitCheck = true; + this.melee = true; + } + else if ((int) this.type == 98) + { + this.width = (ushort) 10; + this.height = (ushort) 10; + this.aiStyle = (byte) 1; + this.hostile = true; + this.ranged = true; + this.penetrate = (sbyte) -1; + } + else if ((int) this.type == 99) + { + this.width = (ushort) 31; + this.height = (ushort) 31; + this.aiStyle = (byte) 25; + this.hostile = true; + this.ranged = true; + this.penetrate = (sbyte) -1; + } + else if ((int) this.type == 100) + { + this.width = (ushort) 4; + this.height = (ushort) 4; + this.aiStyle = (byte) 1; + this.hostile = true; + this.friendly = false; + this.penetrate = (sbyte) 3; + this.light = 0.75f; + this.alpha = byte.MaxValue; + this.maxUpdates = (byte) 2; + this.scale = 1.8f; + this.timeLeft = 1200; + this.magic = true; + } + else if ((int) this.type == 101) + { + this.width = (ushort) 6; + this.height = (ushort) 6; + this.aiStyle = (byte) 23; + this.hostile = true; + this.friendly = false; + this.alpha = byte.MaxValue; + this.penetrate = (sbyte) -1; + this.maxUpdates = (byte) 3; + this.magic = true; + } + else if ((int) this.type == 102) + { + this.width = (ushort) 22; + this.height = (ushort) 22; + this.aiStyle = (byte) 16; + this.hostile = true; + this.friendly = false; + this.penetrate = (sbyte) -1; + this.ranged = true; + } + else if ((int) this.type == 103) + { + this.width = (ushort) 10; + this.height = (ushort) 10; + this.aiStyle = (byte) 1; + this.light = 1f; + this.ranged = true; + } + else if ((int) this.type == 113) + { + this.width = (ushort) 10; + this.height = (ushort) 10; + this.aiStyle = (byte) 1; + this.light = 1f; + this.ranged = true; + } + else if ((int) this.type == 104) + { + this.width = (ushort) 4; + this.height = (ushort) 4; + this.aiStyle = (byte) 1; + this.penetrate = (sbyte) 1; + this.light = 0.5f; + this.alpha = byte.MaxValue; + this.maxUpdates = (byte) 1; + this.scale = 1.2f; + this.timeLeft = 600; + this.ranged = true; + } + else if ((int) this.type == 105) + { + this.width = (ushort) 18; + this.height = (ushort) 18; + this.aiStyle = (byte) 19; + this.penetrate = (sbyte) -1; + this.tileCollide = false; + this.scale = 1.3f; + this.hide = true; + this.ownerHitCheck = true; + this.melee = true; + } + else if ((int) this.type == 112) + { + this.width = (ushort) 18; + this.height = (ushort) 18; + this.aiStyle = (byte) 19; + this.penetrate = (sbyte) -1; + this.tileCollide = false; + this.scale = 1.3f; + this.hide = true; + this.ownerHitCheck = true; + this.melee = true; + } + else if ((int) this.type == 106) + { + this.width = (ushort) 32; + this.height = (ushort) 32; + this.aiStyle = (byte) 3; + this.penetrate = (sbyte) -1; + this.melee = true; + this.light = 0.4f; + } + else if ((int) this.type == 107) + { + this.width = (ushort) 22; + this.height = (ushort) 22; + this.aiStyle = (byte) 20; + this.penetrate = (sbyte) -1; + this.tileCollide = false; + this.hide = true; + this.ownerHitCheck = true; + this.melee = true; + this.scale = 1.1f; + } + else if ((int) this.type == 108) + { + this.width = (ushort) 260; + this.height = (ushort) 260; + this.aiStyle = (byte) 16; + this.hostile = true; + this.penetrate = (sbyte) -1; + this.tileCollide = false; + this.alpha = byte.MaxValue; + this.timeLeft = 2; + } + else if ((int) this.type == 109) + { + this.knockBack = 6f; + this.width = (ushort) 10; + this.height = (ushort) 10; + this.aiStyle = (byte) 10; + this.hostile = true; + this.friendly = false; + this.scale = 0.9f; + this.penetrate = (sbyte) -1; + } + else if ((int) this.type == 110) + { + this.width = (ushort) 4; + this.height = (ushort) 4; + this.aiStyle = (byte) 1; + this.hostile = true; + this.friendly = false; + this.penetrate = (sbyte) -1; + this.light = 0.5f; + this.alpha = byte.MaxValue; + this.maxUpdates = (byte) 1; + this.scale = 1.2f; + this.timeLeft = 600; + this.ranged = true; + } + else if ((int) this.type == 111) + { + this.width = (ushort) 18; + this.height = (ushort) 18; + this.aiStyle = (byte) 26; + this.penetrate = (sbyte) -1; + this.timeLeft = 18000; + } + else if ((int) this.type == 115) + { + this.width = (ushort) 18; + this.height = (ushort) 10; + this.aiStyle = (byte) 26; + this.penetrate = (sbyte) -1; + this.timeLeft = 18000; + this.localAI0 = (sbyte) 1; + } + else if ((int) this.type == 116) + { + this.width = (ushort) 12; + this.height = (ushort) 72; + this.scale = 0.5f; + this.aiStyle = (byte) 28; + this.penetrate = (sbyte) -1; + this.timeLeft = 18000; + this.damage = (short) 2; + this.localAI0 = (sbyte) 2; + } + else if ((int) this.type == 117) + { + this.width = (ushort) 16; + this.height = (ushort) 48; + this.aiStyle = (byte) 28; + this.penetrate = (sbyte) -1; + this.timeLeft = 18000; + this.damage = (short) 4; + this.localAI0 = (sbyte) 3; + } + else if ((int) this.type == 118) + { + this.width = (ushort) 18; + this.height = (ushort) 26; + this.aiStyle = (byte) 26; + this.penetrate = (sbyte) -1; + this.timeLeft = 18000; + this.damage = (short) 10; + this.localAI0 = (sbyte) 4; + } + else if ((int) this.type == 119) + { + this.width = (ushort) 18; + this.height = (ushort) 24; + this.aiStyle = (byte) 26; + this.penetrate = (sbyte) -1; + this.timeLeft = 18000; + this.damage = (short) 8; + this.localAI0 = (sbyte) 5; + } + else + this.active = (byte) 0; + this.width = (ushort) ((double) this.width * (double) this.scale); + this.height = (ushort) ((double) this.height * (double) this.scale); + this.aabb.Width = (int) this.width; + this.aabb.Height = (int) this.height; + } + + public static unsafe int NewProjectile(float X, float Y, float SpeedX, float SpeedY, int Type, int Damage, float KnockBack, int Owner = 8, bool send = true) + { + for (int index = 0; index < 512; ++index) + { + uint num = Projectile.lastProjectileIndex++ & 511U; + fixed (Projectile* projectilePtr = &Main.projectile[(IntPtr) num]) + { + if ((int) projectilePtr->active == 0) + { + projectilePtr->SetDefaults(Type); + projectilePtr->position.X = X - (float) ((int) projectilePtr->width >> 1); + projectilePtr->position.Y = Y - (float) ((int) projectilePtr->height >> 1); + projectilePtr->aabb.X = (int) projectilePtr->position.X; + projectilePtr->aabb.Y = (int) projectilePtr->position.Y; + projectilePtr->owner = (byte) Owner; + projectilePtr->velocity.X = SpeedX; + projectilePtr->velocity.Y = SpeedY; + if (Damage != 0) + projectilePtr->damage = (short) Damage; + projectilePtr->knockBack = KnockBack; + projectilePtr->identity = (ushort) index; + projectilePtr->wet = Collision.WetCollision(ref projectilePtr->position, (int) projectilePtr->width, (int) projectilePtr->height); + if (projectilePtr->isLocal()) + { + if (Type == 29) + projectilePtr->timeLeft = 300; + else if (Type == 28 || Type == 30 || (Type == 37 || Type == 75)) + projectilePtr->timeLeft = 180; + if (send) + NetMessage.SendProjectile((int) num, SendDataOptions.Reliable); + } + return (int) num; + } + else + { + // ISSUE: __unpin statement + __unpin(projectilePtr); + } + } + } + return -1; + } + + public unsafe int NewClonedProjectile(int newType) + { + for (int index = 0; index < 512; ++index) + { + uint num = Projectile.lastProjectileIndex++ & 511U; + fixed (Projectile* projectilePtr = &Main.projectile[(IntPtr) num]) + { + if ((int) projectilePtr->active == 0) + { + projectilePtr->SetDefaults(newType); + projectilePtr->position = this.position; + projectilePtr->aabb.X = (int) this.position.X; + projectilePtr->aabb.Y = (int) this.position.Y; + projectilePtr->owner = this.owner; + projectilePtr->velocity = this.velocity; + projectilePtr->damage = this.damage; + projectilePtr->knockBack = this.knockBack; + projectilePtr->identity = (ushort) index; + projectilePtr->wet = this.wet; + if (projectilePtr->isLocal()) + { + if (newType == 29) + projectilePtr->timeLeft = 300; + else if (newType == 28 || newType == 30 || (newType == 37 || newType == 75)) + projectilePtr->timeLeft = 180; + } + return (int) num; + } + else + { + // ISSUE: __unpin statement + __unpin(projectilePtr); + } + } + } + return -1; + } + + public unsafe void Damage() + { + if ((int) this.type == 18 || (int) this.type == 72 || ((int) this.type == 86 || (int) this.type == 87) || ((int) this.type == 111 || (int) this.type == 115)) + return; + Rectangle rectangle1 = this.aabb; + if ((int) this.type == 85 || (int) this.type == 101) + { + rectangle1.X -= 30; + rectangle1.Y -= 30; + rectangle1.Width += 60; + rectangle1.Height += 60; + } + if (this.friendly && this.isLocal()) + { + if (((int) this.aiStyle == 16 || (int) this.type == 41 || (int) this.type == 114) && (this.timeLeft <= 1 || (int) this.type == 108)) + { + Player player = Main.player[(int) this.owner]; + if ((int) player.active != 0 && !player.dead && (!player.immune && rectangle1.Intersects(player.aabb))) + { + this.direction = player.aabb.X + 10 >= this.aabb.X + ((int) this.width >> 1) ? (sbyte) 1 : (sbyte) -1; + int num = Main.DamageVar((int) this.damage); + player.ApplyProjectileBuff((int) this.type); + player.Hurt(num, (int) this.direction, true, false, Lang.deathMsg((int) this.owner, 0, (int) this.type, -1), false); + NetMessage.SendPlayerHurt((int) player.whoAmI, (int) this.direction, num, true, false, Lang.deathMsg((int) this.owner, 0, (int) this.type, -1)); + } + } + if ((int) this.type < 116 && (int) this.type != 69 && ((int) this.type != 70 && (int) this.type != 10) && (int) this.type != 11) + { + int num1 = this.aabb.X >> 4; + int num2 = (this.aabb.X + (int) this.width >> 4) + 1; + int num3 = this.aabb.Y >> 4; + int num4 = (this.aabb.Y + (int) this.height >> 4) + 1; + if (num1 < 0) + num1 = 0; + if (num2 > (int) Main.maxTilesX) + num2 = (int) Main.maxTilesX; + if (num3 < 0) + num3 = 0; + if (num4 > (int) Main.maxTilesY) + num4 = (int) Main.maxTilesY; + for (int index1 = num1; index1 < num2; ++index1) + { + for (int index2 = num3; index2 < num4; ++index2) + { + if (Main.tileCut[(int) Main.tile[index1, index2].type] && (int) Main.tile[index1, index2 + 1].type != 78) + { + WorldGen.KillTile(index1, index2); + NetMessage.CreateMessage5(17, 0, index1, index2, 0, 0); + NetMessage.SendMessage(); + } + } + } + } + } + if (this.isLocal()) + { + Player player = Main.player[(int) this.owner]; + if ((int) this.damage > 0) + { + for (int npcId = 0; npcId < 196; ++npcId) + { + NPC npc = Main.npc[npcId]; + if ((int) npc.active != 0 && !npc.dontTakeDamage && (this.friendly && (!npc.friendly || (int) npc.type == 22 && player.killGuide) || npc.friendly && this.hostile) && ((int) npc.immune[(int) this.owner] == 0 && ((int) this.type != 11 || (int) npc.type != 47 && (int) npc.type != 57) && (((int) this.type != 31 || (int) npc.type != 69) && (npc.noTileCollide || !this.ownerHitCheck || Collision.CanHit(ref player.aabb, ref npc.aabb))) && rectangle1.Intersects(npc.aabb))) + { + if ((int) this.aiStyle == 3) + { + if ((double) this.ai0 == 0.0) + { + this.velocity.X = -this.velocity.X; + this.velocity.Y = -this.velocity.Y; + this.netUpdate = true; + } + this.ai0 = 1f; + } + else if ((int) this.aiStyle == 16) + { + if (this.timeLeft > 3) + this.timeLeft = 3; + this.direction = npc.aabb.X + ((int) npc.width >> 1) >= this.aabb.X + ((int) this.width >> 1) ? (sbyte) 1 : (sbyte) -1; + } + if (((int) this.type == 41 || (int) this.type == 114) && this.timeLeft > 1) + this.timeLeft = 1; + bool flag = false; + if (this.melee && Main.rand.Next(1, 101) <= (int) player.meleeCrit) + flag = true; + else if (this.ranged && Main.rand.Next(1, 101) <= (int) player.rangedCrit) + flag = true; + else if (this.magic && Main.rand.Next(1, 101) <= (int) player.magicCrit) + flag = true; + int num = Main.DamageVar((int) this.damage); + npc.ApplyProjectileBuff((int) this.type); + npc.StrikeNPC(num, this.knockBack, (int) this.direction, flag, false); + NetMessage.SendNpcHurt(npcId, num, (double) this.knockBack, (int) this.direction, flag); + if ((int) npc.active == 0 && player.ui != null) + { + StatisticEntry statisticEntryFromNetId = Statistics.GetStatisticEntryFromNetID(npc.netID); + player.ui.Statistics.incStat(statisticEntryFromNetId); + } + if ((int) this.penetrate != 1) + npc.immune[(int) this.owner] = (byte) 10; + if ((int) this.penetrate <= 0 || (int) --this.penetrate != 0) + { + if ((int) this.aiStyle == 7) + { + this.ai0 = 1f; + this.damage = (short) 0; + this.netUpdate = true; + } + else if ((int) this.aiStyle == 13) + { + this.ai0 = 1f; + this.netUpdate = true; + } + } + else + break; + } + } + if (player.hostile) + { + for (int playerId = 0; playerId < 8; ++playerId) + { + if (playerId != (int) this.owner && (int) Main.player[playerId].active != 0 && (!Main.player[playerId].dead && !Main.player[playerId].immune) && Main.player[playerId].hostile) + { + // ISSUE: reference to a compiler-generated field + fixed (sbyte* numPtr1 = &this.playerImmune.FixedElementField) + { + if ((int) numPtr1[playerId] <= 0) + { + // ISSUE: __unpin statement + __unpin(numPtr1); + if (((int) player.team == 0 || (int) player.team != (int) Main.player[playerId].team) && (!this.ownerHitCheck || Collision.CanHit(ref player.aabb, ref Main.player[playerId].aabb)) && rectangle1.Intersects(Main.player[playerId].aabb)) + { + if ((int) this.aiStyle == 3) + { + if ((double) this.ai0 == 0.0) + { + this.velocity.X = -this.velocity.X; + this.velocity.Y = -this.velocity.Y; + this.netUpdate = true; + } + this.ai0 = 1f; + } + else if ((int) this.aiStyle == 16) + { + if (this.timeLeft > 3) + this.timeLeft = 3; + this.direction = Main.player[playerId].aabb.X + 10 >= this.aabb.X + ((int) this.width >> 1) ? (sbyte) 1 : (sbyte) -1; + } + if (((int) this.type == 41 || (int) this.type == 114) && this.timeLeft > 1) + this.timeLeft = 1; + bool flag = false; + if (this.melee && Main.rand.Next(1, 101) <= (int) player.meleeCrit) + flag = true; + int num = Main.DamageVar((int) this.damage); + if (!Main.player[playerId].immune) + Main.player[playerId].ApplyProjectileBuffPvP((int) this.type); + Main.player[playerId].Hurt(num, (int) this.direction, true, false, Lang.deathMsg((int) this.owner, 0, (int) this.type, -1), flag); + NetMessage.SendPlayerHurt(playerId, (int) this.direction, num, true, flag, Lang.deathMsg((int) this.owner, 0, (int) this.type, -1)); + // ISSUE: reference to a compiler-generated field + fixed (sbyte* numPtr2 = &this.playerImmune.FixedElementField) + numPtr2[playerId] = (sbyte) 40; + if ((int) this.penetrate <= 0 || (int) --this.penetrate != 0) + { + if ((int) this.aiStyle == 7) + { + this.ai0 = 1f; + this.damage = (short) 0; + this.netUpdate = true; + } + else if ((int) this.aiStyle == 13) + { + this.ai0 = 1f; + this.netUpdate = true; + } + } + else + break; + } + } + } + } + } + } + } + } + if ((int) this.type == 11 && Main.netMode != 1) + { + for (int index = 0; index < 196; ++index) + { + if ((int) Main.npc[index].active != 0) + { + if ((int) Main.npc[index].type == 46) + { + if (rectangle1.Intersects(Main.npc[index].aabb)) + Main.npc[index].Transform(47); + } + else if ((int) Main.npc[index].type == 55 && rectangle1.Intersects(Main.npc[index].aabb)) + Main.npc[index].Transform(57); + } + } + } + if (!this.hostile || (int) this.damage <= 0) + return; + for (int index = 0; index < 8; ++index) + { + Player player = Main.player[index]; + if (player.isLocal() && (int) player.active != 0 && (!player.dead && !player.immune)) + { + Rectangle rectangle2 = new Rectangle((int) player.position.X, (int) player.position.Y, 20, 42); + if (rectangle1.Intersects(rectangle2)) + { + int num1 = (int) this.direction; + int hitDirection = player.aabb.X + 10 >= this.aabb.X + ((int) this.width >> 1) ? 1 : -1; + int num2 = Main.DamageVar((int) this.damage); + if (!player.immune) + player.ApplyProjectileBuff((int) this.type); + player.Hurt(num2 * 2, hitDirection, false, false, Lang.deathMsg(-1, 0, (int) this.type, -1), false); + } + } + } + } + + public unsafe void Update(int i) + { + if (this.aabb.X <= 0 || this.aabb.X + (int) this.width >= Main.rightWorld || (this.aabb.Y <= 0 || this.aabb.Y + (int) this.height >= Main.bottomWorld)) + { + this.active = (byte) 0; + } + else + { + this.whoAmI = (short) i; + do + { + if ((int) this.soundDelay > 0) + --this.soundDelay; + this.netUpdate = false; + // ISSUE: reference to a compiler-generated field + fixed (sbyte* numPtr = &this.playerImmune.FixedElementField) + { + for (int index = 0; index < 8; ++index) + { + if ((int) numPtr[index] > 0) + { + IntPtr num1 = (IntPtr) (numPtr + index); + int num2 = (int) (sbyte) ((int) *(sbyte*) num1 - 1); + *(sbyte*) num1 = (sbyte) num2; + } + } + } + switch (this.aiStyle) + { + case (byte) 1: + this.ArrowAI(); + break; + case (byte) 2: + this.ShurikenAI(); + break; + case (byte) 3: + this.BoomerangAI(); + break; + case (byte) 4: + this.VilethornAI(); + break; + case (byte) 5: + this.StarfuryAI(); + break; + case (byte) 6: + this.PowderAI(); + break; + case (byte) 7: + this.GrapplingAI(); + break; + case (byte) 8: + this.BallOfFireAI(); + break; + case (byte) 9: + this.MagicMissileAI(); + break; + case (byte) 10: + this.DirtBallAI(); + break; + case (byte) 11: + this.OrbOfLightAI(); + break; + case (byte) 12: + this.BlueFlameAI(); + break; + case (byte) 13: + this.HarpoonAI(); + break; + case (byte) 14: + this.SpikyBallAI(); + break; + case (byte) 15: + this.FlailAI(); + break; + case (byte) 16: + this.BombAI(); + break; + case (byte) 17: + this.TombstoneAI(); + break; + case (byte) 18: + this.DemonSickleAI(); + break; + case (byte) 19: + this.SpearAI(); + break; + case (byte) 20: + this.ChainsawAI(); + break; + case (byte) 21: + this.NoteAI(); + break; + case (byte) 22: + this.IceBlockAI(); + break; + case (byte) 23: + this.FlameAI(); + break; + case (byte) 24: + this.CrystalShardAI(); + break; + case (byte) 25: + this.BoulderAI(); + break; + case (byte) 26: + this.PetAI(); + break; + case (byte) 27: + this.FairyAI(); + break; + case (byte) 28: + this.FlyingPetAI(); + break; + } + if ((int) this.owner < 8 && (int) Main.player[(int) this.owner].active == 0) + this.Kill(); + if (!this.ignoreWater) + { + bool flag1; + bool flag2; + try + { + flag1 = Collision.LavaCollision(ref this.position, (int) this.width, (int) this.height); + flag2 = Collision.WetCollision(ref this.position, (int) this.width, (int) this.height); + if (flag1) + this.lavaWet = true; + } + catch + { + this.active = (byte) 0; + return; + } + if (this.wet && !this.lavaWet) + { + if ((int) this.type == 85 || (int) this.type == 15 || (int) this.type == 34) + this.Kill(); + else if ((int) this.type == 2 || (int) this.type == 82) + { + --this.type; + this.light = 0.0f; + } + } + if ((int) this.type == 80) + { + this.wet = false; + if (flag1 && (double) this.ai0 >= 0.0) + this.Kill(); + } + else if (flag2) + { + if ((int) this.wetCount == 0) + { + this.wetCount = (byte) 10; + if (!this.wet) + { + this.wet = true; + Main.PlaySound(19, this.aabb.X, this.aabb.Y, 1); + if (!flag1) + { + for (int index = 0; index < 8; ++index) + { + Dust* dustPtr = Main.dust.NewDust(this.aabb.X - 6, this.aabb.Y + ((int) this.height >> 1) - 8, (int) this.width + 12, 24, 33, 0.0, 0.0, 0, new Color(), 1.0); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.Y -= 4f; + dustPtr->velocity.X *= 2.5f; + dustPtr->scale = 1.3f; + dustPtr->alpha = (short) 100; + dustPtr->noGravity = true; + } + else + break; + } + } + else + { + for (int index = 0; index < 8; ++index) + { + Dust* dustPtr = Main.dust.NewDust(this.aabb.X - 6, this.aabb.Y + ((int) this.height >> 1) - 8, (int) this.width + 12, 24, 35, 0.0, 0.0, 0, new Color(), 1.0); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.Y -= 1.5f; + dustPtr->velocity.X *= 2.5f; + dustPtr->scale = 1.3f; + dustPtr->alpha = (short) 100; + dustPtr->noGravity = true; + } + else + break; + } + } + } + } + } + else if (this.wet) + { + this.wet = false; + if ((int) this.wetCount == 0) + { + this.wetCount = (byte) 10; + Main.PlaySound(19, this.aabb.X, this.aabb.Y, 1); + if (!this.lavaWet) + { + for (int index = 0; index < 8; ++index) + { + Dust* dustPtr = Main.dust.NewDust(this.aabb.X - 6, this.aabb.Y + ((int) this.height >> 1), (int) this.width + 12, 24, 33, 0.0, 0.0, 0, new Color(), 1.0); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.Y -= 4f; + dustPtr->velocity.X *= 2.5f; + dustPtr->scale = 1.3f; + dustPtr->alpha = (short) 100; + dustPtr->noGravity = true; + } + else + break; + } + } + else + { + for (int index = 0; index < 8; ++index) + { + Dust* dustPtr = Main.dust.NewDust(this.aabb.X - 6, this.aabb.Y + ((int) this.height >> 1) - 8, (int) this.width + 12, 24, 35, 0.0, 0.0, 0, new Color(), 1.0); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.Y -= 1.5f; + dustPtr->velocity.X *= 2.5f; + dustPtr->scale = 1.3f; + dustPtr->alpha = (short) 100; + dustPtr->noGravity = true; + } + else + break; + } + } + } + } + if (!this.wet) + this.lavaWet = false; + if ((int) this.wetCount > 0) + --this.wetCount; + } + this.lastPosition = this.position; + Vector2 vector2_1 = this.velocity; + if (this.tileCollide) + { + Vector2 vector2_2 = this.velocity; + bool flag1 = (int) this.type != 9 && (int) this.type != 12 && ((int) this.type != 15 && (int) this.type != 13) && ((int) this.type != 31 && (int) this.type != 39 && (int) this.type != 40) && (int) this.aiStyle != 26; + if ((int) this.aiStyle == 10) + { + if ((int) this.type == 42 || (int) this.type == 65 || (int) this.type == 68 || (int) this.type == 31 && (double) this.ai0 == 2.0) + Collision.TileCollision(ref this.position, ref this.velocity, (int) this.width, (int) this.height, flag1, flag1); + else + Collision.AnyCollision(ref this.position, ref this.velocity, (int) this.width, (int) this.height); + } + else if ((int) this.aiStyle == 18) + { + int Width = (int) this.width - 36; + int Height = (int) this.height - 36; + Vector2 Position = new Vector2(this.position.X + (float) ((int) this.width >> 1) - (float) (Width >> 1), this.position.Y + (float) ((int) this.height >> 1) - (float) (Height >> 1)); + Collision.TileCollision(ref Position, ref this.velocity, Width, Height, flag1, flag1); + } + else if (this.wet) + { + Vector2 vector2_3 = this.velocity; + Collision.TileCollision(ref this.position, ref this.velocity, (int) this.width, (int) this.height, flag1, flag1); + vector2_1 = this.velocity; + vector2_1.X *= 0.5f; + vector2_1.Y *= 0.5f; + if ((double) this.velocity.X != (double) vector2_3.X) + vector2_1.X = this.velocity.X; + if ((double) this.velocity.Y != (double) vector2_3.Y) + vector2_1.Y = this.velocity.Y; + } + else + Collision.TileCollision(ref this.position, ref this.velocity, (int) this.width, (int) this.height, flag1, flag1); + if (vector2_2 != this.velocity) + { + if ((int) this.type == 94) + { + if ((double) this.velocity.X != (double) vector2_2.X) + this.velocity.X = -vector2_2.X; + if ((double) this.velocity.Y != (double) vector2_2.Y) + this.velocity.Y = -vector2_2.Y; + } + else if ((int) this.type == 99) + { + if ((double) this.velocity.Y != (double) vector2_2.Y && (double) vector2_2.Y > 5.0) + { + Collision.HitTiles(this.position, this.velocity, (int) this.width, (int) this.height); + Main.PlaySound(0, this.aabb.X, this.aabb.Y, 1); + this.velocity.Y = (float) (-(double) vector2_2.Y * 0.200000002980232); + } + if ((double) this.velocity.X != (double) vector2_2.X) + this.Kill(); + } + else if ((int) this.type == 36) + { + if ((int) this.penetrate > 1) + { + Collision.HitTiles(this.position, this.velocity, (int) this.width, (int) this.height); + Main.PlaySound(2, this.aabb.X, this.aabb.Y, 10); + --this.penetrate; + if ((double) this.velocity.X != (double) vector2_2.X) + this.velocity.X = -vector2_2.X; + if ((double) this.velocity.Y != (double) vector2_2.Y) + this.velocity.Y = -vector2_2.Y; + } + else + this.Kill(); + } + else if ((int) this.aiStyle == 21) + { + if ((double) this.velocity.X != (double) vector2_2.X) + this.velocity.X = -vector2_2.X; + if ((double) this.velocity.Y != (double) vector2_2.Y) + this.velocity.Y = -vector2_2.Y; + } + else if ((int) this.aiStyle == 17) + { + if ((double) this.velocity.X != (double) vector2_2.X) + this.velocity.X = vector2_2.X * -0.75f; + if ((double) this.velocity.Y != (double) vector2_2.Y && (double) vector2_2.Y > 1.5) + this.velocity.Y = vector2_2.Y * -0.7f; + } + else if ((int) this.aiStyle == 15) + { + bool flag2 = false; + if ((double) vector2_2.X != (double) this.velocity.X) + { + if ((double) Math.Abs(vector2_2.X) > 4.0) + flag2 = true; + this.position.X += this.velocity.X; + this.velocity.X = (float) (-(double) vector2_2.X * 0.200000002980232); + } + if ((double) vector2_2.Y != (double) this.velocity.Y) + { + if ((double) Math.Abs(vector2_2.Y) > 4.0) + flag2 = true; + this.position.Y += this.velocity.Y; + this.velocity.Y = (float) (-(double) vector2_2.Y * 0.200000002980232); + } + this.ai0 = 1f; + if (flag2) + { + this.netUpdate = true; + Collision.HitTiles(this.position, this.velocity, (int) this.width, (int) this.height); + Main.PlaySound(0, this.aabb.X, this.aabb.Y, 1); + } + } + else if ((int) this.aiStyle == 3 || (int) this.aiStyle == 13) + { + Collision.HitTiles(this.position, this.velocity, (int) this.width, (int) this.height); + if ((int) this.type == 33 || (int) this.type == 106) + { + if ((double) this.velocity.X != (double) vector2_2.X) + this.velocity.X = -vector2_2.X; + if ((double) this.velocity.Y != (double) vector2_2.Y) + this.velocity.Y = -vector2_2.Y; + } + else + { + this.ai0 = 1f; + if ((int) this.aiStyle == 3) + { + this.velocity.X = -vector2_2.X; + this.velocity.Y = -vector2_2.Y; + } + } + this.netUpdate = true; + Main.PlaySound(0, this.aabb.X, this.aabb.Y, 1); + } + else if ((int) this.aiStyle == 8 && (int) this.type != 96) + { + Main.PlaySound(2, this.aabb.X, this.aabb.Y, 10); + ++this.ai0; + if ((double) this.ai0 >= 5.0) + { + this.position.X += this.velocity.X; + this.position.Y += this.velocity.Y; + this.Kill(); + } + else + { + if ((int) this.type == 15 && (double) this.velocity.Y > 4.0) + { + if ((double) this.velocity.Y != (double) vector2_2.Y) + this.velocity.Y = (float) (-(double) vector2_2.Y * 0.800000011920929); + } + else if ((double) this.velocity.Y != (double) vector2_2.Y) + this.velocity.Y = -vector2_2.Y; + if ((double) this.velocity.X != (double) vector2_2.X) + this.velocity.X = -vector2_2.X; + } + } + else if ((int) this.aiStyle == 14) + { + if ((int) this.type == 50) + { + if ((double) this.velocity.X != (double) vector2_2.X) + this.velocity.X = vector2_2.X * -0.2f; + if ((double) this.velocity.Y != (double) vector2_2.Y && (double) vector2_2.Y > 1.5) + this.velocity.Y = vector2_2.Y * -0.2f; + } + else + { + if ((double) this.velocity.X != (double) vector2_2.X) + this.velocity.X = vector2_2.X * -0.5f; + if ((double) this.velocity.Y != (double) vector2_2.Y && (double) vector2_2.Y > 1.0) + this.velocity.Y = vector2_2.Y * -0.5f; + } + } + else if ((int) this.aiStyle == 16) + { + if ((double) this.velocity.X != (double) vector2_2.X) + { + this.velocity.X = vector2_2.X * -0.4f; + if ((int) this.type == 29) + this.velocity.X *= 0.8f; + } + if ((double) this.velocity.Y != (double) vector2_2.Y && (double) vector2_2.Y > 0.7 && (int) this.type != 102) + { + this.velocity.Y = vector2_2.Y * -0.4f; + if ((int) this.type == 29) + this.velocity.Y *= 0.8f; + } + } + else if (((int) this.aiStyle != 9 || this.isLocal()) && (int) this.type != 111 && ((int) this.type < 115 || (int) this.type > 119)) + { + this.position.X += this.velocity.X; + this.position.Y += this.velocity.Y; + this.Kill(); + } + } + } + if ((int) this.type != 7 && (int) this.type != 8) + { + if (this.wet) + { + this.position.X += vector2_1.X; + this.position.Y += vector2_1.Y; + } + else + { + this.position.X += this.velocity.X; + this.position.Y += this.velocity.Y; + } + this.aabb.X = (int) this.position.X; + this.aabb.Y = (int) this.position.Y; + } + if (((int) this.aiStyle != 3 || (double) this.ai0 != 1.0) && ((int) this.aiStyle != 7 || (double) this.ai0 != 1.0) && (((int) this.aiStyle != 13 || (double) this.ai0 != 1.0) && ((int) this.aiStyle != 15 || (double) this.ai0 != 1.0)) && ((int) this.aiStyle != 15 && (int) this.aiStyle != 26)) + this.direction = (double) this.velocity.X < 0.0 ? (sbyte) -1 : (sbyte) 1; + if ((int) this.active == 0) + return; + if ((double) this.light > 0.0) + { + float x = this.light; + float y = this.light; + float z = this.light; + if ((int) this.type == 2 || (int) this.type == 82) + { + y *= 0.75f; + z *= 0.55f; + } + else if ((int) this.type == 94) + { + x *= 0.5f; + y = 0.0f; + } + else if ((int) this.type == 95 || (int) this.type == 96 || ((int) this.type == 103 || (int) this.type == 104)) + { + x *= 0.35f; + z = 0.0f; + } + else if ((int) this.type == 4) + { + y *= 0.1f; + x *= 0.5f; + } + else if ((int) this.type == 9) + { + y *= 0.1f; + z *= 0.6f; + } + else if ((int) this.type == 92) + { + y *= 0.6f; + x *= 0.8f; + } + else if ((int) this.type == 93) + { + y *= 1f; + x *= 1f; + z *= 0.01f; + } + else if ((int) this.type == 12) + { + x *= 0.9f; + y *= 0.8f; + z *= 0.1f; + } + else if ((int) this.type == 14 || (int) this.type == 110) + { + y *= 0.7f; + z *= 0.1f; + } + else if ((int) this.type == 15) + { + y *= 0.4f; + z *= 0.1f; + x = 1f; + } + else if ((int) this.type == 16) + { + x *= 0.1f; + y *= 0.4f; + z = 1f; + } + else if ((int) this.type == 113) + { + x *= 0.1f; + z = 1f; + } + else if ((int) this.type == 18) + { + y *= 0.7f; + z *= 0.3f; + } + else if ((int) this.type == 19) + { + y *= 0.5f; + z *= 0.1f; + } + else if ((int) this.type == 20) + { + x *= 0.1f; + z *= 0.3f; + } + else if ((int) this.type == 22) + { + x = 0.0f; + y = 0.0f; + } + else if ((int) this.type == 27) + { + x = 0.0f; + y *= 0.3f; + z = 1f; + } + else if ((int) this.type == 34) + { + y *= 0.1f; + z *= 0.1f; + } + else if ((int) this.type == 36) + { + x = 0.8f; + y *= 0.2f; + z *= 0.6f; + } + else if ((int) this.type == 41) + { + y *= 0.8f; + z *= 0.6f; + } + else if ((int) this.type == 114) + { + x = 1f; + y = 1f; + z *= 0.25f; + } + else if ((int) this.type == 44 || (int) this.type == 45) + { + z = 1f; + x *= 0.6f; + y *= 0.1f; + } + else if ((int) this.type == 50) + { + x *= 0.7f; + z *= 0.8f; + } + else if ((int) this.type == 53) + { + x *= 0.7f; + y *= 0.8f; + } + else if ((int) this.type == 72) + { + x *= 0.45f; + y *= 0.75f; + z = 1f; + } + else if ((int) this.type == 86) + { + y *= 0.45f; + z = 0.75f; + } + else if ((int) this.type == 87) + { + x *= 0.45f; + y = 1f; + z *= 0.75f; + } + else if ((int) this.type == 73) + { + x *= 0.4f; + y *= 0.6f; + } + else if ((int) this.type == 74) + { + y *= 0.4f; + z *= 0.6f; + } + else if ((int) this.type == 76 || (int) this.type == 77 || (int) this.type == 78) + { + y *= 0.3f; + z *= 0.6f; + } + else if ((int) this.type == 79) + { + x = Main.DiscoRGB.X; + y = Main.DiscoRGB.Y; + z = Main.DiscoRGB.Z; + } + else if ((int) this.type == 80) + { + x = 0.0f; + y *= 0.8f; + z *= 1f; + } + else if ((int) this.type == 83 || (int) this.type == 88) + { + x *= 0.7f; + y = 0.0f; + z *= 1f; + } + else if ((int) this.type == 100) + { + y *= 0.5f; + z = 0.0f; + } + else if ((int) this.type == 84) + { + x *= 0.8f; + y = 0.0f; + z *= 0.5f; + } + else if ((int) this.type == 89 || (int) this.type == 90) + { + y *= 0.2f; + x *= 0.05f; + } + else if ((int) this.type == 106) + { + x = 0.0f; + y *= 0.5f; + } + Lighting.addLight(this.aabb.X + ((int) this.width >> 1) >> 4, this.aabb.Y + ((int) this.height >> 1) >> 4, new Vector3(x, y, z)); + } + if (((int) Main.frameCounter & 1) == 1) + { + if ((int) this.type == 2 || (int) this.type == 82) + Main.dust.NewDust(6, ref this.aabb, 0.0, 0.0, 100, new Color(), 1.0); + else if ((int) this.type == 103) + { + Dust* dustPtr = Main.dust.NewDust(75, ref this.aabb, 0.0, 0.0, 100, new Color(), 1.0); + if (Main.rand.Next(2) == 0 && (IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->noGravity = true; + dustPtr->scale *= 2f; + } + } + else if ((int) this.type == 4) + { + if (Main.rand.Next(3) == 0) + Main.dust.NewDust(14, ref this.aabb, 0.0, 0.0, 150, new Color(), 1.10000002384186); + } + else if ((int) this.type == 5) + { + int num = Main.rand.Next(3); + int Type = num != 0 ? num + 56 : 15; + Main.dust.NewDust(Type, ref this.aabb, (double) this.velocity.X * 0.5, (double) this.velocity.Y * 0.5, 150, new Color(), 1.20000004768372); + } + } + this.Damage(); + if ((int) this.type == 99) + { + if (Main.netMode != 1) + Collision.SwitchTiles(this.position, (int) this.width, (int) this.height, this.lastPosition); + } + else if ((int) this.type == 94) + { + // ISSUE: reference to a compiler-generated field + fixed (float* numPtr = &this.oldPos.FixedElementField) + { + for (int index = 9; index > 0; --index) + ((Vector2*) numPtr)[index] = ((Vector2*) numPtr)[index - 1]; + *(Vector2*) numPtr = this.position; + } + } + if (--this.timeLeft <= 0) + { + this.Kill(); + goto label_284; + } + else if ((int) this.penetrate == 0) + { + this.Kill(); + goto label_284; + } + else if ((int) this.active != 0) + { + if (this.isLocal() && this.netUpdate) + NetMessage.SendProjectile(i, SendDataOptions.InOrder); + if ((int) this.maxUpdates <= 0) + goto label_284; + } + else + goto label_284; + } + while ((int) --this.numUpdates >= 0); + this.numUpdates = (sbyte) this.maxUpdates; +label_284: + this.netUpdate = false; + } + } + + private unsafe void PetAI() + { + Player player = Main.player[(int) this.owner]; + if (this.isLocal()) + { + if (player.dead) + player.pet = (sbyte) -1; + else if ((int) player.pet >= 0) + this.timeLeft = 2; + } + if ((int) player.rocketDelay2 > 0) + this.ai0 = 1f; + Vector2 vector2_1 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num1 = player.position.X + 10f - vector2_1.X; + float num2 = player.position.Y + 21f - vector2_1.Y; + float num3 = (float) Math.Sqrt((double) num1 * (double) num1 + (double) num2 * (double) num2); + if ((double) num3 > 2000.0) + { + this.position.X = player.position.X + 10f - (float) ((int) this.width >> 1); + this.position.Y = player.position.Y + 21f - (float) ((int) this.height >> 1); + this.aabb.X = (int) this.position.X; + this.aabb.Y = (int) this.position.Y; + } + else if ((double) num3 > 500.0 || (double) Math.Abs(num2) > 300.0) + { + this.ai0 = 1f; + if ((double) num2 > 0.0 && (double) this.velocity.Y < 0.0) + this.velocity.Y = 0.0f; + if ((double) num2 < 0.0 && (double) this.velocity.Y > 0.0) + this.velocity.Y = 0.0f; + } + if ((double) this.ai0 != 0.0) + { + this.tileCollide = false; + Vector2 vector2_2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num4 = player.position.X + 10f - vector2_2.X; + float num5 = player.position.Y + 21f - vector2_2.Y; + float num6 = (float) Math.Sqrt((double) num4 * (double) num4 + (double) num5 * (double) num5); + float num7 = 10f; + if ((double) num6 < 200.0 && (double) player.velocity.Y == 0.0 && (double) this.position.Y + (double) this.height <= (double) player.position.Y + 42.0) + { + Vector2 Velocity = this.velocity; + Collision.TileCollision(ref this.position, ref Velocity, (int) this.width, (int) this.height, false, false); + this.tileCollide = (double) this.velocity.X != (double) Velocity.X || (double) this.velocity.Y != (double) Velocity.Y; + if (!this.tileCollide) + { + this.ai0 = 0.0f; + if ((double) this.velocity.Y < -6.0) + this.velocity.Y = -6f; + } + } + float num8; + float num9; + if ((double) num6 < 60.0) + { + num8 = this.velocity.X; + num9 = this.velocity.Y; + } + else + { + float num10 = num7 / num6; + num8 = num4 * num10; + num9 = num5 * num10; + } + if ((double) this.velocity.X < (double) num8) + { + this.velocity.X += 0.2f; + if ((double) this.velocity.X < 0.0) + this.velocity.X += 0.3f; + } + if ((double) this.velocity.X > (double) num8) + { + this.velocity.X -= 0.2f; + if ((double) this.velocity.X > 0.0) + this.velocity.X -= 0.3f; + } + if ((double) this.velocity.Y < (double) num9) + { + this.velocity.Y += 0.2f; + if ((double) this.velocity.Y < 0.0) + this.velocity.Y += 0.3f; + } + if ((double) this.velocity.Y > (double) num9) + { + this.velocity.Y -= 0.2f; + if ((double) this.velocity.Y > 0.0) + this.velocity.Y -= 0.3f; + } + Projectile.petAnimFly[(int) this.localAI0].Update(ref this); + if ((double) this.velocity.X > 0.5) + this.spriteDirection = (sbyte) -1; + else if ((double) this.velocity.X < -0.5) + this.spriteDirection = (sbyte) 1; + if ((int) this.type < 116) + this.rotation = (int) this.spriteDirection != -1 ? (float) (Math.Atan2((double) this.velocity.Y, (double) this.velocity.X) + Math.PI) : (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X); + if (((int) Main.frameCounter & 1) != 1) + return; + Dust* dustPtr = Main.dust.NewDust((int) ((double) this.position.X - (double) this.velocity.X) + ((int) this.width >> 1) - 4, (int) ((double) this.position.Y - (double) this.velocity.Y) + ((int) this.height >> 1) - 4, 8, 8, 16, (double) this.velocity.X * -0.5, (double) this.velocity.Y * 0.5, 50, new Color(), 1.70000004768372); + if ((IntPtr) dustPtr == IntPtr.Zero) + return; + dustPtr->velocity *= 0.2f; + dustPtr->noGravity = true; + } + else + { + bool flag1 = false; + bool flag2 = false; + bool flag3 = false; + bool flag4 = false; + this.rotation = 0.0f; + this.tileCollide = true; + if (player.aabb.X + 10 < this.aabb.X + ((int) this.width >> 1) - 60) + { + if ((double) this.velocity.X > -3.5) + this.velocity.X -= 0.08f; + else + this.velocity.X -= 0.02f; + flag1 = true; + } + else if ((double) player.position.X + 10.0 > (double) this.position.X + (double) ((int) this.width >> 1) + 60.0) + { + if ((double) this.velocity.X < 3.5) + this.velocity.X += 0.08f; + else + this.velocity.X += 0.02f; + flag2 = true; + } + else + { + this.velocity.X *= 0.9f; + if ((double) this.velocity.X >= -0.08 && (double) this.velocity.X <= 0.08) + this.velocity.X = 0.0f; + } + if (flag1 || flag2) + { + int num4 = this.aabb.X + ((int) this.width >> 1) >> 4; + int j = this.aabb.Y + ((int) this.height >> 1) >> 4; + if (WorldGen.CanStandOnTop((!flag1 ? num4 + 1 : num4 - 1) + (int) this.velocity.X, j)) + flag4 = true; + } + if ((double) player.position.Y + 42.0 > (double) this.position.Y + (double) this.height) + flag3 = true; + if ((double) this.velocity.Y == 0.0) + { + if (!flag3 && ((double) this.velocity.X < 0.0 || (double) this.velocity.X > 0.0)) + { + int i = this.aabb.X + ((int) this.width >> 1) >> 4; + int j = (this.aabb.Y + ((int) this.height >> 1) >> 4) + 1; + if (flag1) + --i; + if (flag2) + ++i; + if (!WorldGen.CanStandOnTop(i, j)) + flag4 = true; + } + if (flag4 && WorldGen.CanStandOnTop(this.aabb.X + ((int) this.width >> 1) >> 4, (this.aabb.Y + ((int) this.height >> 1) >> 4) + 1)) + this.velocity.Y = -9.1f; + } + if ((double) this.velocity.X > 6.5) + this.velocity.X = 6.5f; + else if ((double) this.velocity.X < -6.5) + this.velocity.X = -6.5f; + if ((double) this.velocity.X > 0.07 && flag2) + this.direction = (sbyte) 1; + else if ((double) this.velocity.X < -0.07 && flag1) + this.direction = (sbyte) -1; + this.spriteDirection = -this.direction; + if ((double) this.velocity.Y == 0.0) + { + if ((double) Math.Abs(this.velocity.X) < 0.8) + Projectile.petAnimIdle[(int) this.localAI0].Update(ref this); + else + Projectile.petAnimMove[(int) this.localAI0].Update(ref this); + } + else if ((double) this.velocity.Y < 0.0) + Projectile.petAnimFall[(int) this.localAI0].Update(ref this); + else if ((double) this.velocity.Y > 0.0) + Projectile.petAnimJump[(int) this.localAI0].Update(ref this); + this.velocity.Y += 0.4f; + if ((double) this.velocity.Y <= 10.0) + return; + this.velocity.Y = 10f; + } + } + + private void FlyingPetAI() + { + Player player = Main.player[(int) this.owner]; + if (this.isLocal()) + { + if (player.dead) + player.pet = (sbyte) -1; + else if ((int) player.pet >= 0) + this.timeLeft = 2; + } + this.tileCollide = false; + Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num1 = player.position.X + 10f - vector2.X; + float num2 = player.position.Y + 21f - vector2.Y; + float num3 = (float) Math.Sqrt((double) num1 * (double) num1 + (double) num2 * (double) num2); + float num4 = 10f; + if ((double) num3 < 200.0 && (double) player.velocity.Y == 0.0 && (double) this.position.Y + (double) this.height <= (double) player.position.Y + 42.0) + { + Vector2 Velocity = this.velocity; + Collision.TileCollision(ref this.position, ref Velocity, (int) this.width, (int) this.height, false, false); + this.tileCollide = (double) this.velocity.X != (double) Velocity.X || (double) this.velocity.Y != (double) Velocity.Y; + if (!this.tileCollide) + { + this.ai0 = 0.0f; + if ((double) this.velocity.Y < -6.0) + this.velocity.Y = -6f; + } + } + float num5; + float num6; + if ((double) num3 < 60.0) + { + num5 = this.velocity.X; + num6 = this.velocity.Y; + } + else + { + float num7 = num4 / num3; + num5 = num1 * num7; + num6 = num2 * num7; + } + if ((double) this.velocity.X < (double) num5) + { + this.velocity.X += 0.2f; + if ((double) this.velocity.X < 0.0) + this.velocity.X += 0.3f; + } + if ((double) this.velocity.X > (double) num5) + { + this.velocity.X -= 0.2f; + if ((double) this.velocity.X > 0.0) + this.velocity.X -= 0.3f; + } + if ((double) this.velocity.Y < (double) num6) + { + this.velocity.Y += 0.2f; + if ((double) this.velocity.Y < 0.0) + this.velocity.Y += 0.3f; + } + if ((double) this.velocity.Y > (double) num6) + { + this.velocity.Y -= 0.2f; + if ((double) this.velocity.Y > 0.0) + this.velocity.Y -= 0.3f; + } + Projectile.petAnimFly[(int) this.localAI0].Update(ref this); + if ((double) this.velocity.X > 0.5) + { + this.spriteDirection = (sbyte) -1; + } + else + { + if ((double) this.velocity.X >= -0.5) + return; + this.spriteDirection = (sbyte) 1; + } + } + + private unsafe void ArrowAI() + { + if (this.ai1 == 0) + { + this.ai1 = 1; + if ((int) this.type == 83 || (int) this.type == 100) + Main.PlaySound(2, this.aabb.X, this.aabb.Y, 33); + else if ((int) this.type == 110) + Main.PlaySound(2, this.aabb.X, this.aabb.Y, 11); + else if ((int) this.type == 84) + Main.PlaySound(2, this.aabb.X, this.aabb.Y, 12); + else if ((int) this.type == 98) + Main.PlaySound(2, this.aabb.X, this.aabb.Y, 17); + else if ((int) this.type == 81 || (int) this.type == 82) + Main.PlaySound(2, this.aabb.X, this.aabb.Y, 5); + } + if ((int) this.type == 41) + { + Dust* dustPtr1 = Main.dust.NewDust(31, ref this.aabb, 0.0, 0.0, 100, new Color(), 1.60000002384186); + if ((IntPtr) dustPtr1 != IntPtr.Zero) + { + dustPtr1->noGravity = true; + Dust* dustPtr2 = Main.dust.NewDust(6, ref this.aabb, 0.0, 0.0, 100, new Color(), 2.0); + if ((IntPtr) dustPtr2 != IntPtr.Zero) + dustPtr2->noGravity = true; + } + } + else if ((int) this.type == 114) + { + Dust* dustPtr1 = Main.dust.NewDust(31, ref this.aabb, 0.0, 0.0, 100, new Color(), 1.60000002384186); + if ((IntPtr) dustPtr1 != IntPtr.Zero) + { + dustPtr1->noGravity = true; + Dust* dustPtr2 = Main.dust.NewDust(64, ref this.aabb, 0.0, 0.0, 100, new Color(), 2.0); + if ((IntPtr) dustPtr2 != IntPtr.Zero) + dustPtr2->noGravity = true; + } + } + else if ((int) this.type == 55) + { + Dust* dustPtr = Main.dust.NewDust(18, ref this.aabb, 0.0, 0.0, 0, new Color(), 0.899999976158142); + if ((IntPtr) dustPtr != IntPtr.Zero) + dustPtr->noGravity = true; + } + else if ((int) this.type == 91) + { + if (Main.rand.Next(3) == 0) + { + int Type = Main.rand.Next(2) != 0 ? 58 : 15; + Dust* dustPtr = Main.dust.NewDust(Type, ref this.aabb, (double) this.velocity.X * 0.25, (double) this.velocity.Y * 0.25, 150, new Color(), 0.899999976158142); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.X *= 0.25f; + dustPtr->velocity.Y *= 0.25f; + } + } + } + else if ((int) this.type == 88) + { + if ((int) this.alpha > 10) + this.alpha -= (byte) 10; + else + this.alpha = (byte) 0; + } + else if ((int) this.type == 20 || (int) this.type == 14 || ((int) this.type == 36 || (int) this.type == 83) || ((int) this.type == 84 || (int) this.type == 89 || ((int) this.type == 100 || (int) this.type == 104)) || (int) this.type == 110) + { + if ((int) this.alpha > 15) + this.alpha -= (byte) 15; + else + this.alpha = (byte) 0; + } + this.rotation = (float) (Math.Atan2((double) this.velocity.Y, (double) this.velocity.X) + 1.57); + if ((int) this.type != 5 && (int) this.type != 14 && ((int) this.type != 20 && (int) this.type != 36) && ((int) this.type != 38 && (int) this.type != 55 && ((int) this.type != 83 && (int) this.type != 84)) && ((int) this.type != 88 && (int) this.type != 89 && ((int) this.type != 98 && (int) this.type != 100) && ((int) this.type != 104 && (int) this.type != 110))) + { + if ((double) ++this.ai0 == 9.0) + { + if ((int) this.type == 114 && this.isLocal() && Main.rand.Next(4) == 0) + { + int number = this.NewClonedProjectile(114); + if (number >= 0) + { + double num1 = (double) this.velocity.Length(); + double num2 = (double) this.rotation - (double) Main.rand.Next(10, 28) * (Math.PI / 180.0); + double num3 = (double) this.rotation + (double) Main.rand.Next(10, 28) * (Math.PI / 180.0); + double num4 = -Math.Cos(num2); + double num5 = Math.Sin(num2); + double num6 = num1 * num5; + double num7 = num1 * num4; + Main.projectile[number].velocity.X = (float) num6; + Main.projectile[number].velocity.Y = (float) num7; + Main.projectile[number].ai0 = 9f; + Main.projectile[number].ai1 = 1; + double num8 = -Math.Cos(num3); + double num9 = Math.Sin(num3); + double num10 = num1 * num9; + double num11 = num1 * num8; + this.velocity.X = (float) num10; + this.velocity.Y = (float) num11; + NetMessage.SendProjectile(number, SendDataOptions.Reliable); + } + } + } + else if ((double) this.ai0 >= 15.0) + { + if ((int) this.type == 81 || (int) this.type == 91) + { + if ((double) this.ai0 >= 20.0) + this.velocity.Y += 0.07f; + } + else + this.velocity.Y += 0.1f; + } + } + if ((double) this.velocity.Y <= 16.0) + return; + this.velocity.Y = 16f; + } + + private unsafe void BoomerangAI() + { + if ((int) this.soundDelay == 0) + { + this.soundDelay = (short) 8; + Main.PlaySound(2, this.aabb.X, this.aabb.Y, 7); + } + if ((int) this.type == 19) + { + for (int index = 0; index < 2; ++index) + { + Dust* dustPtr = Main.dust.NewDust(6, ref this.aabb, (double) this.velocity.X * 0.200000002980232, (double) this.velocity.Y * 0.200000002980232, 100, new Color(), 2.0); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->noGravity = true; + dustPtr->velocity.X *= 0.3f; + dustPtr->velocity.Y *= 0.3f; + } + else + break; + } + } + else if ((int) this.type == 33) + { + if (Main.rand.Next(2) == 0) + { + Dust* dustPtr = Main.dust.NewDust(40, ref this.aabb, (double) this.velocity.X * 0.25, (double) this.velocity.Y * 0.25, 0, new Color(), 1.39999997615814); + if ((IntPtr) dustPtr != IntPtr.Zero) + dustPtr->noGravity = true; + } + } + else if ((int) this.type == 6 && Main.rand.Next(6) == 0) + { + int Type; + switch (Main.rand.Next(3)) + { + case 0: + Type = 15; + break; + case 1: + Type = 57; + break; + default: + Type = 58; + break; + } + Main.dust.NewDust(Type, ref this.aabb, (double) this.velocity.X * 0.25, (double) this.velocity.Y * 0.25, 150, new Color(), 0.699999988079071); + } + if ((double) this.ai0 == 0.0) + { + ++this.ai1; + if ((int) this.type == 106) + { + if (this.ai1 >= 45) + { + this.ai0 = 1f; + this.ai1 = 0; + this.netUpdate = true; + } + } + else if (this.ai1 >= 30) + { + this.ai0 = 1f; + this.ai1 = 0; + this.netUpdate = true; + } + } + else + { + this.tileCollide = false; + float num1 = 9f; + float num2 = 0.4f; + if ((int) this.type == 19) + { + num1 = 13f; + num2 = 0.6f; + } + else if ((int) this.type == 33) + { + num1 = 15f; + num2 = 0.8f; + } + else if ((int) this.type == 106) + { + num1 = 16f; + num2 = 1.2f; + } + Vector2 vector2 = new Vector2(this.position.X + (float) ((int) this.width >> 1), this.position.Y + (float) ((int) this.height >> 1)); + float num3 = Main.player[(int) this.owner].position.X + 10f - vector2.X; + float num4 = Main.player[(int) this.owner].position.Y + 21f - vector2.Y; + float num5 = (float) Math.Sqrt((double) num3 * (double) num3 + (double) num4 * (double) num4); + if ((double) num5 > 3000.0) + this.Kill(); + float num6 = num1 / num5; + float num7 = num3 * num6; + float num8 = num4 * num6; + if ((double) this.velocity.X < (double) num7) + { + this.velocity.X += num2; + if ((double) this.velocity.X < 0.0 && (double) num7 > 0.0) + this.velocity.X += num2; + } + else if ((double) this.velocity.X > (double) num7) + { + this.velocity.X -= num2; + if ((double) this.velocity.X > 0.0 && (double) num7 < 0.0) + this.velocity.X -= num2; + } + if ((double) this.velocity.Y < (double) num8) + { + this.velocity.Y += num2; + if ((double) this.velocity.Y < 0.0 && (double) num8 > 0.0) + this.velocity.Y += num2; + } + else if ((double) this.velocity.Y > (double) num8) + { + this.velocity.Y -= num2; + if ((double) this.velocity.Y > 0.0 && (double) num8 < 0.0) + this.velocity.Y -= num2; + } + if (this.isLocal() && new Rectangle(this.aabb.X, this.aabb.Y, (int) this.width, (int) this.height).Intersects(Main.player[(int) this.owner].aabb)) + this.Kill(); + } + if ((int) this.type == 106) + this.rotation += 0.3f * (float) this.direction; + else + this.rotation += 0.4f * (float) this.direction; + } + + private unsafe void ShurikenAI() + { + if ((int) this.type == 93 && Main.rand.Next(5) == 0) + { + Dust* dustPtr = Main.dust.NewDust(57, ref this.aabb, (double) this.velocity.X * 0.200000002980232 + (double) ((int) this.direction * 3), (double) this.velocity.Y * 0.200000002980232, 100, new Color(), 0.300000011920929); + if ((IntPtr) dustPtr != IntPtr.Zero) + dustPtr->velocity *= 0.3f; + } + this.rotation += (float) (((double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y)) * 0.0299999993294477) * (float) this.direction; + ++this.ai0; + if ((int) this.type == 69 || (int) this.type == 70) + { + if ((double) this.ai0 >= 10.0) + { + this.velocity.Y += 0.25f; + this.velocity.X *= 0.99f; + } + } + else if ((double) this.ai0 >= 20.0) + { + this.velocity.Y += 0.4f; + this.velocity.X *= 0.97f; + } + else if ((int) this.type == 48 || (int) this.type == 54 || (int) this.type == 93) + this.rotation = (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X) + 1.57f; + if ((double) this.velocity.Y > 16.0) + this.velocity.Y = 16f; + if ((int) this.type != 54 || Main.rand.Next(20) != 0) + return; + Main.dust.NewDust(40, ref this.aabb, (double) this.velocity.X * 0.100000001490116, (double) this.velocity.Y * 0.100000001490116, 0, new Color(), 0.75); + } + + private unsafe void VilethornAI() + { + this.rotation = (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X) + 1.57f; + if ((double) this.ai0 == 0.0) + { + this.alpha -= (byte) 50; + if ((int) this.alpha > 0) + return; + this.alpha = (byte) 0; + this.ai0 = 1f; + if (this.ai1 == 0) + { + this.ai1 = 1; + this.position.X += this.velocity.X; + this.position.Y += this.velocity.Y; + this.aabb.X = (int) this.position.X; + this.aabb.Y = (int) this.position.Y; + } + if ((int) this.type != 7 || !this.isLocal()) + return; + int number = this.NewClonedProjectile(this.ai1 >= 6 ? 8 : 7); + if (number < 0) + return; + Main.projectile[number].position.X += this.velocity.X; + Main.projectile[number].position.Y += this.velocity.Y; + Main.projectile[number].aabb.X = (int) Main.projectile[number].position.X; + Main.projectile[number].aabb.Y = (int) Main.projectile[number].position.Y; + Main.projectile[number].ai1 = this.ai1 + 1; + NetMessage.SendProjectile(number, SendDataOptions.Reliable); + } + else + { + this.alpha += (byte) 5; + if ((int) this.alpha >= 170 && (int) this.alpha < 175) + { + for (int index = 0; index < 2; ++index) + Main.dust.NewDust(18, ref this.aabb, (double) this.velocity.X * 0.025000000372529, (double) this.velocity.Y * 0.025000000372529, 170, new Color(), 1.20000004768372); + Main.dust.NewDust(14, ref this.aabb, 0.0, 0.0, 170, new Color(), 1.10000002384186); + } + else + { + if ((int) this.alpha < (int) byte.MaxValue) + return; + this.Kill(); + } + } + } + + private unsafe void StarfuryAI() + { + if ((int) this.type == 92) + { + if (this.aabb.Y > this.ai1) + this.tileCollide = true; + } + else + { + if (this.ai1 == 0 && !Collision.SolidCollision(ref this.position, (int) this.width, (int) this.height)) + { + this.ai1 = 1; + this.netUpdate = true; + } + if (this.ai1 != 0) + this.tileCollide = true; + } + if ((int) this.soundDelay == 0) + { + this.soundDelay = (short) (20 + Main.rand.Next(40)); + Main.PlaySound(2, this.aabb.X, this.aabb.Y, 9); + } + if ((int) this.localAI0 == 0) + this.localAI0 = (sbyte) 1; + int num = (int) this.alpha + 25 * (int) this.localAI0; + if (num > 200) + { + this.alpha = (byte) 200; + this.localAI0 = (sbyte) -1; + } + else if (num < 0) + { + this.alpha = (byte) 0; + this.localAI0 = (sbyte) 1; + } + else + this.alpha = (byte) num; + this.rotation += (float) (((double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y)) * 0.00999999977648258) * (float) this.direction; + if (this.ai1 != 1 && (int) this.type != 92) + return; + this.light = 0.9f; + if (Main.rand.Next(12) == 0) + Main.dust.NewDust(58, ref this.aabb, (double) this.velocity.X * 0.5, (double) this.velocity.Y * 0.5, 150, new Color(), 1.20000004768372); + if (Main.rand.Next(24) != 0) + return; + Gore.NewGore(this.position, new Vector2(this.velocity.X * 0.2f, this.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1.0); + } + + private unsafe void PowderAI() + { + this.velocity.X *= 0.95f; + this.velocity.Y *= 0.95f; + ++this.ai0; + if ((double) this.ai0 == 180.0) + this.Kill(); + if (this.ai1 == 0) + { + this.ai1 = 1; + for (int index = 0; index < 24; ++index) + Main.dust.NewDust(10 + (int) this.type, ref this.aabb, (double) this.velocity.X, (double) this.velocity.Y, 50, new Color(), 1.0); + } + if (!this.isLocal()) + return; + int num1 = (this.aabb.X >> 4) - 1; + int num2 = (this.aabb.X + (int) this.width >> 4) + 2; + int num3 = (this.aabb.Y >> 4) - 1; + int num4 = (this.aabb.Y + (int) this.height >> 4) + 2; + if (num1 < 0) + num1 = 0; + if (num2 > (int) Main.maxTilesX) + num2 = (int) Main.maxTilesX; + if (num3 < 0) + num3 = 0; + if (num4 > (int) Main.maxTilesY) + num4 = (int) Main.maxTilesY; + for (int index1 = num1; index1 < num2; ++index1) + { + for (int index2 = num3; index2 < num4; ++index2) + { + Vector2 vector2; + vector2.X = (float) (index1 * 16); + vector2.Y = (float) (index2 * 16); + if ((double) this.position.X + (double) this.width > (double) vector2.X && (double) this.position.X < (double) vector2.X + 16.0 && ((double) this.position.Y + (double) this.height > (double) vector2.Y && (double) this.position.Y < (double) vector2.Y + 16.0) && (int) Main.tile[index1, index2].active != 0) + { + int num5 = (int) Main.tile[index1, index2].type; + if ((int) this.type == 10) + { + if (num5 == 23) + { + Main.tile[index1, index2].type = (byte) 2; + WorldGen.SquareTileFrame(index1, index2, -1); + NetMessage.SendTile(index1, index2); + } + else if (num5 == 25) + { + Main.tile[index1, index2].type = (byte) 1; + WorldGen.SquareTileFrame(index1, index2, -1); + NetMessage.SendTile(index1, index2); + } + else if (num5 == 112) + { + Main.tile[index1, index2].type = (byte) 53; + WorldGen.SquareTileFrame(index1, index2, -1); + NetMessage.SendTile(index1, index2); + } + } + else if (num5 == 109) + { + Main.tile[index1, index2].type = (byte) 2; + WorldGen.SquareTileFrame(index1, index2, -1); + NetMessage.SendTile(index1, index2); + } + else if (num5 == 116) + { + Main.tile[index1, index2].type = (byte) 53; + WorldGen.SquareTileFrame(index1, index2, -1); + NetMessage.SendTile(index1, index2); + } + else if (num5 == 117) + { + Main.tile[index1, index2].type = (byte) 1; + WorldGen.SquareTileFrame(index1, index2, -1); + NetMessage.SendTile(index1, index2); + } + } + } + } + } + + private void GrapplingAI() + { + if (Main.player[(int) this.owner].dead) + { + this.Kill(); + } + else + { + Vector2 vector2_1 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num1 = Main.player[(int) this.owner].position.X + 10f - vector2_1.X; + float num2 = Main.player[(int) this.owner].position.Y + 21f - vector2_1.Y; + float num3 = (float) Math.Sqrt((double) num1 * (double) num1 + (double) num2 * (double) num2); + this.rotation = (float) Math.Atan2((double) num2, (double) num1) - 1.57f; + if ((double) this.ai0 == 0.0) + { + if ((double) num3 > 300.0 && (int) this.type == 13 || (double) num3 > 400.0 && (int) this.type == 32 || ((double) num3 > 440.0 && (int) this.type == 73 || (double) num3 > 440.0 && (int) this.type == 74)) + this.ai0 = 1f; + int num4 = (this.aabb.X >> 4) - 1; + int num5 = (this.aabb.X + (int) this.width >> 4) + 2; + int num6 = (this.aabb.Y >> 4) - 1; + int num7 = (this.aabb.Y + (int) this.height >> 4) + 2; + if (num4 < 0) + num4 = 0; + if (num5 > (int) Main.maxTilesX) + num5 = (int) Main.maxTilesX; + if (num6 < 0) + num6 = 0; + if (num7 > (int) Main.maxTilesY) + num7 = (int) Main.maxTilesY; + for (int i = num4; i < num5; ++i) + { + for (int j = num6; j < num7; ++j) + { + Vector2 vector2_2; + vector2_2.X = (float) (i * 16); + vector2_2.Y = (float) (j * 16); + if ((double) this.position.X + (double) this.width > (double) vector2_2.X && (double) this.position.X < (double) vector2_2.X + 16.0 && ((double) this.position.Y + (double) this.height > (double) vector2_2.Y && (double) this.position.Y < (double) vector2_2.Y + 16.0) && ((int) Main.tile[i, j].active != 0 && Main.tileSolid[(int) Main.tile[i, j].type])) + { + if ((int) Main.player[(int) this.owner].grapCount < 10) + { + Main.player[(int) this.owner].grappling[(int) Main.player[(int) this.owner].grapCount] = this.whoAmI; + ++Main.player[(int) this.owner].grapCount; + } + if (this.isLocal()) + { + int num8 = 0; + int index1 = -1; + int num9 = 100000; + if ((int) this.type == 73 || (int) this.type == 74) + { + for (int index2 = 0; index2 < 512; ++index2) + { + if (index2 != (int) this.whoAmI && (int) Main.projectile[index2].active != 0 && ((int) Main.projectile[index2].owner == (int) this.owner && (int) Main.projectile[index2].aiStyle == 7) && (double) Main.projectile[index2].ai0 == 2.0) + Main.projectile[index2].Kill(); + } + } + else + { + for (int index2 = 0; index2 < 512; ++index2) + { + if ((int) Main.projectile[index2].active != 0 && (int) Main.projectile[index2].owner == (int) this.owner && (int) Main.projectile[index2].aiStyle == 7) + { + if (Main.projectile[index2].timeLeft < num9) + { + index1 = index2; + num9 = Main.projectile[index2].timeLeft; + } + ++num8; + } + } + if (num8 > 3) + Main.projectile[index1].Kill(); + } + } + WorldGen.KillTile(i, j, true, true, false); + Main.PlaySound(0, i * 16, j * 16, 1); + this.velocity.X = 0.0f; + this.velocity.Y = 0.0f; + this.ai0 = 2f; + this.position.X = (float) (this.aabb.X = i * 16 + 8 - ((int) this.width >> 1)); + this.position.Y = (float) (this.aabb.Y = j * 16 + 8 - ((int) this.height >> 1)); + this.damage = (short) 0; + this.netUpdate = true; + if (this.isLocal()) + { + NetMessage.CreateMessage1(13, (int) this.owner); + NetMessage.SendMessage(); + break; + } + else + break; + } + } + if ((double) this.ai0 == 2.0) + break; + } + } + else if ((double) this.ai0 == 1.0) + { + float num4 = 11f; + if ((int) this.type == 32) + num4 = 15f; + if ((int) this.type == 73 || (int) this.type == 74) + num4 = 17f; + if ((double) num3 < 24.0) + this.Kill(); + float num5 = num4 / num3; + float num6 = num1 * num5; + float num7 = num2 * num5; + this.velocity.X = num6; + this.velocity.Y = num7; + } + else + { + if ((double) this.ai0 != 2.0) + return; + int num4 = (this.aabb.X >> 4) - 1; + int num5 = (this.aabb.X + (int) this.width >> 4) + 2; + int num6 = (this.aabb.Y >> 4) - 1; + int num7 = (this.aabb.Y + (int) this.height >> 4) + 2; + if (num4 < 0) + num4 = 0; + if (num5 > (int) Main.maxTilesX) + num5 = (int) Main.maxTilesX; + if (num6 < 0) + num6 = 0; + if (num7 > (int) Main.maxTilesY) + num7 = (int) Main.maxTilesY; + bool flag = true; + for (int index1 = num4; index1 < num5; ++index1) + { + for (int index2 = num6; index2 < num7; ++index2) + { + Vector2 vector2_2; + vector2_2.X = (float) (index1 * 16); + vector2_2.Y = (float) (index2 * 16); + if ((double) this.position.X + (double) ((int) this.width >> 1) > (double) vector2_2.X && (double) this.position.X + (double) ((int) this.width >> 1) < (double) vector2_2.X + 16.0 && ((double) this.position.Y + (double) ((int) this.height >> 1) > (double) vector2_2.Y && (double) this.position.Y + (double) ((int) this.height >> 1) < (double) vector2_2.Y + 16.0) && ((int) Main.tile[index1, index2].active != 0 && Main.tileSolid[(int) Main.tile[index1, index2].type])) + flag = false; + } + } + if (flag) + { + this.ai0 = 1f; + } + else + { + if ((int) Main.player[(int) this.owner].grapCount >= 10) + return; + Main.player[(int) this.owner].grappling[(int) Main.player[(int) this.owner].grapCount] = this.whoAmI; + ++Main.player[(int) this.owner].grapCount; + } + } + } + } + + private unsafe void BallOfFireAI() + { + if ((int) this.type == 96 && (int) this.localAI0 == 0) + { + this.localAI0 = (sbyte) 1; + Main.PlaySound(2, this.aabb.X, this.aabb.Y, 20); + } + if ((int) this.type == 27) + { + Dust* dustPtr = Main.dust.NewDust((int) ((double) this.position.X + (double) this.velocity.X), (int) ((double) this.position.Y + (double) this.velocity.Y), (int) this.width, (int) this.height, 29, (double) this.velocity.X, (double) this.velocity.Y, 100, new Color(), 3.0); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->noGravity = true; + if (Main.rand.Next(12) == 0) + Main.dust.NewDust(29, ref this.aabb, (double) this.velocity.X, (double) this.velocity.Y, 100, new Color(), 1.39999997615814); + } + } + else if ((int) this.type == 95 || (int) this.type == 96) + { + Dust* dustPtr = Main.dust.NewDust((int) ((double) this.position.X + (double) this.velocity.X), (int) ((double) this.position.Y + (double) this.velocity.Y), (int) this.width, (int) this.height, 75, (double) this.velocity.X, (double) this.velocity.Y, 100, new Color(), 3.0 * (double) this.scale); + if ((IntPtr) dustPtr != IntPtr.Zero) + dustPtr->noGravity = true; + } + else + { + for (int index = 0; index < 2; ++index) + { + Dust* dustPtr = Main.dust.NewDust(6, ref this.aabb, (double) this.velocity.X * 0.200000002980232, (double) this.velocity.Y * 0.200000002980232, 100, new Color(), 2.0); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->noGravity = true; + dustPtr->velocity.X *= 0.3f; + dustPtr->velocity.Y *= 0.3f; + } + else + break; + } + } + if ((int) this.type != 27 && (int) this.type != 96 && ++this.ai1 >= 20) + this.velocity.Y += 0.2f; + this.rotation += 0.3f * (float) this.direction; + if ((double) this.velocity.Y <= 16.0) + return; + this.velocity.Y = 16f; + } + + private unsafe void MagicMissileAI() + { + if ((int) this.type == 34) + { + Dust* dustPtr = Main.dust.NewDust(6, ref this.aabb, (double) this.velocity.X * 0.200000002980232, (double) this.velocity.Y * 0.200000002980232, 100, new Color(), 3.5); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->noGravity = true; + dustPtr->velocity.X *= 1.4f; + dustPtr->velocity.Y *= 1.4f; + Main.dust.NewDust(6, ref this.aabb, (double) this.velocity.X * 0.200000002980232, (double) this.velocity.Y * 0.200000002980232, 100, new Color(), 1.5); + } + } + else if ((int) this.type == 79) + { + if ((int) this.soundDelay == 0 && (double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y) > 2.0) + { + this.soundDelay = (short) 10; + Main.PlaySound(2, this.aabb.X, this.aabb.Y, 9); + } + Dust* dustPtr = Main.dust.NewDust(66, ref this.aabb, 0.0, 0.0, 100, new Color(Main.DiscoRGB), 2.5); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.X *= 0.1f; + dustPtr->velocity.Y *= 0.1f; + dustPtr->velocity.X += this.velocity.X * 0.2f; + dustPtr->velocity.Y += this.velocity.Y * 0.2f; + dustPtr->position.X = (float) (this.aabb.X + ((int) this.width >> 1) + 4 + Main.rand.Next(-2, 3)); + dustPtr->position.Y = (float) (this.aabb.Y + ((int) this.height >> 1) + Main.rand.Next(-2, 3)); + dustPtr->noGravity = true; + } + } + else + { + if ((int) this.soundDelay == 0 && (double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y) > 2.0) + { + this.soundDelay = (short) 10; + Main.PlaySound(2, this.aabb.X, this.aabb.Y, 9); + } + Dust* dustPtr = Main.dust.NewDust(15, ref this.aabb, 0.0, 0.0, 100, new Color(), 2.0); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.X *= 0.3f; + dustPtr->velocity.Y *= 0.3f; + dustPtr->position.X = (float) (this.aabb.X + ((int) this.width >> 1) + 4 + Main.rand.Next(-4, 5)); + dustPtr->position.Y = (float) (this.aabb.Y + ((int) this.height >> 1) + Main.rand.Next(-4, 5)); + dustPtr->noGravity = true; + } + } + if ((double) this.ai0 == 0.0) + { + Player player = Main.player[(int) this.owner]; + if (player.isLocal() && player.channel) + { + float num1 = (int) this.type == 16 ? 15f : 12f; + Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num2 = (float) ((int) player.ui.mouseX + player.view.screenPosition.X) - vector2.X; + float num3 = (float) ((int) player.ui.mouseY + player.view.screenPosition.Y) - vector2.Y; + float num4 = (float) Math.Sqrt((double) num2 * (double) num2 + (double) num3 * (double) num3); + if ((double) num4 > (double) num1) + { + float num5 = num1 / num4; + num2 *= num5; + num3 *= num5; + } + if ((int) ((double) num2 * 1000.0) != (int) ((double) this.velocity.X * 1000.0) || (int) ((double) num3 * 1000.0) != (int) ((double) this.velocity.Y * 1000.0)) + this.netUpdate = true; + this.velocity.X = num2; + this.velocity.Y = num3; + } + else + { + this.ai0 = 1f; + this.netUpdate = true; + float num1 = 12f; + Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num2 = (float) ((int) player.ui.mouseX + player.view.screenPosition.X) - vector2.X; + float num3 = (float) ((int) player.ui.mouseY + player.view.screenPosition.Y) - vector2.Y; + float num4 = (float) Math.Sqrt((double) num2 * (double) num2 + (double) num3 * (double) num3); + if ((double) num4 == 0.0) + { + vector2 = new Vector2(player.position.X + 10f, player.position.Y + 21f); + num2 = this.position.X + (float) this.width * 0.5f - vector2.X; + num3 = this.position.Y + (float) this.height * 0.5f - vector2.Y; + num4 = (float) Math.Sqrt((double) num2 * (double) num2 + (double) num3 * (double) num3); + } + float num5 = num1 / num4; + float num6 = num2 * num5; + float num7 = num3 * num5; + this.velocity.X = num6; + this.velocity.Y = num7; + if ((double) this.velocity.X == 0.0 && (double) this.velocity.Y == 0.0) + this.Kill(); + } + } + if ((int) this.type == 34) + this.rotation += 0.3f * (float) this.direction; + else if ((double) this.velocity.X != 0.0 || (double) this.velocity.Y != 0.0) + this.rotation = (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X) - 2.355f; + if ((double) this.velocity.Y <= 16.0) + return; + this.velocity.Y = 16f; + } + + private unsafe void DirtBallAI() + { + if ((int) this.type == 31 && (double) this.ai0 != 2.0) + { + if (Main.rand.Next(3) == 0) + { + Dust* dustPtr = Main.dust.NewDust(32, ref this.aabb, 0.0, (double) this.velocity.Y * 0.5, 0, new Color(), 1.0); + if ((IntPtr) dustPtr != IntPtr.Zero) + dustPtr->velocity.X *= 0.4f; + } + } + else if ((int) this.type == 39) + { + if (Main.rand.Next(3) == 0) + { + Dust* dustPtr = Main.dust.NewDust(38, ref this.aabb, 0.0, (double) this.velocity.Y * 0.5, 0, new Color(), 1.0); + if ((IntPtr) dustPtr != IntPtr.Zero) + dustPtr->velocity.X *= 0.4f; + } + } + else if ((int) this.type == 40) + { + if (Main.rand.Next(3) == 0) + { + Dust* dustPtr = Main.dust.NewDust(36, ref this.aabb, 0.0, (double) this.velocity.Y * 0.5, 0, new Color(), 1.0); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.X *= 0.4f; + dustPtr->velocity.Y *= 0.4f; + } + } + } + else if ((int) this.type == 42 || (int) this.type == 31) + { + if (Main.rand.Next(3) == 0) + { + Dust* dustPtr = Main.dust.NewDust(32, ref this.aabb, 0.0, 0.0, 0, new Color(), 1.0); + if ((IntPtr) dustPtr != IntPtr.Zero) + dustPtr->velocity.X *= 0.4f; + } + } + else if ((int) this.type == 56 || (int) this.type == 65) + { + if (Main.rand.Next(3) == 0) + { + Dust* dustPtr = Main.dust.NewDust(14, ref this.aabb, 0.0, 0.0, 0, new Color(), 1.0); + if ((IntPtr) dustPtr != IntPtr.Zero) + dustPtr->velocity.X *= 0.4f; + } + } + else if ((int) this.type == 67 || (int) this.type == 68) + { + if (Main.rand.Next(3) == 0) + { + Dust* dustPtr = Main.dust.NewDust(51, ref this.aabb, 0.0, 0.0, 0, new Color(), 1.0); + if ((IntPtr) dustPtr != IntPtr.Zero) + dustPtr->velocity.X *= 0.4f; + } + } + else if ((int) this.type == 71) + { + if (Main.rand.Next(3) == 0) + { + Dust* dustPtr = Main.dust.NewDust(53, ref this.aabb, 0.0, 0.0, 0, new Color(), 1.0); + if ((IntPtr) dustPtr != IntPtr.Zero) + dustPtr->velocity.X *= 0.4f; + } + } + else if ((int) this.type != 109 && Main.rand.Next(24) == 0) + Main.dust.NewDust(0, ref this.aabb, 0.0, 0.0, 0, new Color(), 1.0); + if ((double) this.ai0 == 0.0) + { + Player player = Main.player[(int) this.owner]; + if (player.isLocal() && player.channel) + { + float num1 = 12f; + Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num2 = (float) ((int) player.ui.mouseX + player.view.screenPosition.X) - vector2.X; + float num3 = (float) ((int) player.ui.mouseY + player.view.screenPosition.Y) - vector2.Y; + float num4 = (float) Math.Sqrt((double) num2 * (double) num2 + (double) num3 * (double) num3); + float num5 = (float) Math.Sqrt((double) num2 * (double) num2 + (double) num3 * (double) num3); + if ((double) num5 > (double) num1) + { + float num6 = num1 / num5; + num2 *= num6; + num3 *= num6; + } + if ((double) num2 != (double) this.velocity.X || (double) num3 != (double) this.velocity.Y) + this.netUpdate = true; + this.velocity.X = num2; + this.velocity.Y = num3; + } + else + { + this.ai0 = 1f; + this.netUpdate = true; + } + } + if ((int) this.type != 109) + { + if ((double) this.ai0 == 1.0) + { + if ((int) this.type == 42 || (int) this.type == 65 || (int) this.type == 68) + { + if (++this.ai1 >= 60) + this.velocity.Y += 0.2f; + } + else + this.velocity.Y += 0.41f; + } + else if ((double) this.ai0 == 2.0) + { + this.velocity.Y += 0.2f; + if ((double) this.velocity.X < -0.04) + this.velocity.X += 0.04f; + else if ((double) this.velocity.X > 0.04) + this.velocity.X -= 0.04f; + else + this.velocity.X = 0.0f; + } + } + this.rotation += 0.1f; + if ((double) this.velocity.Y <= 10.0) + return; + this.velocity.Y = 10f; + } + + private void OrbOfLightAI() + { + this.rotation += 0.02f; + if (this.isLocal() && Main.player[(int) this.owner].lightOrb) + this.timeLeft = 2; + if (!Main.player[(int) this.owner].dead) + { + Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num1 = Main.player[(int) this.owner].position.X + 10f - vector2.X; + float num2 = Main.player[(int) this.owner].position.Y + 21f - vector2.Y; + float num3 = (float) Math.Sqrt((double) num1 * (double) num1 + (double) num2 * (double) num2); + float num4 = (float) Math.Sqrt((double) num1 * (double) num1 + (double) num2 * (double) num2); + if ((double) num4 > 800.0) + { + this.position.X = (float) (this.aabb.X = Main.player[(int) this.owner].aabb.X + 10 - ((int) this.width >> 1)); + this.position.Y = (float) (this.aabb.Y = Main.player[(int) this.owner].aabb.Y + 21 - ((int) this.height >> 1)); + } + else if ((double) num4 > 70.0) + { + float num5 = 2.5f / num4; + float num6 = num1 * num5; + float num7 = num2 * num5; + this.velocity.X = num6; + this.velocity.Y = num7; + } + else + { + this.velocity.X = 0.0f; + this.velocity.Y = 0.0f; + } + } + else + this.Kill(); + } + + private unsafe void FairyAI() + { + if ((double) this.velocity.X > 0.0) + this.spriteDirection = (sbyte) -1; + else if ((double) this.velocity.X < 0.0) + this.spriteDirection = (sbyte) 1; + this.rotation = this.velocity.X * 0.1f; + if ((int) ++this.frameCounter >= 4) + { + this.frameCounter = (byte) 0; + this.frame = (byte) ((int) this.frame + 1 & 3); + } + if (Main.rand.Next(6) == 0) + { + int Type = 56; + if ((int) this.type == 86) + Type = 73; + else if ((int) this.type == 87) + Type = 74; + Dust* dustPtr = Main.dust.NewDust(Type, ref this.aabb, 0.0, 0.0, 200, new Color(), 0.800000011920929); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.X *= 0.3f; + dustPtr->velocity.Y *= 0.3f; + } + } + if (this.isLocal() && Main.player[(int) this.owner].fairy) + this.timeLeft = 2; + if (!Main.player[(int) this.owner].dead) + { + Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num1 = Main.player[(int) this.owner].position.X + 10f - vector2.X; + float num2 = Main.player[(int) this.owner].position.Y + 21f - vector2.Y; + float num3 = (float) Math.Sqrt((double) num1 * (double) num1 + (double) num2 * (double) num2); + if ((double) num3 > 800.0) + { + this.position.X = (float) (this.aabb.X = Main.player[(int) this.owner].aabb.X + 10 - ((int) this.width >> 1)); + this.position.Y = (float) (this.aabb.Y = Main.player[(int) this.owner].aabb.Y + 21 - ((int) this.height >> 1)); + } + else if ((double) num3 > 40.0) + { + float num4 = 3.5f / num3; + float num5 = num1 * num4; + float num6 = num2 * num4; + this.velocity.X = num5; + this.velocity.Y = num6; + } + else + { + this.velocity.X = 0.0f; + this.velocity.Y = 0.0f; + } + } + else + this.Kill(); + } + + private unsafe void BlueFlameAI() + { + this.scale -= 0.04f; + if ((double) this.scale <= 0.0) + this.Kill(); + if ((double) this.ai0 > 4.0) + { + this.alpha = (byte) 150; + this.light = 0.8f; + Dust* dustPtr = Main.dust.NewDust(29, ref this.aabb, (double) this.velocity.X, (double) this.velocity.Y, 100, new Color(), 2.5); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->noGravity = true; + Main.dust.NewDust(29, ref this.aabb, (double) this.velocity.X, (double) this.velocity.Y, 100, new Color(), 1.5); + } + } + else + ++this.ai0; + this.rotation += 0.3f * (float) this.direction; + } + + private void HarpoonAI() + { + if (Main.player[(int) this.owner].dead) + { + this.Kill(); + } + else + { + Main.player[(int) this.owner].itemAnimation = (short) 5; + Main.player[(int) this.owner].itemTime = (byte) 5; + Main.player[(int) this.owner].direction = this.aabb.X + ((int) this.width >> 1) <= Main.player[(int) this.owner].aabb.X + 10 ? (sbyte) -1 : (sbyte) 1; + Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num1 = Main.player[(int) this.owner].position.X + 10f - vector2.X; + float num2 = Main.player[(int) this.owner].position.Y + 21f - vector2.Y; + float num3 = (float) Math.Sqrt((double) num1 * (double) num1 + (double) num2 * (double) num2); + if ((double) this.ai0 == 0.0) + { + if ((double) num3 > 700.0) + this.ai0 = 1f; + this.rotation = (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X) + 1.57f; + if (++this.ai1 <= 2) + return; + this.alpha = (byte) 0; + if (this.ai1 < 10) + return; + this.velocity.Y += 0.3f; + } + else + { + if ((double) this.ai0 != 1.0) + return; + this.tileCollide = false; + this.rotation = (float) Math.Atan2((double) num2, (double) num1) - 1.57f; + float num4 = 20f; + if ((double) num3 < 50.0) + this.Kill(); + float num5 = num4 / num3; + float num6 = num1 * num5; + float num7 = num2 * num5; + this.velocity.X = num6; + this.velocity.Y = num7; + } + } + } + + private void SpikyBallAI() + { + if ((int) this.type == 53) + { + int num1 = (this.aabb.X >> 4) - 1; + int num2 = (this.aabb.X + (int) this.width >> 4) + 2; + int num3 = (this.aabb.Y >> 4) - 1; + int num4 = (this.aabb.Y + (int) this.height >> 4) + 2; + if (num1 < 0) + num1 = 0; + if (num2 > (int) Main.maxTilesX) + num2 = (int) Main.maxTilesX; + if (num3 < 0) + num3 = 0; + if (num4 > (int) Main.maxTilesY) + num4 = (int) Main.maxTilesY; + for (int index1 = num1; index1 < num2; ++index1) + { + for (int index2 = num3; index2 < num4; ++index2) + { + if (Main.tile[index1, index2].canStandOnTop()) + { + Vector2 vector2; + vector2.X = (float) (index1 * 16); + vector2.Y = (float) (index2 * 16); + if ((double) this.position.X + (double) this.width > (double) vector2.X && (double) this.position.X < (double) vector2.X + 16.0 && ((double) this.position.Y + (double) this.height > (double) vector2.Y && (double) this.position.Y < (double) vector2.Y + 16.0)) + { + this.velocity.X = 0.0f; + this.velocity.Y = -0.2f; + } + } + } + } + } + ++this.ai0; + if ((double) this.ai0 > 5.0) + { + this.ai0 = 5f; + if ((double) this.velocity.Y == 0.0 && (double) this.velocity.X != 0.0) + { + this.velocity.X *= 0.97f; + if ((double) this.velocity.X > -0.01 && (double) this.velocity.X < 0.01) + { + this.velocity.X = 0.0f; + this.netUpdate = true; + } + } + this.velocity.Y += 0.2f; + } + this.rotation += this.velocity.X * 0.1f; + if ((double) this.velocity.Y <= 16.0) + return; + this.velocity.Y = 16f; + } + + private unsafe void FlailAI() + { + if ((int) this.type == 25) + { + if (Main.rand.Next(16) == 0) + Main.dust.NewDust(14, ref this.aabb, 0.0, 0.0, 150, new Color(), 1.29999995231628); + } + else if ((int) this.type == 26) + { + Dust* dustPtr = Main.dust.NewDust(29, ref this.aabb, (double) this.velocity.X * 0.400000005960464, (double) this.velocity.Y * 0.400000005960464, 100, new Color(), 2.5); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->noGravity = true; + dustPtr->velocity.X *= 0.5f; + dustPtr->velocity.Y *= 0.5f; + } + } + else if ((int) this.type == 35) + { + Dust* dustPtr = Main.dust.NewDust(6, ref this.aabb, (double) this.velocity.X * 0.400000005960464, (double) this.velocity.Y * 0.400000005960464, 100, new Color(), 3.0); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->noGravity = true; + dustPtr->velocity.X *= 2f; + dustPtr->velocity.Y *= 2f; + } + } + if (Main.player[(int) this.owner].dead) + { + this.Kill(); + } + else + { + Main.player[(int) this.owner].itemAnimation = (short) 10; + Main.player[(int) this.owner].itemTime = (byte) 10; + if (this.aabb.X + ((int) this.width >> 1) > Main.player[(int) this.owner].aabb.X + 10) + { + Main.player[(int) this.owner].direction = (sbyte) 1; + this.direction = (sbyte) 1; + } + else + { + Main.player[(int) this.owner].direction = (sbyte) -1; + this.direction = (sbyte) -1; + } + Vector2 vector2_1 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num1 = Main.player[(int) this.owner].position.X + 10f - vector2_1.X; + float num2 = Main.player[(int) this.owner].position.Y + 21f - vector2_1.Y; + float num3 = (float) Math.Sqrt((double) num1 * (double) num1 + (double) num2 * (double) num2); + if ((double) this.ai0 == 0.0) + { + float num4 = 160f; + if ((int) this.type == 63) + num4 *= 1.5f; + this.tileCollide = true; + if ((double) num3 > (double) num4) + { + this.ai0 = 1f; + this.netUpdate = true; + } + else if (!Main.player[(int) this.owner].channel) + { + if ((double) this.velocity.Y < 0.0) + this.velocity.Y *= 0.9f; + ++this.velocity.Y; + this.velocity.X *= 0.9f; + } + } + else if ((double) this.ai0 == 1.0) + { + float num4 = 14f / Main.player[(int) this.owner].meleeSpeed; + float num5 = 0.9f / Main.player[(int) this.owner].meleeSpeed; + float num6 = 300f; + if ((int) this.type == 63) + { + num6 *= 1.5f; + num4 *= 1.5f; + num5 *= 1.5f; + } + double num7 = (double) Math.Abs(num1); + double num8 = (double) Math.Abs(num2); + if (this.ai1 == 1) + this.tileCollide = false; + if (!Main.player[(int) this.owner].channel || (double) num3 > (double) num6 || !this.tileCollide) + { + this.ai1 = 1; + if (this.tileCollide) + this.netUpdate = true; + this.tileCollide = false; + if ((double) num3 < 20.0) + this.Kill(); + } + if (!this.tileCollide) + num5 *= 2f; + if ((double) num3 > 60.0 || !this.tileCollide) + { + float num9 = num4 / num3; + num1 *= num9; + num2 *= num9; + Vector2 vector2_2 = new Vector2(this.velocity.X, this.velocity.Y); + float num10 = num1 - this.velocity.X; + float num11 = num2 - this.velocity.Y; + float num12 = (float) Math.Sqrt((double) num10 * (double) num10 + (double) num11 * (double) num11); + float num13 = num5 / num12; + float num14 = num10 * num13; + float num15 = num11 * num13; + this.velocity.X *= 0.98f; + this.velocity.Y *= 0.98f; + this.velocity.X += num14; + this.velocity.Y += num15; + } + else + { + if ((double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y) < 6.0) + { + this.velocity.X *= 0.96f; + this.velocity.Y += 0.2f; + } + if ((double) Main.player[(int) this.owner].velocity.X == 0.0) + this.velocity.X *= 0.96f; + } + } + this.rotation = (float) Math.Atan2((double) num2, (double) num1) - this.velocity.X * 0.1f; + } + } + + private unsafe void BombAI() + { + if ((int) this.type == 108) + { + ++this.ai0; + if ((double) this.ai0 > 3.0) + this.Kill(); + } + if ((int) this.type == 37) + { + int num1 = (this.aabb.X >> 4) - 1; + int num2 = (this.aabb.X + (int) this.width >> 4) + 2; + int num3 = (this.aabb.Y >> 4) - 1; + int num4 = (this.aabb.Y + (int) this.height >> 4) + 2; + if (num1 < 0) + num1 = 0; + if (num2 > (int) Main.maxTilesX) + num2 = (int) Main.maxTilesX; + if (num3 < 0) + num3 = 0; + if (num4 > (int) Main.maxTilesY) + num4 = (int) Main.maxTilesY; + for (int index1 = num1; index1 < num2; ++index1) + { + for (int index2 = num3; index2 < num4; ++index2) + { + if (Main.tile[index1, index2].canStandOnTop()) + { + Vector2 vector2; + vector2.X = (float) (index1 * 16); + vector2.Y = (float) (index2 * 16); + if ((double) this.position.X + (double) this.width - 4.0 > (double) vector2.X && (double) this.position.X + 4.0 < (double) vector2.X + 16.0 && ((double) this.position.Y + (double) this.height - 4.0 > (double) vector2.Y && (double) this.position.Y + 4.0 < (double) vector2.Y + 16.0)) + { + this.velocity.X = 0.0f; + this.velocity.Y = -0.2f; + } + } + } + } + } + if ((int) this.type == 102) + { + if ((double) this.velocity.Y > 10.0) + this.velocity.Y = 10f; + if ((int) this.localAI0 == 0) + { + this.localAI0 = (sbyte) 1; + Main.PlaySound(2, this.aabb.X, this.aabb.Y, 10); + } + if ((int) ++this.frameCounter > 3) + { + this.frameCounter = (byte) 0; + this.frame ^= (byte) 1; + } + if ((double) this.velocity.Y == 0.0 && (int) this.width != 128) + { + this.position.X += (float) ((int) this.width >> 1); + this.position.Y += (float) ((int) this.height >> 1); + this.aabb.Width = (int) (this.width = (ushort) 128); + this.aabb.Height = (int) (this.height = (ushort) 128); + this.position.X -= 64f; + this.position.Y -= 64f; + this.aabb.X = (int) this.position.X; + this.aabb.Y = (int) this.position.Y; + this.damage = (short) 40; + this.knockBack = 8f; + this.timeLeft = 3; + this.netUpdate = true; + } + } + if (this.timeLeft <= 3 && this.isLocal()) + { + this.ai1 = 0; + this.alpha = byte.MaxValue; + if ((int) this.type == 28 || (int) this.type == 37 || (int) this.type == 75) + { + if ((int) this.width != 128) + { + this.position.X += (float) ((int) this.width >> 1); + this.position.Y += (float) ((int) this.height >> 1); + this.aabb.Width = (int) (this.width = (ushort) 128); + this.aabb.Height = (int) (this.height = (ushort) 128); + this.position.X -= 64f; + this.position.Y -= 64f; + this.aabb.X = (int) this.position.X; + this.aabb.Y = (int) this.position.Y; + this.damage = (short) 100; + this.knockBack = 8f; + } + } + else if ((int) this.type == 29) + { + if ((int) this.width != 250) + { + this.position.X += (float) ((int) this.width >> 1); + this.position.Y += (float) ((int) this.height >> 1); + this.aabb.Width = (int) (this.width = (ushort) 250); + this.aabb.Height = (int) (this.height = (ushort) 250); + this.position.X -= 125f; + this.position.Y -= 125f; + this.aabb.X = (int) this.position.X; + this.aabb.Y = (int) this.position.Y; + this.damage = (short) 250; + this.knockBack = 10f; + } + } + else if ((int) this.type == 30 && (int) this.width != 128) + { + this.position.X += (float) ((int) this.width >> 1); + this.position.Y += (float) ((int) this.height >> 1); + this.aabb.Width = (int) (this.width = (ushort) 128); + this.aabb.Height = (int) (this.height = (ushort) 128); + this.position.X -= 64f; + this.position.Y -= 64f; + this.aabb.X = (int) this.position.X; + this.aabb.Y = (int) this.position.Y; + this.knockBack = 8f; + } + } + else if ((int) this.type != 30) + { + if ((int) this.type != 108) + this.damage = (short) 0; + if (Main.rand.Next(5) == 0) + Main.dust.NewDust(6, ref this.aabb, 0.0, 0.0, 100, new Color(), 1.0); + } + ++this.ai0; + if ((int) this.type == 30 && (double) this.ai0 > 10.0 || (int) this.type != 30 && (double) this.ai0 > 5.0) + { + if ((double) this.velocity.Y == 0.0 && (double) this.velocity.X != 0.0) + { + this.velocity.X *= 0.97f; + if ((int) this.type == 29) + this.velocity.X *= 0.99f; + if ((double) this.velocity.X > -0.01 && (double) this.velocity.X < 0.01) + { + this.velocity.X = 0.0f; + this.netUpdate = true; + } + } + this.velocity.Y += 0.2f; + } + this.rotation += this.velocity.X * 0.1f; + } + + private void TombstoneAI() + { + if ((double) this.velocity.Y == 0.0) + this.velocity.X *= 0.98f; + this.rotation += this.velocity.X * 0.1f; + this.velocity.Y += 0.2f; + if (!this.isLocal()) + return; + int index1 = this.aabb.X + ((int) this.width >> 1) >> 4; + int index2 = this.aabb.Y + (int) this.height - 4 >> 4; + if ((int) Main.tile[index1, index2].active != 0 || !WorldGen.PlaceTile(index1, index2, 85, false, false, -1, 0)) + return; + NetMessage.CreateMessage5(17, 1, index1, index2, 85, 0); + NetMessage.SendMessage(); + int index3 = Sign.ReadSign(index1, index2); + if (index3 >= 0) + Main.sign[index3].SetText((UserString) Projectile.tombstoneText[(int) this.tombstoneTextId]); + this.Kill(); + } + + private unsafe void DemonSickleAI() + { + if (this.ai1 == 0 && (int) this.type == 44) + { + this.ai1 = 1; + Main.PlaySound(2, this.aabb.X, this.aabb.Y, 8); + } + this.rotation += (float) this.direction * 0.8f; + if ((double) ++this.ai0 >= 30.0) + { + if ((double) this.ai0 < 100.0) + { + this.velocity.X *= 1.06f; + this.velocity.Y *= 1.06f; + } + else + this.ai0 = 200f; + } + for (int index = 0; index < 2; ++index) + { + Dust* dustPtr = Main.dust.NewDust(27, ref this.aabb, 0.0, 0.0, 100, new Color(), 1.0); + if ((IntPtr) dustPtr == IntPtr.Zero) + break; + dustPtr->noGravity = true; + } + } + + private unsafe void SpearAI() + { + this.direction = Main.player[(int) this.owner].direction; + Main.player[(int) this.owner].heldProj = this.whoAmI; + Main.player[(int) this.owner].itemTime = (byte) Main.player[(int) this.owner].itemAnimation; + this.position.X = Main.player[(int) this.owner].position.X + (float) (20 - (int) this.width >> 1); + this.position.Y = Main.player[(int) this.owner].position.Y + (float) (42 - (int) this.height >> 1); + if ((int) this.type == 46) + { + if ((double) this.ai0 == 0.0) + { + this.ai0 = 3f; + this.netUpdate = true; + } + if ((int) Main.player[(int) this.owner].itemAnimation < (int) Main.player[(int) this.owner].itemAnimationMax / 3) + this.ai0 -= 1.6f; + else + this.ai0 += 1.4f; + } + else if ((int) this.type == 105) + { + if ((double) this.ai0 == 0.0) + { + this.ai0 = 3f; + this.netUpdate = true; + } + if ((int) Main.player[(int) this.owner].itemAnimation < (int) Main.player[(int) this.owner].itemAnimationMax / 3) + this.ai0 -= 2.4f; + else + this.ai0 += 2.1f; + } + else if ((int) this.type == 112) + { + if ((double) this.ai0 == 0.0) + { + this.ai0 = 3f; + this.netUpdate = true; + } + if ((int) Main.player[(int) this.owner].itemAnimation < (int) Main.player[(int) this.owner].itemAnimationMax / 3) + this.ai0 -= 2.4f; + else + this.ai0 += 2.1f; + } + else if ((int) this.type == 47) + { + if ((double) this.ai0 == 0.0) + { + this.ai0 = 4f; + this.netUpdate = true; + } + if ((int) Main.player[(int) this.owner].itemAnimation < (int) Main.player[(int) this.owner].itemAnimationMax / 3) + this.ai0 -= 1.2f; + else + this.ai0 += 0.9f; + } + else if ((int) this.type == 49) + { + if ((double) this.ai0 == 0.0) + { + this.ai0 = 4f; + this.netUpdate = true; + } + if ((int) Main.player[(int) this.owner].itemAnimation < (int) Main.player[(int) this.owner].itemAnimationMax / 3) + this.ai0 -= 1.1f; + else + this.ai0 += 0.85f; + } + else if ((int) this.type == 64) + { + this.spriteDirection = -this.direction; + if ((double) this.ai0 == 0.0) + { + this.ai0 = 3f; + this.netUpdate = true; + } + if ((int) Main.player[(int) this.owner].itemAnimation < (int) Main.player[(int) this.owner].itemAnimationMax / 3) + this.ai0 -= 1.9f; + else + this.ai0 += 1.7f; + } + else if ((int) this.type == 66 || (int) this.type == 97) + { + this.spriteDirection = -this.direction; + if ((double) this.ai0 == 0.0) + { + this.ai0 = 3f; + this.netUpdate = true; + } + if ((int) Main.player[(int) this.owner].itemAnimation < (int) Main.player[(int) this.owner].itemAnimationMax / 3) + this.ai0 -= 2.1f; + else + this.ai0 += 1.9f; + } + else if ((int) this.type == 97) + { + this.spriteDirection = -this.direction; + if ((double) this.ai0 == 0.0) + { + this.ai0 = 3f; + this.netUpdate = true; + } + if ((int) Main.player[(int) this.owner].itemAnimation < (int) Main.player[(int) this.owner].itemAnimationMax / 3) + this.ai0 -= 1.6f; + else + this.ai0 += 1.4f; + } + this.position.X += this.velocity.X * this.ai0; + this.position.Y += this.velocity.Y * this.ai0; + this.aabb.X = (int) this.position.X; + this.aabb.Y = (int) this.position.Y; + if ((int) Main.player[(int) this.owner].itemAnimation == 0) + this.Kill(); + this.rotation = (float) (Math.Atan2((double) this.velocity.Y, (double) this.velocity.X) + 2.355); + if ((int) this.spriteDirection == -1) + this.rotation -= 1.57f; + if ((int) this.type == 46) + { + if (Main.rand.Next(6) == 0) + Main.dust.NewDust(14, ref this.aabb, 0.0, 0.0, 150, new Color(), 1.39999997615814); + Dust* dustPtr1 = Main.dust.NewDust(27, ref this.aabb, (double) this.velocity.X * 0.200000002980232 + (double) ((int) this.direction * 3), (double) this.velocity.Y * 0.200000002980232, 100, new Color(), 1.20000004768372); + if ((IntPtr) dustPtr1 == IntPtr.Zero) + return; + dustPtr1->noGravity = true; + dustPtr1->velocity.X *= 0.5f; + dustPtr1->velocity.Y *= 0.5f; + Dust* dustPtr2 = Main.dust.NewDust((int) ((double) this.position.X - (double) this.velocity.X * 2.0), (int) ((double) this.position.Y - (double) this.velocity.Y * 2.0), (int) this.width, (int) this.height, 27, 0.0, 0.0, 150, new Color(), 1.39999997615814); + if ((IntPtr) dustPtr2 == IntPtr.Zero) + return; + dustPtr2->velocity.X *= 0.2f; + dustPtr2->velocity.Y *= 0.2f; + } + else if ((int) this.type == 105) + { + if (Main.rand.Next(4) == 0) + { + Dust* dustPtr = Main.dust.NewDust(57, ref this.aabb, (double) this.velocity.X * 0.200000002980232, (double) this.velocity.Y * 0.200000002980232, 200, new Color(), 1.20000004768372); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.X += this.velocity.X * 0.3f; + dustPtr->velocity.Y += this.velocity.Y * 0.3f; + dustPtr->velocity.X *= 0.2f; + dustPtr->velocity.Y *= 0.2f; + } + } + if (Main.rand.Next(5) != 0) + return; + Dust* dustPtr1 = Main.dust.NewDust(43, ref this.aabb, 0.0, 0.0, 254, new Color(), 0.300000011920929); + if ((IntPtr) dustPtr1 == IntPtr.Zero) + return; + dustPtr1->velocity.X += this.velocity.X * 0.5f; + dustPtr1->velocity.Y += this.velocity.Y * 0.5f; + dustPtr1->velocity.X *= 0.5f; + dustPtr1->velocity.Y *= 0.5f; + } + else + { + if ((int) this.type != 112) + return; + if (Main.rand.Next(3) == 0) + { + Dust* dustPtr = Main.dust.NewDust(57, ref this.aabb, (double) this.velocity.X * 0.200000002980232, (double) this.velocity.Y * 0.200000002980232, 200, new Color(), 1.20000004768372); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.X += this.velocity.X * 0.3f; + dustPtr->velocity.Y += this.velocity.Y * 0.3f; + dustPtr->velocity.X *= 0.2f; + dustPtr->velocity.Y *= 0.2f; + } + } + if (Main.rand.Next(4) != 0) + return; + Dust* dustPtr1 = Main.dust.NewDust(43, ref this.aabb, 0.0, 0.0, 254, new Color(), 0.300000011920929); + if ((IntPtr) dustPtr1 == IntPtr.Zero) + return; + dustPtr1->velocity.X += this.velocity.X * 0.5f; + dustPtr1->velocity.Y += this.velocity.Y * 0.5f; + dustPtr1->velocity.X *= 0.5f; + dustPtr1->velocity.Y *= 0.5f; + } + } + + private unsafe void ChainsawAI() + { + if ((int) this.soundDelay <= 0) + { + Main.PlaySound(2, this.aabb.X, this.aabb.Y, 22); + this.soundDelay = (short) 30; + } + Player player = Main.player[(int) this.owner]; + if (player.isLocal()) + { + if (player.channel) + { + float num1 = player.inventory[(int) player.selectedItem].shootSpeed * this.scale; + Vector2 vector2 = new Vector2(player.position.X + 10f, player.position.Y + 21f); + float num2 = (float) ((int) player.ui.mouseX + player.view.screenPosition.X) - vector2.X; + float num3 = (float) ((int) player.ui.mouseY + player.view.screenPosition.Y) - vector2.Y; + float num4 = (float) ((double) num2 * (double) num2 + (double) num3 * (double) num3); + if ((double) num4 > 0.0) + { + float num5 = (float) Math.Sqrt((double) num4); + float num6 = num1 / num5; + num2 *= num6; + num3 *= num6; + } + if ((double) num2 != (double) this.velocity.X || (double) num3 != (double) this.velocity.Y) + this.netUpdate = true; + this.velocity.X = num2; + this.velocity.Y = num3; + } + else + this.Kill(); + } + if ((double) this.velocity.X > 0.0) + this.direction = (sbyte) 1; + else if ((double) this.velocity.X < 0.0) + this.direction = (sbyte) -1; + this.spriteDirection = this.direction; + player.direction = this.direction; + player.heldProj = this.whoAmI; + player.itemTime = (byte) 2; + player.itemAnimation = (short) 2; + this.position.X = player.position.X + 10f - (float) ((int) this.width >> 1); + this.position.Y = player.position.Y + 21f - (float) ((int) this.height >> 1); + this.aabb.X = (int) this.position.X; + this.aabb.Y = (int) this.position.Y; + this.rotation = (float) (Math.Atan2((double) this.velocity.Y, (double) this.velocity.X) + 1.57000005245209); + player.itemRotation = (float) Math.Atan2((double) this.velocity.Y * (double) this.direction, (double) this.velocity.X * (double) this.direction); + this.velocity.X *= (float) (1.0 + (double) Main.rand.Next(-3, 4) * 0.00999999977648258); + if (Main.rand.Next(8) != 0) + return; + float num = (float) Main.rand.Next(6, 10) * 0.1f; + Dust* dustPtr = Main.dust.NewDust((int) ((double) this.position.X + (double) this.velocity.X * (double) num) - 4, (int) ((double) this.position.Y + (double) this.velocity.Y * (double) num), (int) this.width, (int) this.height, 31, 0.0, 0.0, 80, new Color(), 1.39999997615814); + if ((IntPtr) dustPtr == IntPtr.Zero) + return; + dustPtr->noGravity = true; + dustPtr->velocity.X *= 0.2f; + dustPtr->velocity.Y = (float) -Main.rand.Next(7, 13) * 0.15f; + } + + private unsafe void NoteAI() + { + this.rotation = this.velocity.X * 0.1f; + this.spriteDirection = -this.direction; + if (Main.rand.Next(4) == 0) + { + Dust* dustPtr = Main.dust.NewDust(27, ref this.aabb, 0.0, 0.0, 80, new Color(), 1.0); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->noGravity = true; + dustPtr->velocity.X *= 0.2f; + dustPtr->velocity.Y *= 0.2f; + } + } + if (this.ai1 != 1) + return; + this.ai1 = 0; + Main.harpNote = this.ai0; + Main.PlaySound(2, this.aabb.X, this.aabb.Y, 26); + } + + private unsafe void IceBlockAI() + { + if ((double) this.velocity.X == 0.0 && (double) this.velocity.Y == 0.0) + this.alpha = byte.MaxValue; + if (this.ai1 < 0) + { + if ((double) this.velocity.X > 0.0) + this.rotation += 0.3f; + else + this.rotation -= 0.3f; + int num1 = (this.aabb.X >> 4) - 1; + int num2 = (this.aabb.X + (int) this.width >> 4) + 2; + int num3 = (this.aabb.Y >> 4) - 1; + int num4 = (this.aabb.Y + (int) this.height >> 4) + 2; + if (num1 < 0) + num1 = 0; + if (num2 > (int) Main.maxTilesX) + num2 = (int) Main.maxTilesX; + if (num3 < 0) + num3 = 0; + if (num4 > (int) Main.maxTilesY) + num4 = (int) Main.maxTilesY; + int num5 = this.aabb.X + 4; + int num6 = this.aabb.Y + 4; + for (int index1 = num1; index1 < num2; ++index1) + { + for (int index2 = num3; index2 < num4; ++index2) + { + if ((int) Main.tile[index1, index2].active != 0) + { + int index3 = (int) Main.tile[index1, index2].type; + if (index3 != (int) sbyte.MaxValue && Main.tileSolidNotSolidTop[index3]) + { + Vector2 vector2; + vector2.X = (float) (index1 * 16); + vector2.Y = (float) (index2 * 16); + if ((double) (num5 + 8) > (double) vector2.X && (double) num5 < (double) vector2.X + 16.0 && ((double) (num6 + 8) > (double) vector2.Y && (double) num6 < (double) vector2.Y + 16.0)) + this.Kill(); + } + } + } + } + Dust* dustPtr = Main.dust.NewDust(67, ref this.aabb, 0.0, 0.0, 0, new Color(), 1.0); + if ((IntPtr) dustPtr == IntPtr.Zero) + return; + dustPtr->noGravity = true; + dustPtr->velocity.X *= 0.3f; + dustPtr->velocity.Y *= 0.3f; + } + else if ((double) this.ai0 < 0.0) + { + if ((double) this.ai0 == -1.0) + { + for (int index = 0; index < 8; ++index) + { + Dust* dustPtr = Main.dust.NewDust(67, ref this.aabb, 0.0, 0.0, 0, new Color(), 1.10000002384186); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->noGravity = true; + dustPtr->velocity.X *= 1.3f; + dustPtr->velocity.Y *= 1.3f; + } + else + break; + } + } + else if (Main.rand.Next(32) == 0) + { + Dust* dustPtr = Main.dust.NewDust(67, ref this.aabb, 0.0, 0.0, 100, new Color(), 1.0); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.X *= 0.2f; + dustPtr->velocity.Y *= 0.2f; + } + } + int index1 = this.aabb.X >> 4; + int index2 = this.aabb.Y >> 4; + if ((int) Main.tile[index1, index2].active == 0) + this.Kill(); + if ((double) --this.ai0 > -300.0 || !this.isLocal() || ((int) Main.tile[index1, index2].type != (int) sbyte.MaxValue || (int) Main.tile[index1, index2].active == 0)) + return; + WorldGen.KillTile(index1, index2); + NetMessage.CreateMessage5(17, 0, index1, index2, 0, 0); + NetMessage.SendMessage(); + this.Kill(); + } + else + { + int num1 = (this.aabb.X >> 4) - 1; + int num2 = (this.aabb.X + (int) this.width >> 4) + 2; + int num3 = (this.aabb.Y >> 4) - 1; + int num4 = (this.aabb.Y + (int) this.height >> 4) + 2; + if (num1 < 0) + num1 = 0; + if (num2 > (int) Main.maxTilesX) + num2 = (int) Main.maxTilesX; + if (num3 < 0) + num3 = 0; + if (num4 > (int) Main.maxTilesY) + num4 = (int) Main.maxTilesY; + int num5 = this.aabb.X + 4; + int num6 = this.aabb.Y + 4; + for (int index1 = num1; index1 < num2; ++index1) + { + for (int index2 = num3; index2 < num4; ++index2) + { + if ((int) Main.tile[index1, index2].active != 0 && (int) Main.tile[index1, index2].type != (int) sbyte.MaxValue && Main.tileSolidNotSolidTop[(int) Main.tile[index1, index2].type]) + { + Vector2 vector2; + vector2.X = (float) (index1 * 16); + vector2.Y = (float) (index2 * 16); + if ((double) (num5 + 8) > (double) vector2.X && (double) num5 < (double) vector2.X + 16.0 && ((double) (num6 + 8) > (double) vector2.Y && (double) num6 < (double) vector2.Y + 16.0)) + this.Kill(); + } + } + } + if (this.lavaWet) + this.Kill(); + if ((int) this.active == 0) + return; + Dust* dustPtr = Main.dust.NewDust(67, ref this.aabb, 0.0, 0.0, 0, new Color(), 1.0); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->noGravity = true; + dustPtr->velocity.X *= 0.3f; + dustPtr->velocity.Y *= 0.3f; + } + int i = (int) this.ai0; + int j = this.ai1; + if ((double) this.velocity.X > 0.0) + this.rotation += 0.3f; + else + this.rotation -= 0.3f; + if (!this.isLocal()) + return; + int num7 = this.aabb.X + ((int) this.width >> 1) >> 4; + int num8 = this.aabb.Y + ((int) this.height >> 1) >> 4; + if ((num7 != i || num8 != j) && (((double) this.velocity.X > 0.0 || num7 > i) && ((double) this.velocity.X < 0.0 || num7 < i) || ((double) this.velocity.Y > 0.0 || num8 > j) && ((double) this.velocity.Y < 0.0 || num8 < j))) + return; + if (WorldGen.PlaceTile(i, j, (int) sbyte.MaxValue, false, false, (int) this.owner, 0)) + { + NetMessage.CreateMessage5(17, 1, (int) this.ai0, this.ai1, (int) sbyte.MaxValue, 0); + NetMessage.SendMessage(); + this.damage = (short) 0; + this.ai0 = -1f; + this.velocity.X = 0.0f; + this.velocity.Y = 0.0f; + this.alpha = byte.MaxValue; + this.position.X = (float) (this.aabb.X = i * 16); + this.position.Y = (float) (this.aabb.Y = j * 16); + this.netUpdate = true; + } + else + this.ai1 = -1; + } + } + + private unsafe void FlameAI() + { + if (this.timeLeft > 60) + this.timeLeft = 60; + if ((double) this.ai0 > 7.0) + { + float num = 1f; + if ((double) this.ai0 == 8.0) + num = 0.25f; + else if ((double) this.ai0 == 9.0) + num = 0.5f; + else if ((double) this.ai0 == 10.0) + num = 0.75f; + ++this.ai0; + int Type = (int) this.type == 101 ? 75 : 6; + if (Type == 6 || Main.rand.Next(3) == 0) + { + Dust* dustPtr = Main.dust.NewDust(Type, ref this.aabb, (double) this.velocity.X * 0.200000002980232, (double) this.velocity.Y * 0.200000002980232, 100, new Color(), 1.0); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + if (Main.rand.Next(3) != 0 || Type == 75 && Main.rand.Next(3) == 0) + { + dustPtr->noGravity = true; + dustPtr->scale *= 3f; + dustPtr->velocity.X *= 2f; + dustPtr->velocity.Y *= 2f; + } + dustPtr->scale *= num * 1.5f; + dustPtr->velocity.X *= 1.2f; + dustPtr->velocity.Y *= 1.2f; + if (Type == 75) + { + dustPtr->velocity.X += this.velocity.X; + dustPtr->velocity.Y += this.velocity.Y; + if (!dustPtr->noGravity) + { + dustPtr->velocity.X *= 0.5f; + dustPtr->velocity.Y *= 0.5f; + } + } + } + } + } + else + ++this.ai0; + this.rotation += 0.3f * (float) this.direction; + } + + private unsafe void CrystalShardAI() + { + this.light = this.scale * 0.5f; + this.rotation += this.velocity.X * 0.2f; + ++this.ai1; + if ((int) this.type == 94) + { + if (Main.rand.Next(4) == 0) + { + Dust* dustPtr = Main.dust.NewDust(70, ref this.aabb, 0.0, 0.0, 0, new Color(), 1.0); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->noGravity = true; + dustPtr->velocity.X *= 0.5f; + dustPtr->velocity.Y *= 0.5f; + dustPtr->scale *= 0.9f; + } + } + this.velocity.X *= 0.985f; + this.velocity.Y *= 0.985f; + if (this.ai1 <= 130) + return; + this.scale -= 0.05f; + if ((double) this.scale > 0.2) + return; + this.scale = 0.2f; + this.Kill(); + } + else + { + this.velocity.X *= 0.96f; + this.velocity.Y *= 0.96f; + if (this.ai1 <= 15) + return; + this.scale -= 0.05f; + if ((double) this.scale > 0.2) + return; + this.scale = 0.2f; + this.Kill(); + } + } + + private void BoulderAI() + { + if ((double) this.ai0 != 0.0 && (double) this.velocity.Y <= 0.0 && (double) this.velocity.X == 0.0) + { + int i1 = this.aabb.X - 8 >> 4; + int j1 = this.aabb.Y >> 4; + bool flag1 = WorldGen.SolidTile(i1, j1) || WorldGen.SolidTile(i1, j1 + 1); + int i2 = this.aabb.X + (int) this.width + 8 >> 4; + bool flag2 = flag1 || WorldGen.SolidTile(i2, j1) || WorldGen.SolidTile(i2, j1 + 1); + if (flag1) + this.velocity.X = 0.5f; + else if (flag2) + { + this.velocity.X = -0.5f; + } + else + { + int i3 = this.aabb.X - 8 - 16 >> 4; + int j2 = this.aabb.Y >> 4; + bool flag3 = WorldGen.SolidTile(i3, j2) || WorldGen.SolidTile(i3, j2 + 1); + int i4 = this.aabb.X + (int) this.width + 8 + 16 >> 4; + bool flag4 = flag3 || WorldGen.SolidTile(i4, j2) || WorldGen.SolidTile(i4, j2 + 1); + if (flag3) + this.velocity.X = 0.5f; + else if (flag4) + { + this.velocity.X = -0.5f; + } + else + { + int i5 = this.aabb.X + 4 >> 4; + int j3 = this.aabb.Y + (int) this.height + 8 >> 4; + this.velocity.X = WorldGen.SolidTile(i5, j3) || WorldGen.SolidTile(i5, j3 + 1) ? -0.5f : 0.5f; + } + } + } + this.rotation += this.velocity.X * 0.06f; + this.ai0 = 1f; + if ((double) this.velocity.Y > 16.0) + this.velocity.Y = 16f; + else if ((double) this.velocity.Y <= 6.0) + { + if ((double) this.velocity.X > 0.0 && (double) this.velocity.X < 7.0) + this.velocity.X += 0.05f; + else if ((double) this.velocity.X < 0.0 && (double) this.velocity.X > -7.0) + this.velocity.X -= 0.05f; + } + this.velocity.Y += 0.3f; + } + + public unsafe void Kill() + { + if ((int) this.active == 0) + return; + this.timeLeft = 0; + int num1 = this.aabb.X = (int) this.position.X; + int num2 = this.aabb.Y = (int) this.position.Y; + if ((int) this.type == 1 || (int) this.type == 81 || (int) this.type == 98) + { + Main.PlaySound(0, num1, num2, 1); + for (int index = 0; index < 8; ++index) + Main.dust.NewDust(7, ref this.aabb, 0.0, 0.0, 0, new Color(), 1.0); + } + else if ((int) this.type == 93) + { + Main.PlaySound(0, num1, num2, 1); + for (int index = 0; index < 8; ++index) + { + Dust* dustPtr = Main.dust.NewDust(57, ref this.aabb, 0.0, 0.0, 100, new Color(), 0.5); + if ((IntPtr) dustPtr != IntPtr.Zero) + dustPtr->velocity *= 2f; + else + break; + } + } + else if ((int) this.type == 99) + { + Main.PlaySound(0, num1, num2, 1); + for (int index = 0; index < 24; ++index) + { + Dust* dustPtr = Main.dust.NewDust(1, ref this.aabb, 0.0, 0.0, 0, new Color(), 1.0); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + if (Main.rand.Next(2) == 0) + dustPtr->scale *= 1.4f; + this.velocity.X *= 1.9f; + this.velocity.Y *= 1.9f; + } + else + break; + } + } + else if ((int) this.type == 91 || (int) this.type == 92) + { + Main.PlaySound(2, num1, num2, 10); + for (int index = 0; index < 8; ++index) + Main.dust.NewDust(58, ref this.aabb, (double) this.velocity.X * 0.100000001490116, (double) this.velocity.Y * 0.100000001490116, 150, new Color(), 1.20000004768372); + for (int index = 0; index < 3; ++index) + Gore.NewGore(this.position, new Vector2(this.velocity.X * 0.05f, this.velocity.Y * 0.05f), Main.rand.Next(16, 18), 1.0); + if ((int) this.type == 12 && (int) this.damage < 500) + { + for (int index = 0; index < 8; ++index) + Main.dust.NewDust(57, ref this.aabb, (double) this.velocity.X * 0.100000001490116, (double) this.velocity.Y * 0.100000001490116, 150, new Color(), 1.20000004768372); + for (int index = 0; index < 3; ++index) + Gore.NewGore(this.position, new Vector2(this.velocity.X * 0.05f, this.velocity.Y * 0.05f), Main.rand.Next(16, 18), 1.0); + } + if (((int) this.type == 91 || (int) this.type == 92 && (double) this.ai0 > 0.0) && this.isLocal()) + { + int number = this.NewClonedProjectile(92); + if (number >= 0) + { + float num3 = (float) Main.rand.Next(-400, 400); + float num4 = (float) -Main.rand.Next(600, 900); + Main.projectile[number].position.X += num3; + Main.projectile[number].position.Y += num4; + float num5 = 22f / (float) Math.Sqrt((double) num3 * (double) num3 + (double) num4 * (double) num4); + float num6 = num3 * num5; + float num7 = num4 * num5; + Main.projectile[number].velocity.X = num6; + Main.projectile[number].velocity.Y = num7; + if ((int) this.type == 91) + { + Main.projectile[number].damage >>= 1; + Main.projectile[number].ai0 = 1f; + } + Main.projectile[number].ai1 = num2; + NetMessage.SendProjectile(number, SendDataOptions.Reliable); + } + } + } + else if ((int) this.type == 89) + { + Main.PlaySound(0, num1, num2, 1); + for (int index = 0; index < 3; ++index) + { + Dust* dustPtr = Main.dust.NewDust(68, ref this.aabb, 0.0, 0.0, 0, new Color(), 1.0); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->noGravity = true; + dustPtr->velocity.X *= 1.5f; + dustPtr->velocity.Y *= 1.5f; + dustPtr->scale *= 0.9f; + } + else + break; + } + if (this.isLocal()) + { + for (int index = 0; index < 3; ++index) + { + float SpeedX = (float) (-(double) this.velocity.X * (double) Main.rand.Next(40, 70) * 0.00999999977648258 + (double) Main.rand.Next(-20, 21) * 0.400000005960464); + float SpeedY = (float) (-(double) this.velocity.Y * (double) Main.rand.Next(40, 70) * 0.00999999977648258 + (double) Main.rand.Next(-20, 21) * 0.400000005960464); + Projectile.NewProjectile(this.position.X + SpeedX, this.position.Y + SpeedY, SpeedX, SpeedY, 90, (int) ((double) this.damage * 0.6), 0.0f, (int) this.owner, true); + } + } + } + else if ((int) this.type == 80) + { + if ((double) this.ai0 >= 0.0) + { + Main.PlaySound(2, num1, num2, 27); + for (int index = 0; index < 8; ++index) + Main.dust.NewDust(67, ref this.aabb, 0.0, 0.0, 0, new Color(), 1.0); + } + int i = num1 >> 4; + int j = num2 >> 4; + if ((int) Main.tile[i, j].type == (int) sbyte.MaxValue && (int) Main.tile[i, j].active != 0) + WorldGen.KillTile(i, j); + } + else if ((int) this.type == 76 || (int) this.type == 77 || (int) this.type == 78) + { + for (int index = 0; index < 4; ++index) + { + Dust* dustPtr = Main.dust.NewDust(27, ref this.aabb, 0.0, 0.0, 80, new Color(), 1.5); + if ((IntPtr) dustPtr != IntPtr.Zero) + dustPtr->noGravity = true; + else + break; + } + } + else if ((int) this.type == 55) + { + for (int index = 0; index < 4; ++index) + { + Dust* dustPtr = Main.dust.NewDust(18, ref this.aabb, 0.0, 0.0, 0, new Color(), 1.5); + if ((IntPtr) dustPtr != IntPtr.Zero) + dustPtr->noGravity = true; + else + break; + } + } + else if ((int) this.type == 51) + { + Main.PlaySound(0, num1, num2, 1); + for (int index = 0; index < 4; ++index) + Main.dust.NewDust(0, ref this.aabb, 0.0, 0.0, 0, new Color(), 0.699999988079071); + } + else if ((int) this.type == 2 || (int) this.type == 82) + { + Main.PlaySound(0, num1, num2, 1); + for (int index = 0; index < 16; ++index) + Main.dust.NewDust(6, ref this.aabb, 0.0, 0.0, 100, new Color(), 1.0); + } + else if ((int) this.type == 103) + { + Main.PlaySound(0, num1, num2, 1); + for (int index = 0; index < 14; ++index) + { + Dust* dustPtr = Main.dust.NewDust(75, ref this.aabb, 0.0, 0.0, 100, new Color(), 1.0); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + if (Main.rand.Next(2) == 0) + { + dustPtr->scale *= 2.5f; + dustPtr->noGravity = true; + dustPtr->velocity.X *= 5f; + dustPtr->velocity.Y *= 5f; + } + } + else + break; + } + } + else if ((int) this.type == 3 || (int) this.type == 48 || (int) this.type == 54) + { + Main.PlaySound(0, num1, num2, 1); + for (int index = 0; index < 7; ++index) + Main.dust.NewDust(1, ref this.aabb, (double) this.velocity.X * 0.100000001490116, (double) this.velocity.Y * 0.100000001490116, 0, new Color(), 0.75); + } + else if ((int) this.type == 4) + { + Main.PlaySound(0, num1, num2, 1); + for (int index = 0; index < 7; ++index) + Main.dust.NewDust(14, ref this.aabb, 0.0, 0.0, 150, new Color(), 1.10000002384186); + } + else if ((int) this.type == 5) + { + Main.PlaySound(2, num1, num2, 10); + for (int index = 0; index < 48; ++index) + { + int Type; + switch (Main.rand.Next(3)) + { + case 0: + Type = 15; + break; + case 1: + Type = 57; + break; + default: + Type = 58; + break; + } + Main.dust.NewDust(Type, ref this.aabb, (double) this.velocity.X * 0.5, (double) this.velocity.Y * 0.5, 150, new Color(), 1.5); + } + } + else if ((int) this.type == 9 || (int) this.type == 12) + { + Main.PlaySound(2, num1, num2, 10); + for (int index = 0; index < 8; ++index) + Main.dust.NewDust(58, ref this.aabb, (double) this.velocity.X * 0.100000001490116, (double) this.velocity.Y * 0.100000001490116, 150, new Color(), 1.20000004768372); + for (int index = 0; index < 3; ++index) + Gore.NewGore(this.position, new Vector2(this.velocity.X * 0.05f, this.velocity.Y * 0.05f), Main.rand.Next(16, 18), 1.0); + if ((int) this.type == 12 && (int) this.damage < 100) + { + for (int index = 0; index < 8; ++index) + Main.dust.NewDust(57, ref this.aabb, (double) this.velocity.X * 0.100000001490116, (double) this.velocity.Y * 0.100000001490116, 150, new Color(), 1.20000004768372); + for (int index = 0; index < 3; ++index) + Gore.NewGore(this.position, new Vector2(this.velocity.X * 0.05f, this.velocity.Y * 0.05f), Main.rand.Next(16, 18), 1.0); + } + } + else if ((int) this.type == 14 || (int) this.type == 20 || ((int) this.type == 36 || (int) this.type == 83) || ((int) this.type == 84 || (int) this.type == 100 || (int) this.type == 110)) + { + Collision.HitTiles(this.position, this.velocity, (int) this.width, (int) this.height); + Main.PlaySound(2, num1, num2, 10); + } + else if ((int) this.type == 15 || (int) this.type == 34) + { + Main.PlaySound(2, num1, num2, 10); + for (int index = 0; index < 16; ++index) + { + Dust* dustPtr1 = Main.dust.NewDust(6, ref this.aabb, (double) this.velocity.X * -0.200000002980232, (double) this.velocity.Y * -0.200000002980232, 100, new Color(), 2.0); + if ((IntPtr) dustPtr1 != IntPtr.Zero) + { + dustPtr1->noGravity = true; + dustPtr1->velocity.X *= 2f; + dustPtr1->velocity.Y *= 2f; + Dust* dustPtr2 = Main.dust.NewDust(6, ref this.aabb, (double) this.velocity.X * -0.200000002980232, (double) this.velocity.Y * -0.200000002980232, 100, new Color(), 1.0); + if ((IntPtr) dustPtr2 != IntPtr.Zero) + { + dustPtr2->velocity.X *= 2f; + dustPtr2->velocity.Y *= 2f; + } + else + break; + } + else + break; + } + } + else if ((int) this.type == 95 || (int) this.type == 96) + { + Main.PlaySound(2, num1, num2, 10); + for (int index = 0; index < 16; ++index) + { + Dust* dustPtr1 = Main.dust.NewDust(75, ref this.aabb, (double) this.velocity.X * -0.200000002980232, (double) this.velocity.Y * -0.200000002980232, 100, new Color(), 2.0 * (double) this.scale); + if ((IntPtr) dustPtr1 != IntPtr.Zero) + { + dustPtr1->noGravity = true; + dustPtr1->velocity.X *= 2f; + dustPtr1->velocity.Y *= 2f; + Dust* dustPtr2 = Main.dust.NewDust(75, ref this.aabb, (double) this.velocity.X * -0.200000002980232, (double) this.velocity.Y * -0.200000002980232, 100, new Color(), 1.0 * (double) this.scale); + if ((IntPtr) dustPtr2 != IntPtr.Zero) + { + dustPtr2->velocity.X *= 2f; + dustPtr2->velocity.Y *= 2f; + } + else + break; + } + else + break; + } + } + else if ((int) this.type == 79) + { + Main.PlaySound(2, num1, num2, 10); + for (int index = 0; index < 12; ++index) + { + Dust* dustPtr = Main.dust.NewDust(66, ref this.aabb, 0.0, 0.0, 100, new Color(Main.DiscoRGB), 2.0); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->noGravity = true; + dustPtr->velocity.X *= 4f; + dustPtr->velocity.Y *= 4f; + } + else + break; + } + } + else if ((int) this.type == 16) + { + Main.PlaySound(2, num1, num2, 10); + for (int index = 0; index < 12; ++index) + { + Dust* dustPtr = Main.dust.NewDust((int) ((double) this.position.X - (double) this.velocity.X), (int) ((double) this.position.Y - (double) this.velocity.Y), (int) this.width, (int) this.height, 15, 0.0, 0.0, 100, new Color(), 2.0); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->noGravity = true; + dustPtr->velocity.X *= 2f; + dustPtr->velocity.Y *= 2f; + Main.dust.NewDust((int) ((double) this.position.X - (double) this.velocity.X), (int) ((double) this.position.Y - (double) this.velocity.Y), (int) this.width, (int) this.height, 15, 0.0, 0.0, 100, new Color(), 1.0); + } + else + break; + } + } + else if ((int) this.type == 17) + { + Main.PlaySound(0, num1, num2, 1); + for (int index = 0; index < 2; ++index) + Main.dust.NewDust(0, ref this.aabb, 0.0, 0.0, 0, new Color(), 1.0); + } + else if ((int) this.type == 31 || (int) this.type == 42) + { + Main.PlaySound(0, num1, num2, 1); + for (int index = 0; index < 2; ++index) + { + Dust* dustPtr = Main.dust.NewDust(32, ref this.aabb, 0.0, 0.0, 0, new Color(), 1.0); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.X *= 0.6f; + dustPtr->velocity.Y *= 0.6f; + } + else + break; + } + } + else if ((int) this.type == 109) + { + Main.PlaySound(0, num1, num2, 1); + for (int index = 0; index < 3; ++index) + { + Dust* dustPtr = Main.dust.NewDust(51, ref this.aabb, 0.0, 0.0, 0, new Color(), 0.600000023841858); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.X *= 0.6f; + dustPtr->velocity.Y *= 0.6f; + } + else + break; + } + } + else if ((int) this.type == 39) + { + Main.PlaySound(0, num1, num2, 1); + for (int index = 0; index < 3; ++index) + { + Dust* dustPtr = Main.dust.NewDust(38, ref this.aabb, 0.0, 0.0, 0, new Color(), 1.0); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.X *= 0.6f; + dustPtr->velocity.Y *= 0.6f; + } + else + break; + } + } + else if ((int) this.type == 71) + { + Main.PlaySound(0, num1, num2, 1); + for (int index = 0; index < 3; ++index) + { + Dust* dustPtr = Main.dust.NewDust(53, ref this.aabb, 0.0, 0.0, 0, new Color(), 1.0); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.X *= 0.6f; + dustPtr->velocity.Y *= 0.6f; + } + else + break; + } + } + else if ((int) this.type == 40) + { + Main.PlaySound(0, num1, num2, 1); + for (int index = 0; index < 3; ++index) + { + Dust* dustPtr = Main.dust.NewDust(36, ref this.aabb, 0.0, 0.0, 0, new Color(), 1.0); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.X *= 0.6f; + dustPtr->velocity.Y *= 0.6f; + } + else + break; + } + } + else if ((int) this.type == 21) + { + Main.PlaySound(0, num1, num2, 1); + for (int index = 0; index < 8; ++index) + Main.dust.NewDust(26, ref this.aabb, 0.0, 0.0, 0, new Color(), 0.800000011920929); + } + else if ((int) this.type == 24) + { + for (int index = 0; index < 6; ++index) + Main.dust.NewDust(1, ref this.aabb, (double) this.velocity.X * 0.100000001490116, (double) this.velocity.Y * 0.100000001490116, 0, new Color(), 0.75); + } + else if ((int) this.type == 27) + { + Main.PlaySound(2, num1, num2, 10); + for (int index = 0; index < 20; ++index) + { + Dust* dustPtr = Main.dust.NewDust(29, ref this.aabb, (double) this.velocity.X * 0.100000001490116, (double) this.velocity.Y * 0.100000001490116, 100, new Color(), 3.0); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->noGravity = true; + Main.dust.NewDust(29, ref this.aabb, (double) this.velocity.X * 0.100000001490116, (double) this.velocity.Y * 0.100000001490116, 100, new Color(), 2.0); + } + else + break; + } + } + else if ((int) this.type == 38) + { + for (int index = 0; index < 6; ++index) + Main.dust.NewDust(42, ref this.aabb, (double) this.velocity.X * 0.100000001490116, (double) this.velocity.Y * 0.100000001490116, 0, new Color(), 1.0); + } + else if ((int) this.type == 44 || (int) this.type == 45) + { + Main.PlaySound(2, num1, num2, 10); + for (int index = 0; index < 18; ++index) + { + Dust* dustPtr = Main.dust.NewDust(27, ref this.aabb, (double) this.velocity.X, (double) this.velocity.Y, 100, new Color(), 1.70000004768372); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->noGravity = true; + Main.dust.NewDust(27, ref this.aabb, (double) this.velocity.X, (double) this.velocity.Y, 100, new Color(), 1.0); + } + else + break; + } + } + else if ((int) this.type == 41 || (int) this.type == 114) + { + Main.PlaySound(2, num1, num2, 14); + int num3 = 0; + while (num3 < 6 && (IntPtr) Main.dust.NewDust(31, ref this.aabb, 0.0, 0.0, 100, new Color(), 1.5) != IntPtr.Zero) + ++num3; + int Type = (int) this.type == 114 ? 64 : 6; + for (int index = 0; index < 3; ++index) + { + Dust* dustPtr1 = Main.dust.NewDust(Type, ref this.aabb, 0.0, 0.0, 100, new Color(), 2.5); + if ((IntPtr) dustPtr1 != IntPtr.Zero) + { + dustPtr1->noGravity = true; + dustPtr1->velocity.X *= 3f; + dustPtr1->velocity.Y *= 3f; + Dust* dustPtr2 = Main.dust.NewDust(Type, ref this.aabb, 0.0, 0.0, 100, new Color(), 1.5); + if ((IntPtr) dustPtr2 != IntPtr.Zero) + { + dustPtr2->velocity.X *= 2f; + dustPtr2->velocity.Y *= 2f; + } + else + break; + } + else + break; + } + int index1 = Gore.NewGore(this.position, new Vector2(), Main.rand.Next(61, 64), 1.0); + Main.gore[index1].velocity *= 0.4f; + Main.gore[index1].velocity.X += (float) Main.rand.Next(-10, 11) * 0.1f; + Main.gore[index1].velocity.Y += (float) Main.rand.Next(-10, 11) * 0.1f; + int index2 = Gore.NewGore(this.position, new Vector2(), Main.rand.Next(61, 64), 1.0); + Main.gore[index2].velocity *= 0.4f; + Main.gore[index2].velocity.X += (float) Main.rand.Next(-10, 11) * 0.1f; + Main.gore[index2].velocity.Y += (float) Main.rand.Next(-10, 11) * 0.1f; + if (this.isLocal()) + { + this.penetrate = (sbyte) -1; + this.position.X += (float) ((int) this.width >> 1); + this.position.Y += (float) ((int) this.height >> 1); + this.aabb.Width = (int) (this.width = (ushort) 64); + this.aabb.Height = (int) (this.height = (ushort) 64); + this.position.X -= (float) ((int) this.width >> 1); + this.position.Y -= (float) ((int) this.height >> 1); + num1 = this.aabb.X = (int) this.position.X; + num2 = this.aabb.Y = (int) this.position.Y; + this.Damage(); + } + } + else if ((int) this.type == 28 || (int) this.type == 30 || ((int) this.type == 37 || (int) this.type == 75) || (int) this.type == 102) + { + Main.PlaySound(2, num1, num2, 14); + this.position.X += (float) ((int) this.width >> 1); + this.position.Y += (float) ((int) this.height >> 1); + this.aabb.Width = (int) (this.width = (ushort) 22); + this.aabb.Height = (int) (this.height = (ushort) 22); + this.position.X -= (float) ((int) this.width >> 1); + this.position.Y -= (float) ((int) this.height >> 1); + num1 = this.aabb.X = (int) this.position.X; + num2 = this.aabb.Y = (int) this.position.Y; + for (int index = 0; index < 16; ++index) + { + Dust* dustPtr = Main.dust.NewDust(31, ref this.aabb, 0.0, 0.0, 100, new Color(), 1.5); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.X *= 1.4f; + dustPtr->velocity.Y *= 1.4f; + } + else + break; + } + for (int index = 0; index < 7; ++index) + { + Dust* dustPtr1 = Main.dust.NewDust(6, ref this.aabb, 0.0, 0.0, 100, new Color(), 2.5); + if ((IntPtr) dustPtr1 != IntPtr.Zero) + { + dustPtr1->noGravity = true; + dustPtr1->velocity.X *= 5f; + dustPtr1->velocity.Y *= 5f; + Dust* dustPtr2 = Main.dust.NewDust(6, ref this.aabb, 0.0, 0.0, 100, new Color(), 1.5); + if ((IntPtr) dustPtr2 != IntPtr.Zero) + { + dustPtr2->velocity.X *= 3f; + dustPtr2->velocity.Y *= 3f; + } + else + break; + } + else + break; + } + int index1 = Gore.NewGore(this.position, new Vector2(), Main.rand.Next(61, 64), 1.0); + Main.gore[index1].velocity *= 0.4f; + ++Main.gore[index1].velocity.X; + ++Main.gore[index1].velocity.Y; + int index2 = Gore.NewGore(this.position, new Vector2(), Main.rand.Next(61, 64), 1.0); + Main.gore[index2].velocity *= 0.4f; + --Main.gore[index2].velocity.X; + ++Main.gore[index2].velocity.Y; + int index3 = Gore.NewGore(this.position, new Vector2(), Main.rand.Next(61, 64), 1.0); + Main.gore[index3].velocity *= 0.4f; + ++Main.gore[index3].velocity.X; + --Main.gore[index3].velocity.Y; + int index4 = Gore.NewGore(this.position, new Vector2(), Main.rand.Next(61, 64), 1.0); + Main.gore[index4].velocity *= 0.4f; + --Main.gore[index4].velocity.X; + --Main.gore[index4].velocity.Y; + } + else if ((int) this.type == 29 || (int) this.type == 108) + { + Main.PlaySound(2, num1, num2, 14); + if ((int) this.type == 29) + { + this.position.X += (float) (((int) this.width >> 1) - 100); + this.position.Y += (float) (((int) this.height >> 1) - 100); + num1 = this.aabb.X = (int) this.position.X; + num2 = this.aabb.Y = (int) this.position.Y; + this.aabb.Width = (int) (this.width = (ushort) 200); + this.aabb.Height = (int) (this.height = (ushort) 200); + } + for (int index = 0; index < 40; ++index) + { + Dust* dustPtr = Main.dust.NewDust(31, ref this.aabb, 0.0, 0.0, 100, new Color(), 2.0); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.X *= 1.4f; + dustPtr->velocity.Y *= 1.4f; + } + else + break; + } + for (int index = 0; index < 64; ++index) + { + Dust* dustPtr1 = Main.dust.NewDust(6, ref this.aabb, 0.0, 0.0, 100, new Color(), 3.0); + if ((IntPtr) dustPtr1 != IntPtr.Zero) + { + dustPtr1->noGravity = true; + dustPtr1->velocity.X *= 5f; + dustPtr1->velocity.Y *= 5f; + Dust* dustPtr2 = Main.dust.NewDust(6, ref this.aabb, 0.0, 0.0, 100, new Color(), 2.0); + if ((IntPtr) dustPtr2 != IntPtr.Zero) + { + dustPtr2->velocity.X *= 3f; + dustPtr2->velocity.Y *= 3f; + } + else + break; + } + else + break; + } + for (int index1 = 0; index1 < 2; ++index1) + { + int index2 = Gore.NewGore(num1 + ((int) this.width >> 1) - 24, num2 + ((int) this.height >> 1) - 24, new Vector2(), Main.rand.Next(61, 64)); + Main.gore[index2].scale = 1.5f; + Main.gore[index2].velocity.X += 1.5f; + Main.gore[index2].velocity.Y += 1.5f; + int index3 = Gore.NewGore(num1 + ((int) this.width >> 1) - 24, num2 + ((int) this.height >> 1) - 24, new Vector2(), Main.rand.Next(61, 64)); + Main.gore[index3].scale = 1.5f; + Main.gore[index3].velocity.X -= 1.5f; + Main.gore[index3].velocity.Y += 1.5f; + int index4 = Gore.NewGore(num1 + ((int) this.width >> 1) - 24, num2 + ((int) this.height >> 1) - 24, new Vector2(), Main.rand.Next(61, 64)); + Main.gore[index4].scale = 1.5f; + Main.gore[index4].velocity.X += 1.5f; + Main.gore[index4].velocity.Y -= 1.5f; + int index5 = Gore.NewGore(num1 + ((int) this.width >> 1) - 24, num2 + ((int) this.height >> 1) - 24, new Vector2(), Main.rand.Next(61, 64)); + Main.gore[index5].scale = 1.5f; + Main.gore[index5].velocity.X -= 1.5f; + Main.gore[index5].velocity.Y -= 1.5f; + } + this.position.X += (float) (((int) this.width >> 1) - 5); + this.position.Y += (float) (((int) this.height >> 1) - 5); + num1 = this.aabb.X = (int) this.position.X; + num2 = this.aabb.Y = (int) this.position.Y; + this.aabb.Width = (int) (this.width = (ushort) 10); + this.aabb.Height = (int) (this.height = (ushort) 10); + } + else if ((int) this.type == 69) + { + Main.PlaySound(13, num1, num2, 1); + for (int index = 0; index < 3; ++index) + Main.dust.NewDust(num1, num2, (int) this.width, (int) this.height, 13, 0.0, 0.0, 0, new Color(), 1.0); + for (int index = 0; index < 20; ++index) + { + Dust* dustPtr = Main.dust.NewDust(num1, num2, (int) this.width, (int) this.height, 33, 0.0, -2.0, 0, new Color(), 1.10000002384186); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->alpha = (short) 100; + dustPtr->velocity.X *= 4.5f; + dustPtr->velocity.Y *= 3f; + } + else + break; + } + } + else if ((int) this.type == 70) + { + Main.PlaySound(13, num1, num2, 1); + for (int index = 0; index < 3; ++index) + Main.dust.NewDust(num1, num2, (int) this.width, (int) this.height, 13, 0.0, 0.0, 0, new Color(), 1.0); + for (int index = 0; index < 20; ++index) + { + Dust* dustPtr = Main.dust.NewDust(num1, num2, (int) this.width, (int) this.height, 52, 0.0, -2.0, 0, new Color(), 1.10000002384186); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->alpha = (short) 100; + dustPtr->velocity.X *= 4.5f; + dustPtr->velocity.Y *= 3f; + } + else + break; + } + } + else if ((int) this.type == 111 || (int) this.type >= 115 && (int) this.type <= 119) + { + int index = Gore.NewGore(new Vector2((float) (num1 - ((int) this.width >> 1)), (float) (num2 - ((int) this.height >> 1))), new Vector2(), Main.rand.Next(11, 14), (double) this.scale); + Main.gore[index].velocity *= 0.1f; + } + if (this.isLocal()) + { + if ((int) this.type == 28 || (int) this.type == 29 || ((int) this.type == 37 || (int) this.type == 75) || (int) this.type == 108) + { + int num3 = 3; + if ((int) this.type == 29) + num3 = 7; + else if ((int) this.type == 108) + num3 = 10; + int num4 = num1 >> 4; + int num5 = num2 >> 4; + int num6 = num4 - num3; + int num7 = num4 + num3; + int num8 = num5 - num3; + int num9 = num5 + num3; + if (num6 < 0) + num6 = 0; + if (num7 > (int) Main.maxTilesX) + num7 = (int) Main.maxTilesX; + if (num8 < 0) + num8 = 0; + if (num9 > (int) Main.maxTilesY) + num9 = (int) Main.maxTilesY; + bool flag1 = false; + for (int index1 = num6; index1 <= num7; ++index1) + { + for (int index2 = num8; index2 <= num9; ++index2) + { + int num10 = Math.Abs(index1 - num4); + int num11 = Math.Abs(index2 - num5); + if (num10 * num10 + num11 * num11 < num3 * num3 && (int) Main.tile[index1, index2].wall == 0) + { + flag1 = true; + break; + } + } + } + for (int index1 = num6; index1 <= num7; ++index1) + { + for (int index2 = num8; index2 <= num9; ++index2) + { + int num10 = Math.Abs(index1 - num4); + int num11 = Math.Abs(index2 - num5); + if (num10 * num10 + num11 * num11 < num3 * num3) + { + bool flag2 = true; + if ((int) Main.tile[index1, index2].active != 0) + { + int index3 = (int) Main.tile[index1, index2].type; + switch (index3) + { + case 21: + case 26: + case 107: + case 108: + case 111: + flag2 = false; + break; + default: + if (!Main.tileDungeon[index3]) + { + if (index3 == 58 && !Main.hardMode) + { + flag2 = false; + break; + } + else if (WorldGen.KillTile(index1, index2)) + { + NetMessage.CreateMessage5(17, 0, index1, index2, 0, 0); + NetMessage.SendMessage(); + break; + } + else + break; + } + else + goto case 21; + } + } + if (flag2 && flag1) + { + for (int index3 = index1 - 1; index3 <= index1 + 1; ++index3) + { + for (int index4 = index2 - 1; index4 <= index2 + 1; ++index4) + { + if ((int) Main.tile[index3, index4].wall > 0) + { + WorldGen.KillWall(index3, index4, false); + if ((int) Main.tile[index3, index4].wall == 0) + { + NetMessage.CreateMessage5(17, 2, index3, index4, 0, 0); + NetMessage.SendMessage(); + } + } + } + } + } + } + } + } + } + NetMessage.CreateMessage2(29, (int) this.identity, (int) this.owner); + NetMessage.SendMessage(); + int number2 = -1; + if ((int) this.aiStyle == 10) + { + int num3 = 0; + int Type = 0; + byte num4 = this.type; + if ((uint) num4 <= 42U) + { + switch (num4) + { + case (byte) 31: + case (byte) 42: + num3 = 53; + goto label_297; + case (byte) 39: + num3 = 59; + Type = 176; + goto label_297; + case (byte) 40: + num3 = 57; + Type = 172; + goto label_297; + } + } + else + { + switch (num4) + { + case (byte) 56: + case (byte) 65: + num3 = 112; + goto label_297; + case (byte) 67: + case (byte) 68: + num3 = 116; + goto label_297; + case (byte) 71: + num3 = 123; + goto label_297; + case (byte) 109: + num3 = 147; + goto label_297; + } + } + number2 = Item.NewItem(num1, num2, (int) this.width, (int) this.height, 2, 1, false, 0); +label_297: + if (num3 > 0) + { + int index1 = num1 + ((int) this.width >> 1) >> 4; + int index2 = num2 + ((int) this.width >> 1) >> 4; + if ((int) Main.tile[index1, index2].active == 0 && WorldGen.PlaceTile(index1, index2, num3, false, true, -1, 0)) + { + NetMessage.CreateMessage5(17, 1, index1, index2, num3, 0); + NetMessage.SendMessage(); + } + else if (Type > 0) + number2 = Item.NewItem(num1, num2, (int) this.width, (int) this.height, Type, 1, false, 0); + } + } + if ((int) this.type == 1) + { + if (Main.rand.Next(3) == 0) + number2 = Item.NewItem(num1, num2, (int) this.width, (int) this.height, 40, 1, false, 0); + } + else if ((int) this.type == 2) + { + if (Main.rand.Next(3) == 0) + number2 = Main.rand.Next(3) != 0 ? Item.NewItem(num1, num2, (int) this.width, (int) this.height, 40, 1, false, 0) : Item.NewItem(num1, num2, (int) this.width, (int) this.height, 41, 1, false, 0); + } + else if ((int) this.type == 103) + { + if (Main.rand.Next(6) == 0) + number2 = Main.rand.Next(3) != 0 ? Item.NewItem(num1, num2, (int) this.width, (int) this.height, 40, 1, false, 0) : Item.NewItem(num1, num2, (int) this.width, (int) this.height, 545, 1, false, 0); + } + else if ((int) this.type == 113) + { + if (Main.rand.Next(4) == 0) + number2 = Item.NewItem(num1, num2, (int) this.width, (int) this.height, 616, 1, false, 0); + } + else if ((int) this.type == 91 && Main.rand.Next(6) == 0) + number2 = Item.NewItem(num1, num2, (int) this.width, (int) this.height, 516, 1, false, 0); + else if ((int) this.type == 50 && Main.rand.Next(3) == 0) + number2 = Item.NewItem(num1, num2, (int) this.width, (int) this.height, 282, 1, false, 0); + else if ((int) this.type == 53 && Main.rand.Next(3) == 0) + number2 = Item.NewItem(num1, num2, (int) this.width, (int) this.height, 286, 1, false, 0); + else if ((int) this.type == 48 && Main.rand.Next(2) == 0) + number2 = Item.NewItem(num1, num2, (int) this.width, (int) this.height, 279, 1, false, 0); + else if ((int) this.type == 54 && Main.rand.Next(2) == 0) + number2 = Item.NewItem(num1, num2, (int) this.width, (int) this.height, 287, 1, false, 0); + else if ((int) this.type == 3 && Main.rand.Next(2) == 0) + number2 = Item.NewItem(num1, num2, (int) this.width, (int) this.height, 42, 1, false, 0); + else if ((int) this.type == 4 && Main.rand.Next(4) == 0) + number2 = Item.NewItem(num1, num2, (int) this.width, (int) this.height, 47, 1, false, 0); + else if ((int) this.type == 12 && (int) this.damage > 100) + number2 = Item.NewItem(num1, num2, (int) this.width, (int) this.height, 75, 1, false, 0); + else if ((int) this.type == 69 || (int) this.type == 70) + { + int num3 = num1 + ((int) this.width >> 1) >> 4; + int num4 = num2 + ((int) this.height >> 1) >> 4; + for (int index1 = num3 - 4; index1 <= num3 + 4; ++index1) + { + for (int index2 = num4 - 4; index2 <= num4 + 4; ++index2) + { + if (Math.Abs(index1 - num3) + Math.Abs(index2 - num4) < 6) + { + int num5 = (int) Main.tile[index1, index2].type; + int num6 = 0; + if ((int) this.type == 69) + { + if (num5 == 2 || num5 == 23) + num6 = 109; + else if (num5 == 1 || num5 == 25) + num6 = 117; + else if (num5 == 53 || num5 == 112) + num6 = 116; + } + else if (num5 == 2 || num5 == 109) + num6 = 23; + else if (num5 == 1 || num5 == 117) + num6 = 25; + else if (num5 == 53 || num5 == 116) + num6 = 112; + if (num6 > 0) + { + Main.tile[index1, index2].type = (byte) num6; + WorldGen.SquareTileFrame(index1, index2, -1); + NetMessage.SendTile(index1, index2); + } + } + } + } + } + else if ((int) this.type == 21 && Main.rand.Next(2) == 0) + number2 = Item.NewItem(num1, num2, (int) this.width, (int) this.height, 154, 1, false, 0); + if (number2 >= 0) + { + NetMessage.CreateMessage2(21, (int) UI.main.myPlayer, number2); + NetMessage.SendMessage(); + } + } + this.active = (byte) 0; + } + + public Color GetAlpha(Color newColor) + { + if ((int) this.type == 34 || (int) this.type == 15 || ((int) this.type == 93 || (int) this.type == 94) || ((int) this.type == 95 || (int) this.type == 96 || (int) this.type == 102 && (int) this.alpha < (int) byte.MaxValue)) + return new Color(200, 200, 200, 25); + if ((int) this.type == 83 || (int) this.type == 88 || ((int) this.type == 89 || (int) this.type == 90) || ((int) this.type == 100 || (int) this.type == 104)) + { + if ((int) this.alpha < 200) + return new Color((int) byte.MaxValue - (int) this.alpha, (int) byte.MaxValue - (int) this.alpha, (int) byte.MaxValue - (int) this.alpha, 0); + else + return new Color(); + } + else + { + if ((int) this.type == 34 || (int) this.type == 35 || ((int) this.type == 15 || (int) this.type == 19) || ((int) this.type == 44 || (int) this.type == 45)) + return Color.White; + if ((int) this.type == 79) + return new Color(); + int r; + int g; + int b; + if ((int) this.type == 9 || (int) this.type == 15 || ((int) this.type == 34 || (int) this.type == 50) || ((int) this.type == 53 || (int) this.type == 76 || ((int) this.type == 77 || (int) this.type == 78)) || ((int) this.type == 92 || (int) this.type == 91)) + { + r = (int) newColor.R - (int) this.alpha / 3; + g = (int) newColor.G - (int) this.alpha / 3; + b = (int) newColor.B - (int) this.alpha / 3; + } + else if ((int) this.type == 16 || (int) this.type == 18 || ((int) this.type == 44 || (int) this.type == 45)) + { + r = (int) newColor.R; + g = (int) newColor.G; + b = (int) newColor.B; + } + else + { + if ((int) this.type == 12 || (int) this.type == 72 || ((int) this.type == 86 || (int) this.type == 87)) + return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) newColor.A - (int) this.alpha); + r = (int) newColor.R - (int) this.alpha; + g = (int) newColor.G - (int) this.alpha; + b = (int) newColor.B - (int) this.alpha; + } + int a = (int) newColor.A - (int) this.alpha; + if (a < 0) + a = 0; + if (a > (int) byte.MaxValue) + a = (int) byte.MaxValue; + return new Color(r, g, b, a); + } + } + + public unsafe void Draw(WorldView view) + { + Player player = Main.player[(int) this.owner]; + Vector2 pos1; + if ((int) this.type == 32) + { + Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num1 = player.position.X + 10f - vector2.X; + float num2 = player.position.Y + 21f - vector2.Y; + float rotCenter = (float) Math.Atan2((double) num2, (double) num1) - 1.57f; + bool flag = true; + if ((double) num1 == 0.0 && (double) num2 == 0.0) + { + flag = false; + } + else + { + float num3 = 8f / (float) Math.Sqrt((double) num1 * (double) num1 + (double) num2 * (double) num2); + float num4 = num1 * num3; + float num5 = num2 * num3; + vector2.X -= num4; + vector2.Y -= num5; + num1 = player.position.X + 10f - vector2.X; + num2 = player.position.Y + 21f - vector2.Y; + } + while (flag) + { + float num3 = (float) ((double) num1 * (double) num1 + (double) num2 * (double) num2); + if ((double) num3 < 784.0) + { + flag = false; + } + else + { + float num4 = 28f / (float) Math.Sqrt((double) num3); + float num5 = num1 * num4; + float num6 = num2 * num4; + vector2.X += num5; + vector2.Y += num6; + num1 = player.position.X + 10f - vector2.X; + num2 = player.position.Y + 21f - vector2.Y; + pos1 = vector2; + pos1.X -= (float) view.screenPosition.X; + pos1.Y -= (float) view.screenPosition.Y; + SpriteSheet<_sheetSprites>.DrawRotated(190, ref pos1, view.lighting.GetColor((int) vector2.X >> 4, (int) vector2.Y >> 4), rotCenter); + } + } + } + else if ((int) this.type == 73) + { + Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num1 = player.position.X + 10f - vector2.X; + float num2 = player.position.Y + 21f - vector2.Y; + float rotCenter = (float) Math.Atan2((double) num2, (double) num1) - 1.57f; + bool flag = true; + while (flag) + { + float num3 = (float) ((double) num1 * (double) num1 + (double) num2 * (double) num2); + if ((double) num3 < 625.0) + { + flag = false; + } + else + { + float num4 = 12f / (float) Math.Sqrt((double) num3); + float num5 = num1 * num4; + float num6 = num2 * num4; + vector2.X += num5; + vector2.Y += num6; + num1 = player.position.X + 10f - vector2.X; + num2 = player.position.Y + 21f - vector2.Y; + pos1 = vector2; + pos1.X -= (float) view.screenPosition.X; + pos1.Y -= (float) view.screenPosition.Y; + SpriteSheet<_sheetSprites>.DrawRotated(193, ref pos1, view.lighting.GetColor((int) vector2.X >> 4, (int) vector2.Y >> 4), rotCenter); + } + } + } + else if ((int) this.type == 74) + { + Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num1 = player.position.X + 10f - vector2.X; + float num2 = player.position.Y + 21f - vector2.Y; + float rotCenter = (float) Math.Atan2((double) num2, (double) num1) - 1.57f; + bool flag = true; + while (flag) + { + float num3 = (float) ((double) num1 * (double) num1 + (double) num2 * (double) num2); + if ((double) num3 < 625.0) + { + flag = false; + } + else + { + float num4 = 12f / (float) Math.Sqrt((double) num3); + float num5 = num1 * num4; + float num6 = num2 * num4; + vector2.X += num5; + vector2.Y += num6; + num1 = player.position.X + 10f - vector2.X; + num2 = player.position.Y + 21f - vector2.Y; + pos1 = vector2; + pos1.X -= (float) view.screenPosition.X; + pos1.Y -= (float) view.screenPosition.Y; + SpriteSheet<_sheetSprites>.DrawRotated(194, ref pos1, view.lighting.GetColor((int) vector2.X >> 4, (int) vector2.Y >> 4), rotCenter); + } + } + } + else if ((int) this.aiStyle == 7) + { + Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); + float num1 = player.position.X + 10f - vector2.X; + float num2 = player.position.Y + 21f - vector2.Y; + float rotCenter = (float) Math.Atan2((double) num2, (double) num1) - 1.57f; + bool flag = true; + while (flag) + { + float num3 = (float) ((double) num1 * (double) num1 + (double) num2 * (double) num2); + if ((double) num3 < 625.0) + { + flag = false; + } + else + { + float num4 = 12f / (float) Math.Sqrt((double) num3); + float num5 = num1 * num4; + float num6 = num2 * num4; + vector2.X += num5; + vector2.Y += num6; + num1 = player.position.X + 10f - vector2.X; + num2 = player.position.Y + 21f - vector2.Y; + pos1 = vector2; + pos1.X -= (float) view.screenPosition.X; + pos1.Y -= (float) view.screenPosition.Y; + SpriteSheet<_sheetSprites>.DrawRotated(198, ref pos1, view.lighting.GetColor((int) vector2.X >> 4, (int) vector2.Y >> 4), rotCenter); + } + } + } + else if ((int) this.aiStyle == 13) + { + float num1 = this.position.X + 8f; + float num2 = this.position.Y + 2f; + float num3 = this.velocity.X; + float num4 = this.velocity.Y; + float num5 = 20f / (float) Math.Sqrt((double) num3 * (double) num3 + (double) num4 * (double) num4); + float x; + float y; + if ((double) this.ai0 == 0.0) + { + x = num1 - this.velocity.X * num5; + y = num2 - this.velocity.Y * num5; + } + else + { + x = num1 + this.velocity.X * num5; + y = num2 + this.velocity.Y * num5; + } + Vector2 vector2 = new Vector2(x, y); + float num6 = player.position.X + 10f - vector2.X; + float num7 = player.position.Y + 21f - vector2.Y; + float rotCenter = (float) Math.Atan2((double) num7, (double) num6) - 1.57f; + if ((int) this.alpha == 0) + { + int num8 = -1; + if ((double) this.position.X + (double) ((int) this.width >> 1) < (double) player.position.X + 10.0) + num8 = 1; + player.itemRotation = (float) Math.Atan2((double) num7 * (double) num8, (double) num6 * (double) num8); + } + while (true) + { + float num8 = (float) ((double) num6 * (double) num6 + (double) num7 * (double) num7); + if ((double) num8 >= 625.0) + { + float num9 = 12f / (float) Math.Sqrt((double) num8); + float num10 = num6 * num9; + float num11 = num7 * num9; + vector2.X += num10; + vector2.Y += num11; + num6 = player.position.X + 10f - vector2.X; + num7 = player.position.Y + 21f - vector2.Y; + pos1 = vector2; + pos1.X -= (float) view.screenPosition.X; + pos1.Y -= (float) view.screenPosition.Y; + SpriteSheet<_sheetSprites>.DrawRotated(198, ref pos1, view.lighting.GetColor((int) vector2.X >> 4, (int) vector2.Y >> 4), rotCenter); + } + else + break; + } + } + else if ((int) this.aiStyle == 15) + { + Vector2 vector2 = new Vector2(this.position.X + (float) ((int) this.width >> 1), this.position.Y + (float) ((int) this.height >> 1)); + float num1 = player.position.X + 10f - vector2.X; + float num2 = player.position.Y + 21f - vector2.Y; + float rotCenter = (float) Math.Atan2((double) num2, (double) num1) - 1.57f; + if ((int) this.alpha == 0) + { + int num3 = -1; + if (this.aabb.X + ((int) this.width >> 1) < player.aabb.X + 10) + num3 = 1; + player.itemRotation = (float) Math.Atan2((double) num2 * (double) num3, (double) num1 * (double) num3); + } + bool flag = true; + do + { + float num3 = (float) ((double) num1 * (double) num1 + (double) num2 * (double) num2); + if ((double) num3 < 625.0) + { + flag = false; + } + else + { + float num4 = 12f / (float) Math.Sqrt((double) num3); + float num5 = num1 * num4; + float num6 = num2 * num4; + vector2.X += num5; + vector2.Y += num6; + num1 = player.position.X + 10f - vector2.X; + num2 = player.position.Y + 21f - vector2.Y; + pos1 = vector2; + pos1.X -= (float) view.screenPosition.X; + pos1.Y -= (float) view.screenPosition.Y; + int id = 188; + if ((int) this.type == 25) + id = 187; + else if ((int) this.type == 35) + id = 191; + else if ((int) this.type == 63) + id = 192; + SpriteSheet<_sheetSprites>.DrawRotated(id, ref pos1, view.lighting.GetColor((int) vector2.X >> 4, (int) vector2.Y >> 4), rotCenter); + } + } + while (flag); + } + Color newColor = (int) this.type != 14 ? (!this.hide ? view.lighting.GetColor(this.aabb.X + ((int) this.width >> 1) >> 4, this.aabb.Y + ((int) this.height >> 1) >> 4) : view.lighting.GetColor(player.aabb.X + 10 >> 4, player.aabb.Y + 21 >> 4)) : Color.White; + int id1 = 1349 + (int) this.type; + int num12 = SpriteSheet<_sheetSprites>.src[id1].Width >> 1; + int num13 = num12; + int num14 = 0; + if ((int) this.type == 16) + num14 = 6; + else if ((int) this.type == 17 || (int) this.type == 31) + num14 = 2; + else if ((int) this.type == 25 || (int) this.type == 26 || ((int) this.type == 35 || (int) this.type == 63)) + { + num14 = 6; + num13 -= 6; + } + else if ((int) this.type == 28 || (int) this.type == 37 || (int) this.type == 75) + num14 = 8; + else if ((int) this.type == 29) + num14 = 11; + else if ((int) this.type == 43) + num14 = 4; + else if ((int) this.type == 69 || (int) this.type == 70) + { + num14 = 4; + num13 += 4; + } + else if ((int) this.type == 50 || (int) this.type == 53) + num13 -= 8; + else if ((int) this.type == 72 || (int) this.type == 86 || (int) this.type == 87) + { + num13 -= 16; + num14 = 8; + } + else if ((int) this.type == 74) + num13 -= 6; + else if ((int) this.type == 99) + num14 = 1; + else if ((int) this.type == 111 || (int) this.type >= 115 && (int) this.type <= 119) + { + num14 = ((int) Projectile.projFrameH[(int) this.type] >> 1) - 2; + num13 -= 16; + } + SpriteEffects e = (int) this.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + pos1 = new Vector2(this.position.X - (float) view.screenPosition.X + (float) num13, this.position.Y - (float) view.screenPosition.Y + (float) ((int) this.height >> 1)); + Vector2 pivot = new Vector2((float) num12, (float) (((int) this.height >> 1) + num14)); + Color alpha = this.GetAlpha(newColor); + int sh = (int) Projectile.projFrameH[(int) this.type]; + if (sh > 0) + { + int sy = sh * (int) this.frame; + SpriteSheet<_sheetSprites>.Draw(id1, ref pos1, sy, sh, alpha, this.rotation, ref pivot, this.scale, e); + } + else if ((int) this.aiStyle == 19) + { + pos1.X -= pivot.X; + pos1.X += (float) ((int) this.width >> 1); + if ((int) this.spriteDirection == -1) + pivot.X *= 2f; + else + pivot.X = 0.0f; + pivot.Y = 0.0f; + SpriteSheet<_sheetSprites>.Draw(id1, ref pos1, alpha, this.rotation, ref pivot, this.scale, e); + } + else + { + if ((int) this.type == 94 && this.ai1 > 6) + { + // ISSUE: reference to a compiler-generated field + fixed (float* numPtr = &this.oldPos.FixedElementField) + { + for (int index = 0; index < 10; ++index) + { + Color c = alpha; + float num1 = (float) (9 - index) * 0.1111111f; + c.R = (byte) ((double) c.R * (double) num1); + c.G = (byte) ((double) c.G * (double) num1); + c.B = (byte) ((double) c.B * (double) num1); + c.A = (byte) ((double) c.A * (double) num1); + Vector2 pos2 = new Vector2(numPtr[index << 1] - (float) view.screenPosition.X + (float) num13, numPtr[(index << 1) + 1] - (float) view.screenPosition.Y + (float) ((int) this.height >> 1)); + SpriteSheet<_sheetSprites>.Draw(id1, ref pos2, c, this.rotation, ref pivot, this.scale * num1, e); + } + } + } + SpriteSheet<_sheetSprites>.Draw(id1, ref pos1, alpha, this.rotation, ref pivot, this.scale, e); + if ((int) this.type != 106) + return; + alpha.R = (byte) 200; + alpha.G = (byte) 200; + alpha.B = (byte) 200; + alpha.A = (byte) 0; + SpriteSheet<_sheetSprites>.Draw(1084, ref pos1, alpha, this.rotation, ref pivot, this.scale, e); + } + } + + private struct PetAnim + { + private byte startFrame; + private byte endFrame; + private byte frameDelay; + + public PetAnim(int s, int e, int d) + { + this.startFrame = (byte) s; + this.endFrame = (byte) e; + this.frameDelay = (byte) d; + } + + public void Update(ref Projectile p) + { + if ((int) p.frame < (int) this.startFrame || (int) p.frame > (int) this.endFrame) + { + p.frame = this.startFrame; + p.frameCounter = (byte) 0; + } + else + { + if ((int) ++p.frameCounter < (int) this.frameDelay) + return; + p.frameCounter = (byte) 0; + if ((int) ++p.frame <= (int) this.endFrame) + return; + p.frame = this.startFrame; + } + } + } + } +} diff --git a/Terraria/Recipe.cs b/Terraria/Recipe.cs new file mode 100644 index 0000000..4b7f538 --- /dev/null +++ b/Terraria/Recipe.cs @@ -0,0 +1,3179 @@ +// Type: Terraria.Recipe +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using System.Collections.Generic; +using Terraria.Achievements; + +namespace Terraria +{ + public sealed class Recipe + { + public static Recipe newRecipe = new Recipe(); + public static int numRecipes = 0; + public static Dictionary currentRecipies = new Dictionary(); + public Item createItem = new Item(); + public Item[] requiredItem = new Item[12]; + public short[] requiredTile = new short[3]; + public const int maxItemRequirements = 12; + public const int maxTileRequirements = 3; + public const int maxRecipes = 342; + public byte numRequiredItems; + public byte numRequiredTiles; + public bool needWater; + public Recipe.Category category; + public Recipe.SubCategory subCategory; + + static Recipe() + { + } + + public Recipe() + { + for (int index = 0; index < 12; ++index) + this.requiredItem[index].Init(); + for (int index = 0; index < 3; ++index) + this.requiredTile[index] = (short) -1; + } + + public void Create(UI ui) + { + for (int index1 = 0; index1 < (int) this.numRequiredItems; ++index1) + { + int num = (int) this.requiredItem[index1].stack; + for (int index2 = 0; index2 < 48; ++index2) + { + if ((int) ui.player.inventory[index2].netID == (int) this.requiredItem[index1].netID) + { + if ((int) ui.player.inventory[index2].stack > num) + { + ui.player.inventory[index2].stack -= (short) num; + num = 0; + } + else + { + num -= (int) ui.player.inventory[index2].stack; + ui.player.inventory[index2].Init(); + } + } + if (num <= 0) + break; + } + } + if (((int) this.requiredTile[0] == 16 || (int) this.requiredTile[0] == 134) && (int) ++ui.totalAnvilCrafting == 300) + ui.AchievementTriggers.SetState(Trigger.UsedLotsOfAnvils, true); + switch (this.category) + { + case Recipe.Category.STRUCTURES: + ui.Statistics.incStat(StatisticEntry.FurnitureCrafted); + break; + case Recipe.Category.TOOLS: + ui.Statistics.incStat(StatisticEntry.ToolsCrafted); + break; + case Recipe.Category.WEAPONS: + ui.Statistics.incStat(StatisticEntry.WeaponsCrafted); + break; + case Recipe.Category.ARMOR: + ui.Statistics.incStat(StatisticEntry.ArmorCrafted); + break; + case Recipe.Category.POTIONS: + ui.Statistics.incStat(StatisticEntry.ConsumablesCrafted); + break; + default: + ui.Statistics.incStat(StatisticEntry.MiscCrafted); + break; + } + switch (this.createItem.type) + { + case (short) 391: + case (short) 117: + case (short) 175: + case (short) 381: + case (short) 382: + case (short) 57: + case (short) 19: + case (short) 20: + case (short) 21: + case (short) 22: + ui.totalBarsCrafted += (uint) this.createItem.stack; + if (ui.totalBarsCrafted < 10000U) + break; + ui.player.AchievementTrigger(Trigger.CreatedLotsOfBars); + break; + case (short) 427: + case (short) 428: + case (short) 429: + case (short) 430: + case (short) 431: + case (short) 432: + case (short) 433: + case (short) 8: + ui.totalTorchesCrafted += (uint) this.createItem.stack; + break; + case (short) 479: + case (short) 30: + case (short) 93: + case (short) 26: + ui.totalWallsCrafted += (uint) this.createItem.stack; + break; + case (short) 94: + ui.totalWoodPlatformsCrafted += (uint) this.createItem.stack; + break; + } + } + + public static void FindRecipes(UI ui, Recipe.Category cat, bool isCraftable) + { + int num1 = 0; + int num2 = 1024; + ui.player.UpdateRecipes(); + for (int recipe = 0; recipe < 342; ++recipe) + { + Recipe r = Main.recipe[recipe]; + if (cat == r.category) + { + if (isCraftable) + { + if (!ui.player.CanCraftRecipe(r)) + continue; + } + else if (ui.craftGuide) + { + bool flag = false; + for (int index = (int) r.numRequiredItems - 1; index >= 0; --index) + { + if ((int) r.requiredItem[index].netID == (int) ui.guideItem.netID) + { + flag = true; + break; + } + } + if (!flag) + continue; + } + else if (!ui.player.recipesFound[recipe]) + continue; + int key = (int) r.subCategory; + if (key == 0) + { + ++num1; + key = num2++; + Recipe.currentRecipies.Add(key, new Recipe.SubCategoryList(1)); + } + else if (!Recipe.currentRecipies.ContainsKey(key)) + { + ++num1; + Recipe.currentRecipies.Add(key, new Recipe.SubCategoryList(32)); + } + Recipe.currentRecipies[key].Add(ui.player, recipe); + } + } + Dictionary.ValueCollection values = Recipe.currentRecipies.Values; + ui.currentRecipeCategory.Clear(); + foreach (Recipe.SubCategoryList subCategoryList in values) + { + if (subCategoryList.canCraft) + ui.currentRecipeCategory.Add(subCategoryList); + } + foreach (Recipe.SubCategoryList subCategoryList in values) + { + if (!subCategoryList.canCraft) + ui.currentRecipeCategory.Add(subCategoryList); + } + int count1 = Recipe.currentRecipies.Count; + if (count1 == 0) + { + ui.craftingRecipe = Recipe.newRecipe; + ui.craftingRecipeX = (sbyte) 0; + ui.craftingRecipeY = (sbyte) 0; + } + else + { + if ((int) ui.craftingRecipeY >= count1) + ui.craftingRecipeY = (sbyte) (count1 - 1); + int count2 = ui.currentRecipeCategory[(int) ui.craftingRecipeY].recipes.Count; + if ((int) ui.craftingRecipeX >= count2) + ui.craftingRecipeX = (sbyte) (count2 - 1); + } + Recipe.currentRecipies.Clear(); + } + + public static void SetupRecipes() + { + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.CRAFTING_STATIONS; + Recipe.newRecipe.createItem.SetDefaults(36, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(9, 10, false); + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.TORCHES; + Recipe.newRecipe.createItem.SetDefaults(8, 3, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(23, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(9, 1, false); + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.MISC; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(351, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(170, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 17; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.POTIONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(357, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(356, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(5, 1, false); + Recipe.newRecipe.requiredItem[2].SetDefaults(261, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 96; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.MISC; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(31, 2, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(170, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 17; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.POTIONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(126, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(31, 1, false); + Recipe.newRecipe.needWater = true; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.POTIONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(422, 5, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(126, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(501, 5, false); + Recipe.newRecipe.requiredItem[2].SetDefaults(369, 1, false); + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.POTIONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(423, 5, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(126, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(370, 1, false); + Recipe.newRecipe.requiredItem[2].SetDefaults(59, 1, false); + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.POTIONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(353, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(351, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 94; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.POTIONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.TORCHES; + Recipe.newRecipe.createItem.SetDefaults(28, 2, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(5, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(23, 2, false); + Recipe.newRecipe.requiredItem[2].SetDefaults(31, 2, false); + Recipe.newRecipe.requiredTile[0] = (short) 13; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.POTIONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.TORCHES; + Recipe.newRecipe.createItem.SetDefaults(188, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(28, 2, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(183, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 13; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.POTIONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.TORCHES; + Recipe.newRecipe.createItem.SetDefaults(499, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(126, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(501, 3, false); + Recipe.newRecipe.requiredItem[2].SetDefaults(502, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 13; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.POTIONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.WALLS; + Recipe.newRecipe.createItem.SetDefaults(110, 2, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(75, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(23, 2, false); + Recipe.newRecipe.requiredItem[2].SetDefaults(31, 2, false); + Recipe.newRecipe.requiredTile[0] = (short) 13; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.POTIONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.WALLS; + Recipe.newRecipe.createItem.SetDefaults(189, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(110, 2, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(183, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 13; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.POTIONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.BRICKS; + Recipe.newRecipe.createItem.SetDefaults(226, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(28, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(110, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 13; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.POTIONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.BRICKS; + Recipe.newRecipe.createItem.SetDefaults(227, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(188, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(189, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 13; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.POTIONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(288, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(126, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(318, 1, false); + Recipe.newRecipe.requiredItem[2].SetDefaults(317, 1, false); + Recipe.newRecipe.requiredItem[3].SetDefaults(173, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 13; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.POTIONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(289, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(126, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(313, 1, false); + Recipe.newRecipe.requiredItem[2].SetDefaults(5, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 13; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.POTIONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(290, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(126, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(315, 1, false); + Recipe.newRecipe.requiredItem[2].SetDefaults(276, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 13; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.POTIONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(291, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(126, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(317, 1, false); + Recipe.newRecipe.requiredItem[2].SetDefaults(275, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 13; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.POTIONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(292, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(126, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(313, 1, false); + Recipe.newRecipe.requiredItem[2].SetDefaults(11, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 13; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.POTIONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(293, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(126, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(314, 1, false); + Recipe.newRecipe.requiredItem[2].SetDefaults(313, 1, false); + Recipe.newRecipe.requiredItem[3].SetDefaults(75, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 13; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.POTIONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(294, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(126, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(314, 1, false); + Recipe.newRecipe.requiredItem[2].SetDefaults(316, 1, false); + Recipe.newRecipe.requiredItem[3].SetDefaults(75, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 13; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.POTIONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(295, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(126, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(313, 1, false); + Recipe.newRecipe.requiredItem[2].SetDefaults(315, 1, false); + Recipe.newRecipe.requiredItem[3].SetDefaults(320, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 13; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.POTIONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(296, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(126, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(315, 1, false); + Recipe.newRecipe.requiredItem[2].SetDefaults(314, 1, false); + Recipe.newRecipe.requiredItem[3].SetDefaults(13, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 13; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.POTIONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(297, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(126, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(315, 1, false); + Recipe.newRecipe.requiredItem[2].SetDefaults(314, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 13; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.POTIONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(298, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(126, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(313, 1, false); + Recipe.newRecipe.requiredItem[2].SetDefaults(183, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 13; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.POTIONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(299, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(126, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(313, 1, false); + Recipe.newRecipe.requiredItem[2].SetDefaults(315, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 13; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.POTIONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(300, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(126, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(316, 1, false); + Recipe.newRecipe.requiredItem[2].SetDefaults(68, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 13; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.POTIONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(301, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(126, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(316, 1, false); + Recipe.newRecipe.requiredItem[2].SetDefaults(276, 1, false); + Recipe.newRecipe.requiredItem[3].SetDefaults(69, 1, false); + Recipe.newRecipe.requiredItem[4].SetDefaults(209, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 13; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.POTIONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(302, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(126, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(317, 1, false); + Recipe.newRecipe.requiredItem[2].SetDefaults(319, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 13; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.POTIONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(303, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(126, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(313, 1, false); + Recipe.newRecipe.requiredItem[2].SetDefaults(38, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 13; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.POTIONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(304, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(126, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(313, 1, false); + Recipe.newRecipe.requiredItem[2].SetDefaults(315, 1, false); + Recipe.newRecipe.requiredItem[3].SetDefaults(319, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 13; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.POTIONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(305, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(126, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(318, 1, false); + Recipe.newRecipe.requiredItem[2].SetDefaults(316, 1, false); + Recipe.newRecipe.requiredItem[3].SetDefaults(315, 1, false); + Recipe.newRecipe.requiredItem[4].SetDefaults(320, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 13; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.CRAFTING_STATIONS; + Recipe.newRecipe.createItem.SetDefaults(40, 5, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(9, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(3, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 18; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.CRAFTING_STATIONS; + Recipe.newRecipe.createItem.SetDefaults(41, 3, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(40, 3, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(8, 1, false); + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.CRAFTING_STATIONS; + Recipe.newRecipe.createItem.SetDefaults(47, 3, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(40, 3, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(69, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.CRAFTING_STATIONS; + Recipe.newRecipe.createItem.SetDefaults(265, 10, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(40, 10, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(175, 1, false); + Recipe.newRecipe.requiredItem[2].SetDefaults(8, 5, false); + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.CRAFTING_STATIONS; + Recipe.newRecipe.createItem.SetDefaults(545, 15, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(40, 15, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(522, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 134; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.CRAFTING_STATIONS; + Recipe.newRecipe.createItem.SetDefaults(516, 35, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(40, 35, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(501, 6, false); + Recipe.newRecipe.requiredItem[2].SetDefaults(526, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 134; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.PUMPS; + Recipe.newRecipe.createItem.SetDefaults(234, 25, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(97, 25, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(117, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.PUMPS; + Recipe.newRecipe.createItem.SetDefaults(515, 25, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(97, 25, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(502, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 134; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.PUMPS; + Recipe.newRecipe.createItem.SetDefaults(546, 25, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(97, 25, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(522, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 134; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.MISC; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults((int) byte.MaxValue, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(31, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(194, 3, false); + Recipe.newRecipe.requiredTile[0] = (short) 13; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.MISC; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(67, 5, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(60, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 13; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(287, 20, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(279, 20, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(67, 1, false); + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.TORCHES; + Recipe.newRecipe.createItem.SetDefaults(427, 1, false); + Recipe.newRecipe.createItem.stack = (short) 3; + Recipe.newRecipe.requiredItem[0].SetDefaults(8, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 3; + Recipe.newRecipe.requiredItem[1].SetDefaults(177, 1, false); + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.TORCHES; + Recipe.newRecipe.createItem.SetDefaults(428, 1, false); + Recipe.newRecipe.createItem.stack = (short) 3; + Recipe.newRecipe.requiredItem[0].SetDefaults(8, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 3; + Recipe.newRecipe.requiredItem[1].SetDefaults(178, 1, false); + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.TORCHES; + Recipe.newRecipe.createItem.SetDefaults(429, 1, false); + Recipe.newRecipe.createItem.stack = (short) 3; + Recipe.newRecipe.requiredItem[0].SetDefaults(8, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 3; + Recipe.newRecipe.requiredItem[1].SetDefaults(179, 1, false); + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.TORCHES; + Recipe.newRecipe.createItem.SetDefaults(432, 1, false); + Recipe.newRecipe.createItem.stack = (short) 3; + Recipe.newRecipe.requiredItem[0].SetDefaults(8, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 3; + Recipe.newRecipe.requiredItem[1].SetDefaults(180, 1, false); + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.TORCHES; + Recipe.newRecipe.createItem.SetDefaults(430, 1, false); + Recipe.newRecipe.createItem.stack = (short) 3; + Recipe.newRecipe.requiredItem[0].SetDefaults(8, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 3; + Recipe.newRecipe.requiredItem[1].SetDefaults(181, 1, false); + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.TORCHES; + Recipe.newRecipe.createItem.SetDefaults(431, 1, false); + Recipe.newRecipe.createItem.stack = (short) 3; + Recipe.newRecipe.requiredItem[0].SetDefaults(8, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 3; + Recipe.newRecipe.requiredItem[1].SetDefaults(182, 1, false); + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.TORCHES; + Recipe.newRecipe.createItem.SetDefaults(523, 1, false); + Recipe.newRecipe.createItem.stack = (short) 33; + Recipe.newRecipe.requiredItem[0].SetDefaults(8, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 33; + Recipe.newRecipe.requiredItem[1].SetDefaults(522, 1, false); + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.LANTERNS; + Recipe.newRecipe.createItem.SetDefaults(344, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(225, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 5; + Recipe.newRecipe.requiredItem[1].SetDefaults(8, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 1; + Recipe.newRecipe.requiredTile[0] = (short) 18; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.LANTERNS; + Recipe.newRecipe.createItem.SetDefaults(342, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(8, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(9, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 3; + Recipe.newRecipe.requiredTile[0] = (short) 18; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.LANTERNS; + Recipe.newRecipe.createItem.SetDefaults(341, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(22, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 3; + Recipe.newRecipe.requiredItem[1].SetDefaults(170, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 2; + Recipe.newRecipe.requiredItem[2].SetDefaults(8, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.LANTERNS; + Recipe.newRecipe.createItem.SetDefaults(347, 1, false); + Recipe.newRecipe.createItem.stack = (short) 1; + Recipe.newRecipe.requiredItem[0].SetDefaults(154, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 10; + Recipe.newRecipe.requiredItem[1].SetDefaults(8, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 18; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.EXPLOSIVES; + Recipe.newRecipe.createItem.SetDefaults(235, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(166, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(23, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 5; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(286, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(282, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(23, 1, false); + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(170, 1, false); + Recipe.newRecipe.createItem.stack = (short) 1; + Recipe.newRecipe.requiredItem[0].SetDefaults(169, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 2; + Recipe.newRecipe.requiredTile[0] = (short) 17; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.WALLS; + Recipe.newRecipe.createItem.SetDefaults(392, 1, false); + Recipe.newRecipe.createItem.stack = (short) 4; + Recipe.newRecipe.requiredItem[0].SetDefaults(170, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 18; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(222, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(133, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 6; + Recipe.newRecipe.requiredTile[0] = (short) 17; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(350, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(133, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 4; + Recipe.newRecipe.requiredTile[0] = (short) 17; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(356, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(133, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 2; + Recipe.newRecipe.requiredTile[0] = (short) 17; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.BRICKS; + Recipe.newRecipe.createItem.SetDefaults(129, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(3, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 2; + Recipe.newRecipe.requiredTile[0] = (short) 17; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.WALLS; + Recipe.newRecipe.createItem.SetDefaults(130, 1, false); + Recipe.newRecipe.createItem.stack = (short) 4; + Recipe.newRecipe.requiredItem[0].SetDefaults(129, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 18; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.BRICKS; + Recipe.newRecipe.createItem.SetDefaults(131, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(133, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 2; + Recipe.newRecipe.requiredTile[0] = (short) 17; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.WALLS; + Recipe.newRecipe.createItem.SetDefaults(132, 1, false); + Recipe.newRecipe.createItem.stack = (short) 4; + Recipe.newRecipe.requiredItem[0].SetDefaults(131, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 18; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.BRICKS; + Recipe.newRecipe.createItem.SetDefaults(145, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(3, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 1; + Recipe.newRecipe.requiredItem[1].SetDefaults(12, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 1; + Recipe.newRecipe.requiredTile[0] = (short) 17; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.WALLS; + Recipe.newRecipe.createItem.SetDefaults(146, 1, false); + Recipe.newRecipe.createItem.stack = (short) 4; + Recipe.newRecipe.requiredItem[0].SetDefaults(145, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 18; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.BRICKS; + Recipe.newRecipe.createItem.SetDefaults(143, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(3, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 1; + Recipe.newRecipe.requiredItem[1].SetDefaults(14, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 1; + Recipe.newRecipe.requiredTile[0] = (short) 17; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.WALLS; + Recipe.newRecipe.createItem.SetDefaults(144, 1, false); + Recipe.newRecipe.createItem.stack = (short) 4; + Recipe.newRecipe.requiredItem[0].SetDefaults(143, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 18; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.BRICKS; + Recipe.newRecipe.createItem.SetDefaults(141, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(3, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 1; + Recipe.newRecipe.requiredItem[1].SetDefaults(13, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 1; + Recipe.newRecipe.requiredTile[0] = (short) 17; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.WALLS; + Recipe.newRecipe.createItem.SetDefaults(142, 1, false); + Recipe.newRecipe.createItem.stack = (short) 4; + Recipe.newRecipe.requiredItem[0].SetDefaults(141, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 18; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.BRICKS; + Recipe.newRecipe.createItem.SetDefaults(214, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(174, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(3, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 17; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.BRICKS; + Recipe.newRecipe.createItem.SetDefaults(192, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(173, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 2; + Recipe.newRecipe.requiredTile[0] = (short) 17; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.WALLS; + Recipe.newRecipe.createItem.SetDefaults(330, 1, false); + Recipe.newRecipe.createItem.stack = (short) 4; + Recipe.newRecipe.requiredItem[0].SetDefaults(192, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 17; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.BRICKS; + Recipe.newRecipe.createItem.SetDefaults(594, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(593, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 2; + Recipe.newRecipe.requiredTile[0] = (short) 18; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.WALLS; + Recipe.newRecipe.createItem.SetDefaults(595, 1, false); + Recipe.newRecipe.createItem.stack = (short) 4; + Recipe.newRecipe.requiredItem[0].SetDefaults(594, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 18; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.WALLS; + Recipe.newRecipe.createItem.SetDefaults(587, 1, false); + Recipe.newRecipe.createItem.stack = (short) 4; + Recipe.newRecipe.requiredItem[0].SetDefaults(586, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 18; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.WALLS; + Recipe.newRecipe.createItem.SetDefaults(592, 1, false); + Recipe.newRecipe.createItem.stack = (short) 4; + Recipe.newRecipe.requiredItem[0].SetDefaults(591, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 18; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.BRICKS; + Recipe.newRecipe.createItem.SetDefaults(412, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(408, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(409, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 17; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.WALLS; + Recipe.newRecipe.createItem.SetDefaults(417, 1, false); + Recipe.newRecipe.createItem.stack = (short) 4; + Recipe.newRecipe.requiredItem[0].SetDefaults(412, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 18; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.BRICKS; + Recipe.newRecipe.createItem.SetDefaults(413, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(3, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(172, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 17; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.WALLS; + Recipe.newRecipe.createItem.SetDefaults(418, 1, false); + Recipe.newRecipe.createItem.stack = (short) 4; + Recipe.newRecipe.requiredItem[0].SetDefaults(413, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 18; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.BRICKS; + Recipe.newRecipe.createItem.SetDefaults(414, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(3, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(176, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 17; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.WALLS; + Recipe.newRecipe.createItem.SetDefaults(419, 1, false); + Recipe.newRecipe.createItem.stack = (short) 4; + Recipe.newRecipe.requiredItem[0].SetDefaults(414, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 18; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.BRICKS; + Recipe.newRecipe.createItem.SetDefaults(415, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(3, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(364, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 17; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.WALLS; + Recipe.newRecipe.createItem.SetDefaults(420, 1, false); + Recipe.newRecipe.createItem.stack = (short) 4; + Recipe.newRecipe.requiredItem[0].SetDefaults(415, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 18; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.BRICKS; + Recipe.newRecipe.createItem.SetDefaults(416, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(3, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(365, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 17; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.WALLS; + Recipe.newRecipe.createItem.SetDefaults(421, 1, false); + Recipe.newRecipe.createItem.stack = (short) 4; + Recipe.newRecipe.requiredItem[0].SetDefaults(416, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 18; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.BRICKS; + Recipe.newRecipe.createItem.SetDefaults(577, 1, false); + Recipe.newRecipe.createItem.stack = (short) 5; + Recipe.newRecipe.requiredItem[0].SetDefaults(56, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(61, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 5; + Recipe.newRecipe.requiredTile[0] = (short) 17; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(176, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(2, 1, false); + Recipe.newRecipe.needWater = true; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.WALLS; + Recipe.newRecipe.createItem.SetDefaults(30, 1, false); + Recipe.newRecipe.createItem.stack = (short) 4; + Recipe.newRecipe.requiredItem[0].SetDefaults(2, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 18; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.WALLS; + Recipe.newRecipe.createItem.SetDefaults(26, 1, false); + Recipe.newRecipe.createItem.stack = (short) 4; + Recipe.newRecipe.requiredItem[0].SetDefaults(3, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 18; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.WALLS; + Recipe.newRecipe.createItem.SetDefaults(93, 1, false); + Recipe.newRecipe.createItem.stack = (short) 4; + Recipe.newRecipe.requiredItem[0].SetDefaults(9, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 18; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(94, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(9, 1, false); + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(25, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(9, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 6; + Recipe.newRecipe.requiredTile[0] = (short) 18; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(34, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(9, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 4; + Recipe.newRecipe.requiredTile[0] = (short) 18; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(171, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(9, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 6; + Recipe.newRecipe.requiredTile[0] = (short) 18; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.CHESTS; + Recipe.newRecipe.createItem.SetDefaults(48, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(9, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 8; + Recipe.newRecipe.requiredItem[1].SetDefaults(22, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 2; + Recipe.newRecipe.requiredTile[0] = (short) 18; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(32, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(9, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 8; + Recipe.newRecipe.requiredTile[0] = (short) 18; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.WALLS; + Recipe.newRecipe.createItem.SetDefaults(479, 1, false); + Recipe.newRecipe.createItem.stack = (short) 4; + Recipe.newRecipe.requiredItem[0].SetDefaults(3, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 1; + Recipe.newRecipe.requiredItem[1].SetDefaults(9, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 1; + Recipe.newRecipe.requiredTile[0] = (short) 106; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(480, 1, false); + Recipe.newRecipe.createItem.stack = (short) 2; + Recipe.newRecipe.requiredItem[0].SetDefaults(9, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 1; + Recipe.newRecipe.requiredTile[0] = (short) 106; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(498, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(9, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 20; + Recipe.newRecipe.requiredTile[0] = (short) 106; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(224, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(9, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 15; + Recipe.newRecipe.requiredItem[1].SetDefaults(225, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 5; + Recipe.newRecipe.requiredTile[0] = (short) 106; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(354, 1, false); + Recipe.newRecipe.createItem.stack = (short) 1; + Recipe.newRecipe.requiredItem[0].SetDefaults(9, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 20; + Recipe.newRecipe.requiredItem[1].SetDefaults(149, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 10; + Recipe.newRecipe.requiredTile[0] = (short) 106; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(343, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(9, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 9; + Recipe.newRecipe.requiredItem[1].SetDefaults(22, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 1; + Recipe.newRecipe.requiredTile[0] = (short) 106; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(359, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(19, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 3; + Recipe.newRecipe.requiredItem[1].SetDefaults(170, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 6; + Recipe.newRecipe.requiredItem[2].SetDefaults(9, 1, false); + Recipe.newRecipe.requiredItem[2].stack = (short) 10; + Recipe.newRecipe.requiredTile[0] = (short) 106; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.CRAFTING_STATIONS; + Recipe.newRecipe.createItem.SetDefaults(352, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(9, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 14; + Recipe.newRecipe.requiredTile[0] = (short) 106; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(333, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(154, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 4; + Recipe.newRecipe.requiredItem[1].SetDefaults(9, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 15; + Recipe.newRecipe.requiredItem[2].SetDefaults(149, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 106; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.CRAFTING_STATIONS; + Recipe.newRecipe.createItem.SetDefaults(332, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(9, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 12; + Recipe.newRecipe.requiredTile[0] = (short) 106; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(334, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(9, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 16; + Recipe.newRecipe.requiredTile[0] = (short) 106; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(335, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(9, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 8; + Recipe.newRecipe.requiredTile[0] = (short) 106; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.CRAFTING_STATIONS; + Recipe.newRecipe.createItem.SetDefaults(363, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(9, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 10; + Recipe.newRecipe.requiredItem[1].SetDefaults(22, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 2; + Recipe.newRecipe.requiredItem[2].SetDefaults(85, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 18; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.TORCHES; + Recipe.newRecipe.createItem.SetDefaults(24, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(9, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 7; + Recipe.newRecipe.requiredTile[0] = (short) 18; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.TOOLS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.CHANDELIERS; + Recipe.newRecipe.createItem.SetDefaults(196, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(9, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 8; + Recipe.newRecipe.requiredTile[0] = (short) 18; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.CHESTS; + Recipe.newRecipe.createItem.SetDefaults(39, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(9, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 10; + Recipe.newRecipe.requiredTile[0] = (short) 18; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.MISC; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(361, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(362, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 10; + Recipe.newRecipe.requiredItem[1].SetDefaults(9, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 5; + Recipe.newRecipe.requiredTile[0] = (short) 86; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.MISC; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(225, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(150, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 10; + Recipe.newRecipe.requiredTile[0] = (short) 86; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.MISC; + Recipe.newRecipe.subCategory = Recipe.SubCategory.TORCHES; + Recipe.newRecipe.createItem.SetDefaults(337, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(225, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 3; + Recipe.newRecipe.requiredTile[0] = (short) 86; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.MISC; + Recipe.newRecipe.subCategory = Recipe.SubCategory.TORCHES; + Recipe.newRecipe.createItem.SetDefaults(338, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(225, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 3; + Recipe.newRecipe.requiredTile[0] = (short) 86; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.MISC; + Recipe.newRecipe.subCategory = Recipe.SubCategory.TORCHES; + Recipe.newRecipe.createItem.SetDefaults(339, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(225, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 3; + Recipe.newRecipe.requiredTile[0] = (short) 86; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.MISC; + Recipe.newRecipe.subCategory = Recipe.SubCategory.TORCHES; + Recipe.newRecipe.createItem.SetDefaults(340, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(225, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 3; + Recipe.newRecipe.requiredTile[0] = (short) 86; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.CHANDELIERS; + Recipe.newRecipe.createItem.SetDefaults(247, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(225, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 20; + Recipe.newRecipe.requiredItem[1].SetDefaults((int) byte.MaxValue, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 3; + Recipe.newRecipe.requiredTile[0] = (short) 86; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.ANVILS; + Recipe.newRecipe.createItem.SetDefaults(248, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(225, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 20; + Recipe.newRecipe.requiredItem[1].SetDefaults((int) byte.MaxValue, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 3; + Recipe.newRecipe.requiredTile[0] = (short) 86; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.MECHANISM; + Recipe.newRecipe.createItem.SetDefaults(249, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(225, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 20; + Recipe.newRecipe.requiredItem[1].SetDefaults((int) byte.MaxValue, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 3; + Recipe.newRecipe.requiredTile[0] = (short) 86; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.ANVILS; + Recipe.newRecipe.createItem.SetDefaults(240, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(225, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 20; + Recipe.newRecipe.requiredItem[1].SetDefaults(254, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 3; + Recipe.newRecipe.requiredTile[0] = (short) 86; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.MECHANISM; + Recipe.newRecipe.createItem.SetDefaults(241, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(225, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 20; + Recipe.newRecipe.requiredItem[1].SetDefaults(254, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 3; + Recipe.newRecipe.requiredTile[0] = (short) 86; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(262, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(225, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 30; + Recipe.newRecipe.requiredItem[1].SetDefaults(178, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 3; + Recipe.newRecipe.requiredTile[0] = (short) 86; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.MISC; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(259, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(68, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 5; + Recipe.newRecipe.requiredTile[0] = (short) 18; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.ANVILS; + Recipe.newRecipe.createItem.SetDefaults(252, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(259, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 15; + Recipe.newRecipe.requiredTile[0] = (short) 18; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.MECHANISM; + Recipe.newRecipe.createItem.SetDefaults(253, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(259, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 15; + Recipe.newRecipe.requiredTile[0] = (short) 18; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(250, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(261, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 2; + Recipe.newRecipe.requiredItem[1].SetDefaults(126, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 18; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.CRAFTING_STATIONS; + Recipe.newRecipe.createItem.SetDefaults(33, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(3, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 20; + Recipe.newRecipe.requiredItem[1].SetDefaults(9, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 4; + Recipe.newRecipe.requiredItem[2].SetDefaults(8, 1, false); + Recipe.newRecipe.requiredItem[2].stack = (short) 3; + Recipe.newRecipe.requiredTile[0] = (short) 18; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.STATUES; + Recipe.newRecipe.createItem.SetDefaults(360, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(3, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 100; + Recipe.newRecipe.requiredTile[0] = (short) 18; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.TOOLS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.CRAFTING_STATIONS; + Recipe.newRecipe.createItem.SetDefaults(20, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(12, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 3; + Recipe.newRecipe.requiredTile[0] = (short) 17; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.TOOLS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.TORCHES; + Recipe.newRecipe.createItem.netDefaults(-13, 1); + Recipe.newRecipe.requiredItem[0].SetDefaults(20, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 12; + Recipe.newRecipe.requiredItem[1].SetDefaults(9, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 4; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.TOOLS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.BRICKS; + Recipe.newRecipe.createItem.netDefaults(-16, 1); + Recipe.newRecipe.requiredItem[0].SetDefaults(20, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 9; + Recipe.newRecipe.requiredItem[1].SetDefaults(9, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 3; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.TOOLS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.CHANDELIERS; + Recipe.newRecipe.createItem.netDefaults(-17, 1); + Recipe.newRecipe.requiredItem[0].SetDefaults(20, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 10; + Recipe.newRecipe.requiredItem[1].SetDefaults(9, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 3; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.WALLS; + Recipe.newRecipe.createItem.netDefaults(-14, 1); + Recipe.newRecipe.requiredItem[0].SetDefaults(20, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 8; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.BRICKS; + Recipe.newRecipe.createItem.netDefaults(-15, 1); + Recipe.newRecipe.requiredItem[0].SetDefaults(20, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 7; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.CHESTS; + Recipe.newRecipe.createItem.netDefaults(-18, 1); + Recipe.newRecipe.requiredItem[0].SetDefaults(20, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 7; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.WALLS; + Recipe.newRecipe.createItem.SetDefaults(89, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(20, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 15; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.CRAFTING_STATIONS; + Recipe.newRecipe.createItem.SetDefaults(80, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(20, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 25; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.STATUES; + Recipe.newRecipe.createItem.SetDefaults(76, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(20, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 20; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.MISC; + Recipe.newRecipe.subCategory = Recipe.SubCategory.WALLS; + Recipe.newRecipe.createItem.SetDefaults(15, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(20, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 10; + Recipe.newRecipe.requiredItem[1].SetDefaults(85, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 14; + Recipe.newRecipe.requiredTile[1] = (short) 15; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.CHANDELIERS; + Recipe.newRecipe.createItem.SetDefaults(106, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(20, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 4; + Recipe.newRecipe.requiredItem[1].SetDefaults(8, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 4; + Recipe.newRecipe.requiredItem[2].SetDefaults(85, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.TOOLS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.CRAFTING_STATIONS; + Recipe.newRecipe.createItem.SetDefaults(22, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(11, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 3; + Recipe.newRecipe.requiredTile[0] = (short) 17; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.ANVILS; + Recipe.newRecipe.createItem.SetDefaults(35, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(22, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 5; + Recipe.newRecipe.requiredTile[0] = (short) 18; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.TOOLS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(205, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(22, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 3; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(348, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(22, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 8; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(336, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(22, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 14; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(358, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(22, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 6; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.CRAFTING_STATIONS; + Recipe.newRecipe.createItem.SetDefaults(345, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(22, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 10; + Recipe.newRecipe.requiredItem[1].SetDefaults(9, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 2; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.TOOLS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.TORCHES; + Recipe.newRecipe.createItem.SetDefaults(1, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(22, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 12; + Recipe.newRecipe.requiredItem[1].SetDefaults(9, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 3; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.TOOLS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.BRICKS; + Recipe.newRecipe.createItem.SetDefaults(10, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(22, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 9; + Recipe.newRecipe.requiredItem[1].SetDefaults(9, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 3; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.TOOLS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.CHANDELIERS; + Recipe.newRecipe.createItem.SetDefaults(7, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(22, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 10; + Recipe.newRecipe.requiredItem[1].SetDefaults(9, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 3; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.WALLS; + Recipe.newRecipe.createItem.SetDefaults(4, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(22, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 8; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.BRICKS; + Recipe.newRecipe.createItem.SetDefaults(6, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(22, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 7; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.CHESTS; + Recipe.newRecipe.createItem.SetDefaults(99, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(22, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 7; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.WALLS; + Recipe.newRecipe.createItem.SetDefaults(90, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(22, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 20; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.CRAFTING_STATIONS; + Recipe.newRecipe.createItem.SetDefaults(81, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(22, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 30; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.STATUES; + Recipe.newRecipe.createItem.SetDefaults(77, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(22, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 25; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.TOOLS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(85, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(22, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 3; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.TOOLS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.CRAFTING_STATIONS; + Recipe.newRecipe.createItem.SetDefaults(21, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(14, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 4; + Recipe.newRecipe.requiredTile[0] = (short) 17; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.TOOLS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.TORCHES; + Recipe.newRecipe.createItem.netDefaults(-7, 1); + Recipe.newRecipe.requiredItem[0].SetDefaults(21, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 12; + Recipe.newRecipe.requiredItem[1].SetDefaults(9, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 4; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.TOOLS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.BRICKS; + Recipe.newRecipe.createItem.netDefaults(-10, 1); + Recipe.newRecipe.requiredItem[0].SetDefaults(21, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 9; + Recipe.newRecipe.requiredItem[1].SetDefaults(9, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 3; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.TOOLS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.CHANDELIERS; + Recipe.newRecipe.createItem.netDefaults(-11, 1); + Recipe.newRecipe.requiredItem[0].SetDefaults(21, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 10; + Recipe.newRecipe.requiredItem[1].SetDefaults(9, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 3; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.WALLS; + Recipe.newRecipe.createItem.netDefaults(-8, 1); + Recipe.newRecipe.requiredItem[0].SetDefaults(21, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 8; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.BRICKS; + Recipe.newRecipe.createItem.netDefaults(-9, 1); + Recipe.newRecipe.requiredItem[0].SetDefaults(21, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 6; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.CHESTS; + Recipe.newRecipe.createItem.netDefaults(-12, 1); + Recipe.newRecipe.requiredItem[0].SetDefaults(21, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 7; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.WALLS; + Recipe.newRecipe.createItem.SetDefaults(91, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(21, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 20; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.CRAFTING_STATIONS; + Recipe.newRecipe.createItem.SetDefaults(82, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(21, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 30; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.STATUES; + Recipe.newRecipe.createItem.SetDefaults(78, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(21, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 25; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.MISC; + Recipe.newRecipe.subCategory = Recipe.SubCategory.WALLS; + Recipe.newRecipe.createItem.SetDefaults(16, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(21, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 10; + Recipe.newRecipe.requiredItem[1].SetDefaults(85, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 14; + Recipe.newRecipe.requiredTile[1] = (short) 15; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.CHANDELIERS; + Recipe.newRecipe.createItem.SetDefaults(107, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(21, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 4; + Recipe.newRecipe.requiredItem[1].SetDefaults(8, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 4; + Recipe.newRecipe.requiredItem[2].SetDefaults(85, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.TOOLS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.CRAFTING_STATIONS; + Recipe.newRecipe.createItem.SetDefaults(19, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(13, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 4; + Recipe.newRecipe.requiredTile[0] = (short) 17; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.TOOLS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.TORCHES; + Recipe.newRecipe.createItem.netDefaults(-1, 1); + Recipe.newRecipe.requiredItem[0].SetDefaults(19, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 12; + Recipe.newRecipe.requiredItem[1].SetDefaults(9, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 4; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.TOOLS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.BRICKS; + Recipe.newRecipe.createItem.netDefaults(-4, 1); + Recipe.newRecipe.requiredItem[0].SetDefaults(19, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 9; + Recipe.newRecipe.requiredItem[1].SetDefaults(9, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 3; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.TOOLS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.CHANDELIERS; + Recipe.newRecipe.createItem.netDefaults(-5, 1); + Recipe.newRecipe.requiredItem[0].SetDefaults(19, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 10; + Recipe.newRecipe.requiredItem[1].SetDefaults(9, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 3; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.WALLS; + Recipe.newRecipe.createItem.netDefaults(-2, 1); + Recipe.newRecipe.requiredItem[0].SetDefaults(19, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 8; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.BRICKS; + Recipe.newRecipe.createItem.netDefaults(-3, 1); + Recipe.newRecipe.requiredItem[0].SetDefaults(19, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 7; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.CHESTS; + Recipe.newRecipe.createItem.netDefaults(-6, 1); + Recipe.newRecipe.requiredItem[0].SetDefaults(19, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 7; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.WALLS; + Recipe.newRecipe.createItem.SetDefaults(92, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(19, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 25; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.CRAFTING_STATIONS; + Recipe.newRecipe.createItem.SetDefaults(83, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(19, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 35; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.STATUES; + Recipe.newRecipe.createItem.SetDefaults(79, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(19, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 30; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.MISC; + Recipe.newRecipe.subCategory = Recipe.SubCategory.WALLS; + Recipe.newRecipe.createItem.SetDefaults(17, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(19, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 10; + Recipe.newRecipe.requiredItem[1].SetDefaults(85, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 14; + Recipe.newRecipe.requiredTile[1] = (short) 15; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(264, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(19, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 30; + Recipe.newRecipe.requiredItem[1].SetDefaults(178, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.CHANDELIERS; + Recipe.newRecipe.createItem.SetDefaults(108, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(19, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 4; + Recipe.newRecipe.requiredItem[1].SetDefaults(8, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 4; + Recipe.newRecipe.requiredItem[2].SetDefaults(85, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(355, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(225, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 20; + Recipe.newRecipe.requiredItem[1].SetDefaults(19, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 30; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.LANTERNS; + Recipe.newRecipe.createItem.SetDefaults(105, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(19, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(8, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 18; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.LANTERNS; + Recipe.newRecipe.createItem.SetDefaults(349, 1, false); + Recipe.newRecipe.createItem.stack = (short) 1; + Recipe.newRecipe.requiredItem[0].SetDefaults(19, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 5; + Recipe.newRecipe.requiredItem[1].SetDefaults(8, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 3; + Recipe.newRecipe.requiredTile[0] = (short) 18; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.TOOLS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.CRAFTING_STATIONS; + Recipe.newRecipe.createItem.SetDefaults(57, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(56, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 4; + Recipe.newRecipe.requiredTile[0] = (short) 17; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.CHESTS; + Recipe.newRecipe.createItem.SetDefaults(44, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(57, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 8; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.TOOLS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.BRICKS; + Recipe.newRecipe.createItem.SetDefaults(45, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(57, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 10; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.WALLS; + Recipe.newRecipe.createItem.SetDefaults(46, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(57, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 10; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.WALLS; + Recipe.newRecipe.createItem.SetDefaults(102, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(57, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 15; + Recipe.newRecipe.requiredItem[1].SetDefaults(86, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 10; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.CRAFTING_STATIONS; + Recipe.newRecipe.createItem.SetDefaults(101, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(57, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 25; + Recipe.newRecipe.requiredItem[1].SetDefaults(86, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 20; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.STATUES; + Recipe.newRecipe.createItem.SetDefaults(100, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(57, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 20; + Recipe.newRecipe.requiredItem[1].SetDefaults(86, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 15; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.TOOLS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.TORCHES; + Recipe.newRecipe.createItem.SetDefaults(103, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(57, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 12; + Recipe.newRecipe.requiredItem[1].SetDefaults(86, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 6; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.TOOLS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.CHANDELIERS; + Recipe.newRecipe.createItem.SetDefaults(104, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(57, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 10; + Recipe.newRecipe.requiredItem[1].SetDefaults(86, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 5; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.TOOLS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.ANVILS; + Recipe.newRecipe.createItem.SetDefaults(84, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(85, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 3; + Recipe.newRecipe.requiredItem[1].SetDefaults(118, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 1; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.TOOLS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.CRAFTING_STATIONS; + Recipe.newRecipe.createItem.SetDefaults(117, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(116, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 4; + Recipe.newRecipe.requiredTile[0] = (short) 17; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.PHASEBLADES; + Recipe.newRecipe.createItem.SetDefaults(198, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(117, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 20; + Recipe.newRecipe.requiredItem[1].SetDefaults(177, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 10; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.PHASEBLADES; + Recipe.newRecipe.createItem.SetDefaults(199, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(117, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 20; + Recipe.newRecipe.requiredItem[1].SetDefaults(178, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 10; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.PHASEBLADES; + Recipe.newRecipe.createItem.SetDefaults(200, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(117, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 20; + Recipe.newRecipe.requiredItem[1].SetDefaults(179, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 10; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.PHASEBLADES; + Recipe.newRecipe.createItem.SetDefaults(201, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(117, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 20; + Recipe.newRecipe.requiredItem[1].SetDefaults(181, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 10; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.PHASEBLADES; + Recipe.newRecipe.createItem.SetDefaults(202, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(117, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 20; + Recipe.newRecipe.requiredItem[1].SetDefaults(182, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 10; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.PHASEBLADES; + Recipe.newRecipe.createItem.SetDefaults(203, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(117, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 20; + Recipe.newRecipe.requiredItem[1].SetDefaults(180, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 10; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.PHASESABERS; + Recipe.newRecipe.createItem.netDefaults(-19, 1); + Recipe.newRecipe.requiredItem[0].SetDefaults(198, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(502, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 50; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.PHASESABERS; + Recipe.newRecipe.createItem.netDefaults(-20, 1); + Recipe.newRecipe.requiredItem[0].SetDefaults(199, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(502, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 50; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.PHASESABERS; + Recipe.newRecipe.createItem.netDefaults(-21, 1); + Recipe.newRecipe.requiredItem[0].SetDefaults(200, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(502, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 50; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.PHASESABERS; + Recipe.newRecipe.createItem.netDefaults(-22, 1); + Recipe.newRecipe.requiredItem[0].SetDefaults(201, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(502, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 50; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.PHASESABERS; + Recipe.newRecipe.createItem.netDefaults(-23, 1); + Recipe.newRecipe.requiredItem[0].SetDefaults(202, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(502, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 50; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.PHASESABERS; + Recipe.newRecipe.createItem.netDefaults(-24, 1); + Recipe.newRecipe.requiredItem[0].SetDefaults(203, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(502, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 50; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.TOOLS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.CHESTS; + Recipe.newRecipe.createItem.SetDefaults(204, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(117, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 35; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.STATUES; + Recipe.newRecipe.createItem.SetDefaults((int) sbyte.MaxValue, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(95, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(117, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 30; + Recipe.newRecipe.requiredItem[2].SetDefaults(75, 1, false); + Recipe.newRecipe.requiredItem[2].stack = (short) 10; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.TIMERS; + Recipe.newRecipe.createItem.SetDefaults(197, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(98, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(117, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 20; + Recipe.newRecipe.requiredItem[2].SetDefaults(75, 1, false); + Recipe.newRecipe.requiredItem[2].stack = (short) 5; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.WALLS; + Recipe.newRecipe.createItem.SetDefaults(123, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(117, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 20; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.CRAFTING_STATIONS; + Recipe.newRecipe.createItem.SetDefaults(124, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(117, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 30; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.STATUES; + Recipe.newRecipe.createItem.SetDefaults(125, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(117, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 25; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.WALLS; + Recipe.newRecipe.createItem.SetDefaults(151, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(154, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 40; + Recipe.newRecipe.requiredItem[1].SetDefaults(150, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 40; + Recipe.newRecipe.requiredTile[0] = (short) 18; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.CRAFTING_STATIONS; + Recipe.newRecipe.createItem.SetDefaults(152, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(154, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 60; + Recipe.newRecipe.requiredItem[1].SetDefaults(150, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 50; + Recipe.newRecipe.requiredTile[0] = (short) 18; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.STATUES; + Recipe.newRecipe.createItem.SetDefaults(153, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(154, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 50; + Recipe.newRecipe.requiredItem[1].SetDefaults(150, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 45; + Recipe.newRecipe.requiredTile[0] = (short) 18; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.WALLS; + Recipe.newRecipe.createItem.SetDefaults(190, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(331, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 12; + Recipe.newRecipe.requiredItem[1].SetDefaults(209, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 15; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.CHANDELIERS; + Recipe.newRecipe.createItem.SetDefaults(191, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(331, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 6; + Recipe.newRecipe.requiredItem[1].SetDefaults(209, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 15; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.TOOLS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.ANVILS; + Recipe.newRecipe.createItem.SetDefaults(185, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(84, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(331, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 12; + Recipe.newRecipe.requiredItem[2].SetDefaults(210, 1, false); + Recipe.newRecipe.requiredItem[2].stack = (short) 3; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.TORCHES; + Recipe.newRecipe.createItem.SetDefaults(228, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(179, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 1; + Recipe.newRecipe.requiredItem[1].SetDefaults(177, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 1; + Recipe.newRecipe.requiredItem[2].SetDefaults(331, 1, false); + Recipe.newRecipe.requiredItem[2].stack = (short) 8; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.CRAFTING_STATIONS; + Recipe.newRecipe.createItem.SetDefaults(229, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(178, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 1; + Recipe.newRecipe.requiredItem[1].SetDefaults(182, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 1; + Recipe.newRecipe.requiredItem[2].SetDefaults(331, 1, false); + Recipe.newRecipe.requiredItem[2].stack = (short) 16; + Recipe.newRecipe.requiredItem[3].SetDefaults(209, 1, false); + Recipe.newRecipe.requiredItem[3].stack = (short) 12; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.STATUES; + Recipe.newRecipe.createItem.SetDefaults(230, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(181, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 1; + Recipe.newRecipe.requiredItem[1].SetDefaults(180, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 1; + Recipe.newRecipe.requiredItem[2].SetDefaults(331, 1, false); + Recipe.newRecipe.requiredItem[2].stack = (short) 8; + Recipe.newRecipe.requiredItem[3].SetDefaults(210, 1, false); + Recipe.newRecipe.requiredItem[3].stack = (short) 2; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.TOOLS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.CRAFTING_STATIONS; + Recipe.newRecipe.createItem.SetDefaults(175, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(174, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 4; + Recipe.newRecipe.requiredItem[1].SetDefaults(173, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 1; + Recipe.newRecipe.requiredTile[0] = (short) 77; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.CHANDELIERS; + Recipe.newRecipe.createItem.SetDefaults(119, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(175, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 15; + Recipe.newRecipe.requiredItem[1].SetDefaults(55, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.CHESTS; + Recipe.newRecipe.createItem.SetDefaults(120, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(175, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 25; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.WALLS; + Recipe.newRecipe.createItem.SetDefaults(121, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(175, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 35; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.TOOLS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.TORCHES; + Recipe.newRecipe.createItem.SetDefaults(122, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(175, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 35; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.TOOLS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.CHESTS; + Recipe.newRecipe.createItem.SetDefaults(217, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(175, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 35; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.ANVILS; + Recipe.newRecipe.createItem.SetDefaults(219, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(175, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 20; + Recipe.newRecipe.requiredItem[1].SetDefaults(164, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.WALLS; + Recipe.newRecipe.createItem.SetDefaults(231, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(175, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 25; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.CRAFTING_STATIONS; + Recipe.newRecipe.createItem.SetDefaults(232, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(175, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 35; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.STATUES; + Recipe.newRecipe.createItem.SetDefaults(233, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(175, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 30; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.WALLS; + Recipe.newRecipe.createItem.SetDefaults(273, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(46, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(155, 1, false); + Recipe.newRecipe.requiredItem[2].SetDefaults(190, 1, false); + Recipe.newRecipe.requiredItem[3].SetDefaults(121, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 26; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.LANTERNS; + Recipe.newRecipe.createItem.SetDefaults(389, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(527, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(528, 1, false); + Recipe.newRecipe.requiredItem[2].SetDefaults(521, 1, false); + Recipe.newRecipe.requiredItem[2].stack = (short) 10; + Recipe.newRecipe.requiredItem[3].SetDefaults(520, 1, false); + Recipe.newRecipe.requiredItem[3].stack = (short) 10; + Recipe.newRecipe.requiredTile[0] = (short) 134; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.TOOLS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.CRAFTING_STATIONS; + Recipe.newRecipe.createItem.SetDefaults(381, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(364, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 3; + Recipe.newRecipe.requiredTile[0] = (short) 17; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.WALLS; + Recipe.newRecipe.createItem.SetDefaults(372, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(381, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 10; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.BRICKS; + Recipe.newRecipe.createItem.SetDefaults(373, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(381, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 10; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.TORCHES; + Recipe.newRecipe.createItem.SetDefaults(371, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(381, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 10; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.CRAFTING_STATIONS; + Recipe.newRecipe.createItem.SetDefaults(374, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(381, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 20; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.STATUES; + Recipe.newRecipe.createItem.SetDefaults(375, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(381, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 15; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.TOOLS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.WALLS; + Recipe.newRecipe.createItem.SetDefaults(385, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(381, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 15; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.TOOLS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.LANTERNS; + Recipe.newRecipe.createItem.SetDefaults(383, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(381, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 10; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.TIMERS; + Recipe.newRecipe.createItem.SetDefaults(435, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(381, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 10; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.TORCHES; + Recipe.newRecipe.createItem.SetDefaults(483, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(381, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 10; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.SPEARS; + Recipe.newRecipe.createItem.SetDefaults(537, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(381, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 10; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.TOOLS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.CRAFTING_STATIONS; + Recipe.newRecipe.createItem.SetDefaults(382, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(365, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 4; + Recipe.newRecipe.requiredTile[0] = (short) 17; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.WALLS; + Recipe.newRecipe.createItem.SetDefaults(377, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(382, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 10; + Recipe.newRecipe.requiredTile[0] = (short) 134; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.WALLS; + Recipe.newRecipe.createItem.SetDefaults(378, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(382, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 10; + Recipe.newRecipe.requiredTile[0] = (short) 134; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.TORCHES; + Recipe.newRecipe.createItem.SetDefaults(376, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(382, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 10; + Recipe.newRecipe.requiredTile[0] = (short) 134; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.CRAFTING_STATIONS; + Recipe.newRecipe.createItem.SetDefaults(379, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(382, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 20; + Recipe.newRecipe.requiredTile[0] = (short) 134; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.STATUES; + Recipe.newRecipe.createItem.SetDefaults(380, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(382, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 15; + Recipe.newRecipe.requiredTile[0] = (short) 134; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.TOOLS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.WALLS; + Recipe.newRecipe.createItem.SetDefaults(386, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(382, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 15; + Recipe.newRecipe.requiredTile[0] = (short) 134; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.TOOLS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.LANTERNS; + Recipe.newRecipe.createItem.SetDefaults(384, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(382, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 10; + Recipe.newRecipe.requiredTile[0] = (short) 134; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.TIMERS; + Recipe.newRecipe.createItem.SetDefaults(436, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(382, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 10; + Recipe.newRecipe.requiredTile[0] = (short) 134; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.TORCHES; + Recipe.newRecipe.createItem.SetDefaults(484, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(382, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 10; + Recipe.newRecipe.requiredTile[0] = (short) 134; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.SPEARS; + Recipe.newRecipe.createItem.SetDefaults(390, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(382, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 10; + Recipe.newRecipe.requiredTile[0] = (short) 134; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.ANVILS; + Recipe.newRecipe.createItem.SetDefaults(525, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(382, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 10; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.TOOLS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.CRAFTING_STATIONS; + Recipe.newRecipe.createItem.SetDefaults(391, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(366, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 5; + Recipe.newRecipe.requiredTile[0] = (short) 133; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.WALLS; + Recipe.newRecipe.createItem.SetDefaults(401, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(391, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 12; + Recipe.newRecipe.requiredTile[0] = (short) 134; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.BRICKS; + Recipe.newRecipe.createItem.SetDefaults(402, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(391, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 12; + Recipe.newRecipe.requiredTile[0] = (short) 134; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.TORCHES; + Recipe.newRecipe.createItem.SetDefaults(400, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(391, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 12; + Recipe.newRecipe.requiredTile[0] = (short) 134; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.CRAFTING_STATIONS; + Recipe.newRecipe.createItem.SetDefaults(403, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(391, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 24; + Recipe.newRecipe.requiredTile[0] = (short) 134; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.STATUES; + Recipe.newRecipe.createItem.SetDefaults(404, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(391, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 18; + Recipe.newRecipe.requiredTile[0] = (short) 134; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.TOOLS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.WALLS; + Recipe.newRecipe.createItem.SetDefaults(388, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(391, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 18; + Recipe.newRecipe.requiredTile[0] = (short) 134; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.TOOLS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.LANTERNS; + Recipe.newRecipe.createItem.SetDefaults(387, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(391, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 12; + Recipe.newRecipe.requiredTile[0] = (short) 134; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.TIMERS; + Recipe.newRecipe.createItem.SetDefaults(481, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(391, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 12; + Recipe.newRecipe.requiredTile[0] = (short) 134; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.TORCHES; + Recipe.newRecipe.createItem.SetDefaults(482, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(391, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 12; + Recipe.newRecipe.requiredTile[0] = (short) 134; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.SPEARS; + Recipe.newRecipe.createItem.SetDefaults(406, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(391, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 12; + Recipe.newRecipe.requiredTile[0] = (short) 134; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.CRAFTING_STATIONS; + Recipe.newRecipe.createItem.SetDefaults(524, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(366, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 30; + Recipe.newRecipe.requiredItem[1].SetDefaults(221, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 134; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.BRICKS; + Recipe.newRecipe.createItem.SetDefaults(559, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(372, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(377, 1, false); + Recipe.newRecipe.requiredItem[2].SetDefaults(401, 1, false); + Recipe.newRecipe.requiredItem[3].SetDefaults(549, 1, false); + Recipe.newRecipe.requiredItem[3].stack = (short) 20; + Recipe.newRecipe.requiredTile[0] = (short) 134; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.TORCHES; + Recipe.newRecipe.createItem.SetDefaults(558, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(371, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(376, 1, false); + Recipe.newRecipe.requiredItem[2].SetDefaults(400, 1, false); + Recipe.newRecipe.requiredItem[3].SetDefaults(549, 1, false); + Recipe.newRecipe.requiredItem[3].stack = (short) 20; + Recipe.newRecipe.requiredTile[0] = (short) 134; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.WALLS; + Recipe.newRecipe.createItem.SetDefaults(553, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(373, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(378, 1, false); + Recipe.newRecipe.requiredItem[2].SetDefaults(402, 1, false); + Recipe.newRecipe.requiredItem[3].SetDefaults(549, 1, false); + Recipe.newRecipe.requiredItem[3].stack = (short) 20; + Recipe.newRecipe.requiredTile[0] = (short) 134; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.CRAFTING_STATIONS; + Recipe.newRecipe.createItem.SetDefaults(551, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(374, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(379, 1, false); + Recipe.newRecipe.requiredItem[2].SetDefaults(403, 1, false); + Recipe.newRecipe.requiredItem[3].SetDefaults(548, 1, false); + Recipe.newRecipe.requiredItem[3].stack = (short) 20; + Recipe.newRecipe.requiredTile[0] = (short) 134; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.STATUES; + Recipe.newRecipe.createItem.SetDefaults(552, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(375, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(380, 1, false); + Recipe.newRecipe.requiredItem[2].SetDefaults(404, 1, false); + Recipe.newRecipe.requiredItem[3].SetDefaults(547, 1, false); + Recipe.newRecipe.requiredItem[3].stack = (short) 20; + Recipe.newRecipe.requiredTile[0] = (short) 134; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.TOOLS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(579, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(385, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(386, 1, false); + Recipe.newRecipe.requiredItem[2].SetDefaults(388, 1, false); + Recipe.newRecipe.requiredItem[3].SetDefaults(383, 1, false); + Recipe.newRecipe.requiredItem[4].SetDefaults(384, 1, false); + Recipe.newRecipe.requiredItem[5].SetDefaults(387, 1, false); + Recipe.newRecipe.requiredItem[6].SetDefaults(547, 1, false); + Recipe.newRecipe.requiredItem[6].stack = (short) 5; + Recipe.newRecipe.requiredItem[7].SetDefaults(548, 1, false); + Recipe.newRecipe.requiredItem[7].stack = (short) 5; + Recipe.newRecipe.requiredItem[8].SetDefaults(549, 1, false); + Recipe.newRecipe.requiredItem[8].stack = (short) 5; + Recipe.newRecipe.requiredTile[0] = (short) 134; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.TIMERS; + Recipe.newRecipe.createItem.SetDefaults(578, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(435, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(436, 1, false); + Recipe.newRecipe.requiredItem[2].SetDefaults(481, 1, false); + Recipe.newRecipe.requiredItem[3].SetDefaults(549, 1, false); + Recipe.newRecipe.requiredItem[3].stack = (short) 20; + Recipe.newRecipe.requiredTile[0] = (short) 134; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.TORCHES; + Recipe.newRecipe.createItem.SetDefaults(368, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(483, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(484, 1, false); + Recipe.newRecipe.requiredItem[2].SetDefaults(482, 1, false); + Recipe.newRecipe.requiredItem[3].SetDefaults(548, 1, false); + Recipe.newRecipe.requiredItem[3].stack = (short) 20; + Recipe.newRecipe.requiredTile[0] = (short) 134; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.SPEARS; + Recipe.newRecipe.createItem.SetDefaults(550, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(537, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(390, 1, false); + Recipe.newRecipe.requiredItem[2].SetDefaults(406, 1, false); + Recipe.newRecipe.requiredItem[3].SetDefaults(547, 1, false); + Recipe.newRecipe.requiredItem[3].stack = (short) 20; + Recipe.newRecipe.requiredTile[0] = (short) 134; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.TIMERS; + Recipe.newRecipe.createItem.SetDefaults(533, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(98, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(324, 1, false); + Recipe.newRecipe.requiredItem[2].SetDefaults(319, 1, false); + Recipe.newRecipe.requiredItem[2].stack = (short) 5; + Recipe.newRecipe.requiredItem[3].SetDefaults(548, 1, false); + Recipe.newRecipe.requiredItem[3].stack = (short) 20; + Recipe.newRecipe.requiredTile[0] = (short) 134; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.CHANDELIERS; + Recipe.newRecipe.createItem.SetDefaults(561, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(381, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 10; + Recipe.newRecipe.requiredItem[1].SetDefaults(382, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 10; + Recipe.newRecipe.requiredItem[2].SetDefaults(520, 1, false); + Recipe.newRecipe.requiredItem[2].stack = (short) 5; + Recipe.newRecipe.requiredItem[3].SetDefaults(548, 1, false); + Recipe.newRecipe.requiredItem[3].stack = (short) 5; + Recipe.newRecipe.requiredTile[0] = (short) 134; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.TIMERS; + Recipe.newRecipe.createItem.SetDefaults(506, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(20, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 20; + Recipe.newRecipe.requiredItem[1].SetDefaults(22, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 20; + Recipe.newRecipe.requiredItem[2].SetDefaults(324, 1, false); + Recipe.newRecipe.requiredItem[3].SetDefaults(522, 1, false); + Recipe.newRecipe.requiredItem[3].stack = (short) 35; + Recipe.newRecipe.requiredItem[4].SetDefaults(547, 1, false); + Recipe.newRecipe.requiredItem[4].stack = (short) 20; + Recipe.newRecipe.requiredTile[0] = (short) 134; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(494, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(508, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(502, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 25; + Recipe.newRecipe.requiredItem[2].SetDefaults(521, 1, false); + Recipe.newRecipe.requiredItem[2].stack = (short) 15; + Recipe.newRecipe.requiredItem[3].SetDefaults(19, 1, false); + Recipe.newRecipe.requiredItem[3].stack = (short) 15; + Recipe.newRecipe.requiredItem[4].SetDefaults(549, 1, false); + Recipe.newRecipe.requiredItem[4].stack = (short) 20; + Recipe.newRecipe.requiredTile[0] = (short) 134; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.MISC; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(425, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(507, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(501, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 80; + Recipe.newRecipe.requiredItem[2].SetDefaults(520, 1, false); + Recipe.newRecipe.requiredItem[2].stack = (short) 15; + Recipe.newRecipe.requiredItem[3].SetDefaults(19, 1, false); + Recipe.newRecipe.requiredItem[3].stack = (short) 15; + Recipe.newRecipe.requiredItem[4].SetDefaults(549, 1, false); + Recipe.newRecipe.requiredItem[4].stack = (short) 20; + Recipe.newRecipe.requiredTile[0] = (short) 134; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.MISC; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(497, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(275, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 15; + Recipe.newRecipe.requiredItem[1].SetDefaults(319, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 5; + Recipe.newRecipe.requiredItem[2].SetDefaults(261, 1, false); + Recipe.newRecipe.requiredItem[2].stack = (short) 15; + Recipe.newRecipe.requiredItem[3].SetDefaults(520, 1, false); + Recipe.newRecipe.requiredItem[3].stack = (short) 5; + Recipe.newRecipe.requiredItem[4].SetDefaults(521, 1, false); + Recipe.newRecipe.requiredItem[4].stack = (short) 5; + Recipe.newRecipe.requiredItem[5].SetDefaults(547, 1, false); + Recipe.newRecipe.requiredItem[5].stack = (short) 20; + Recipe.newRecipe.requiredTile[0] = (short) 134; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(495, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(502, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 30; + Recipe.newRecipe.requiredItem[1].SetDefaults(526, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 4; + Recipe.newRecipe.requiredItem[2].SetDefaults(501, 1, false); + Recipe.newRecipe.requiredItem[2].stack = (short) 60; + Recipe.newRecipe.requiredItem[3].SetDefaults(520, 1, false); + Recipe.newRecipe.requiredItem[3].stack = (short) 10; + Recipe.newRecipe.requiredItem[4].SetDefaults(549, 1, false); + Recipe.newRecipe.requiredItem[4].stack = (short) 20; + Recipe.newRecipe.requiredTile[0] = (short) 134; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.TIMERS; + Recipe.newRecipe.createItem.SetDefaults(493, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(320, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 10; + Recipe.newRecipe.requiredItem[1].SetDefaults(575, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 25; + Recipe.newRecipe.requiredItem[2].SetDefaults(520, 1, false); + Recipe.newRecipe.requiredItem[2].stack = (short) 30; + Recipe.newRecipe.requiredTile[0] = (short) 134; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.TIMERS; + Recipe.newRecipe.createItem.SetDefaults(492, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(320, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 10; + Recipe.newRecipe.requiredItem[1].SetDefaults(575, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 25; + Recipe.newRecipe.requiredItem[2].SetDefaults(521, 1, false); + Recipe.newRecipe.requiredItem[2].stack = (short) 30; + Recipe.newRecipe.requiredTile[0] = (short) 134; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(394, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(187, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(268, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 114; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.MISC; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(395, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(17, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(18, 1, false); + Recipe.newRecipe.requiredItem[2].SetDefaults(393, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 114; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.MISC; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(396, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(158, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(193, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 114; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(397, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(156, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(193, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 114; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.MISC; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(399, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(53, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(159, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 114; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(405, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(54, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(128, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 114; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.MISC; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(555, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(223, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(189, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 114; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.MECHANISM; + Recipe.newRecipe.createItem.SetDefaults(511, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(3, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(530, 1, false); + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.MECHANISM; + Recipe.newRecipe.createItem.SetDefaults(512, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(26, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 4; + Recipe.newRecipe.requiredItem[1].SetDefaults(530, 1, false); + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.MECHANISM; + Recipe.newRecipe.createItem.SetDefaults(580, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(167, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 3; + Recipe.newRecipe.requiredItem[1].SetDefaults(530, 1, false); + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.PUMPS; + Recipe.newRecipe.createItem.SetDefaults(581, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(22, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 10; + Recipe.newRecipe.requiredItem[1].SetDefaults(530, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 2; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.PUMPS; + Recipe.newRecipe.createItem.SetDefaults(582, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(22, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 10; + Recipe.newRecipe.requiredItem[1].SetDefaults(530, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 2; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.TIMERS; + Recipe.newRecipe.createItem.SetDefaults(583, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(17, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(22, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 5; + Recipe.newRecipe.requiredItem[2].SetDefaults(530, 1, false); + Recipe.newRecipe.requiredItem[2].stack = (short) 1; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.TIMERS; + Recipe.newRecipe.createItem.SetDefaults(584, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(16, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(22, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 5; + Recipe.newRecipe.requiredItem[2].SetDefaults(530, 1, false); + Recipe.newRecipe.requiredItem[2].stack = (short) 1; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.TIMERS; + Recipe.newRecipe.createItem.SetDefaults(585, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(15, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(22, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 5; + Recipe.newRecipe.requiredItem[2].SetDefaults(530, 1, false); + Recipe.newRecipe.requiredItem[2].stack = (short) 1; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.STRUCTURES; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(540, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(3, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 6; + Recipe.newRecipe.requiredTile[0] = (short) 114; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.MISC; + Recipe.newRecipe.subCategory = Recipe.SubCategory.BRICKS; + Recipe.newRecipe.createItem.SetDefaults(565, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(562, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(563, 1, false); + Recipe.newRecipe.requiredItem[2].SetDefaults(564, 1, false); + Recipe.newRecipe.requiredItem[3].SetDefaults(566, 1, false); + Recipe.newRecipe.requiredItem[4].SetDefaults(567, 1, false); + Recipe.newRecipe.requiredItem[5].SetDefaults(568, 1, false); + Recipe.newRecipe.requiredItem[6].SetDefaults(569, 1, false); + Recipe.newRecipe.requiredItem[7].SetDefaults(570, 1, false); + Recipe.newRecipe.requiredItem[8].SetDefaults(571, 1, false); + Recipe.newRecipe.requiredItem[9].SetDefaults(572, 1, false); + Recipe.newRecipe.requiredItem[10].SetDefaults(573, 1, false); + Recipe.newRecipe.requiredItem[11].SetDefaults(574, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 114; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.MISC; + Recipe.newRecipe.subCategory = Recipe.SubCategory.BRICKS; + Recipe.newRecipe.createItem.SetDefaults(628, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(626, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(627, 1, false); + Recipe.newRecipe.requiredItem[2].SetDefaults(629, 1, false); + Recipe.newRecipe.requiredItem[3].SetDefaults(630, 1, false); + Recipe.newRecipe.requiredItem[4].SetDefaults(631, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 114; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.MISC; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(18, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(20, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 10; + Recipe.newRecipe.requiredItem[1].SetDefaults(21, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 8; + Recipe.newRecipe.requiredItem[2].SetDefaults(19, 1, false); + Recipe.newRecipe.requiredItem[2].stack = (short) 6; + Recipe.newRecipe.requiredTile[0] = (short) 14; + Recipe.newRecipe.requiredTile[1] = (short) 15; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.MISC; + Recipe.newRecipe.subCategory = Recipe.SubCategory.CHANDELIERS; + Recipe.newRecipe.createItem.SetDefaults(193, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(173, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 20; + Recipe.newRecipe.requiredTile[0] = (short) 17; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.MECHANISM; + Recipe.newRecipe.createItem.SetDefaults(518, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(531, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(502, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 30; + Recipe.newRecipe.requiredItem[2].SetDefaults(520, 1, false); + Recipe.newRecipe.requiredItem[2].stack = (short) 20; + Recipe.newRecipe.requiredTile[0] = (short) 101; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.MECHANISM; + Recipe.newRecipe.createItem.SetDefaults(519, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(531, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(522, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 30; + Recipe.newRecipe.requiredItem[2].SetDefaults(521, 1, false); + Recipe.newRecipe.requiredItem[2].stack = (short) 20; + Recipe.newRecipe.requiredTile[0] = (short) 101; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.ANVILS; + Recipe.newRecipe.createItem.SetDefaults(266, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(324, 1, false); + Recipe.newRecipe.requiredItem[1].SetDefaults(323, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 10; + Recipe.newRecipe.requiredItem[2].SetDefaults(180, 1, false); + Recipe.newRecipe.requiredItem[2].stack = (short) 5; + Recipe.newRecipe.requiredTile[0] = (short) 17; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.CHESTS; + Recipe.newRecipe.createItem.SetDefaults(37, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(38, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 2; + Recipe.newRecipe.requiredTile[0] = (short) 18; + Recipe.newRecipe.requiredTile[1] = (short) 15; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.CHESTS; + Recipe.newRecipe.createItem.SetDefaults(237, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(236, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 2; + Recipe.newRecipe.requiredTile[0] = (short) 18; + Recipe.newRecipe.requiredTile[1] = (short) 15; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.POTIONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(109, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(75, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 10; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.MISC; + Recipe.newRecipe.subCategory = Recipe.SubCategory.LANTERNS; + Recipe.newRecipe.createItem.SetDefaults(43, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(38, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 6; + Recipe.newRecipe.requiredTile[0] = (short) 26; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.MISC; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(70, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(67, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 30; + Recipe.newRecipe.requiredItem[1].SetDefaults(68, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 15; + Recipe.newRecipe.requiredTile[0] = (short) 26; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.MISC; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(560, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(23, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 99; + Recipe.newRecipe.requiredItem[1].SetDefaults(264, 1, false); + Recipe.newRecipe.requiredTile[0] = (short) 26; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.MISC; + Recipe.newRecipe.subCategory = Recipe.SubCategory.LANTERNS; + Recipe.newRecipe.createItem.SetDefaults(544, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(38, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 3; + Recipe.newRecipe.requiredItem[1].SetDefaults(20, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 5; + Recipe.newRecipe.requiredItem[2].SetDefaults(22, 1, false); + Recipe.newRecipe.requiredItem[2].stack = (short) 5; + Recipe.newRecipe.requiredItem[3].SetDefaults(520, 1, false); + Recipe.newRecipe.requiredItem[3].stack = (short) 7; + Recipe.newRecipe.requiredTile[0] = (short) 134; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.MISC; + Recipe.newRecipe.subCategory = Recipe.SubCategory.NONE; + Recipe.newRecipe.createItem.SetDefaults(556, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(68, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 6; + Recipe.newRecipe.requiredItem[1].SetDefaults(20, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 5; + Recipe.newRecipe.requiredItem[2].SetDefaults(22, 1, false); + Recipe.newRecipe.requiredItem[2].stack = (short) 5; + Recipe.newRecipe.requiredItem[3].SetDefaults(521, 1, false); + Recipe.newRecipe.requiredItem[3].stack = (short) 7; + Recipe.newRecipe.requiredTile[0] = (short) 134; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.MISC; + Recipe.newRecipe.subCategory = Recipe.SubCategory.CHANDELIERS; + Recipe.newRecipe.createItem.SetDefaults(557, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(154, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 30; + Recipe.newRecipe.requiredItem[1].SetDefaults(20, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 5; + Recipe.newRecipe.requiredItem[2].SetDefaults(22, 1, false); + Recipe.newRecipe.requiredItem[2].stack = (short) 5; + Recipe.newRecipe.requiredItem[3].SetDefaults(520, 1, false); + Recipe.newRecipe.requiredItem[3].stack = (short) 5; + Recipe.newRecipe.requiredItem[4].SetDefaults(521, 1, false); + Recipe.newRecipe.requiredItem[4].stack = (short) 5; + Recipe.newRecipe.requiredTile[0] = (short) 134; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.MISC; + Recipe.newRecipe.subCategory = Recipe.SubCategory.CHANDELIERS; + Recipe.newRecipe.createItem.SetDefaults(619, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(544, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 2; + Recipe.newRecipe.requiredItem[1].SetDefaults(557, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 1; + Recipe.newRecipe.requiredItem[2].SetDefaults(391, 1, false); + Recipe.newRecipe.requiredItem[2].stack = (short) 20; + Recipe.newRecipe.requiredItem[3].SetDefaults(521, 1, false); + Recipe.newRecipe.requiredItem[3].stack = (short) 10; + Recipe.newRecipe.requiredItem[4].SetDefaults(520, 1, false); + Recipe.newRecipe.requiredItem[4].stack = (short) 10; + Recipe.newRecipe.requiredTile[0] = (short) 134; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.BRICKS; + Recipe.newRecipe.createItem.SetDefaults(604, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(559, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 1; + Recipe.newRecipe.requiredItem[1].SetDefaults(372, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 1; + Recipe.newRecipe.requiredItem[2].SetDefaults(377, 1, false); + Recipe.newRecipe.requiredItem[2].stack = (short) 1; + Recipe.newRecipe.requiredItem[3].SetDefaults(401, 1, false); + Recipe.newRecipe.requiredItem[3].stack = (short) 1; + Recipe.newRecipe.requiredItem[4].SetDefaults(620, 1, false); + Recipe.newRecipe.requiredItem[4].stack = (short) 20; + Recipe.newRecipe.requiredTile[0] = (short) 134; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.CRAFTING_STATIONS; + Recipe.newRecipe.createItem.SetDefaults(607, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(551, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 1; + Recipe.newRecipe.requiredItem[1].SetDefaults(374, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 1; + Recipe.newRecipe.requiredItem[2].SetDefaults(379, 1, false); + Recipe.newRecipe.requiredItem[2].stack = (short) 1; + Recipe.newRecipe.requiredItem[3].SetDefaults(403, 1, false); + Recipe.newRecipe.requiredItem[3].stack = (short) 1; + Recipe.newRecipe.requiredItem[4].SetDefaults(548, 1, false); + Recipe.newRecipe.requiredItem[4].stack = (short) 20; + Recipe.newRecipe.requiredItem[5].SetDefaults(620, 1, false); + Recipe.newRecipe.requiredItem[5].stack = (short) 20; + Recipe.newRecipe.requiredTile[0] = (short) 134; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.STATUES; + Recipe.newRecipe.createItem.SetDefaults(610, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(552, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 1; + Recipe.newRecipe.requiredItem[1].SetDefaults(375, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 1; + Recipe.newRecipe.requiredItem[2].SetDefaults(380, 1, false); + Recipe.newRecipe.requiredItem[2].stack = (short) 1; + Recipe.newRecipe.requiredItem[3].SetDefaults(404, 1, false); + Recipe.newRecipe.requiredItem[3].stack = (short) 1; + Recipe.newRecipe.requiredItem[4].SetDefaults(548, 1, false); + Recipe.newRecipe.requiredItem[4].stack = (short) 20; + Recipe.newRecipe.requiredItem[5].SetDefaults(620, 1, false); + Recipe.newRecipe.requiredItem[5].stack = (short) 20; + Recipe.newRecipe.requiredTile[0] = (short) 134; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.WALLS; + Recipe.newRecipe.createItem.SetDefaults(605, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(553, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 1; + Recipe.newRecipe.requiredItem[1].SetDefaults(373, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 1; + Recipe.newRecipe.requiredItem[2].SetDefaults(378, 1, false); + Recipe.newRecipe.requiredItem[2].stack = (short) 1; + Recipe.newRecipe.requiredItem[3].SetDefaults(402, 1, false); + Recipe.newRecipe.requiredItem[3].stack = (short) 1; + Recipe.newRecipe.requiredItem[4].SetDefaults(620, 1, false); + Recipe.newRecipe.requiredItem[4].stack = (short) 20; + Recipe.newRecipe.requiredTile[0] = (short) 134; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.CRAFTING_STATIONS; + Recipe.newRecipe.createItem.SetDefaults(608, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(551, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 1; + Recipe.newRecipe.requiredItem[1].SetDefaults(374, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 1; + Recipe.newRecipe.requiredItem[2].SetDefaults(379, 1, false); + Recipe.newRecipe.requiredItem[2].stack = (short) 1; + Recipe.newRecipe.requiredItem[3].SetDefaults(403, 1, false); + Recipe.newRecipe.requiredItem[3].stack = (short) 1; + Recipe.newRecipe.requiredItem[4].SetDefaults(549, 1, false); + Recipe.newRecipe.requiredItem[4].stack = (short) 20; + Recipe.newRecipe.requiredItem[5].SetDefaults(620, 1, false); + Recipe.newRecipe.requiredItem[5].stack = (short) 20; + Recipe.newRecipe.requiredTile[0] = (short) 134; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.STATUES; + Recipe.newRecipe.createItem.SetDefaults(611, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(552, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 1; + Recipe.newRecipe.requiredItem[1].SetDefaults(375, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 1; + Recipe.newRecipe.requiredItem[2].SetDefaults(380, 1, false); + Recipe.newRecipe.requiredItem[2].stack = (short) 1; + Recipe.newRecipe.requiredItem[3].SetDefaults(404, 1, false); + Recipe.newRecipe.requiredItem[3].stack = (short) 1; + Recipe.newRecipe.requiredItem[4].SetDefaults(549, 1, false); + Recipe.newRecipe.requiredItem[4].stack = (short) 20; + Recipe.newRecipe.requiredItem[5].SetDefaults(620, 1, false); + Recipe.newRecipe.requiredItem[5].stack = (short) 20; + Recipe.newRecipe.requiredTile[0] = (short) 134; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.TORCHES; + Recipe.newRecipe.createItem.SetDefaults(606, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(558, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 1; + Recipe.newRecipe.requiredItem[1].SetDefaults(371, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 1; + Recipe.newRecipe.requiredItem[2].SetDefaults(376, 1, false); + Recipe.newRecipe.requiredItem[2].stack = (short) 1; + Recipe.newRecipe.requiredItem[3].SetDefaults(400, 1, false); + Recipe.newRecipe.requiredItem[3].stack = (short) 1; + Recipe.newRecipe.requiredItem[4].SetDefaults(620, 1, false); + Recipe.newRecipe.requiredItem[4].stack = (short) 20; + Recipe.newRecipe.requiredTile[0] = (short) 134; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.CRAFTING_STATIONS; + Recipe.newRecipe.createItem.SetDefaults(609, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(551, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 1; + Recipe.newRecipe.requiredItem[1].SetDefaults(374, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 1; + Recipe.newRecipe.requiredItem[2].SetDefaults(379, 1, false); + Recipe.newRecipe.requiredItem[2].stack = (short) 1; + Recipe.newRecipe.requiredItem[3].SetDefaults(403, 1, false); + Recipe.newRecipe.requiredItem[3].stack = (short) 1; + Recipe.newRecipe.requiredItem[4].SetDefaults(547, 1, false); + Recipe.newRecipe.requiredItem[4].stack = (short) 20; + Recipe.newRecipe.requiredItem[5].SetDefaults(620, 1, false); + Recipe.newRecipe.requiredItem[5].stack = (short) 20; + Recipe.newRecipe.requiredTile[0] = (short) 134; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.ARMOR; + Recipe.newRecipe.subCategory = Recipe.SubCategory.STATUES; + Recipe.newRecipe.createItem.SetDefaults(612, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(552, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 1; + Recipe.newRecipe.requiredItem[1].SetDefaults(375, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 1; + Recipe.newRecipe.requiredItem[2].SetDefaults(380, 1, false); + Recipe.newRecipe.requiredItem[2].stack = (short) 1; + Recipe.newRecipe.requiredItem[3].SetDefaults(404, 1, false); + Recipe.newRecipe.requiredItem[3].stack = (short) 1; + Recipe.newRecipe.requiredItem[4].SetDefaults(547, 1, false); + Recipe.newRecipe.requiredItem[4].stack = (short) 20; + Recipe.newRecipe.requiredItem[5].SetDefaults(620, 1, false); + Recipe.newRecipe.requiredItem[5].stack = (short) 20; + Recipe.newRecipe.requiredTile[0] = (short) 134; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.TORCHES; + Recipe.newRecipe.createItem.SetDefaults(613, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(368, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 2; + Recipe.newRecipe.requiredItem[1].SetDefaults(620, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 15; + Recipe.newRecipe.requiredItem[2].SetDefaults(391, 1, false); + Recipe.newRecipe.requiredItem[2].stack = (short) 20; + Recipe.newRecipe.requiredTile[0] = (short) 134; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.SPEARS; + Recipe.newRecipe.createItem.SetDefaults(614, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(550, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 2; + Recipe.newRecipe.requiredItem[1].SetDefaults(620, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 15; + Recipe.newRecipe.requiredItem[2].SetDefaults(391, 1, false); + Recipe.newRecipe.requiredItem[2].stack = (short) 20; + Recipe.newRecipe.requiredTile[0] = (short) 134; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.CHESTS; + Recipe.newRecipe.createItem.SetDefaults(615, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(120, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 2; + Recipe.newRecipe.requiredItem[1].SetDefaults(175, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 10; + Recipe.newRecipe.requiredTile[0] = (short) 16; + Recipe.addRecipe(); + Recipe.newRecipe.category = Recipe.Category.WEAPONS; + Recipe.newRecipe.subCategory = Recipe.SubCategory.TIMERS; + Recipe.newRecipe.createItem.SetDefaults(617, 1, false); + Recipe.newRecipe.requiredItem[0].SetDefaults(578, 1, false); + Recipe.newRecipe.requiredItem[0].stack = (short) 2; + Recipe.newRecipe.requiredItem[1].SetDefaults(620, 1, false); + Recipe.newRecipe.requiredItem[1].stack = (short) 15; + Recipe.newRecipe.requiredItem[2].SetDefaults(391, 1, false); + Recipe.newRecipe.requiredItem[2].stack = (short) 20; + Recipe.newRecipe.requiredTile[0] = (short) 134; + Recipe.addRecipe(); + for (int index1 = 0; index1 < Recipe.numRecipes; ++index1) + { + for (int index2 = 0; index2 < 12 && (int) Main.recipe[index1].requiredItem[index2].type > 0; ++index2) + Main.recipe[index1].requiredItem[index2].checkMat(); + Main.recipe[index1].createItem.checkMat(); + } + } + + private static void addRecipe() + { + for (int index = 0; index < 12 && (int) Recipe.newRecipe.requiredItem[index].type > 0; ++index) + ++Recipe.newRecipe.numRequiredItems; + for (int index = 0; index < 3 && (int) Recipe.newRecipe.requiredTile[index] >= 0; ++index) + ++Recipe.newRecipe.numRequiredTiles; + Main.recipe[Recipe.numRecipes++] = Recipe.newRecipe; + Recipe.newRecipe = new Recipe(); + } + + public enum Category : byte + { + STRUCTURES, + TOOLS, + WEAPONS, + ARMOR, + POTIONS, + MISC, + NUM_CATEGORIES, + } + + public enum SubCategory : byte + { + BOOTS = (byte) 0, + NONE = (byte) 0, + TABLEWARE = (byte) 0, + BANNERS = (byte) 1, + HEADGEAR = (byte) 1, + HEALING = (byte) 1, + PICKAXES = (byte) 1, + SWORDS = (byte) 1, + TORCHES = (byte) 1, + BROADSWORDS = (byte) 2, + DRILLS = (byte) 2, + HELMETS = (byte) 2, + MANA = (byte) 2, + WALLS = (byte) 2, + WATCHES = (byte) 2, + AXES = (byte) 3, + BRICKS = (byte) 3, + MASKS = (byte) 3, + MUSICBOXES = (byte) 3, + RESTORATION = (byte) 3, + SHORTSWORDS = (byte) 3, + CHAINSAWS = (byte) 4, + EYES = (byte) 4, + FLAILS = (byte) 4, + HOODS = (byte) 4, + LANTERNS = (byte) 4, + BOOMERANGS = (byte) 5, + CHANDELIERS = (byte) 5, + HAMMERS = (byte) 5, + HATS = (byte) 5, + SKULLS = (byte) 5, + BOWS = (byte) 6, + CHESTS = (byte) 6, + GOGGLES = (byte) 6, + HAMAXES = (byte) 6, + ARROWS = (byte) 7, + BARS = (byte) 7, + BODY = (byte) 7, + CRAFTING_STATIONS = (byte) 7, + ANVILS = (byte) 8, + GRAPPLING = (byte) 8, + GUNS = (byte) 8, + SHIRTS = (byte) 8, + LEGS = (byte) 9, + MAGIC_GUNS = (byte) 9, + STATUES = (byte) 9, + MECHANISM = (byte) 10, + PANTS = (byte) 10, + SPELLS = (byte) 10, + REPEATERS = (byte) 11, + TIMERS = (byte) 11, + WINGS = (byte) 11, + BULLETS = (byte) 12, + PUMPS = (byte) 12, + PHASEBLADES = (byte) 13, + PHASESABERS = (byte) 14, + SPEARS = (byte) 15, + EXPLOSIVES = (byte) 16, + } + + public sealed class SubCategoryList + { + public bool canCraft; + public List recipes; + + public SubCategoryList(int reserve) + { + this.canCraft = false; + this.recipes = new List(reserve); + } + + public void Add(Player p, int recipe) + { + this.recipes.Add((short) recipe); + if (this.canCraft) + return; + this.canCraft = p.CanCraftRecipe(Main.recipe[recipe]); + } + } + } +} diff --git a/Terraria/SfxInstancePool.cs b/Terraria/SfxInstancePool.cs new file mode 100644 index 0000000..07c77f0 --- /dev/null +++ b/Terraria/SfxInstancePool.cs @@ -0,0 +1,75 @@ +// Type: Terraria.SfxInstancePool +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework.Audio; +using Microsoft.Xna.Framework.Content; + +namespace Terraria +{ + public sealed class SfxInstancePool + { + private uint mLastFramePlayed; + private short mCurrentIndex; + private short mMaxInstanceMask; + private SoundEffectInstance[] mInstances; + private SoundEffectInstance mCurrentInstance; + private SoundEffect mSoundEffect; + + public SfxInstancePool(ContentManager content, string name, int maxInstances) + { + this.mCurrentIndex = (short) 0; + this.mMaxInstanceMask = (short) (maxInstances - 1); + this.mInstances = new SoundEffectInstance[maxInstances]; + this.mSoundEffect = content.Load(name); + for (int index = 0; index < maxInstances; ++index) + this.mInstances[index] = this.mSoundEffect.CreateInstance(); + } + + public bool IsPlaying() + { + if (this.mCurrentInstance != null) + return this.mCurrentInstance.State == SoundState.Playing; + else + return false; + } + + public void Play(double volume, double pan = 0.0, double pitch = 0.0) + { + if ((int) this.mLastFramePlayed == (int) Main.frameCounter) + return; + this.mLastFramePlayed = Main.frameCounter; + SoundEffectInstance soundEffectInstance = this.mInstances[(int) this.mCurrentIndex]; + int index = (int) this.mCurrentIndex + 1 & (int) this.mMaxInstanceMask; + this.mInstances[index].Stop(true); + this.mCurrentIndex = (short) index; + soundEffectInstance.Volume = (float) volume; + soundEffectInstance.Pan = (float) pan; + soundEffectInstance.Pitch = (float) pitch; + soundEffectInstance.Play(); + this.mCurrentInstance = soundEffectInstance; + } + + public void Update(double volume, double pan = 0.0, double pitch = 0.0) + { + if (this.mCurrentInstance == null || this.mCurrentInstance.State != SoundState.Playing) + return; + this.mCurrentInstance.Volume = (float) volume; + this.mCurrentInstance.Pan = (float) pan; + this.mCurrentInstance.Pitch = (float) pitch; + } + + public void UpdateOrPlay(double volume, double pan = 0.0, double pitch = 0.0) + { + if (this.mCurrentInstance != null && this.mCurrentInstance.State == SoundState.Playing) + { + this.mCurrentInstance.Volume = (float) volume; + this.mCurrentInstance.Pan = (float) pan; + this.mCurrentInstance.Pitch = (float) pitch; + } + else + this.Play(volume, pan, pitch); + } + } +} diff --git a/Terraria/Sign.cs b/Terraria/Sign.cs new file mode 100644 index 0000000..3eb6b35 --- /dev/null +++ b/Terraria/Sign.cs @@ -0,0 +1,138 @@ +// Type: Terraria.Sign +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework.Net; +using System.IO; + +namespace Terraria +{ + public struct Sign + { + public const int MAX_SIGNS = 1000; + public short x; + public short y; + public UserString text; + + public void Init() + { + this.x = (short) -1; + this.y = (short) -1; + this.text = (UserString) null; + } + + public static void KillSign(int x, int y) + { + for (int index = 0; index < 1000; ++index) + { + if ((int) Main.sign[index].x == x && (int) Main.sign[index].y == y) + { + Main.sign[index].Init(); + break; + } + } + } + + public static int ReadSign(int i, int j) + { + int num1 = (int) Main.tile[i, j].frameX / 18 & 1; + int num2 = (int) Main.tile[i, j].frameY / 18; + int x = i - num1; + int y = j - num2; + if ((int) Main.tile[x, y].type != 55 && (int) Main.tile[x, y].type != 85) + { + Sign.KillSign(x, y); + return -1; + } + else + { + int num3 = 0; + for (int index = 0; index < 1000; ++index) + { + if ((int) Main.sign[index].x < 0) + num3 = index; + else if ((int) Main.sign[index].x == x && (int) Main.sign[index].y == y) + return index; + } + for (int index = num3; index < 1000; ++index) + { + if ((int) Main.sign[index].x < 0) + { + Main.sign[index].x = (short) x; + Main.sign[index].y = (short) y; + Main.sign[index].text = new UserString("", true); + return index; + } + } + return -1; + } + } + + private unsafe bool Validate() + { + fixed (Tile* tilePtr = &Main.tile[(int) this.x, (int) this.y]) + { + if ((int) tilePtr->active == 0 || (int) tilePtr->type != 55 && (int) tilePtr->type != 85) + { + this.Init(); + return false; + } + else + { + // ISSUE: __unpin statement + __unpin(tilePtr); + return true; + } + } + } + + public void SetText(UserString s) + { + if (!this.Validate()) + return; + this.text = s; + } + + public void Read(PacketReader packetIn) + { + this.x = ((BinaryReader) packetIn).ReadInt16(); + this.y = ((BinaryReader) packetIn).ReadInt16(); + this.text = new UserString((BinaryReader) packetIn); + } + + public void Read(BinaryReader fileIO, int release) + { + if (!fileIO.ReadBoolean()) + return; + if (release >= 49) + { + this.x = fileIO.ReadInt16(); + this.y = fileIO.ReadInt16(); + this.text = new UserString(fileIO); + } + else + { + this.text = (UserString) fileIO.ReadString(); + this.x = fileIO.ReadInt16(); + this.y = fileIO.ReadInt16(); + } + this.Validate(); + } + + public void Write(BinaryWriter fileIO) + { + if ((int) this.x < 0 || this.text == null) + { + fileIO.Write(false); + } + else + { + fileIO.Write(true); + fileIO.Write(this.x); + fileIO.Write(this.y); + this.text.Write(fileIO); + } + } + } +} diff --git a/Terraria/Size.cs b/Terraria/Size.cs new file mode 100644 index 0000000..7fb9125 --- /dev/null +++ b/Terraria/Size.cs @@ -0,0 +1,13 @@ +// Type: Terraria.Size +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +namespace Terraria +{ + public struct Size + { + public short Width; + public short Height; + } +} diff --git a/Terraria/Slider.cs b/Terraria/Slider.cs new file mode 100644 index 0000000..202d5f7 --- /dev/null +++ b/Terraria/Slider.cs @@ -0,0 +1,59 @@ +// Type: Terraria.Slider +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace Terraria +{ + public class Slider + { + private Texture2D texture; + private Rectangle empty; + private Rectangle filled; + private Vector2 position; + private float progress; + private Rectangle leftComponent; + private Vector2 rightComponentOffset; + private Rectangle rightComponent; + + public float Progress + { + get + { + return this.progress; + } + set + { + this.progress = value; + if ((double) this.progress < 0.0) + this.progress = 0.0f; + else if ((double) this.progress > 1.0) + this.progress = 1f; + this.leftComponent = this.filled; + this.leftComponent.Width = (int) ((double) this.leftComponent.Width * (double) this.progress); + this.rightComponent = this.empty; + this.rightComponent.Width = (int) ((double) this.rightComponent.Width * (1.0 - (double) this.progress)); + this.rightComponent.X = this.leftComponent.Width; + this.rightComponentOffset = new Vector2((float) this.leftComponent.Width, 0.0f); + } + } + + public Slider(Texture2D texture, Rectangle empty, Rectangle filled, Vector2 position) + { + this.texture = texture; + this.empty = empty; + this.filled = filled; + this.position = position; + this.Progress = 0.0f; + } + + public void Draw(SpriteBatch screen) + { + screen.Draw(this.texture, this.position, new Rectangle?(this.leftComponent), Color.White); + screen.Draw(this.texture, this.position + this.rightComponentOffset, new Rectangle?(this.rightComponent), Color.White); + } + } +} diff --git a/Terraria/SoundUI/Assets.cs b/Terraria/SoundUI/Assets.cs new file mode 100644 index 0000000..ba2c301 --- /dev/null +++ b/Terraria/SoundUI/Assets.cs @@ -0,0 +1,35 @@ +// Type: Terraria.SoundUI.Assets +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Content; +using Microsoft.Xna.Framework.Graphics; + +namespace Terraria.SoundUI +{ + public class Assets + { + public static Texture2D SLIDER; + public static Rectangle SLIDER_EMPTY_RECT; + public static Rectangle SLIDER_EMPTY_INACTIVE_RECT; + public static Rectangle SLIDER_FULL_RECT; + public static Rectangle SLIDER_FULL_INACTIVE_RECT; + public static Texture2D SOUND_ICONS; + public static Rectangle SOUND_ICON_RECT; + public static Rectangle MUSIC_ICON_RECT; + + public static void LoadContent(ContentManager Content) + { + Assets.SLIDER = Content.Load("UI/SoundBar"); + Assets.SLIDER_EMPTY_RECT = new Rectangle(0, 0, 244, 58); + Assets.SLIDER_EMPTY_INACTIVE_RECT = new Rectangle(0, 58, 244, 58); + Assets.SLIDER_FULL_RECT = new Rectangle(0, 116, 244, 58); + Assets.SLIDER_FULL_INACTIVE_RECT = new Rectangle(0, 174, 244, 58); + Assets.SOUND_ICONS = Content.Load("UI/SoundIcons"); + Assets.SOUND_ICON_RECT = new Rectangle(0, 36, 40, 36); + Assets.MUSIC_ICON_RECT = new Rectangle(0, 0, 40, 36); + } + } +} diff --git a/Terraria/SoundUI/UI.cs b/Terraria/SoundUI/UI.cs new file mode 100644 index 0000000..7383460 --- /dev/null +++ b/Terraria/SoundUI/UI.cs @@ -0,0 +1,146 @@ +// Type: Terraria.SoundUI.UI +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System.Text; +using Terraria; + +namespace Terraria.SoundUI +{ + internal class UI + { + private const int SLIDER_SPACE_Y = 10; + private const float SLIDER_STEPS = 0.05f; + private Terraria.UI parentUI; + private UI.Icon soundIcon; + private UI.Icon musicIcon; + private ActivatableSlider soundSlider; + private ActivatableSlider musicSlider; + private ActivatableSlider selected; + private float stepSize; + private int uiDelay; + + public UI(Terraria.UI parentUI, UI.Icon soundIcon, UI.Icon musicIcon, ActivatableSlider soundSlider, ActivatableSlider musicSlider, float stepSize) + { + this.parentUI = parentUI; + this.soundIcon = soundIcon; + this.musicIcon = musicIcon; + this.soundSlider = soundSlider; + this.musicSlider = musicSlider; + this.SelectSoundSlider(); + this.stepSize = stepSize; + } + + public static UI Create(Terraria.UI parentUI) + { + int num = Assets.SLIDER_EMPTY_RECT.Height + 10; + Vector2 vector2 = new Vector2(300f, 300f); + Vector2 position1 = vector2 + new Vector2(50f, 0.0f); + ActivatableSlider soundSlider = new ActivatableSlider(new Slider(Assets.SLIDER, Assets.SLIDER_EMPTY_RECT, Assets.SLIDER_FULL_RECT, position1), new Slider(Assets.SLIDER, Assets.SLIDER_EMPTY_INACTIVE_RECT, Assets.SLIDER_FULL_INACTIVE_RECT, position1)); + position1.Y += (float) num; + ActivatableSlider musicSlider = new ActivatableSlider(new Slider(Assets.SLIDER, Assets.SLIDER_EMPTY_RECT, Assets.SLIDER_FULL_RECT, position1), new Slider(Assets.SLIDER, Assets.SLIDER_EMPTY_INACTIVE_RECT, Assets.SLIDER_FULL_INACTIVE_RECT, position1)); + Vector2 position2 = vector2 + new Vector2(0.0f, (float) (Assets.SLIDER_EMPTY_RECT.Height - Assets.SOUND_ICON_RECT.Height)); + UI.Icon soundIcon = new UI.Icon(Assets.SOUND_ICONS, position2, Assets.SOUND_ICON_RECT); + position2.Y += (float) num; + UI.Icon musicIcon = new UI.Icon(Assets.SOUND_ICONS, position2, Assets.MUSIC_ICON_RECT); + return new UI(parentUI, soundIcon, musicIcon, soundSlider, musicSlider, 0.05f); + } + + public void UpdateVolumes() + { + this.soundSlider.Progress = this.parentUI.soundVolume; + this.musicSlider.Progress = this.parentUI.musicVolume; + } + + private void SelectMusicSlider() + { + this.soundSlider.Active = false; + this.musicSlider.Active = true; + this.selected = this.musicSlider; + } + + private void SelectSoundSlider() + { + this.soundSlider.Active = true; + this.musicSlider.Active = false; + this.selected = this.soundSlider; + } + + public void Update() + { + if (this.uiDelay > 0) + { + --this.uiDelay; + } + else + { + bool flag = false; + if (this.parentUI.IsRightButtonDown()) + { + this.selected.Progress += this.stepSize; + flag = true; + } + if (this.parentUI.IsLeftButtonDown()) + { + this.selected.Progress -= this.stepSize; + flag = true; + } + if (this.parentUI.IsUpButtonDown() || this.parentUI.IsDownButtonDown()) + { + if (this.selected == this.soundSlider) + this.SelectMusicSlider(); + else + this.SelectSoundSlider(); + flag = true; + } + if (!flag) + return; + this.uiDelay = 12; + Main.soundVolume = this.parentUI.soundVolume = this.soundSlider.Progress; + Main.musicVolume = this.parentUI.musicVolume = this.musicSlider.Progress; + this.parentUI.settingsDirty = true; + Main.PlaySound(12); + } + } + + public void Draw(SpriteBatch screen) + { + screen.Draw(this.soundIcon.texture, this.soundIcon.position, new Rectangle?(this.soundIcon.source), Color.White); + screen.Draw(this.musicIcon.texture, this.musicIcon.position, new Rectangle?(this.musicIcon.source), Color.White); + this.soundSlider.Draw(screen); + this.musicSlider.Draw(screen); + } + + public void ControlDescription(StringBuilder strBuilder) + { + if (this.selected == this.musicSlider) + { + strBuilder.Append(Lang.controls(Lang.CONTROLS.CHANGE_MUSIC_VOLUME)); + strBuilder.Append(' '); + } + else if (this.selected == this.soundSlider) + { + strBuilder.Append(Lang.controls(Lang.CONTROLS.CHANGE_SOUND_VOLUME)); + strBuilder.Append(' '); + } + strBuilder.Append(Lang.controls(Lang.CONTROLS.BACK)); + } + + public struct Icon + { + public Texture2D texture; + public Vector2 position; + public Rectangle source; + + public Icon(Texture2D texture, Vector2 position, Rectangle source) + { + this.texture = texture; + this.position = position; + this.source = source; + } + } + } +} diff --git a/Terraria/SpriteSheet`1.cs b/Terraria/SpriteSheet`1.cs new file mode 100644 index 0000000..d2499ed --- /dev/null +++ b/Terraria/SpriteSheet`1.cs @@ -0,0 +1,257 @@ +// Type: Terraria.SpriteSheet`1 +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace Terraria +{ + public class SpriteSheet + { + protected static Texture2D tex; + public static Rectangle[] src; + + public static void Draw(int id, int x, int y, int sy, int sh, Color c, float rotCenter, float scaleCenter) + { + Rectangle rectangle = SpriteSheet.src[id]; + rectangle.Y += sy; + rectangle.Height = sh; + Main.spriteBatch.Draw(SpriteSheet.tex, new Vector2((float) x, (float) y), new Rectangle?(rectangle), c, rotCenter, new Vector2((float) (rectangle.Width >> 1), (float) (sh >> 1)), scaleCenter, SpriteEffects.None, 0.0f); + } + + public static void Draw(int id, int x, int y, int sx, int sw, int sh, Color c) + { + Rectangle rectangle = SpriteSheet.src[id]; + rectangle.X += sx; + rectangle.Width = sw; + rectangle.Height = sh; + Main.spriteBatch.Draw(SpriteSheet.tex, new Vector2((float) x, (float) y), new Rectangle?(rectangle), c); + } + + public static void Draw(int id, ref Vector2 pos, int sy, int sh, Color c, SpriteEffects e) + { + Rectangle rectangle = SpriteSheet.src[id]; + rectangle.Y += sy; + rectangle.Height = sh; + Main.spriteBatch.Draw(SpriteSheet.tex, pos, new Rectangle?(rectangle), c, 0.0f, new Vector2(), 1f, e, 0.0f); + } + + public static void DrawRotated(int id, ref Vector2 pos, int sy, int sh, Color c, float rot, SpriteEffects e) + { + Rectangle rectangle = SpriteSheet.src[id]; + rectangle.Y += sy; + rectangle.Height = sh; + Main.spriteBatch.Draw(SpriteSheet.tex, pos, new Rectangle?(rectangle), c, rot, new Vector2((float) (rectangle.Width >> 1), (float) (sh >> 1)), 1f, e, 0.0f); + } + + public static void DrawRotated(int id, ref Vector2 pos, int sy, int sh, Color c, float rot, ref Vector2 pivot, SpriteEffects e) + { + Rectangle rectangle = SpriteSheet.src[id]; + rectangle.Y += sy; + rectangle.Height = sh; + Main.spriteBatch.Draw(SpriteSheet.tex, pos, new Rectangle?(rectangle), c, rot, pivot, 1f, e, 0.0f); + } + + public static void Draw(int id, ref Vector2 pos, int sy, int sh, Color c, float rot, ref Vector2 pivot, float scale, SpriteEffects e) + { + Rectangle rectangle = SpriteSheet.src[id]; + rectangle.Y += sy; + rectangle.Height = sh; + Main.spriteBatch.Draw(SpriteSheet.tex, pos, new Rectangle?(rectangle), c, rot, pivot, scale, e, 0.0f); + } + + public static void Draw(int id, ref Vector2 pos, Color c, float rot, ref Vector2 pivot, float scale, SpriteEffects e) + { + Main.spriteBatch.Draw(SpriteSheet.tex, pos, new Rectangle?(SpriteSheet.src[id]), c, rot, pivot, scale, e, 0.0f); + } + + public static void Draw(int id, ref Vector2 pos, Color c) + { + Main.spriteBatch.Draw(SpriteSheet.tex, pos, new Rectangle?(SpriteSheet.src[id]), c); + } + + public static void Draw(int id, ref Vector2 pos, ref Rectangle s, Color c) + { + Rectangle rectangle = SpriteSheet.src[id]; + rectangle.X += s.X; + rectangle.Y += s.Y; + rectangle.Width = s.Width; + rectangle.Height = s.Height; + Main.spriteBatch.Draw(SpriteSheet.tex, pos, new Rectangle?(rectangle), c); + } + + public static void DrawStretched(int id, Rectangle s, ref Rectangle dest, Color c) + { + s.X += SpriteSheet.src[id].X; + s.Y += SpriteSheet.src[id].Y; + Main.spriteBatch.Draw(SpriteSheet.tex, dest, new Rectangle?(s), c); + } + + public static void DrawStretchedX(int id, ref Rectangle dest, Color c) + { + Rectangle rectangle = SpriteSheet.src[id]; + rectangle.X += 4; + rectangle.Width -= 8; + Main.spriteBatch.Draw(SpriteSheet.tex, dest, new Rectangle?(rectangle), c); + } + + public static void DrawStretchedY(int id, ref Rectangle dest, Color c) + { + Rectangle rectangle = SpriteSheet.src[id]; + rectangle.Y += 4; + rectangle.Height -= 8; + Main.spriteBatch.Draw(SpriteSheet.tex, dest, new Rectangle?(rectangle), c); + } + + public static void Draw(int id, int x, int y) + { + Main.spriteBatch.Draw(SpriteSheet.tex, new Vector2((float) x, (float) y), new Rectangle?(SpriteSheet.src[id]), Color.White); + } + + public static void DrawCentered(int id, int x, int y, Rectangle rect, Color c) + { + rect.X += SpriteSheet.src[id].X; + rect.Y += SpriteSheet.src[id].Y; + Main.spriteBatch.Draw(SpriteSheet.tex, new Vector2((float) (x - (rect.Width >> 1)), (float) (y - (rect.Height >> 1))), new Rectangle?(rect), c); + } + + public static void DrawCentered(int id, int x, int y, Rectangle rect, Color c, float scale) + { + rect.X += SpriteSheet.src[id].X; + rect.Y += SpriteSheet.src[id].Y; + Vector2 vector2 = new Vector2((float) (rect.Width >> 1), (float) (rect.Height >> 1)); + Main.spriteBatch.Draw(SpriteSheet.tex, new Vector2((float) x, (float) y), new Rectangle?(rect), c, 0.0f, vector2, scale, SpriteEffects.None, 0.0f); + } + + public static void DrawCentered(int id, ref Rectangle rect) + { + Main.spriteBatch.Draw(SpriteSheet.tex, new Vector2((float) (rect.X + (rect.Width >> 1) - (SpriteSheet.src[id].Width >> 1)), (float) (rect.Y + (rect.Height >> 1) - (SpriteSheet.src[id].Height >> 1))), new Rectangle?(SpriteSheet.src[id]), Color.White); + } + + public static void DrawCentered(int id, ref Rectangle rect, SpriteEffects se) + { + Main.spriteBatch.Draw(SpriteSheet.tex, new Vector2((float) (rect.X + (rect.Width >> 1) - (SpriteSheet.src[id].Width >> 1)), (float) (rect.Y + (rect.Height >> 1) - (SpriteSheet.src[id].Height >> 1))), new Rectangle?(SpriteSheet.src[id]), Color.White, 0.0f, new Vector2(), 1f, se, 0.0f); + } + + public static void Draw(int id, int x, int y, Color c) + { + Main.spriteBatch.Draw(SpriteSheet.tex, new Vector2((float) x, (float) y), new Rectangle?(SpriteSheet.src[id]), c); + } + + public static void Draw(int id, int x, int y, Color c, SpriteEffects se) + { + Main.spriteBatch.Draw(SpriteSheet.tex, new Vector2((float) x, (float) y), new Rectangle?(SpriteSheet.src[id]), c, 0.0f, new Vector2(), 1f, se, 0.0f); + } + + public static void DrawScaled(int id, int x, int y, float scaleCenter, Color c) + { + Main.spriteBatch.Draw(SpriteSheet.tex, new Vector2((float) x, (float) y), new Rectangle?(SpriteSheet.src[id]), c, 0.0f, new Vector2((float) (SpriteSheet.src[id].Width >> 1), (float) (SpriteSheet.src[id].Height >> 1)), scaleCenter, SpriteEffects.None, 0.0f); + } + + public static void DrawRotated(int id, ref Vector2 pos, Color c, float rotCenter) + { + Main.spriteBatch.Draw(SpriteSheet.tex, pos, new Rectangle?(SpriteSheet.src[id]), c, rotCenter, new Vector2((float) (SpriteSheet.src[id].Width >> 1), (float) (SpriteSheet.src[id].Height >> 1)), 1f, SpriteEffects.None, 0.0f); + } + + public static void DrawRotatedTL(int id, int x, int y, Color c, float rotTL) + { + Main.spriteBatch.Draw(SpriteSheet.tex, new Vector2((float) x, (float) y), new Rectangle?(SpriteSheet.src[id]), c, rotTL, new Vector2(), 1f, SpriteEffects.None, 0.0f); + } + + public static void DrawScaled(int id, ref Vector2 pos, Color c, float scaleCenter) + { + Main.spriteBatch.Draw(SpriteSheet.tex, pos, new Rectangle?(SpriteSheet.src[id]), c, 0.0f, new Vector2((float) (SpriteSheet.src[id].Width >> 1), (float) (SpriteSheet.src[id].Height >> 1)), scaleCenter, SpriteEffects.None, 0.0f); + } + + public static void DrawScaledTL(int id, ref Vector2 pos, Color c, float scale) + { + Main.spriteBatch.Draw(SpriteSheet.tex, pos, new Rectangle?(SpriteSheet.src[id]), c, 0.0f, new Vector2(), scale, SpriteEffects.None, 0.0f); + } + + public static void DrawScaledTL(int id, int x, int y, Color c, float scale) + { + Main.spriteBatch.Draw(SpriteSheet.tex, new Vector2((float) x, (float) y), new Rectangle?(SpriteSheet.src[id]), c, 0.0f, new Vector2(), scale, SpriteEffects.None, 0.0f); + } + + public static void DrawScaled(int id, int x, int y, float scaleCenter, Color c, SpriteEffects e) + { + Main.spriteBatch.Draw(SpriteSheet.tex, new Vector2((float) x, (float) y), new Rectangle?(SpriteSheet.src[id]), c, 0.0f, new Vector2((float) (SpriteSheet.src[id].Width >> 1), (float) (SpriteSheet.src[id].Height >> 1)), scaleCenter, e, 0.0f); + } + + public static void Draw(int id, int x, int y, Color c, float rotCenter, float scaleCenter) + { + Main.spriteBatch.Draw(SpriteSheet.tex, new Vector2((float) x, (float) y), new Rectangle?(SpriteSheet.src[id]), c, rotCenter, new Vector2((float) (SpriteSheet.src[id].Width >> 1), (float) (SpriteSheet.src[id].Height >> 1)), scaleCenter, SpriteEffects.None, 0.0f); + } + + public static void Draw(int id, ref Vector2 pos, Color c, SpriteEffects se) + { + Main.spriteBatch.Draw(SpriteSheet.tex, pos, new Rectangle?(SpriteSheet.src[id]), c, 0.0f, new Vector2(), 1f, se, 0.0f); + } + + public static void Draw(int id, ref Vector2 pos, Color c, float rotCenter, SpriteEffects se) + { + Main.spriteBatch.Draw(SpriteSheet.tex, pos, new Rectangle?(SpriteSheet.src[id]), c, rotCenter, new Vector2((float) (SpriteSheet.src[id].Width >> 1), (float) (SpriteSheet.src[id].Height >> 1)), 1f, se, 0.0f); + } + + public static void DrawTL(int id, ref Vector2 pos, Color c, float scaleTopLeft) + { + Main.spriteBatch.Draw(SpriteSheet.tex, pos, new Rectangle?(SpriteSheet.src[id]), c, 0.0f, new Vector2(), scaleTopLeft, SpriteEffects.None, 0.0f); + } + + public static void DrawTL(int id, int x, int y, Color c, float scaleTopLeft) + { + Main.spriteBatch.Draw(SpriteSheet.tex, new Vector2((float) x, (float) y), new Rectangle?(SpriteSheet.src[id]), c, 0.0f, new Vector2(), scaleTopLeft, SpriteEffects.None, 0.0f); + } + + public static void DrawL(int id, int x, int y, Color c, float scaleCenterLeft) + { + Main.spriteBatch.Draw(SpriteSheet.tex, new Vector2((float) x, (float) y), new Rectangle?(SpriteSheet.src[id]), c, 0.0f, new Vector2(0.0f, (float) (SpriteSheet.src[id].Height >> 1)), scaleCenterLeft, SpriteEffects.None, 0.0f); + } + + public static void Draw(int id, ref Vector2 pos, Color c, float rot, float scale) + { + Main.spriteBatch.Draw(SpriteSheet.tex, pos, new Rectangle?(SpriteSheet.src[id]), c, rot, new Vector2((float) (SpriteSheet.src[id].Width >> 1), (float) (SpriteSheet.src[id].Height >> 1)), scale, SpriteEffects.None, 0.0f); + } + + public static void Draw(int id, ref Vector2 pos, ref Rectangle s, Color c, float rot, ref Vector2 pivot, float scale) + { + Rectangle rectangle = SpriteSheet.src[id]; + rectangle.X += s.X; + rectangle.Y += s.Y; + rectangle.Width = s.Width; + rectangle.Height = s.Height; + Main.spriteBatch.Draw(SpriteSheet.tex, pos, new Rectangle?(rectangle), c, rot, pivot, scale, SpriteEffects.None, 0.0f); + } + + public static void Draw(int id, ref Vector2 pos, int sh, Color c, float rot, float scale = 1f) + { + Rectangle rectangle = SpriteSheet.src[id]; + rectangle.Height = sh; + Main.spriteBatch.Draw(SpriteSheet.tex, pos, new Rectangle?(rectangle), c, rot, new Vector2((float) (rectangle.Width >> 1), (float) (SpriteSheet.src[id].Height >> 1)), scale, SpriteEffects.None, 0.0f); + } + + public static void Draw(int id, ref Vector2 pos, int sh, Color c, SpriteEffects se) + { + Rectangle rectangle = SpriteSheet.src[id]; + rectangle.Height = sh; + Main.spriteBatch.Draw(SpriteSheet.tex, pos, new Rectangle?(rectangle), c, 0.0f, new Vector2(), 1f, se, 0.0f); + } + + public static void Draw(int id, ref Vector2 pos, Color c, float rot, ref Vector2 pivot, float scale) + { + Main.spriteBatch.Draw(SpriteSheet.tex, pos, new Rectangle?(SpriteSheet.src[id]), c, rot, pivot, scale, SpriteEffects.None, 0.0f); + } + + public static Vector2 GetCenterPivot(int id) + { + return new Vector2((float) (SpriteSheet.src[id].Width >> 1), (float) (SpriteSheet.src[id].Height >> 1)); + } + + public static int GetCenterPivotY(int id) + { + return SpriteSheet.src[id].Height >> 1; + } + } +} diff --git a/Terraria/Star.cs b/Terraria/Star.cs new file mode 100644 index 0000000..2d68837 --- /dev/null +++ b/Terraria/Star.cs @@ -0,0 +1,98 @@ +// Type: Terraria.Star +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework; + +namespace Terraria +{ + public struct Star + { + public static Star[] star = new Star[96]; + public const int maxStars = 96; + public const int maxStarTypes = 5; + public Vector2 position; + public float scale; + public float rotation; + public int type; + public float twinkle; + public float twinkleSpeed; + public float rotationSpeed; + + static Star() + { + } + + public static unsafe void SpawnStars() + { + fixed (Star* starPtr1 = &Star.star[0]) + { + Star* starPtr2 = starPtr1; + int num1 = 95; + while (num1 >= 0) + { + starPtr2->type = Main.rand.Next(5); + int index = starPtr2->type + 19; + int num2 = SpriteSheet<_sheetTiles>.src[index].Width; + int num3 = SpriteSheet<_sheetTiles>.src[index].Height; + int num4; + do + { + num4 = Main.rand.Next(960 - num2); + } + while ((num4 < 48 || num4 > 912) && Main.rand.Next(4) != 0); + starPtr2->position.X = (float) (num4 + (num2 >> 1)); + int num5; + do + { + num5 = Main.rand.Next(540 - num3); + } + while ((num5 < 27 || num5 > 513) && Main.rand.Next(4) != 0); + starPtr2->position.Y = (float) (num5 + (num3 >> 1)); + starPtr2->scale = (float) Main.rand.Next(50, 120) * 0.01f; + starPtr2->rotation = (float) Main.rand.Next(628) * 0.01f; + starPtr2->twinkle = (float) Main.rand.Next(101) * 0.01f; + starPtr2->twinkleSpeed = (float) Main.rand.Next(40, 100) * 0.0001f; + if (Main.rand.Next(2) == 0) + starPtr2->twinkleSpeed *= -1f; + starPtr2->rotationSpeed = (float) Main.rand.Next(10, 40) * 0.0001f; + if (Main.rand.Next(2) == 0) + starPtr2->rotationSpeed *= -1f; + --num1; + ++starPtr2; + } + } + } + + public static unsafe void UpdateStars() + { + fixed (Star* starPtr1 = &Star.star[0]) + { + Star* starPtr2 = starPtr1; + int num = 95; + while (num >= 0) + { + starPtr2->twinkle += starPtr2->twinkleSpeed; + if ((double) starPtr2->twinkle > 1.0) + { + starPtr2->twinkle = 1f; + starPtr2->twinkleSpeed *= -1f; + } + else if ((double) starPtr2->twinkle < 0.5) + { + starPtr2->twinkle = 0.5f; + starPtr2->twinkleSpeed *= -1f; + } + starPtr2->rotation += starPtr2->rotationSpeed; + if ((double) starPtr2->rotation > 6.28000020980835) + starPtr2->rotation -= 6.28f; + else if ((double) starPtr2->rotation < 0.0) + starPtr2->rotation += 6.28f; + --num; + ++starPtr2; + } + } + } + } +} diff --git a/Terraria/StatisticEntry.cs b/Terraria/StatisticEntry.cs new file mode 100644 index 0000000..09f6f13 --- /dev/null +++ b/Terraria/StatisticEntry.cs @@ -0,0 +1,63 @@ +// Type: Terraria.StatisticEntry +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +namespace Terraria +{ + public enum StatisticEntry + { + Unknown = -1, + BabySlime = 0, + BlackSlime = 1, + BlueSlime = 2, + DungeonSlime = 3, + GreenSlime = 4, + JungleSlime = 5, + LavaSlime = 6, + MotherSlime = 7, + Pinky = 8, + PurpleSlime = 9, + RedSlime = 10, + YellowSlime = 11, + CorruptSlime = 12, + IlluminantSlime = 13, + Slimer = 14, + Slimeling = 15, + ToxicSludge = 16, + ShadowSlime = 17, + KingSlime = 18, + EyeOfCthulhu = 19, + EaterOfWorlds = 20, + Skeletron = 21, + WallOfFlesh = 22, + TheTwins = 23, + TheDestroyer = 24, + SkeletronPrime = 25, + Ocram = 26, + AirTravel = 27, + GroundTravel = 28, + WaterTravel = 29, + LavaTravel = 30, + Ore = 31, + Gems = 32, + Soils = 33, + Wood = 34, + FurnitureCrafted = 35, + ToolsCrafted = 36, + WeaponsCrafted = 37, + ArmorCrafted = 38, + ConsumablesCrafted = 39, + MiscCrafted = 40, + PotionsDrank = 41, + LighstPlaced = 42, + AmmoShot = 43, + SeedsPlanted = 44, + KeysUsed = 45, + Drowned = 46, + Fallen = 47, + Buried = 48, + LavaBurned = 49, + NumEntries = 50, + } +} diff --git a/Terraria/Statistics.cs b/Terraria/Statistics.cs new file mode 100644 index 0000000..8cc7075 --- /dev/null +++ b/Terraria/Statistics.cs @@ -0,0 +1,262 @@ +// Type: Terraria.Statistics +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using System; +using System.Collections; + +namespace Terraria +{ + public class Statistics + { + private const int FirstNonSlimeIndex = 19; + private const int FirstBossIndex = 18; + private const int LastBossIndex = 26; + public bool AllSlimeTypesKilled; + public bool AllBossesKilled; + private BitArray SlimesKilled; + private BitArray BossesKilled; + private uint[] Counters; + + public uint this[StatisticEntry stat] + { + get + { + return this.Counters[(int) stat]; + } + } + + public Statistics(BitArray slimesKilled, BitArray bossesKilled, uint[] counters) + { + this.SlimesKilled = slimesKilled; + this.BossesKilled = bossesKilled; + this.Counters = counters; + this.UpdateAllSlimesKilled(); + this.UpdateAllBossesKilled(); + } + + public static StatisticEntry GetStatisticEntryFromNetID(short netID) + { + StatisticEntry statisticEntry = StatisticEntry.Unknown; + switch (netID) + { + case (short) 138: + statisticEntry = StatisticEntry.IlluminantSlime; + break; + case (short) 141: + statisticEntry = StatisticEntry.ToxicSludge; + break; + case (short) 150: + statisticEntry = StatisticEntry.ShadowSlime; + break; + case (short) 81: + statisticEntry = StatisticEntry.CorruptSlime; + break; + case (short) 121: + statisticEntry = StatisticEntry.Slimer; + break; + case (short) 59: + statisticEntry = StatisticEntry.LavaSlime; + break; + case (short) 71: + statisticEntry = StatisticEntry.DungeonSlime; + break; + case (short) -18: + statisticEntry = StatisticEntry.Slimeling; + break; + case (short) -10: + statisticEntry = StatisticEntry.JungleSlime; + break; + case (short) -9: + statisticEntry = StatisticEntry.YellowSlime; + break; + case (short) -8: + statisticEntry = StatisticEntry.RedSlime; + break; + case (short) -7: + statisticEntry = StatisticEntry.PurpleSlime; + break; + case (short) -6: + statisticEntry = StatisticEntry.BlackSlime; + break; + case (short) -5: + statisticEntry = StatisticEntry.BabySlime; + break; + case (short) -4: + statisticEntry = StatisticEntry.Pinky; + break; + case (short) -3: + statisticEntry = StatisticEntry.GreenSlime; + break; + case (short) -2: + statisticEntry = StatisticEntry.Slimer; + break; + case (short) -1: + statisticEntry = StatisticEntry.Slimeling; + break; + case (short) 1: + statisticEntry = StatisticEntry.BlueSlime; + break; + case (short) 16: + statisticEntry = StatisticEntry.MotherSlime; + break; + } + return statisticEntry; + } + + public static StatisticEntry GetBossStatisticEntryFromNetID(short netID) + { + StatisticEntry statisticEntry = StatisticEntry.Unknown; + switch (netID) + { + case (short) 134: + statisticEntry = StatisticEntry.TheDestroyer; + break; + case (short) 166: + statisticEntry = StatisticEntry.Ocram; + break; + case (short) 113: + statisticEntry = StatisticEntry.WallOfFlesh; + break; + case (short) 125: + case (short) 126: + statisticEntry = StatisticEntry.TheTwins; + break; + case (short) sbyte.MaxValue: + statisticEntry = StatisticEntry.SkeletronPrime; + break; + case (short) 35: + statisticEntry = StatisticEntry.Skeletron; + break; + case (short) 50: + statisticEntry = StatisticEntry.KingSlime; + break; + case (short) 4: + statisticEntry = StatisticEntry.EyeOfCthulhu; + break; + case (short) 13: + case (short) 14: + case (short) 15: + statisticEntry = StatisticEntry.EaterOfWorlds; + break; + } + return statisticEntry; + } + + public static Statistics Create() + { + return new Statistics(new BitArray(19), new BitArray(9), new uint[50]); + } + + private void UpdateAllSlimesKilled() + { + this.AllSlimeTypesKilled = true; + for (int index = 0; index < this.SlimesKilled.Count; ++index) + { + Statistics statistics = this; + int num = statistics.AllSlimeTypesKilled & this.SlimesKilled[index] ? 1 : 0; + statistics.AllSlimeTypesKilled = num != 0; + } + } + + private void UpdateAllBossesKilled() + { + this.AllBossesKilled = true; + for (int index = 0; index < this.BossesKilled.Count; ++index) + { + Statistics statistics = this; + int num = statistics.AllBossesKilled & this.BossesKilled[index] ? 1 : 0; + statistics.AllBossesKilled = num != 0; + } + } + + public void incStat(StatisticEntry entry) + { + if (entry == StatisticEntry.Unknown) + return; + int index = (int) entry; + if (index < 19) + { + this.SlimesKilled.Set(index, true); + this.UpdateAllSlimesKilled(); + } + if (index < 27 && index >= 18) + { + this.BossesKilled.Set(index - 18, true); + this.UpdateAllBossesKilled(); + } + ++this.Counters[index]; + } + + public void incWoodStat(uint count) + { + this.Counters[34] += count; + } + + private uint CreateChecksum(uint[] array) + { + uint num1 = 0U; + foreach (uint num2 in this.Counters) + num1 ^= num2; + return num1; + } + + public byte[] Serialize() + { + uint checksum = this.CreateChecksum(this.Counters); + int count = 4; + int num = Buffer.ByteLength((Array) this.Counters); + byte[] numArray = new byte[num + count]; + Buffer.BlockCopy((Array) this.Counters, 0, (Array) numArray, 0, num); + Buffer.BlockCopy((Array) new uint[1] + { + checksum + }, 0, (Array) numArray, num, count); + return numArray; + } + + public void Deserialize(byte[] stream) + { + if (stream.Length == 0) + { + Array.Clear((Array) this.Counters, 0, this.Counters.Length); + } + else + { + int count = 4; + int num = stream.Length - count; + Buffer.BlockCopy((Array) stream, 0, (Array) this.Counters, 0, num); + uint[] numArray = new uint[1]; + Buffer.BlockCopy((Array) stream, num, (Array) numArray, 0, count); + if ((int) this.CreateChecksum(this.Counters) != (int) numArray[0]) + Array.Clear((Array) this.Counters, 0, this.Counters.Length); + for (int index = 0; index < this.Counters.Length; ++index) + { + bool flag = this.Counters[index] > 0U; + if (index < 19 && flag) + this.SlimesKilled.Set(index, true); + if (index < 27 && index >= 18 && flag) + this.BossesKilled.Set(index - 18, true); + } + this.UpdateAllSlimesKilled(); + this.UpdateAllBossesKilled(); + } + } + + public static int CalculateSerialisationSize() + { + return 204; + } + + public void Init() + { + this.AllSlimeTypesKilled = false; + this.AllBossesKilled = false; + this.SlimesKilled.SetAll(false); + this.BossesKilled.SetAll(false); + for (int index = 49; index >= 0; --index) + this.Counters[index] = 0U; + } + } +} diff --git a/Terraria/TextSequenceBlock.cs b/Terraria/TextSequenceBlock.cs new file mode 100644 index 0000000..59df778 --- /dev/null +++ b/Terraria/TextSequenceBlock.cs @@ -0,0 +1,501 @@ +// Type: Terraria.TextSequenceBlock +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria.HowToPlay; + +namespace Terraria +{ + public sealed class TextSequenceBlock + { + public static readonly string[] TIPS_EN = new string[78] + { + "You can change your spawn point by placing and using a bed.", + "If you find a Magic Mirror, you can use it to teleport back to your spawn point.", + "Torches require wood and gels to craft. Gels can be found on slimes.", + "When you explore caves, it helps to have wood platforms. Craft them out of wood.", + "Falling Stars sometimes appear at night. Collect 10 of them to craft a Mana Crystal you can use to increase your mana.", + "You can plant acorns to grow new trees.", + "Use the Housing section of the Inventory Menu to assign NPCs to rooms or to toggle NPC room flags.", + "You can check if a room is valid housing from the Housing section of the Inventory Menu.", + "If you get lost or need to find another player, open the World Map.", + "You can remove furniture or background walls by crafting a hammer.", + "There are floating islands in the sky.", + "Sometimes you can find NPCs hidden around the World.", + "During a Blood Moon, zombies can open doors.", + "You can continuously use some items by holding down " + (object) '\x0081' + ".", + "Water will break your fall.", + "Torches and glowsticks can be a light for you in dark places, when all other lights go out. Torches won't work underwater, but glowsticks will.", + "Don't fall into lava without an Obsidian Skin Potion!", + "You won't take falling damage if you have a Lucky Horseshoe. Look for them on floating islands.", + "Walking on Hellstone and Meteorite can burn you! Protect yourself by equipping an Obsidian Skull or similar accessory.", + "Life Crystals are hidden around the World. Use them to increase your health.", + "Some ores require better pickaxes to mine.", + "Bosses are easier to defeat with friends.", + "Press " + (object) '\x0085' + " to switch between Cursor Modes.", + "Bows and guns require the proper ammo in your Ammo slots.", + "If your Inventory is full, you can press " + (object) '\x008A' + " to send items to the Trash.", + "When speaking to a vendor, you can sell items in your Inventory by pressing " + (object) '\x008A' + ".", + "The Old Man at the Dungeon is a Clothier, if only someone could lift his curse...", + "Collect money to attract a Merchant to your house.", + "Hold onto an explosive to attract a Demolitionist to your house.", + "Make sure you have empty, valid rooms to attract new inhabitants.", + "Slay a boss to attract a Dryad to your house. She can tell you the state of Corruption and Hallow in your World.", + "Bind items to your " + (object) '\x0086' + " for quick access!", + "By default, " + (object) '\x008E' + " is an alternate jump button. Advanced players may wish to switch the grappling and alternate jump buttons; you can do this from the Controls Menu.", + "Wear a Mining Helmet if you don't want to use torches.", + "You can wear buckets!", + "You can remove torches with " + (object) '\x008D' + ".", + "Other players can loot your chests! If you don't trust them, use a safe or piggy bank; those items have storage that is exclusive to each player.", + "Defeat the boss in The Underworld to change the World forever. Find a Guide Voodoo Doll and hurl it into the infernal lava to summon him.", + "Demon Altars can't be destroyed with a normal hammer. You have to pwn them.", + "Killing bunnies is cruel. Period.", + "Explosives are dangerous!\n...and effective...", + "Watch out for falling Meteorites!", + "A pet can be your best friend.", + "If you dig deep enough, you'll end up in The Underworld!", + "Santa Claus is real. He comes to town after the Frost Legion is defeated (and 'tis the season).", + "Don't shake a snow globe unless you want to summon the Frost Legion.", + "In your Inventory, you can press " + (object) '\x008B' + " to equip items such as armor or accessories directly to a usable slot.", + "You can use Hallowed Seeds, Holy Water, or Pearlstone to make Hallowed ground.", + "The Hallow is the only place where Corruption cannot spread.", + "The Corruption is full of chasms. Mind the gaps.", + "Time heals all wounds.", + "Rocket science gave us Rocket Boots.", + "The Could in a Bottle and Shiny Red Balloon accessories both improve your ability jump. Combine them to make a Cloud in a Balloon.", + "Gungnir is the spear of the god Odin.", + "Excalibur is the legendary sword of King Arthur.", + "Adamantite comes from the Greek word 'adamastos', meaning 'untameable'", + "If you store your coins in a house, you'll be less likely to lose them.", + "If you find chests out in the World, you can remove them with a hammer to take them with you.", + "To craft potions, place a bottle on a table to make an alchemy station. Double, double, toil and trouble!", + "If your house doesn't have background walls, monsters will be able to spawn inside.", + "Monsters spawn more often in dark areas.", + "Wearing armor made out of all the same material gives you an extra bonus.", + "Build a furnace to craft metal bars out of ore.", + "You can harvest cobwebs and turn them into silk. You can use silk to craft vanity clothes or a bed.", + "You can buy wires from a Mechanic and use them to create traps, pumping systems, or other elaborate devices.", + "If you're sick of getting knocked around, try equipping a Cobalt Shield. You can find it in the Dungeon.", + "You can make a grappling hook out of iron chains and a hook. The easiest place to find a hook is on piranhas in a jungle.", + "A room in a house can have wood platforms as a floor or ceiling, but NPCs need at least one solid block to stand on.", + "You can destroy Shadow Orbs with a hammer or explosives, but prepare yourself for the forces they unleash.", + "The most powerful items require Souls to craft. You can only find them in Hard Mode.", + "When dealing with a Goblin Army, crowd control is key.", + "The best wizard people use Mana Flowers.", + "Use suspicious looking items at your own risk!", + "Sand is overpowered.", + "Swimming is dangerous without Flippers or a Diving Helmet! You can craft those with a Tinkerer's Workshop.", + "The Goblin Tinkerer found in underground caverns will sell you many useful items, including a Tinkerer's Workshop.", + "Seeds can be used to farm a variety of useful ingredients, especially for crafting potions.", + "Some projectiles such as arrows and shurikens can be gathered and reused after firing them." + }; + public static readonly string[] TIPS_DE = new string[78] + { + "Du kannst deinen Startpunkt ändern, indem du ein Bett platzierst und benutzt.", + "Wenn du einen Magischen Spiegel findest, kannst du dich damit zu deinem Startpunkt zurückteleportieren.", + "Um Fackeln herzustellen, benötigst du Holz und Glibber. Glibber können bei Schleimen gefunden werden.", + "Wenn du Höhlen erforschst, ist es hilfreich, Holzklappen zu haben. Stelle sie aus Holz her.", + "Gefallene Sterne erscheinen manchmal in der Nacht. Sammle zehn davon, um einen Manakristall herzustellen. Damit kannst du dein Mana erhöhen.", + "Du kannst Eicheln pflanzen, damit neue Bäume wachsen.", + "Du kannst die Unterkunft-Sektion des Inventars nutzen, um den Zimmern NPCs zuzuweisen oder zwischen den NPC-Raumflaggen zu wechseln.", + "In der Unterkunfts-Sektion des Inventarmenüs kannst du prüfen, ob ein Zimmer eine fertige Unterkunft ist.", + "Wenn du die Orientierung verlierst oder einen anderen Spieler finden willst, öffne die Weltkarte.", + "Du kannst Möbel und Hintergrundwände entfernen, indem du einen Hammer herstellst.", + "Es gibt schwebende Inseln in der Luft.", + "Manchmal kannst du versteckte NPCs finden, die in der Welt verstreut sind.", + "Während eines Blutmondes können Zombies die Türen öffnen.", + "Manche Gegenstände kannst du kontinuierlich benutzen, indem du " + (object) '\x0081' + " gedrückt hältst.", + "Wasser federt deinen Sturz ab.", + "Fackeln und Leuchtstäbe können dir Licht in der Dunkelheit spenden, wenn alle anderen Lichter versagen. Fackeln funktionieren nicht unter Wasser, aber Leuchtstäbe schon.", + "Falle nicht in die Lava, ohne einen Obsidianhaut-Trank!", + "Du erleidest keinen Fallschaden, wenn du ein Glückshufeisen hast. Suche nach ihnen auf den schwebenden Inseln.", + "Auf Höllensteinen und Meteoriten zu laufen, kann dich verbrennen! Schütze dich, indem du einen Obsidianschädel oder einen ähnlichen Gegenstand trägst.", + "Lebenskristalle sind überall in der Welt versteckt. Verwende sie, um deine Gesundheit zu verbessern.", + "Manche Erze können nur mit einer Spitzhacke abgebaut werden.", + "Bosse sind mit der Hilfe von Freunden leichter zu besiegen.", + "Drücke " + (object) '\x0085' + " , um zwischen den Cursor Modi zu wechseln.", + "Bögen und Pistolen benötigen die richtige Munition in deinen Ammo-Slots.", + "Wenn dein Inventar voll ist, kannst du durch Drücken von " + (object) '\x008A' + " einen Gegenstand in den Müll werfen.", + "Wenn du mit einem Verkäufer sprichst, kannst du Gegenstände in deinem Inventar verkaufen, indem du " + (object) '\x008A' + " drückst.", + "Der Greis beim Verlies ist ein Schneider. Wenn nur jemand seinen Fluch aufheben könnte ...", + "Sammle Geld, um einen Händler zu deinem Haus zu locken.", + "Behalte einen Sprengsatz, um einen Sprengstoffexperte zu deinem Haus zu locken.", + "Stelle sicher, dass du leere, fertige Räume hast, bevor du neue Bewohner anziehst.", + "Töte einen Boss, um eine Dryade zu deinem Haus zu locken. Sie kann dir sagen, wie Heilig oder Verdorben deine Welt ist.", + "Lege für einen schnelleren Zugriff Gegenstände auf dein " + (object) '\x0086' + " !", + "Standardmäßig ist " + (object) '\x008E' + " ein alternativer Knopf zum Springen. Fortgeschrittene Spieler möchten vielleicht die Knöpfe für Festhaken und Springen austauschen. Dies ist im Steuerungsmenü möglich.", + "Trage einen Minenhelm, wenn du keine Fackeln benutzen möchtest.", + "Du kannst Eimer tragen!", + "Du kannst Fackeln mit " + (object) '\x008D' + " entfernen.", + "Andere Spieler können deine Schatzkisten plündern! Wenn du ihnen nicht traust, benutze einen Tresor oder ein Sparschwein. Auf diese Lagergegenstände hat nur der jeweilige Besitzer Zugriff.", + "Besiege den Boss in der Unterwelt, um die Welt für immer zu verändern. Finde eine Guide Voodoo Puppe und wirf sie in die höllische Lava, um ihn herbeizurufen.", + "Dämonenaltare können nicht mit einem normalen Hammer zerstört werden. Du musst sie vernichtend besiegen.", + "Häschen zu töten ist grausam. Punkt.", + "Sprengstoffe sind gefährlich!\n ... und effektiv ... ", + "Pass auf die herabfallenden Meteoriten auf!", + "Ein Haustier kann dein bester Freund sein.", + "Wenn du tief genug gräbst, landest du in der Unterwelt!", + "Der Weihnachtsmann ist echt. Er kommt in die Stadt, nachdem die Frost Legion besiegt ist (und wenn es weihnachtet).", + "Schüttle niemals eine Schneekugel, es sei denn, du willst die Frost Legion herbeirufen.", + "In deinem Inventar kannst du " + (object) '\x008B' + " drücken, um Gegenstände wie Rüstung und Zubehör direkt einem offenen Slot zuzuweisen.", + "Du kannst Heilige Saat, Heiliges Wasser oder Perlstein benutzen, um gesegneten Boden herzustellen.", + "Das Heiligtum ist der einzige Platz, wo sich die Verderbtheit nicht ausbreiten kann.", + "Die Verderbtheit ist voller Abgründe. Pass auf die Spalten auf.", + "Die Zeit heilt alle Wunden.", + "Die Raketentechnik hat uns Raketenstiefel gebracht.", + "Die Zubehörgegenstände Wolke in einer Flasche und Glitzender Roter Ballon können beide deine Sprungkraft verbessern. Kombiniere sie, um eine Wolke in einem Ballon zu schaffen.", + "Gungnir ist der Speer des Gottes Odin.", + "Excalibur ist das legendäre Schwert des König Artus.", + "Adamantit kommt vom griechischen Wort Adamastos, was unzähmbar bedeutet.", + "Wenn du deine Münzen in einem Haus lagerst, läufst du weniger Gefahr, sie zu verlieren.", + "Wenn du in der Welt Kisten findest, kannst du sie mit einem Hammer loslösen und mitnehmen.", + "Um Tränke herzustellen, platziere eine Flasche auf einem Tisch, um eine Alchemiestation zu schaffen. Doppelt plagt euch, mengt und mischt!", + "Wenn dein Haus keine Hintergrundwände hat, können Monster darin erscheinen.", + "Monster erscheinen oft in dunklen Gebieten.", + "Wenn du ein komplettes Rüstungs-Set aus demselben Material trägst, erhältst du einen Extra-Bonus.", + "Baue einen Schmelzofen, um aus Erz Metallbarren herzustellen.", + "Du kannst Spinnweben sammeln und sie zu Seide verarbeiten. Du kannst aus Seide Zierklamotten oder ein Bett herstellen.", + "Du kannst Kabel von einem Mechaniker kaufen und aus ihnen Fallen, Pumpensysteme oder andere ausgeklügelte Geräte herstellen.", + "Wenn du nicht mehr weggestoßen werden willst, versuche einen Kobaltschild zu tragen. Du kannst ihn im Verlies finden.", + "Du kannst einen Greifhaken aus Eisenketten und einem Haken herstellen. Am leichtesten findest du einen Haken bei den Piranhas in einem Dschungel.", + "Ein Zimmer in einem Haus kann Holzklappen als Fußboden oder Decke haben, aber NPCs benötigen zumindest einen festen Block, auf dem sie stehen können.", + "Du kannst Schattenkugeln mit einem Hammer oder Sprengstoff zerstören, aber bereite dich auf die Kräfte vor, die sie entfesseln.", + "Die mächtigsten Gegenstände benötigen Seelen zur Herstellung. Du kannst sie nur im Schweren Modus finden.", + "Wenn du es mit einer Goblin Armee zu tun hast, ist die Kontrolle der Menge der Schlüssel zum Erfolg.", + "Die besten Magier verwenden Manablumen.", + "Benutze verdächtig aussehende Gegenstände auf eigenes Risiko!", + "Sand ist überwältigt.", + "Schwimmen ist gefährlich ohne Flossen oder einen Taucherhelm! Du kannst sie in der Tüftler-Werkstatt herstellen.", + "Der Goblin Tüftler kann in unterirdischen Höhlen gefunden werden und wird dir viele nützliche Gegenstände verkaufen, wie etwa eine Tüftler-Werkstatt.", + "Samen können benutzt werden, um eine Vielzahl nützlicher Bestandteile anzubauen, besonders zur Herstellung von Tränken.", + "Manche Geschosse, wie etwa Pfeile und Shuriken, können gesammelt und wiederverwendet werden, nachdem sie abgefeuert wurden." + }; + public static readonly string[] TIPS_IT = new string[78] + { + "Modifica il punto di rigenerazione posizionando e utilizzando il letto.", + "Se trovi uno Specchio Magico, usalo per teletrasportarti al punto di rigenerazione.", + "Per creare le torce è necessario avere la legna e gelatine. Le gelatine si trovano sugli Slime.", + "Quando esplori le caverne, è utile avere delle piattaforme di legno. Creale utilizzando la legna!", + "Di sera a volte si vedono le Stelle cadenti . Raccogline 10 per creare un Cristallo di Mana da utilizzare per aumentare il tuo livello di mana.", + "È possibile piantare ghiande per far crescere nuovi alberi.", + "Utilizza la sezione Alloggio del menu Inventario per assegnare una stanza a un PNG o per attivare le bandiere della stanza del PNG.", + "È possibile controllare la validità dell'alloggio nella sezione Alloggio del menu Inventario.", + "Apri la Mappa del Mondo se ti perdi o devi trovare un altro giocatore.", + "Creando un martello è possibile rimuovere mobili o muri sullo sfondo.", + "Ci sono isole fluttuanti nel cielo.", + "A volte è possibile trovare PNG nascosti nel Mondo.", + "Quando c'è la Luna di Sangue, gli zombie possono aprire le porte.", + "Tenendo premuto " + (object) '\x0081' + " è possibile utilizzare continuamente alcuni oggetti.", + "L'acqua attutirà la caduta.", + "Le torce e i bastoni luminosi possono essere una fonte di illuminazione, quando sei in posti bui e non sono disponibili altre fonti di illuminazione. Le torce non funzionano sott'acqua, mentre i bastoni luminosi funzionano.", + "Non cadere nella lava senza avere la Pozione Pelle d'Ossidiana!", + "Se possiedi il Ferro di Cavallo Fortunato non ti farai male quando cadi. Cercali sulle isole fluttuanti.", + "Puoi bruciarti se cammini sul Meteorite o sulla Pietra Infernale! Equipaggiati di un Teschio d'Ossidiana o di un accessorio simile per proteggerti.", + "I Cristalli di Vita sono nascosti nel Mondo. Utilizzali per aumentare il tuo livello di vita.", + "È necessario utilizzare picconi migliori per estrarre alcuni minerali.", + "I boss sono più facili da sconfiggere con gli amici.", + "Premi " + (object) '\x0085' + " per cambiare la modalità Cursore.", + "Archi e pistole richiedono apposite munizioni che troverai nelle sezioni per le munizioni.", + "Quando l'Inventario è pieno, è possibile spostare gli oggetti nel Cestino, premendo " + (object) '\x008A' + ".", + "Mentre parli con il venditore, è possibile vendere gli oggetti presenti nel tuo Inventario, premendo " + (object) '\x008A' + ".", + "Il Vecchio nella Dungeon è un Mercante di stoffe... Se solo qualcuno potesse annullarne la maledizione...", + "Raccogli le monete per attirare un Mercante nella tua abitazione.", + "Afferra un esplosivo per attirare un Esperto di demolizioni nella tua abitazione.", + "Assicurati di avere stanze valide e vuote per attirare nuovi abitanti.", + "Uccidi un boss per attirare una Driade nella tua abitazione. Ti può rivelare lo stato di Corruzione e Consacrazione del tuo Mondo.", + "Per un accesso rapido, configura gli oggetti con " + (object) '\x0086' + ".", + "Per impostazione predefinita, " + (object) '\x008E' + " è un pulsante alternativo per saltare. I giocatori più esperti possono cambiare la modalità di lotta e alternare i pulsanti per saltare. È possibile eseguire questa azione dal menu Comandi.", + "Se non vuoi utilizzare le torce, indossa un Casco da minatore.", + "Puoi utilizzare i secchi!", + "È possibile rimuovere le torce con " + (object) '\x008D' + ".", + "Gli altri giocatori possono saccheggiare le tue casse! Se non ti fidi, utilizza una cassaforte o un salvadanaio. Questi sono portaoggetti accessibili solo al singolo giocatore.", + "Sconfiggi il boss degli Inferi per cambiare per sempre il Mondo. Trova la Bambola Voodoo della Guida e lanciala nella lava infernale per evocarla.", + "Gli Altari dei Demoni non possono essere distrutti con un martello normale. Li devi sconfiggere!", + "È spietato uccidere i conigli, punto e basta!", + "Gli esplosivi sono pericolosi!\n...Ed efficaci...", + "Fai attenzione ai Meteoriti!", + "Un animale domestico può essere il tuo migliore amico.", + "Se scavi in profondità, finirai negliInferi!", + "Babbo Natale esiste! Arriva dopo aver sconfitto la Legione del Gelo (ed è Natale!).", + "Non scuotere una sfera di neve a meno che tu non voglia evocare la Legione del Gelo.", + "È possibile premere " + (object) '\x008B' + " nell'Inventario, per equipaggiarsi di un'armatura o un accessorio direttamente da una sezione disponibile", + "È possibile utilizzare i Semi Consacrati, l'Acqua Santa o la Pietra di Perla per preparare un terreno consacrato.", + "La Consacrazione è l'unico bioma nel quale non si espande la Corruzione.", + "La Corruzione è piena di voragini. Fai attenzione!", + "Il tempo guarisce tutte le ferite.", + "La scienza missilistica ci ha donato gli Stivali razzo.", + "La Nuvola in Bottiglia e il Palloncino Rosso Brillante migliorano la tua capacità di saltare. Uniscili per creare una Nuvola in un Palloncino.", + "Gungnir è la lancia del dio Odino", + "Excalibur è la leggendaria spada di Re Artù.", + "Adamantite deriva dal greco 'adamastos', che significa 'indomabile'", + "Se conservi le monete nella tua abitazione, è meno probabile che le perda.", + "Se trovi le casse nel Mondo, potrai rimuoverle con un martello per portarle con te.", + "Per creare delle pozioni, posiziona una bottiglia su un tavolo per avere una postazione alchemica. Abracadabra!", + "I mostri possono rigenerarsi all'interno della tua abitazione, se non si dispone di muri sullo sfondo.", + "I mostri si rigenerano più spesso nelle aree buie.", + "Indossare un'armatura creata dallo stesso materiale ti dà un bonus extra.", + "Costruisci una fornace per creare le barre di metallo dal ferro.", + "È possibile raccogliere ragnatele e trasformarle in seta. È possibile utilizzare la seta per creare un letto o dei vestiti,", + "È possibile acquistare cavi presso un Meccanico e utilizzarli per creare trappole, sistemi di pompaggio o altri dispositivi sofisticati.", + "Se sei stufo di essere assalito, prova ad equipaggiarti di uno Scudo di Cobalto. Lo puoi trovare nel Dungeon.", + "È possibile creare un rampino con delle catene di ferro e un amo. È più facile trovare un amo nella giungla, agganciato ai piranha.", + "All'interno dell'abitazione, una stanza può avere piattaforme di legno come pavimento o soffitto, ma i PNG richiedono almeno un blocco solido su cui reggersi.", + "È possibile distruggere Le Sfere d'Ombra con un martello o degli esplosivi... ma preparati alle forze che sprigioneranno.", + "Per creare gli oggetti più potenti è necessario utilizzare le Anime. È possibile trovarle solo nella modalità Difficile.", + "Quando affronti l'Esercito dei Goblin è importante tenere a bada la folla.", + "I miglior stregoni utilizzano i Fiori di Mana.", + "Utilizza gli oggetti per lanciare sguardi sospetti a tuo rischio e pericolo!", + "La sabbia è stata conquistata.", + "È pericoloso nuotare senza le Pinne o il Casco da Sommozzatore! Li puoi creare utilizzando il Laboratorio dell'Inventore.", + "Il Goblin Riparatore, trovato nelle caverne sotterranee, ti venderà molti oggetti utili, tra cui il Laboratorio dell'Inventore.", + "I semi possono essere utilizzati per coltivare una varietà di ingredienti utili, soprattutto per creare pozioni.", + "Alcuni proiettili, come le frecce e gli shuriken, possono essere raccolti e riutilizzati dopo l'uso." + }; + public static readonly string[] TIPS_FR = new string[78] + { + "Vous pouvez modifier votre point d'apparition en plaçant un lit et en l'utilisant.", + "Si vous trouvez un miroir magique, vous pouvez l'utiliser pour vous téléporter à votre point d'apparition.", + "Il faut du bois et du gel pour fabriquer les torches. Le gel se trouve sur les slimes.", + "Les plateformes en bois sont utiles lorsque vous explorez des grottes. Fabriquez-les avec du bois.", + "Certaines nuits, des étoiles filantes apparaissent. Collectez-en 10 pour fabriquer un cristal mana qui peut vous servir à augmenter votre mana.", + "Vous pouvez planter des glands pour faire pousser des arbres.", + "Utilisez la section Logement du menu Inventaire pour attribuer les PNJ aux chambres ou pour alterner les drapeaux des chambres de PNJ.", + "Vous pouvez vérifier si une chambre est valide dans la section Logement du menu Inventaire.", + "Si vous vous perdez ou que vous avez besoin de trouver un autre joueur, ouvrez la Carte du monde.", + "Vous pouvez supprimer un meuble ou un mur du fond en fabriquant un marteau.", + "Il y a des îles flottantes dans le ciel.", + "Vous pouvez parfois trouver des PNJ cachés dans le monde.", + "Pendant une lune sanglante, les zombies peuvent ouvrir les portes.", + "Vous pouvez utiliser certains objets en continu en maintenant " + (object) '\x0081' + ".", + "L'eau arrêtera votre chute.", + "Les torches et bâtons lumineux peuvent vous donner de la lumière dans les endroits sombres sans sources lumineuses. Les torches ne fonctionneront pas sous l'eau, contrairement aux bâtons lumineux.", + "Ne tombez pas dans la lave sans une potion de peau d'obsidienne !", + "Vous ne subirez aucun dégât de chute si vous avez un fer à cheval porte-bonheur. Cherchez-les sur les îles flottantes.", + "Vous pouvez brûler en marchant sur les pierres de l'enfer et les météorites ! Protégez-vous en vous équipant d'un crâne d'obsidienne ou d'un accessoire similaire.", + "Des cristaux de vie sont dissimulés dans le monde. Utilisez-les pour augmenter votre santé.", + "L'extraction de certains minerais nécessite une pioche plus solide.", + "Les boss sont plus faciles à vaincre avec l'aide d'amis.", + "Appuyez sur " + (object) '\x0085' + " pour changer le mode curseur.", + "Il vous faut des munitions dans vos emplacements Munitions pour vos arcs et armes à feu.", + "Si votre inventaire est plein, vous pouvez mettre des objets à la poubelle en appuyant sur " + (object) '\x008A' + ".", + "Lorsque vous parlez à un vendeur, vous pouvez vendre les objets de votre inventaire en appuyant sur " + (object) '\x008A' + ".", + "Le vieil homme du donjon est un tailleur ; si seulement quelqu'un pouvait le libérer de sa malédiction...", + "Collectez de l'argent pour attirer un marchand chez vous.", + "Gardez un explosif pour attirer un démolisseur chez vous.", + "Veillez à avoir des chambres libres et valides pour attirer de nouveaux habitants.", + "Éliminez un boss pour attirer une dryade chez vous. Elle peut vous donner l'état de Corruption et de Sainteté dans votre monde.", + "Installez des objets sur votre " + (object) '\x0086' + " pour un accès rapide !", + "Par défaut, " + (object) '\x008E' + " est une alternative au bouton de saut. Les joueurs expérimentés souhaiteront peut-être changer le grappin et alterner les boutons de saut ; ceci est possible depuis le menu Commandes.", + "Portez un casque de mineur si vous ne voulez pas utiliser de torches.", + "Vous pouvez même porter des seaux vides !", + "Vous pouvez supprimer des torches avec " + (object) '\x008D' + ".", + "Les autres joueurs peuvent également piller vos coffres ! Si vous ne leur faites pas confiance, utilisez un coffre-fort ou une tirelire, ces objets offrent un stockage exclusif pour chaque joueur.", + "Vainquez le boss du monde des Enfers pour changer le monde pour toujours. Trouvez une poupée vaudou du guide et jetez-la dans la lave infernale pour le faire venir.", + "Vous pouvez détruire les autels du démon avec une marteau normal. Vous devez les briser.", + "Tuer des lapins est un acte de cruauté. Point barre.", + "Les explosifs sont dangereux !\n... Et efficaces...", + "Faites attention aux chutes de météorites !", + "Un animal de compagnie peut devenir votre meilleur ami.", + "Si vous creuser assez profondément, vous arriverez au monde des Enfers !", + "le père Noël existe. Il arrive en ville une fois que la Légion gel est vaincue (et c'est de saison).", + "Ne secouez pas un globe de neige si vous ne voulez pas faire venir la Légion gel.", + "Dans votre inventaire, vous pouvez appuyer sur " + (object) '\x008B' + " pour équiper les objets tels que les armures ou les accessoires dans des emplacements permettant une utilisation directe.", + "Vous pouvez utiliser des graines sanctifiées, de l'eau bénite ou des pierres de perle pour créer une terre sanctifiée.", + "La Sainteté est le seul endroit où la Corruption ne peut pas s'étendre.", + "La Corruption est pleine d'abîmes. Attention aux trous.", + "Le temps guérit toutes les blessures.", + "La fuséologie nous a donné les bottes-fusées.", + "Les accessoires nuage en bouteille et ballon rouge brillant permettent d'améliorer votre capacité de saut. Combinez-les pour créer un nuage dans un ballon.", + "Gungnir est la lance du dieu Odin.", + "Excalibur est l'épée légendaire du Roi Arthur.", + "Adamantite vient du grec  'adamastos', qui signifie 'indomptable'", + "Si vous stockez vos pièces dans une maison, vous aurez moins de chance de les perdre.", + "Si vous trouvez des coffres dans le monde, vous pouvez les prendre à l'aide de votre marteau et les emmener avec vous.", + "Fabriquez des potions en plaçant une bouteille sur une table pour créer une station d'alchimie. Double, double, peine et trouble !", + "Les monstres pourront apparaître dans votre maison si celle-ci n'a pas de mur du fond.", + "Les monstres apparaissent plus souvent dans les zones sombres.", + "Porter une armure assortie du même matériel vous donne un bonus.", + "Construisez une fournaise pour fabriquer des lingots de métal à partir de minerai.", + "Vous pouvez récolter des toiles d'araignée et en faire de la soie. Vous pouvez utiliser la soie pour fabriquer des vêtements de vanité ou un lit.", + "Vous pouvez acheter des câbles à un mécanicien et les utiliser pour créer des pièges, des systèmes de pompage et autres dispositifs élaborés.", + "Si vous en avez assez de prendre des coups, essayez d'équiper le bouclier de cobalt. Vous pouvez le trouver dans le donjon.", + "Vous pouvez fabriquer un grappin avec des chaînes de fer et un crochet. Le meilleur endroit pour trouver un crochet, c'est sur les piranhas dans la jungle.", + "Une chambre dans une maison peut avoir un plafond et un plancher faits de plateformes en bois, mais les PNJ ont besoin d'un bloc solide sur lequel se tenir.", + "Vous pouvez détruire les orbes d'ombre avec un marteau ou des explosifs, mais préparez-vous pour les forces qu'elles libèrent.", + "Des âmes seront nécessaires pour fabriquer les objets les plus puissants. Vous les trouverez seulement en mode difficile.", + "Lorsque vous vous occupez d'une armée de gobelins, l'important c'est le contrôle de la foule.", + "Les meilleurs sorciers utilisent des fleurs de mana.", + "Utilisez les objets d'apparence douteuse à vos risques et périls !'", + "Le sable est maîtrisé.", + "Il est dangereux de nager sans palmes ni casque de plongée ! Vous pouvez fabriquer ceux-ci à l'aide d'un atelier de bricoleur.", + "Le gobelin bricoleur rencontré dans les grottes souterraines vous vendra des objets utiles, notamment, un atelier de bricoleur.", + "Vous pouvez utiliser les graines pour cultiver une variété d'ingrédients utiles, et en particulier pour concocter des potions.", + "Certains projectiles tels que les flèches ou shurikens peuvent être récupérés et réutilisés." + }; + public static readonly string[] TIPS_ES = new string[78] + { + "Puedes cambiar el punto de resurrección colocando y usando una cama.", + "Si encuentras un espejo mágico, puedes usarlo para teletransportarte al punto de resurrección.", + "Para fabricar antorchas se necesita madera y gel. El gel se puede obtener de los slimes.", + "Las plataformas de madera son muy útiles a la hora de explorar cuevas. Puedes construirlas con madera.", + "Las estrellas fugaces a veces aparecen de noche. Consigue 10 de ellas para crear un cristal de manáque podrás usar para aumentar el maná.", + "Puedes plantar bellotas para hacer crecer árboles.", + "Usa la sección Cobijo del menú del Inventario para asignar habitaciones a los PNJ o cambiar las banderas de las habitaciones de los PNJ.", + "Puedes comprobar si una habitación es válida en la sección Cobijo del menú del Inventario.", + "Si te pierdes o necesitas encontrar a otro jugador, abre el Mapamundi.", + "Puedes eliminar los muebles o los muros fabricando un martillo.", + "En el cielo hay islas flotantes.", + "A veces puedes encontrar PNJ escondidos por el mundo.", + "Durante una luna de sangre, los zombies pueden abrir puertas.", + "Puedes usar continuamente varios objetos manteniendo presionado " + (object) '\x0081' + ".", + "El agua detendrá tu caída.", + "Las antorchas y las varitas luminosas se pueden usar como iluminación en sitios oscuros, si no hay otras fuentes de luz. Las antorchas no funcionan bajo el agua, pero las varitas luminosas sí.", + "¡No te caigas en la lava sin la poción de piel obsidiana!", + "No sufrirás ningún daño al caerte si tienes una herradura de la suerte. Búscalas en las islas flotantes.", + "¡Caminar sobre piedras del infierno y meteoritos puede hacer que te quemes! Protégete equipándote con una calavera de obsidiana o un accesorio similar.", + "Los cristales de vida están escondidos por el mundo. Úsalos para aumentar la salud.", + "Algunos minerales precisan picos de mejor calidad para ser extraídos.", + "Es más fácil derrotar a los enemigos finales con la ayuda de tus amigos.", + "Pulsa " + (object) '\x0085' + " para cambiar el modo de cursor.", + "Los arcos y armas necesitan que coloques la munición adecuada en las ranuras de munición.", + "Si tienes el inventario lleno, puedes pulsar " + (object) '\x008A' + " para enviar objetos a la basura.", + "Cuando hables con un comerciante, puedes venderle objetos de tu inventario pulsando " + (object) '\x008A' + ".", + "El anciano de la mazmorra es un sastre. Si alguien pudiese librarlo de su maldición...", + "Consigue dinero para atraer a un comerciante a tu casa.", + "Agárrate a un explosivo para atraer a demoledores a tu casa.", + "Asegúrate de que tienes habitaciones vacías válidas para atraer a nuevos inquilinos.", + "Descuartiza a un enemigo final para atraer a una dríade a tu casa. Ella te podrá informar de si tu mundo está volviéndose corrompido o sagrado.", + "¡Enlaza objetos al " + (object) '\x0086' + " para acceder a ellos rápidamente!", + "Por defecto, " + (object) '\x008E' + " es el botón de salto alternativo. Puede que los jugadores más experimentados prefieran cambiar los botones de agarre y salto alternativo. Esto se puede hacer desde el menú Controles.", + "Si no quieres usar antorchas puedes llevar un casco de minero.", + "¡Puedes llevar cubos!", + "Puedes retirar antorchas con " + (object) '\x008D' + ".", + "¡Otros jugadores pueden saquear tus cofres! Si no confías en ellos, usa una caja fuerte o hucha, ya que esos objetos tienen almacenamiento exclusivo para cada jugador.", + "Derrota al enemigo final en el Inframundo para cambiar el mundo para siempre. Encuentra un Muñeco vudú guía y sumérgelo en la lava para invocarlo.", + "Los Altares demoníacos no se pueden destruir con un martillo normal. Hay que destrozarlos.", + "Matar conejitos es cruel. Punto.", + "¡Los explosivos son peligrosos!\nPero efectivos...", + "¡Cuidado con los meteoritos!", + "Una mascota puede ser tu mejor amigo.", + "¡Si excavas lo suficiente, terminarás en el Inframundo!", + "Papá Noelexiste. Viene a la ciudad después de haber derrotado a la Legión del hielo(y es la época).", + "No agites un globo de nieve a menos que quieras invocar a la Legión del hielo.", + "En el inventario, puedes pulsar " + (object) '\x008B' + " para equipar objetos como la armadura o los accesorios, moviéndolos directamente a una ranura adecuada.", + "Puedes usar las semillas encantadas, el agua sagrada o la piedra perla para crear terreno sagrado.", + "El terreno sagrado es el único sitio donde la corrupción no se puede extender.", + "La corrupción está llena de abismos. ¡Mira bien dónde pisas!", + "El tiempo cura todas las heridas.", + "La ciencia nos ha proporcionado las botas cohete.", + "Los accesorios, como la nube en botella y el globo rojo brillante, mejoran la habilidad de salto. Combínalos para crear una nube en globo.", + "Gungnir es la lanza del dios Odín.", + "Excalibures la legendaria espada del Rey Arturo.", + "El nombre de la adamantita viene de la palabra griega 'adamastos', que significa 'indomable'.", + "Si almacenas monedas en una casa, será menos probable que las pierdas.", + "Si encuentras cofres en el mundo, puedes eliminarlos con un martillo y llevártelos.", + "Para crear pociones, coloca una botella sobre una mesay se convertirá en una estación de alquimia. ¡Abracadabra, pata de cabra!", + "Si la casa no tiene muros de fondo, los monstruos podrán entrar en ella.", + "Los monstruos reaparecen más a menudo en las zonas oscuras.", + "Al llevar un conjunto de armadura en el que todas las piezas estén fabricadas con el mismo material, conseguirás bonificaciones extra.", + "Construye una forjapara crear barras de metal a partir de los minerales.", + "Puedes recoger las telarañas y convertirlas en seda. Puedes usar seda para crear camas o prendas decorativas.", + "Puedes comprar cables a un mecánico y usarlos para crear trampas, sistemas de bombeo o dispositivos más elaborados.", + "Si te cansas de que te golpeen, intenta equiparte con un escudo de cobalto. Lo puedes encontrar en la mazmorra.", + "Puedes crear un garfio de escalada con cadenas de hierro y un gancho. Puedes obtener ganchos de las pirañas de la jungla.", + "Una habitación puede tener plataformas de madera como suelo o techo, pero los PNJ necesitan como mínimo un bloque sólido sobre el que ponerse.", + "Puedes destruir orbes sombríos con un martillo o con explosivos, pero prepárate para las fuerzas que desatan.", + "Los objetos más poderosos precisan almas para ser creados. Solo podrás encontrarlas en el modo Difícil.", + "Cuando te enfrentes a un ejército duende, es fundamental saber controlar a las multitudes.", + "Los mejores magos usan flores de maná.", + "¡Usa los objetos de aspecto sospechoso bajo tu responsabilidad!", + "La arena es demasiado poderosa.", + "¡Nadar sin aletas ni casco de buceoes peligroso! Puedes fabricar estos objetos en el taller de chapuzas ", + "El duende chapucero se encuentra en cavernas subterráneas y te venderá muchos objetos muy útiles, como el taller de chapuzas.", + "Las semillas se pueden usar para cultivar una gran cantidad de ingredientes muy útiles, especialmente a la hora de preparar pociones.", + "Algunos proyectiles, como las flechas y los shuriken se pueden recoger y volver a usar después de haberlos lanzado." + }; + private static Point TipCenter = new Point(480, 405); + private static Point TipDimensions = new Point(500, 150); + private const int Width = 450; + private const int DisplayTime = 480; + private static TextBlock[] blocks; + private int current; + private int cooldown; + private int displayInterval; + + static TextSequenceBlock() + { + } + + private TextSequenceBlock(int startIndex, int displayInterval) + { + this.current = startIndex; + this.cooldown = displayInterval; + this.displayInterval = displayInterval; + } + + public static void GenerateCache(GraphicsDevice gfx) + { + string[] strArray = TextSequenceBlock.TIPS_EN; + switch (Lang.lang) + { + case 2: + strArray = TextSequenceBlock.TIPS_DE; + break; + case 3: + strArray = TextSequenceBlock.TIPS_IT; + break; + case 4: + strArray = TextSequenceBlock.TIPS_FR; + break; + case 5: + strArray = TextSequenceBlock.TIPS_ES; + break; + } + Rectangle dialogArea = new Rectangle(TextSequenceBlock.TipCenter.X, TextSequenceBlock.TipCenter.Y, 0, 0); + dialogArea.Inflate(TextSequenceBlock.TipDimensions.X >> 1, TextSequenceBlock.TipDimensions.Y >> 1); + TextSequenceBlock.blocks = new TextBlock[strArray.Length]; + for (int index = 0; index < strArray.Length; ++index) + { + CompiledText text = new CompiledText(strArray[index], 450, UI.styleFontSmallOutline, CompiledText.MarkupType.Html); + Rectangle textArea = new Rectangle(TextSequenceBlock.TipCenter.X, TextSequenceBlock.TipCenter.Y, 0, 0); + textArea.Inflate((int) text.Width >> 1, (int) text.Height + UI.fontSmallOutline.LineSpacing >> 1); + TextSequenceBlock.blocks[index] = new TextBlock(ref dialogArea, text, ref textArea, Assets.TEXT_BACKGROUND, Assets.TEXT_BACKGROUND_BORDER_WIDTH, UI.DEFAULT_DIALOG_COLOR, Color.White, Color.DarkOrange); + TextSequenceBlock.blocks[index].GenerateCache(gfx); + } + int length = TextSequenceBlock.blocks.Length; + do + { + int index = Main.rand.Next(length); + --length; + TextBlock textBlock = TextSequenceBlock.blocks[index]; + TextSequenceBlock.blocks[index] = TextSequenceBlock.blocks[length]; + TextSequenceBlock.blocks[length] = textBlock; + } + while (length > 1); + } + + public static TextSequenceBlock CreateTips() + { + return new TextSequenceBlock(Main.rand.Next(TextSequenceBlock.blocks.Length), 480); + } + + public void Update() + { + --this.cooldown; + if (this.cooldown >= 0) + return; + ++this.current; + if (this.current >= TextSequenceBlock.blocks.Length) + this.current -= TextSequenceBlock.blocks.Length; + this.cooldown = this.displayInterval; + } + + public void Draw() + { + TextSequenceBlock.blocks[this.current].Draw(0, 0, 0); + } + } +} diff --git a/Terraria/Tile.cs b/Terraria/Tile.cs new file mode 100644 index 0000000..05f605d --- /dev/null +++ b/Terraria/Tile.cs @@ -0,0 +1,140 @@ +// Type: Terraria.Tile +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +namespace Terraria +{ + public struct Tile + { + public byte active; + public byte type; + public Tile.Flags flags; + public byte liquid; + public byte lava; + public byte wall; + public ushort wallFrameX; + public byte wallFrameY; + public byte frameNumber; + public short frameX; + public short frameY; + + public int wallFrameNumber + { + get + { + return (int) (this.flags & Tile.Flags.WALLFRAME_MASK); + } + set + { + this.flags = (Tile.Flags) value | this.flags & (Tile.Flags.HIGHLIGHT_MASK | Tile.Flags.VISITED | Tile.Flags.WIRE | Tile.Flags.CHECKING_LIQUID | Tile.Flags.SKIP_LIQUID); + } + } + + public int checkingLiquid + { + get + { + return (int) (this.flags & Tile.Flags.CHECKING_LIQUID); + } + set + { + this.flags = (Tile.Flags) value | this.flags & (Tile.Flags.WALLFRAME_MASK | Tile.Flags.HIGHLIGHT_MASK | Tile.Flags.VISITED | Tile.Flags.WIRE | Tile.Flags.SKIP_LIQUID); + } + } + + public int skipLiquid + { + get + { + return (int) (this.flags & Tile.Flags.SKIP_LIQUID); + } + set + { + this.flags = (Tile.Flags) value | this.flags & (Tile.Flags.WALLFRAME_MASK | Tile.Flags.HIGHLIGHT_MASK | Tile.Flags.VISITED | Tile.Flags.WIRE | Tile.Flags.CHECKING_LIQUID); + } + } + + public int wire + { + get + { + return (int) (this.flags & Tile.Flags.WIRE); + } + set + { + this.flags = (Tile.Flags) value | this.flags & (Tile.Flags.WALLFRAME_MASK | Tile.Flags.HIGHLIGHT_MASK | Tile.Flags.VISITED | Tile.Flags.CHECKING_LIQUID | Tile.Flags.SKIP_LIQUID); + } + } + + public void Clear() + { + this.active = (byte) 0; + this.flags = ~(Tile.Flags.WALLFRAME_MASK | Tile.Flags.HIGHLIGHT_MASK | Tile.Flags.VISITED | Tile.Flags.WIRE | Tile.Flags.CHECKING_LIQUID | Tile.Flags.SKIP_LIQUID); + this.type = (byte) 0; + this.wall = (byte) 0; + this.wallFrameX = (ushort) 0; + this.wallFrameY = (byte) 0; + this.liquid = (byte) 0; + this.lava = (byte) 0; + this.frameNumber = (byte) 0; + } + + public bool isTheSameAsExcludingVisibility(ref Tile compTile) + { + return (int) this.active == (int) compTile.active && ((int) this.active == 0 || (int) this.type == (int) compTile.type && (!Main.tileFrameImportant[(int) this.type] || (int) this.frameX == (int) compTile.frameX && (int) this.frameY == (int) compTile.frameY)) && ((int) this.wall == (int) compTile.wall && (int) this.liquid == (int) compTile.liquid && (this.flags & Tile.Flags.WIRE) == (compTile.flags & Tile.Flags.WIRE)); + } + + public bool isTheSameAs(ref Tile compTile) + { + return (int) this.active == (int) compTile.active && ((int) this.active == 0 || (int) this.type == (int) compTile.type && (!Main.tileFrameImportant[(int) this.type] || (int) this.frameX == (int) compTile.frameX && (int) this.frameY == (int) compTile.frameY)) && ((int) this.wall == (int) compTile.wall && (int) this.liquid == (int) compTile.liquid && (this.flags & (Tile.Flags.VISITED | Tile.Flags.WIRE)) == (compTile.flags & (Tile.Flags.VISITED | Tile.Flags.WIRE))); + } + + public bool isFullTile() + { + if ((int) this.active != 0 && (int) this.type != 10 && ((int) this.type != 54 && (int) this.type != 138) && Main.tileSolidNotSolidTop[(int) this.type]) + { + int num1 = (int) this.frameY; + if (num1 == 18) + { + int num2 = (int) this.frameX; + if (num2 >= 18 && num2 <= 54 || num2 >= 108 && num2 <= 144) + return true; + } + else if (num1 >= 90 && num1 <= 196) + { + int num2 = (int) this.frameX; + if (num2 <= 70 || num2 >= 144 && num2 <= 232) + return true; + } + } + return false; + } + + public bool canStandOnTop() + { + if ((int) this.active == 0) + return false; + if (Main.tileSolid[(int) this.type]) + return true; + if ((int) this.frameY == 0) + return Main.tileSolidTop[(int) this.type]; + else + return false; + } + + [System.Flags] + public enum Flags : byte + { + WALLFRAME_MASK = (byte) 3, + NEARBY = (byte) 4, + VISITED = (byte) 8, + WIRE = (byte) 16, + SELECTED = (byte) 32, + LAVA = SELECTED, + CHECKING_LIQUID = (byte) 64, + SKIP_LIQUID = (byte) 128, + HIGHLIGHT_MASK = LAVA | NEARBY, + } + } +} diff --git a/Terraria/Time.cs b/Terraria/Time.cs new file mode 100644 index 0000000..116437a --- /dev/null +++ b/Terraria/Time.cs @@ -0,0 +1,319 @@ +// Type: Terraria.Time +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework; +using System; + +namespace Terraria +{ + public struct Time + { + private const int sunWidth = 64; + private const int moonWidth = 50; + public const int moonHeight = 50; + public const int dayLength = 54000; + public const int nightLength = 32400; + public float dayRate; + public float time; + public bool dayTime; + public bool bloodMoon; + public byte moonPhase; + public Color intermediateCelestialColor; + public Color intermediateBgColor; + public short celestialX; + public short celestialY; + public float celestialRotation; + public float celestialScale; + public Color celestialColor; + public Color bgColor; + public Color tileColor; + public Vector3 tileColorf; + public static bool xMas; + + static Time() + { + } + + public void reset(float speed) + { + this.dayRate = speed; + this.time = 13500f; + this.dayTime = true; + this.bloodMoon = false; + this.moonPhase = (byte) 0; + this.intermediateCelestialColor.A = byte.MaxValue; + this.intermediateBgColor.A = byte.MaxValue; + this.tileColor.A = byte.MaxValue; + this.updateDay(); + } + + private void updateNight() + { + this.celestialX = (short) ((int) ((double) this.time / 32400.0 * 1060.0) - 50); + this.celestialRotation = (float) ((double) this.time / 16200.0 - 7.30000019073486); + float num1 = (double) this.time >= 16200.0 ? (float) (((double) this.time / 32400.0 - 0.5) * 2.0) : (float) (1.0 - (double) this.time / 16200.0); + float num2 = num1 * num1; + this.celestialY = (short) ((int) ((double) num2 * 250.0) + 180); + this.celestialScale = (float) (1.20000004768372 - (double) num2 * 0.400000005960464); + if (this.bloodMoon) + { + if ((double) this.time < 16200.0) + { + float num3 = (float) (1.0 - (double) this.time / 16200.0); + this.intermediateCelestialColor.R = (byte) ((double) num3 * 10.0 + 205.0); + this.intermediateCelestialColor.G = (byte) ((double) num3 * 170.0 + 55.0); + this.intermediateCelestialColor.B = (byte) ((double) num3 * 200.0 + 55.0); + this.intermediateBgColor.R = (byte) (40.0 - (double) num3 * 40.0 + 35.0); + this.intermediateBgColor.G = (byte) ((double) num3 * 20.0 + 15.0); + this.intermediateBgColor.B = (byte) ((double) num3 * 20.0 + 15.0); + } + else + { + if ((double) this.time < 16200.0) + return; + float num3 = (float) (((double) this.time / 32400.0 - 0.5) * 2.0); + this.intermediateCelestialColor.R = (byte) ((double) num3 * 10.0 + 205.0); + this.intermediateCelestialColor.G = (byte) ((double) num3 * 170.0 + 55.0); + this.intermediateCelestialColor.B = (byte) ((double) num3 * 200.0 + 55.0); + this.intermediateBgColor.R = (byte) (40.0 - (double) num3 * 40.0 + 35.0); + this.intermediateBgColor.G = (byte) ((double) num3 * 20.0 + 15.0); + this.intermediateBgColor.B = (byte) ((double) num3 * 20.0 + 15.0); + } + } + else if ((double) this.time < 16200.0) + { + float num3 = (float) (1.0 - (double) this.time / 16200.0); + this.intermediateCelestialColor.R = (byte) ((double) num3 * 10.0 + 205.0); + this.intermediateCelestialColor.G = (byte) ((double) num3 * 70.0 + 155.0); + this.intermediateCelestialColor.B = (byte) ((double) num3 * 100.0 + 155.0); + this.intermediateBgColor.R = (byte) ((double) num3 * 20.0 + 15.0); + this.intermediateBgColor.G = (byte) ((double) num3 * 20.0 + 15.0); + this.intermediateBgColor.B = (byte) ((double) num3 * 20.0 + 15.0); + } + else if ((double) this.time >= 16200.0) + { + float num3 = (float) (((double) this.time / 32400.0 - 0.5) * 2.0); + this.intermediateCelestialColor.R = (byte) ((double) num3 * 50.0 + 205.0); + this.intermediateCelestialColor.G = (byte) ((double) num3 * 100.0 + 155.0); + this.intermediateCelestialColor.B = (byte) ((double) num3 * 100.0 + 155.0); + this.intermediateBgColor.R = (byte) ((double) num3 * 10.0 + 15.0); + this.intermediateBgColor.G = (byte) ((double) num3 * 20.0 + 15.0); + this.intermediateBgColor.B = (byte) ((double) num3 * 20.0 + 15.0); + } + else + { + this.intermediateCelestialColor = Color.White; + this.intermediateBgColor = Color.White; + } + } + + private void updateDay() + { + this.celestialX = (short) ((int) ((double) this.time / 54000.0 * 1088.0) - 64); + this.celestialRotation = (float) ((double) this.time / 27000.0 - 7.30000019073486); + float num1 = (double) this.time >= 27000.0 ? (float) (((double) this.time / 54000.0 - 0.5) * 2.0) : (float) (1.0 - (double) this.time / 54000.0 * 2.0); + float num2 = num1 * num1; + this.celestialY = (short) ((int) ((double) num2 * 250.0) + 180); + this.celestialScale = (float) ((1.20000004768372 - (double) num2 * 0.400000005960464) * 1.10000002384186); + if ((double) this.time < 13500.0) + { + float num3 = this.time / 13500f; + this.intermediateCelestialColor.R = (byte) ((double) num3 * 200.0 + 55.0); + this.intermediateCelestialColor.G = (byte) ((double) num3 * 180.0 + 75.0); + this.intermediateCelestialColor.B = (byte) ((double) num3 * 250.0 + 5.0); + this.intermediateBgColor.R = (byte) ((double) num3 * 230.0 + 25.0); + this.intermediateBgColor.G = (byte) ((double) num3 * 220.0 + 35.0); + this.intermediateBgColor.B = (byte) ((double) num3 * 220.0 + 35.0); + } + else if ((double) this.time > 45900.0) + { + float num3 = (float) (1.0 - ((double) this.time / 54000.0 - 0.850000023841858) * 6.66666650772095); + this.intermediateCelestialColor.R = (byte) ((double) num3 * 120.0 + 55.0); + this.intermediateCelestialColor.G = (byte) ((double) num3 * 100.0 + 25.0); + this.intermediateCelestialColor.B = (byte) ((double) num3 * 120.0 + 55.0); + this.intermediateBgColor.R = (byte) ((double) num3 * 200.0 + 35.0); + this.intermediateBgColor.G = (byte) ((double) num3 * 85.0 + 35.0); + this.intermediateBgColor.B = (byte) ((double) num3 * 135.0 + 35.0); + } + else if ((double) this.time > 37800.0) + { + float num3 = (float) (1.0 - ((double) this.time / 54000.0 - 0.699999988079071) * 6.66666650772095); + this.intermediateCelestialColor.R = (byte) ((double) num3 * 80.0 + 175.0); + this.intermediateCelestialColor.G = (byte) ((double) num3 * 130.0 + 125.0); + this.intermediateCelestialColor.B = (byte) ((double) num3 * 100.0 + 155.0); + this.intermediateBgColor.R = (byte) ((double) num3 * 20.0 + 235.0); + this.intermediateBgColor.G = (byte) ((double) num3 * 135.0 + 120.0); + this.intermediateBgColor.B = (byte) ((double) num3 * 85.0 + 170.0); + } + else + { + this.intermediateCelestialColor = Color.White; + this.intermediateBgColor = Color.White; + } + } + + public void applyJungle(float light) + { + if ((double) light > 1.0) + light = 1f; + int num1 = (int) this.intermediateBgColor.R; + int num2 = (int) this.intermediateBgColor.G; + int num3 = (int) this.intermediateBgColor.B; + int num4 = num1 - (int) (30.0 * (double) light * ((double) num1 * 0.00392156885936856)); + int num5 = num3 - (int) (90.0 * (double) light * ((double) num3 * 0.00392156885936856)); + if (num4 < 15) + num4 = 15; + if (num5 < 15) + num5 = 15; + this.bgColor.R = (byte) num4; + this.bgColor.G = (byte) num2; + this.bgColor.B = (byte) num5; + this.bgColor.A = byte.MaxValue; + int num6 = (int) this.intermediateCelestialColor.R; + int num7 = (int) this.intermediateCelestialColor.G; + int num8 = (int) this.intermediateCelestialColor.B; + int num9; + int num10; + if (this.dayTime) + { + num9 = num6 - (int) (30.0 * (double) light * ((double) num6 * 0.00392156885936856)); + num10 = num8 - (int) (10.0 * (double) light * ((double) num7 * 0.00392156885936856)); + } + else + { + num9 = num6 - (int) (140.0 * (double) light * ((double) num6 * 0.00392156885936856)); + num7 -= (int) (190.0 * (double) light * ((double) num7 * 0.00392156885936856)); + num10 = num8 - (int) (170.0 * (double) light * ((double) num8 * 0.00392156885936856)); + } + if (num9 < 15) + num9 = 15; + if (num7 < 15) + num7 = 15; + if (num10 < 15) + num10 = 15; + this.celestialColor.R = (byte) num9; + this.celestialColor.G = (byte) num7; + this.celestialColor.B = (byte) num10; + this.celestialColor.A = byte.MaxValue; + } + + public void applyEvil(float light) + { + if ((double) light > 1.0) + light = 1f; + int num1 = (int) this.intermediateBgColor.R; + int num2 = (int) this.intermediateBgColor.G; + int num3 = (int) this.intermediateBgColor.B; + int num4 = num1 - (int) (100.0 * (double) light * ((double) num1 * 0.00392156885936856)); + int num5 = num2 - (int) (140.0 * (double) light * ((double) num2 * 0.00392156885936856)); + int num6 = num3 - (int) (80.0 * (double) light * ((double) num3 * 0.00392156885936856)); + if (num4 < 15) + num4 = 15; + if (num5 < 15) + num5 = 15; + if (num6 < 15) + num6 = 15; + this.bgColor.R = (byte) num4; + this.bgColor.G = (byte) num5; + this.bgColor.B = (byte) num6; + this.bgColor.A = byte.MaxValue; + int num7 = (int) this.intermediateCelestialColor.R; + int num8 = (int) this.intermediateCelestialColor.G; + int num9 = (int) this.intermediateCelestialColor.B; + int num10; + int num11; + if (this.dayTime) + { + num10 = num7 - (int) (100.0 * (double) light * ((double) num7 * 0.00392156885936856)); + num11 = num8 - (int) (100.0 * (double) light * ((double) num8 * 0.00392156885936856)); + } + else + { + num10 = num7 - (int) (140.0 * (double) light * ((double) num7 * 0.00392156885936856)); + num11 = num8 - (int) (190.0 * (double) light * ((double) num8 * 0.00392156885936856)); + num9 -= (int) (170.0 * (double) light * ((double) num9 * 0.00392156885936856)); + } + if (num10 < 15) + num10 = 15; + if (num11 < 15) + num11 = 15; + if (num9 < 15) + num9 = 15; + this.celestialColor.R = (byte) num10; + this.celestialColor.G = (byte) num11; + this.celestialColor.B = (byte) num9; + this.celestialColor.A = byte.MaxValue; + } + + public void applyNothing() + { + this.celestialColor = this.intermediateCelestialColor; + this.bgColor = this.intermediateBgColor; + } + + public void finalizeColors() + { + if (this.bloodMoon) + { + if ((int) this.bgColor.R < 35) + this.bgColor.R = (byte) 35; + if ((int) this.bgColor.G < 35) + this.bgColor.G = (byte) 35; + if ((int) this.bgColor.B < 35) + this.bgColor.B = (byte) 35; + } + else + { + if ((int) this.bgColor.R < 25) + this.bgColor.R = (byte) 25; + if ((int) this.bgColor.G < 25) + this.bgColor.G = (byte) 25; + if ((int) this.bgColor.B < 25) + this.bgColor.B = (byte) 25; + } + this.tileColor.R = (byte) (((int) this.bgColor.G + (int) this.bgColor.B + (int) this.bgColor.R * 8) / 10); + this.tileColor.G = (byte) (((int) this.bgColor.R + (int) this.bgColor.B + (int) this.bgColor.G * 8) / 10); + this.tileColor.B = (byte) (((int) this.bgColor.R + (int) this.bgColor.G + (int) this.bgColor.B * 8) / 10); + this.tileColorf.X = (float) this.tileColor.R * 0.003921569f; + this.tileColorf.Y = (float) this.tileColor.G * 0.003921569f; + this.tileColorf.Z = (float) this.tileColor.B * 0.003921569f; + } + + public bool update() + { + this.time += this.dayRate; + if (!this.dayTime) + { + if ((double) this.time > 32400.0) + { + this.time = 0.0f; + this.dayTime = true; + this.bloodMoon = false; + this.moonPhase = (byte) ((int) this.moonPhase + 1 & 7); + this.updateDay(); + return true; + } + else + this.updateNight(); + } + else if ((double) this.time > 54000.0) + { + this.time = 0.0f; + this.dayTime = false; + this.updateNight(); + return true; + } + else + this.updateDay(); + return false; + } + + public static void checkXMas() + { + DateTime now = DateTime.Now; + Time.xMas = now.Month == 12 && now.Day >= 15; + } + } +} diff --git a/Terraria/Tutorial.cs b/Terraria/Tutorial.cs new file mode 100644 index 0000000..c8ae3f6 --- /dev/null +++ b/Terraria/Tutorial.cs @@ -0,0 +1,94 @@ +// Type: Terraria.Tutorial +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +namespace Terraria +{ + public enum Tutorial + { + FIRST = 0, + INTRO = 0, + INTRO_2 = 1, + MOVE = 2, + JUMP = 3, + FALL_DOWN = 4, + JUMP_OUT = 5, + CURSOR = 6, + HOTBAR = 7, + SWORD_ATTACK = 8, + MONSTER_INFO_1 = 9, + MONSTER_INFO_2 = 10, + POTIONS_1 = 11, + POTIONS_2 = 12, + TORCH_1 = 13, + TORCH_2 = 14, + SELECT_AXE = 15, + USE_AXE = 16, + INVENTORY = 17, + INVENTORY_2 = 18, + INVENTORY_3 = 19, + MOVEMENT_1 = 20, + MOVEMENT_2 = 21, + DROP_1 = 22, + DROP_2 = 23, + EQUIPMENT = 24, + EQUIPSCREEN_1 = 25, + EQUIPSCREEN_2 = 26, + CHEST_1 = 27, + CHEST_2 = 28, + CRAFTING = 29, + CRAFT_TORCH = 30, + CRAFTSCREEN_1 = 31, + CRAFTSCREEN_2 = 32, + CRAFT_CATEGORIES = 33, + CRAFTING_EXIT = 34, + SELECT_PICK = 35, + USE_PICK = 36, + MINED_ORE_1 = 37, + MINED_ORE_2 = 38, + WOOD_PLATFORM = 39, + WOOD_PLATFORM_TIME_OUT = 40, + SELECT_PLATFORM = 41, + BUILD_CURSOR = 42, + PLACING_1 = 43, + PLACING_2 = 44, + CURSOR_SWITCH_1 = 45, + CURSOR_SWITCH_2 = 46, + DAY_NIGHT_1 = 47, + DAY_NIGHT_2 = 48, + BUILD_HOUSE = 49, + BUILD_HOUSE_EXTRA_INFO = 50, + BUILD_HOUSE_2 = 51, + BUILD_HOUSE_2_EXTRA_INFO = 52, + CRAFT_WORKBENCH = 53, + CRAFT_WORKBENCH_EXTRA_INFO = 54, + USE_BENCH_1 = 55, + USE_BENCH_2 = 56, + CRAFT_DOOR = 57, + CRAFT_DOOR_EXTRA_INFO = 58, + PLACE_DOOR = 59, + USE_DOOR = 60, + BACK_WALL_INFO_1 = 61, + BACK_WALL_INFO_2 = 62, + CRAFT_WALL = 63, + CRAFT_WALL_EXTRA_INFO = 64, + PLACE_WALL = 65, + BACK_WALL = 66, + HOUSE_INFO_1 = 67, + HOUSE_INFO_2 = 68, + PLACE_CHAIR = 69, + PLACE_TORCH = 70, + HOUSE_DONE_1 = 71, + HOUSE_DONE_2 = 72, + THE_GUIDE_1 = 73, + THE_GUIDE_2 = 74, + HAMMER_1 = 75, + HAMMER_2 = 76, + CONGRATS_1 = 77, + CONGRATS_2 = 78, + THE_END = 79, + NONE = 80, + NUM_TUTORIALS = 80, + } +} diff --git a/Terraria/UI.cs b/Terraria/UI.cs new file mode 100644 index 0000000..3c96d1d --- /dev/null +++ b/Terraria/UI.cs @@ -0,0 +1,8635 @@ +// Type: Terraria.UI +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Content; +using Microsoft.Xna.Framework.GamerServices; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Input; +using Microsoft.Xna.Framework.Net; +using Microsoft.Xna.Framework.Storage; +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.IO; +using System.Threading; +using Terraria.Achievements; +using Terraria.Leaderboards; + +namespace Terraria +{ + public sealed class UI + { + public static Color DISABLED_COLOR = new Color(16, 16, 16, 128); + public static Color WINDOW_OUTLINE = new Color(12, 24, 24, (int) byte.MaxValue); + public static Color DEFAULT_DIALOG_COLOR = new Color(42, 43, 101, 192); + private static int FONT_STACK_EXTRA_OFFSET = -5; + public static WorldView[] activeView = new WorldView[4]; + private static CompiledText saveIconMessage = (CompiledText) null; + private static int saveIconMessageTime = 0; + public static byte mouseTextBrightness = (byte) 175; + private static sbyte mouseTextColorChange = (sbyte) 2; + public static Color mouseTextColor = new Color(175, 175, 175, 175); + public static Color mouseColor = new Color((int) byte.MaxValue, 95, 180); + public static Color cursorColor = Color.White; + public static float cursorAlpha = 0.0f; + public static float cursorScale = 0.0f; + public static byte invAlpha = (byte) 180; + private static sbyte invDir = (sbyte) 1; + public static float essScale = 1f; + private static float essDir = -0.01f; + public static float blueWave = 1f; + private static float blueDelta = -0.0005f; + public static bool quit = false; + public static SpriteFont[] fontCombatText = new SpriteFont[2]; + private static readonly Location[] MENU_TITLE_COORDS = new Location[8] + { + new Location(480, 199), + new Location(480, 237), + new Location(480, 275), + new Location(480, 313), + new Location(480, 351), + new Location(480, 399), + new Location(480, 437), + new Location(480, 475) + }; + private static readonly Location[] MENU_PAUSE_COORDS = new Location[7] + { + new Location(480, 221), + new Location(480, 259), + new Location(480, 297), + new Location(480, 334), + new Location(480, 372), + new Location(480, 421), + new Location(480, 459) + }; + private static Location[] MENU_SELECT_COORDS = new Location[6] + { + new Location(480, 216), + new Location(480, 253), + new Location(480, 291), + new Location(480, 329), + new Location(480, 367), + new Location(480, 410) + }; + private static Location[] MENU_CONFIRM_DELETE_COORDS = new Location[2] + { + new Location(480, 356), + new Location(480, 437) + }; + private static readonly Location[] MENU_WORLD_SIZE_COORDS = new Location[3] + { + new Location(480, 307), + new Location(480, 367), + new Location(480, 415) + }; + private static readonly Location[] MENU_OPTIONS_COORDS = new Location[4] + { + new Location(480, 253), + new Location(480, 313), + new Location(480, 372), + new Location(480, 432) + }; + private static readonly Location[] MENU_SETTINGS_COORDS = new Location[3] + { + new Location(480, 270), + new Location(480, 340), + new Location(480, 410) + }; + private static Item cpItem = new Item(); + public byte myPlayer = (byte) 8; + public NetPlayer netPlayer = new NetPlayer(); + public float worldFadeTarget = 1f; + public float uiFade = 1f; + public float uiFadeTarget = 1f; + public bool smartCursor = true; + public Buttons BTN_JUMP2 = Buttons.LeftStick; + public Buttons BTN_GRAPPLE = Buttons.LeftTrigger; + private sbyte quickAccessUp = (sbyte) -1; + private sbyte quickAccessDown = (sbyte) -1; + private sbyte quickAccessLeft = (sbyte) -1; + private sbyte quickAccessRight = (sbyte) -1; + private List transferredPlayerStorage = new List(3); + public Player[] loadPlayer = new Player[5]; + public string[] loadPlayerPath = new string[5]; + private float logoRotationDirection = 1f; + private float logoRotationSpeed = 1f; + private float logoScale = 1f; + private float logoScaleDirection = 1f; + private float logoScaleSpeed = 1f; + private short LogoA = (short) byte.MaxValue; + public float musicVolume = 0.75f; + public float soundVolume = 1f; + public bool showItemText = true; + private Stopwatch saveTime = new Stopwatch(); + private Color selColor = Color.White; + private bool[] noFocus = new bool[14]; + private bool[] blockFocus = new bool[14]; + private short[] menuY = new short[14]; + private byte[] menuHC = new byte[14]; + private float[] menuScale = new float[14]; + private float[] menuItemScale = new float[14]; + private sbyte focusMenu = (sbyte) -1; + private sbyte selectedMenu = (sbyte) -1; + public MenuMode menuMode = MenuMode.WELCOME; + public MenuMode[] prevMenuMode = new MenuMode[16]; + private Location[] uiPos = new Location[38]; + public int hotbarItemNameTime = 210; + public float[] hotbarScale = new float[10] + { + 1f, + 0.75f, + 0.75f, + 0.75f, + 0.75f, + 0.75f, + 0.75f, + 0.75f, + 0.75f, + 0.75f + }; + public float[] inventoryMenuSectionScale = new float[5] + { + 0.75f, + 0.75f, + 1f, + 0.75f, + 0.75f + }; + public UI.InventorySection inventorySection = UI.InventorySection.ITEMS; + private sbyte inventoryEquipY = (sbyte) 1; + private short inventoryHousingNpc = (short) -1; + private float craftingRecipeScrollMul = 13.0 / 16.0; + public short stackDelay = (short) 7; + private UI.InventorySection mouseItemSrcSection = UI.InventorySection.NUM_SECTIONS; + public Item mouseItem = new Item(); + public Item trashItem = new Item(); + public Item guideItem = new Item(); + private Item toolTip = new Item(); + public List currentRecipeCategory = new List(); + public MiniMap miniMap = new MiniMap(); + private BitArray armorFound = new BitArray(632); + private List blacklist = new List(); + private string[] menuString = new string[14]; + private sbyte showPlayer = (sbyte) -1; + private byte menuSpace = (byte) 80; + private short menuTop = (short) 250; + private short menuLeft = (short) 480; + private const bool TEST_WATCH = false; + private const bool TEST_DEPTH_METER = false; + private const bool TEST_COMPASS = false; + private const ulong MARKETPLACE_OFFER_ID = 6359384554213474305UL; + public const int FULLSCREEN_SAFE_AREA_OFFSET_X = 48; + public const int FULLSCREEN_SAFE_AREA_OFFSET_Y = 27; + public const int USABLE_WIDTH = 864; + public const int USABLE_HEIGHT = 454; + public const int CONTROLS_HUD_X = 0; + public const int UI_DELAY = 12; + public const int MOUSE_DELAY = 4; + public const float DEAD_ZONE = 0.125f; + public const float DEAD_ZONE_SQUARED = 0.015625f; + public const float WORLD_FADE_START = -0.25f; + private const float WORLD_FADE_SPEED = 0.03333334f; + private const float UI_FADE_SPEED = 0.03333334f; + private const int MAX_ITEMS = 14; + private const int MAX_DEPTH = 16; + private const int MAX_LOAD_PLAYERS = 5; + private const int MAX_LOAD_WORLDS = 5; + public const int mcColorR = 125; + public const int mcColorG = 125; + public const int mcColorB = 255; + public const int hcColorR = 200; + public const int hcColorG = 125; + public const int hcColorB = 255; + public const float FONT_STACK_EXTRA_SCALE = 0.1f; + public const Buttons BTN_JUMP = Buttons.A; + public const Buttons BTN_INTERACT = Buttons.B; + public const Buttons BTN_USE = Buttons.RightTrigger; + public const Buttons BTN_DROP = Buttons.X; + public const Buttons BTN_RESPAWN = Buttons.A; + public const Buttons BTN_CURSOR_MODE = Buttons.RightStick; + public const Buttons BTN_PREV_ITEM = Buttons.LeftShoulder; + public const Buttons BTN_NEXT_ITEM = Buttons.RightShoulder; + public const Buttons BTN_INVENTORY_SELL_OR_TRASH = Buttons.X; + public const Buttons BTN_INVENTORY_SELECT = Buttons.A; + public const Buttons BTN_INVENTORY_ACTION = Buttons.RightTrigger; + public const Buttons BTN_INVENTORY_DROP = Buttons.X; + public const Buttons BTN_INVENTORY_HOUSING = Buttons.LeftTrigger; + public const Buttons BTN_INVENTORY_OPEN = Buttons.Y; + public const Buttons BTN_INVENTORY_CLOSE = Buttons.B; + public const Buttons BTN_NPC_CHAT_SELECT = Buttons.A; + public const Buttons BTN_NPC_CHAT_CLOSE = Buttons.B; + public const float LEFT_STICK_VERTICAL_THRESHOLD = 0.5f; + public const int HOTBAR_ITEMNAME_DISPLAYTIME = 210; + public const int QUICK_ACCESS_DISPLAYTIME = 120; + private const int CRAFTING_INGREDIENT_COLS = 4; + private const int CRAFTING_INGREDIENT_ROWS = 3; + private const float CRAFTING_DEFAULT_SCROLL_MUL = 0.8125f; + private const float CRAFTING_MIN_SCROLL_MUL = 0.25f; + private const float CRAFTING_SCROLL_MUL_DECREMENT = 0.075f; + private const int cooldownLen = 180; + private const int MENU_TITLE_W = 1; + private const int MENU_TITLE_H = 7; + private const int MENU_PAUSE_W = 1; + private const int MENU_PAUSE_H = 7; + private const int MENU_SELECT_W = 1; + private const int MENU_SELECT_H = 6; + private const int MENU_CONFIRM_DELETE_W = 1; + private const int MENU_CONFIRM_DELETE_H = 2; + private const int MENU_WORLD_SIZE_W = 1; + private const int MENU_WORLD_SIZE_H = 3; + private const int MENU_OPTIONS_W = 1; + private const int MENU_OPTIONS_H = 4; + private const int MENU_SETTINGS_W = 1; + private const int MENU_SETTINGS_H = 3; + private const int INVENTORY_W = 864; + private const int INVENTORY_H = 446; + private const int INVENTORY_CLIENT_Y_OFFSET = 80; + private const int INVENTORY_CLIENT_H = 366; + private const int TOOLTIP_W = 322; + private const float INVENTORY_FADE = 0.5f; + public static UI main; + public static UI current; + public static int numActiveViews; + public WorldView view; + public LocalNetworkGamer localGamer; + public SignedInGamer signedInGamer; + public PlayerIndex controller; + public Player player; + private byte privateSlots; + public bool wasRemovedFromSessionWithoutOurConsent; + public MenuType menuType; + public bool isStopping; + public float worldFade; + public short oldMouseX; + public short oldMouseY; + public short mouseX; + public short mouseY; + public bool alternateGrappleControls; + public GamePadState gpPrevState; + public GamePadState gpState; + public StorageDeviceManager playerStorage; + public sbyte numLoadPlayers; + public string playerPathName; + private float logoRotation; + private short LogoB; + public string statusText; + private static string errorDescription; + private static string errorCaption; + private static CompiledText errorCompiledText; + public bool autoSave; + public bool isOnline; + public bool isInviteOnly; + public bool settingsDirty; + public sbyte selectedPlayer; + public int menuDepth; + public float progress; + private float progressTotal; + private float numProgressStepsInv; + private short uiX; + private short uiY; + private sbyte uiWidth; + private sbyte uiHeight; + private sbyte uiDelayValue; + public sbyte uiDelay; + public Location[] uiCoords; + public int cursorHighlight; + public Terraria.CreateCharacter.UI createCharacterGUI; + private Terraria.SoundUI.UI soundUI; + private Terraria.HowToPlay.UI howtoUI; + private TextSequenceBlock tips; + private LeaderboardsUI leaderboards; + public int quickAccessDisplayTime; + private static float inventoryScale; + public byte inventoryMode; + private bool restoreOldInventorySection; + private UI.InventorySection oldInventorySection; + private sbyte inventoryItemX; + private sbyte inventoryItemY; + private sbyte inventoryChestX; + private sbyte inventoryChestY; + private sbyte inventoryEquipX; + private sbyte inventoryBuffX; + private sbyte inventoryHousingX; + private sbyte inventoryHousingY; + public Recipe.Category craftingCategory; + private UI.CraftingSection craftingSection; + public bool craftingShowCraftable; + public sbyte craftingRecipeX; + public sbyte craftingRecipeY; + private sbyte craftingIngredientX; + private sbyte craftingIngredientY; + private float craftingRecipeScrollX; + private float craftingRecipeScrollY; + public Recipe craftingRecipe; + public short stackSplit; + public short stackCounter; + private sbyte mouseItemSrcX; + private sbyte mouseItemSrcY; + public byte npcShop; + public bool craftGuide; + public bool reforge; + public string chestText; + public bool editSign; + public bool signBubble; + public int signX; + public int signY; + public UserString npcChatText; + public string npcCompiledChatText; + private CompiledText npcChatCompiledText; + public short helpText; + public sbyte npcChatSelectedItem; + public bool showNPCs; + private int mapScreenCursorX; + private int mapScreenCursorY; + public byte teamSelected; + public bool pvpSelected; + public short teamCooldown; + public short pvpCooldown; + public Statistics Statistics; + public TriggerSystem AchievementTriggers; + public uint totalJumps; + public uint totalChops; + public uint totalSlimes; + public uint totalAxed; + public uint totalCopper; + public uint totalDoorsOpened; + public uint totalDoorsClosed; + public uint totalWoodPlatformsPlaced; + public uint totalWallsPlaced; + public uint totalTorchesCrafted; + public uint totalWoodPlatformsCrafted; + public uint totalWallsCrafted; + public uint totalSteps; + public uint totalBarsCrafted; + public uint totalPicked; + public uint totalAnvilCrafting; + public uint totalWires; + public uint totalAirTime; + public uint currentAirTime; + public float airTravel; + public byte petSpawnMask; + private static Main theGame; + public static Texture2D logoTexture; + public static Texture2D logo2Texture; + public static Texture2D controlsTexture; + public static Texture2D progressBarTexture; + public static Texture2D textBackTexture; + public static Texture2D chatBackTexture; + public static Texture2D cursorTexture; + public static SpriteFont fontBig; + public static SpriteFont fontSmall; + public static SpriteFont fontSmallOutline; + public static SpriteFont fontItemStack; + public static CompiledText.Style styleFontSmallOutline; + private byte numMenuItems; + private sbyte oldMenu; + public bool inputTextEnter; + public bool inputTextCanceled; + private IAsyncResult kbResult; + private string focusText; + private string focusText3; + private Color focusColor; + private static CompiledText compiledToolTipText; + private static string toolTipText; + + static UI() + { + } + + public static void Error(string caption, string desc, bool rememberPreviousMenu = false) + { + UI.errorCompiledText = (CompiledText) null; + UI.errorCaption = caption; + UI.errorDescription = desc; + UI.main.SetMenu(MenuMode.ERROR, rememberPreviousMenu, false); + } + + public void InitGame() + { + this.wasRemovedFromSessionWithoutOurConsent = false; + this.restoreOldInventorySection = false; + this.inventoryMode = (byte) 0; + this.inventorySection = UI.InventorySection.ITEMS; + this.inventoryItemX = (sbyte) 0; + this.inventoryItemY = (sbyte) 0; + this.inventoryChestX = (sbyte) 0; + this.inventoryChestY = (sbyte) 0; + this.inventoryEquipX = (sbyte) 0; + this.inventoryEquipY = (sbyte) 1; + this.inventoryBuffX = (sbyte) 0; + this.inventoryHousingX = (sbyte) 0; + this.inventoryHousingY = (sbyte) 0; + this.inventoryHousingNpc = (short) -1; + this.craftingCategory = Recipe.Category.STRUCTURES; + this.craftingSection = UI.CraftingSection.RECIPES; + this.craftingShowCraftable = false; + this.craftingRecipeX = (sbyte) 0; + this.craftingRecipeY = (sbyte) 0; + this.craftingIngredientX = (sbyte) 0; + this.craftingIngredientY = (sbyte) 0; + this.craftingRecipeScrollX = 0.0f; + this.craftingRecipeScrollY = 0.0f; + this.mouseItem.Init(); + this.trashItem.Init(); + this.guideItem.Init(); + this.toolTip.Init(); + this.helpText = (short) 0; + this.showNPCs = false; + this.mapScreenCursorX = 0; + this.mapScreenCursorY = 0; + this.teamSelected = (byte) 0; + this.pvpSelected = false; + this.teamCooldown = (short) 0; + this.pvpCooldown = (short) 0; + this.npcShop = (byte) 0; + this.craftGuide = false; + this.reforge = false; + this.editSign = false; + this.signBubble = false; + this.npcChatText = (UserString) null; + this.npcChatSelectedItem = (sbyte) 0; + this.player.hostile = false; + this.player.NetClone(this.netPlayer); + this.InitializeAchievementTriggers(); + } + + private void InitializeAchievementTriggers() + { + this.AchievementTriggers.ReadProfile(this.signedInGamer); + } + + public bool TriggerCheckEnabled(Trigger trigger) + { + return this.AchievementTriggers.CheckEnabled(trigger); + } + + public void SetTriggerState(Trigger trigger) + { + this.AchievementTriggers.SetState(trigger, true); + } + + public static void SetTriggerStateForAll(Trigger trigger) + { + for (int index = 0; index < 8; ++index) + { + Player player = Main.player[index]; + if ((int) player.active != 0) + player.AchievementTrigger(trigger); + } + } + + public static void IncreaseStatisticForAll(StatisticEntry entry) + { + if (entry == StatisticEntry.Unknown) + return; + for (int index = 0; index < 8; ++index) + { + Player player = Main.player[index]; + if ((int) player.active != 0) + player.IncreaseStatistic(entry); + } + } + + private void UpdateAchievements() + { + if (this.Statistics.AllSlimeTypesKilled) + this.SetTriggerState(Trigger.AllSlimesKilled); + if (this.Statistics.AllBossesKilled) + this.SetTriggerState(Trigger.AllBossesKilled); + this.AchievementTriggers.UpdateAchievements(this.signedInGamer); + } + + public static void Initialize(Main game) + { + UI.theGame = game; + Terraria.HowToPlay.UI.GenerateCache(game.GraphicsDevice); + TextSequenceBlock.GenerateCache(game.GraphicsDevice); + } + + public void Initialize(PlayerIndex controller) + { + this.controller = controller; + UI.current = this; + if (UI.main == null) + UI.main = this; + for (int index = 13; index >= 0; --index) + this.menuItemScale[index] = 0.8f; + for (int index = 4; index >= 0; --index) + this.loadPlayer[index] = new Player(); + this.createCharacterGUI = Terraria.CreateCharacter.UI.Create(this); + this.soundUI = Terraria.SoundUI.UI.Create(this); + this.howtoUI = Terraria.HowToPlay.UI.Create(this); + this.tips = TextSequenceBlock.CreateTips(); + this.Statistics = Statistics.Create(); + this.AchievementTriggers = new TriggerSystem(); + this.leaderboards = new LeaderboardsUI(this); + } + + private void SetDefaultSettings() + { + this.soundVolume = 1f; + this.musicVolume = 0.75f; + if (this == UI.main) + { + Main.musicVolume = this.musicVolume; + Main.soundVolume = this.soundVolume; + } + this.autoSave = true; + this.showItemText = true; + this.alternateGrappleControls = false; + this.UpdateAlternateGrappleControls(); + this.Statistics.Init(); + this.totalSteps = 0U; + this.totalPicked = 0U; + this.totalBarsCrafted = 0U; + this.totalAnvilCrafting = 0U; + this.totalWires = 0U; + this.totalAirTime = 0U; + this.petSpawnMask = (byte) 0; + this.armorFound.SetAll(false); + this.isOnline = false; + this.isInviteOnly = false; + this.blacklist.Clear(); + this.settingsDirty = false; + } + + private void InitPlayerStorage() + { + this.SetDefaultSettings(); + this.numLoadPlayers = (sbyte) 0; + if (this.signedInGamer.IsGuest || Main.isTrial) + { + this.playerStorage = (StorageDeviceManager) null; + } + else + { + if (this.playerStorage == null) + { + this.playerStorage = new StorageDeviceManager((Game) UI.theGame, this.controller, 196608); + this.playerStorage.DeviceSelectorCanceled += new EventHandler(this.DeviceSelectorCanceled); + this.playerStorage.DeviceDisconnected += new EventHandler(this.DeviceDisconnected); + this.playerStorage.DeviceSelected += new EventHandler(this.DeviceSelected); + ((Collection) UI.theGame.Components).Add((IGameComponent) this.playerStorage); + } + if (this.playerStorage.Device != null) + return; + this.playerStorage.PromptForDevice(); + } + } + + public bool HasPlayerStorage() + { + if (this.playerStorage != null) + return this.playerStorage.Device != null; + else + return false; + } + + public bool CanViewGamerCard() + { + if (this.signedInGamer.IsSignedInToLive && this.signedInGamer.Privileges.AllowProfileViewing != GamerPrivilegeSetting.Blocked) + return !GuideExtensions.get_IsNetworkCableUnplugged(); + else + return false; + } + + public bool HasOnline() + { + if (!Main.isTrial && this.signedInGamer.IsSignedInToLive) + return !GuideExtensions.get_IsNetworkCableUnplugged(); + else + return false; + } + + public bool HasOnlineWithPrivileges() + { + if (!Main.isTrial && this.signedInGamer.IsSignedInToLive && this.signedInGamer.Privileges.AllowOnlineSessions) + return !GuideExtensions.get_IsNetworkCableUnplugged(); + else + return false; + } + + public static bool IsUserGeneratedContentAllowed() + { + GamerCollection gamerCollection = Netplay.session != null ? Netplay.session.RemoteGamers : (GamerCollection) null; + SignedInGamerCollection signedInGamers = Gamer.SignedInGamers; + for (int index1 = ((ReadOnlyCollection) signedInGamers).Count - 1; index1 >= 0; --index1) + { + SignedInGamer signedInGamer = ((ReadOnlyCollection) signedInGamers)[index1]; + if (!signedInGamer.IsGuest && signedInGamer.IsSignedInToLive) + { + if (signedInGamer.Privileges.AllowUserCreatedContent == GamerPrivilegeSetting.Blocked) + return false; + if (gamerCollection != null && signedInGamer.Privileges.AllowUserCreatedContent == GamerPrivilegeSetting.FriendsOnly) + { + for (int index2 = ((ReadOnlyCollection) gamerCollection).Count - 1; index2 >= 0; --index2) + { + NetworkGamer networkGamer = ((ReadOnlyCollection) gamerCollection)[index2]; + if (!signedInGamer.IsFriend((Gamer) networkGamer)) + return false; + } + } + } + } + return true; + } + + public bool CanPlayOnline() + { + if (this.HasOnlineWithPrivileges()) + return UI.IsUserGeneratedContentAllowed(); + else + return false; + } + + public bool CanCommunicate() + { + return this.signedInGamer.Privileges.AllowCommunication != GamerPrivilegeSetting.Blocked; + } + + public static bool AllPlayersCanPlayOnline() + { + if (!UI.IsUserGeneratedContentAllowed()) + return false; + for (int index = 0; index < 4; ++index) + { + UI ui = Main.ui[index]; + if (ui.signedInGamer != null && !ui.HasOnlineWithPrivileges()) + return false; + } + return true; + } + + public static void LoadContent(ContentManager Content) + { + Terraria.CreateCharacter.Assets.LoadContent(Content); + Terraria.SoundUI.Assets.LoadContent(Content); + Terraria.HowToPlay.Assets.LoadContent(Content); + Terraria.Leaderboards.Assets.LoadContent(Content); + UI.logoTexture = Content.Load("Images/Logo"); + UI.logo2Texture = Content.Load("Images/Logo2"); + UI.controlsTexture = Content.Load("UI/Controller_Layout01"); + UI.progressBarTexture = Content.Load("UI/ProgressBar"); + UI.textBackTexture = Content.Load("Images/Text_Back"); + UI.chatBackTexture = Content.Load("Images/Chat_Back"); + UI.cursorTexture = Content.Load("Images/Cursor"); + UI.LoadFonts(Content); + } + + public static void LoadFonts(ContentManager Content) + { + UI.fontBig = Content.Load("Fonts/big"); + UI.fontBig.Spacing = -24f; + UI.fontItemStack = Content.Load("Fonts/stack"); + UI.fontItemStack.Spacing = -4f; + UI.FONT_STACK_EXTRA_OFFSET = -5; + UI.fontCombatText[0] = Content.Load("Fonts/combat"); + UI.fontCombatText[0].Spacing = -3f; + UI.fontCombatText[1] = Content.Load("Fonts/combat2"); + UI.fontCombatText[1].Spacing = -4f; + UI.fontSmall = Content.Load("Fonts/small"); + UI.fontSmall.Spacing = -2f; + UI.fontSmall.LineSpacing = 20; + UI.fontSmallOutline = Content.Load("Fonts/small2"); + UI.fontSmallOutline.Spacing = -5f; + UI.fontSmallOutline.LineSpacing = 22; + UI.styleFontSmallOutline = new CompiledText.Style(UI.fontSmallOutline); + } + + public static void LoadSplitscreenFonts(ContentManager Content) + { + UI.fontBig = Content.Load("Fonts/big_sc"); + UI.fontBig.Spacing = -13f; + UI.fontBig.LineSpacing = 19; + UI.fontItemStack = Content.Load("Fonts/stack_sc"); + UI.fontItemStack.Spacing = -4f; + UI.FONT_STACK_EXTRA_OFFSET = -8; + UI.fontCombatText[0] = Content.Load("Fonts/combat_sc"); + UI.fontCombatText[0].Spacing = -2f; + UI.fontCombatText[1] = Content.Load("Fonts/combat2_sc"); + UI.fontCombatText[1].Spacing = -3f; + UI.fontSmall = Content.Load("Fonts/small_sc"); + UI.fontSmall.Spacing = -2f; + UI.fontSmall.LineSpacing = 10; + UI.fontSmallOutline = Content.Load("Fonts/small2_sc"); + UI.fontSmallOutline.Spacing = -2f; + UI.fontSmallOutline.LineSpacing = 13; + UI.styleFontSmallOutline = new CompiledText.Style(UI.fontSmallOutline); + } + + private void InvalidateCachedText() + { + UI.toolTipText = (string) null; + this.npcCompiledChatText = (string) null; + UI.errorCompiledText = (CompiledText) null; + Terraria.HowToPlay.UI.GenerateCache(UI.theGame.GraphicsDevice); + TextSequenceBlock.GenerateCache(UI.theGame.GraphicsDevice); + } + + public static float Spacing(SpriteFont font) + { + float spacing = font.Spacing; + if (UI.numActiveViews > 1) + spacing *= 2f; + return spacing; + } + + public static int LineSpacing(SpriteFont font) + { + int lineSpacing = font.LineSpacing; + if (UI.numActiveViews > 1) + lineSpacing <<= 1; + return lineSpacing; + } + + public static Vector2 MeasureString(SpriteFont font) + { + Vector2 vector2 = font.MeasureString(Main.strBuilder); + if (UI.numActiveViews > 1) + { + vector2.X *= 2f; + vector2.Y *= 2f; + } + return vector2; + } + + public static float MeasureStringX(SpriteFont font) + { + float num = font.MeasureString(Main.strBuilder).X; + if (UI.numActiveViews > 1) + num *= 2f; + return num; + } + + public static Vector2 MeasureString(SpriteFont font, string text) + { + Vector2 vector2 = font.MeasureString(text); + if (UI.numActiveViews > 1) + { + vector2.X *= 2f; + vector2.Y *= 2f; + } + return vector2; + } + + public static void DrawStringLB(SpriteFont font, int x, int y) + { + Vector2 vector2 = font.MeasureString(Main.strBuilder); + Main.spriteBatch.DrawString(font, Main.strBuilder, new Vector2((float) x, (float) (540 - y)), Color.White, 0.0f, new Vector2(0.0f, vector2.Y), UI.numActiveViews > 1 ? 2f : 1f, SpriteEffects.None, 0.0f); + } + + public static void DrawStringLT(SpriteFont font, int x, int y, Color c) + { + Main.spriteBatch.DrawString(font, Main.strBuilder, new Vector2((float) x, (float) y), c, 0.0f, new Vector2(), UI.numActiveViews > 1 ? 2f : 1f, SpriteEffects.None, 0.0f); + } + + public static void DrawStringLT(SpriteFont font, string s, int x, int y, Color c) + { + Main.spriteBatch.DrawString(font, s, new Vector2((float) x, (float) y), c, 0.0f, new Vector2(), UI.numActiveViews > 1 ? 2f : 1f, SpriteEffects.None, 0.0f); + } + + public static void DrawStringScaled(SpriteFont font, string s, Vector2 pos, Color c, Vector2 pivot, float scale) + { + if (UI.numActiveViews > 1) + { + scale *= 2f; + pivot.X *= 0.5f; + pivot.Y *= 0.5f; + } + Main.spriteBatch.DrawString(font, s, pos, c, 0.0f, pivot, scale, SpriteEffects.None, 0.0f); + } + + public static void DrawString(SpriteFont font, string s, Vector2 pos, Color c, float rot, Vector2 pivot, float scale) + { + if (UI.numActiveViews > 1) + { + scale *= 2f; + pivot.X *= 0.5f; + pivot.Y *= 0.5f; + } + Main.spriteBatch.DrawString(font, s, pos, c, rot, pivot, scale, SpriteEffects.None, 0.0f); + } + + public static void DrawStringScaled(SpriteFont font, Vector2 pos, Color c, Vector2 pivot, float scale) + { + if (UI.numActiveViews > 1) + { + scale *= 2f; + pivot.X *= 0.5f; + pivot.Y *= 0.5f; + } + Main.spriteBatch.DrawString(font, Main.strBuilder, pos, c, 0.0f, pivot, scale, SpriteEffects.None, 0.0f); + } + + public static void DrawStringCC(SpriteFont font, string s, int x, int y, Color c) + { + float scale = UI.numActiveViews > 1 ? 2f : 1f; + Vector2 origin = font.MeasureString(s); + origin.X = (float) Math.Round((double) origin.X * 0.5); + origin.Y = (float) Math.Round((double) origin.Y * 0.5); + Main.spriteBatch.DrawString(font, s, new Vector2((float) x, (float) y), c, 0.0f, origin, scale, SpriteEffects.None, 0.0f); + } + + public static void DrawStringLC(SpriteFont font, string s, int x, int y, Color c) + { + float scale = UI.numActiveViews > 1 ? 2f : 1f; + Vector2 origin = font.MeasureString(s); + origin.X = 0.0f; + origin.Y = (float) Math.Round((double) origin.Y * 0.5); + Main.spriteBatch.DrawString(font, s, new Vector2((float) x, (float) y), c, 0.0f, origin, scale, SpriteEffects.None, 0.0f); + } + + public static void DrawStringRC(SpriteFont font, string s, int x, int y, Color c) + { + float scale = UI.numActiveViews > 1 ? 2f : 1f; + Vector2 origin = font.MeasureString(s); + origin.Y = (float) Math.Round((double) origin.Y * 0.5); + Main.spriteBatch.DrawString(font, s, new Vector2((float) x, (float) y), c, 0.0f, origin, scale, SpriteEffects.None, 0.0f); + } + + public static float DrawStringCT(SpriteFont font, string s, int x, int y, Color c) + { + float scale = UI.numActiveViews > 1 ? 2f : 1f; + Vector2 origin = font.MeasureString(s); + origin.X = (float) Math.Round((double) origin.X * 0.5); + float num = origin.Y * scale; + origin.Y = 0.0f; + Main.spriteBatch.DrawString(font, s, new Vector2((float) x, (float) y), c, 0.0f, origin, scale, SpriteEffects.None, 0.0f); + return num; + } + + public static float DrawStringCT(SpriteFont font, int x, int y, Color c) + { + float num1 = UI.numActiveViews > 1 ? 2f : 1f; + Vector2 vector2 = font.MeasureString(Main.strBuilder); + vector2.X *= 0.5f; + float num2 = vector2.Y * num1; + vector2.Y = 0.0f; + Main.spriteBatch.DrawString(font, Main.strBuilder, new Vector2((float) x, (float) y), c, 0.0f, vector2, num1, SpriteEffects.None, 0.0f); + return num2; + } + + public void PrevMenu(int depth = -1) + { + Main.PlaySound(11); + if (depth < 0) + { + this.menuDepth += depth; + if (this.menuDepth >= 0) + this.SetMenu(this.prevMenuMode[this.menuDepth], false, false); + else + this.SetMenu(MenuMode.TITLE, false, true); + } + else if (depth < this.menuDepth) + { + this.menuDepth = depth; + this.SetMenu(this.prevMenuMode[depth], false, false); + } + else + this.SetMenu(MenuMode.TITLE, false, true); + } + + private void ResetPlayerMenuSelection() + { + this.uiX = (short) 0; + this.uiY = (int) this.numLoadPlayers > 0 ? (short) 0 : (short) 5; + } + + public void SetMenu(MenuMode mode, bool rememberPrevious = true, bool reset = false) + { + if (this.settingsDirty) + this.SaveSettings(); + this.numMenuItems = (byte) 0; + if (reset) + this.menuDepth = 0; + if (mode == MenuMode.TITLE) + { + Main.SetTutorial(Tutorial.NUM_TUTORIALS); + if (!Main.isTrial && UI.saveIconMessage == null) + { + UI.saveIconMessage = new CompiledText(Lang.menu[4], 470, UI.styleFontSmallOutline, CompiledText.MarkupType.Html); + UI.saveIconMessageTime = 480; + } + if (this.signedInGamer != null) + GamerPresenceExtensions.SetPresenceModeString(this.signedInGamer.Presence, "Menu"); + if (Netplay.isJoiningRemoteInvite) + { + if (Netplay.gamersWaitingToJoinInvite.Contains(this.signedInGamer)) + { + mode = MenuMode.CHARACTER_SELECT; + if (this == UI.main) + { + for (int index = Netplay.gamersWaitingToJoinInvite.Count - 1; index >= 0; --index) + { + SignedInGamer signedInGamer = Netplay.gamersWaitingToJoinInvite[index]; + if (signedInGamer != this.signedInGamer) + { + UI ui = Main.ui[(int) signedInGamer.PlayerIndex]; + ui.SetMenu(MenuMode.CHARACTER_SELECT, false, true); + ui.OpenView(); + } + } + } + } + else + { + this.Exit(); + return; + } + } + } + if (this.menuMode != MenuMode.NONE) + { + for (int index = this.menuHC.Length - 1; index >= 0; --index) + this.menuHC[index] = (byte) 0; + if (rememberPrevious) + this.prevMenuMode[this.menuDepth++] = this.menuMode; + this.uiPos[(int) this.menuMode].X = this.uiX; + this.uiPos[(int) this.menuMode].Y = this.uiY; + } + this.menuMode = mode; + this.uiX = this.uiPos[(int) mode].X; + this.uiY = this.uiPos[(int) mode].Y; + this.uiDelay = (sbyte) 0; + this.uiDelayValue = (sbyte) 12; + switch (mode) + { + case MenuMode.PAUSE: + this.worldFadeTarget = 0.375f; + this.uiWidth = (sbyte) 1; + this.uiHeight = (sbyte) 7; + this.uiCoords = UI.MENU_PAUSE_COORDS; + return; + case MenuMode.MAP: + this.worldFadeTarget = 0.375f; + this.uiFade = 0.0f; + this.uiFadeTarget = 1f; + break; + case MenuMode.TITLE: + this.uiWidth = (sbyte) 1; + this.uiHeight = (sbyte) 7; + this.uiCoords = UI.MENU_TITLE_COORDS; + return; + case MenuMode.CHARACTER_SELECT: + this.uiWidth = (sbyte) 1; + this.uiHeight = (sbyte) 6; + this.uiCoords = UI.MENU_SELECT_COORDS; + this.initCharacterSelectCoordinates(); + return; + case MenuMode.CONFIRM_LEAVE_CREATE_CHARACTER: + case MenuMode.CONFIRM_DELETE_CHARACTER: + case MenuMode.CONFIRM_DELETE_WORLD: + this.uiWidth = (sbyte) 1; + this.uiHeight = (sbyte) 2; + this.uiCoords = UI.MENU_CONFIRM_DELETE_COORDS; + return; + case MenuMode.WORLD_SELECT: + if (Netplay.availableSessions.Count == 0 && !Netplay.IsFindingSessions()) + { + Netplay.FindSessions(); + break; + } + else + break; + case MenuMode.WORLD_SIZE: + this.uiWidth = (sbyte) 1; + this.uiHeight = (sbyte) 3; + this.uiCoords = UI.MENU_WORLD_SIZE_COORDS; + return; + case MenuMode.STATUS_SCREEN: + case MenuMode.NETPLAY: + this.progress = 0.0f; + this.progressTotal = 0.0f; + this.uiWidth = (sbyte) 0; + this.uiHeight = (sbyte) 1; + this.uiCoords = (Location[]) null; + this.statusText = (string) null; + return; + case MenuMode.OPTIONS: + this.uiWidth = (sbyte) 1; + this.uiHeight = (sbyte) 4; + this.uiCoords = UI.MENU_OPTIONS_COORDS; + return; + case MenuMode.SETTINGS: + this.uiWidth = (sbyte) 1; + this.uiHeight = (sbyte) 3; + this.uiCoords = UI.MENU_SETTINGS_COORDS; + return; + case MenuMode.VOLUME: + this.soundUI.UpdateVolumes(); + break; + case MenuMode.ERROR: + if (Main.worldGenThread != null) + { + Main.worldGenThread.Abort(); + Main.worldGenThread = (Thread) null; + WorldGen.gen = false; + break; + } + else + break; + case MenuMode.CREDITS: + Credits.Init(); + break; + case MenuMode.QUIT: + MessageBox.Show(this.controller, Lang.menu[15], Lang.inter[35], new string[2] + { + Lang.menu[105], + Lang.menu[104] + }, 0 != 0); + break; + case MenuMode.UPSELL: + UI.theGame.LoadUpsell(); + break; + } + this.uiWidth = (sbyte) 0; + this.uiHeight = (sbyte) 0; + this.uiCoords = (Location[]) null; + } + + private void Exit() + { + if (UI.numActiveViews == 1) + { + if (Main.isTrial) + this.SetMenu(MenuMode.UPSELL, false, true); + else + UI.quit = true; + } + else + { + this.setPlayer((Player) null); + this.signedInGamer = (SignedInGamer) null; + this.menuType = MenuType.MAIN; + this.menuMode = MenuMode.WELCOME; + this.selectedMenu = (sbyte) -1; + this.focusMenu = (sbyte) -1; + this.uiX = (short) 0; + this.uiY = (short) 0; + this.uiPos = new Location[38]; + this.worldFade = 0.0f; + this.worldFadeTarget = 1f; + this.isStopping = false; + if (this.playerStorage == null || Netplay.isJoiningRemoteInvite) + return; + ((Collection) UI.theGame.Components).Remove((IGameComponent) this.playerStorage); + this.playerStorage.Dispose(); + this.playerStorage = (StorageDeviceManager) null; + } + } + + public void ExitGame() + { + Main.isGameStarted = false; + for (int index = 0; index < 4; ++index) + { + UI ui = Main.ui[index]; + if (ui.view != null && ui.menuType != MenuType.MAIN) + ui.view.onStopGame(); + } + for (int index = 0; index < 4; ++index) + { + UI ui = Main.ui[index]; + if (ui.view != null && ui != UI.main) + { + if (ui.menuType == MenuType.MAIN) + ui.Exit(); + else + ui.StopGame(); + } + } + UI.main.StopGame(); + } + + public void StopGame() + { + this.CloseInventory(); + this.inventorySection = UI.InventorySection.ITEMS; + this.hotbarItemNameTime = 210; + this.quickAccessDisplayTime = 0; + this.quickAccessUp = (sbyte) -1; + this.quickAccessDown = (sbyte) -1; + this.quickAccessLeft = (sbyte) -1; + this.quickAccessRight = (sbyte) -1; + this.isStopping = true; + this.worldFadeTarget = 1f; + this.statusText = !Main.saveOnExit ? "" : Lang.menu[54]; + if (this.menuMode != MenuMode.ERROR) + this.SetMenu(MenuMode.STATUS_SCREEN, false, false); + this.menuType = MenuType.MAIN; + if (this == UI.main) + { + if (Main.saveOnExit) + { + Main.saveOnExit = false; + WorldGen.SaveAndQuit(); + } + else + { + Netplay.disconnect = true; + this.LoadPlayers(); + if (this.menuMode == MenuMode.ERROR) + return; + this.SetMenu(MenuMode.TITLE, false, true); + } + } + else + { + if (Main.saveOnExit) + return; + this.Exit(); + } + } + + public void PrepareDraw(int pass) + { + if (this.view == null || this.menuType == MenuType.MAIN) + return; + UI.current = this; + this.view.PrepareDraw(pass); + } + + public void Draw() + { + if (this.view == null) + return; + UI.current = this; + this.view.DrawBg(this); + if (this.menuType != MenuType.MAIN) + { + this.view.DrawWorld(); + this.DrawCursor(); + this.view.SetScreenView(); + } + this.DrawTopLayer(); + if (this.menuType != MenuType.NONE) + this.DrawMenu(); + else if (Main.tutorialState < Tutorial.THE_END) + this.DrawTutorial(); + Main.spriteBatch.End(); + } + + private void DrawTopLayer() + { + if ((double) this.worldFade < 1.0) + Main.DrawSolidRect(new Rectangle(-1, -1, (int) this.view.viewWidth, 540), new Color(0.0f, 0.0f, 0.0f, 1f - this.worldFade)); + if ((double) this.worldFade != (double) this.worldFadeTarget) + { + if ((double) this.worldFadeTarget < (double) this.worldFade) + { + this.worldFade -= 0.03333334f; + if ((double) this.worldFadeTarget > (double) this.worldFade) + this.worldFade = this.worldFadeTarget; + } + else + { + this.worldFade += 0.03333334f; + if ((double) this.worldFadeTarget < (double) this.worldFade) + this.worldFade = this.worldFadeTarget; + } + } + if (this.menuType != MenuType.NONE) + return; + this.DrawInterface(); + if ((int) this.inventoryMode != 0 || this.player.ghost) + return; + this.DrawHud(); + } + + private void DrawTutorial() + { + this.DrawDialog(new Vector2((float) ((int) this.view.viewWidth - UI.chatBackTexture.Width >> 1), (float) (540 - this.view.SAFE_AREA_OFFSET_B - 36)), new Color(128, 128, 128, 64), new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue), Main.tutorialText, (string) null, true); + } + + private void UpdateMenu() + { + MenuMode menuMode = this.menuMode; + this.numMenuItems = (byte) 0; + this.menuTop = (short) 250; + this.menuLeft = this.view != null ? (short) ((int) this.view.viewWidth >> 1) : (short) 480; + this.menuSpace = (byte) 80; + this.showPlayer = (sbyte) -1; + for (int index = 0; index < 14; ++index) + { + this.noFocus[index] = false; + this.blockFocus[index] = false; + this.menuY[index] = (short) 0; + this.menuScale[index] = 1f; + } + if (this.menuMode == MenuMode.ERROR) + { + this.numMenuItems = (byte) 0; + if (this.IsBackButtonTriggered()) + this.SetMenu(MenuMode.TITLE, false, true); + } + else if (this.menuMode == MenuMode.LOAD_FAILED_NO_BACKUP) + { + this.numMenuItems = (byte) 1; + this.menuString[0] = Lang.menu[9]; + this.noFocus[0] = true; + this.menuTop = (short) 300; + if (this.IsBackButtonTriggered()) + this.PrevMenu(-1); + } + else if (this.menuMode == MenuMode.STATUS_SCREEN) + { + this.numMenuItems = (byte) 1; + this.menuString[0] = this.statusText; + this.noFocus[0] = true; + this.menuTop = (short) 175; + this.tips.Update(); + } + else if (this.menuMode == MenuMode.NETPLAY) + { + this.numMenuItems = (byte) 1; + this.menuString[0] = this.statusText; + this.noFocus[0] = true; + this.menuTop = (short) 175; + this.tips.Update(); + if (this.IsBackButtonTriggered()) + { + if (Netplay.sessionThread != null) + Netplay.disconnect = true; + this.PrevMenu(-1); + } + else if (Netplay.sessionThread == null) + { + bool flag = true; + for (int index = 0; index < 4; ++index) + { + UI ui = Main.ui[index]; + if (ui.view != null && ui.menuMode != MenuMode.NETPLAY) + { + flag = false; + break; + } + } + if (flag) + Netplay.StartClient(); + } + } + else if (this.menuMode == MenuMode.WAITING_SCREEN) + { + this.numMenuItems = (byte) 1; + this.menuString[0] = Lang.menu[51]; + this.noFocus[0] = true; + this.menuTop = (short) 300; + if (this.IsBackButtonTriggered()) + this.PrevMenu(-1); + else if (Main.isGameStarted && !Main.isGamePaused) + { + if (Netplay.session == null) + { + this.Exit(); + return; + } + else if (((ReadOnlyCollection) Netplay.session.AllGamers).Count < 8) + { + int privateGamerSlots = Netplay.session.PrivateGamerSlots; + if (privateGamerSlots > 0) + { + if (Main.netMode != 1) + { + --Netplay.session.PrivateGamerSlots; + } + else + { + NetMessage.CreateMessage0(66); + NetMessage.SendMessage(); + this.privateSlots = (byte) privateGamerSlots; + this.SetMenu(MenuMode.WAITING_FOR_PUBLIC_SLOT, false, false); + return; + } + } + try + { + Netplay.session.AddLocalGamer(this.signedInGamer); + this.SetMenu(MenuMode.WAITING_FOR_PLAYER_ID, false, false); + } + catch + { + this.Exit(); + return; + } + } + else + this.menuString[0] = Lang.gen[57]; + } + } + else if (this.menuMode == MenuMode.WAITING_FOR_PUBLIC_SLOT) + { + this.numMenuItems = (byte) 1; + this.menuString[0] = Lang.menu[51]; + this.noFocus[0] = true; + this.menuTop = (short) 300; + if (Netplay.session.PrivateGamerSlots < (int) this.privateSlots) + { + try + { + Netplay.session.AddLocalGamer(this.signedInGamer); + this.SetMenu(MenuMode.WAITING_FOR_PLAYER_ID, false, false); + } + catch + { + this.Exit(); + return; + } + } + else if (this.IsBackButtonTriggered()) + { + NetMessage.CreateMessage0(67); + NetMessage.SendMessage(); + this.PrevMenu(-1); + } + } + else if (this.menuMode == MenuMode.WAITING_FOR_PLAYER_ID) + { + this.numMenuItems = (byte) 1; + this.menuString[0] = Lang.menu[51]; + this.noFocus[0] = true; + this.menuTop = (short) 300; + if (this.IsBackButtonTriggered()) + this.PrevMenu(-1); + } + else if (this.menuMode == MenuMode.LEADERBOARDS) + { + if (this.IsBackButtonTriggered()) + this.PrevMenu(-1); + else + this.leaderboards.Update(); + } + else if (this.menuMode == MenuMode.TITLE) + { + if (UI.main != this) + { + this.Exit(); + return; + } + else + { + this.menuTop = (short) 172; + this.menuSpace = (byte) 42; + this.menuString[0] = Lang.menu[13]; + this.menuString[1] = Lang.menu[89]; + this.menuString[2] = Lang.menu[106]; + this.menuString[3] = Lang.menu[107]; + this.menuString[4] = Lang.menu[108]; + if (!Main.isTrial) + { + UI.MENU_TITLE_COORDS[0].X = (short) 480; + this.menuHC[0] = (byte) 0; + } + else + { + UI.MENU_TITLE_COORDS[0].X = (short) 0; + this.menuHC[0] = (byte) 3; + if ((int) this.uiY == 0) + this.uiY = (short) 1; + } + if (!this.signedInGamer.IsGuest && this.HasOnline()) + { + UI.MENU_TITLE_COORDS[2].X = (short) 480; + this.menuHC[2] = (byte) 0; + } + else + { + UI.MENU_TITLE_COORDS[2].X = (short) 0; + this.menuHC[2] = (byte) 3; + if ((int) this.uiY == 2) + this.uiY = (short) 3; + } + if (!this.signedInGamer.IsGuest && !Main.isTrial) + { + UI.MENU_TITLE_COORDS[3].X = (short) 480; + this.menuHC[3] = (byte) 0; + } + else + { + UI.MENU_TITLE_COORDS[3].X = (short) 0; + this.menuHC[3] = (byte) 3; + if ((int) this.uiY == 3) + this.uiY = (short) 4; + } + if (Main.isTrial) + { + this.menuString[5] = Lang.menu[109]; + if (this.signedInGamer.Privileges.AllowPurchaseContent) + { + UI.MENU_TITLE_COORDS[5].X = (short) 480; + this.menuHC[5] = (byte) 0; + } + else + { + UI.MENU_TITLE_COORDS[5].X = (short) 0; + this.menuHC[5] = (byte) 3; + if ((int) this.uiY == 5) + this.uiY = (short) 6; + } + this.menuString[6] = Lang.menu[15]; + this.numMenuItems = (byte) 7; + UI.MENU_TITLE_COORDS[6].X = (short) 480; + } + else + { + this.menuString[5] = Lang.menu[15]; + this.numMenuItems = (byte) 6; + UI.MENU_TITLE_COORDS[6].X = (short) 0; + } + for (int index = (int) this.numMenuItems - 1; index >= 0; --index) + this.menuScale[index] = 0.75f; + if ((int) this.selectedMenu == 0) + { + Main.PlaySound(10); + this.SetMenu(MenuMode.CHARACTER_SELECT, true, false); + this.ResetPlayerMenuSelection(); + } + else if ((int) this.selectedMenu == 1) + { + Main.PlaySound(10); + this.SetMenu(MenuMode.STATUS_SCREEN, true, false); + Main.StartTutorial(); + } + else if ((int) this.selectedMenu == 2) + { + Main.PlaySound(10); + this.SetMenu(MenuMode.LEADERBOARDS, true, false); + this.leaderboards.InitializeData(); + } + else if ((int) this.selectedMenu == 3) + this.ShowAchievements(); + else if ((int) this.selectedMenu == 4) + { + Main.PlaySound(10); + this.SetMenu(MenuMode.OPTIONS, true, false); + } + else if ((int) this.selectedMenu == 5) + { + if (Main.isTrial) + { + if (!Guide.IsVisible) + { + bool flag; + do + { + flag = false; + try + { + GuideExtensions.ShowMarketplace(this.controller, 6359384554213474305UL); + } + catch (GuideAlreadyVisibleException ex) + { + Thread.Sleep(32); + flag = true; + } + } + while (flag); + } + } + else + this.SetMenu(MenuMode.QUIT, true, false); + } + else if ((int) this.selectedMenu == 6) + this.SetMenu(MenuMode.QUIT, true, false); + else if (this.IsButtonTriggered(Buttons.X)) + { + if (this.playerStorage != null) + this.playerStorage.PromptForDevice(); + } + else if (this.IsButtonTriggered(Buttons.Y)) + this.ShowParty(); + } + } + else if (this.menuMode == MenuMode.PAUSE) + { + this.menuString[0] = Lang.menu[112]; + int index1 = 1; + if (Main.isTrial) + { + this.menuString[index1] = Lang.menu[109]; + if (this.signedInGamer.Privileges.AllowPurchaseContent) + { + UI.MENU_PAUSE_COORDS[index1].X = (short) 480; + this.menuHC[index1] = (byte) 0; + } + else + { + UI.MENU_PAUSE_COORDS[index1].X = (short) 0; + this.menuHC[index1] = (byte) 3; + if ((int) this.uiY == index1) + this.uiY = (short) 0; + } + ++index1; + this.numMenuItems = (byte) 7; + UI.MENU_PAUSE_COORDS[6].X = (short) 480; + } + else + { + this.numMenuItems = (byte) 6; + UI.MENU_PAUSE_COORDS[6].X = (short) 0; + } + if (!this.HasOnline()) + { + UI.MENU_PAUSE_COORDS[index1 + 1].X = (short) 0; + this.menuHC[index1 + 1] = (byte) 3; + if ((int) this.uiY == index1 + 1) + this.uiY = (short) 0; + } + else + { + UI.MENU_PAUSE_COORDS[index1 + 1].X = (short) 480; + this.menuHC[index1 + 1] = (byte) 0; + } + if (this.signedInGamer.IsGuest || Main.isTrial) + { + UI.MENU_PAUSE_COORDS[index1 + 2].X = (short) 0; + this.menuHC[index1 + 2] = (byte) 3; + if ((int) this.uiY == index1 + 2) + this.uiY = (short) 0; + } + else + { + UI.MENU_PAUSE_COORDS[index1 + 2].X = (short) 480; + this.menuHC[index1 + 2] = (byte) 0; + } + if (WorldGen.saveLock || Main.IsTutorial() || !this.HasPlayerStorage()) + { + UI.MENU_PAUSE_COORDS[index1 + 3].X = (short) 0; + this.menuHC[index1 + 3] = (byte) 3; + if ((int) this.uiY == index1 + 3) + this.uiY = (short) 0; + } + else + { + UI.MENU_PAUSE_COORDS[index1 + 3].X = (short) 480; + this.menuHC[index1 + 3] = (byte) 0; + } + if (WorldGen.saveLock) + { + UI.MENU_PAUSE_COORDS[index1 + 4].X = (short) 0; + this.menuHC[index1 + 4] = (byte) 3; + if ((int) this.uiY == index1 + 4) + this.uiY = (short) 0; + } + else + { + UI.MENU_PAUSE_COORDS[index1 + 4].X = (short) 480; + this.menuHC[index1 + 4] = (byte) 0; + } + this.menuString[index1] = Lang.menu[108]; + this.menuString[index1 + 1] = Lang.menu[106]; + this.menuString[index1 + 2] = Lang.menu[107]; + this.menuString[index1 + 3] = Lang.menu[99]; + this.menuString[index1 + 4] = Lang.menu[101]; + for (int index2 = 0; index2 < (int) this.numMenuItems; ++index2) + this.menuScale[index2] = 0.75f; + this.menuTop = (short) 200; + this.menuSpace = (byte) 40; + if ((int) this.selectedMenu == 0 || this.IsButtonUntriggered(Buttons.Start) || this.IsBackButtonTriggered()) + this.ResumeGame(); + else if (Main.netMode == 1 && this.IsButtonTriggered(Buttons.RightShoulder)) + { + MessageBox.Show(this.controller, Lang.inter[72], Lang.inter[73], new string[2] + { + Lang.menu[105], + Lang.menu[104] + }, 0 != 0); + this.SetMenu(MenuMode.BLACKLIST, true, false); + } + else if (index1 > 1 && (int) this.selectedMenu == 1) + { + if (!Guide.IsVisible) + { + bool flag; + do + { + flag = false; + try + { + GuideExtensions.ShowMarketplace(this.controller, 6359384554213474305UL); + } + catch (GuideAlreadyVisibleException ex) + { + Thread.Sleep(32); + flag = true; + } + } + while (flag); + } + } + else if ((int) this.selectedMenu == index1) + { + Main.PlaySound(10); + this.SetMenu(MenuMode.OPTIONS, true, false); + } + else if ((int) this.selectedMenu == index1 + 1) + { + Main.PlaySound(10); + this.SetMenu(MenuMode.LEADERBOARDS, true, false); + this.leaderboards.InitializeData(); + } + else if ((int) this.selectedMenu == index1 + 2) + this.ShowAchievements(); + else if ((int) this.selectedMenu == index1 + 3) + { + Main.PlaySound(10); + WorldGen.saveAllWhilePlaying(); + } + else if ((int) this.selectedMenu == index1 + 4) + { + Main.PlaySound(10); + Main.saveOnExit = !Main.IsTutorial() && this.autoSave && UI.IsStorageEnabledForAnyPlayer(); + if (!Main.saveOnExit && !Main.IsTutorial()) + { + string[] options; + if (UI.IsStorageEnabledForAnyPlayer()) + options = new string[3] + { + Lang.inter[0], + Lang.inter[1], + Lang.inter[2] + }; + else + options = new string[2] + { + Lang.inter[0], + Lang.inter[1] + }; + MessageBox.Show(this.controller, Lang.menu[100], Lang.inter[5], options, false); + } + this.SetMenu(MenuMode.EXIT, true, false); + } + } + else if (this.menuMode == MenuMode.EXIT) + { + if (MessageBox.IsVisible()) + { + if (!MessageBox.IsAutoUpdate() && MessageBox.Update()) + { + int result = MessageBox.GetResult(); + if (result <= 0) + this.PrevMenu(-1); + else + Main.saveOnExit = result == 2; + } + } + else + this.ExitGame(); + } + else if (this.menuMode == MenuMode.EXIT_UGC_BLOCKED) + { + if (MessageBox.IsVisible()) + { + if (!MessageBox.IsAutoUpdate() && MessageBox.Update()) + Main.saveOnExit = MessageBox.GetResult() != 1; + } + else + this.ExitGame(); + } + else if (this.menuMode == MenuMode.BLACKLIST) + { + if (MessageBox.IsVisible() && !MessageBox.IsAutoUpdate() && MessageBox.Update()) + { + if (MessageBox.GetResult() <= 0) + { + this.PrevMenu(-1); + } + else + { + this.blacklist.Add(Main.GetWorldId()); + this.SaveSettings(); + this.ExitGame(); + } + } + } + else if (this.menuMode == MenuMode.BLACKLIST_REMOVE) + { + if (MessageBox.IsVisible() && !MessageBox.IsAutoUpdate() && MessageBox.Update()) + { + if (MessageBox.GetResult() <= 0) + { + if (this.menuType == MenuType.MAIN) + { + this.Exit(); + return; + } + else + this.ExitGame(); + } + else + { + this.blacklist.Remove(Main.GetWorldId()); + this.settingsDirty = true; + this.PrevMenu(-1); + if (this.menuType != MenuType.MAIN) + this.menuType = MenuType.NONE; + Main.checkWorldId = true; + } + } + } + else if (this.menuMode == MenuMode.MAP) + { + if (this.miniMap.isThreadDone) + { + if (this.IsBackButtonTriggered()) + { + this.miniMap.DestroyMap(); + this.ResumeGame(); + } + else + this.miniMap.UpdateMap(this); + } + } + else if (this.menuMode == MenuMode.CHARACTER_SELECT) + { + this.menuLeft += (short) 80; + this.menuTop = (short) 200; + this.menuSpace = (byte) 40; + for (int index = 0; index < 5; ++index) + { + if (index < (int) this.numLoadPlayers) + { + this.menuString[index] = this.loadPlayer[index].characterName; + this.menuHC[index] = this.loadPlayer[index].difficulty; + UI.MENU_SELECT_COORDS[index].X = (short) 480; + } + else + { + this.menuString[index] = (string) null; + UI.MENU_SELECT_COORDS[index].X = (short) 0; + } + } + if ((int) this.numLoadPlayers == 5) + { + this.blockFocus[5] = true; + this.menuString[5] = (string) null; + UI.MENU_SELECT_COORDS[5].X = (short) 0; + } + else + { + this.menuString[5] = Lang.menu[16]; + UI.MENU_SELECT_COORDS[5].X = (short) 480; + } + this.numMenuItems = (byte) 6; + for (int index = 0; index < 6; ++index) + this.menuScale[index] = 0.8f; + if (this.IsBackButtonTriggered() && (Netplay.gamersWhoReceivedInvite.Count < 2 || !Netplay.gamersWhoReceivedInvite.Contains(this.signedInGamer))) + { + UI.CancelInvite(this.signedInGamer); + this.SetMenu(MenuMode.TITLE, false, true); + } + else if ((int) this.selectedMenu == 5) + { + Main.PlaySound(10); + this.loadPlayer[(int) this.numLoadPlayers] = new Player(); + this.loadPlayer[(int) this.numLoadPlayers].characterName = this.signedInGamer.Gamertag; + this.loadPlayer[(int) this.numLoadPlayers].inventory[0].SetDefaults("Copper Shortsword"); + this.loadPlayer[(int) this.numLoadPlayers].inventory[0].Prefix(-1); + this.loadPlayer[(int) this.numLoadPlayers].inventory[1].SetDefaults("Copper Pickaxe"); + this.loadPlayer[(int) this.numLoadPlayers].inventory[1].Prefix(-1); + this.loadPlayer[(int) this.numLoadPlayers].inventory[2].SetDefaults("Copper Axe"); + this.loadPlayer[(int) this.numLoadPlayers].inventory[2].Prefix(-1); + this.createCharacterGUI.ApplyDefaultAttributes(this.loadPlayer[(int) this.numLoadPlayers]); + this.SetMenu(MenuMode.CREATE_CHARACTER, true, false); + } + else if ((int) this.selectedMenu >= 0) + { + Main.PlaySound(10); + this.selectedPlayer = this.selectedMenu; + this.setPlayer(this.loadPlayer[(int) this.selectedPlayer].DeepCopy()); + this.playerPathName = this.loadPlayerPath[(int) this.selectedPlayer]; + if (Netplay.isJoiningRemoteInvite) + { + this.SetMenu(MenuMode.NETPLAY, true, false); + this.statusText = Lang.menu[75]; + } + else if (this != UI.main) + this.SetMenu(MenuMode.WAITING_SCREEN, true, false); + else + this.SetMenu(MenuMode.WORLD_SELECT, true, false); + } + else if ((int) this.focusMenu >= 0 && (int) this.focusMenu < (int) this.numLoadPlayers) + { + if (this.IsButtonTriggered(Buttons.X)) + { + this.selectedPlayer = this.focusMenu; + Main.PlaySound(10); + this.SetMenu(MenuMode.CONFIRM_DELETE_CHARACTER, true, false); + } + else + this.showPlayer = this.focusMenu; + } + } + else if (this.menuMode == MenuMode.CREATE_CHARACTER) + this.createCharacterGUI.Update(this.loadPlayer[(int) this.numLoadPlayers]); + else if (this.menuMode == MenuMode.CONFIRM_LEAVE_CREATE_CHARACTER) + { + this.menuString[0] = Lang.menu[49]; + this.noFocus[0] = true; + this.menuString[1] = Lang.menu[104]; + this.menuString[2] = Lang.menu[105]; + this.numMenuItems = (byte) 3; + if ((int) this.selectedMenu == 1) + this.PrevMenu(-2); + else if ((int) this.selectedMenu == 2 || this.IsBackButtonTriggered()) + this.PrevMenu(-1); + } + else if (this.menuMode == MenuMode.NAME_CHARACTER) + { + string str = this.GetInputText((UserString) this.loadPlayer[(int) this.numLoadPlayers].characterName, Lang.menu[53], Lang.menu[45], false).text; + this.numMenuItems = (byte) 0; + if (this.inputTextEnter) + { + if (this.inputTextCanceled || str.Length == 0) + { + this.PrevMenu(-1); + } + else + { + Main.PlaySound(10); + if (str.Length > 16) + str = str.Substring(0, 16); + Player player = this.loadPlayer[(int) this.numLoadPlayers]; + player.characterName = str; + player.ui = this; + this.loadPlayerPath[(int) this.numLoadPlayers] = this.nextLoadPlayer(); + player.Save(this.loadPlayerPath[(int) this.numLoadPlayers]); + this.PrevMenu(-2); + this.selectedPlayer = this.numLoadPlayers; + this.showPlayer = this.numLoadPlayers; + this.uiY = (short) this.numLoadPlayers; + UI.MENU_SELECT_COORDS[(int) this.uiY].X = (short) 480; + ++this.numLoadPlayers; + } + } + } + else if (this.menuMode == MenuMode.CONFIRM_DELETE_CHARACTER) + { + this.menuString[0] = Lang.menu[46] + this.loadPlayer[(int) this.selectedPlayer].name + "?"; + this.noFocus[0] = true; + this.menuString[1] = Lang.menu[104]; + this.menuString[2] = Lang.menu[105]; + this.numMenuItems = (byte) 3; + if ((int) this.selectedMenu == 2 || this.IsBackButtonTriggered()) + this.PrevMenu(-1); + else if ((int) this.selectedMenu == 1) + { + this.ErasePlayer((int) this.selectedPlayer); + Main.PlaySound(10); + this.PrevMenu(-1); + this.ResetPlayerMenuSelection(); + } + } + else if (this.menuMode == MenuMode.WORLD_SELECT) + WorldSelect.Update(); + else if (this.menuMode == MenuMode.GAME_MODE) + GameMode.Update(); + else if (this.menuMode == MenuMode.NAME_WORLD) + { + string name = this.GetInputText((UserString) Lang.menu[56], Lang.menu[55], Lang.menu[48], false).text; + this.numMenuItems = (byte) 0; + if (this.inputTextEnter) + { + if (this.inputTextCanceled || name.Length == 0) + { + this.PrevMenu(-1); + } + else + { + if (name.Length > 20) + name = name.Substring(0, 20); + this.SetMenu(MenuMode.STATUS_SCREEN, false, false); + WorldSelect.CreateWorld(name); + } + } + } + else if (this.menuMode == MenuMode.CONFIRM_DELETE_WORLD) + { + this.menuString[0] = Lang.menu[46] + (object) WorldSelect.WorldName() + (string) (object) '?'; + this.noFocus[0] = true; + this.menuString[1] = Lang.menu[104]; + this.menuString[2] = Lang.menu[105]; + this.numMenuItems = (byte) 3; + if ((int) this.selectedMenu == 2 || this.IsBackButtonTriggered()) + this.PrevMenu(-1); + else if ((int) this.selectedMenu == 1) + { + WorldSelect.EraseWorld(); + Main.PlaySound(10); + this.PrevMenu(-1); + } + } + else if (this.menuMode == MenuMode.OPTIONS) + { + this.menuTop = (short) 220; + this.menuSpace = (byte) 57; + this.menuString[0] = Lang.menu[110]; + this.menuString[1] = Lang.menu[111]; + this.menuString[2] = Lang.menu[14]; + if (this.menuType == MenuType.MAIN) + { + this.menuString[3] = Lang.menu[47]; + UI.MENU_OPTIONS_COORDS[3].X = (short) 480; + this.numMenuItems = (byte) 4; + } + else + { + UI.MENU_OPTIONS_COORDS[3].X = (short) 0; + if ((int) this.uiY == 3) + this.uiY = (short) 0; + this.numMenuItems = (byte) 3; + } + if ((int) this.selectedMenu == 0) + { + Main.PlaySound(10); + this.SetMenu(MenuMode.HOW_TO_PLAY, true, false); + } + else if ((int) this.selectedMenu == 1) + { + Main.PlaySound(10); + this.SetMenu(MenuMode.CONTROLS, true, false); + } + else if ((int) this.selectedMenu == 2) + { + Main.PlaySound(10); + this.SetMenu(MenuMode.SETTINGS, true, false); + } + else if ((int) this.selectedMenu == 3) + { + Main.PlaySound(10); + this.SetMenu(MenuMode.CREDITS, true, false); + } + else if (this.IsBackButtonTriggered()) + this.PrevMenu(-1); + } + else if (this.menuMode == MenuMode.HOW_TO_PLAY) + { + this.howtoUI.Update(); + if (this.IsBackButtonTriggered()) + this.PrevMenu(-1); + } + else if (this.menuMode == MenuMode.SHOW_SIGN_IN) + { + if (!Guide.IsVisible) + { + try + { + Guide.ShowSignIn(1, this != UI.main && Main.netMode != 0); + this.menuMode = MenuMode.SIGN_IN; + } + catch (GuideAlreadyVisibleException ex) + { + } + } + } + else if (this.menuMode == MenuMode.SIGN_IN) + { + if (!Guide.IsVisible) + { + if (this.signedInGamer == null) + { + using (GamerCollection.GamerCollectionEnumerator enumerator = Gamer.SignedInGamers.GetEnumerator()) + { + while (enumerator.MoveNext()) + { + SignedInGamer current = enumerator.Current; + if (current.PlayerIndex == this.controller) + { + this.signedInGamer = current; + GamerPresenceExtensions.SetPresenceModeString(this.signedInGamer.Presence, "Menu"); + this.InitPlayerStorage(); + break; + } + } + } + } + if (this.signedInGamer != null) + { + if (!this.IsGamerValid()) + { + MessageBox.Show(this.controller, Lang.menu[5], Lang.inter[43], new string[1] + { + Lang.menu[90] + }, 1 != 0); + this.menuMode = MenuMode.SIGN_IN_FAILED; + } + else if (this.playerStorage == null || this.playerStorage.isDone) + this.PrevMenu(-1); + } + else + this.menuMode = MenuMode.SIGN_IN_FAILED; + } + } + else if (this.menuMode == MenuMode.CONTROLS) + { + this.numMenuItems = (byte) 0; + if (this.IsButtonTriggered(Buttons.A)) + { + UI ui = this; + int num = !ui.alternateGrappleControls ? 1 : 0; + ui.alternateGrappleControls = num != 0; + this.UpdateAlternateGrappleControls(); + this.settingsDirty = true; + } + else if (this.IsBackButtonTriggered()) + this.PrevMenu(-1); + } + else if (this.menuMode == MenuMode.SETTINGS) + { + this.menuSpace = (byte) 60; + this.numMenuItems = (byte) 3; + if (this == UI.main) + { + this.menuString[0] = Lang.menu[65]; + UI.MENU_SETTINGS_COORDS[0].X = (short) 480; + } + else + { + this.menuString[0] = ""; + UI.MENU_SETTINGS_COORDS[0].X = (short) 0; + if ((int) this.uiY == 0) + this.uiY = (short) 1; + } + this.menuString[1] = !this.autoSave ? Lang.menu[68] : Lang.menu[67]; + if (this.HasPlayerStorage()) + { + UI.MENU_SETTINGS_COORDS[1].X = (short) 480; + this.menuHC[1] = (byte) 0; + } + else + { + UI.MENU_SETTINGS_COORDS[1].X = (short) 0; + this.menuHC[1] = (byte) 3; + if ((int) this.uiY == 1) + this.uiY = (short) 2; + } + this.menuString[2] = !this.showItemText ? Lang.menu[72] : Lang.menu[71]; + if ((int) this.selectedMenu == 2) + { + Main.PlaySound(12); + UI ui = this; + int num = !ui.showItemText ? 1 : 0; + ui.showItemText = num != 0; + this.settingsDirty = true; + } + else if ((int) this.selectedMenu == 1) + { + Main.PlaySound(12); + UI ui = this; + int num = !ui.autoSave ? 1 : 0; + ui.autoSave = num != 0; + this.settingsDirty = true; + } + else if ((int) this.selectedMenu == 0) + { + Main.PlaySound(10); + this.SetMenu(MenuMode.VOLUME, true, false); + } + else if (this.IsBackButtonTriggered()) + this.PrevMenu(-1); + } + else if (this.menuMode == MenuMode.VOLUME) + { + this.soundUI.Update(); + this.menuTop = (short) 200; + this.menuSpace = (byte) 60; + this.numMenuItems = (byte) 1; + this.menuString[0] = Lang.menu[65]; + this.noFocus[0] = true; + if (this.IsBackButtonTriggered()) + this.PrevMenu(-1); + } + else if (this.menuMode == MenuMode.WORLD_SIZE) + { + this.menuTop = (short) 190; + this.menuSpace = (byte) 60; + this.menuY[1] = (short) 30; + this.menuY[2] = (short) 30; + this.menuY[3] = (short) 30; + this.menuY[4] = (short) 40; + this.menuString[0] = Lang.menu[91]; + this.noFocus[0] = true; + this.menuString[1] = Lang.menu[92]; + this.menuString[2] = Lang.menu[93]; + this.menuString[3] = Lang.menu[94]; + this.numMenuItems = (byte) 4; + if (this.IsBackButtonTriggered()) + this.PrevMenu(-1); + else if ((int) this.selectedMenu > 0) + { + if ((int) this.selectedMenu == 1) + { + Main.maxTilesX = (short) 4200; + Main.maxTilesY = (short) 1200; + } + else if ((int) this.selectedMenu == 2) + { + Main.maxTilesX = (short) 4620; + Main.maxTilesY = (short) 1320; + } + else + { + Main.maxTilesX = (short) 5040; + Main.maxTilesY = (short) 1440; + } + Main.PlaySound(10); + WorldGen.setWorldSize(); + this.ClearInput(); + this.SetMenu(MenuMode.NAME_WORLD, true, false); + } + } + else if (this.menuMode == MenuMode.QUIT) + { + if (!MessageBox.IsAutoUpdate() && MessageBox.Update()) + { + if (MessageBox.GetResult() <= 0) + { + this.PrevMenu(-1); + } + else + { + this.Exit(); + return; + } + } + } + else if (this.menuMode == MenuMode.SIGN_IN_FAILED) + { + if (!MessageBox.IsVisible()) + { + if (this == UI.main) + this.SetMenu(MenuMode.WELCOME, false, true); + else + this.Exit(); + } + } + else if (this.menuMode == MenuMode.CREDITS) + { + this.numMenuItems = (byte) 0; + Credits.Update(); + } + else if (this.menuMode == MenuMode.UPSELL) + { + this.numMenuItems = (byte) 0; + if (this.IsBackButtonTriggered()) + this.SetMenu(MenuMode.TITLE, false, true); + else if (this.IsButtonTriggered(Buttons.A)) + UI.quit = true; + else if (this.IsButtonTriggered(Buttons.X) && this.signedInGamer.Privileges.AllowPurchaseContent && !Guide.IsVisible) + { + bool flag; + do + { + flag = false; + try + { + GuideExtensions.ShowMarketplace(this.controller, 6359384554213474305UL); + } + catch (GuideAlreadyVisibleException ex) + { + Thread.Sleep(32); + flag = true; + } + } + while (flag); + } + } + if (this.menuMode != menuMode) + { + this.numMenuItems = (byte) 0; + for (int index = 0; index < 14; ++index) + this.menuItemScale[index] = 0.8f; + } + this.focusMenu = (sbyte) -1; + this.selectedMenu = (sbyte) -1; + for (int index = 0; index < (int) this.numMenuItems; ++index) + { + if (this.menuString[index] != null && (int) this.mouseY > (int) this.menuTop + (int) this.menuSpace * index + (int) this.menuY[index] && ((double) this.mouseY < (double) ((int) this.menuTop + (int) this.menuSpace * index + (int) this.menuY[index]) + 50.0 * (double) this.menuScale[index] && Main.hasFocus) && (!this.noFocus[index] && !this.blockFocus[index])) + { + this.focusMenu = (sbyte) index; + if ((int) this.oldMenu != (int) this.focusMenu) + Main.PlaySound(12); + if (this.menuMode != MenuMode.PAUSE ? this.IsSelectButtonTriggered() : this.IsButtonTriggered(Buttons.A)) + this.selectedMenu = (sbyte) index; + } + } + this.oldMenu = this.focusMenu; + } + + private void DrawSaveIconMessage() + { + this.DrawDialog(new Vector2((float) (960 - UI.chatBackTexture.Width >> 1), 220f), new Color(128, 128, 128, 64), new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue), UI.saveIconMessage, Lang.menu[3], false); + SpriteSheet<_sheetSprites>.Draw(642, 480, 304, Color.White, (float) Main.frameCounter * -0.05235988f, 1f); + } + + private void DrawMenu() + { + if (this.menuMode != MenuMode.CONTROLS && this.menuMode != MenuMode.MAP && (this.menuMode != MenuMode.HOW_TO_PLAY && this.menuMode != MenuMode.LEADERBOARDS) && (this.menuMode != MenuMode.WORLD_SELECT && this.menuMode != MenuMode.CREATE_CHARACTER && (this.menuMode != MenuMode.CREDITS && this.menuMode != MenuMode.UPSELL))) + this.DrawLogo(); + if (UI.saveIconMessageTime > 0) + { + if (Guide.IsVisible) + return; + --UI.saveIconMessageTime; + if (this.IsButtonTriggered(Buttons.B)) + UI.saveIconMessageTime = 0; + this.DrawSaveIconMessage(); + this.DrawControls(); + } + else + { + if (this.menuMode == MenuMode.STATUS_SCREEN || this.menuMode == MenuMode.NETPLAY) + { + int num1 = (int) this.menuTop + 100; + float num2 = this.progress * this.numProgressStepsInv + this.progressTotal; + if ((double) num2 > 0.0) + { + Rectangle rectangle = new Rectangle(); + rectangle.Height = UI.progressBarTexture.Height >> 1; + rectangle.Width = (int) ((double) UI.progressBarTexture.Width * (double) num2); + Vector2 vector2 = new Vector2(); + vector2.X = (float) ((int) this.view.viewWidth - UI.progressBarTexture.Width >> 1); + vector2.Y = (float) num1; + Main.spriteBatch.Draw(UI.progressBarTexture, vector2, new Rectangle?(rectangle), Color.White); + rectangle.X = rectangle.Width; + rectangle.Y = rectangle.Height; + vector2.X += (float) rectangle.Width; + rectangle.Width = UI.progressBarTexture.Width - rectangle.Width; + Main.spriteBatch.Draw(UI.progressBarTexture, vector2, new Rectangle?(rectangle), Color.White); + } + this.view.SetScreenViewWideCentered(); + this.tips.Draw(); + this.view.SetScreenView(); + } + else if (this.menuMode == MenuMode.CONTROLS) + { + int num1 = (int) this.view.viewWidth >> 1; + Main.spriteBatch.Draw(UI.controlsTexture, new Vector2() + { + X = (float) (num1 - (UI.controlsTexture.Width >> 1)), + Y = (float) (540 - UI.controlsTexture.Height >> 1) + }, Color.White); + int x1 = (int) this.view.viewWidth - this.view.SAFE_AREA_OFFSET_R - ((int) UI.MeasureString(UI.fontSmall, Lang.inter[24]).X + 60); + int y1 = 464 - this.view.SAFE_AREA_OFFSET_B; + this.view.ui.DrawInventoryCursor(x1, y1, 1.0, (int) byte.MaxValue); + if (this.alternateGrappleControls) + SpriteSheet<_sheetSprites>.Draw(202, x1 + 10, y1 + 10, Color.White); + UI.DrawStringLC(UI.fontSmall, Lang.inter[24], x1 + 60, y1 + 26, Color.White); + ControlDesc[] controlDescArray = Lang.controls(); + for (int index = controlDescArray.Length - 1; index >= 0; --index) + { + int num2 = controlDescArray[index].alignment; + int x2 = (int) controlDescArray[index].X; + if ((int) this.view.viewWidth > 960) + x2 += 480; + int y2 = (int) controlDescArray[index].Y; + string str = controlDescArray[index].text; + if (index == 0) + { + if (this.alternateGrappleControls) + str = controlDescArray[9].text; + } + else if (index == 5) + str = !this.alternateGrappleControls ? str + controlDescArray[9].text : str + controlDescArray[0].text; + Vector2 vector2 = UI.MeasureString(UI.fontSmallOutline, str); + if (num2 < 2) + { + x2 -= (int) vector2.X >> 1; + if (num2 == 0) + y2 -= (int) vector2.Y; + } + else + { + if (num2 == 3) + x2 -= (int) vector2.X; + y2 -= (int) vector2.Y >> 1; + } + UI.DrawStringLT(UI.fontSmallOutline, str, x2, y2, Color.White); + } + } + else if (this.menuMode == MenuMode.MAP) + { + if (Netplay.session != null) + this.DrawMiniMap(); + } + else if (this.menuMode == MenuMode.HOW_TO_PLAY) + { + this.view.SetScreenViewWideCentered(); + this.howtoUI.Draw(); + this.view.SetScreenView(); + } + else if (this.menuMode == MenuMode.WORLD_SELECT) + WorldSelect.Draw(this.view); + else if (this.menuMode == MenuMode.GAME_MODE) + GameMode.Draw(this.view); + else if (this.menuMode == MenuMode.CREATE_CHARACTER) + { + this.view.SetScreenViewWideCentered(); + this.createCharacterGUI.Draw(this.view); + this.view.SetScreenView(); + this.showPlayer = (sbyte) -1; + } + else if (this.menuMode == MenuMode.VOLUME) + this.soundUI.Draw(Main.spriteBatch); + else if (this.menuMode == MenuMode.WELCOME) + { + string text = Lang.menu[52] ?? ""; + SpriteFont spriteFont = UI.fontBig; + Vector2 origin = spriteFont.MeasureString(text) * 0.5f; + Vector2 position = new Vector2(480f, 460f); + float scale = 0.75f * (float) (1.0 + (double) UI.cursorAlpha * 0.100000001490116); + Color color = new Color((int) UI.cursorColor.A, (int) UI.cursorColor.A, 100, (int) byte.MaxValue); + Main.spriteBatch.DrawString(spriteFont, text, position, color, 0.0f, origin, scale, SpriteEffects.None, 0.0f); + } + else if (this.menuMode == MenuMode.LEADERBOARDS) + { + this.view.SetScreenViewWideCentered(); + this.leaderboards.Draw(this.view); + this.view.SetScreenView(); + } + else if (this.menuMode == MenuMode.ERROR) + { + if (UI.errorCompiledText == null) + UI.errorCompiledText = new CompiledText(UI.errorDescription, 470, UI.styleFontSmallOutline, CompiledText.MarkupType.Html); + this.DrawDialog(new Vector2((float) ((int) this.view.viewWidth - UI.chatBackTexture.Width >> 1), 260f), new Color(128, 128, 128, 64), new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue), UI.errorCompiledText, UI.errorCaption, false); + } + else if (this.menuMode == MenuMode.CREDITS) + Credits.Draw(); + else if (this.menuMode == MenuMode.UPSELL) + UI.theGame.DrawUpsell(); + for (int index = 0; index < (int) this.numMenuItems; ++index) + { + if (this.menuString[index] != null) + { + float num = this.menuItemScale[index]; + Color c; + if ((int) this.menuHC[index] == 3) + c = new Color(120, 120, 120); + else if ((int) this.menuHC[index] == 2) + c = new Color(200, 125, (int) byte.MaxValue); + else if ((int) this.menuHC[index] == 1) + c = new Color(125, 125, (int) byte.MaxValue); + else if (this.noFocus[index]) + c = new Color((int) byte.MaxValue, 200, 62, (int) byte.MaxValue); + else if (index == (int) this.focusMenu) + { + num *= (float) (1.0 + (double) UI.cursorAlpha * 0.100000001490116); + c = new Color((int) UI.cursorColor.A, (int) UI.cursorColor.A, 100, (int) byte.MaxValue); + } + else + c = new Color(240, 240, 240, 240); + Vector2 pivot = UI.MeasureString(UI.fontBig, this.menuString[index]); + pivot.X *= 0.5f; + pivot.Y *= 0.5f; + float scale = num * this.menuScale[index]; + Vector2 pos = new Vector2((float) this.menuLeft, (float) ((int) this.menuTop + (int) this.menuSpace * index) + pivot.Y * this.menuScale[index] + (float) this.menuY[index]); + UI.DrawStringScaled(UI.fontBig, this.menuString[index], pos, c, pivot, scale); + } + } + for (int index = 0; index < 14; ++index) + { + if (index == (int) this.focusMenu) + { + if ((double) this.menuItemScale[index] < 1.0) + this.menuItemScale[index] += 0.05f; + if ((double) this.menuItemScale[index] > 1.0) + this.menuItemScale[index] = 1f; + } + else if ((double) this.menuItemScale[index] > 0.8) + this.menuItemScale[index] -= 0.05f; + } + if ((int) this.showPlayer >= 0) + { + Player player = this.loadPlayer[(int) this.showPlayer]; + player.velocity.X = 1f; + player.PlayerFrame(); + this.DrawPlayer(player, new Vector2(148f, 244f), 4f); + } + this.DrawControls(); + } + } + + private void ResumeGame() + { + Main.PlaySound(10); + this.PrevMenu(-1); + this.ClearButtonTriggers(); + this.menuType = MenuType.NONE; + this.worldFadeTarget = 1f; + } + + public void DrawPlayer(Player player, Vector2 position, float scale) + { + Main.spriteBatch.End(); + Vector2 vector2 = player.position; + player.position.X = (float) this.view.screenPosition.X; + player.position.Y = (float) this.view.screenPosition.Y; + Matrix scale1 = Matrix.CreateScale(scale, scale, 1f); + scale1.M41 = position.X; + scale1.M42 = position.Y; + this.view.screenProjection.World = scale1; + Main.spriteBatch.Begin(SpriteSortMode.Deferred, (BlendState) null, SamplerState.PointClamp, (DepthStencilState) null, (RasterizerState) null, (Effect) this.view.screenProjection); + player.Draw(this.view, true, false); + Main.spriteBatch.End(); + this.view.screenProjection.World = Matrix.Identity; + Main.spriteBatch.Begin(SpriteSortMode.Deferred, (BlendState) null, (SamplerState) null, (DepthStencilState) null, (RasterizerState) null, (Effect) this.view.screenProjection); + player.position = vector2; + player.aabb.X = (int) vector2.X; + player.aabb.Y = (int) vector2.Y; + } + + public void DrawPlayerIcon(Player player, Vector2 position, float scale) + { + Vector2 vector2_1 = player.position; + player.position.X = (float) this.view.screenPosition.X; + player.position.Y = (float) this.view.screenPosition.Y; + Vector2 vector2_2 = player.velocity; + player.velocity.X = 0.0f; + player.velocity.Y = 0.0f; + Matrix scale1 = Matrix.CreateScale(scale, scale, 1f); + scale1.M41 = position.X; + scale1.M42 = position.Y; + this.view.screenProjection.World = scale1; + Main.spriteBatch.Begin(SpriteSortMode.Deferred, (BlendState) null, SamplerState.PointClamp, (DepthStencilState) null, (RasterizerState) null, (Effect) this.view.screenProjection); + player.Draw(this.view, true, true); + Main.spriteBatch.End(); + this.view.screenProjection.World = Matrix.Identity; + player.velocity = vector2_2; + player.position = vector2_1; + player.aabb.X = (int) vector2_1.X; + player.aabb.Y = (int) vector2_1.Y; + } + + private bool IsGamerValid() + { + return (this != UI.main || !this.signedInGamer.IsGuest) && (Main.netMode <= 0 || this.CanPlayOnline()); + } + + private void ShowSignInPortal() + { + using (GamerCollection.GamerCollectionEnumerator enumerator = Gamer.SignedInGamers.GetEnumerator()) + { + while (enumerator.MoveNext()) + { + SignedInGamer current = enumerator.Current; + if (current.PlayerIndex == this.controller) + { + this.signedInGamer = current; + if (this.IsGamerValid()) + { + GamerPresenceExtensions.SetPresenceModeString(current.Presence, "Menu"); + this.InitPlayerStorage(); + return; + } + else + this.signedInGamer = (SignedInGamer) null; + } + } + } + this.SetMenu(MenuMode.SHOW_SIGN_IN, true, false); + } + + private void ShowAchievements() + { + if (Guide.IsVisible) + return; + Main.PlaySound(10); + bool flag; + do + { + flag = false; + try + { + GuideExtensions.ShowAchievements(this.controller); + } + catch (GuideAlreadyVisibleException ex) + { + Thread.Sleep(32); + flag = true; + } + } + while (flag); + } + + public void ShowParty() + { + if (!this.CanPlayOnline() || Guide.IsVisible) + return; + Main.PlaySound(10); + bool flag; + do + { + flag = false; + try + { + Guide.ShowPartySessions(this.controller); + } + catch (GuideAlreadyVisibleException ex) + { + Thread.Sleep(32); + flag = true; + } + } + while (flag); + } + + private void DrawLogo() + { + this.logoRotation += this.logoRotationSpeed * 3E-05f; + if ((double) this.logoRotation > 0.1) + this.logoRotationDirection = -1f; + else if ((double) this.logoRotation < -0.1) + this.logoRotationDirection = 1f; + if ((double) this.logoRotationSpeed < 20.0 & (double) this.logoRotationDirection == 1.0) + ++this.logoRotationSpeed; + else if ((double) this.logoRotationSpeed > -20.0 & (double) this.logoRotationDirection == -1.0) + --this.logoRotationSpeed; + this.logoScale += this.logoScaleSpeed * 1E-05f; + if ((double) this.logoScale > 1.1) + this.logoScaleDirection = -1f; + else if ((double) this.logoScale < 0.9) + this.logoScaleDirection = 1f; + if ((double) this.logoScaleSpeed < 50.0 & (double) this.logoScaleDirection == 1.0) + ++this.logoScaleSpeed; + else if ((double) this.logoScaleSpeed > -50.0 & (double) this.logoScaleDirection == -1.0) + --this.logoScaleSpeed; + Color color1 = new Color((int) this.LogoA, (int) this.LogoA, (int) this.LogoA, (int) this.LogoA); + Color color2 = new Color((int) this.LogoB, (int) this.LogoB, (int) this.LogoB, (int) this.LogoB); + float x = this.view != null ? (float) ((int) this.view.viewWidth >> 1) : 480f; + Main.spriteBatch.Draw(UI.logoTexture, new Vector2(x, 100f), new Rectangle?(new Rectangle(0, 0, UI.logoTexture.Width, UI.logoTexture.Height)), color1, this.logoRotation, new Vector2((float) (UI.logoTexture.Width >> 1), (float) (UI.logoTexture.Height >> 1)), this.logoScale, SpriteEffects.None, 0.0f); + Main.spriteBatch.Draw(UI.logo2Texture, new Vector2(x, 100f), new Rectangle?(new Rectangle(0, 0, UI.logoTexture.Width, UI.logoTexture.Height)), color2, this.logoRotation, new Vector2((float) (UI.logoTexture.Width >> 1), (float) (UI.logoTexture.Height >> 1)), this.logoScale, SpriteEffects.None, 0.0f); + if (this.view.time.dayTime) + { + this.LogoA += (short) 2; + if ((int) this.LogoA > (int) byte.MaxValue) + this.LogoA = (short) byte.MaxValue; + --this.LogoB; + if ((int) this.LogoB >= 0) + return; + this.LogoB = (short) 0; + } + else + { + this.LogoB += (short) 2; + if ((int) this.LogoB > (int) byte.MaxValue) + this.LogoB = (short) byte.MaxValue; + --this.LogoA; + if ((int) this.LogoA >= 0) + return; + this.LogoA = (short) 0; + } + } + + private void initCharacterSelectCoordinates() + { + if ((int) this.numLoadPlayers == 0) + return; + for (int index = 0; index < 5; ++index) + UI.MENU_SELECT_COORDS[index].X = index >= (int) this.numLoadPlayers ? (short) 0 : (short) 480; + } + + private void DrawControls() + { + if (this.menuType == MenuType.NONE) + return; + Main.strBuilder.Length = 0; + if (UI.saveIconMessageTime > 0) + { + Main.strBuilder.Append(Lang.controls(Lang.CONTROLS.CLOSE)); + } + else + { + switch (this.menuMode) + { + case MenuMode.PAUSE: + Main.strBuilder.Append(Lang.controls(Lang.CONTROLS.SELECT)); + Main.strBuilder.Append(' '); + Main.strBuilder.Append(Lang.controls(Lang.CONTROLS.BACK)); + if (Main.netMode == 1) + { + Main.strBuilder.Append(' '); + Main.strBuilder.Append(Lang.controls(Lang.CONTROLS.BLACKLIST)); + break; + } + else + break; + case MenuMode.MAP: + Main.strBuilder.Append(Lang.controls(Lang.CONTROLS.MOVE_MAP)); + Main.strBuilder.Append(' '); + Main.strBuilder.Append(Lang.controls(Lang.CONTROLS.ZOOM)); + Main.strBuilder.Append(' '); + if (this.mapScreenCursorY >= 2) + { + if (this.CanViewGamerCard() && Netplay.session != null && this.mapScreenCursorY - 2 < ((ReadOnlyCollection) Netplay.session.AllGamers).Count) + { + Main.strBuilder.Append(Lang.controls(Lang.CONTROLS.SHOW_GAMERCARD)); + Main.strBuilder.Append(' '); + } + } + else if (this.mapScreenCursorX == 0) + { + Main.strBuilder.Append(Lang.controls(Lang.CONTROLS.TOGGLE_PVP)); + Main.strBuilder.Append(' '); + } + else + { + Main.strBuilder.Append(Lang.controls(Lang.CONTROLS.SELECT_TEAM)); + Main.strBuilder.Append(' '); + } + Main.strBuilder.Append(Lang.controls(Lang.CONTROLS.BACK)); + if (Netplay.gamer != null && Main.netMode > 0) + { + if (this.CanCommunicate()) + { + Main.strBuilder.Append(' '); + Main.strBuilder.Append(Lang.controls(Lang.CONTROLS.INVITE_PLAYER)); + } + if (this.signedInGamer.PartySize > 1) + { + Main.strBuilder.Append(' '); + Main.strBuilder.Append(Lang.controls(Lang.CONTROLS.INVITE_PARTY)); + break; + } + else + break; + } + else + break; + case MenuMode.WELCOME: + case MenuMode.STATUS_SCREEN: + break; + case MenuMode.TITLE: + Main.strBuilder.Append(Lang.controls(Lang.CONTROLS.SELECT)); + if (this.playerStorage != null) + { + Main.strBuilder.Append(' '); + Main.strBuilder.Append(Lang.controls(Lang.CONTROLS.CHANGE_STORAGE)); + } + if (this.CanPlayOnline()) + { + Main.strBuilder.Append(' '); + Main.strBuilder.Append(Lang.controls(Lang.CONTROLS.SHOW_PARTY)); + break; + } + else + break; + case MenuMode.CHARACTER_SELECT: + Main.strBuilder.Append(Lang.controls(Lang.CONTROLS.SELECT)); + if (Netplay.gamersWhoReceivedInvite.Count < 2 || !Netplay.gamersWhoReceivedInvite.Contains(this.signedInGamer)) + { + Main.strBuilder.Append(' '); + Main.strBuilder.Append(Lang.controls(Lang.CONTROLS.BACK)); + } + if ((int) this.focusMenu < (int) this.numLoadPlayers) + { + Main.strBuilder.Append(' '); + Main.strBuilder.Append(Lang.menu[17]); + break; + } + else + break; + case MenuMode.CREATE_CHARACTER: + this.createCharacterGUI.ControlDescription(Main.strBuilder); + break; + case MenuMode.WORLD_SELECT: + WorldSelect.ControlDescription(Main.strBuilder); + break; + case MenuMode.WAITING_SCREEN: + case MenuMode.NETPLAY: + case MenuMode.ERROR: + case MenuMode.LOAD_FAILED_NO_BACKUP: + case MenuMode.CREDITS: + Main.strBuilder.Append(Lang.controls(Lang.CONTROLS.BACK)); + break; + case MenuMode.CONTROLS: + Main.strBuilder.Append(Lang.controls(Lang.CONTROLS.TOGGLE_GRAPPLE_MODE)); + Main.strBuilder.Append(' '); + Main.strBuilder.Append(Lang.controls(Lang.CONTROLS.BACK)); + break; + case MenuMode.VOLUME: + this.soundUI.ControlDescription(Main.strBuilder); + break; + case MenuMode.LEADERBOARDS: + this.leaderboards.ControlDescription(Main.strBuilder); + break; + case MenuMode.HOW_TO_PLAY: + this.howtoUI.ControlDescription(Main.strBuilder); + break; + case MenuMode.UPSELL: + Main.strBuilder.Append(Lang.controls(Lang.CONTROLS.EXIT)); + Main.strBuilder.Append(' '); + Main.strBuilder.Append(Lang.controls(Lang.CONTROLS.BACK_TO_GAME)); + if (this.signedInGamer.Privileges.AllowPurchaseContent) + { + Main.strBuilder.Append(' '); + Main.strBuilder.Append(Lang.controls(Lang.CONTROLS.UNLOCK_FULL_GAME)); + break; + } + else + break; + default: + Main.strBuilder.Append(Lang.controls(Lang.CONTROLS.SELECT)); + Main.strBuilder.Append(' '); + Main.strBuilder.Append(Lang.controls(Lang.CONTROLS.BACK)); + break; + } + } + if (Main.strBuilder.Length <= 0) + return; + UI.DrawStringLB(UI.fontSmallOutline, this.view.SAFE_AREA_OFFSET_L, this.view.SAFE_AREA_OFFSET_B); + } + + private void DrawHud() + { + Vector2 pos = new Vector2(); + Color c = new Color(128, 128, 128, 128); + for (int index = 1; index < (int) this.player.statLifeMax / 20 + 1; ++index) + { + int x = (int) this.view.viewWidth - this.view.SAFE_AREA_OFFSET_R - 460 + 26 * (index - 1) + 160 + 11; + int y = this.view.SAFE_AREA_OFFSET_T; + if (index > 10) + { + x -= 260; + y += 26; + } + SpriteSheet<_sheetSprites>.Draw(436, x, y, c); + int id = 435; + if ((int) this.player.statLife < index * 20) + { + float num = (float) ((int) this.player.statLife - (index - 1) * 20) / 20f; + if ((double) num > 0.0) + id = (double) num >= 0.25 ? ((double) num >= 0.5 ? 432 : 433) : 434; + else + continue; + } + SpriteSheet<_sheetSprites>.Draw(id, x, y); + } + if ((int) this.player.breath < 200) + { + for (int index = 1; index < 11; ++index) + { + int x = (int) this.view.viewWidth - this.view.SAFE_AREA_OFFSET_R - 460 + 26 * (index - 1) + 160 + 11; + int y = this.view.SAFE_AREA_OFFSET_T + 52; + SpriteSheet<_sheetSprites>.Draw(141, x, y, c); + if ((int) this.player.breath < index * 20) + { + float num1 = (float) ((int) this.player.breath - (index - 1) * 20) / 20f; + if ((double) num1 > 0.0) + { + float scaleCenter = (float) ((double) num1 * 0.25 + 0.75); + int num2 = (int) (30.0 + 225.0 * (double) num1); + if (num2 < 30) + num2 = 30; + c.R = (byte) num2; + c.G = (byte) num2; + c.B = (byte) num2; + c.A = (byte) num2; + SpriteSheet<_sheetSprites>.DrawScaled(140, x + 11, y + 11, scaleCenter, c); + c = new Color(128, 128, 128, 128); + } + } + else + SpriteSheet<_sheetSprites>.Draw(140, x, y); + } + } + if ((int) this.player.statManaMax2 > 0) + { + int num1 = (int) this.player.statManaMax2 / 20; + int x = (int) this.view.viewWidth - this.view.SAFE_AREA_OFFSET_R - 22; + pos.X = (float) (x + 11); + c.R = byte.MaxValue; + c.G = byte.MaxValue; + c.B = byte.MaxValue; + c.A = (byte) 229; + int num2 = 0; + do + { + bool flag = false; + float scaleCenter = 1f; + if ((int) this.player.statMana >= (num2 + 1) * 20) + { + if ((int) this.player.statMana == (num2 + 1) * 20) + flag = true; + } + else + { + float num3 = (float) ((int) this.player.statMana - num2 * 20) / 20f; + int num4 = (int) (30.0 + 225.0 * (double) num3); + if (num4 < 30) + num4 = 30; + c.R = (byte) num4; + c.G = (byte) num4; + c.B = (byte) num4; + c.A = (byte) ((double) num4 * 0.9); + scaleCenter = (float) ((double) num3 * 0.25 + 0.5); + if ((double) scaleCenter < 0.5) + scaleCenter = 0.5f; + if ((double) num3 > 0.0) + flag = true; + } + if (flag) + scaleCenter += UI.cursorScale - 1f; + int y = this.view.SAFE_AREA_OFFSET_T + 23 * num2; + pos.Y = (float) (y + 11) + (float) (6.0 - 6.0 * (double) scaleCenter); + SpriteSheet<_sheetSprites>.Draw(1087, x, y, new Color(128, 128, 128, 128)); + SpriteSheet<_sheetSprites>.DrawScaled(1086, ref pos, c, scaleCenter); + } + while (++num2 < num1); + } + c = new Color(99, 99, 99, 99); + for (int index = 0; index < 10; ++index) + { + int num1 = (int) this.player.buff[index].Type; + if (num1 > 0) + { + int x = 32 + this.view.SAFE_AREA_OFFSET_L + index * 38; + int y = 76 + this.view.SAFE_AREA_OFFSET_T; + int id = 141 + num1; + if (num1 == 40) + id += (int) this.player.pet; + SpriteSheet<_sheetSprites>.Draw(id, x, y, c); + if (num1 != 28 && num1 != 34 && (num1 != 37 && num1 != 38) && num1 != 40) + { + int num2 = (int) this.player.buff[index].Time / 60; + Main.strBuilder.Length = 0; + Main.strBuilder.Append(ToStringExtensions.ToStringLookup(num2 / 60)); + Main.strBuilder.Append(':'); + int num3 = num2 % 60; + if (num3 < 10) + Main.strBuilder.Append('0'); + Main.strBuilder.Append(ToStringExtensions.ToStringLookup(num3)); + UI.DrawStringLT(UI.fontItemStack, x, y + 32, Color.White); + } + } + } + if (this.npcChatText == null) + { + bool flag1 = false; + bool flag2 = false; + bool flag3 = false; + for (int index = 0; index < 3; ++index) + { + Main.strBuilder.Length = 0; + if (this.player.accCompass && !flag3) + { + Main.strBuilder.Append(Lang.menu[95]); + int num1 = (this.player.aabb.X + 10 >> 3) - (int) Main.maxTilesX >> 2; + if (num1 > 0) + { + Main.strBuilder.Append(ToStringExtensions.ToStringLookup(num1)); + Main.strBuilder.Append(Lang.menu[96]); + } + else if (num1 < 0) + { + int num2 = -num1; + Main.strBuilder.Append(ToStringExtensions.ToStringLookup(num2)); + Main.strBuilder.Append(Lang.menu[97]); + } + else + Main.strBuilder.Append(Lang.menu[98]); + flag3 = true; + } + else if (this.player.accDepthMeter && !flag2) + { + Main.strBuilder.Append(Lang.menu[85]); + int num1 = (this.player.aabb.Y + 42 >> 3) - Main.worldSurface * 2 >> 2; + if (num1 > 0) + { + Main.strBuilder.Append(ToStringExtensions.ToStringLookup(num1)); + Main.strBuilder.Append(Lang.menu[86]); + } + else if (num1 < 0) + { + int num2 = -num1; + Main.strBuilder.Append(ToStringExtensions.ToStringLookup(num2)); + Main.strBuilder.Append(Lang.menu[87]); + } + else + Main.strBuilder.Append(Lang.menu[88]); + flag2 = true; + } + else if ((int) this.player.accWatch > 0 && !flag1) + { + string str1 = " AM"; + double num1 = (double) Main.gameTime.time; + if (!Main.gameTime.dayTime) + num1 += 54000.0; + double num2 = num1 / 86400.0 * 24.0 - 7.5 - 12.0; + if (num2 < 0.0) + num2 += 24.0; + if (num2 >= 12.0) + str1 = " PM"; + int num3 = (int) num2; + int num4 = (int) ((num2 - (double) num3) * 60.0); + if (num3 > 12) + num3 -= 12; + if (num3 == 0) + num3 = 12; + string str2; + if ((int) this.player.accWatch == 1) + str2 = "00"; + else if ((int) this.player.accWatch == 2) + { + str2 = num4 >= 30 ? "30" : "00"; + } + else + { + str2 = ToStringExtensions.ToStringLookup(num4); + if (num4 < 10) + str2 = "0" + str2; + } + Main.strBuilder.Append(Lang.inter[34]); + Main.strBuilder.Append(ToStringExtensions.ToStringLookup(num3)); + Main.strBuilder.Append(':'); + Main.strBuilder.Append(str2); + Main.strBuilder.Append(str1); + flag1 = true; + } + if (Main.strBuilder.Length > 0) + UI.DrawStringLT(UI.fontSmallOutline, this.view.SAFE_AREA_OFFSET_L, 110 + 22 * index + 48, UI.mouseTextColor); + } + } + int num5 = (int) this.player.oldSelectedItem; + int num6 = num5 >= 0 ? num5 : (int) this.player.selectedItem; + float num7 = UI.numActiveViews > 1 ? 1.25f : 1f; + int x1 = this.view.SAFE_AREA_OFFSET_L; + for (int index1 = 0; index1 < 10; ++index1) + { + float num1 = this.hotbarScale[index1]; + if (index1 == num6) + { + if ((double) num1 < 1.0) + { + num1 += 0.05f; + this.hotbarScale[index1] = num1; + } + } + else if ((double) num1 > 0.75) + { + num1 -= 0.05f; + this.hotbarScale[index1] = num1; + } + float scaleTopLeft = num1 * num7; + int y = (int) ((double) this.view.SAFE_AREA_OFFSET_T + 22.0 * (1.0 - (double) scaleTopLeft)); + int num2 = (int) (65.0 + 180.0 * (double) scaleTopLeft); + Color itemColor = new Color(num2, num2, num2, num2); + if (index1 == num6) + { + c.R = (byte) 200; + c.G = (byte) 200; + c.B = (byte) 200; + c.A = (byte) 200; + SpriteSheet<_sheetSprites>.DrawTL(448, x1, y, c, scaleTopLeft); + } + else + { + c.R = (byte) 100; + c.G = (byte) 100; + c.B = (byte) 100; + c.A = (byte) 100; + SpriteSheet<_sheetSprites>.DrawTL(451, x1, y, c, scaleTopLeft); + } + int index2 = index1 == num5 ? (int) this.player.selectedItem : index1; + if ((int) this.player.inventory[index2].type > 0 && (int) this.player.inventory[index2].stack > 0) + { + UI.inventoryScale = scaleTopLeft; + this.DrawInventoryItem(ref this.player.inventory[index2], x1, y, itemColor, UI.StackType.HOTBAR); + } + x1 += (int) (52.0 * (double) scaleTopLeft) + 4; + } + if (this.quickAccessDisplayTime > 0) + { + --this.quickAccessDisplayTime; + this.DrawQuickAccess((int) this.player.selectedItem, this.view.SAFE_AREA_OFFSET_L, 540 - this.view.SAFE_AREA_OFFSET_B - 32 - 128, this.quickAccessDisplayTime < 64 ? this.quickAccessDisplayTime << 2 : (int) byte.MaxValue, UI.StackType.HOTBAR); + } + if (this.hotbarItemNameTime > 0) + { + --this.hotbarItemNameTime; + if ((int) this.player.inventory[(int) this.player.selectedItem].type != 0) + { + string s = this.player.inventory[(int) this.player.selectedItem].AffixName(); + int num1 = this.hotbarItemNameTime < 64 ? this.hotbarItemNameTime << 2 : (int) byte.MaxValue; + double num2 = (double) UI.DrawStringCT(UI.fontSmall, s, (int) (216.0 * (double) num7) + this.view.SAFE_AREA_OFFSET_L, this.view.SAFE_AREA_OFFSET_T + (int) (44.0 * (double) num7), new Color(num1, num1, num1, num1)); + } + } + this.DrawControlsIngame(); + } + + private void DrawInventoryItem(int itemTexId, int x, int y, Color itemColor) + { + int num1 = SpriteSheet<_sheetSprites>.src[itemTexId].Width; + int num2 = SpriteSheet<_sheetSprites>.src[itemTexId].Height; + float scaleCenter = (num1 <= num2 ? 41f / (float) num2 : 41f / (float) num1) * UI.inventoryScale; + if ((double) scaleCenter > 1.25) + scaleCenter = 1.25f; + SpriteSheet<_sheetSprites>.DrawScaled(itemTexId, ref new Vector2() + { + X = (float) x + 26f * UI.inventoryScale, + Y = (float) y + 26f * UI.inventoryScale + }, itemColor, scaleCenter); + } + + private void DrawInventoryItem(ref Item item, int x, int y, Color itemColor, UI.StackType stackType = UI.StackType.NONE) + { + int id = (int) item.type + 451; + int num1 = SpriteSheet<_sheetSprites>.src[id].Width; + int num2 = SpriteSheet<_sheetSprites>.src[id].Height; + float scaleCenter = (num1 <= num2 ? 41f / (float) num2 : 41f / (float) num1) * UI.inventoryScale; + if ((double) scaleCenter > 1.25) + scaleCenter = 1.25f; + Vector2 pos = new Vector2(); + pos.X = (float) x + 26f * UI.inventoryScale; + pos.Y = (float) y + 26f * UI.inventoryScale; + SpriteSheet<_sheetSprites>.DrawScaled(id, ref pos, item.GetAlphaInventory(itemColor), scaleCenter); + if ((int) item.color.PackedValue != 0) + SpriteSheet<_sheetSprites>.DrawScaled(id, ref pos, item.GetColor(itemColor), scaleCenter); + if (stackType == UI.StackType.INGREDIENT) + { + this.DrawIngredientStack(ref item, x, y, itemColor); + } + else + { + if (stackType == UI.StackType.NONE) + return; + UI.DrawInventoryItemStack(ref item, x, y, ref itemColor); + if (stackType != UI.StackType.HOTBAR) + return; + int num3 = (int) item.useAmmo; + if (num3 > 0) + { + int num4 = 0; + for (int index = 0; index < 48; ++index) + { + if ((int) this.player.inventory[index].ammo == num3) + num4 += (int) this.player.inventory[index].stack; + } + UI.DrawStringScaled(UI.fontItemStack, ToStringExtensions.ToStringLookup(num4), new Vector2((float) (x + UI.FONT_STACK_EXTRA_OFFSET) + 10f * UI.inventoryScale, (float) y + 26f * UI.inventoryScale), itemColor, new Vector2(), UI.inventoryScale + 0.1f); + } + else if ((int) item.type == 509) + { + int num4 = 0; + for (int index = 0; index < 48; ++index) + { + if ((int) this.player.inventory[index].type == 530) + num4 += (int) this.player.inventory[index].stack; + } + UI.DrawStringScaled(UI.fontItemStack, ToStringExtensions.ToStringLookup(num4), new Vector2((float) (x + UI.FONT_STACK_EXTRA_OFFSET) + 10f * UI.inventoryScale, (float) y + 26f * UI.inventoryScale), itemColor, new Vector2(), UI.inventoryScale + 0.1f); + } + if (!item.potion) + return; + Color c = item.GetAlphaInventory(itemColor) * ((float) this.player.potionDelay / (float) this.player.potionDelayTime); + pos.X = (float) x + 26f * UI.inventoryScale; + pos.Y = (float) y + 26f * UI.inventoryScale; + SpriteSheet<_sheetSprites>.DrawScaled(204, ref pos, c, UI.inventoryScale); + } + } + + private static void DrawInventoryItemStack(ref Item item, int x, int y, ref Color itemColor) + { + if ((int) item.stack <= 1) + return; + UI.DrawStringScaled(UI.fontItemStack, ToStringExtensions.ToStringLookup(item.stack), new Vector2((float) (x + UI.FONT_STACK_EXTRA_OFFSET) + 10f * UI.inventoryScale, (float) y + 26f * UI.inventoryScale), itemColor, new Vector2(), UI.inventoryScale + 0.1f); + } + + private void DrawIngredientStack(ref Item item, int x, int y, Color itemColor) + { + int num = Math.Min((int) item.stack, this.player.CountInventory((int) item.netID)); + Main.strBuilder.Length = 0; + Main.strBuilder.Append(ToStringExtensions.ToStringLookup(item.stack)); + if (num < (int) item.stack) + { + itemColor.G >>= 1; + itemColor.B >>= 1; + } + UI.DrawStringScaled(UI.fontItemStack, new Vector2((float) (x + UI.FONT_STACK_EXTRA_OFFSET) + 10f * UI.inventoryScale, (float) y + 26f * UI.inventoryScale), itemColor, new Vector2(), UI.inventoryScale - 0.1f); + } + + public void DrawInterface() + { + if (this.showNPCs) + this.view.DrawNPCHouse(); + Vector2 pos = new Vector2(); + if (this.player.rulerAcc) + this.view.DrawGrid(); + if (this.signBubble) + { + this.signBubble = false; + int num1 = this.signX - this.view.screenPosition.X; + int num2 = this.signY - this.view.screenPosition.Y; + SpriteEffects se = SpriteEffects.None; + int x; + if ((double) this.signX > (double) this.player.position.X + 20.0) + { + se = SpriteEffects.FlipHorizontally; + x = num1 - 40; + } + else + x = num1 + 8; + int y = num2 - 22; + SpriteSheet<_sheetSprites>.Draw(200, x, y, UI.mouseTextColor, se); + } + Main.spriteBatch.End(); + for (int index = 7; index >= 0; --index) + { + if ((int) this.myPlayer != index) + { + Player player = Main.player[index]; + if ((int) player.active != 0 && !player.dead && !player.aabb.Intersects(this.view.viewArea) && ((int) this.player.team == 0 || (int) player.team == 0 || (int) this.player.team == (int) player.team)) + { + Vector2 a1 = new Vector2(); + Vector2 a2 = new Vector2(); + a1.X = (float) ((int) this.view.viewWidth >> 1); + a1.Y = 270f; + a2.X = (float) (player.aabb.X + 10 - this.view.screenPosition.X); + a2.Y = (float) (player.aabb.Y + 21 - this.view.screenPosition.Y); + Vector2 intersection = new Vector2(); + bool flag1 = false; + int num1 = this.view.SAFE_AREA_OFFSET_L; + int num2 = (int) this.view.viewWidth - this.view.SAFE_AREA_OFFSET_R - 40; + int num3 = this.view.SAFE_AREA_OFFSET_T + 20 + 40; + int num4 = 540 - this.view.SAFE_AREA_OFFSET_B - 40; + if ((double) a2.X <= (double) num1) + flag1 = Collision.LineIntersection(ref a1, ref a2, new Vector2((float) num1, (float) num3), new Vector2((float) num1, (float) num4), ref intersection); + else if ((double) a2.X >= (double) num2) + flag1 = Collision.LineIntersection(ref a1, ref a2, new Vector2((float) num2, (float) num3), new Vector2((float) num2, (float) num4), ref intersection); + bool flag2; + if (!flag1) + { + if ((double) a2.Y <= (double) num3) + flag2 = Collision.LineIntersection(ref a1, ref a2, new Vector2((float) num1, (float) num3), new Vector2((float) num2, (float) num3), ref intersection); + else if ((double) a2.Y >= (double) num4) + flag2 = Collision.LineIntersection(ref a1, ref a2, new Vector2((float) num1, (float) num4), new Vector2((float) num2, (float) num4), ref intersection); + } + float num5 = (float) this.view.viewWidth * 1.5f / (a2 - a1).Length(); + if ((double) num5 < 0.5) + num5 = 0.5f; + Matrix matrix = Matrix.CreateTranslation(-10f, -8f, 0.0f) * Matrix.CreateScale(num5, num5, 1f); + Vector2 vector2 = player.position; + player.position.X = (float) this.view.screenPosition.X; + player.position.Y = (float) this.view.screenPosition.Y; + this.view.screenProjection.World = matrix * Matrix.CreateTranslation(intersection.X, intersection.Y, 0.0f); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, (BlendState) null, (SamplerState) null, (DepthStencilState) null, (RasterizerState) null, (Effect) this.view.screenProjection); + player.Draw(this.view, true, true); + Main.spriteBatch.End(); + player.position = vector2; + player.aabb.X = (int) vector2.X; + player.aabb.Y = (int) vector2.Y; + } + } + } + this.view.screenProjection.World = Matrix.Identity; + Main.spriteBatch.Begin(SpriteSortMode.Deferred, (BlendState) null, (SamplerState) null, (DepthStencilState) null, (RasterizerState) null, (Effect) this.view.screenProjection); + if ((int) this.inventoryMode == 0 && (this.npcChatText != null || (int) this.player.sign != -1)) + this.DrawNpcChat(); + if (this.player.dead) + { + this.CloseInventory(); + string s = Lang.inter[38]; + UI.DrawStringCC(UI.fontBig, s, (int) this.view.viewWidth >> 1, 270, this.player.GetDeathAlpha(new Color())); + } + else if ((int) this.inventoryMode != 0) + { + this.DrawInventoryMenu(); + } + else + { + this.view.SetWorldView(); + Rectangle rectangle1 = new Rectangle(this.player.aabb.X + 10 - 80, this.player.aabb.Y + 21 - 64, 160, 128); + for (int index = 0; index < 8; ++index) + { + if ((int) Main.player[index].active != 0 && (int) this.myPlayer != index && !Main.player[index].dead) + { + Rectangle rectangle2 = new Rectangle(Main.player[index].aabb.X - 6, Main.player[index].aabb.Y + 42 - 48, 32, 48); + if (rectangle1.Intersects(rectangle2)) + Main.player[index].DrawInfo(this.view); + } + } + if (!this.player.dead) + { + for (int index = 195; index >= 0; --index) + this.view.drawNpcName[index] = true; + this.player.npcChatBubble = (short) -1; + int num1 = 10496; + Rectangle rectangle2 = new Rectangle(); + Point center1 = rectangle1.Center; + for (int index = 0; index < 196; ++index) + { + NPC npc = Main.npc[index]; + if ((int) npc.active != 0) + { + int num2 = (int) npc.type; + if (num2 != 85 || (double) Main.npc[index].ai0 != 0.0) + { + if (num2 >= 87 && num2 <= 92 || num2 >= 159 && num2 <= 164) + { + rectangle2.X = npc.aabb.X + ((int) npc.width >> 1) - 32; + rectangle2.Y = npc.aabb.Y + ((int) npc.height >> 1) - 32; + rectangle2.Width = 64; + rectangle2.Height = 64; + } + else + { + int num3 = SpriteSheet<_sheetSprites>.src[1088 + num2].Width; + rectangle2.X = npc.aabb.X + ((int) npc.width >> 1) - (num3 >> 1); + rectangle2.Y = npc.aabb.Y + (int) npc.height - (int) npc.frameHeight; + rectangle2.Width = num3; + rectangle2.Height = (int) npc.frameHeight; + } + bool result1; + rectangle1.Intersects(ref rectangle2, out result1); + if (result1) + { + if (npc.canTalk() && this.player.CanInteractWithNPC()) + { + Point center2 = rectangle2.Center; + int num3 = Math.Abs(center1.X - center2.X); + if (num3 <= 80) + { + int num4 = num3 * num3; + int num5 = Math.Abs(center1.Y - center2.Y); + if (num5 <= 64 && num4 + num5 * num5 < num1) + { + bool result2; + if (this.smartCursor) + { + result2 = true; + } + else + { + center2.X = (int) this.mouseX + this.view.screenPosition.X; + center2.Y = (int) this.mouseY + this.view.screenPosition.Y; + rectangle2.Contains(ref center2, out result2); + } + if (result2) + this.player.npcChatBubble = (short) index; + } + } + } + if ((int) npc.drawMyName < 32) + npc.drawMyName = (short) 32; + } + if ((int) npc.drawMyName > 0 && this.view.clipArea.Intersects(rectangle2)) + { + --npc.drawMyName; + npc.DrawInfo(this.view); + } + } + } + } + if ((int) this.player.npcChatBubble >= 0) + { + NPC npc = Main.npc[(int) this.player.npcChatBubble]; + int num2 = -(((int) npc.width >> 1) + 8); + SpriteEffects se = SpriteEffects.None; + if ((int) npc.spriteDirection == -1) + { + se = SpriteEffects.FlipHorizontally; + num2 = -num2; + } + pos.X = (float) (npc.aabb.X + ((int) npc.width >> 1) - this.view.screenPosition.X - 16 - num2); + pos.Y = (float) (npc.aabb.Y - 26 - this.view.screenPosition.Y); + SpriteSheet<_sheetSprites>.Draw(201, ref pos, UI.mouseTextColor, se); + } + } + this.view.SetScreenView(); + } + } + + public void ClearInput() + { + this.inputTextEnter = false; + this.inputTextCanceled = false; + } + + public UserString GetInputText(UserString oldString, string title = null, string desc = null, bool validate = true) + { + if (!this.inputTextEnter && oldString.IsEditable()) + { + if (!Guide.IsVisible) + { + try + { + this.kbResult = Guide.BeginShowKeyboardInput(this.controller, title, desc, oldString.isCensored ? "" : oldString.text, (AsyncCallback) null, (object) null); + } + catch (GuideAlreadyVisibleException ex) + { + } + } + else if (this.kbResult != null && this.kbResult.IsCompleted) + { + this.inputTextEnter = true; + string str = Guide.EndShowKeyboardInput(this.kbResult); + this.kbResult = (IAsyncResult) null; + this.inputTextCanceled = str == null; + if (!this.inputTextCanceled) + { + string s = str.Trim(); + char[] chArray = s.ToCharArray(); + bool flag = false; + for (int index = chArray.Length - 1; index >= 0; --index) + { + if ((int) chArray[index] == 164) + { + chArray[index] = 'Ʃ'; + flag = true; + } + else if (!UI.fontSmallOutline.get_Characters().Contains(chArray[index])) + { + chArray[index] = (int) chArray[index] != 8364 ? '?' : 'Ɛ'; + flag = true; + } + } + if (flag) + s = new string(chArray); + if (validate) + oldString.SetUserString(s); + else + oldString.SetSystemString(s); + } + } + } + return oldString; + } + + public void FirstProgressStep(int numSteps, string text = null) + { + this.progress = 0.0f; + this.progressTotal = 0.0f; + this.numProgressStepsInv = 1f / (float) numSteps; + if (text == null) + return; + this.statusText = text; + } + + public void NextProgressStep(string text = null) + { + this.progress = 0.0f; + this.progressTotal += this.numProgressStepsInv; + if (text == null) + return; + this.statusText = text; + } + + private static void UpdateCursorColor() + { + UI.cursorAlpha = (float) (0.8 + 0.2 * Math.Sin((double) Main.frameCounter * (1.0 / 16.0))); + double num = (double) UI.cursorAlpha * 0.3 + 0.7; + UI.cursorColor = new Color((int) (byte) ((double) UI.mouseColor.R * (double) UI.cursorAlpha), (int) (byte) ((double) UI.mouseColor.G * (double) UI.cursorAlpha), (int) (byte) ((double) UI.mouseColor.B * (double) UI.cursorAlpha), (int) (byte) ((double) byte.MaxValue * num)); + UI.cursorScale = (float) (num + 0.1); + } + + private void UpdateMouse() + { + if (this.uiCoords == null) + { + int dx = 0; + int dy = 0; + int num1 = 3; + bool flag = (int) this.inventoryMode > 0 || this.menuMode == MenuMode.MAP || this.menuMode == MenuMode.WORLD_SELECT || this.menuMode == MenuMode.GAME_MODE; + if (flag) + num1 = 1; + else if (this.menuType == MenuType.NONE) + { + if (this.IsButtonTriggered(Buttons.RightStick)) + { + UI ui = this; + int num2 = !ui.smartCursor ? 1 : 0; + ui.smartCursor = num2 != 0; + } + if (this.smartCursor) + { + this.player.UpdateMouseSmart(); + return; + } + else + { + this.player.UpdateMouse(); + return; + } + } + else + { + this.uiDelay = (sbyte) 0; + this.uiDelayValue = (sbyte) 12; + } + if (this.menuMode != MenuMode.MAP) + { + if ((double) this.gpState.ThumbSticks.Right.X < -0.125) + dx = -num1; + else if ((double) this.gpState.ThumbSticks.Right.X > 0.125) + dx = num1; + if ((double) this.gpState.ThumbSticks.Right.Y < -0.125) + dy = num1; + else if ((double) this.gpState.ThumbSticks.Right.Y > 0.125) + dy = -num1; + } + if (this.menuType != MenuType.NONE || (int) this.inventoryMode > 0) + { + if ((double) this.gpState.ThumbSticks.Left.X < -0.125) + dx = -num1; + else if ((double) this.gpState.ThumbSticks.Left.X > 0.125) + dx = num1; + if ((double) this.gpState.ThumbSticks.Left.Y < -0.125) + dy = num1; + else if ((double) this.gpState.ThumbSticks.Left.Y > 0.125) + dy = -num1; + if ((int) this.inventoryMode == 0 || this.inventorySection != UI.InventorySection.ITEMS) + { + if (this.gpState.DPad.Left == ButtonState.Pressed) + dx = -num1; + else if (this.gpState.DPad.Right == ButtonState.Pressed) + dx = num1; + if (this.gpState.DPad.Down == ButtonState.Pressed) + dy = num1; + else if (this.gpState.DPad.Up == ButtonState.Pressed) + dy = -num1; + } + } + if ((int) this.uiDelay > 0) + { + if (dx == 0 && dy == 0) + { + this.uiDelay = (sbyte) 0; + this.uiDelayValue = (sbyte) 12; + } + else + --this.uiDelay; + } + if ((int) this.uiDelay != 0) + return; + if (flag) + { + if (dx != 0 || dy != 0) + { + this.uiDelay = this.uiDelayValue; + this.uiDelayValue = (sbyte) 6; + } + if (this.menuMode == MenuMode.MAP) + this.PositionMapScreenCursor(dx, dy); + else if (this.menuMode == MenuMode.WORLD_SELECT) + WorldSelect.UpdateCursor(dx, dy); + else if (this.menuMode == MenuMode.GAME_MODE) + { + GameMode.UpdateCursor(dx, dy); + } + else + { + this.UpdateInventoryMenu(); + if (this.inventorySection == UI.InventorySection.CRAFTING) + this.PositionCraftingCursor(dx, dy); + else + this.PositionInventoryCursor(dx, dy); + } + } + else + { + if (dx == 0 && dy == 0) + return; + this.uiDelay = (sbyte) 4; + this.mouseX += (short) dx; + if ((int) this.mouseX < 0) + this.mouseX = (short) 0; + else if ((int) this.mouseX > 944) + this.mouseX = (short) 944; + this.mouseY += (short) dy; + if ((int) this.mouseY < 0) + { + this.mouseY = (short) 0; + } + else + { + if ((int) this.mouseY <= 524) + return; + this.mouseY = (short) 524; + } + } + } + else if ((int) this.uiDelay > 0) + { + if ((double) this.gpState.ThumbSticks.Left.LengthSquared() <= 1.0 / 64.0 && (double) this.gpState.ThumbSticks.Right.LengthSquared() <= 1.0 / 64.0 && (this.gpState.DPad.Up == ButtonState.Released && this.gpState.DPad.Down == ButtonState.Released) && (this.gpState.DPad.Left == ButtonState.Released && this.gpState.DPad.Right == ButtonState.Released)) + { + this.uiDelay = (sbyte) 0; + this.uiDelayValue = (sbyte) 12; + } + else + --this.uiDelay; + } + else + { + int num1 = this.IsLeftButtonDown() ? -1 : (this.IsRightButtonDown() ? 1 : 0); + if (num1 < 0) + { + if ((int) --this.uiX < 0) + this.uiX = (short) ((int) this.uiWidth - 1); + this.uiDelay = this.uiDelayValue; + this.uiDelayValue = (sbyte) 6; + } + else if (num1 > 0) + { + if ((int) ++this.uiX == (int) this.uiWidth) + this.uiX = (short) 0; + this.uiDelay = this.uiDelayValue; + this.uiDelayValue = (sbyte) 6; + } + int num2 = this.IsDownButtonDown() ? -1 : (this.IsUpButtonDown() ? 1 : 0); + while (true) + { + do + { + if (num2 > 0) + { + if ((int) --this.uiY < 0) + this.uiY = (short) ((int) this.uiHeight - 1); + this.uiDelay = this.uiDelayValue; + this.uiDelayValue = (sbyte) 6; + } + else if (num2 < 0) + { + if ((int) ++this.uiY == (int) this.uiHeight) + this.uiY = (short) 0; + this.uiDelay = this.uiDelayValue; + this.uiDelayValue = (sbyte) 6; + } + this.mouseX = this.uiCoords[(int) this.uiX + (int) this.uiY * (int) this.uiWidth].X; + if ((int) this.mouseX != 0) + goto label_87; + } + while (num2 != 0 || (int) ++this.uiY < (int) this.uiHeight); + this.uiY = (short) 0; + } +label_87: + this.mouseY = this.uiCoords[(int) this.uiX + (int) this.uiY * (int) this.uiWidth].Y; + } + } + + public static void UpdateOnce() + { + UI.UpdateCursorColor(); + UI.mouseTextBrightness += (byte) UI.mouseTextColorChange; + if ((int) UI.mouseTextBrightness <= 175 || (int) UI.mouseTextBrightness >= 250) + UI.mouseTextColorChange = -UI.mouseTextColorChange; + UI.mouseTextColor.R = UI.mouseTextBrightness; + UI.mouseTextColor.G = UI.mouseTextBrightness; + UI.mouseTextColor.B = UI.mouseTextBrightness; + UI.mouseTextColor.A = UI.mouseTextBrightness; + UI.invAlpha += (byte) UI.invDir; + if ((int) UI.invAlpha > 240) + { + UI.invAlpha = (byte) 240; + UI.invDir = -UI.invDir; + } + else if ((int) UI.invAlpha < 180) + { + UI.invAlpha = (byte) 180; + UI.invDir = -UI.invDir; + } + UI.essScale += UI.essDir; + if ((double) UI.essScale > 1.0) + { + UI.essScale = 1f; + UI.essDir = -UI.essDir; + } + else if ((double) UI.essScale < 0.699999988079071) + { + UI.essScale = 0.7f; + UI.essDir = -UI.essDir; + } + UI.blueWave += UI.blueDelta; + if ((double) UI.blueWave > 1.0) + { + UI.blueWave = 1f; + UI.blueDelta = -UI.blueDelta; + } + else if ((double) UI.blueWave < 0.970000028610229) + { + UI.blueWave = 0.97f; + UI.blueDelta = -UI.blueDelta; + } + if (!MessageBox.current.autoUpdate) + return; + MessageBox.Update(); + } + + public void UpdateGamePad() + { + if (Main.hasFocus) + { + this.gpPrevState = this.gpState; + this.gpState = GamePad.GetState(this.controller); + } + else + { + UI ui1 = this; + UI ui2 = this; + UI ui3 = this; + GamePadState gamePadState1 = new GamePadState(); + GamePadState gamePadState2 = gamePadState1; + ui3.gpState = gamePadState2; + GamePadState gamePadState3; + GamePadState gamePadState4 = gamePadState3 = gamePadState1; + ui2.gpState = gamePadState3; + GamePadState gamePadState5 = gamePadState4; + ui1.gpPrevState = gamePadState5; + } + } + + public void Update() + { + if (UI.main.menuMode == MenuMode.WELCOME) + { + if (this.IsSelectButtonTriggered()) + { + this.ClearButtonTriggers(); + this.OpenMainView((SignedInGamer) null); + } + } + else if (this.view == null) + { + if (!Main.isGameStarted || !this.IsSelectButtonTriggered() || Main.IsTutorial() || Netplay.session != null && ((ReadOnlyCollection) Netplay.session.AllGamers).Count == 8) + return; + this.ClearButtonTriggers(); + this.SetMenu(MenuMode.CHARACTER_SELECT, false, true); + this.OpenView(); + return; + } + UI.current = this; + if (this.menuType == MenuType.NONE) + { + if (this.IsButtonUntriggered(Buttons.Start)) + { + Main.PlaySound(10); + this.uiFade = 0.0f; + this.uiFadeTarget = 1f; + this.menuType = MenuType.PAUSE; + this.SetMenu(MenuMode.PAUSE, true, false); + this.ClearButtonTriggers(); + } + else if (this.IsButtonTriggered(Buttons.Back)) + { + this.miniMap.CreateMap(this); + Main.PlaySound(10); + if (Main.netMode == 1) + { + NetMessage.CreateMessage0(11); + NetMessage.SendMessage(); + } + this.SetMenu(MenuMode.MAP, true, false); + this.menuType = MenuType.PAUSE; + this.ClearButtonTriggers(); + } + } + else + { + if (this.transferredPlayerStorage.Count > 0 && !MessageBox.IsVisible()) + this.DeleteTransferredPlayerStorage(); + if (UI.saveIconMessageTime <= 0) + this.UpdateMenu(); + } + if (this.menuType != MenuType.MAIN) + this.UpdateIngame(); + if ((int) this.teamCooldown > 0 && ((int) --this.teamCooldown == 0 && (int) this.teamSelected != (int) this.player.team)) + { + this.player.team = this.teamSelected; + NetMessage.CreateMessage1(45, (int) this.myPlayer); + NetMessage.SendMessage(); + } + if ((int) this.pvpCooldown > 0 && ((int) --this.pvpCooldown == 0 && this.pvpSelected != this.player.hostile)) + { + this.player.hostile = this.pvpSelected; + NetMessage.CreateMessage1(30, (int) this.myPlayer); + NetMessage.SendMessage(); + } + this.UpdateMouse(); + if (this.signedInGamer == null || this.signedInGamer.IsGuest || Main.isTrial) + return; + this.UpdateAchievements(); + } + + private void UpdateIngame() + { + if (this.editSign) + this.player.UpdateEditSign(); + if (this.autoSave && Main.tutorialState == Tutorial.NUM_TUTORIALS && this.HasPlayerStorage()) + { + if (!this.saveTime.get_IsRunning()) + this.saveTime.Start(); + else if (this.saveTime.get_ElapsedMilliseconds() > 600000L) + { + this.saveTime.Reset(); + if (Main.netMode == 1 || UI.main != this) + WorldGen.savePlayerWhilePlaying(); + else + WorldGen.saveAllWhilePlaying(); + } + } + else if (this.saveTime.get_IsRunning()) + this.saveTime.Stop(); + this.view.itemTextLocal.Update(); + this.view.dustLocal.UpdateDust(); + this.view.spawnSnow(); + } + + private void OpenMainView(SignedInGamer gamer = null) + { + if (UI.main != this) + { + this.view = UI.main.view; + this.view.ui = this; + this.view.player = this.player; + UI.main.view = (WorldView) null; + UI.main = this; + Main.musicVolume = this.musicVolume; + Main.soundVolume = this.soundVolume; + } + this.signedInGamer = gamer; + this.SetMenu(MenuMode.TITLE, true, false); + if (gamer == null) + this.ShowSignInPortal(); + else + this.InitPlayerStorage(); + } + + private void OpenView() + { + this.CheckHDTV(); + MessageBox.Update(); + for (int index = 0; index < 4; ++index) + { + UI ui = Main.ui[index]; + if (ui.view != null) + ui.setView(WorldView.getViewType(ui.controller, this), true); + } + this.setView(WorldView.getViewType(this.controller, this), true); + this.ShowSignInPortal(); + } + + public void ClearButtonTriggers() + { + this.gpPrevState = this.gpState; + } + + public bool IsBackButtonTriggered() + { + if (this.gpState.IsButtonDown(Buttons.Back) && this.gpPrevState.IsButtonUp(Buttons.Back)) + return true; + if (this.gpState.IsButtonDown(Buttons.B)) + return this.gpPrevState.IsButtonUp(Buttons.B); + else + return false; + } + + public bool IsSelectButtonTriggered() + { + if (this.gpState.IsButtonDown(Buttons.Start) && this.gpPrevState.IsButtonUp(Buttons.Start)) + return true; + if (this.gpState.IsButtonDown(Buttons.A)) + return this.gpPrevState.IsButtonUp(Buttons.A); + else + return false; + } + + public bool IsLeftButtonDown() + { + if (!this.gpState.IsButtonDown(Buttons.DPadLeft) && (double) this.gpState.ThumbSticks.Left.X >= -0.125) + return (double) this.gpState.ThumbSticks.Right.X < -0.125; + else + return true; + } + + public bool IsRightButtonDown() + { + if (!this.gpState.IsButtonDown(Buttons.DPadRight) && (double) this.gpState.ThumbSticks.Left.X <= 0.125) + return (double) this.gpState.ThumbSticks.Right.X > 0.125; + else + return true; + } + + public bool IsUpButtonDown() + { + if (!this.gpState.IsButtonDown(Buttons.DPadUp) && (double) this.gpState.ThumbSticks.Left.Y <= 0.125) + return (double) this.gpState.ThumbSticks.Right.Y > 0.125; + else + return true; + } + + public bool IsDownButtonDown() + { + if (!this.gpState.IsButtonDown(Buttons.DPadDown) && (double) this.gpState.ThumbSticks.Left.Y >= -0.125) + return (double) this.gpState.ThumbSticks.Right.Y < -0.125; + else + return true; + } + + public bool IsAlternateLeftButtonDown() + { + return (double) this.gpState.ThumbSticks.Right.X < -0.125; + } + + public bool IsAlternateRightButtonDown() + { + return (double) this.gpState.ThumbSticks.Right.X > 0.125; + } + + public bool IsAlternateUpButtonDown() + { + return (double) this.gpState.ThumbSticks.Right.Y > 0.125; + } + + public bool IsAlternateDownButtonDown() + { + return (double) this.gpState.ThumbSticks.Right.Y < -0.125; + } + + public bool IsLeftButtonTriggered() + { + if (this.gpState.IsButtonDown(Buttons.DPadLeft) && this.gpPrevState.IsButtonUp(Buttons.DPadLeft)) + return true; + if ((double) this.gpState.ThumbSticks.Left.X < -0.125) + return (double) this.gpPrevState.ThumbSticks.Left.X >= -0.125; + else + return false; + } + + public bool IsRightButtonTriggered() + { + if (this.gpState.IsButtonDown(Buttons.DPadRight) && this.gpPrevState.IsButtonUp(Buttons.DPadRight)) + return true; + if ((double) this.gpState.ThumbSticks.Left.X > 0.125) + return (double) this.gpPrevState.ThumbSticks.Left.X <= 0.125; + else + return false; + } + + public bool IsButtonDown(Buttons b) + { + return this.gpState.IsButtonDown(b); + } + + public bool IsButtonTriggered(Buttons b) + { + if (this.gpState.IsButtonDown(b)) + return this.gpPrevState.IsButtonUp(b); + else + return false; + } + + public bool IsButtonUntriggered(Buttons b) + { + if (this.gpState.IsButtonUp(b)) + return this.gpPrevState.IsButtonDown(b); + else + return false; + } + + private void DrawCursor() + { + if (this.menuType != MenuType.NONE || (int) this.inventoryMode != 0 || (this.npcChatText != null || this.player.dead)) + return; + bool flag = (int) this.player.inventory[(int) this.player.selectedItem].pick > 0 || (int) this.player.inventory[(int) this.player.selectedItem].axe > 0 || ((int) this.player.inventory[(int) this.player.selectedItem].hammer > 0 || (int) this.player.inventory[(int) this.player.selectedItem].createTile >= 0) || (int) this.player.inventory[(int) this.player.selectedItem].createWall >= 0; + if (this.cursorHighlight > 0) + { + int num1 = 16 - (this.view.screenPosition.X & 15) & 15; + int x = ((int) this.mouseX - num1 & -16) + num1; + int num2 = 16 - (this.view.screenPosition.Y & 15) & 15; + int y = ((int) this.mouseY - num2 & -16) + num2; + Main.DrawRect(new Rectangle(x, y, 16, 16), new Color(this.cursorHighlight << 1, this.cursorHighlight << 1, 0, this.cursorHighlight << 1), true); + } + if (flag && (double) this.player.velocity.X == 0.0 && (double) this.player.velocity.Y == 0.0) + { + if (this.cursorHighlight < 64) + this.cursorHighlight += 4; + } + else if (this.cursorHighlight > 0) + this.cursorHighlight -= 2; + Rectangle rectangle = new Rectangle(); + rectangle.Y = (int) Main.frameCounter & 16; + rectangle.Width = 16; + rectangle.Height = 16; + Vector2 vector2 = new Vector2(); + if (!this.smartCursor) + { + rectangle.X = 16; + vector2.X = (float) ((int) this.mouseX - 8); + vector2.Y = (float) ((int) this.mouseY - 8); + } + else + { + if ((double) this.player.controlDir.LengthSquared() <= 576.0) + return; + vector2.X = (float) (this.player.aabb.X + 10 - this.view.screenPosition.X + (int) this.player.controlDir.X - 8); + vector2.Y = (float) (this.player.aabb.Y + 21 - this.view.screenPosition.Y + (int) this.player.controlDir.Y - 8); + } + Main.spriteBatch.Draw(UI.cursorTexture, vector2, new Rectangle?(rectangle), Color.White); + } + + public void DrawInventoryCursor(int x, int y, double scale, int alpha = 255) + { + alpha = (int) UI.mouseTextBrightness * alpha >> 8; + SpriteSheet<_sheetSprites>.DrawTL(448, x, y, new Color(alpha, alpha, alpha, alpha), (float) scale); + this.mouseX = (short) x; + this.mouseY = (short) y; + } + + public static bool IsStorageEnabledForAnyPlayer() + { + if (Main.isTrial) + return false; + for (int index = 0; index < 4; ++index) + { + if (Main.ui[index].HasPlayerStorage()) + return true; + } + return false; + } + + public void CheckPlayerStorage(string name) + { + bool flag; + IAsyncResult asyncResult = StorageDeviceExtensions.BeginOpenContainer(this.playerStorage.Device, name, true, ref flag, (AsyncCallback) null, (object) null); + asyncResult.AsyncWaitHandle.WaitOne(); + StorageContainer storageContainer = this.playerStorage.Device.EndOpenContainer(asyncResult); + asyncResult.AsyncWaitHandle.Close(); + if (flag) + { + if (storageContainer.GetFileNames().Length == 0) + { + Main.ShowSaveIcon(); + Main.HideSaveIcon(); + } + else + { + MessageBox.Show(this.controller, Lang.menu[9], string.Format(Lang.inter[78], (object) name), new string[1] + { + Lang.menu[90] + }, 1 != 0); + this.transferredPlayerStorage.Add(name); + } + } + storageContainer.Dispose(); + } + + public void DeleteTransferredPlayerStorage() + { + for (int index = this.transferredPlayerStorage.Count - 1; index >= 0; --index) + this.playerStorage.Device.DeleteContainer(this.transferredPlayerStorage[index]); + this.transferredPlayerStorage.Clear(); + this.DeviceSelected((object) null, (EventArgs) null); + } + + public StorageContainer OpenPlayerStorage(string name) + { + IAsyncResult asyncResult = this.playerStorage.Device.BeginOpenContainer(name, (AsyncCallback) null, (object) null); + asyncResult.AsyncWaitHandle.WaitOne(); + StorageContainer storageContainer = this.playerStorage.Device.EndOpenContainer(asyncResult); + asyncResult.AsyncWaitHandle.Close(); + return storageContainer; + } + + private void DeviceDisconnected(object sender, EventArgs args) + { + this.LoadPlayers(); + WorldSelect.LoadWorlds(); + MessageBox.Show(this.controller, Lang.menu[69], Lang.menu[70], new string[1] + { + Lang.menu[90] + }, 1 != 0); + if (this.menuMode != MenuMode.CONFIRM_DELETE_CHARACTER && this.menuMode != MenuMode.CONFIRM_DELETE_WORLD) + return; + this.PrevMenu(-1); + } + + private void DeviceSelectorCanceled(object sender, EventArgs args) + { + this.LoadPlayers(); + WorldSelect.LoadWorlds(); + MessageBox.Show(this.controller, Lang.menu[69], Lang.menu[66], new string[1] + { + Lang.menu[90] + }, 1 != 0); + } + + private void DeviceSelected(object sender, EventArgs e) + { + try + { + this.CheckPlayerStorage("Settings"); + this.CheckPlayerStorage("Characters"); + this.CheckPlayerStorage("Worlds"); + } + catch (Exception ex) + { + this.transferredPlayerStorage.Clear(); + return; + } + if (this.transferredPlayerStorage.Count > 0) + return; + if (!this.OpenSettings()) + MessageBox.Show(this.controller, Lang.menu[9], Lang.menu[102], new string[1] + { + Lang.menu[90] + }, 1 != 0); + this.LoadPlayers(); + if (this != UI.main || WorldSelect.LoadWorlds()) + return; + MessageBox.Show(this.controller, Lang.menu[9], Lang.menu[103], new string[1] + { + Lang.menu[90] + }, 1 != 0); + } + + public void LoadPlayers() + { + if (this.HasPlayerStorage()) + { + try + { + StorageContainer c = this.OpenPlayerStorage("Characters"); +label_2: + try + { + string[] fileNames = c.GetFileNames("player?.plr"); + int num = fileNames.Length; + if (num > 5) + num = 5; + for (int index = 0; index < 5; ++index) + { + if (index < num) + { + this.loadPlayerPath[index] = fileNames[index]; + this.loadPlayer[index].Load(c, this.loadPlayerPath[index]); + if (this.loadPlayer[index].name == null) + { + MessageBox.Show(this.controller, Lang.menu[9], Lang.menu[12], new string[1] + { + Lang.menu[90] + }, 1 != 0); + goto label_2; + } + } + else + this.loadPlayer[index] = new Player(); + } + this.numLoadPlayers = (sbyte) num; + } + finally + { + if (c != null) + ((IDisposable) c).Dispose(); + } + } + catch (IOException ex) + { + this.ReadError(); + this.numLoadPlayers = (sbyte) 0; + } + catch (Exception ex) + { + this.numLoadPlayers = (sbyte) 0; + } + } + else + this.numLoadPlayers = (sbyte) 0; + if (this.menuMode != MenuMode.CHARACTER_SELECT) + return; + this.ResetPlayerMenuSelection(); + } + + public void SaveSettings() + { + if (!this.HasPlayerStorage()) + return; + using (MemoryStream memoryStream = new MemoryStream(512)) + { + using (BinaryWriter binaryWriter = new BinaryWriter((Stream) memoryStream)) + { + binaryWriter.Write(5); + binaryWriter.Write(0U); + binaryWriter.Write(this.soundVolume); + binaryWriter.Write(this.musicVolume); + binaryWriter.Write(this.autoSave); + binaryWriter.Write(this.showItemText); + binaryWriter.Write(this.alternateGrappleControls); + byte[] buffer1 = this.Statistics.Serialize(); + binaryWriter.Write(buffer1); + binaryWriter.Write(this.totalSteps); + binaryWriter.Write(this.totalPicked); + binaryWriter.Write(this.totalBarsCrafted); + binaryWriter.Write(this.totalAnvilCrafting); + binaryWriter.Write(this.totalWires); + binaryWriter.Write(this.totalAirTime); + binaryWriter.Write(this.petSpawnMask); + int count = this.armorFound.Length + 7 >> 3; + byte[] buffer2 = new byte[count]; + this.armorFound.CopyTo((Array) buffer2, 0); + binaryWriter.Write((ushort) count); + binaryWriter.Write(buffer2, 0, count); + binaryWriter.Write(this.isOnline); + binaryWriter.Write(this.isInviteOnly); + int num1 = this.blacklist.Count; + int num2 = num1; + if (num1 > (int) ushort.MaxValue) + num1 = (int) ushort.MaxValue; + binaryWriter.Write((ushort) num1); + for (int index = num2 - num1; index < num2; ++index) + binaryWriter.Write(this.blacklist[index]); + CRC32 crC32 = new CRC32(); + crC32.Update(memoryStream.GetBuffer(), 8, (int) memoryStream.Length - 8); + binaryWriter.Seek(4, SeekOrigin.Begin); + binaryWriter.Write(crC32.GetValue()); + Main.ShowSaveIcon(); + try + { + if (this.TestStorageSpace("Settings", "config.dat", (int) memoryStream.Length)) + { + using (StorageContainer storageContainer = this.OpenPlayerStorage("Settings")) + { + using (Stream stream = storageContainer.OpenFile("config.dat", FileMode.Create)) + { + stream.Write(memoryStream.GetBuffer(), 0, (int) memoryStream.Length); + stream.Close(); + } + this.settingsDirty = false; + } + } + } + catch (IOException ex) + { + this.WriteError(); + } + catch (Exception ex) + { + } + binaryWriter.Close(); + Main.HideSaveIcon(); + } + } + } + + private bool OpenSettings() + { + bool flag = true; + try + { + using (StorageContainer storageContainer = this.OpenPlayerStorage("Settings")) + { + if (storageContainer.FileExists("config.dat")) + { + try + { + using (Stream stream = storageContainer.OpenFile("config.dat", FileMode.Open)) + { + using (MemoryStream memoryStream = new MemoryStream((int) stream.Length)) + { + memoryStream.SetLength(stream.Length); + stream.Read(memoryStream.GetBuffer(), 0, (int) stream.Length); + stream.Close(); + using (BinaryReader binaryReader = new BinaryReader((Stream) memoryStream)) + { + int num1 = binaryReader.ReadInt32(); + if (num1 > 5) + throw new InvalidOperationException("Invalid version"); + if (num1 >= 4) + { + CRC32 crC32 = new CRC32(); + crC32.Update(memoryStream.GetBuffer(), 8, (int) memoryStream.Length - 8); + if ((int) crC32.GetValue() != (int) binaryReader.ReadUInt32()) + throw new InvalidOperationException("Invalid CRC32"); + } + this.soundVolume = binaryReader.ReadSingle(); + this.musicVolume = binaryReader.ReadSingle(); + this.autoSave = binaryReader.ReadBoolean(); + this.showItemText = binaryReader.ReadBoolean(); + this.alternateGrappleControls = binaryReader.ReadBoolean(); + if (num1 <= 3) + this.alternateGrappleControls = false; + this.UpdateAlternateGrappleControls(); + if (this == UI.main) + { + Main.musicVolume = this.musicVolume; + Main.soundVolume = this.soundVolume; + } + int count1 = Statistics.CalculateSerialisationSize(); + this.Statistics.Deserialize(binaryReader.ReadBytes(count1)); + if (num1 >= 2) + { + if (num1 >= 3) + { + this.totalSteps = binaryReader.ReadUInt32(); + this.totalPicked = binaryReader.ReadUInt32(); + this.totalBarsCrafted = binaryReader.ReadUInt32(); + this.totalAnvilCrafting = binaryReader.ReadUInt32(); + this.totalWires = binaryReader.ReadUInt32(); + this.totalAirTime = binaryReader.ReadUInt32(); + this.petSpawnMask = binaryReader.ReadByte(); + int count2 = (int) binaryReader.ReadUInt16(); + this.armorFound = new BitArray(binaryReader.ReadBytes(count2)); + if (this.armorFound.Length < 632) + this.armorFound.Length = 632; + } + this.isOnline = binaryReader.ReadBoolean(); + this.isInviteOnly = binaryReader.ReadBoolean(); + } + this.blacklist.Clear(); + if (num1 >= 5) + { + int num2 = (int) binaryReader.ReadUInt16(); + this.blacklist.Capacity = num2 + 4; + for (; num2 > 0; --num2) + this.blacklist.Add(binaryReader.ReadUInt64()); + } + binaryReader.Close(); + } + } + } + } + catch (InvalidOperationException ex) + { + Main.ShowSaveIcon(); + flag = false; + storageContainer.DeleteFile("config.dat"); + this.armorFound = new BitArray(632); + Main.HideSaveIcon(); + } + catch (Exception ex) + { + } + } + } + this.settingsDirty = !flag; + } + catch (IOException ex) + { + if (!flag) + { + this.WriteError(); + flag = true; + } + else + this.ReadError(); + } + catch (Exception ex) + { + } + if (Main.netMode == 1 && Main.isGameStarted) + this.CheckBlacklist(); + return flag; + } + + public void ErasePlayer(int i) + { + if (this.HasPlayerStorage()) + { + Main.ShowSaveIcon(); + try + { + using (StorageContainer storageContainer = this.OpenPlayerStorage("Characters")) + storageContainer.DeleteFile(this.loadPlayerPath[i]); + } + catch (IOException ex) + { + this.WriteError(); + } + catch (Exception ex) + { + } + Main.HideSaveIcon(); + } + --this.numLoadPlayers; + this.loadPlayer[i] = this.loadPlayer[(int) this.numLoadPlayers]; + this.loadPlayerPath[i] = this.loadPlayerPath[(int) this.numLoadPlayers]; + } + + private string nextLoadPlayer() + { + int num = 0; + string file = (string) null; + if (this.HasPlayerStorage()) + { + try + { + using (StorageContainer storageContainer = this.OpenPlayerStorage("Characters")) + { + do + { + ++num; + file = "player" + (object) num + ".plr"; + } + while (storageContainer.FileExists(file)); + } + } + catch (IOException ex) + { + this.ReadError(); + file = (string) null; + } + catch (Exception ex) + { + file = (string) null; + } + } + return file; + } + + public void setView(WorldView.Type viewType, bool noAutoFullScreen = false) + { + if (this.view != null) + { + for (int index = 0; index < UI.numActiveViews; ++index) + { + if (UI.activeView[index] == this.view) + { + UI.activeView[index] = UI.activeView[--UI.numActiveViews]; + UI.activeView[UI.numActiveViews] = (WorldView) null; + break; + } + } + } + if (viewType != WorldView.Type.NONE) + { + if (this.view == null) + { + this.view = new WorldView(); + this.view.player = this.player; + this.view.ui = this; + } + UI.activeView[UI.numActiveViews++] = this.view; + UI.current = this; + if (UI.numActiveViews == 2) + { + UI.LoadSplitscreenFonts(UI.theGame.Content); + this.InvalidateCachedText(); + } + if (this.view.setViewType(viewType) && this.menuType != MenuType.MAIN) + this.worldFade = -0.25f; + } + else if (this.view != null) + { + this.view.Dispose(); + this.view = (WorldView) null; + if (UI.numActiveViews == 1) + { + UI.LoadFonts(UI.theGame.Content); + this.InvalidateCachedText(); + } + if (UI.main == this) + { + if (UI.numActiveViews > 0) + { + for (int index = 0; index < 4; ++index) + { + if (Main.ui[index].view != null) + { + UI.main = Main.ui[index]; + WorldSelect.LoadWorlds(); + break; + } + } + } + else + UI.main = (UI) null; + } + } + else + noAutoFullScreen = true; + if (this.player != null) + { + this.player.view = this.view; + if (this.view == null) + this.player.active = (byte) 0; + } + if (noAutoFullScreen) + return; + if (UI.numActiveViews == 1 && UI.main != null && (UI.main.view != null && !UI.main.view.isFullScreen())) + { + UI.main.view.setViewType(WorldView.Type.FULLSCREEN); + if (UI.main.menuType == MenuType.MAIN) + return; + UI.main.worldFade = -0.25f; + } + else + { + for (int index = 0; index < 4; ++index) + { + UI ui = Main.ui[index]; + if (ui.view != null) + ui.view.setViewType(WorldView.getViewType(ui.controller, (UI) null)); + } + } + } + + public void setPlayer(int id, bool swapIfUsed = true) + { + if (id < 0) + { + for (int index = 7; index >= 0; --index) + { + if ((int) Main.player[index].active == 0 && Main.player[index].view == null) + { + id = index; + break; + } + } + if (id < 0) + { + this.myPlayer = (byte) 8; + this.player = (Player) null; + return; + } + } + if (this.player != null && id != (int) this.myPlayer) + { + Player player = this.player.DeepCopy(); + player.whoAmI = (byte) id; + this.player.ui = (UI) null; + this.player.view = (WorldView) null; + if (swapIfUsed) + { + for (int index = 0; index < 4; ++index) + { + UI ui = Main.ui[index]; + if (ui != this && (int) ui.myPlayer == id) + { + ui.setPlayer((int) this.myPlayer, false); + break; + } + } + } + if (id != (int) this.myPlayer) + Main.player[id] = player; + } + this.myPlayer = (byte) id; + this.player = Main.player[id]; + this.player.ui = this; + this.player.view = this.view; + if (this.signedInGamer != null) + this.player.name = this.signedInGamer.Gamertag; + this.teamCooldown = (short) 0; + this.teamSelected = this.player.team; + this.pvpCooldown = (short) 0; + this.pvpSelected = this.player.hostile; + if (this.view != null) + this.view.player = this.player; + else + this.player.active = (byte) 0; + } + + public void setPlayer(Player p) + { + if (this.player != null && p != this.player) + { + this.player.ui = (UI) null; + this.player.view = (WorldView) null; + } + this.player = p; + this.teamCooldown = (short) 0; + this.pvpCooldown = (short) 0; + if (this.view != null) + this.view.player = p; + if (p != null) + { + this.teamSelected = p.team; + this.pvpSelected = p.hostile; + p.ui = this; + p.view = this.view; + p.whoAmI = this.myPlayer; + if (this.signedInGamer != null) + p.name = this.signedInGamer.Gamertag; + p.active = (byte) 0; + Main.player[(int) this.myPlayer] = p; + } + else + { + this.myPlayer = (byte) 8; + this.setView(WorldView.Type.NONE, false); + } + } + + public void JoinSession(int newPlayerIndex) + { + this.setPlayer(newPlayerIndex, true); + if (Main.netMode != 1) + return; + NetMessage.CreateMessage0(11); + NetMessage.SendMessage(); + } + + public void LeaveSession() + { + this.localGamer = (LocalNetworkGamer) null; + } + + public void InviteAccepted(InviteAcceptedEventArgs e) + { + if (e.IsCurrentSession || Netplay.isJoiningRemoteInvite) + { + if (Netplay.session == null) + { + if (!Netplay.gamersWhoReceivedInvite.Contains(e.Gamer)) + Netplay.gamersWhoReceivedInvite.Add(e.Gamer); + if (!Netplay.gamersWaitingToJoinInvite.Contains(e.Gamer)) + Netplay.gamersWaitingToJoinInvite.Add(e.Gamer); + } + if (this.view != null) + return; + this.SetMenu(MenuMode.CHARACTER_SELECT, false, true); + this.OpenView(); + } + else + { + Netplay.isJoiningRemoteInvite = true; + Netplay.gamersWhoReceivedInvite.Add(e.Gamer); + Netplay.gamersWaitingToJoinInvite.Add(e.Gamer); + for (int index = 0; index < 4; ++index) + { + SignedInGamer signedInGamer = Main.ui[index].signedInGamer; + if (signedInGamer != null && !Netplay.gamersWaitingToJoinInvite.Contains(signedInGamer)) + Netplay.gamersWaitingToJoinInvite.Add(signedInGamer); + } + if (Netplay.session != null) + this.ExitGame(); + else if (UI.main.menuMode == MenuMode.WELCOME) + { + this.OpenMainView(e.Gamer); + } + else + { + if (Main.worldGenThread != null) + { + Main.worldGenThread.Abort(); + Main.worldGenThread = (Thread) null; + WorldGen.gen = false; + } + UI.main.SetMenu(MenuMode.TITLE, false, true); + } + } + } + + private static void CancelInvite(SignedInGamer gamer) + { + Netplay.gamersWhoReceivedInvite.Remove(gamer); + if (Netplay.gamersWhoReceivedInvite.Count == 0) + { + Netplay.isJoiningRemoteInvite = false; + Netplay.gamersWaitingToJoinInvite.Clear(); + } + else + Netplay.gamersWaitingToJoinInvite.Remove(gamer); + } + + private unsafe void DrawControlsIngame() + { + if (this.menuType != MenuType.NONE) + return; + Main.strBuilder.Length = 0; + if (!Main.TutorialMaskY) + { + Main.strBuilder.Append(Lang.controls(Lang.CONTROLS.INVENTORY)); + Main.strBuilder.Append(' '); + } + if ((int) this.player.grappleItemSlot >= 0) + { + Main.strBuilder.Append(Lang.controls(this.alternateGrappleControls ? Lang.CONTROLS.GRAPPLE_ALT : Lang.CONTROLS.GRAPPLE)); + Main.strBuilder.Append(' '); + } + fixed (Item* objPtr = &this.player.inventory[(int) this.player.selectedItem]) + { + if (!Main.TutorialMaskRT && (int) objPtr->type > 0) + { + if ((int) objPtr->pick > 0) + Main.strBuilder.Append(Lang.controls(Lang.CONTROLS.DIG)); + else if ((int) objPtr->axe > 0) + Main.strBuilder.Append(Lang.controls(Lang.CONTROLS.CHOP)); + else if ((int) objPtr->hammer > 0) + Main.strBuilder.Append(Lang.controls(Lang.CONTROLS.HIT)); + else if ((int) objPtr->createTile >= 0 || (int) objPtr->createWall >= 0) + Main.strBuilder.Append(Lang.controls(Lang.CONTROLS.BUILD)); + else if ((int) objPtr->ammo > 0 || (int) objPtr->damage > 0) + Main.strBuilder.Append(Lang.controls(Lang.CONTROLS.ATTACK)); + else + Main.strBuilder.Append(Lang.controls(Lang.CONTROLS.USE)); + Main.strBuilder.Append(' '); + } + if (!Main.TutorialMaskB) + { + if ((int) this.player.npcChatBubble >= 0) + Main.strBuilder.Append(Lang.controls(Lang.CONTROLS.TALK)); + else if ((int) this.player.tileInteractX != 0) + Main.strBuilder.Append(Lang.controls(Lang.CONTROLS.INTERACT)); + } + } + UI.DrawStringLB(UI.fontSmallOutline, this.view.SAFE_AREA_OFFSET_L, this.view.SAFE_AREA_OFFSET_B); + } + + private void DrawControlsInventory() + { + if (this.menuType != MenuType.NONE) + return; + Main.strBuilder.Length = 0; + Main.strBuilder.Append(Lang.controls(Lang.CONTROLS.CHANGE_MENU)); + Main.strBuilder.Append(' '); + if ((int) this.toolTip.type > 0 && !this.reforge && !this.craftGuide) + { + if (this.toolTip.isEquipable() && (this.inventorySection != UI.InventorySection.EQUIP || (int) this.inventoryEquipX == 0)) + { + Main.strBuilder.Append(Lang.controls(Lang.CONTROLS.EQUIP)); + Main.strBuilder.Append(' '); + } + if ((int) this.toolTip.type >= 599 && (int) this.toolTip.type <= 601) + { + Main.strBuilder.Append(Lang.controls(Lang.CONTROLS.OPEN)); + Main.strBuilder.Append(' '); + } + else if ((int) this.toolTip.stack > 1 && ((int) this.mouseItem.type == 0 || (int) this.mouseItem.netID == (int) this.toolTip.netID)) + { + Main.strBuilder.Append(Lang.controls(Lang.CONTROLS.SELECT_ONE)); + Main.strBuilder.Append(' '); + } + } + if ((int) this.mouseItem.type == 0) + { + if ((int) this.toolTip.type > 0) + { + if (this.reforge) + { + if (this.toolTip.Prefix(-3)) + { + Main.strBuilder.Append(Lang.controls(Lang.CONTROLS.REFORGE)); + Main.strBuilder.Append(' '); + } + } + else if (this.craftGuide) + { + if (this.toolTip.material) + { + Main.strBuilder.Append(Lang.controls(Lang.CONTROLS.SHOW_RECIPES)); + Main.strBuilder.Append(' '); + } + } + else + { + Main.strBuilder.Append(Lang.controls(Lang.CONTROLS.SELECT_ALL)); + Main.strBuilder.Append(' '); + } + } + else if (this.inventorySection == UI.InventorySection.CHEST) + { + if ((int) this.inventoryChestX < 0) + { + switch (this.inventoryChestY) + { + case (sbyte) 1: + Main.strBuilder.Append(Lang.inter[29]); + break; + case (sbyte) 2: + Main.strBuilder.Append(Lang.inter[30]); + break; + case (sbyte) 3: + Main.strBuilder.Append(Lang.inter[31]); + break; + } + Main.strBuilder.Append(' '); + } + } + else if (this.inventorySection == UI.InventorySection.EQUIP && (int) this.inventoryEquipY == 0) + { + int index = (int) this.inventoryEquipX + (int) this.inventoryBuffX; + if ((int) this.player.buff[index].Time > 0 && !this.player.buff[index].IsDebuff()) + { + Main.strBuilder.Append(Lang.controls(Lang.CONTROLS.CANCEL_BUFF)); + Main.strBuilder.Append(' '); + } + } + } + else + { + bool flag1 = false; + bool flag2 = true; + if (this.inventorySection == UI.InventorySection.EQUIP) + { + switch (this.inventoryEquipY) + { + case (sbyte) 0: + flag1 = (int) this.mouseItem.headSlot >= 0; + break; + case (sbyte) 1: + flag1 = (int) this.mouseItem.bodySlot >= 0; + break; + case (sbyte) 2: + flag1 = (int) this.mouseItem.legSlot >= 0; + break; + default: + flag1 = this.mouseItem.accessory; + break; + } + } + else if (this.inventorySection == UI.InventorySection.ITEMS && (int) this.mouseItem.type > 0 && (int) this.mouseItem.stack > 0) + { + switch (this.inventoryItemY) + { + case (sbyte) 4: + flag2 = this.mouseItem.CanBePlacedInAmmoSlot(); + break; + case (sbyte) 5: + flag2 = this.mouseItem.CanBePlacedInCoinSlot(); + break; + } + } + if (flag2) + { + if ((int) this.toolTip.type > 0 && ((int) this.toolTip.netID != (int) this.mouseItem.netID || (int) this.toolTip.stack == (int) this.toolTip.maxStack || (int) this.mouseItem.stack == (int) this.mouseItem.maxStack)) + { + if (this.inventorySection != UI.InventorySection.EQUIP || flag1) + { + Main.strBuilder.Append(Lang.controls(Lang.CONTROLS.SWAP)); + Main.strBuilder.Append(' '); + } + } + else if ((int) this.toolTip.type == 0 || (int) this.toolTip.stack < (int) this.toolTip.maxStack) + { + if (this.inventorySection == UI.InventorySection.EQUIP) + { + if (flag1) + { + Main.strBuilder.Append(Lang.controls(Lang.CONTROLS.PLACE_EQUIPMENT)); + Main.strBuilder.Append(' '); + } + } + else + { + Main.strBuilder.Append(Lang.controls(Lang.CONTROLS.PLACE)); + Main.strBuilder.Append(' '); + } + } + } + } + Main.strBuilder.Append(Lang.controls(Lang.CONTROLS.CLOSE)); + Main.strBuilder.Append(' '); + if (!this.reforge && !this.craftGuide) + { + if ((int) this.mouseItem.type > 0) + { + Main.strBuilder.Append(Lang.controls(Lang.CONTROLS.DROP)); + Main.strBuilder.Append(' '); + } + else if (this.inventorySection == UI.InventorySection.ITEMS && (int) this.toolTip.type > 0) + { + Lang.CONTROLS i = (int) this.npcShop <= 0 ? Lang.CONTROLS.TRASH : Lang.CONTROLS.SELL; + Main.strBuilder.Append(Lang.controls(i)); + Main.strBuilder.Append(' '); + } + } + UI.DrawStringLB(UI.fontSmallOutline, this.view.SAFE_AREA_OFFSET_L, this.view.SAFE_AREA_OFFSET_B); + } + + private void DrawControlsShop() + { + if (this.menuType != MenuType.NONE) + return; + Main.strBuilder.Length = 0; + Main.strBuilder.Append(Lang.controls(Lang.CONTROLS.CHANGE_MENU)); + Main.strBuilder.Append(' '); + if ((int) this.toolTip.type > 0 && (int) this.toolTip.stack > 1 && ((int) this.mouseItem.type == 0 || (int) this.mouseItem.netID == (int) this.toolTip.netID)) + { + Main.strBuilder.Append(Lang.controls(Lang.CONTROLS.BUY_ONE)); + Main.strBuilder.Append(' '); + } + if ((int) this.mouseItem.type == 0) + { + if ((int) this.toolTip.type > 0) + { + Main.strBuilder.Append(Lang.controls(Lang.CONTROLS.BUY_ALL)); + Main.strBuilder.Append(' '); + } + } + else if ((int) this.toolTip.type == 0) + { + Main.strBuilder.Append(Lang.controls(Lang.CONTROLS.SELL_ITEM_IN_HAND)); + Main.strBuilder.Append(' '); + } + Main.strBuilder.Append(Lang.controls(Lang.CONTROLS.CLOSE)); + Main.strBuilder.Append(' '); + if ((int) this.mouseItem.type > 0) + { + Main.strBuilder.Append(Lang.controls(Lang.CONTROLS.DROP)); + Main.strBuilder.Append(' '); + } + UI.DrawStringLB(UI.fontSmallOutline, this.view.SAFE_AREA_OFFSET_L, this.view.SAFE_AREA_OFFSET_B); + } + + private void DrawControlsCrafting() + { + if (this.menuType != MenuType.NONE) + return; + Main.strBuilder.Length = 0; + Main.strBuilder.Append(Lang.controls(Lang.CONTROLS.CHANGE_MENU)); + Main.strBuilder.Append(' '); + Main.strBuilder.Append(Lang.controls(Lang.CONTROLS.CRAFTING_CATEGORY)); + Main.strBuilder.Append(' '); + if (this.player.CanCraftRecipe(this.craftingRecipe)) + { + Main.strBuilder.Append(Lang.controls(Lang.CONTROLS.CRAFT)); + Main.strBuilder.Append(' '); + } + Main.strBuilder.Append(Lang.controls(Lang.CONTROLS.CLOSE)); + Main.strBuilder.Append(' '); + if ((int) this.mouseItem.type > 0) + { + Main.strBuilder.Append(Lang.controls(Lang.CONTROLS.DROP)); + Main.strBuilder.Append(' '); + } + else + { + Main.strBuilder.Append(Lang.controls(this.craftingShowCraftable ? Lang.CONTROLS.SHOW_ALL : Lang.CONTROLS.SHOW_AVAILABLE)); + Main.strBuilder.Append(' '); + } + Lang.CONTROLS i = this.craftingSection == UI.CraftingSection.RECIPES ? Lang.CONTROLS.INGREDIENTS : Lang.CONTROLS.RECIPES; + Main.strBuilder.Append(Lang.controls(i)); + UI.DrawStringLB(UI.fontSmallOutline, this.view.SAFE_AREA_OFFSET_L, this.view.SAFE_AREA_OFFSET_B); + } + + private void DrawControlsHousing() + { + if (this.menuType != MenuType.NONE) + return; + Main.strBuilder.Length = 0; + Main.strBuilder.Append(Lang.controls(Lang.CONTROLS.CHANGE_MENU)); + Main.strBuilder.Append(' '); + Main.strBuilder.Append(Lang.controls(Lang.CONTROLS.CHECK_HOUSING)); + Main.strBuilder.Append(' '); + Main.strBuilder.Append(Lang.controls(this.showNPCs ? Lang.CONTROLS.HIDE_BANNERS : Lang.CONTROLS.SHOW_BANNERS)); + Main.strBuilder.Append(' '); + if ((int) this.inventoryHousingNpc >= 0) + { + Main.strBuilder.Append(Lang.controls(Lang.CONTROLS.ASSIGN_TO_ROOM)); + Main.strBuilder.Append(' '); + } + Main.strBuilder.Append(Lang.controls(Lang.CONTROLS.CLOSE)); + Main.strBuilder.Append(' '); + UI.DrawStringLB(UI.fontSmallOutline, this.view.SAFE_AREA_OFFSET_L, this.view.SAFE_AREA_OFFSET_B); + } + + public int DrawDialog(Vector2 pos, Color backColor, Color textColor, CompiledText ct, string caption = null, bool anchorBottom = false) + { + int num1 = 30; + if (anchorBottom) + { + pos.Y -= (float) ((int) ct.Height + num1); + num1 = 0; + } + Main.spriteBatch.Draw(UI.chatBackTexture, pos, new Rectangle?(new Rectangle(0, 0, UI.chatBackTexture.Width, (int) ct.Height + num1)), backColor); + pos.Y += (float) ((int) ct.Height + num1); + Main.spriteBatch.Draw(UI.chatBackTexture, pos, new Rectangle?(new Rectangle(0, UI.chatBackTexture.Height - 30, UI.chatBackTexture.Width, 30)), backColor); + pos.Y -= (float) ((int) ct.Height + num1); + if (caption != null) + { + int num2 = (int) UI.fontSmallOutline.MeasureString(caption).X; + int num3 = UI.chatBackTexture.Width - num2 >> 1; + int num4 = 0; + Main.spriteBatch.DrawString(UI.fontSmallOutline, caption, new Vector2(pos.X + (float) num3, pos.Y + (float) num4), Color.LightGreen); + pos.Y += (float) num1; + } + else + pos.Y += 10f; + pos.X += 20f; + ct.Draw(Main.spriteBatch, new Rectangle((int) pos.X, (int) pos.Y, 470, 540), textColor, new Color((int) byte.MaxValue, 212, 64, (int) byte.MaxValue)); + return (int) ct.Height; + } + + private void HelpText() + { + bool flag1 = (int) this.player.statLifeMax > 100; + bool flag2 = (int) this.player.statManaMax > 0; + bool flag3 = true; + bool flag4 = false; + bool flag5 = false; + bool flag6 = false; + bool flag7 = false; + bool flag8 = false; + bool flag9 = false; + for (int index = 0; index < 48; ++index) + { + if ((int) this.player.inventory[index].pick > 0 && (int) this.player.inventory[index].netID != -13) + flag3 = false; + else if ((int) this.player.inventory[index].axe > 0 && (int) this.player.inventory[index].netID != -16) + flag3 = false; + else if ((int) this.player.inventory[index].hammer > 0) + flag3 = false; + switch ((Item.ID) this.player.inventory[index].type) + { + case Item.ID.ROTTEN_CHUNK: + case Item.ID.WORM_FOOD: + flag8 = true; + break; + case Item.ID.FALLEN_STAR: + flag6 = true; + break; + case Item.ID.GRAPPLING_HOOK: + flag9 = true; + break; + case Item.ID.IRON_ORE: + case Item.ID.COPPER_ORE: + case Item.ID.GOLD_ORE: + case Item.ID.SILVER_ORE: + flag4 = true; + break; + case Item.ID.GOLD_BAR: + case Item.ID.COPPER_BAR: + case Item.ID.SILVER_BAR: + case Item.ID.IRON_BAR: + flag5 = true; + break; + case Item.ID.LENS: + flag7 = true; + break; + } + } + bool flag10 = false; + bool flag11 = false; + bool flag12 = false; + bool flag13 = false; + bool flag14 = false; + bool flag15 = false; + bool flag16 = false; + bool flag17 = false; + bool flag18 = false; + for (int index = 0; index < 196; ++index) + { + if ((int) Main.npc[index].active != 0) + { + switch ((NPC.ID) Main.npc[index].type) + { + case NPC.ID.CLOTHIER: + flag18 = true; + continue; + case NPC.ID.GOBLIN_TINKERER: + flag17 = true; + continue; + case NPC.ID.WIZARD: + flag16 = true; + continue; + case NPC.ID.MECHANIC: + flag15 = true; + continue; + case NPC.ID.MERCHANT: + flag10 = true; + continue; + case NPC.ID.NURSE: + flag11 = true; + continue; + case NPC.ID.ARMS_DEALER: + flag13 = true; + continue; + case NPC.ID.DRYAD: + flag12 = true; + continue; + case NPC.ID.DEMOLITIONIST: + flag14 = true; + continue; + default: + continue; + } + } + } + while (true) + { + do + { + ++this.helpText; + if (flag3) + { + if ((int) this.helpText == 1) + { + this.npcChatText = (UserString) Lang.dialog(this.player, 177); + return; + } + else if ((int) this.helpText == 2) + { + this.npcChatText = (UserString) Lang.dialog(this.player, 178); + return; + } + else if ((int) this.helpText == 3) + { + this.npcChatText = (UserString) Lang.dialog(this.player, 179); + return; + } + else if ((int) this.helpText == 4) + { + this.npcChatText = (UserString) Lang.dialog(this.player, 180); + return; + } + else if ((int) this.helpText == 5) + { + this.npcChatText = (UserString) Lang.dialog(this.player, 181); + return; + } + else if ((int) this.helpText == 6) + { + this.npcChatText = (UserString) Lang.dialog(this.player, 182); + return; + } + } + if (flag3 && !flag4 && (!flag5 && (int) this.helpText == 11)) + { + this.npcChatText = (UserString) Lang.dialog(this.player, 183); + return; + } + else + { + if (flag3 && flag4 && !flag5) + { + if ((int) this.helpText == 21) + { + this.npcChatText = (UserString) Lang.dialog(this.player, 184); + return; + } + else if ((int) this.helpText == 22) + { + this.npcChatText = (UserString) Lang.dialog(this.player, 185); + return; + } + } + if (flag3 && flag5) + { + if ((int) this.helpText == 31) + { + this.npcChatText = (UserString) Lang.dialog(this.player, 186); + return; + } + else if ((int) this.helpText == 32) + { + this.npcChatText = (UserString) Lang.dialog(this.player, 187); + return; + } + } + if (!flag1 && (int) this.helpText == 41) + { + this.npcChatText = (UserString) Lang.dialog(this.player, 188); + return; + } + else if (!flag2 && (int) this.helpText == 42) + { + this.npcChatText = (UserString) Lang.dialog(this.player, 189); + return; + } + else if (!flag2 && !flag6 && (int) this.helpText == 43) + { + this.npcChatText = (UserString) Lang.dialog(this.player, 190); + return; + } + else + { + if (!flag10 && !flag11) + { + if ((int) this.helpText == 51) + { + this.npcChatText = (UserString) Lang.dialog(this.player, 191); + return; + } + else if ((int) this.helpText == 52) + { + this.npcChatText = (UserString) Lang.dialog(this.player, 192); + return; + } + else if ((int) this.helpText == 53) + { + this.npcChatText = (UserString) Lang.dialog(this.player, 193); + return; + } + else if ((int) this.helpText == 54) + { + this.npcChatText = (UserString) Lang.dialog(this.player, 194); + return; + } + } + if (!flag10 && (int) this.helpText == 61) + { + this.npcChatText = (UserString) Lang.dialog(this.player, 195); + return; + } + else if (!flag11 && (int) this.helpText == 62) + { + this.npcChatText = (UserString) Lang.dialog(this.player, 196); + return; + } + else if (!flag13 && (int) this.helpText == 63) + { + this.npcChatText = (UserString) Lang.dialog(this.player, 197); + return; + } + else if (!flag12 && (int) this.helpText == 64) + { + this.npcChatText = (UserString) Lang.dialog(this.player, 198); + return; + } + else if (!flag15 && (int) this.helpText == 65 && NPC.downedBoss3) + { + this.npcChatText = (UserString) Lang.dialog(this.player, 199); + return; + } + else if (!flag18 && (int) this.helpText == 66 && NPC.downedBoss3) + { + this.npcChatText = (UserString) Lang.dialog(this.player, 200); + return; + } + else if (!flag14 && (int) this.helpText == 67) + { + this.npcChatText = (UserString) Lang.dialog(this.player, 201); + return; + } + else if (!flag17 && NPC.downedBoss2 && (int) this.helpText == 68) + { + this.npcChatText = (UserString) Lang.dialog(this.player, 202); + return; + } + else if (!flag16 && Main.hardMode && (int) this.helpText == 69) + { + this.npcChatText = (UserString) Lang.dialog(this.player, 203); + return; + } + else if (flag7 && (int) this.helpText == 71) + { + this.npcChatText = (UserString) Lang.dialog(this.player, 204); + return; + } + else if (flag8 && (int) this.helpText == 72) + { + this.npcChatText = (UserString) Lang.dialog(this.player, 205); + return; + } + else if ((flag7 || flag8) && (int) this.helpText == 80) + { + this.npcChatText = (UserString) Lang.dialog(this.player, 206); + return; + } + else if (!flag9 && (int) this.helpText == 201 && (!Main.hardMode && !NPC.downedBoss3) && !NPC.downedBoss2) + { + this.npcChatText = (UserString) Lang.dialog(this.player, 207); + return; + } + else if ((int) this.helpText == 1000 && !NPC.downedBoss1 && !NPC.downedBoss2) + { + this.npcChatText = (UserString) Lang.dialog(this.player, 208); + return; + } + else if ((int) this.helpText == 1001 && !NPC.downedBoss1 && !NPC.downedBoss2) + { + this.npcChatText = (UserString) Lang.dialog(this.player, 209); + return; + } + else if ((int) this.helpText == 1002 && !NPC.downedBoss3) + { + this.npcChatText = (UserString) Lang.dialog(this.player, 210); + return; + } + else if ((int) this.helpText == 1050 && !NPC.downedBoss1) + { + if ((int) this.player.statLifeMax < 200) + { + this.npcChatText = (UserString) Lang.dialog(this.player, 211); + return; + } + } + else if ((int) this.helpText == 1051 && !NPC.downedBoss1) + { + if ((int) this.player.statDefense <= 10) + { + this.npcChatText = (UserString) Lang.dialog(this.player, 212); + return; + } + } + else if ((int) this.helpText == 1052 && !NPC.downedBoss1) + { + if ((int) this.player.statLifeMax >= 200 && (int) this.player.statDefense > 10) + { + this.npcChatText = (UserString) Lang.dialog(this.player, 213); + return; + } + } + else if ((int) this.helpText == 1053 && NPC.downedBoss1 && !NPC.downedBoss2) + { + if ((int) this.player.statLifeMax < 300) + { + this.npcChatText = (UserString) Lang.dialog(this.player, 214); + return; + } + } + else if ((int) this.helpText == 1054 && NPC.downedBoss1 && !NPC.downedBoss2) + { + if ((int) this.player.statLifeMax >= 300) + { + this.npcChatText = (UserString) Lang.dialog(this.player, 215); + return; + } + } + else if ((int) this.helpText == 1055 && NPC.downedBoss1 && !NPC.downedBoss2) + { + if ((int) this.player.statLifeMax >= 300) + { + this.npcChatText = (UserString) Lang.dialog(this.player, 216); + return; + } + } + else if ((int) this.helpText == 1056 && NPC.downedBoss1 && (NPC.downedBoss2 && !NPC.downedBoss3)) + { + this.npcChatText = (UserString) Lang.dialog(this.player, 217); + return; + } + else if ((int) this.helpText == 1057 && NPC.downedBoss1 && (NPC.downedBoss2 && NPC.downedBoss3) && (!Main.hardMode && (int) this.player.statLifeMax < 400)) + { + this.npcChatText = (UserString) Lang.dialog(this.player, 218); + return; + } + else if ((int) this.helpText == 1058 && NPC.downedBoss1 && (NPC.downedBoss2 && NPC.downedBoss3) && (!Main.hardMode && (int) this.player.statLifeMax >= 400)) + { + this.npcChatText = (UserString) Lang.dialog(this.player, 219); + return; + } + else if ((int) this.helpText == 1059 && NPC.downedBoss1 && (NPC.downedBoss2 && NPC.downedBoss3) && (!Main.hardMode && (int) this.player.statLifeMax >= 400)) + { + this.npcChatText = (UserString) Lang.dialog(this.player, 220); + return; + } + else if ((int) this.helpText == 1060 && NPC.downedBoss1 && (NPC.downedBoss2 && NPC.downedBoss3) && (!Main.hardMode && (int) this.player.statLifeMax >= 400)) + { + this.npcChatText = (UserString) Lang.dialog(this.player, 221); + return; + } + else if ((int) this.helpText == 1061 && Main.hardMode) + { + this.npcChatText = (UserString) Lang.dialog(this.player, 222); + return; + } + else if ((int) this.helpText == 1062 && Main.hardMode) + { + this.npcChatText = (UserString) Lang.dialog(this.player, 223); + return; + } + } + } + } + while ((int) this.helpText <= 1100); + this.helpText = (short) 0; + } + } + + public void UpdateNpcChat() + { + this.focusText = (string) null; + this.focusText3 = (string) null; + int num1 = ((int) UI.mouseTextBrightness * 2 + (int) byte.MaxValue) / 3; + this.focusColor = new Color(num1, (int) ((double) num1 * (10.0 / 11.0)), num1 >> 1, num1); + int price = (int) this.player.statLifeMax - (int) this.player.statLife; + if ((int) this.player.sign >= 0) + this.focusText = Lang.inter[48]; + else if ((int) Main.npc[(int) this.player.talkNPC].type == 20) + { + this.focusText = Lang.inter[28]; + this.focusText3 = Lang.inter[49]; + } + else if ((int) Main.npc[(int) this.player.talkNPC].type == 107) + { + this.focusText = Lang.inter[28]; + this.focusText3 = Lang.inter[19]; + } + else if ((int) Main.npc[(int) this.player.talkNPC].type == 17 || (int) Main.npc[(int) this.player.talkNPC].type == 19 || ((int) Main.npc[(int) this.player.talkNPC].type == 38 || (int) Main.npc[(int) this.player.talkNPC].type == 54) || ((int) Main.npc[(int) this.player.talkNPC].type == 108 || (int) Main.npc[(int) this.player.talkNPC].type == 124 || (int) Main.npc[(int) this.player.talkNPC].type == 142)) + this.focusText = Lang.inter[28]; + else if ((int) Main.npc[(int) this.player.talkNPC].type == 37) + { + if (!Main.gameTime.dayTime) + this.focusText = Lang.inter[50]; + } + else if ((int) Main.npc[(int) this.player.talkNPC].type == 22) + { + this.focusText = Lang.inter[51]; + if (!Main.IsTutorial()) + this.focusText3 = Lang.inter[25]; + } + else if ((int) Main.npc[(int) this.player.talkNPC].type == 18) + { + this.focusText = Lang.inter[54]; + for (int index = 0; index < 10; ++index) + { + if (this.player.buff[index].IsHealable()) + price += 1000; + } + if (price > 0) + { + string str1 = ""; + int num2 = 0; + int num3 = 0; + int num4 = 0; + int num5 = 0; + int num6 = (int) ((double) price * 0.75); + if (num6 < 1) + num6 = 1; + price = num6; + if (num6 >= 1000000) + { + num2 = num6 / 1000000; + num6 -= num2 * 1000000; + } + if (num6 >= 10000) + { + num3 = num6 / 10000; + num6 -= num3 * 10000; + } + if (num6 >= 100) + { + num4 = num6 / 100; + num6 -= num4 * 100; + } + if (num6 > 0) + num5 = num6; + if (num2 > 0) + str1 = (string) (object) num2 + (object) Lang.inter[15]; + if (num3 > 0) + str1 = str1 + (object) num3 + Lang.inter[16]; + if (num4 > 0) + str1 = str1 + (object) num4 + Lang.inter[17]; + if (num5 > 0) + str1 = str1 + (object) num5 + Lang.inter[18]; + float num7 = (float) UI.mouseTextBrightness * 0.003921569f; + if (num2 > 0) + this.focusColor = new Color((int) (byte) (220.0 * (double) num7), (int) (byte) (220.0 * (double) num7), (int) (byte) (198.0 * (double) num7), (int) UI.mouseTextBrightness); + else if (num3 > 0) + this.focusColor = new Color((int) (byte) (224.0 * (double) num7), (int) (byte) (201.0 * (double) num7), (int) (byte) (92.0 * (double) num7), (int) UI.mouseTextBrightness); + else if (num4 > 0) + this.focusColor = new Color((int) (byte) (181.0 * (double) num7), (int) (byte) (192.0 * (double) num7), (int) (byte) (193.0 * (double) num7), (int) UI.mouseTextBrightness); + else if (num5 > 0) + this.focusColor = new Color((int) (byte) (246.0 * (double) num7), (int) (byte) (138.0 * (double) num7), (int) (byte) (96.0 * (double) num7), (int) UI.mouseTextBrightness); + UI ui = this; + string str2 = ui.focusText + " (" + str1 + ")"; + ui.focusText = str2; + } + } + this.player.releaseUseItem = false; + if (this.focusText == null && this.focusText3 == null) + this.npcChatSelectedItem = (sbyte) 1; + else if (this.IsLeftButtonTriggered()) + { + Main.PlaySound(12); + if ((int) --this.npcChatSelectedItem < 0) + this.npcChatSelectedItem = this.focusText3 != null ? (sbyte) 2 : (sbyte) 1; + } + else if (this.IsRightButtonTriggered()) + { + Main.PlaySound(12); + ++this.npcChatSelectedItem; + if ((int) this.npcChatSelectedItem == 3 || (int) this.npcChatSelectedItem == 2 && this.focusText3 == null) + this.npcChatSelectedItem = (sbyte) 0; + } + if (this.IsButtonTriggered(Buttons.B)) + { + this.player.talkNPC = (short) -1; + this.player.sign = (short) -1; + this.editSign = false; + this.npcChatText = (UserString) null; + Main.PlaySound(11); + this.ClearButtonTriggers(); + } + else + { + if (!this.IsButtonTriggered(Buttons.A)) + return; + if ((int) this.npcChatSelectedItem == 0) + { + if ((int) this.player.sign != -1) + { + Main.PlaySound(12); + this.editSign = true; + this.ClearInput(); + } + else if ((int) Main.npc[(int) this.player.talkNPC].type == 17) + { + this.npcChatText = (UserString) null; + this.npcShop = (byte) 1; + Main.shop[(int) this.npcShop].SetupShop((int) this.npcShop, this.player); + Main.PlaySound(12); + this.OpenInventory(); + } + else if ((int) Main.npc[(int) this.player.talkNPC].type == 19) + { + this.npcChatText = (UserString) null; + this.npcShop = (byte) 2; + Main.shop[(int) this.npcShop].SetupShop((int) this.npcShop, (Player) null); + Main.PlaySound(12); + this.OpenInventory(); + } + else if ((int) Main.npc[(int) this.player.talkNPC].type == 124) + { + this.npcChatText = (UserString) null; + this.npcShop = (byte) 8; + Main.shop[(int) this.npcShop].SetupShop((int) this.npcShop, (Player) null); + Main.PlaySound(12); + this.OpenInventory(); + } + else if ((int) Main.npc[(int) this.player.talkNPC].type == 142) + { + this.npcChatText = (UserString) null; + this.npcShop = (byte) 9; + Main.shop[(int) this.npcShop].SetupShop((int) this.npcShop, (Player) null); + Main.PlaySound(12); + this.OpenInventory(); + } + else if ((int) Main.npc[(int) this.player.talkNPC].type == 37) + { + if (Main.netMode != 1) + { + NPC.SpawnSkeletron(); + } + else + { + NetMessage.CreateMessage0(62); + NetMessage.SendMessage(); + } + this.npcChatText = (UserString) null; + } + else if ((int) Main.npc[(int) this.player.talkNPC].type == 20) + { + this.npcChatText = (UserString) null; + this.npcShop = (byte) 3; + Main.shop[(int) this.npcShop].SetupShop((int) this.npcShop, (Player) null); + Main.PlaySound(12); + this.OpenInventory(); + } + else if ((int) Main.npc[(int) this.player.talkNPC].type == 38) + { + this.npcChatText = (UserString) null; + this.npcShop = (byte) 4; + Main.shop[(int) this.npcShop].SetupShop((int) this.npcShop, (Player) null); + Main.PlaySound(12); + this.OpenInventory(); + } + else if ((int) Main.npc[(int) this.player.talkNPC].type == 54) + { + this.npcChatText = (UserString) null; + this.npcShop = (byte) 5; + Main.shop[(int) this.npcShop].SetupShop((int) this.npcShop, (Player) null); + Main.PlaySound(12); + this.OpenInventory(); + } + else if ((int) Main.npc[(int) this.player.talkNPC].type == 107) + { + this.npcChatText = (UserString) null; + this.npcShop = (byte) 6; + Main.shop[(int) this.npcShop].SetupShop((int) this.npcShop, (Player) null); + Main.PlaySound(12); + this.OpenInventory(); + } + else if ((int) Main.npc[(int) this.player.talkNPC].type == 108) + { + this.npcChatText = (UserString) null; + this.npcShop = (byte) 7; + Main.shop[(int) this.npcShop].SetupShop((int) this.npcShop, (Player) null); + Main.PlaySound(12); + this.OpenInventory(); + } + else if ((int) Main.npc[(int) this.player.talkNPC].type == 22) + { + Main.PlaySound(12); + this.HelpText(); + } + else if ((int) Main.npc[(int) this.player.talkNPC].type == 18) + { + Main.PlaySound(12); + if (price > 0) + { + if (this.player.BuyItem(price)) + { + Main.PlaySound(2, -1, -1, 4); + this.player.HealEffect((int) this.player.statLifeMax - (int) this.player.statLife); + this.npcChatText = (double) this.player.statLife >= (double) this.player.statLifeMax * 0.25 ? ((double) this.player.statLife >= (double) this.player.statLifeMax * 0.5 ? ((double) this.player.statLife >= (double) this.player.statLifeMax * 0.75 ? (UserString) Lang.dialog(this.player, 230) : (UserString) Lang.dialog(this.player, 229)) : (UserString) Lang.dialog(this.player, 228)) : (UserString) Lang.dialog(this.player, 227); + this.player.statLife = this.player.statLifeMax; + for (int b = 0; b < 10; ++b) + { + if (this.player.buff[b].IsHealable()) + b = this.player.DelBuff(b); + } + } + else + { + switch (Main.rand.Next(3)) + { + case 0: + this.npcChatText = (UserString) Lang.dialog(this.player, 52); + break; + case 1: + this.npcChatText = (UserString) Lang.dialog(this.player, 53); + break; + default: + this.npcChatText = (UserString) Lang.dialog(this.player, 54); + break; + } + } + } + else + { + switch (Main.rand.Next(3)) + { + case 0: + this.npcChatText = (UserString) Lang.dialog(this.player, 55); + break; + case 1: + this.npcChatText = (UserString) Lang.dialog(this.player, 56); + break; + default: + this.npcChatText = (UserString) Lang.dialog(this.player, 57); + break; + } + } + } + } + else if ((int) this.npcChatSelectedItem == 1) + { + this.player.talkNPC = (short) -1; + this.player.sign = (short) -1; + this.editSign = false; + this.npcChatText = (UserString) null; + Main.PlaySound(11); + } + else if ((int) this.player.talkNPC >= 0) + { + if ((int) Main.npc[(int) this.player.talkNPC].type == 20) + { + Main.PlaySound(12); + this.npcChatText = (UserString) Lang.evilGood(); + } + else if ((int) Main.npc[(int) this.player.talkNPC].type == 22) + { + this.npcChatText = (UserString) null; + Main.PlaySound(12); + this.craftGuide = true; + this.guideItem.Init(); + this.OpenInventory(); + } + else if ((int) Main.npc[(int) this.player.talkNPC].type == 107) + { + this.npcChatText = (UserString) null; + Main.PlaySound(12); + this.reforge = true; + this.OpenInventory(); + } + } + this.ClearButtonTriggers(); + } + } + + private void DrawNpcChat() + { + string @string = this.npcChatText.GetString(); + if (@string != this.npcCompiledChatText) + { + this.npcCompiledChatText = @string; + this.npcChatCompiledText = new CompiledText(@string, 470, UI.styleFontSmallOutline, CompiledText.MarkupType.Html); + } + int num1 = ((int) UI.mouseTextBrightness * 2 + (int) byte.MaxValue) / 3; + Color color = new Color(num1, num1, num1, num1); + int num2 = this.DrawDialog(new Vector2((float) ((int) this.view.viewWidth - UI.chatBackTexture.Width >> 1), 100f), new Color(200, 200, 200, 200), color, this.npcChatCompiledText, (string) null, false); + int num3 = (int) UI.mouseTextBrightness; + int num4 = 180 + ((int) this.view.viewWidth - 800 >> 1); + int num5 = 128 + num2; + Vector2 pivot1 = new Vector2(); + if (this.focusText != null) + { + pivot1 = UI.MeasureString(UI.fontSmallOutline, this.focusText); + pivot1.X *= 0.5f; + pivot1.Y *= 0.5f; + UI.DrawStringScaled(UI.fontSmallOutline, this.focusText, new Vector2((float) num4 + pivot1.X, (float) num5 + pivot1.Y), this.focusColor, pivot1, (int) this.npcChatSelectedItem == 0 ? 1.1f : 0.9f); + } + string str = Lang.inter[52]; + color = new Color(num3, (int) ((double) num3 * (10.0 / 11.0)), num3 >> 1, num3); + int num6 = num4 + (int) ((double) pivot1.X * 2.0) + 30; + Vector2 pivot2 = UI.MeasureString(UI.fontSmallOutline, str); + pivot2.X *= 0.5f; + pivot2.Y *= 0.5f; + UI.DrawStringScaled(UI.fontSmallOutline, str, new Vector2((float) num6 + pivot2.X, (float) num5 + pivot2.Y), color, pivot2, (int) this.npcChatSelectedItem == 1 ? 1.1f : 0.9f); + if (this.focusText3 == null) + return; + int num7 = num6 + (int) ((double) pivot2.X * 2.0) + 30; + Vector2 pivot3 = UI.MeasureString(UI.fontSmallOutline, this.focusText3); + pivot3.X *= 0.5f; + pivot3.Y *= 0.5f; + UI.DrawStringScaled(UI.fontSmallOutline, this.focusText3, new Vector2((float) num7 + pivot3.X, (float) num5 + pivot3.Y), color, pivot3, (int) this.npcChatSelectedItem == 2 ? 1.1f : 0.9f); + } + + private void Reforge(int slot, bool isArmor = false) + { + if (!this.toolTip.Prefix(-3) || !this.player.BuyItem(this.toolTip.value)) + return; + int num = (int) this.toolTip.prefix; + this.toolTip.netDefaults((int) this.toolTip.netID, 1); + do + { + this.toolTip.Prefix(-2); + } + while ((int) this.toolTip.prefix == num); + this.toolTip.position.X = (float) (this.player.aabb.X + 10 - ((int) this.toolTip.width >> 1)); + this.toolTip.position.Y = (float) (this.player.aabb.Y + 21 - ((int) this.toolTip.height >> 1)); + if (isArmor) + this.player.armor[slot] = this.toolTip; + else + this.player.inventory[slot] = this.toolTip; + Main.PlaySound(2, this.player.aabb.X, this.player.aabb.Y, 37); + } + + private void CraftingGuide() + { + if ((int) this.toolTip.type <= 0 || !this.toolTip.material) + return; + this.guideItem = this.toolTip; + this.inventorySection = UI.InventorySection.CRAFTING; + this.craftingCategory = Recipe.Category.MISC; + for (int index = 0; index < 6; ++index) + { + this.NextCraftingCategory(); + if (this.currentRecipeCategory.Count > 0) + break; + } + } + + private bool IsSlotAssignedToQuickAccess(int slot) + { + if ((int) this.quickAccessUp != slot && (int) this.quickAccessDown != slot && (int) this.quickAccessLeft != slot) + return (int) this.quickAccessRight == slot; + else + return true; + } + + private void UpdateInventory() + { + if ((int) this.inventoryItemX == 9 && (int) this.inventoryItemY == 6) + { + if (!this.IsButtonTriggered(Buttons.A)) + return; + if ((int) this.mouseItem.type != 0) + this.trashItem.Init(); + Item obj = this.mouseItem; + this.mouseItem = this.trashItem; + this.trashItem = obj; + this.mouseItemSrcSection = UI.InventorySection.ITEMS; + this.mouseItemSrcX = this.inventoryItemX; + this.mouseItemSrcY = this.inventoryItemY; + if ((int) this.trashItem.type == 0 || (int) this.trashItem.stack < 1) + this.trashItem.Init(); + if ((int) this.mouseItem.netID == (int) this.trashItem.netID && (int) this.trashItem.stack != (int) this.trashItem.maxStack && (int) this.mouseItem.stack != (int) this.mouseItem.maxStack) + { + if ((int) this.mouseItem.stack + (int) this.trashItem.stack <= (int) this.mouseItem.maxStack) + { + this.trashItem.stack += this.mouseItem.stack; + this.mouseItem.stack = (short) 0; + } + else + { + short num = (short) ((int) this.mouseItem.maxStack - (int) this.trashItem.stack); + this.trashItem.stack += num; + this.mouseItem.stack -= num; + } + } + if ((int) this.mouseItem.type == 0 || (int) this.mouseItem.stack < 1) + this.mouseItem.Init(); + if ((int) this.mouseItem.type <= 0 && (int) this.trashItem.type <= 0) + return; + Main.PlaySound(7); + } + else + { + bool flag1 = true; + int slot; + switch (this.inventoryItemY) + { + case (sbyte) 4: + slot = 44 + (int) this.inventoryItemX - 6; + flag1 = this.mouseItem.CanBePlacedInAmmoSlot(); + break; + case (sbyte) 5: + slot = 40 + (int) this.inventoryItemX - 6; + flag1 = this.mouseItem.CanBePlacedInCoinSlot(); + break; + default: + slot = (int) this.inventoryItemX + (int) this.inventoryItemY * 10; + break; + } + if (slot < 40 && (int) this.mouseItem.type == 0) + { + if (this.IsButtonTriggered(Buttons.DPadUp)) + { + if ((int) this.quickAccessUp == slot) + { + this.quickAccessUp = (sbyte) -1; + } + else + { + this.quickAccessUp = (sbyte) slot; + if ((int) this.quickAccessDown == slot) + this.quickAccessDown = (sbyte) -1; + else if ((int) this.quickAccessLeft == slot) + this.quickAccessLeft = (sbyte) -1; + else if ((int) this.quickAccessRight == slot) + this.quickAccessRight = (sbyte) -1; + } + Main.PlaySound(7); + } + else if (this.IsButtonTriggered(Buttons.DPadDown)) + { + if ((int) this.quickAccessDown == slot) + { + this.quickAccessDown = (sbyte) -1; + } + else + { + this.quickAccessDown = (sbyte) slot; + if ((int) this.quickAccessUp == slot) + this.quickAccessUp = (sbyte) -1; + else if ((int) this.quickAccessLeft == slot) + this.quickAccessLeft = (sbyte) -1; + else if ((int) this.quickAccessRight == slot) + this.quickAccessRight = (sbyte) -1; + } + Main.PlaySound(7); + } + else if (this.IsButtonTriggered(Buttons.DPadLeft)) + { + if ((int) this.quickAccessLeft == slot) + { + this.quickAccessLeft = (sbyte) -1; + } + else + { + this.quickAccessLeft = (sbyte) slot; + if ((int) this.quickAccessUp == slot) + this.quickAccessUp = (sbyte) -1; + else if ((int) this.quickAccessDown == slot) + this.quickAccessDown = (sbyte) -1; + else if ((int) this.quickAccessRight == slot) + this.quickAccessRight = (sbyte) -1; + } + Main.PlaySound(7); + } + else if (this.IsButtonTriggered(Buttons.DPadRight)) + { + if ((int) this.quickAccessRight == slot) + { + this.quickAccessRight = (sbyte) -1; + } + else + { + this.quickAccessRight = (sbyte) slot; + if ((int) this.quickAccessUp == slot) + this.quickAccessUp = (sbyte) -1; + else if ((int) this.quickAccessDown == slot) + this.quickAccessDown = (sbyte) -1; + else if ((int) this.quickAccessLeft == slot) + this.quickAccessLeft = (sbyte) -1; + } + Main.PlaySound(7); + } + } + if (this.IsButtonTriggered(Buttons.A)) + { + if (this.reforge) + this.Reforge(slot, false); + else if (this.craftGuide) + { + this.CraftingGuide(); + } + else + { + if ((int) this.mouseItem.type != 0 && (!flag1 || (int) this.player.selectedItem == slot && (int) this.player.itemAnimation > 0)) + return; + Item obj = this.mouseItem; + this.mouseItem = this.player.inventory[slot]; + this.player.inventory[slot] = obj; + if ((int) this.player.inventory[slot].type == 0 || (int) this.player.inventory[slot].stack < 1) + this.player.inventory[slot].Init(); + bool flag2 = false; + if ((int) this.mouseItem.netID == (int) this.player.inventory[slot].netID && (int) this.player.inventory[slot].stack != (int) this.player.inventory[slot].maxStack && (int) this.mouseItem.stack != (int) this.mouseItem.maxStack) + { + if ((int) this.mouseItem.stack + (int) this.player.inventory[slot].stack <= (int) this.mouseItem.maxStack) + { + this.player.inventory[slot].stack += this.mouseItem.stack; + this.mouseItem.Init(); + } + else + { + short num = (short) ((int) this.mouseItem.maxStack - (int) this.player.inventory[slot].stack); + this.player.inventory[slot].stack += num; + this.mouseItem.stack -= num; + flag2 = true; + } + } + if ((int) this.mouseItem.type > 0 && (int) obj.type > 0 && (!flag2 && this.mouseItemSrcSection == UI.InventorySection.ITEMS) && ((int) this.mouseItemSrcX < 10 && (int) this.mouseItemSrcY < 4)) + { + int index = (int) this.mouseItemSrcX + (int) this.mouseItemSrcY * 10; + if ((int) this.player.inventory[index].type == 0) + { + this.player.inventory[index] = this.mouseItem; + this.mouseItem.Init(); + } + if ((int) this.quickAccessUp == index) + this.quickAccessUp = (sbyte) slot; + else if ((int) this.quickAccessDown == index) + this.quickAccessDown = (sbyte) slot; + else if ((int) this.quickAccessLeft == index) + this.quickAccessLeft = (sbyte) slot; + else if ((int) this.quickAccessRight == index) + this.quickAccessRight = (sbyte) slot; + } + this.mouseItemSrcSection = UI.InventorySection.ITEMS; + this.mouseItemSrcX = this.inventoryItemX; + this.mouseItemSrcY = this.inventoryItemY; + if ((int) this.mouseItem.type <= 0 && (int) this.player.inventory[slot].type <= 0) + return; + Main.PlaySound(7); + } + } + else if (this.gpState.IsButtonDown(Buttons.RightTrigger)) + { + if (this.gpPrevState.IsButtonUp(Buttons.RightTrigger)) + { + if ((int) this.player.inventory[slot].type >= 599 && (int) this.player.inventory[slot].type <= 601) + { + Main.PlaySound(7); + this.stackSplit = (short) 30; + int num = Main.rand.Next(14); + if (num == 0 && Main.hardMode) + { + this.player.inventory[slot].SetDefaults(602, 1, false); + } + else + { + this.player.inventory[slot].SetDefaults(num <= 7 ? 586 : 591, 1, false); + this.player.inventory[slot].stack = (short) Main.rand.Next(20, 50); + } + } + else + { + if (!this.player.inventory[slot].isEquipable()) + return; + this.player.inventory[slot] = this.player.armorSwap(ref this.player.inventory[slot]); + } + } + else + { + if ((int) this.stackSplit > 1 || (int) this.player.inventory[slot].maxStack <= 1 || (int) this.player.inventory[slot].type <= 0 || ((int) this.mouseItem.netID != (int) this.player.inventory[slot].netID && (int) this.mouseItem.type != 0 || (int) this.mouseItem.stack >= (int) this.mouseItem.maxStack && (int) this.mouseItem.type != 0)) + return; + if ((int) this.mouseItem.type == 0) + { + this.mouseItem = this.player.inventory[slot]; + this.mouseItem.stack = (short) 0; + this.mouseItemSrcSection = UI.InventorySection.ITEMS; + this.mouseItemSrcX = this.inventoryItemX; + this.mouseItemSrcY = this.inventoryItemY; + } + ++this.mouseItem.stack; + --this.player.inventory[slot].stack; + if ((int) this.player.inventory[slot].stack <= 0) + this.player.inventory[slot].Init(); + Main.PlaySound(12); + if ((int) this.stackSplit == 0) + this.stackSplit = (short) 15; + else + this.stackSplit = this.stackDelay; + } + } + else + { + if ((int) this.mouseItem.type != 0 || this.reforge || (!this.IsButtonTriggered(Buttons.X) || (int) this.player.inventory[slot].type <= 0)) + return; + if ((int) this.npcShop > 0 && !this.player.inventory[slot].CanBePlacedInCoinSlot()) + { + if (this.player.SellItem(this.player.inventory[slot].value, (int) this.player.inventory[slot].stack)) + { + Main.shop[(int) this.npcShop].AddShop(ref this.player.inventory[slot]); + this.player.inventory[slot].Init(); + Main.PlaySound(18); + } + else + { + if (this.player.inventory[slot].value != 0) + return; + Main.shop[(int) this.npcShop].AddShop(ref this.player.inventory[slot]); + this.player.inventory[slot].Init(); + Main.PlaySound(7); + } + } + else + { + Main.PlaySound(7); + this.trashItem = this.player.inventory[slot]; + this.player.inventory[slot].Init(); + } + } + } + } + + private void DrawInventory(int itemsSectionX, int itemsSectionY) + { + Vector2 pos = new Vector2(); + Color c1 = new Color((int) UI.invAlpha, (int) UI.invAlpha, (int) UI.invAlpha, (int) UI.invAlpha); + UI.inventoryScale = 0.93125f; + UI.DrawStringRC(UI.fontSmall, Lang.inter[3], itemsSectionX + 469, itemsSectionY + 338, Color.White); + int x1 = 469 + itemsSectionX; + int y1 = 312 + itemsSectionY; + if ((int) this.inventoryItemX == 9 && (int) this.inventoryItemY == 6) + { + this.DrawInventoryCursor(x1, y1, (double) UI.inventoryScale, (int) byte.MaxValue); + this.toolTip = this.trashItem; + } + else + SpriteSheet<_sheetSprites>.DrawTL(446, x1, y1, c1, UI.inventoryScale); + if ((int) this.trashItem.type == 0 || (int) this.trashItem.stack == 0) + { + pos.X = (float) x1 + 26f * UI.inventoryScale; + pos.Y = (float) y1 + 26f * UI.inventoryScale; + SpriteSheet<_sheetSprites>.DrawScaled(1482, ref pos, new Color(100, 100, 100, 100), UI.inventoryScale); + } + else + this.DrawInventoryItem(ref this.trashItem, x1, y1, Color.White, UI.StackType.INVENTORY); + for (int index1 = 0; index1 < 10; ++index1) + { + for (int index2 = 0; index2 < 4; ++index2) + { + int x2 = itemsSectionX + (int) ((double) index1 * 52.1499977111816); + int y2 = itemsSectionY + (int) ((double) index2 * 52.1499977111816); + int slot = index1 + index2 * 10; + if ((int) this.inventoryItemX == index1 && (int) this.inventoryItemY == index2) + { + this.toolTip = this.player.inventory[slot]; + this.DrawInventoryCursor(x2, y2, (double) UI.inventoryScale, (int) byte.MaxValue); + } + else + { + Color c2 = c1; + int id; + if (this.IsSlotAssignedToQuickAccess(slot)) + { + id = 450; + c2 = UI.mouseTextColor; + } + else + id = index2 == 0 ? 447 : 451; + SpriteSheet<_sheetSprites>.DrawTL(id, x2, y2, c2, UI.inventoryScale); + } + if ((int) this.player.inventory[slot].type > 0 && (int) this.player.inventory[slot].stack > 0) + { + UI.StackType stackType; + Color itemColor; + if (this.craftGuide && !this.player.inventory[slot].material || this.reforge && !this.player.inventory[slot].Prefix(-3)) + { + stackType = UI.StackType.NONE; + itemColor = UI.DISABLED_COLOR; + } + else + { + stackType = UI.StackType.INVENTORY; + itemColor = new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue); + } + this.DrawInventoryItem(ref this.player.inventory[slot], x2, y2, itemColor, stackType); + } + } + } + UI.DrawStringRC(UI.fontSmall, Lang.inter[26], itemsSectionX + 312, itemsSectionY + 286, Color.White); + for (int index1 = 0; index1 < 4; ++index1) + { + int x2 = (int) ((double) (6 + index1) * 52.1499977111816) + itemsSectionX; + int y2 = 260 + itemsSectionY; + int index2 = index1 + 40; + if ((int) this.inventoryItemY == 5 && (int) this.inventoryItemX - 6 == index1) + { + this.DrawInventoryCursor(x2, y2, (double) UI.inventoryScale, (int) byte.MaxValue); + this.toolTip = this.player.inventory[index2]; + } + else + SpriteSheet<_sheetSprites>.DrawTL(451, x2, y2, c1, UI.inventoryScale); + if ((int) this.player.inventory[index2].type > 0 && (int) this.player.inventory[index2].stack > 0) + this.DrawInventoryItem(ref this.player.inventory[index2], x2, y2, Color.White, UI.StackType.INVENTORY); + } + UI.DrawStringRC(UI.fontSmall, Lang.inter[27], itemsSectionX + 312, itemsSectionY + 234, Color.White); + for (int index1 = 0; index1 < 4; ++index1) + { + int x2 = (int) ((double) (6 + index1) * 52.1499977111816) + itemsSectionX; + int y2 = 208 + itemsSectionY; + int index2 = index1 + 44; + if (this.inventorySection == UI.InventorySection.ITEMS && (int) this.inventoryItemY == 4 && (int) this.inventoryItemX - 6 == index1) + { + this.DrawInventoryCursor(x2, y2, (double) UI.inventoryScale, (int) byte.MaxValue); + this.toolTip = this.player.inventory[index2]; + } + else + SpriteSheet<_sheetSprites>.DrawTL(451, x2, y2, c1, UI.inventoryScale); + if ((int) this.player.inventory[index2].type > 0 && (int) this.player.inventory[index2].stack > 0) + { + UI.StackType stackType; + Color itemColor; + if (this.craftGuide && !this.player.inventory[index2].material || this.reforge) + { + stackType = UI.StackType.NONE; + itemColor = UI.DISABLED_COLOR; + } + else + { + stackType = UI.StackType.INVENTORY; + itemColor = new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue); + } + this.DrawInventoryItem(ref this.player.inventory[index2], x2, y2, itemColor, stackType); + } + } + this.DrawQuickAccess(-1, itemsSectionX + 26, itemsSectionY + 234, (int) byte.MaxValue, UI.StackType.INVENTORY); + this.UpdateToolTipText((string) null); + this.DrawToolTip(itemsSectionX + 864 - 322 - 8, itemsSectionY + 8, 344); + this.DrawControlsInventory(); + } + + public int UpdateQuickAccess() + { + int num = -1; + int index1 = (int) this.quickAccessUp; + if (index1 >= 0) + { + if ((int) this.player.inventory[index1].type == 0) + this.quickAccessUp = (sbyte) -1; + else if (this.gpState.DPad.Up == ButtonState.Pressed && this.gpPrevState.DPad.Up == ButtonState.Released) + num = index1; + } + int index2 = (int) this.quickAccessDown; + if (index2 >= 0) + { + if ((int) this.player.inventory[index2].type == 0) + this.quickAccessDown = (sbyte) -1; + else if (this.gpState.DPad.Down == ButtonState.Pressed && this.gpPrevState.DPad.Down == ButtonState.Released) + num = index2; + } + int index3 = (int) this.quickAccessLeft; + if (index3 >= 0) + { + if ((int) this.player.inventory[index3].type == 0) + this.quickAccessLeft = (sbyte) -1; + else if (this.gpState.DPad.Left == ButtonState.Pressed && this.gpPrevState.DPad.Left == ButtonState.Released) + num = index3; + } + int index4 = (int) this.quickAccessRight; + if (index4 >= 0) + { + if ((int) this.player.inventory[index4].type == 0) + this.quickAccessRight = (sbyte) -1; + else if (this.gpState.DPad.Right == ButtonState.Pressed && this.gpPrevState.DPad.Right == ButtonState.Released) + num = index4; + } + return num; + } + + private void DrawQuickAccess(int selectedItem, int x, int y, int alpha, UI.StackType stackType) + { + Color color1 = new Color(alpha, alpha, alpha, alpha); + Color color2 = new Color(0, 0, 0, alpha >> 1); + alpha = alpha * (int) UI.mouseTextBrightness >> 8; + Color c = new Color(alpha, alpha, alpha, alpha); + SpriteSheet<_sheetSprites>.Draw(217, x, y, color1); + UI.inventoryScale = 1f; + int index1 = (int) this.quickAccessUp; + if (index1 >= 0) + { + if (selectedItem == index1) + { + SpriteSheet<_sheetSprites>.Draw(448, x + 32 + 4, y - 4, color2); + SpriteSheet<_sheetSprites>.Draw(448, x + 32, y - 4 - 4, c); + } + if ((int) this.player.inventory[index1].type > 0) + { + if (selectedItem != index1) + this.DrawInventoryItem(ref this.player.inventory[index1], x + 32 + 4, y - 4, color2, stackType); + this.DrawInventoryItem(ref this.player.inventory[index1], x + 32, y - 4 - 4, color1, stackType); + } + } + int index2 = (int) this.quickAccessDown; + if (index2 >= 0) + { + if (selectedItem == index2) + { + SpriteSheet<_sheetSprites>.Draw(448, x + 32 + 4, y + 112 - 42 + 4, color2); + SpriteSheet<_sheetSprites>.Draw(448, x + 32, y + 112 - 42, c); + } + if ((int) this.player.inventory[index2].type > 0) + { + if (selectedItem != index2) + this.DrawInventoryItem(ref this.player.inventory[index2], x + 32 + 4, y + 112 - 42 + 4, color2, stackType); + this.DrawInventoryItem(ref this.player.inventory[index2], x + 32, y + 112 - 42, color1, stackType); + } + } + int index3 = (int) this.quickAccessLeft; + if (index3 >= 0) + { + if (selectedItem == index3) + { + SpriteSheet<_sheetSprites>.Draw(448, x - 4, y + 30 + 4, color2); + SpriteSheet<_sheetSprites>.Draw(448, x - 4 - 4, y + 30, c); + } + if ((int) this.player.inventory[index3].type > 0) + { + if (selectedItem != index3) + this.DrawInventoryItem(ref this.player.inventory[index3], x - 4, y + 30 + 4, color2, stackType); + this.DrawInventoryItem(ref this.player.inventory[index3], x - 4 - 4, y + 30, color1, stackType); + } + } + int index4 = (int) this.quickAccessRight; + if (index4 < 0) + return; + if (selectedItem == index4) + { + SpriteSheet<_sheetSprites>.Draw(448, x + 112 - 42 + 4, y + 30 + 4, color2); + SpriteSheet<_sheetSprites>.Draw(448, x + 112 - 42, y + 30, c); + } + if ((int) this.player.inventory[index4].type <= 0) + return; + if (selectedItem != index4) + this.DrawInventoryItem(ref this.player.inventory[index4], x + 112 - 42 + 4, y + 30 + 4, color2, stackType); + this.DrawInventoryItem(ref this.player.inventory[index4], x + 112 - 42, y + 30, color1, stackType); + } + + private void UpdateStorage() + { + if ((int) this.inventoryChestX < 0) + { + if (!this.IsButtonTriggered(Buttons.A)) + return; + switch (this.inventoryChestY) + { + case (sbyte) 1: + if ((int) this.player.chest >= 0) + { + Main.chest[(int) this.player.chest].LootAll(this.player); + break; + } + else if ((int) this.player.chest == -3) + { + this.player.safe.LootAll(this.player); + break; + } + else + { + this.player.bank.LootAll(this.player); + break; + } + case (sbyte) 2: + if ((int) this.player.chest >= 0) + { + Main.chest[(int) this.player.chest].Deposit(this.player); + break; + } + else if ((int) this.player.chest == -3) + { + this.player.safe.Deposit(this.player); + break; + } + else + { + this.player.bank.Deposit(this.player); + break; + } + case (sbyte) 3: + if ((int) this.player.chest >= 0) + { + Main.chest[(int) this.player.chest].QuickStack(this.player); + break; + } + else if ((int) this.player.chest == -3) + { + this.player.safe.QuickStack(this.player); + break; + } + else + { + this.player.bank.QuickStack(this.player); + break; + } + } + } + else + { + int number = (int) this.player.chest; + Chest chest; + switch (number) + { + case -3: + chest = this.player.safe; + break; + case -2: + chest = this.player.bank; + break; + default: + chest = Main.chest[number]; + break; + } + int number2 = (int) this.inventoryChestX + (int) this.inventoryChestY * 5; + if (this.IsButtonTriggered(Buttons.A)) + { + if ((int) this.player.selectedItem == number2 && (int) this.player.itemAnimation > 0) + return; + Item obj = this.mouseItem; + this.mouseItem = chest.item[number2]; + this.mouseItemSrcSection = UI.InventorySection.CHEST; + this.mouseItemSrcX = this.inventoryChestX; + this.mouseItemSrcY = this.inventoryChestY; + chest.item[number2] = obj; + if ((int) chest.item[number2].type == 0 || (int) chest.item[number2].stack < 1) + chest.item[number2].Init(); + if ((int) this.mouseItem.netID == (int) chest.item[number2].netID && (int) chest.item[number2].stack != (int) chest.item[number2].maxStack && (int) this.mouseItem.stack != (int) this.mouseItem.maxStack) + { + if ((int) this.mouseItem.stack + (int) chest.item[number2].stack <= (int) this.mouseItem.maxStack) + { + chest.item[number2].stack += this.mouseItem.stack; + this.mouseItem.stack = (short) 0; + } + else + { + short num = (short) ((int) this.mouseItem.maxStack - (int) chest.item[number2].stack); + chest.item[number2].stack += num; + this.mouseItem.stack -= num; + } + } + if ((int) this.mouseItem.type == 0 || (int) this.mouseItem.stack < 1) + this.mouseItem.Init(); + if ((int) this.mouseItem.type > 0 || (int) chest.item[number2].type > 0) + Main.PlaySound(7); + if (number < 0) + return; + NetMessage.CreateMessage2(32, number, number2); + NetMessage.SendMessage(); + } + else if (this.IsButtonTriggered(Buttons.RightTrigger) && chest.item[number2].isEquipable()) + { + chest.item[number2] = this.player.armorSwap(ref chest.item[number2]); + if (number < 0) + return; + NetMessage.CreateMessage2(32, number, number2); + NetMessage.SendMessage(); + } + else + { + if ((int) this.stackSplit > 1 || !this.gpState.IsButtonDown(Buttons.RightTrigger) || (int) chest.item[number2].maxStack <= 1 || ((int) this.mouseItem.netID != (int) chest.item[number2].netID && (int) this.mouseItem.type != 0 || (int) this.mouseItem.stack >= (int) this.mouseItem.maxStack && (int) this.mouseItem.type != 0)) + return; + if ((int) this.mouseItem.type == 0) + { + this.mouseItem = chest.item[number2]; + this.mouseItem.stack = (short) 0; + this.mouseItemSrcSection = UI.InventorySection.CHEST; + this.mouseItemSrcX = this.inventoryChestX; + this.mouseItemSrcY = this.inventoryChestY; + } + ++this.mouseItem.stack; + --chest.item[number2].stack; + if ((int) chest.item[number2].stack <= 0) + chest.item[number2].Init(); + Main.PlaySound(12); + this.stackSplit = (int) this.stackSplit != 0 ? this.stackDelay : (short) 15; + if (number < 0) + return; + NetMessage.CreateMessage2(32, number, number2); + NetMessage.SendMessage(); + } + } + } + + private void DrawStorage(int INVENTORY_X, int INVENTORY_Y) + { + int index1 = (int) this.player.chest; + Chest chest; + switch (index1) + { + case -3: + chest = this.player.safe; + break; + case -2: + chest = this.player.bank; + break; + case -1: + return; + default: + chest = Main.chest[index1]; + break; + } + Color c = new Color((int) UI.invAlpha, (int) UI.invAlpha, (int) UI.invAlpha, (int) UI.invAlpha); + UI.inventoryScale = 1f; + int x1 = 112 + INVENTORY_X - 56; + int y1 = 56 + INVENTORY_Y + 56; + SpriteSheet<_sheetSprites>.DrawTL((int) this.inventoryChestX >= 0 || (int) this.inventoryChestY != 1 ? 451 : 448, x1, y1, c, UI.inventoryScale); + this.DrawInventoryItem(1085, x1, y1, Color.White); + int y2 = y1 + 56; + SpriteSheet<_sheetSprites>.DrawTL((int) this.inventoryChestX >= 0 || (int) this.inventoryChestY != 2 ? 451 : 448, x1, y2, c, UI.inventoryScale); + this.DrawInventoryItem(213, x1, y2, Color.White); + int y3 = y2 + 56; + SpriteSheet<_sheetSprites>.DrawTL((int) this.inventoryChestX >= 0 || (int) this.inventoryChestY != 3 ? 451 : 448, x1, y3, c, UI.inventoryScale); + this.DrawInventoryItem(1469, x1, y3, Color.White); + if ((int) this.inventoryChestX < 0) + this.toolTip.Init(); + for (int index2 = 0; index2 < 5; ++index2) + { + for (int index3 = 0; index3 < 4; ++index3) + { + int x2 = 112 + INVENTORY_X + index2 * 56; + int y4 = 56 + INVENTORY_Y + index3 * 56; + int index4 = index2 + index3 * 5; + SpriteSheet<_sheetSprites>.DrawTL(444, x2, y4, c, UI.inventoryScale); + if ((int) this.inventoryChestX == index2 && (int) this.inventoryChestY == index3) + { + this.DrawInventoryCursor(x2, y4, (double) UI.inventoryScale, (int) byte.MaxValue); + this.toolTip = chest.item[index4]; + } + if ((int) chest.item[index4].type > 0 && (int) chest.item[index4].stack > 0) + { + Color white = Color.White; + this.DrawInventoryItem(ref chest.item[index4], x2, y4, white, UI.StackType.INVENTORY); + } + } + } + this.UpdateToolTipText((string) null); + this.DrawToolTip(INVENTORY_X + 864 - 322 - 8, INVENTORY_Y + 8, 344); + this.DrawControlsInventory(); + } + + private void UpdateShop() + { + int index = (int) this.inventoryChestX + (int) this.inventoryChestY * 5; + if (this.IsButtonTriggered(Buttons.A)) + { + if ((int) this.mouseItem.type == 0) + { + if ((int) this.player.selectedItem == index && (int) this.player.itemAnimation > 0 || !this.player.BuyItem(Main.shop[(int) this.npcShop].item[index].value)) + return; + if (Main.shop[(int) this.npcShop].item[index].buyOnce) + { + int pre = (int) Main.shop[(int) this.npcShop].item[index].prefix; + this.mouseItem.netDefaults((int) Main.shop[(int) this.npcShop].item[index].netID, 1); + this.mouseItem.Prefix(pre); + } + else + { + this.mouseItem.netDefaults((int) Main.shop[(int) this.npcShop].item[index].netID, 1); + this.mouseItem.Prefix(-1); + } + this.mouseItem.position.X = this.player.position.X + 10f - (float) ((int) this.mouseItem.width >> 1); + this.mouseItem.position.Y = this.player.position.Y + 21f - (float) ((int) this.mouseItem.height >> 1); + if (Main.shop[(int) this.npcShop].item[index].buyOnce) + { + --Main.shop[(int) this.npcShop].item[index].stack; + if ((int) Main.shop[(int) this.npcShop].item[index].stack <= 0) + Main.shop[(int) this.npcShop].item[index].Init(); + } + Main.PlaySound(18); + } + else + { + if ((int) Main.shop[(int) this.npcShop].item[index].type != 0) + return; + if (this.player.SellItem(this.mouseItem.value, (int) this.mouseItem.stack)) + { + Main.shop[(int) this.npcShop].AddShop(ref this.mouseItem); + this.mouseItem.stack = (short) 0; + this.mouseItem.type = (short) 0; + Main.PlaySound(18); + } + else + { + if (this.mouseItem.value != 0) + return; + Main.shop[(int) this.npcShop].AddShop(ref this.mouseItem); + this.mouseItem.stack = (short) 0; + this.mouseItem.type = (short) 0; + Main.PlaySound(7); + } + } + } + else + { + if ((int) this.stackSplit > 1 || !this.gpState.IsButtonDown(Buttons.RightTrigger) || (int) this.mouseItem.netID != (int) Main.shop[(int) this.npcShop].item[index].netID && (int) this.mouseItem.type != 0 || ((int) this.mouseItem.stack >= (int) this.mouseItem.maxStack && (int) this.mouseItem.type != 0 || !this.player.BuyItem(Main.shop[(int) this.npcShop].item[index].value))) + return; + Main.PlaySound(18); + if ((int) this.mouseItem.type == 0) + { + this.mouseItem.netDefaults((int) Main.shop[(int) this.npcShop].item[index].netID, 1); + this.mouseItem.stack = (short) 0; + } + ++this.mouseItem.stack; + this.stackSplit = (int) this.stackSplit != 0 ? this.stackDelay : (short) 15; + if (!Main.shop[(int) this.npcShop].item[index].buyOnce) + return; + --Main.shop[(int) this.npcShop].item[index].stack; + if ((int) Main.shop[(int) this.npcShop].item[index].stack > 0) + return; + Main.shop[(int) this.npcShop].item[index].Init(); + } + } + + private void DrawShop(int INVENTORY_X, int INVENTORY_Y) + { + Color c = new Color((int) UI.invAlpha, (int) UI.invAlpha, (int) UI.invAlpha, (int) UI.invAlpha); + UI.inventoryScale = 1f; + for (int index1 = 0; index1 < 5; ++index1) + { + for (int index2 = 0; index2 < 4; ++index2) + { + int x = 112 + INVENTORY_X + index1 * 56; + int y = 56 + INVENTORY_Y + index2 * 56; + int index3 = index1 + index2 * 5; + SpriteSheet<_sheetSprites>.DrawTL(445, x, y, c, UI.inventoryScale); + if (this.inventorySection == UI.InventorySection.CHEST && (int) this.inventoryChestX == index1 && (int) this.inventoryChestY == index2) + { + this.DrawInventoryCursor(x, y, (double) UI.inventoryScale, (int) byte.MaxValue); + this.toolTip = Main.shop[(int) this.npcShop].item[index3]; + this.toolTip.buy = true; + } + if ((int) Main.shop[(int) this.npcShop].item[index3].type > 0 && (int) Main.shop[(int) this.npcShop].item[index3].stack > 0) + { + Color white = Color.White; + this.DrawInventoryItem(ref Main.shop[(int) this.npcShop].item[index3], x, y, white, UI.StackType.INVENTORY); + } + } + } + this.UpdateToolTipText((string) null); + this.DrawToolTip(INVENTORY_X + 864 - 322 - 8, INVENTORY_Y + 8, 344); + this.DrawControlsShop(); + } + + private void UpdateEquip() + { + if ((int) this.inventoryEquipY == 0) + { + if (!this.IsButtonTriggered(Buttons.A)) + return; + int b = (int) this.inventoryEquipX + (int) this.inventoryBuffX; + if ((int) this.player.buff[b].Time <= 0 || this.player.buff[b].IsDebuff()) + return; + this.player.DelBuff(b); + Main.PlaySound(12); + } + else + { + int slot = (int) this.inventoryEquipY != 4 ? ((int) this.inventoryEquipX != 0 ? (int) this.inventoryEquipY + 7 : (int) this.inventoryEquipY - 1) : 3 + (int) this.inventoryEquipX; + if (this.IsButtonTriggered(Buttons.A)) + { + if (this.reforge) + this.Reforge(slot, true); + else if (this.craftGuide) + { + this.CraftingGuide(); + } + else + { + if ((int) this.mouseItem.type != 0 && ((int) this.mouseItem.headSlot < 0 || slot != 0 && slot != 8) && (((int) this.mouseItem.bodySlot < 0 || slot != 1 && slot != 9) && ((int) this.mouseItem.legSlot < 0 || slot != 2 && slot != 10)) && (!this.mouseItem.accessory || slot <= 2 || this.AccCheck(ref this.mouseItem, slot))) + return; + Item obj = this.mouseItem; + this.mouseItem = this.player.armor[slot]; + this.player.armor[slot] = obj; + this.mouseItemSrcSection = UI.InventorySection.EQUIP; + this.mouseItemSrcX = this.inventoryEquipX; + this.mouseItemSrcY = this.inventoryEquipY; + if ((int) this.player.armor[slot].type == 0 || (int) this.player.armor[slot].stack < 1) + this.player.armor[slot].Init(); + if ((int) this.mouseItem.type <= 0 && (int) this.player.armor[slot].type <= 0) + return; + Main.PlaySound(7); + } + } + else + { + if (!this.IsButtonTriggered(Buttons.RightTrigger) || !this.player.armor[slot].isEquipable() || this.reforge) + return; + this.player.armor[slot] = this.player.armorSwap(ref this.player.armor[slot]); + } + } + } + + private void DrawEquip(int INVENTORY_X, int INVENTORY_Y) + { + Color c1 = new Color((int) UI.invAlpha, (int) UI.invAlpha, (int) UI.invAlpha, (int) UI.invAlpha); + Color c2 = new Color((int) UI.invAlpha >> 1, (int) UI.invAlpha, (int) UI.invAlpha >> 1, (int) UI.invAlpha); + UI.inventoryScale = 1f; + int x1 = INVENTORY_X + 112; + int y1 = INVENTORY_Y; + Rectangle rect = new Rectangle(); + rect.Y = y1; + rect.Width = 16; + rect.Height = 56; + if ((int) this.inventoryBuffX > 0) + { + rect.X = x1 - 16; + SpriteSheet<_sheetSprites>.DrawCentered(136, ref rect, SpriteEffects.FlipHorizontally); + } + if ((int) this.inventoryBuffX < 5) + { + rect.X = x1 + 280; + SpriteSheet<_sheetSprites>.DrawCentered(136, ref rect); + } + string extraInfo = (string) null; + for (int index = 0; index < 5; ++index) + { + int type = (int) this.player.buff[(int) this.inventoryBuffX + index].Type; + if ((int) this.inventoryEquipY == 0 && (int) this.inventoryEquipX == index) + { + this.DrawInventoryCursor(x1, y1, (double) UI.inventoryScale, (int) byte.MaxValue); + this.toolTip.Init(); + string str = !Buff.IsDebuff(type) ? "" : ""; + if (type == 40) + type += (int) this.player.pet; + extraInfo = str + Buff.buffName[type] + "\n" + Buff.buffTip[type]; + } + else + SpriteSheet<_sheetSprites>.DrawTL(442, x1, y1, c2, UI.inventoryScale); + if (type > 0) + { + int itemTexId = 141 + type; + if (type == 40) + itemTexId += (int) this.player.pet; + this.DrawInventoryItem(itemTexId, x1, y1, Color.White); + } + x1 += 56; + } + int x2 = INVENTORY_X + 112; + int y2 = INVENTORY_Y + 88; + for (int index = 0; index < 3; ++index) + { + if ((int) this.inventoryEquipX == 0 && (int) this.inventoryEquipY == index + 1) + { + this.DrawInventoryCursor(x2, y2, (double) UI.inventoryScale, (int) byte.MaxValue); + this.toolTip = this.player.armor[index]; + this.toolTip.wornArmor = true; + } + else + SpriteSheet<_sheetSprites>.DrawTL(442, x2, y2, c1, UI.inventoryScale); + if ((int) this.player.armor[index].type > 0 && (int) this.player.armor[index].stack > 0) + { + Color itemColor = this.craftGuide && !this.player.armor[index].material || this.reforge && !this.player.armor[index].Prefix(-3) ? UI.DISABLED_COLOR : new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue); + this.DrawInventoryItem(ref this.player.armor[index], x2, y2, itemColor, UI.StackType.NONE); + } + y2 += 56; + } + int y3 = y2 + 32; + for (int index = 3; index < 8; ++index) + { + if ((int) this.inventoryEquipY == 4 && (int) this.inventoryEquipX == index - 3) + { + this.DrawInventoryCursor(x2, y3, (double) UI.inventoryScale, (int) byte.MaxValue); + this.toolTip = this.player.armor[index]; + } + else + SpriteSheet<_sheetSprites>.DrawTL(442, x2, y3, c1, UI.inventoryScale); + if ((int) this.player.armor[index].type > 0 && (int) this.player.armor[index].stack > 0) + { + Color itemColor = this.craftGuide && !this.player.armor[index].material || this.reforge && !this.player.armor[index].Prefix(-3) ? UI.DISABLED_COLOR : new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue); + this.DrawInventoryItem(ref this.player.armor[index], x2, y3, itemColor, UI.StackType.NONE); + } + x2 += 56; + } + int x3 = x2 - 56; + int y4 = INVENTORY_Y + 88; + for (int index = 8; index < 11; ++index) + { + if ((int) this.inventoryEquipX == 4 && (int) this.inventoryEquipY == index - 7) + { + this.DrawInventoryCursor(x3, y4, (double) UI.inventoryScale, (int) byte.MaxValue); + this.toolTip = this.player.armor[index]; + this.toolTip.social = true; + } + else + SpriteSheet<_sheetSprites>.DrawTL(442, x3, y4, c1, UI.inventoryScale); + if ((int) this.player.armor[index].type > 0 && (int) this.player.armor[index].stack > 0) + { + Color itemColor = this.craftGuide && !this.player.armor[index].material || this.reforge && !this.player.armor[index].Prefix(-3) ? UI.DISABLED_COLOR : new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue); + this.DrawInventoryItem(ref this.player.armor[index], x3, y4, itemColor, UI.StackType.NONE); + } + y4 += 56; + } + this.DrawPlayer(this.player, new Vector2((float) (INVENTORY_X + 112 + 112), (float) (INVENTORY_Y + 88)), 3.75f); + double num1 = (double) UI.DrawStringCT(UI.fontSmall, Lang.inter[6], INVENTORY_X + 112 + 140, INVENTORY_Y + 56 - 12, Color.White); + double num2 = (double) UI.DrawStringCT(UI.fontSmall, Lang.inter[45], INVENTORY_X + 112 + 28, y4 - 12, Color.White); + double num3 = (double) UI.DrawStringCT(UI.fontSmall, Lang.inter[11], x3 + 28, y4 - 12, Color.White); + double num4 = (double) UI.DrawStringCT(UI.fontSmallOutline, ToStringExtensions.ToStringLookup((int) this.player.statDefense) + Lang.inter[10], INVENTORY_X + 112 + 140, y4 - 6, new Color(100, (int) byte.MaxValue, 200, (int) byte.MaxValue)); + this.UpdateToolTipText(extraInfo); + this.DrawToolTip(INVENTORY_X + 864 - 322 - 8, INVENTORY_Y + 8, 344); + this.DrawControlsInventory(); + } + + private void UpdateHousing() + { + int x = this.player.aabb.X >> 4; + int y = this.player.aabb.Y >> 4; + if (this.IsButtonTriggered(Buttons.X)) + { + Main.PlaySound(12); + if (!WorldGen.MoveNPC(x, y, -1)) + return; + Main.NewText(Lang.inter[39], (int) byte.MaxValue, 240, 20); + } + else if (this.IsButtonTriggered(Buttons.Y)) + { + Main.PlaySound(12); + UI ui = this; + int num = !ui.showNPCs ? 1 : 0; + ui.showNPCs = num != 0; + } + else + { + if (!this.IsButtonTriggered(Buttons.A) || (int) this.inventoryHousingNpc < 0) + return; + Main.PlaySound(12); + if (!WorldGen.MoveNPC(x, y, (int) this.inventoryHousingNpc)) + return; + WorldGen.moveRoom(x, y, (int) this.inventoryHousingNpc); + Main.PlaySound(12); + } + } + + private void DrawHousing(int INVENTORY_X, int INVENTORY_Y) + { + Color c = new Color((int) UI.invAlpha, (int) UI.invAlpha, (int) UI.invAlpha, (int) UI.invAlpha); + UI.inventoryScale = 1f; + string extraInfo = (string) null; + int x = INVENTORY_X; + int y = INVENTORY_Y; + for (int index1 = 0; index1 < 11; ++index1) + { + if (index1 == 6) + { + x += 240; + y = INVENTORY_Y; + } + string s = (string) null; + NPC npc = (NPC) null; + int num = -1; + for (int index2 = 0; index2 < 196; ++index2) + { + npc = Main.npc[index2]; + if ((int) npc.active != 0 && index1 + 1 == npc.getHeadTextureId()) + { + num = index2; + s = !npc.hasName() ? npc.displayName : npc.getName(); + break; + } + } + if ((int) this.inventoryHousingX == index1 / 6 && (int) this.inventoryHousingY == index1 % 6) + { + this.DrawInventoryCursor(x, y, (double) UI.inventoryScale, (int) byte.MaxValue); + this.inventoryHousingNpc = (short) num; + if (s != null) + { + string str = s; + if (index1 != 10 && Lang.lang <= 1) + str = str + " the " + npc.name; + extraInfo = str + (object) '\n' + Lang.inter[55 + index1]; + } + } + else + SpriteSheet<_sheetSprites>.DrawTL(449, x, y, c, UI.inventoryScale); + if (num >= 0) + { + this.DrawInventoryItem(index1 + 1256, x, y, Color.White); + if (!npc.homeless) + SpriteSheet<_sheetSprites>.DrawTL(437, x + 60 - 16, y - 8, Color.White, UI.inventoryScale); + UI.DrawStringLC(UI.fontSmallOutline, s, x + 60, y + 30, Color.White); + } + y += 60; + } + this.UpdateToolTipText(extraInfo); + this.DrawToolTip(INVENTORY_X + 864 - 322 - 8, INVENTORY_Y + 8, 344); + this.DrawControlsHousing(); + } + + private void DrawMouseItem() + { + if ((int) this.mouseItem.stack <= 0) + { + this.mouseItem.Init(); + } + else + { + if ((int) this.mouseItem.type <= 0 || (int) this.mouseItem.stack <= 0) + return; + UI.inventoryScale = UI.cursorScale; + this.DrawInventoryItem(ref this.mouseItem, (int) this.mouseX + 6, (int) this.mouseY + 6, new Color(0, 0, 0, 128), UI.StackType.INVENTORY); + this.DrawInventoryItem(ref this.mouseItem, (int) this.mouseX, (int) this.mouseY, Color.White, UI.StackType.INVENTORY); + } + } + + private void DrawInventoryMenu() + { + int num1 = this.view.SAFE_AREA_OFFSET_L; + int y1 = this.view.SAFE_AREA_OFFSET_T; + if ((int) this.view.viewWidth > 960) + num1 = (int) this.view.viewWidth - 864 >> 1; + bool flag1 = (int) this.player.chest != -1; + bool flag2 = (int) this.npcShop > 0; + bool flag3 = flag1 || flag2; + int texId; + switch (this.inventorySection) + { + case UI.InventorySection.CRAFTING: + texId = 441; + break; + case UI.InventorySection.CHEST: + texId = flag2 ? 445 : 444; + break; + case UI.InventorySection.EQUIP: + texId = 442; + break; + case UI.InventorySection.HOUSING: + texId = 449; + break; + default: + texId = 451; + break; + } + Main.DrawRect(texId, new Rectangle(num1, y1, 864, 446), 96, 0); + Color c = new Color(); + int x = num1 + (864 - ((flag3 ? 4 : 3) * 43 + 56)) / 2; + for (int index = 0; index < 5; ++index) + { + int itemTexId; + switch ((byte) index) + { + case (byte) 0: + itemTexId = 205; + break; + case (byte) 1: + itemTexId = 440; + break; + case (byte) 2: + if (flag2) + { + itemTexId = Chest.GetShopOwnerHeadTextureId((int) this.npcShop); + break; + } + else if (flag1) + { + switch (this.player.chest) + { + case (short) -3: + itemTexId = 797; + break; + case (short) -2: + itemTexId = 538; + break; + default: + itemTexId = 499; + break; + } + } + else + continue; + case (byte) 3: + itemTexId = 219; + break; + default: + itemTexId = 437; + break; + } + int num2 = (int) this.inventorySection; + float scaleTopLeft = this.inventoryMenuSectionScale[index]; + if (index == num2) + { + if ((double) scaleTopLeft < 1.0) + { + scaleTopLeft += 0.05f; + this.inventoryMenuSectionScale[index] = scaleTopLeft; + } + } + else if ((double) scaleTopLeft > 0.75) + { + scaleTopLeft -= 0.05f; + this.inventoryMenuSectionScale[index] = scaleTopLeft; + } + int y2 = (int) ((double) y1 + 22.0 * (1.0 - (double) scaleTopLeft)); + int num3 = (int) (65.0 + 180.0 * (double) scaleTopLeft); + if (index == num2) + { + c.R = (byte) 200; + c.G = (byte) 200; + c.B = (byte) 200; + c.A = (byte) 200; + SpriteSheet<_sheetSprites>.DrawTL(448, x, y2, c, scaleTopLeft); + } + else + { + c.R = (byte) 100; + c.G = (byte) 100; + c.B = (byte) 100; + c.A = (byte) 100; + SpriteSheet<_sheetSprites>.DrawTL(451, x, y2, c, scaleTopLeft); + } + UI.inventoryScale = scaleTopLeft; + Color itemColor = !this.IsInventorySectionAvailable((UI.InventorySection) index) ? UI.DISABLED_COLOR : new Color(num3, num3, num3, num3); + this.DrawInventoryItem(itemTexId, x, y2, itemColor); + x += (int) (52.0 * (double) scaleTopLeft) + 4; + } + string s; + switch (this.inventorySection) + { + case UI.InventorySection.CRAFTING: + s = Lang.inter[25]; + break; + case UI.InventorySection.ITEMS: + s = Lang.inter[4]; + break; + case UI.InventorySection.CHEST: + if (flag2) + { + s = Lang.inter[28]; + break; + } + else + { + int num2 = (int) this.player.chest; + switch (this.player.chest) + { + case (short) -3: + s = Lang.inter[33]; + break; + case (short) -2: + s = Lang.inter[32]; + break; + default: + s = this.chestText; + break; + } + } + case UI.InventorySection.EQUIP: + s = Lang.inter[45]; + break; + default: + s = Lang.inter[7]; + break; + } + if (this.reforge) + s = s + " (" + Lang.inter[19] + (object) ')'; + double num4 = (double) UI.DrawStringCT(UI.fontSmall, s, num1 + 432, y1 + 44, Color.White); + switch (this.inventorySection) + { + case UI.InventorySection.CRAFTING: + this.DrawCrafting(num1, y1 + 80); + break; + case UI.InventorySection.ITEMS: + this.DrawInventory(num1, y1 + 80); + break; + case UI.InventorySection.CHEST: + if (flag2) + { + this.DrawShop(num1, y1 + 80); + break; + } + else + { + this.DrawStorage(num1, y1 + 80); + break; + } + case UI.InventorySection.EQUIP: + this.DrawEquip(num1, y1 + 80); + break; + case UI.InventorySection.HOUSING: + this.DrawHousing(num1, y1 + 80); + break; + } + this.DrawMouseItem(); + } + + private void DrawCrafting(int CRAFTING_X, int CRAFTING_Y) + { + Color color1 = new Color(); + Color color2 = new Color((int) UI.invAlpha, (int) UI.invAlpha, (int) UI.invAlpha, (int) UI.invAlpha); + string extraInfo = (string) null; + Main.DrawRectOpenAtTop(441, new Rectangle(CRAFTING_X, CRAFTING_Y + 48, 864, 318), 192, 0); + int x1 = CRAFTING_X + 3; + for (int index = 0; index < 6; ++index) + { + Rectangle rect = new Rectangle(x1, CRAFTING_Y + 8, (int) sbyte.MaxValue, 32); + if (this.craftingCategory != (Recipe.Category) index) + Main.DrawRectStraightBottom(441, rect, 192, 2); + else + Main.DrawRectOpenAtBottom(441, rect, 192, 0); + SpriteSheet<_sheetSprites>.DrawCentered(206 + index, ref rect); + x1 += 146; + } + int num1 = CRAFTING_X + 4 + 16; + int num2 = CRAFTING_Y + 12 + 48; + int count1 = this.currentRecipeCategory.Count; + if (count1 > 0) + { + UI.inventoryScale = 1f; + int num3 = (int) this.craftingRecipeY - Math.Sign(this.craftingRecipeScrollY); + int num4 = Math.Min(8, this.currentRecipeCategory[(int) this.craftingRecipeY].recipes.Count) * 56; + int num5 = (double) this.craftingRecipeScrollX == 0.0 ? 448 : num4; + int num6 = Math.Min(5, count1) * 56; + Rectangle rectangle = new Rectangle(); + for (int index1 = 0; index1 < 2; ++index1) + { + Main.spriteBatch.End(); + rectangle.X = num1; + rectangle.Y = num2; + if (index1 == 0) + { + rectangle.Width = 56; + rectangle.Height = num6; + } + else + { + rectangle.Y += 56; + rectangle.Width = num5; + rectangle.Height = 56; + } + if (!this.view.isFullScreen()) + { + rectangle.X >>= 1; + rectangle.X += this.view.activeViewport.X; + rectangle.Y >>= 1; + rectangle.Y += this.view.activeViewport.Y; + rectangle.Width >>= 1; + rectangle.Height >>= 1; + } + WorldView.graphicsDevice.ScissorRectangle = rectangle; + Main.spriteBatch.Begin(SpriteSortMode.Deferred, (BlendState) null, (SamplerState) null, (DepthStencilState) null, WorldView.scissorTest, (Effect) this.view.screenProjection); + int y = num2; + int num7 = 1; + if ((double) this.craftingRecipeScrollY != 0.0) + { + num7 = 2; + y = y - 56 - (int) ((1.0 - (double) Math.Abs(this.craftingRecipeScrollY)) * 56.0) * Math.Sign(this.craftingRecipeScrollY); + if (index1 == 1) + { + this.craftingRecipeScrollY *= this.craftingRecipeScrollMul; + if ((double) Math.Abs(this.craftingRecipeScrollY) < 0.0178571436554194) + this.craftingRecipeScrollY = 0.0f; + } + } + for (int index2 = -num7; index2 < 5 + num7; ++index2) + { + int index3 = num3 + index2; + if (index3 >= 0) + { + if (index3 >= count1) + { + int num8 = y - num2; + if (num8 < num6) + { + num6 = num8; + break; + } + else + break; + } + else + { + int num8 = 0; + int x2 = num1; + if ((double) this.craftingRecipeScrollX != 0.0 && index3 == (int) this.craftingRecipeY) + { + num8 = 1; + int num9 = x2 - 56; + if (index1 == 0) + { + this.craftingRecipeScrollX *= this.craftingRecipeScrollMul; + if ((double) Math.Abs(this.craftingRecipeScrollX) < 0.0178571436554194) + this.craftingRecipeScrollX = 0.0f; + } + x2 = num9 - (int) ((1.0 - (double) Math.Abs(this.craftingRecipeScrollX)) * 56.0) * Math.Sign(this.craftingRecipeScrollX); + } + Recipe.SubCategoryList subCategoryList = this.currentRecipeCategory[index3]; + int num10 = index3 != (int) this.craftingRecipeY ? 0 : (int) this.craftingRecipeX - Math.Sign(this.craftingRecipeScrollX); + int count2 = subCategoryList.recipes.Count; + for (int index4 = -num8; index4 < 8 + num8; ++index4) + { + int num9 = num10 + index4; + if (num9 < 0) + num9 += count2; + if (num8 != 0 || index4 < count2) + { + int index5 = num9 % subCategoryList.recipes.Count; + int index6 = (int) subCategoryList.recipes[index5]; + Recipe r = Main.recipe[index6]; + bool flag1 = this.player.CanCraftRecipe(r); + bool flag2 = index3 == (int) this.craftingRecipeY && index5 == (int) this.craftingRecipeX; + if (flag2) + { + this.craftingRecipe = r; + this.DrawInventoryCursor(x2, y, (double) UI.inventoryScale, this.craftingSection == UI.CraftingSection.RECIPES ? (int) byte.MaxValue : 96); + if (index1 == 0) + { + this.toolTip = r.createItem; + extraInfo = "(" + ToStringExtensions.ToStringLookup(this.player.CountPossession((int) this.toolTip.netID)) + Lang.menu[1]; + this.UpdateToolTipText(extraInfo); + } + } + else + { + int id = index1 == 0 ? 443 : 450; + color1 = color2; + if (!flag1) + { + color1.R >>= 1; + color1.G >>= 1; + color1.B >>= 1; + color1.A >>= 1; + } + SpriteSheet<_sheetSprites>.DrawTL(id, x2, y, color1, UI.inventoryScale); + } + color1 = flag1 ? new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue) : new Color(16, 16, 16, 128); + this.DrawInventoryItem(ref r.createItem, x2, y, color1, UI.StackType.INVENTORY); + if (this.player.recipesNew.Get(index6)) + { + if (flag2) + { + this.player.recipesNew.Set(index6, false); + } + else + { + color1 = new Color(UI.cursorAlpha, UI.cursorAlpha, UI.cursorAlpha, UI.cursorAlpha); + SpriteSheet<_sheetTiles>.Draw(23, x2 + 56 - 16, y + 12, color1, (float) Main.frameCounter * 0.03978873f, (float) (0.8 + Math.Sin((double) Main.frameCounter * 0.0198943678864869) * 0.2)); + SpriteSheet<_sheetTiles>.Draw(23, x2 + 28, y + 28, color1, (float) Main.frameCounter * 0.05305165f, (float) (0.6 + Math.Sin((double) Main.frameCounter * 0.0132629119243246) * 0.4)); + SpriteSheet<_sheetTiles>.Draw(23, x2 + 28 - 12, y + 28 - 8, color1, (float) Main.frameCounter * 0.07957747f, (float) (0.7 + Math.Sin((double) Main.frameCounter * 0.00994718394324346) * 0.3)); + } + } + x2 += 56; + } + else + break; + } + } + } + y += 56; + } + } + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, (BlendState) null, (SamplerState) null, (DepthStencilState) null, (RasterizerState) null, (Effect) this.view.screenProjection); + if ((double) this.craftingRecipeScrollX == 0.0 && (double) this.craftingRecipeScrollY == 0.0) + { + Rectangle rect = new Rectangle(); + if (num4 > 56) + { + rect.X = num1 - 16; + rect.Y = num2 + 56; + rect.Width = 16; + rect.Height = 56; + SpriteSheet<_sheetSprites>.DrawCentered(136, ref rect, SpriteEffects.FlipHorizontally); + rect.X += 10 + num4; + SpriteSheet<_sheetSprites>.DrawCentered(136, ref rect); + } + if (count1 > 1) + { + if ((int) this.craftingRecipeY == 0) + { + num2 += 56; + num6 -= 56; + } + rect.X = num1; + rect.Y = num2 - 16; + rect.Width = 56; + rect.Height = 16; + SpriteSheet<_sheetSprites>.DrawCentered(135, ref rect, SpriteEffects.FlipVertically); + rect.Y += num6 + 10; + SpriteSheet<_sheetSprites>.DrawCentered(135, ref rect); + if ((int) this.craftingRecipeY == 0) + { + num2 -= 56; + int num7 = num6 + 56; + } + } + } + int x3 = num1 + 56 + 8; + int y1 = num2 + 112 + 8; + Main.DrawRect(441, new Rectangle(x3, y1, CRAFTING_X + 864 - 322 - 32 - x3, 174), 96, 0); + UI.fontSmall.MeasureString(Lang.menu[0]); + double num11 = (double) UI.DrawStringCT(UI.fontSmall, Lang.menu[0], x3 + 100, y1 + 150 - 6, Color.White); + UI.inventoryScale = 0.9f; + int index7 = 0; + for (int index1 = 0; index1 < 3; ++index1) + { + int num7 = 0; + while (num7 < 4) + { + int x2 = x3 + 50 * num7; + int y2 = y1 + 50 * index1; + if (this.craftingSection == UI.CraftingSection.INGREDIENTS && (num7 == (int) this.craftingIngredientX && index1 == (int) this.craftingIngredientY)) + { + this.DrawInventoryCursor(x2, y2, (double) UI.inventoryScale, (int) byte.MaxValue); + if (index7 < (int) this.craftingRecipe.numRequiredItems) + { + this.toolTip = this.craftingRecipe.requiredItem[index7]; + extraInfo = "(" + ToStringExtensions.ToStringLookup(this.player.CountPossession((int) this.toolTip.netID)) + Lang.menu[1]; + this.UpdateToolTipText(extraInfo); + } + } + else + { + int id = 442; + color1 = index7 >= (int) this.craftingRecipe.numRequiredItems ? new Color(64, 64, 64, 64) : color2; + SpriteSheet<_sheetSprites>.DrawTL(id, x2, y2, color1, UI.inventoryScale); + } + if (index7 < (int) this.craftingRecipe.numRequiredItems) + this.DrawInventoryItem(ref this.craftingRecipe.requiredItem[index7], x2, y2, new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue), UI.StackType.INGREDIENT); + ++num7; + ++index7; + } + } + int id1 = -1; + Main.strBuilder.Length = 0; + if ((int) this.craftingRecipe.numRequiredTiles > 0) + { + Main.strBuilder.Append(Main.tileName[(int) this.craftingRecipe.requiredTile[0]]); + switch (this.craftingRecipe.requiredTile[0]) + { + case (short) 114: + id1 = 849; + break; + case (short) 134: + id1 = 976; + break; + case (short) 101: + id1 = 139; + break; + case (short) 106: + id1 = 814; + break; + case (short) 86: + id1 = 783; + break; + case (short) 94: + id1 = 803; + break; + case (short) 96: + id1 = 796; + break; + case (short) 13: + id1 = 1; + break; + case (short) 14: + id1 = 1480; + Main.strBuilder.Append(" & "); + Main.strBuilder.Append(Main.tileName[15]); + break; + case (short) 16: + id1 = 486; + break; + case (short) 17: + id1 = 484; + break; + case (short) 18: + if ((int) this.craftingRecipe.requiredTile[1] == 15) + { + id1 = 1487; + Main.strBuilder.Append(" & "); + Main.strBuilder.Append(Main.tileName[15]); + break; + } + else + { + id1 = 487; + break; + } + case (short) 26: + id1 = 212; + break; + } + } + else if (this.craftingRecipe.needWater) + { + id1 = 1484; + Main.strBuilder.Append(Lang.inter[53]); + } + if (id1 >= 0) + { + Rectangle rect = new Rectangle(); + rect.X = x3 + 200 + 80; + rect.Y = y1 + 18 + 28; + rect.Width = 68; + rect.Height = 68; + Main.DrawRect(442, rect, 192, 0); + int num7 = SpriteSheet<_sheetSprites>.src[id1].Width; + int num8 = SpriteSheet<_sheetSprites>.src[id1].Height; + float scaleCenter = num7 <= num8 ? 64f / (float) num8 : 64f / (float) num7; + SpriteSheet<_sheetSprites>.DrawScaled(id1, ref new Vector2() + { + X = (float) rect.Center.X, + Y = (float) rect.Center.Y + }, Color.White, scaleCenter); + double num9 = (double) UI.DrawStringCT(UI.fontSmall, rect.Center.X, rect.Bottom + 2, this.player.IsNearCraftingStation(this.craftingRecipe) ? Color.White : new Color((int) byte.MaxValue, 64, 64, (int) byte.MaxValue)); + } + if (extraInfo != null) + this.DrawToolTip(CRAFTING_X + 864 - 322 - 8, num2 + 8, 286); + } + this.DrawControlsCrafting(); + } + + private void DrawMiniMap() + { + int x1 = this.view.SAFE_AREA_OFFSET_L; + int y1 = this.view.SAFE_AREA_OFFSET_T; + int width = (int) this.view.viewWidth - this.view.SAFE_AREA_OFFSET_L - this.view.SAFE_AREA_OFFSET_R; + int height = 540 - this.view.SAFE_AREA_OFFSET_T - this.view.SAFE_AREA_OFFSET_B - 36; + Main.DrawRect(451, new Rectangle(x1, y1, width, height), 128, 0); + int x2 = 31 + x1; + int y2 = 2 + y1; + if (this.mapScreenCursorX == 0 && this.mapScreenCursorY < 2) + this.DrawInventoryCursor(x2, y2, 1.0, (int) byte.MaxValue); + else + SpriteSheet<_sheetSprites>.Draw(451, x2, y2); + Color white = Color.White; + if (this.pvpSelected) + { + SpriteSheet<_sheetSprites>.Draw(455, x2 + 9, y2 + 11, white); + SpriteSheet<_sheetSprites>.Draw(455, x2 + 11, y2 + 11, white, SpriteEffects.FlipHorizontally); + } + else + { + SpriteSheet<_sheetSprites>.DrawRotatedTL(455, x2 - 7, y2 + 25, white, -0.785f); + SpriteSheet<_sheetSprites>.DrawRotatedTL(455, x2 + 11, y2 + 25, white, -0.785f); + } + int num1 = x2 + 123; + for (int index = 0; index < 5; ++index) + { + Color c = Main.teamColor[index]; + if (index == (int) this.teamSelected) + { + c.A = UI.mouseTextBrightness; + } + else + { + c.R >>= 1; + c.G >>= 1; + c.B >>= 1; + c.A >>= 1; + } + int num2 = num1; + int num3 = y2 + 3; + if (index == 0) + { + num2 -= 32; + num3 += 16; + } + else if (index != 1) + { + if (index == 2) + num2 += 32; + else if (index == 3) + { + num3 += 32; + } + else + { + num2 += 32; + num3 += 32; + } + } + int x3 = num2 - 8; + int y3 = num3 - 8; + if (index == 0 && this.mapScreenCursorX == 1 || index == 1 && this.mapScreenCursorX == 2 && this.mapScreenCursorY == 0 || (index == 2 && this.mapScreenCursorX == 3 && this.mapScreenCursorY == 0 || index == 3 && this.mapScreenCursorX == 2 && this.mapScreenCursorY == 1) || index == 4 && this.mapScreenCursorX == 3 && this.mapScreenCursorY == 1) + this.DrawInventoryCursor(x3, y3, 8.0 / 13.0, (int) byte.MaxValue); + else + SpriteSheet<_sheetSprites>.DrawScaledTL(451, x3, y3, Color.White, 0.6153846f); + SpriteSheet<_sheetSprites>.Draw(1481, x3 + 8, y3 + 8, c); + } + int num4 = x1; + int num5 = 98 + y1; + for (int index = 8; index > 0; --index) + { + int num2 = num5 + 44 * (index - 1); + if (this.mapScreenCursorY - 1 == index) + this.DrawInventoryCursor(num4 - 2, num2 - 2, 12.0 / 13.0, (int) byte.MaxValue); + else + SpriteSheet<_sheetSprites>.DrawScaledTL(451, num4 + 2, num2 + 2, Color.White, 0.7692308f); + } + Main.spriteBatch.End(); + GamerCollection allGamers = Netplay.session.AllGamers; + for (int index = 0; index < ((ReadOnlyCollection) allGamers).Count; ++index) + { + Player player = ((ReadOnlyCollection) allGamers)[index].Tag as Player; + if (player != null) + this.DrawPlayerIcon(player, new Vector2((float) (num4 + 8), (float) (num5 + 8 + index * 44)), 1.5f); + } + this.miniMap.DrawMap(this.view); + UI.DrawStringCC(UI.fontSmall, Lang.menu[81], x2 + 26, y2 + 69, Color.White); + UI.DrawStringCC(UI.fontSmall, Lang.menu[82], num1 + 16, y2 + 69, Color.White); + for (int index = 0; index < ((ReadOnlyCollection) allGamers).Count; ++index) + { + Player player = ((ReadOnlyCollection) allGamers)[index].Tag as Player; + if (player != null) + { + int y3 = num5 + 4 + 44 * index; + UI.DrawStringLT(UI.fontSmallOutline, player.name, num4 + 52, y3, Main.teamColor[(int) player.team]); + } + } + } + + private bool AccCheck(ref Item newItem, int slot) + { + if ((int) this.player.armor[slot].netID == (int) newItem.netID) + return false; + for (int index = 3; index < 11; ++index) + { + if ((int) newItem.netID == (int) this.player.armor[index].netID) + return true; + } + return false; + } + + private void UpdateToolTipText(string extraInfo) + { + Main.strBuilder.Length = 0; + string text; + if ((int) this.toolTip.type > 0) + { + switch (this.toolTip.rare) + { + case (sbyte) -1: + Main.strBuilder.Append(""); + break; + case (sbyte) 1: + Main.strBuilder.Append(""); + break; + case (sbyte) 2: + Main.strBuilder.Append(""); + break; + case (sbyte) 3: + Main.strBuilder.Append(""); + break; + case (sbyte) 4: + Main.strBuilder.Append(""); + break; + case (sbyte) 5: + Main.strBuilder.Append(""); + break; + case (sbyte) 6: + Main.strBuilder.Append(""); + break; + default: + Main.strBuilder.Append(""); + break; + } + Main.strBuilder.Append(this.toolTip.AffixName()); + if ((int) this.toolTip.stack > 1) + Main.strBuilder.Append(ToStringExtensions.ToStackString(this.toolTip.stack)); + Main.strBuilder.Append("\n"); + if (extraInfo != null) + { + Main.strBuilder.Append(extraInfo); + Main.strBuilder.Append('\n'); + } + if ((int) this.npcShop > 0 || this.reforge && this.toolTip.Prefix(-3)) + { + if (this.toolTip.value > 0) + { + int num1 = this.toolTip.value * (int) this.toolTip.stack; + if (this.reforge) + Main.strBuilder.Append(Lang.inter[46]); + else if (this.toolTip.buy) + { + Main.strBuilder.Append(Lang.tip[50]); + } + else + { + num1 /= 5; + Main.strBuilder.Append(Lang.tip[49]); + } + int num2 = 0; + int num3 = 0; + int num4 = 0; + int num5 = 0; + if (num1 < 1) + num1 = 1; + if (num1 >= 1000000) + { + num2 = num1 / 1000000; + num1 -= num2 * 1000000; + } + if (num1 >= 10000) + { + num3 = num1 / 10000; + num1 -= num3 * 10000; + } + if (num1 >= 100) + { + num4 = num1 / 100; + num1 -= num4 * 100; + } + if (num1 >= 1) + num5 = num1; + if (num2 > 0) + { + Main.strBuilder.Append(""); + Main.strBuilder.Append(ToStringExtensions.ToStringLookup(num2)); + Main.strBuilder.Append(Lang.inter[15]); + Main.strBuilder.Append(""); + } + if (num3 > 0) + { + Main.strBuilder.Append(""); + Main.strBuilder.Append(ToStringExtensions.ToStringLookup(num3)); + Main.strBuilder.Append(Lang.inter[16]); + Main.strBuilder.Append(""); + } + if (num4 > 0) + { + Main.strBuilder.Append(""); + Main.strBuilder.Append(ToStringExtensions.ToStringLookup(num4)); + Main.strBuilder.Append(Lang.inter[17]); + Main.strBuilder.Append(""); + } + if (num5 > 0) + { + Main.strBuilder.Append(""); + Main.strBuilder.Append(ToStringExtensions.ToStringLookup(num5)); + Main.strBuilder.Append(Lang.inter[18]); + Main.strBuilder.Append(""); + } + Main.strBuilder.Append('\n'); + } + else + { + Main.strBuilder.Append(""); + Main.strBuilder.Append(Lang.tip[51]); + Main.strBuilder.Append("\n"); + } + } + if (this.toolTip.material) + { + Main.strBuilder.Append("¤ "); + Main.strBuilder.Append(Lang.tip[36]); + Main.strBuilder.Append('\n'); + } + if ((int) this.toolTip.createWall > 0 || (int) this.toolTip.createTile >= 0) + { + if ((int) this.toolTip.type != 213) + { + Main.strBuilder.Append("¤ "); + Main.strBuilder.Append(Lang.tip[33]); + Main.strBuilder.Append('\n'); + } + } + else if ((int) this.toolTip.ammo > 0) + { + Main.strBuilder.Append("¤ "); + Main.strBuilder.Append(Lang.tip[34]); + Main.strBuilder.Append('\n'); + } + else if (this.toolTip.consumable) + { + Main.strBuilder.Append("¤ "); + Main.strBuilder.Append(Lang.tip[35]); + Main.strBuilder.Append('\n'); + } + if (this.toolTip.social) + { + Main.strBuilder.Append(Lang.tip[0]); + Main.strBuilder.Append('\n'); + Main.strBuilder.Append(Lang.tip[1]); + Main.strBuilder.Append('\n'); + } + else + { + if ((int) this.toolTip.damage > 0) + { + int num1 = (int) this.toolTip.damage; + int num2 = 0; + if (this.toolTip.melee) + { + Main.strBuilder.Append("¤ "); + Main.strBuilder.Append(ToStringExtensions.ToStringLookup((int) ((double) this.player.meleeDamage * (double) num1))); + Main.strBuilder.Append(Lang.tip[2]); + num2 = (int) this.player.meleeCrit; + } + else if (this.toolTip.ranged) + { + Main.strBuilder.Append("¤ "); + Main.strBuilder.Append(ToStringExtensions.ToStringLookup((int) ((double) this.player.rangedDamage * (double) num1))); + Main.strBuilder.Append(Lang.tip[3]); + num2 = (int) this.player.rangedCrit; + } + else if (this.toolTip.magic) + { + Main.strBuilder.Append("¤ "); + Main.strBuilder.Append(ToStringExtensions.ToStringLookup((int) ((double) this.player.magicDamage * (double) num1))); + Main.strBuilder.Append(Lang.tip[4]); + num2 = (int) this.player.magicCrit; + } + int num3 = num2 - (int) this.player.inventory[(int) this.player.selectedItem].crit + (int) this.toolTip.crit; + Main.strBuilder.Append("\n¤ "); + Main.strBuilder.Append(ToStringExtensions.ToStringLookup(num3)); + Main.strBuilder.Append(Lang.tip[5]); + Main.strBuilder.Append('\n'); + if ((int) this.toolTip.useStyle > 0) + { + int index = 13; + if ((int) this.toolTip.useAnimation <= 8) + index = 6; + else if ((int) this.toolTip.useAnimation <= 20) + index = 7; + else if ((int) this.toolTip.useAnimation <= 25) + index = 8; + else if ((int) this.toolTip.useAnimation <= 30) + index = 9; + else if ((int) this.toolTip.useAnimation <= 35) + index = 10; + else if ((int) this.toolTip.useAnimation <= 45) + index = 11; + else if ((int) this.toolTip.useAnimation <= 55) + index = 12; + Main.strBuilder.Append("¤ "); + Main.strBuilder.Append(Lang.tip[index]); + Main.strBuilder.Append('\n'); + } + int index1 = 22; + double num4 = (double) this.toolTip.knockBack; + if (this.player.kbGlove) + num4 *= 1.7; + if (num4 == 0.0) + index1 = 14; + else if (num4 <= 1.5) + index1 = 15; + else if (num4 <= 3.0) + index1 = 16; + else if (num4 <= 4.0) + index1 = 17; + else if (num4 <= 6.0) + index1 = 18; + else if (num4 <= 7.0) + index1 = 19; + else if (num4 <= 9.0) + index1 = 20; + else if (num4 <= 11.0) + index1 = 21; + Main.strBuilder.Append("¤ "); + Main.strBuilder.Append(Lang.tip[index1]); + Main.strBuilder.Append('\n'); + } + if (this.toolTip.isEquipable()) + { + Main.strBuilder.Append("¤ "); + Main.strBuilder.Append(Lang.tip[23]); + Main.strBuilder.Append('\n'); + } + if (this.toolTip.vanity) + { + Main.strBuilder.Append("¤ "); + Main.strBuilder.Append(Lang.tip[24]); + Main.strBuilder.Append('\n'); + } + if ((int) this.toolTip.defense > 0) + { + Main.strBuilder.Append("¤ "); + Main.strBuilder.Append(ToStringExtensions.ToStringLookup(this.toolTip.defense)); + Main.strBuilder.Append(Lang.tip[25]); + Main.strBuilder.Append('\n'); + } + if ((int) this.toolTip.pick > 0) + { + Main.strBuilder.Append("¤ "); + Main.strBuilder.Append(ToStringExtensions.ToStringLookup((int) this.toolTip.pick)); + Main.strBuilder.Append(Lang.tip[26]); + Main.strBuilder.Append('\n'); + } + if ((int) this.toolTip.axe > 0) + { + Main.strBuilder.Append("¤ "); + Main.strBuilder.Append(ToStringExtensions.ToStringLookup((int) this.toolTip.axe * 5)); + Main.strBuilder.Append(Lang.tip[27]); + Main.strBuilder.Append('\n'); + } + if ((int) this.toolTip.hammer > 0) + { + Main.strBuilder.Append("¤ "); + Main.strBuilder.Append(ToStringExtensions.ToStringLookup((int) this.toolTip.hammer)); + Main.strBuilder.Append(Lang.tip[28]); + Main.strBuilder.Append('\n'); + } + if ((int) this.toolTip.healLife > 0) + { + Main.strBuilder.Append("¤ "); + Main.strBuilder.Append(Lang.tip[29]); + Main.strBuilder.Append(ToStringExtensions.ToStringLookup(this.toolTip.healLife)); + Main.strBuilder.Append(Lang.tip[30]); + Main.strBuilder.Append('\n'); + } + if ((int) this.toolTip.healMana > 0) + { + Main.strBuilder.Append("¤ "); + Main.strBuilder.Append(Lang.tip[29]); + Main.strBuilder.Append(ToStringExtensions.ToStringLookup(this.toolTip.healMana)); + Main.strBuilder.Append(Lang.tip[31]); + Main.strBuilder.Append('\n'); + } + if ((int) this.toolTip.mana > 0 && ((int) this.toolTip.type != (int) sbyte.MaxValue || !this.player.spaceGun)) + { + Main.strBuilder.Append("¤ "); + Main.strBuilder.Append(Lang.tip[32]); + Main.strBuilder.Append(ToStringExtensions.ToStringLookup((int) ((double) this.toolTip.mana * (double) this.player.manaCost))); + Main.strBuilder.Append(Lang.tip[31]); + Main.strBuilder.Append('\n'); + } + string str1 = Lang.toolTip((int) this.toolTip.netID); + if (str1 != null) + { + Main.strBuilder.Append("¤ "); + Main.strBuilder.Append(str1); + Main.strBuilder.Append('\n'); + } + string str2 = Lang.toolTip2((int) this.toolTip.netID); + if (str2 != null) + { + Main.strBuilder.Append("¤ "); + Main.strBuilder.Append(str2); + Main.strBuilder.Append('\n'); + } + if ((int) this.toolTip.buffTime > 0) + { + Main.strBuilder.Append("¤ "); + if ((int) this.toolTip.buffTime / 60 >= 60) + { + Main.strBuilder.Append(ToStringExtensions.ToStringLookup((int) Math.Round((double) ((int) this.toolTip.buffTime / 60) / 60.0))); + Main.strBuilder.Append(Lang.tip[37]); + } + else + { + Main.strBuilder.Append(ToStringExtensions.ToStringLookup((int) Math.Round((double) this.toolTip.buffTime / 60.0))); + Main.strBuilder.Append(Lang.tip[38]); + } + Main.strBuilder.Append('\n'); + } + if ((int) this.toolTip.prefix > 0) + { + if ((int) UI.cpItem.netID != (int) this.toolTip.netID) + UI.cpItem.netDefaults((int) this.toolTip.netID, 1); + if ((int) UI.cpItem.damage != (int) this.toolTip.damage) + { + int num = (int) Math.Round((double) ((int) this.toolTip.damage - (int) UI.cpItem.damage) * 100.0 / (double) UI.cpItem.damage); + if (num > 0) + Main.strBuilder.Append("¤ +"); + else + Main.strBuilder.Append("¤ "); + Main.strBuilder.Append(ToStringExtensions.ToStringLookup(num)); + Main.strBuilder.Append(Lang.tip[39]); + Main.strBuilder.Append("\n"); + } + if ((int) UI.cpItem.useAnimation != (int) this.toolTip.useAnimation) + { + int num = (int) Math.Round((double) ((int) this.toolTip.useAnimation - (int) UI.cpItem.useAnimation) * 100.0 / (double) UI.cpItem.useAnimation); + if (num > 0) + Main.strBuilder.Append("¤ +"); + else + Main.strBuilder.Append("¤ "); + Main.strBuilder.Append(ToStringExtensions.ToStringLookup(num)); + Main.strBuilder.Append(Lang.tip[40]); + Main.strBuilder.Append("\n"); + } + if ((int) UI.cpItem.crit != (int) this.toolTip.crit) + { + int num = (int) this.toolTip.crit - (int) UI.cpItem.crit; + if (num > 0) + Main.strBuilder.Append("¤ +"); + else + Main.strBuilder.Append("¤ "); + Main.strBuilder.Append(ToStringExtensions.ToStringLookup(num)); + Main.strBuilder.Append(Lang.tip[41]); + Main.strBuilder.Append("\n"); + } + if ((int) UI.cpItem.mana != (int) this.toolTip.mana) + { + int num = (int) Math.Round((double) ((int) this.toolTip.mana - (int) UI.cpItem.mana) * 100.0 / (double) UI.cpItem.mana); + if (num > 0) + Main.strBuilder.Append("¤ +"); + else + Main.strBuilder.Append("¤ "); + Main.strBuilder.Append(ToStringExtensions.ToStringLookup(num)); + Main.strBuilder.Append(Lang.tip[42]); + Main.strBuilder.Append("\n"); + } + if ((double) UI.cpItem.scale != (double) this.toolTip.scale) + { + int num = (int) Math.Round(((double) this.toolTip.scale - (double) UI.cpItem.scale) * 100.0 / (double) UI.cpItem.scale); + if (num > 0) + Main.strBuilder.Append("¤ +"); + else + Main.strBuilder.Append("¤ "); + Main.strBuilder.Append(ToStringExtensions.ToStringLookup(num)); + Main.strBuilder.Append(Lang.tip[43]); + Main.strBuilder.Append("\n"); + } + if ((double) UI.cpItem.shootSpeed != (double) this.toolTip.shootSpeed) + { + int num = (int) Math.Round(((double) this.toolTip.shootSpeed - (double) UI.cpItem.shootSpeed) * 100.0 / (double) UI.cpItem.shootSpeed); + if (num > 0) + Main.strBuilder.Append("¤ +"); + else + Main.strBuilder.Append("¤ "); + Main.strBuilder.Append(ToStringExtensions.ToStringLookup(num)); + Main.strBuilder.Append(Lang.tip[44]); + Main.strBuilder.Append("\n"); + } + if ((double) UI.cpItem.knockBack != (double) this.toolTip.knockBack) + { + int num = (int) Math.Round(((double) this.toolTip.knockBack - (double) UI.cpItem.knockBack) * 100.0 / (double) UI.cpItem.knockBack); + if (num > 0) + Main.strBuilder.Append("¤ +"); + else + Main.strBuilder.Append("¤ "); + Main.strBuilder.Append(ToStringExtensions.ToStringLookup(num)); + Main.strBuilder.Append(Lang.tip[45]); + Main.strBuilder.Append("\n"); + } + switch (this.toolTip.prefix) + { + case (byte) 62: + Main.strBuilder.Append("¤ +1"); + Main.strBuilder.Append(Lang.tip[25]); + Main.strBuilder.Append("\n"); + break; + case (byte) 63: + Main.strBuilder.Append("¤ +2"); + Main.strBuilder.Append(Lang.tip[25]); + Main.strBuilder.Append("\n"); + break; + case (byte) 64: + Main.strBuilder.Append("¤ +3"); + Main.strBuilder.Append(Lang.tip[25]); + Main.strBuilder.Append("\n"); + break; + case (byte) 65: + Main.strBuilder.Append("¤ +4"); + Main.strBuilder.Append(Lang.tip[25]); + Main.strBuilder.Append("\n"); + break; + case (byte) 66: + Main.strBuilder.Append("¤ +20"); + Main.strBuilder.Append(Lang.tip[31]); + Main.strBuilder.Append("\n"); + break; + case (byte) 67: + Main.strBuilder.Append("¤ +1"); + Main.strBuilder.Append(Lang.tip[5]); + Main.strBuilder.Append("\n"); + break; + case (byte) 68: + Main.strBuilder.Append("¤ +2"); + Main.strBuilder.Append(Lang.tip[5]); + Main.strBuilder.Append("\n"); + break; + case (byte) 69: + Main.strBuilder.Append("¤ +1"); + Main.strBuilder.Append(Lang.tip[39]); + Main.strBuilder.Append("\n"); + break; + case (byte) 70: + Main.strBuilder.Append("¤ +2"); + Main.strBuilder.Append(Lang.tip[39]); + Main.strBuilder.Append("\n"); + break; + case (byte) 71: + Main.strBuilder.Append("¤ +3"); + Main.strBuilder.Append(Lang.tip[39]); + Main.strBuilder.Append("\n"); + break; + case (byte) 72: + Main.strBuilder.Append("¤ +4"); + Main.strBuilder.Append(Lang.tip[39]); + Main.strBuilder.Append("\n"); + break; + case (byte) 73: + Main.strBuilder.Append("¤ +1"); + Main.strBuilder.Append(Lang.tip[46]); + Main.strBuilder.Append("\n"); + break; + case (byte) 74: + Main.strBuilder.Append("¤ +2"); + Main.strBuilder.Append(Lang.tip[46]); + Main.strBuilder.Append("\n"); + break; + case (byte) 75: + Main.strBuilder.Append("¤ +3"); + Main.strBuilder.Append(Lang.tip[46]); + Main.strBuilder.Append("\n"); + break; + case (byte) 76: + Main.strBuilder.Append("¤ +4"); + Main.strBuilder.Append(Lang.tip[46]); + Main.strBuilder.Append("\n"); + break; + case (byte) 77: + Main.strBuilder.Append("¤ +1"); + Main.strBuilder.Append(Lang.tip[47]); + Main.strBuilder.Append("\n"); + break; + case (byte) 78: + Main.strBuilder.Append("¤ +2"); + Main.strBuilder.Append(Lang.tip[47]); + Main.strBuilder.Append("\n"); + break; + case (byte) 79: + Main.strBuilder.Append("¤ +3"); + Main.strBuilder.Append(Lang.tip[47]); + Main.strBuilder.Append("\n"); + break; + case (byte) 80: + Main.strBuilder.Append("¤ +4"); + Main.strBuilder.Append(Lang.tip[47]); + Main.strBuilder.Append("\n"); + break; + } + } + if (this.toolTip.wornArmor && this.player.setBonus != null) + { + Main.strBuilder.Append("¤ "); + Main.strBuilder.Append(Lang.tip[48]); + Main.strBuilder.Append(this.player.setBonus); + Main.strBuilder.Append('\n'); + } + } + text = ((object) Main.strBuilder).ToString(); + } + else + text = extraInfo ?? ""; + if (!(text != UI.toolTipText)) + return; + UI.toolTipText = text; + UI.compiledToolTipText = new CompiledText(text, 322, UI.styleFontSmallOutline, CompiledText.MarkupType.Html); + } + + private void DrawToolTip(int TOOLTIP_X, int TOOLTIP_Y, int TOOLTIP_H) + { + Rectangle rectangle = new Rectangle(TOOLTIP_X, TOOLTIP_Y, 322, TOOLTIP_H); + Main.DrawRect(451, rectangle, (int) byte.MaxValue, 0); + UI.compiledToolTipText.Draw(Main.spriteBatch, rectangle, new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue), new Color((int) byte.MaxValue, 212, 64, (int) byte.MaxValue)); + } + + public void OpenInventory() + { + this.inventoryMode = (byte) 1; + this.oldMouseX = this.mouseX; + this.oldMouseY = this.mouseY; + this.ClearButtonTriggers(); + if ((double) this.worldFadeTarget > 0.5) + this.worldFadeTarget = 0.5f; + this.craftingRecipeX = (sbyte) 0; + this.craftingRecipeY = (sbyte) 0; + this.player.AdjTiles(); + if ((int) this.npcShop > 0) + { + this.restoreOldInventorySection = true; + this.oldInventorySection = this.inventorySection; + this.inventorySection = UI.InventorySection.CHEST; + this.inventoryChestX = (sbyte) 0; + this.inventoryChestY = (sbyte) 0; + } + else if ((int) this.player.chest != -1) + { + this.restoreOldInventorySection = true; + this.oldInventorySection = this.inventorySection; + this.inventorySection = UI.InventorySection.CHEST; + this.inventoryChestX = (sbyte) -1; + this.inventoryChestY = (sbyte) 1; + } + else if (this.reforge || this.craftGuide) + { + this.restoreOldInventorySection = true; + this.oldInventorySection = this.inventorySection; + this.inventorySection = UI.InventorySection.ITEMS; + } + else + { + if (this.inventorySection != UI.InventorySection.CRAFTING) + return; + Recipe.FindRecipes(this, this.craftingCategory, this.craftingShowCraftable); + } + } + + public void CloseInventory() + { + if ((int) this.inventoryMode <= 0) + return; + if (this.restoreOldInventorySection) + { + this.restoreOldInventorySection = false; + this.inventorySection = this.oldInventorySection; + } + this.inventoryMode = (byte) 0; + this.player.chest = (short) -1; + this.player.talkNPC = (short) -1; + this.npcShop = (byte) 0; + this.reforge = false; + this.craftGuide = false; + this.mouseX = this.oldMouseX; + this.mouseY = this.oldMouseY; + this.toolTip.Init(); + this.ClearButtonTriggers(); + if ((double) this.worldFadeTarget == 0.5) + this.worldFadeTarget = 1f; + this.hotbarItemNameTime = 210; + } + + private bool IsInventorySectionAvailable(UI.InventorySection section) + { + bool flag = (int) this.player.chest != -1 || (int) this.npcShop > 0; + switch (section) + { + case UI.InventorySection.CRAFTING: + if ((int) this.mouseItem.type != 0 || this.reforge) + return false; + if (this.craftGuide) + return (int) this.guideItem.type > 0; + else + return true; + case UI.InventorySection.CHEST: + return flag; + case UI.InventorySection.EQUIP: + if ((int) this.mouseItem.type != 0) + return this.mouseItem.isEquipable(); + else + return true; + case UI.InventorySection.HOUSING: + if ((int) this.mouseItem.type == 0 && !this.reforge) + return !this.craftGuide; + else + return false; + default: + return true; + } + } + + private void UpdateInventoryMenu() + { + int num = (int) this.inventorySection; + bool flag1 = true; + bool flag2 = this.IsButtonTriggered(Buttons.RightShoulder); + bool flag3 = this.IsButtonTriggered(Buttons.LeftShoulder); + do + { + if (flag2) + { + if (++num == 5) + num = 0; + } + else if (flag3) + { + if (--num < 0) + num = 4; + } + else if (!flag1) + num = 1; + flag1 = this.IsInventorySectionAvailable((UI.InventorySection) num); + } + while (!flag1); + this.inventorySection = (UI.InventorySection) num; + if (flag3 || flag2) + { + this.toolTip.Init(); + if (this.inventorySection == UI.InventorySection.CRAFTING) + Recipe.FindRecipes(this, this.craftingCategory, this.craftingShowCraftable); + } + if (this.gpState.IsButtonUp(Buttons.RightTrigger) && this.gpState.IsButtonUp(Buttons.A)) + this.stackSplit = (short) 0; + else if ((int) this.stackSplit > 0) + --this.stackSplit; + if ((int) this.stackSplit == 0) + { + this.stackCounter = (short) 0; + this.stackDelay = (short) 7; + } + else + { + if ((int) ++this.stackCounter < 30) + return; + this.stackCounter = (short) 0; + if ((int) --this.stackDelay >= 2) + return; + this.stackDelay = (short) 2; + } + } + + public void PositionInventoryCursor(int dx, int dy) + { + do + { + do + { + do + { + do + { + switch (this.inventorySection - (byte) 1) + { + case UI.InventorySection.CRAFTING: + this.inventoryItemX += (sbyte) dx; + if ((int) this.inventoryItemX < 0) + this.inventoryItemX += (sbyte) 10; + else if ((int) this.inventoryItemX >= 10) + this.inventoryItemX -= (sbyte) 10; + this.inventoryItemY += (sbyte) dy; + if ((int) this.inventoryItemY < 0) + this.inventoryItemY += (sbyte) 7; + else if ((int) this.inventoryItemY >= 7) + this.inventoryItemY -= (sbyte) 7; + if ((int) this.inventoryItemY == 4) + { + if (this.reforge) + { + dy |= 1; + continue; + } + else if ((int) this.inventoryItemX >= 6) + goto label_18; + else + continue; + } + else if ((int) this.inventoryItemY == 5) + { + if (this.reforge) + { + dy |= 1; + continue; + } + else if ((int) this.inventoryItemX >= 6) + goto label_18; + else + continue; + } + else + continue; + case UI.InventorySection.ITEMS: + goto label_19; + case UI.InventorySection.CHEST: + goto label_36; + case UI.InventorySection.EQUIP: + goto label_52; + default: + continue; + } + } + while ((int) this.inventoryItemY == 6 && (int) this.inventoryItemX < 9); +label_18: + this.UpdateInventory(); + return; +label_19: + this.inventoryChestX += (sbyte) dx; + if ((int) this.inventoryChestX < -1) + this.inventoryChestX += (sbyte) 6; + else if ((int) this.inventoryChestX >= 5) + this.inventoryChestX -= (sbyte) 6; + this.inventoryChestY += (sbyte) dy; + if ((int) this.inventoryChestY < 0) + this.inventoryChestY += (sbyte) 4; + else if ((int) this.inventoryChestY >= 4) + this.inventoryChestY -= (sbyte) 4; + if ((int) this.inventoryChestX < 0) + { + if ((int) this.npcShop <= 0 && (int) this.mouseItem.type <= 0) + goto label_31; + } + else + goto label_33; + } + while (dx != 0); + this.inventoryChestX = (sbyte) 0; + continue; +label_31: + if ((int) this.inventoryChestY == 0) + this.inventoryChestY = (sbyte) 1; +label_33: + if ((int) this.npcShop > 0) + { + this.UpdateShop(); + return; + } + else + { + this.UpdateStorage(); + return; + } +label_36: + this.inventoryEquipY += (sbyte) dy; + if ((int) this.inventoryEquipY < 0) + this.inventoryEquipY += (sbyte) 5; + else if ((int) this.inventoryEquipY >= 5) + this.inventoryEquipY -= (sbyte) 5; + this.inventoryEquipX += (sbyte) dx; + if ((int) this.inventoryEquipX < 0) + { + if ((int) this.inventoryEquipY == 0) + { + this.inventoryEquipX = (sbyte) 0; + if ((int) --this.inventoryBuffX < 0) + this.inventoryBuffX = (sbyte) 0; + } + else + this.inventoryEquipX += (sbyte) 5; + } + else if ((int) this.inventoryEquipX >= 5) + { + if ((int) this.inventoryEquipY == 0) + { + this.inventoryEquipX = (sbyte) 4; + if ((int) ++this.inventoryBuffX > 5) + this.inventoryBuffX = (sbyte) 5; + } + else + this.inventoryEquipX -= (sbyte) 5; + } + } + while ((int) this.inventoryEquipX >= 1 && (int) this.inventoryEquipX <= 3 && ((int) this.inventoryEquipY >= 1 && (int) this.inventoryEquipY <= 3)); + this.UpdateEquip(); + return; +label_52: + if (dx != 0) + this.inventoryHousingX ^= (sbyte) 1; + this.inventoryHousingY += (sbyte) dy; + if ((int) this.inventoryHousingY < 0) + this.inventoryHousingY += (sbyte) 6; + else if ((int) this.inventoryHousingY >= 6) + this.inventoryHousingY -= (sbyte) 6; + } + while ((int) this.inventoryHousingX == 1 && (int) this.inventoryHousingY == 5); + this.UpdateHousing(); + } + + private bool UpdateCraftButtonInput(Recipe r) + { + if ((int) this.stackSplit > 1 || !this.gpState.IsButtonDown(Buttons.A) || !this.player.CanCraftRecipe(r)) + return false; + int num1 = (int) this.mouseItem.type; + short num2 = this.mouseItem.stack; + this.mouseItem = r.createItem; + this.mouseItem.Prefix(-1); + this.mouseItem.stack += num2; + this.mouseItem.position.X = (float) (this.player.aabb.X + 10 - ((int) this.mouseItem.width >> 1)); + this.mouseItem.position.Y = (float) (this.player.aabb.Y + 21 - ((int) this.mouseItem.height >> 1)); + this.mouseItemSrcSection = UI.InventorySection.CRAFTING; + this.mouseItemSrcX = (sbyte) -1; + this.mouseItemSrcY = (sbyte) -1; + r.Create(this); + if ((int) this.mouseItem.type > 0 || (int) r.createItem.type > 0) + Main.PlaySound(7); + if (num1 == 0) + { + this.stackSplit = (int) this.stackSplit != 0 ? this.stackDelay : (short) 15; + this.player.GetItem(ref this.mouseItem); + } + return true; + } + + private void PrevCraftingCategory() + { + int num; + if ((num = (int) (this.craftingCategory - (byte) 1)) < 0) + num = 5; + Recipe.FindRecipes(this, (Recipe.Category) num, this.craftingShowCraftable); + this.craftingCategory = (Recipe.Category) num; + this.craftingRecipeX = (sbyte) 0; + this.craftingRecipeY = (sbyte) 0; + this.craftingRecipeScrollX = 0.0f; + this.craftingRecipeScrollY = 0.0f; + } + + private void NextCraftingCategory() + { + int num; + if ((num = (int) (this.craftingCategory + (byte) 1)) == 6) + num = 0; + Recipe.FindRecipes(this, (Recipe.Category) num, this.craftingShowCraftable); + this.craftingCategory = (Recipe.Category) num; + this.craftingRecipeX = (sbyte) 0; + this.craftingRecipeY = (sbyte) 0; + this.craftingRecipeScrollX = 0.0f; + this.craftingRecipeScrollY = 0.0f; + } + + public void PositionCraftingCursor(int dx, int dy) + { + if (this.IsButtonUntriggered(Buttons.X) && (int) this.mouseItem.type == 0) + { + UI ui = this; + int num = !ui.craftingShowCraftable ? 1 : 0; + ui.craftingShowCraftable = num != 0; + this.craftingRecipeX = (sbyte) 0; + this.craftingRecipeScrollX = 0.0f; + this.craftingRecipeScrollY = 0.0f; + Recipe.FindRecipes(this, this.craftingCategory, this.craftingShowCraftable); + } + else if (this.IsButtonUntriggered(Buttons.A)) + { + Recipe.FindRecipes(this, this.craftingCategory, this.craftingShowCraftable); + } + else + { + if (this.UpdateCraftButtonInput(this.craftingRecipe)) + return; + if (this.IsButtonTriggered(Buttons.Y)) + this.craftingSection = this.craftingSection ^ UI.CraftingSection.INGREDIENTS; + else if (this.IsButtonTriggered(Buttons.LeftTrigger)) + this.PrevCraftingCategory(); + else if (this.IsButtonTriggered(Buttons.RightTrigger)) + this.NextCraftingCategory(); + else if (dx != 0 || dy != 0) + { + if ((double) this.craftingRecipeScrollMul >= 0.324999988079071) + this.craftingRecipeScrollMul -= 0.075f; + if (this.craftingSection == UI.CraftingSection.RECIPES) + { + if (dx != 0) + { + if ((double) this.craftingRecipeScrollX != 0.0 || (double) this.craftingRecipeScrollY != 0.0 || this.currentRecipeCategory.Count == 0) + return; + int count = this.currentRecipeCategory[(int) this.craftingRecipeY].recipes.Count; + if (count == 1) + return; + int num = (int) this.craftingRecipeX + dx; + if (num < 0) + num += count; + else if (num >= count) + num -= count; + this.craftingRecipeX = (sbyte) num; + this.craftingRecipeScrollX = (float) dx; + } + else + { + if ((double) this.craftingRecipeScrollX != 0.0 || (double) this.craftingRecipeScrollY != 0.0) + return; + this.craftingRecipeX = (sbyte) 0; + int num = (int) this.craftingRecipeY + dy; + int count = this.currentRecipeCategory.Count; + if (num < 0) + num += count; + else if (num >= count) + num -= count; + else + this.craftingRecipeScrollY = (float) dy; + this.craftingRecipeY = (sbyte) num; + } + } + else + { + int num1 = (int) this.craftingIngredientX + dx; + if (num1 < 0) + num1 += 4; + else if (num1 >= 4) + num1 -= 4; + this.craftingIngredientX = (sbyte) num1; + int num2 = (int) this.craftingIngredientY + dy; + if (num2 < 0) + num2 += 3; + else if (num2 >= 3) + num2 -= 3; + this.craftingIngredientY = (sbyte) num2; + } + } + else + this.craftingRecipeScrollMul = 13.0 / 16.0; + } + } + + public void PositionMapScreenCursor(int dx, int dy) + { + if (this.IsButtonTriggered(Buttons.A)) + { + Main.PlaySound(10); + if (this.mapScreenCursorX == 0) + { + if (this.mapScreenCursorY < 2) + { + this.pvpCooldown = (short) 180; + UI ui = this; + int num = !ui.pvpSelected ? 1 : 0; + ui.pvpSelected = num != 0; + } + else + { + if (!this.CanViewGamerCard() || Netplay.session == null) + return; + GamerCollection allGamers = Netplay.session.AllGamers; + int index = this.mapScreenCursorY - 2; + if (index >= ((ReadOnlyCollection) allGamers).Count) + return; + this.ShowGamerCard((Gamer) ((ReadOnlyCollection) allGamers)[index]); + } + } + else + { + this.teamCooldown = (short) 180; + if (this.mapScreenCursorY == 0) + this.teamSelected = (byte) (this.mapScreenCursorX - 1); + else + this.teamSelected = this.mapScreenCursorX == 1 ? (byte) 0 : (byte) (this.mapScreenCursorX + 1); + } + } + else if (this.IsButtonTriggered(Buttons.X) && this.CanCommunicate()) + { + if (Main.netMode <= 0 || Netplay.gamer == null || Guide.IsVisible) + return; + Main.PlaySound(10); + bool flag; + do + { + flag = false; + try + { + Guide.ShowGameInvite(this.controller, (IEnumerable) null); + } + catch (GuideAlreadyVisibleException ex) + { + Thread.Sleep(32); + flag = true; + } + } + while (flag); + } + else if (this.IsButtonTriggered(Buttons.Y)) + { + if (this.signedInGamer.PartySize <= 1 || Main.netMode <= 0 || (Netplay.gamer == null || this.localGamer == null)) + return; + this.localGamer.SendPartyInvites(); + } + else + { + if (dy != 0) + { + do + { + this.mapScreenCursorY += dy; + } + while (this.mapScreenCursorX == 0 && this.mapScreenCursorY == 1); + dy = this.mapScreenCursorX > 0 ? 2 : 10; + if (this.mapScreenCursorY < 0) + this.mapScreenCursorY += dy; + else if (this.mapScreenCursorY >= dy) + this.mapScreenCursorY -= dy; + } + if (this.mapScreenCursorY >= 2) + return; + this.mapScreenCursorX += dx; + if (this.mapScreenCursorX < 0) + { + this.mapScreenCursorX += 4; + } + else + { + if (this.mapScreenCursorX < 4) + return; + this.mapScreenCursorX -= 4; + } + } + } + + public void FoundPotentialArmor(int itemType) + { + if (!this.TriggerCheckEnabled(Trigger.CollectedAllArmor)) + return; + this.armorFound.Set(itemType, true); + if (!this.armorFound.Get(604) || !this.armorFound.Get(607) || (!this.armorFound.Get(610) || !this.armorFound.Get(605)) || (!this.armorFound.Get(608) || !this.armorFound.Get(611) || (!this.armorFound.Get(606) || !this.armorFound.Get(609))) || (!this.armorFound.Get(612) || !this.armorFound.Get(558) || (!this.armorFound.Get(559) || !this.armorFound.Get(553)) || (!this.armorFound.Get(551) || !this.armorFound.Get(552) || (!this.armorFound.Get(400) || !this.armorFound.Get(402)))) || (!this.armorFound.Get(401) || !this.armorFound.Get(403) || (!this.armorFound.Get(404) || !this.armorFound.Get(376)) || (!this.armorFound.Get(377) || !this.armorFound.Get(378) || (!this.armorFound.Get(379) || !this.armorFound.Get(380))) || (!this.armorFound.Get(371) || !this.armorFound.Get(372) || (!this.armorFound.Get(373) || !this.armorFound.Get(374)) || (!this.armorFound.Get(375) || !this.armorFound.Get(231) || (!this.armorFound.Get(232) || !this.armorFound.Get(233))))) || (!this.armorFound.Get(151) || !this.armorFound.Get(152) || (!this.armorFound.Get(153) || !this.armorFound.Get(228)) || (!this.armorFound.Get(229) || !this.armorFound.Get(230) || (!this.armorFound.Get(102) || !this.armorFound.Get(101))) || (!this.armorFound.Get(100) || !this.armorFound.Get(123) || (!this.armorFound.Get(124) || !this.armorFound.Get(125)) || (!this.armorFound.Get(92) || !this.armorFound.Get(83) || (!this.armorFound.Get(79) || !this.armorFound.Get(91)))) || (!this.armorFound.Get(82) || !this.armorFound.Get(78) || (!this.armorFound.Get(90) || !this.armorFound.Get(81)) || (!this.armorFound.Get(77) || !this.armorFound.Get(89) || (!this.armorFound.Get(80) || !this.armorFound.Get(76))) || (!this.armorFound.Get(88) || !this.armorFound.Get(410) || !this.armorFound.Get(411))))) + return; + this.SetTriggerState(Trigger.CollectedAllArmor); + } + + private void UpdateAlternateGrappleControls() + { + if (this.alternateGrappleControls) + { + this.BTN_JUMP2 = Buttons.LeftTrigger; + this.BTN_GRAPPLE = Buttons.LeftStick; + } + else + { + this.BTN_JUMP2 = Buttons.LeftStick; + this.BTN_GRAPPLE = Buttons.LeftTrigger; + } + } + + public bool IsJumpButtonDown() + { + if (!this.gpState.IsButtonDown(Buttons.A)) + return this.gpState.IsButtonDown(this.BTN_JUMP2); + else + return true; + } + + public bool WasJumpButtonUp() + { + if (this.gpPrevState.IsButtonUp(Buttons.A)) + return this.gpPrevState.IsButtonUp(this.BTN_JUMP2); + else + return false; + } + + public void ShowGamerCard(Gamer gamer) + { + if (gamer == null || Guide.IsVisible) + return; + bool flag; + do + { + flag = false; + try + { + Guide.ShowGamerCard(this.controller, gamer); + } + catch (GuideAlreadyVisibleException ex) + { + Thread.Sleep(32); + flag = true; + } + catch (ObjectDisposedException ex) + { + gamer = Gamer.GetFromGamertag(gamer.Gamertag); + flag = true; + } + catch (Exception ex) + { + } + } + while (flag); + } + + public void SignOut() + { + if (this.signedInGamer == null) + return; + SignedInGamer gamer = this.signedInGamer; + this.signedInGamer = (SignedInGamer) null; + using (GamerCollection.GamerCollectionEnumerator enumerator = Gamer.SignedInGamers.GetEnumerator()) + { + while (enumerator.MoveNext()) + { + SignedInGamer current = enumerator.Current; + if (current.PlayerIndex == this.controller && current.Gamertag == gamer.Gamertag) + this.signedInGamer = current; + } + } + if (this.signedInGamer != null) + { + if (Main.netMode > 0 && !this.HasOnline()) + { + UI.Error(Lang.menu[5], Lang.inter[36], false); + UI.main.ExitGame(); + } + else + { + if (!Main.isGameStarted) + return; + this.wasRemovedFromSessionWithoutOurConsent = true; + if (this != UI.main) + return; + for (int index = 0; index < ((ReadOnlyCollection) Netplay.session.LocalGamers).Count; ++index) + { + SignedInGamer signedInGamer = ((ReadOnlyCollection) Netplay.session.LocalGamers)[index].SignedInGamer; + Main.ui[(int) signedInGamer.PlayerIndex].wasRemovedFromSessionWithoutOurConsent = true; + } + } + } + else + { + this.wasRemovedFromSessionWithoutOurConsent = false; + MessageBox.RemoveMessagesFor(this.controller); + UI.CancelInvite(gamer); + this.blacklist.Clear(); + if (this == UI.main) + { + Netplay.StopFindingSessions(); + if (Main.worldGenThread != null) + { + Main.worldGenThread.Abort(); + Main.worldGenThread = (Thread) null; + WorldGen.gen = false; + } + if (this.playerStorage != null) + { + ((Collection) UI.theGame.Components).Remove((IGameComponent) this.playerStorage); + this.playerStorage.Dispose(); + this.playerStorage = (StorageDeviceManager) null; + } + if (UI.numActiveViews == 1 || Main.isGameStarted) + { + if (Main.isGameStarted) + this.ExitGame(); + this.SetMenu(MenuMode.WELCOME, false, true); + return; + } + } + this.Exit(); + } + } + + public bool TestStorageSpace(string container, string destinationPath, int writeSize) + { + using (StorageContainer storageContainer = this.OpenPlayerStorage(container)) + { + long freeSpace = storageContainer.StorageDevice.FreeSpace; + if (freeSpace >= (long) writeSize) + return true; + if (storageContainer.FileExists(destinationPath)) + { + using (Stream stream = storageContainer.OpenFile(destinationPath, FileMode.Open, FileAccess.Read)) + freeSpace += stream.Length; + if (freeSpace >= (long) writeSize) + { + storageContainer.DeleteFile(destinationPath); + return true; + } + } + } + MessageBox.Show(this.controller, Lang.menu[5], Lang.inter[70], new string[1] + { + Lang.menu[90] + }, 1 != 0); + return false; + } + + public void WriteError() + { + MessageBox.Show(this.controller, Lang.menu[5], Lang.gen[54], new string[1] + { + Lang.menu[90] + }, 1 != 0); + } + + public void ReadError() + { + MessageBox.Show(this.controller, Lang.menu[9], Lang.gen[53], new string[1] + { + Lang.menu[90] + }, 1 != 0); + } + + public void CheckHDTV() + { + if (Main.isHDTV) + return; + Main.isHDTV = true; + MessageBox.Show(this.controller, Lang.menu[3], Lang.inter[71], new string[1] + { + Lang.menu[90] + }, 1 != 0); + } + + public bool CheckBlacklist() + { + ulong worldId = Main.GetWorldId(); + for (int index = this.blacklist.Count - 1; index >= 0; --index) + { + if ((long) this.blacklist[index] == (long) worldId) + { + if (this.menuType != MenuType.MAIN) + this.menuType = MenuType.PAUSE; + string[] options = new string[2] + { + this.menuType != MenuType.MAIN ? Lang.menu[100] : Lang.menu[15], + Lang.inter[75] + }; + MessageBox.Show(this.controller, Lang.menu[3], Lang.inter[74], options, false); + this.SetMenu(MenuMode.BLACKLIST_REMOVE, true, false); + return true; + } + } + return false; + } + + public void CheckUserGeneratedContent() + { + if (UI.IsUserGeneratedContentAllowed()) + return; + this.menuType = MenuType.PAUSE; + string[] options; + if (this.autoSave || !UI.IsStorageEnabledForAnyPlayer()) + options = new string[1] + { + Lang.menu[15] + }; + else + options = new string[2] + { + Lang.inter[2], + Lang.inter[1] + }; + MessageBox.Show(this.controller, Lang.menu[3], Lang.inter[79], options, false); + this.SetMenu(MenuMode.EXIT_UGC_BLOCKED, true, false); + } + + public enum InventorySection : byte + { + CRAFTING, + ITEMS, + CHEST, + EQUIP, + HOUSING, + NUM_SECTIONS, + } + + public enum CraftingSection : byte + { + RECIPES, + INGREDIENTS, + } + + private enum StackType + { + NONE, + INGREDIENT, + INVENTORY, + HOTBAR, + } + } +} diff --git a/Terraria/UserString.cs b/Terraria/UserString.cs new file mode 100644 index 0000000..0b83dd8 --- /dev/null +++ b/Terraria/UserString.cs @@ -0,0 +1,99 @@ +// Type: Terraria.UserString +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework.GamerServices; +using System; +using System.IO; + +namespace Terraria +{ + public sealed class UserString + { + public string text; + public bool isVerified; + public bool isCensored; + private IAsyncResult asyncResult; + + public UserString(string s, bool verified) + { + this.text = s; + this.isVerified = verified; + this.isCensored = false; + this.asyncResult = (IAsyncResult) null; + } + + public UserString(BinaryReader input) + { + int num = (int) input.ReadByte(); + this.isVerified = (num & 1) != 0; + this.isCensored = (num & 2) != 0; + this.text = !this.isCensored ? input.ReadString() : (string) null; + this.asyncResult = (IAsyncResult) null; + } + + public static implicit operator UserString(string s) + { + return new UserString(s, true); + } + + public void Write(BinaryWriter output) + { + int num = this.isVerified ? 1 : 0; + if (this.isCensored) + num |= 2; + output.Write((byte) num); + if (this.isCensored) + return; + output.Write(this.text); + } + + public void SetUserString(string s) + { + this.text = s; + this.isVerified = s.Length == 0; + this.isCensored = false; + } + + public void SetSystemString(string s) + { + this.text = s; + this.isVerified = true; + this.isCensored = false; + } + + public string GetString() + { + if (!this.isVerified && this.asyncResult == null && Main.netMode > 0) + this.asyncResult = StringChecker.BeginCheckString(this.text, new AsyncCallback(this.OnCheckStringDone), (object) null); + if (this.asyncResult != null) + return Lang.inter[76]; + if (!this.isCensored) + return this.text; + else + return Lang.inter[77]; + } + + public bool IsEditable() + { + if (!this.isVerified) + return Main.netMode == 0; + else + return true; + } + + private void OnCheckStringDone(object s) + { + try + { + this.isCensored = !StringChecker.EndCheckString(this.asyncResult); + this.isVerified = true; + } + catch + { + } + this.asyncResult = (IAsyncResult) null; + } + } +} diff --git a/Terraria/Vector2i.cs b/Terraria/Vector2i.cs new file mode 100644 index 0000000..25a3401 --- /dev/null +++ b/Terraria/Vector2i.cs @@ -0,0 +1,19 @@ +// Type: Terraria.Vector2i +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +namespace Terraria +{ + public struct Vector2i + { + public int X; + public int Y; + + public Vector2i(int x, int y) + { + this.X = (int) (short) x; + this.Y = (int) (short) y; + } + } +} diff --git a/Terraria/WorldGen.cs b/Terraria/WorldGen.cs new file mode 100644 index 0000000..5268c12 --- /dev/null +++ b/Terraria/WorldGen.cs @@ -0,0 +1,19348 @@ +// Type: Terraria.WorldGen +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Storage; +using System; +using System.Collections.Generic; +using System.IO; +using System.Threading; +using Terraria.Achievements; + +namespace Terraria +{ + internal static class WorldGen + { + public static int numMechs = 0; + public static Mech[] mech = new Mech[1000]; + public static int numWire = 0; + public static Location[] wire = new Location[1000]; + public static int numNoWire = 0; + public static Location[] noWire = new Location[1000]; + public static int numInPump = 0; + public static Location[] inPump = new Location[20]; + public static int numOutPump = 0; + public static Location[] outPump = new Location[20]; + public static int totalEvil = 0; + public static int totalGood = 0; + public static int totalSolid = 0; + public static int totalEvil2 = 0; + public static int totalGood2 = 0; + public static int totalSolid2 = 0; + public static byte tEvil = (byte) 0; + public static byte tGood = (byte) 0; + public static int totalX = 0; + public static int totalD = 0; + private static int currentSandBuffer = 0; + private static WorldGen.FallingSandBuffer[] sandBuffer = new WorldGen.FallingSandBuffer[2]; + public static volatile bool hardLock = false; + public static volatile bool saveLock = false; + private static object padlock = new object(); + public static uint woodSpawned = 0U; + public static int shadowOrbCount = 0; + public static int altarCount = 0; + public static bool spawnEye = false; + public static bool gen = false; + public static bool shadowOrbSmashed = false; + public static bool spawnMeteor = false; + private static short lastMaxTilesX = (short) 0; + private static short lastMaxTilesY = (short) 0; + public static Time tempTime = new Time(); + private static bool stopDrops = false; + private static bool mudWall = false; + private static int grassSpread = 0; + public static bool noLiquidCheck = false; + public static bool destroyObject = false; + public static FastRandom genRand = new FastRandom(); + public static int spawnDelay = 0; + public static int spawnNPC = 0; + public static Location[] room = new Location[1900]; + public static bool[] houseTile = new bool[150]; + public static int bestX = 0; + public static int bestY = 0; + public static int hiScore = 0; + public static Vector2i lastDungeonHall = new Vector2i(); + public static int numDRooms = 0; + private static WorldGen.DRoom[] dRoom = new WorldGen.DRoom[100]; + private static WorldGen.DDoor[] dDoor = new WorldGen.DDoor[300]; + private static Location[] DPlat = new Location[300]; + private static int numJChests = 0; + private static Location[] JChest = new Location[10]; + public static int dEnteranceX = 0; + public static bool dSurface = false; + private static int numIslandHouses = 0; + private static int houseCount = 0; + private static Location[] fih = new Location[300]; + private static int numMCaves = 0; + private static Location[] mCave = new Location[300]; + private static int JungleX = 0; + private static int hellChest = 0; + private static bool tileFrameRecursion = true; + public const int MAX_MECH = 1000; + public const int MAX_WIRE = 1000; + public const int MAX_PUMP = 20; + private const float CorruptionFactorForAchievement = 50f; + private const float HallowedFactorForAchievement = 50f; + private const int SAND_BUFFER_SIZE = 64; + public const int MAX_ROOM_RECURSION = 400; + public const int MAX_ROOM_TILES = 1900; + public const int MIN_ROOM_TILES = 60; + public const int MAX_DROOMS = 100; + private const int MAX_DDOORS = 300; + private const int MAX_DPLATS = 300; + private const int MIN_JCHEST = 6; + private const int MAX_JCHEST = 9; + private const double JCHEST_WORLD_SIZE_MODIFIER = 1.2; + public static int lavaLine; + public static int waterLine; + public static int numRoomTiles; + public static int roomX1; + public static int roomX2; + public static int roomY1; + public static int roomY2; + public static bool canSpawn; + public static int dungeonX; + public static int dungeonY; + private static int numDDoors; + private static int numDPlats; + private static double dxStrength1; + private static double dyStrength1; + private static double dxStrength2; + private static double dyStrength2; + private static int dMinX; + private static int dMaxX; + private static int dMinY; + private static int dMaxY; + private static bool roomTorch; + private static bool roomDoor; + public static bool roomChair; + private static bool roomTable; + private static bool roomOccupied; + private static bool roomEvil; + private static int checkRoomDepth; + private static bool mergeUp; + private static bool mergeDown; + private static bool mergeLeft; + private static bool mergeRight; + private static bool mergeUp2; + private static bool mergeDown2; + private static bool mergeLeft2; + private static bool mergeRight2; + + static WorldGen() + { + } + + public static unsafe void UpdateSand() + { + WorldGen.FallingSandBuffer fallingSandBuffer = WorldGen.sandBuffer[WorldGen.currentSandBuffer]; + int num = fallingSandBuffer.count; + if (num <= 0) + return; + fallingSandBuffer.count = 0; + WorldGen.currentSandBuffer ^= 1; + int index1 = 0; + do + { + int index2 = (int) fallingSandBuffer.buffer[index1].X; + int index3 = (int) fallingSandBuffer.buffer[index1].Y; + fixed (Tile* tilePtr = &Main.tile[index2, index3]) + { + tilePtr->active = (byte) 0; + int Type; + switch (tilePtr->type) + { + case (byte) 112: + Type = 56; + break; + case (byte) 116: + Type = 67; + break; + case (byte) 123: + Type = 71; + break; + default: + Type = 31; + break; + } + int index4 = Projectile.NewProjectile((float) (index2 * 16 + 8), (float) (index3 * 16 + 8), 0.0f, 2.5f, Type, 10, 0.0f, 8, true); + if (index4 < 0) + break; + Main.projectile[index4].velocity.Y = 0.5f; + Main.projectile[index4].position.Y += 2f; + Main.projectile[index4].aabb.Y += 2; + WorldGen.tileFrameRecursion = false; + WorldGen.TileFrame(index2, index3 - 1, 0); + WorldGen.TileFrame(index2 - 1, index3, 0); + WorldGen.TileFrame(index2 + 1, index3, 0); + WorldGen.tileFrameRecursion = true; + NetMessage.SendTile(index2, index3); + } + } + while (++index1 < num); + } + + public static bool MoveNPC(int x, int y, int n) + { + if (!WorldGen.StartRoomCheck(x, y)) + { + Main.NewText(Lang.inter[40], (int) byte.MaxValue, 240, 20); + return false; + } + else if (!WorldGen.RoomNeeds()) + { + if (Lang.lang <= 1) + { + int index1 = 0; + string[] strArray = new string[4]; + if (!WorldGen.roomTorch) + { + strArray[index1] = "a light source"; + ++index1; + } + if (!WorldGen.roomDoor) + { + strArray[index1] = "a door"; + ++index1; + } + if (!WorldGen.roomTable) + { + strArray[index1] = "a table"; + ++index1; + } + if (!WorldGen.roomChair) + { + strArray[index1] = "a chair"; + ++index1; + } + string str = ""; + for (int index2 = 0; index2 < index1; ++index2) + { + if (index1 == 2 && index2 == 1) + str = str + " and "; + else if (index2 > 0 && index2 != index1 - 1) + str = str + ", and "; + else if (index2 > 0) + str = str + ", "; + str = str + strArray[index2]; + } + Main.NewText("This housing is missing " + str + ".", (int) byte.MaxValue, 240, 20); + } + else + Main.NewText(Lang.inter[8], (int) byte.MaxValue, 240, 20); + return false; + } + else + { + WorldGen.ScoreRoom(-1); + if (WorldGen.hiScore > 0) + return true; + if (WorldGen.roomOccupied) + Main.NewText(Lang.inter[41], (int) byte.MaxValue, 240, 20); + else if (WorldGen.roomEvil) + Main.NewText(Lang.inter[42], (int) byte.MaxValue, 240, 20); + else + Main.NewText(Lang.inter[8], (int) byte.MaxValue, 240, 20); + return false; + } + } + + public static void moveRoom(int x, int y, int n) + { + if (Main.netMode >= 1) + { + NetMessage.CreateMessage4(60, n, x, y, 1); + NetMessage.SendMessage(); + } + else + { + WorldGen.spawnNPC = (int) Main.npc[n].type; + Main.npc[n].homeless = true; + WorldGen.SpawnNPC(x, y); + } + } + + public static void kickOut(int n) + { + if (Main.netMode >= 1) + { + NetMessage.CreateMessage4(60, n, 0, 0, 0); + NetMessage.SendMessage(); + } + else + Main.npc[n].homeless = true; + } + + public static void SpawnNPC(int x, int y) + { + if (Main.wallHouse[(int) Main.tile[x, y].wall]) + WorldGen.canSpawn = true; + else if (!WorldGen.canSpawn) + return; + if (!WorldGen.StartRoomCheck(x, y) || !WorldGen.RoomNeeds()) + return; + WorldGen.ScoreRoom(-1); + if (WorldGen.hiScore <= 0) + return; + int index1 = -1; + for (int index2 = 0; index2 < 196; ++index2) + { + if ((int) Main.npc[index2].active != 0 && Main.npc[index2].homeless && (int) Main.npc[index2].type == WorldGen.spawnNPC) + { + index1 = index2; + break; + } + } + if (index1 < 0) + { + int index2 = WorldGen.bestX; + int index3 = WorldGen.bestY; + bool flag = false; + if (!flag) + { + flag = true; + Rectangle rectangle = new Rectangle(index2 * 16 + 8 - 960 - 62, index3 * 16 + 8 - 540 - 34, 2044, 1148); + for (int index4 = 0; index4 < 8; ++index4) + { + if ((int) Main.player[index4].active != 0 && Main.player[index4].aabb.Intersects(rectangle)) + { + flag = false; + break; + } + } + } + if (!flag && index3 <= Main.worldSurface) + { + for (int index4 = 1; index4 < 500; ++index4) + { + for (int index5 = 0; index5 < 2; ++index5) + { + index2 = index5 != 0 ? WorldGen.bestX - index4 : WorldGen.bestX + index4; + if (index2 > 10 && index2 < (int) Main.maxTilesX - 10) + { + int num1 = WorldGen.bestY - index4; + double num2 = (double) (WorldGen.bestY + index4); + if (num1 < 10) + num1 = 10; + if (num2 > (double) Main.worldSurface) + num2 = (double) Main.worldSurface; + for (int index6 = num1; (double) index6 < num2; ++index6) + { + index3 = index6; + if ((int) Main.tile[index2, index3].active != 0 && Main.tileSolid[(int) Main.tile[index2, index3].type]) + { + if (!Collision.SolidTiles(index2 - 1, index2 + 1, index3 - 3, index3 - 1)) + { + flag = true; + Rectangle rectangle = new Rectangle(index2 * 16 + 8 - 960 - 62, index3 * 16 + 8 - 540 - 34, 2044, 1148); + for (int index7 = 0; index7 < 8; ++index7) + { + if ((int) Main.player[index7].active != 0 && Main.player[index7].aabb.Intersects(rectangle)) + { + flag = false; + break; + } + } + break; + } + else + break; + } + } + } + if (flag) + break; + } + if (flag) + break; + } + } + int index8 = NPC.NewNPC(index2 * 16, index3 * 16, WorldGen.spawnNPC, 1); + Main.npc[index8].homeTileX = (short) WorldGen.bestX; + Main.npc[index8].homeTileY = (short) WorldGen.bestY; + if (index2 < WorldGen.bestX) + Main.npc[index8].direction = (sbyte) 1; + else if (index2 > WorldGen.bestX) + Main.npc[index8].direction = (sbyte) -1; + Main.npc[index8].netUpdate = true; + string prefix; + if (Main.npc[index8].hasName()) + { + prefix = Main.npc[index8].getName(); + if (Lang.lang <= 1) + prefix = prefix + " the " + Main.npc[index8].name; + } + else + prefix = Main.npc[index8].displayName; + NetMessage.SendText(prefix, 18, 50, 125, (int) byte.MaxValue, -1); + } + else + { + Main.npc[index1].homeTileX = (short) WorldGen.bestX; + Main.npc[index1].homeTileY = (short) WorldGen.bestY; + Main.npc[index1].homeless = false; + } + if (!Main.IsTutorial()) + { + if (WorldGen.spawnNPC == 22) + UI.SetTriggerStateForAll(Trigger.HouseGuide); + WorldGen.CheckHousedNPCs(); + } + WorldGen.spawnNPC = 0; + } + + public static void CheckHousedNPCs() + { + bool flag = true; + int num = 0; + for (int index = 0; index < 196; ++index) + { + NPC npc = Main.npc[index]; + if ((int) npc.active != 0 && npc.townNPC && ((int) npc.type != 37 && (int) npc.type != 142)) + { + flag = flag && !npc.homeless; + ++num; + } + } + if (!flag || num != 10) + return; + UI.SetTriggerStateForAll(Trigger.HousedAllNPCs); + } + + public static bool RoomNeeds() + { + WorldGen.roomChair = false; + WorldGen.roomDoor = false; + WorldGen.roomTable = false; + WorldGen.roomTorch = false; + if (WorldGen.houseTile[15] || WorldGen.houseTile[79] || (WorldGen.houseTile[89] || WorldGen.houseTile[102])) + WorldGen.roomChair = true; + if (WorldGen.houseTile[14] || WorldGen.houseTile[18] || (WorldGen.houseTile[87] || WorldGen.houseTile[88]) || (WorldGen.houseTile[90] || WorldGen.houseTile[101])) + WorldGen.roomTable = true; + if (WorldGen.houseTile[4] || WorldGen.houseTile[33] || (WorldGen.houseTile[34] || WorldGen.houseTile[35]) || (WorldGen.houseTile[36] || WorldGen.houseTile[42] || (WorldGen.houseTile[49] || WorldGen.houseTile[93])) || (WorldGen.houseTile[95] || WorldGen.houseTile[98] || (WorldGen.houseTile[100] || WorldGen.houseTile[149]))) + WorldGen.roomTorch = true; + if (WorldGen.houseTile[10] || WorldGen.houseTile[11] || WorldGen.houseTile[19]) + WorldGen.roomDoor = true; + WorldGen.canSpawn = WorldGen.roomChair && WorldGen.roomTable && (WorldGen.roomDoor && WorldGen.roomTorch); + return WorldGen.canSpawn; + } + + public static void QuickFindHome(int npc) + { + if ((int) Main.npc[npc].homeTileX <= 10 || (int) Main.npc[npc].homeTileY <= 10 || ((int) Main.npc[npc].homeTileX >= (int) Main.maxTilesX - 10 || (int) Main.npc[npc].homeTileY >= (int) Main.maxTilesY)) + return; + WorldGen.canSpawn = false; + WorldGen.StartRoomCheck((int) Main.npc[npc].homeTileX, (int) Main.npc[npc].homeTileY - 1); + if (!WorldGen.canSpawn) + { + for (int x = (int) Main.npc[npc].homeTileX - 1; x < (int) Main.npc[npc].homeTileX + 2; ++x) + { + int y = (int) Main.npc[npc].homeTileY - 1; + while (y < (int) Main.npc[npc].homeTileY + 2 && !WorldGen.StartRoomCheck(x, y)) + ++y; + } + } + if (!WorldGen.canSpawn) + { + int num = 10; + int x = (int) Main.npc[npc].homeTileX - num; + while (x <= (int) Main.npc[npc].homeTileX + num) + { + int y = (int) Main.npc[npc].homeTileY - num; + while (y <= (int) Main.npc[npc].homeTileY + num && !WorldGen.StartRoomCheck(x, y)) + y += 2; + x += 2; + } + } + if (WorldGen.canSpawn) + { + WorldGen.RoomNeeds(); + if (WorldGen.canSpawn) + WorldGen.ScoreRoom(npc); + if (WorldGen.canSpawn && WorldGen.hiScore > 0) + { + Main.npc[npc].homeTileX = (short) WorldGen.bestX; + Main.npc[npc].homeTileY = (short) WorldGen.bestY; + Main.npc[npc].homeless = false; + WorldGen.canSpawn = false; + } + else + Main.npc[npc].homeless = true; + } + else + Main.npc[npc].homeless = true; + } + + public static void ScoreRoom(int ignoreNPC = -1) + { + WorldGen.roomOccupied = false; + WorldGen.roomEvil = false; + for (int index1 = 0; index1 < 196; ++index1) + { + if ((int) Main.npc[index1].active != 0 && Main.npc[index1].townNPC && (ignoreNPC != index1 && !Main.npc[index1].homeless)) + { + for (int index2 = 0; index2 < WorldGen.numRoomTiles; ++index2) + { + if ((int) Main.npc[index1].homeTileX == (int) WorldGen.room[index2].X && (int) Main.npc[index1].homeTileY == (int) WorldGen.room[index2].Y) + { + bool flag = false; + for (int index3 = 0; index3 < WorldGen.numRoomTiles; ++index3) + { + if ((int) Main.npc[index1].homeTileX == (int) WorldGen.room[index3].X && (int) Main.npc[index1].homeTileY - 1 == (int) WorldGen.room[index3].Y) + { + flag = true; + break; + } + } + if (flag) + { + WorldGen.roomOccupied = true; + WorldGen.hiScore = -1; + return; + } + } + } + } + } + WorldGen.hiScore = 0; + int num1 = 0; + int num2 = WorldGen.roomX1 - 3 - 1 - 34; + int num3 = WorldGen.roomX2 + 3 + 1 + 34; + int num4 = WorldGen.roomY1 - 2 - 1 - 34; + int num5 = WorldGen.roomY2 + 2 + 1 + 34; + if (num2 < 0) + num2 = 0; + if (num3 >= (int) Main.maxTilesX) + num3 = (int) Main.maxTilesX - 1; + if (num4 < 0) + num4 = 0; + if (num5 > (int) Main.maxTilesX) + num5 = (int) Main.maxTilesX; + for (int index1 = num2 + 1; index1 < num3; ++index1) + { + for (int index2 = num4 + 2; index2 < num5 + 2; ++index2) + { + if ((int) Main.tile[index1, index2].active != 0) + { + if ((int) Main.tile[index1, index2].type == 23 || (int) Main.tile[index1, index2].type == 24 || ((int) Main.tile[index1, index2].type == 25 || (int) Main.tile[index1, index2].type == 32) || (int) Main.tile[index1, index2].type == 112) + ++num1; + else if ((int) Main.tile[index1, index2].type == 27) + num1 -= 5; + else if ((int) Main.tile[index1, index2].type == 109 || (int) Main.tile[index1, index2].type == 110 || ((int) Main.tile[index1, index2].type == 113 || (int) Main.tile[index1, index2].type == 116)) + --num1; + } + } + } + if (num1 < 50) + num1 = 0; + int num6 = -num1; + if (num6 <= -250) + { + WorldGen.hiScore = num6; + WorldGen.roomEvil = true; + } + else + { + int num7 = WorldGen.roomX1; + int num8 = WorldGen.roomX2; + int num9 = WorldGen.roomY1; + int num10 = WorldGen.roomY2; + for (int index1 = num7 + 1; index1 < num8; ++index1) + { + for (int index2 = num9 + 2; index2 < num10 + 2; ++index2) + { + if ((int) Main.tile[index1, index2].active != 0) + { + int num11 = num6; + if (Main.tileSolidNotSolidTop[(int) Main.tile[index1, index2].type] && !Collision.SolidTiles(index1 - 1, index1 + 1, index2 - 3, index2 - 1) && ((int) Main.tile[index1 - 1, index2].active != 0 && Main.tileSolid[(int) Main.tile[index1 - 1, index2].type]) && ((int) Main.tile[index1 + 1, index2].active != 0 && Main.tileSolid[(int) Main.tile[index1 + 1, index2].type])) + { + for (int index3 = index1 - 2; index3 < index1 + 3; ++index3) + { + for (int index4 = index2 - 4; index4 < index2; ++index4) + { + if ((int) Main.tile[index3, index4].active != 0) + { + if (index3 == index1) + num11 -= 15; + else if ((int) Main.tile[index3, index4].type == 10 || (int) Main.tile[index3, index4].type == 11) + num11 -= 20; + else if (Main.tileSolid[(int) Main.tile[index3, index4].type]) + num11 -= 5; + else + num11 += 5; + } + } + } + if (num11 > WorldGen.hiScore) + { + bool flag = false; + for (int index3 = 0; index3 < WorldGen.numRoomTiles; ++index3) + { + if ((int) WorldGen.room[index3].X == index1 && (int) WorldGen.room[index3].Y == index2) + { + flag = true; + break; + } + } + if (flag) + { + WorldGen.hiScore = num11; + WorldGen.bestX = index1; + WorldGen.bestY = index2; + } + } + } + } + } + } + } + } + + public static bool StartRoomCheck(int x, int y) + { + WorldGen.roomX1 = x; + WorldGen.roomX2 = x; + WorldGen.roomY1 = y; + WorldGen.roomY2 = y; + WorldGen.numRoomTiles = 0; + for (int index = 0; index < 150; ++index) + WorldGen.houseTile[index] = false; + WorldGen.canSpawn = true; + if ((int) Main.tile[x, y].active != 0 && Main.tileSolid[(int) Main.tile[x, y].type]) + { + WorldGen.canSpawn = false; + } + else + { + WorldGen.checkRoomDepth = 0; + WorldGen.CheckRoom(x, y); + if (WorldGen.numRoomTiles < 60) + WorldGen.canSpawn = false; + } + return WorldGen.canSpawn; + } + + public static void CheckRoom(int x, int y) + { + if (x < 10 || y < 10 || (x >= (int) Main.maxTilesX - 10 || y >= (int) WorldGen.lastMaxTilesY - 10)) + { + WorldGen.canSpawn = false; + } + else + { + for (int index = 0; index < WorldGen.numRoomTiles; ++index) + { + if ((int) WorldGen.room[index].X == x && (int) WorldGen.room[index].Y == y) + return; + } + WorldGen.room[WorldGen.numRoomTiles].X = (short) x; + WorldGen.room[WorldGen.numRoomTiles].Y = (short) y; + if (++WorldGen.numRoomTiles >= 1900) + WorldGen.canSpawn = false; + else if (++WorldGen.checkRoomDepth >= 400) + { + WorldGen.canSpawn = false; + } + else + { + if ((int) Main.tile[x, y].active != 0) + { + WorldGen.houseTile[(int) Main.tile[x, y].type] = true; + if (Main.tileSolid[(int) Main.tile[x, y].type] || (int) Main.tile[x, y].type == 11) + { + --WorldGen.checkRoomDepth; + return; + } + } + if (x < WorldGen.roomX1) + WorldGen.roomX1 = x; + if (x > WorldGen.roomX2) + WorldGen.roomX2 = x; + if (y < WorldGen.roomY1) + WorldGen.roomY1 = y; + if (y > WorldGen.roomY2) + WorldGen.roomY2 = y; + int num = 0; + for (int index = -2; index < 3; ++index) + { + if (Main.wallHouse[(int) Main.tile[x + index, y].wall]) + num |= 1; + else if ((int) Main.tile[x + index, y].active != 0 && (Main.tileSolid[(int) Main.tile[x + index, y].type] || (int) Main.tile[x + index, y].type == 11)) + num |= 1; + if (Main.wallHouse[(int) Main.tile[x, y + index].wall]) + num |= 2; + else if ((int) Main.tile[x, y + index].active != 0 && (Main.tileSolid[(int) Main.tile[x, y + index].type] || (int) Main.tile[x, y + index].type == 11)) + num |= 2; + } + if (num != 3) + { + WorldGen.canSpawn = false; + } + else + { + WorldGen.CheckRoom(x, y - 1); + if (!WorldGen.canSpawn) + return; + WorldGen.CheckRoom(x, y + 1); + if (!WorldGen.canSpawn) + return; + WorldGen.CheckRoom(x - 1, y - 1); + if (!WorldGen.canSpawn) + return; + WorldGen.CheckRoom(x - 1, y); + if (!WorldGen.canSpawn) + return; + WorldGen.CheckRoom(x - 1, y + 1); + if (!WorldGen.canSpawn) + return; + WorldGen.CheckRoom(x + 1, y - 1); + if (!WorldGen.canSpawn) + return; + WorldGen.CheckRoom(x + 1, y); + if (!WorldGen.canSpawn) + return; + WorldGen.CheckRoom(x + 1, y + 1); + --WorldGen.checkRoomDepth; + } + } + } + } + + public static bool StartSpaceCheck(int x, int y) + { + WorldGen.roomX1 = x; + WorldGen.roomX2 = x; + WorldGen.roomY1 = y; + WorldGen.roomY2 = y; + WorldGen.numRoomTiles = 0; + for (int index = 0; index < 150; ++index) + WorldGen.houseTile[index] = false; + WorldGen.canSpawn = true; + if ((int) Main.tile[x, y].active != 0 && Main.tileSolid[(int) Main.tile[x, y].type]) + { + WorldGen.canSpawn = false; + } + else + { + WorldGen.checkRoomDepth = 0; + WorldGen.CheckSpace(x, y); + if (WorldGen.numRoomTiles < 60) + WorldGen.canSpawn = false; + } + return WorldGen.canSpawn; + } + + public static void CheckSpace(int x, int y) + { + if (x < 10 || y < 10 || (x >= (int) Main.maxTilesX - 10 || y >= (int) WorldGen.lastMaxTilesY - 10)) + { + WorldGen.canSpawn = false; + } + else + { + for (int index = 0; index < WorldGen.numRoomTiles; ++index) + { + if ((int) WorldGen.room[index].X == x && (int) WorldGen.room[index].Y == y) + return; + } + WorldGen.room[WorldGen.numRoomTiles].X = (short) x; + WorldGen.room[WorldGen.numRoomTiles].Y = (short) y; + if (++WorldGen.numRoomTiles >= 1900) + WorldGen.canSpawn = false; + else if (++WorldGen.checkRoomDepth >= 400) + { + WorldGen.canSpawn = false; + } + else + { + if ((int) Main.tile[x, y].active != 0) + { + WorldGen.houseTile[(int) Main.tile[x, y].type] = true; + if (Main.tileSolid[(int) Main.tile[x, y].type] || (int) Main.tile[x, y].type == 11) + { + --WorldGen.checkRoomDepth; + return; + } + } + if (x < WorldGen.roomX1) + WorldGen.roomX1 = x; + if (x > WorldGen.roomX2) + WorldGen.roomX2 = x; + if (y < WorldGen.roomY1) + WorldGen.roomY1 = y; + if (y > WorldGen.roomY2) + WorldGen.roomY2 = y; + WorldGen.CheckSpace(x, y - 1); + if (!WorldGen.canSpawn) + return; + WorldGen.CheckSpace(x, y + 1); + if (!WorldGen.canSpawn) + return; + WorldGen.CheckSpace(x - 1, y - 1); + if (!WorldGen.canSpawn) + return; + WorldGen.CheckSpace(x - 1, y); + if (!WorldGen.canSpawn) + return; + WorldGen.CheckSpace(x - 1, y + 1); + if (!WorldGen.canSpawn) + return; + WorldGen.CheckSpace(x + 1, y - 1); + if (!WorldGen.canSpawn) + return; + WorldGen.CheckSpace(x + 1, y); + if (!WorldGen.canSpawn) + return; + WorldGen.CheckSpace(x + 1, y + 1); + --WorldGen.checkRoomDepth; + } + } + } + + public static void dropMeteor() + { + bool flag = true; + int num1 = 0; + if (Main.netMode == 1) + return; + for (int index = 0; index < 8; ++index) + { + if ((int) Main.player[index].active != 0) + { + flag = false; + break; + } + } + int num2 = 0; + int num3 = (int) (400.0 * (double) ((float) Main.maxTilesX * 0.0002380952f)); + for (int index1 = 5; index1 < (int) Main.maxTilesX - 5; ++index1) + { + for (int index2 = 5; index2 < Main.worldSurface; ++index2) + { + if ((int) Main.tile[index1, index2].active != 0 && (int) Main.tile[index1, index2].type == 37) + { + ++num2; + if (num2 > num3) + return; + } + } + } + while (!flag) + { + float num4 = (float) Main.maxTilesX * 0.08f; + int i = Main.rand.Next(50, (int) Main.maxTilesX - 50); + while ((double) i > (double) Main.spawnTileX - (double) num4 && (double) i < (double) Main.spawnTileX + (double) num4) + i = Main.rand.Next(50, (int) Main.maxTilesX - 50); + for (int j = Main.rand.Next(100); j < (int) Main.maxTilesY; ++j) + { + if ((int) Main.tile[i, j].active != 0 && Main.tileSolid[(int) Main.tile[i, j].type]) + { + flag = WorldGen.meteor(i, j); + break; + } + } + ++num1; + if (num1 >= 100) + break; + } + } + + public static bool meteor(int i, int j) + { + if (i < 50 || i > (int) Main.maxTilesX - 50 || (j < 50 || j > (int) Main.maxTilesY - 50)) + return false; + Rectangle rectangle1 = new Rectangle((i - 25) * 16, (j - 25) * 16, 800, 800); + for (int index = 0; index < 8; ++index) + { + if ((int) Main.player[index].active != 0) + { + Rectangle rectangle2 = new Rectangle(Main.player[index].aabb.X + 10 - 960 - 62, Main.player[index].aabb.Y + 21 - 540 - 34, 2044, 1148); + if (rectangle1.Intersects(rectangle2)) + return false; + } + } + for (int index = 0; index < 196; ++index) + { + if ((int) Main.npc[index].active != 0 && rectangle1.Intersects(Main.npc[index].aabb)) + return false; + } + for (int index1 = i - 25; index1 < i + 25; ++index1) + { + for (int index2 = j - 25; index2 < j + 25; ++index2) + { + if ((int) Main.tile[index1, index2].type == 21 && (int) Main.tile[index1, index2].active != 0) + return false; + } + } + WorldGen.stopDrops = true; + for (int index1 = i - 15; index1 < i + 15; ++index1) + { + for (int index2 = j - 15; index2 < j + 15; ++index2) + { + if (index2 > j + Main.rand.Next(-2, 3) - 5 && Math.Abs(i - index1) + Math.Abs(j - index2) < 22 + Main.rand.Next(-5, 5)) + { + if (!Main.tileSolid[(int) Main.tile[index1, index2].type]) + Main.tile[index1, index2].active = (byte) 0; + Main.tile[index1, index2].type = (byte) 37; + } + } + } + for (int index1 = i - 10; index1 < i + 10; ++index1) + { + for (int index2 = j - 10; index2 < j + 10; ++index2) + { + if (index2 > j + Main.rand.Next(-2, 3) - 5 && Math.Abs(i - index1) + Math.Abs(j - index2) < 10 + Main.rand.Next(-3, 4)) + Main.tile[index1, index2].active = (byte) 0; + } + } + for (int i1 = i - 16; i1 < i + 16; ++i1) + { + for (int j1 = j - 16; j1 < j + 16; ++j1) + { + switch (Main.tile[i1, j1].type) + { + case (byte) 5: + case (byte) 32: + WorldGen.KillTile(i1, j1); + break; + } + WorldGen.SquareTileFrame(i1, j1, -1); + WorldGen.SquareWallFrame(i1, j1, true); + } + } + for (int i1 = i - 23; i1 < i + 23; ++i1) + { + for (int j1 = j - 23; j1 < j + 23; ++j1) + { + if ((int) Main.tile[i1, j1].active != 0 && Main.rand.Next(10) == 0 && (double) (Math.Abs(i - i1) + Math.Abs(j - j1)) < 29.8999996185303) + { + if ((int) Main.tile[i1, j1].type == 5 || (int) Main.tile[i1, j1].type == 32) + WorldGen.KillTile(i1, j1); + Main.tile[i1, j1].type = (byte) 37; + WorldGen.SquareTileFrame(i1, j1, -1); + } + } + } + WorldGen.stopDrops = false; + NetMessage.SendText(36, 50, (int) byte.MaxValue, 130, -1); + NetMessage.SendTileSquare(i, j, 30); + return true; + } + + public static void setWorldSize() + { + Main.bottomWorld = (int) Main.maxTilesY * 16; + Main.rightWorld = (int) Main.maxTilesX * 16; + Main.maxSectionsX = (int) Main.maxTilesX / 40; + Main.maxSectionsY = (int) Main.maxTilesY / 30; + } + + public static void worldGenCallBack() + { + Thread.CurrentThread.SetProcessorAffinity(new int[1] + { + 5 + }); + WorldGen.clearWorld(); + WorldGen.generateWorld(-1); + WorldGen.everyTileFrame(); + WorldGen.saveWorldWhilePlaying(); + Main.StartGame(); + Main.worldGenThread = (Thread) null; + } + + public static void CreateNewWorld() + { + Netplay.StopFindingSessions(); + Thread thread = new Thread(new ThreadStart(WorldGen.worldGenCallBack)); + thread.IsBackground = true; + thread.Start(); + Main.worldGenThread = thread; + } + + public static void SaveAndQuit() + { + Main.PlaySound(11); + new Thread(new ThreadStart(WorldGen.SaveAndQuitCallBack)).Start(); + } + + public static void SaveAndQuitCallBack() + { + Thread.CurrentThread.SetProcessorAffinity(new int[1] + { + 4 + }); + Main.isGameStarted = false; + for (int index = 0; index < 4; ++index) + { + UI ui = Main.ui[index]; + if (ui.isStopping) + { + ui.player.active = (byte) 0; + ui.player.Save(ui.playerPathName); + ui.SaveSettings(); + } + } + int num = Main.netMode; + Netplay.disconnect = true; + if (num != 1 && UI.main.HasPlayerStorage()) + { + for (int index = 0; index < 4; ++index) + { + UI ui = Main.ui[index]; + if (ui.isStopping) + ui.statusText = Lang.gen[49]; + } + WorldGen.saveNewWorld(); + } + for (int index = 0; index < 4; ++index) + { + UI ui = Main.ui[index]; + if (ui.isStopping) + { + ui.isStopping = false; + if (ui.signedInGamer != null) + { + ui.LoadPlayers(); + if (ui.menuMode != MenuMode.ERROR) + ui.SetMenu(MenuMode.TITLE, false, true); + } + } + } + } + + public static void playWorldCallBack() + { + Thread.CurrentThread.SetProcessorAffinity(new int[1] + { + 5 + }); + if (Main.IsTutorial()) + { + using (Stream file = TitleContainer.OpenStream("Content/Worlds/tutorial.wld")) + WorldGen.loadWorld(file); + WorldGen.tempTime.reset(0.01f); + Main.npc[0].position.Y -= 1120f; + Main.npc[0].aabb.Y -= 1120; + Main.npc[1].position.Y -= 1120f; + Main.npc[1].aabb.Y -= 1120; + } + else + { + bool flag; + try + { + using (StorageContainer storageContainer = UI.main.OpenPlayerStorage("Worlds")) + { + using (Stream file = storageContainer.OpenFile(WorldSelect.worldPathName, FileMode.Open)) + flag = WorldGen.loadWorld(file); + } + } + catch (ThreadAbortException ex) + { + flag = true; + } + catch (IOException ex) + { + UI.main.ReadError(); + flag = false; + } + catch (Exception ex) + { + flag = false; + } + if (!flag) + { + UI.main.SetMenu(MenuMode.LOAD_FAILED_NO_BACKUP, false, false); + Main.worldGenThread = (Thread) null; + return; + } + } + WorldGen.everyTileFrame(); + Main.StartGame(); + Main.worldGenThread = (Thread) null; + } + + public static void playWorld() + { + Netplay.StopFindingSessions(); + Thread thread = new Thread(new ThreadStart(WorldGen.playWorldCallBack)); + thread.Start(); + Main.worldGenThread = thread; + } + + public static void saveWorldWhilePlayingCallBack() + { + Thread.CurrentThread.SetProcessorAffinity(new int[1] + { + 4 + }); + WorldGen.saveNewWorld(); + } + + public static void saveWorldWhilePlaying() + { + if (!UI.main.HasPlayerStorage()) + return; + new Thread(new ThreadStart(WorldGen.saveWorldWhilePlayingCallBack)).Start(); + } + + public static void savePlayerWhilePlayingCallBack() + { + Thread.CurrentThread.SetProcessorAffinity(new int[1] + { + 4 + }); + for (int index = 0; index < 4; ++index) + { + UI ui = Main.ui[index]; + if (ui.menuType != MenuType.MAIN) + { + ui.player.Save(ui.playerPathName); + ui.SaveSettings(); + } + } + } + + public static void savePlayerWhilePlaying() + { + new Thread(new ThreadStart(WorldGen.savePlayerWhilePlayingCallBack)).Start(); + } + + public static void saveAllWhilePlayingCallBack() + { + Thread.CurrentThread.SetProcessorAffinity(new int[1] + { + 4 + }); + if (Main.netMode != 1 && UI.main.HasPlayerStorage()) + WorldGen.saveNewWorld(); + for (int index = 0; index < 4; ++index) + { + UI ui = Main.ui[index]; + if (ui.menuType != MenuType.MAIN) + { + ui.player.Save(ui.playerPathName); + ui.SaveSettings(); + } + } + } + + public static void saveAllWhilePlaying() + { + new Thread(new ThreadStart(WorldGen.saveAllWhilePlayingCallBack)).Start(); + } + + public static void clearWorld() + { + UI.main.statusText = Lang.gen[47]; + WorldGen.tempTime.reset(1f); + WorldGen.totalSolid2 = 0; + WorldGen.totalGood2 = 0; + WorldGen.totalEvil2 = 0; + WorldGen.totalSolid = 0; + WorldGen.totalGood = 0; + WorldGen.totalEvil = 0; + WorldGen.totalX = 0; + WorldGen.totalD = 0; + WorldGen.tEvil = (byte) 0; + WorldGen.tGood = (byte) 0; + NPC.clrNames(); + WorldGen.spawnEye = false; + WorldGen.spawnNPC = 0; + WorldGen.shadowOrbCount = 0; + WorldGen.altarCount = 0; + Main.worldID = 0; + Main.worldTimestamp = 0; + Main.hardMode = false; + Main.dungeonX = (short) 0; + Main.dungeonY = (short) 0; + NPC.downedBoss1 = false; + NPC.downedBoss2 = false; + NPC.downedBoss3 = false; + NPC.savedGoblin = false; + NPC.savedWizard = false; + NPC.savedMech = false; + NPC.downedGoblins = false; + NPC.downedClown = false; + NPC.downedFrost = false; + WorldGen.shadowOrbSmashed = false; + WorldGen.spawnMeteor = false; + WorldGen.stopDrops = false; + Main.invasionDelay = 0; + Main.invasionType = 0; + Main.invasionSize = 0; + Main.invasionWarn = 0; + Main.invasionX = 0.0f; + Liquid.numLiquid = 0; + LiquidBuffer.numLiquidBuffer = 0; + WorldGen.sandBuffer[0] = new WorldGen.FallingSandBuffer(); + WorldGen.sandBuffer[1] = new WorldGen.FallingSandBuffer(); + if ((int) WorldGen.lastMaxTilesX > (int) Main.maxTilesX) + { + for (int index1 = (int) Main.maxTilesX; index1 < (int) WorldGen.lastMaxTilesX; ++index1) + { + for (int index2 = 0; index2 < (int) WorldGen.lastMaxTilesY; ++index2) + Main.tile[index1, index2].Clear(); + } + } + if ((int) WorldGen.lastMaxTilesY > (int) Main.maxTilesY) + { + for (int index1 = 0; index1 < (int) Main.maxTilesX; ++index1) + { + for (int index2 = (int) Main.maxTilesY; index2 < (int) WorldGen.lastMaxTilesY; ++index2) + Main.tile[index1, index2].Clear(); + } + } + WorldGen.lastMaxTilesX = Main.maxTilesX; + WorldGen.lastMaxTilesY = Main.maxTilesY; + if (Main.netMode != 1) + { + for (int index1 = 0; index1 < (int) Main.maxTilesX; ++index1) + { + for (int index2 = 0; index2 < (int) Main.maxTilesY; ++index2) + Main.tile[index1, index2].Clear(); + } + } + Main.dust.Init(); + for (int index = 0; index < 128; ++index) + Main.gore[index].Init(); + for (int index = 0; index < 200; ++index) + Main.item[index].Init(); + for (int index = 0; index < 196; ++index) + Main.npc[index] = new NPC(); + for (int index = 0; index < 512; ++index) + Main.projectile[index].Init(); + for (int index = 0; index < 1000; ++index) + Main.chest[index] = (Chest) null; + for (int index = 0; index < 1000; ++index) + Main.sign[index].Init(); + for (int index = 0; index < 8192; ++index) + Main.liquidBuffer[index] = new LiquidBuffer(); + WorldGen.setWorldSize(); + } + + public static bool loadWorld(Stream file) + { + bool flag = true; + Time.checkXMas(); + using (MemoryStream stream = new MemoryStream((int) file.Length)) + { + stream.SetLength(file.Length); + file.Read(stream.GetBuffer(), 0, (int) file.Length); + file.Close(); + using (BinaryReader fileIO = new BinaryReader((Stream) stream)) + { + try + { + int release = fileIO.ReadInt32(); + if (release > 49) + throw new InvalidOperationException("Invalid version"); + if (release <= 46) + WorldGen.loadOldWorld(fileIO, release); + else + WorldGen.loadNewWorld(fileIO, release, stream); + WorldGen.gen = true; + UI.main.NextProgressStep(Lang.gen[52]); + for (int X = 0; X < (int) Main.maxTilesX; ++X) + { + if ((X & 63) == 0) + UI.main.progress = (float) X / (float) Main.maxTilesX; + WorldGen.CountTiles(X); + } + NPC.setNames(); + UI.main.NextProgressStep(Lang.gen[27]); + WorldGen.waterLine = (int) Main.maxTilesY; + Liquid.QuickWater(0.5, 3, -1, 0.0); + WorldGen.WaterCheck(); + int num1 = 0; + Liquid.QuickSettleOn(); + int num2 = Liquid.numLiquid + LiquidBuffer.numLiquidBuffer; + float num3 = 0.0f; + while (Liquid.numLiquid > 0 && num1 < 512) + { + ++num1; + float num4 = (float) (num2 - (Liquid.numLiquid + LiquidBuffer.numLiquidBuffer)) / (float) num2; + if (Liquid.numLiquid + LiquidBuffer.numLiquidBuffer > num2) + num2 = Liquid.numLiquid + LiquidBuffer.numLiquidBuffer; + if ((double) num4 > (double) num3) + num3 = num4; + else + num4 = num3; + if ((double) num4 <= 0.5) + UI.main.progress = num4 + 0.5f; + Liquid.UpdateLiquid(); + } + Liquid.QuickSettleOff(); + WorldGen.WaterCheck(); + WorldGen.gen = false; + } + catch + { + flag = false; + } + } + } + return flag; + } + + private static unsafe void loadOldWorld(BinaryReader fileIO, int release) + { + string str1 = fileIO.ReadString(); + int num1 = fileIO.ReadInt32(); + Main.rightWorld = fileIO.ReadInt32(); + Main.rightWorld = fileIO.ReadInt32(); + Main.bottomWorld = fileIO.ReadInt32(); + Main.bottomWorld = fileIO.ReadInt32(); + Main.maxTilesY = (short) fileIO.ReadInt32(); + Main.maxTilesX = (short) fileIO.ReadInt32(); + WorldGen.clearWorld(); + Main.worldID = num1; + UI.main.FirstProgressStep(4, Lang.gen[51]); + Main.spawnTileX = (short) fileIO.ReadInt32(); + Main.spawnTileY = (short) fileIO.ReadInt32(); + Main.worldSurface = (int) fileIO.ReadDouble(); + Main.worldSurfacePixels = Main.worldSurface << 4; + Main.rockLayer = (int) fileIO.ReadDouble(); + Main.rockLayerPixels = Main.rockLayer << 4; + WorldGen.UpdateMagmaLayerPos(); + WorldGen.tempTime.dayRate = 1f; + WorldGen.tempTime.time = (float) fileIO.ReadDouble(); + WorldGen.tempTime.dayTime = fileIO.ReadBoolean(); + WorldGen.tempTime.moonPhase = (byte) fileIO.ReadInt32(); + WorldGen.tempTime.bloodMoon = fileIO.ReadBoolean(); + Main.dungeonX = (short) fileIO.ReadInt32(); + Main.dungeonY = (short) fileIO.ReadInt32(); + NPC.downedBoss1 = fileIO.ReadBoolean(); + NPC.downedBoss2 = fileIO.ReadBoolean(); + NPC.downedBoss3 = fileIO.ReadBoolean(); + NPC.savedGoblin = fileIO.ReadBoolean(); + NPC.savedWizard = fileIO.ReadBoolean(); + NPC.savedMech = fileIO.ReadBoolean(); + NPC.downedGoblins = fileIO.ReadBoolean(); + NPC.downedClown = fileIO.ReadBoolean(); + NPC.downedFrost = fileIO.ReadBoolean(); + WorldGen.shadowOrbSmashed = fileIO.ReadBoolean(); + WorldGen.spawnMeteor = fileIO.ReadBoolean(); + WorldGen.shadowOrbCount = (int) fileIO.ReadByte(); + WorldGen.altarCount = fileIO.ReadInt32(); + Main.hardMode = fileIO.ReadBoolean(); + Main.invasionDelay = fileIO.ReadInt32(); + Main.invasionSize = fileIO.ReadInt32(); + Main.invasionType = fileIO.ReadInt32(); + Main.invasionX = (float) fileIO.ReadDouble(); + for (int index = 0; index < (int) Main.maxTilesX; ++index) + { + if ((index & 31) == 0) + UI.main.progress = (float) index / (float) Main.maxTilesX; + fixed (Tile* tilePtr1 = &Main.tile[index, 0]) + { + Tile* tilePtr2 = tilePtr1; + int num2 = 0; + while (num2 < (int) Main.maxTilesY) + { + tilePtr2->flags = ~(Tile.Flags.WALLFRAME_MASK | Tile.Flags.HIGHLIGHT_MASK | Tile.Flags.VISITED | Tile.Flags.WIRE | Tile.Flags.CHECKING_LIQUID | Tile.Flags.SKIP_LIQUID); + tilePtr2->active = fileIO.ReadByte(); + if ((int) tilePtr2->active != 0) + { + tilePtr2->type = fileIO.ReadByte(); + if ((int) tilePtr2->type == (int) sbyte.MaxValue) + tilePtr2->active = (byte) 0; + if (Main.tileFrameImportant[(int) tilePtr2->type]) + { + tilePtr2->frameX = fileIO.ReadInt16(); + tilePtr2->frameY = fileIO.ReadInt16(); + if ((int) tilePtr2->type == 144) + tilePtr2->frameY = (short) 0; + } + else + { + tilePtr2->frameX = (short) -1; + tilePtr2->frameY = (short) -1; + } + } + if (fileIO.ReadBoolean()) + tilePtr2->wall = fileIO.ReadByte(); + if (fileIO.ReadBoolean()) + { + tilePtr2->liquid = fileIO.ReadByte(); + if (fileIO.ReadBoolean()) + tilePtr2->lava = (byte) 32; + } + if (release < 46) + { + if (fileIO.ReadBoolean()) + tilePtr2->wire = 16; + } + else + { + tilePtr2->flags |= (Tile.Flags) fileIO.ReadByte(); + if (Main.IsTutorial()) + tilePtr2->flags &= Tile.Flags.WALLFRAME_MASK | Tile.Flags.HIGHLIGHT_MASK | Tile.Flags.WIRE | Tile.Flags.CHECKING_LIQUID | Tile.Flags.SKIP_LIQUID; + } + int num3 = (int) fileIO.ReadInt16(); + int num4 = num2 + num3; + for (; num3 > 0; --num3) + { + tilePtr2[1] = *tilePtr2; + ++tilePtr2; + } + num2 = num4 + 1; + ++tilePtr2; + } + } + } + for (int index1 = 0; index1 < 1000; ++index1) + { + if (fileIO.ReadBoolean()) + { + Main.chest[index1] = new Chest(); + Main.chest[index1].x = (short) fileIO.ReadInt32(); + Main.chest[index1].y = (short) fileIO.ReadInt32(); + for (int index2 = 0; index2 < 20; ++index2) + { + byte num2 = fileIO.ReadByte(); + if ((int) num2 > 0) + { + Main.chest[index1].item[index2].netDefaults(fileIO.ReadInt32(), (int) num2); + Main.chest[index1].item[index2].Prefix((int) fileIO.ReadByte()); + } + } + } + } + for (int index1 = 0; index1 < 1000; ++index1) + { + if (fileIO.ReadBoolean()) + { + string str2 = fileIO.ReadString(); + int index2 = fileIO.ReadInt32(); + int index3 = fileIO.ReadInt32(); + if ((int) Main.tile[index2, index3].active != 0 && ((int) Main.tile[index2, index3].type == 55 || (int) Main.tile[index2, index3].type == 85)) + { + Main.sign[index1].x = (short) index2; + Main.sign[index1].y = (short) index3; + Main.sign[index1].text = (UserString) str2; + } + } + } + bool flag1 = fileIO.ReadBoolean(); + int index4 = 0; + for (; flag1; flag1 = fileIO.ReadBoolean()) + { + try + { + string str2 = fileIO.ReadString(); + Main.npc[index4].SetDefaults((int) Convert.ToUInt16(str2), -1.0); + Main.npc[index4].position.X = fileIO.ReadSingle(); + Main.npc[index4].position.Y = fileIO.ReadSingle(); + Main.npc[index4].aabb.X = (int) Main.npc[index4].position.X; + Main.npc[index4].aabb.Y = (int) Main.npc[index4].position.Y; + Main.npc[index4].homeless = fileIO.ReadBoolean(); + Main.npc[index4].homeTileX = (short) fileIO.ReadInt32(); + Main.npc[index4].homeTileY = (short) fileIO.ReadInt32(); + ++index4; + } + catch (FormatException ex) + { + fileIO.ReadBytes(17); + } + } + NPC.chrName[17] = fileIO.ReadString(); + NPC.chrName[18] = fileIO.ReadString(); + NPC.chrName[19] = fileIO.ReadString(); + NPC.chrName[20] = fileIO.ReadString(); + NPC.chrName[22] = fileIO.ReadString(); + NPC.chrName[54] = fileIO.ReadString(); + NPC.chrName[38] = fileIO.ReadString(); + NPC.chrName[107] = fileIO.ReadString(); + NPC.chrName[108] = fileIO.ReadString(); + NPC.chrName[124] = fileIO.ReadString(); + bool flag2 = fileIO.ReadBoolean(); + string str3 = fileIO.ReadString(); + int num5 = fileIO.ReadInt32(); + if (!flag2 || str3 != str1 || num5 != Main.worldID) + throw new InvalidOperationException("Invalid footer"); + } + + private static unsafe void loadNewWorld(BinaryReader fileIO, int release, MemoryStream stream) + { + CRC32 crC32 = new CRC32(); + crC32.Update(stream.GetBuffer(), 8, (int) stream.Length - 8); + if ((int) crC32.GetValue() != (int) fileIO.ReadUInt32()) + throw new InvalidOperationException("Invalid CRC32"); + fileIO.ReadString(); + int num1 = fileIO.ReadInt32(); + int num2 = release >= 48 ? fileIO.ReadInt32() : 0; + Main.rightWorld = fileIO.ReadInt32(); + Main.bottomWorld = (int) fileIO.ReadInt16(); + Main.maxTilesY = fileIO.ReadInt16(); + Main.maxTilesX = fileIO.ReadInt16(); + WorldGen.clearWorld(); + Main.worldID = num1; + Main.worldTimestamp = num2; + UI.main.FirstProgressStep(4, Lang.gen[51]); + Main.spawnTileX = fileIO.ReadInt16(); + Main.spawnTileY = fileIO.ReadInt16(); + Main.worldSurface = (int) fileIO.ReadInt16(); + Main.worldSurfacePixels = Main.worldSurface << 4; + Main.rockLayer = (int) fileIO.ReadInt16(); + Main.rockLayerPixels = Main.rockLayer << 4; + WorldGen.UpdateMagmaLayerPos(); + WorldGen.tempTime.dayRate = 1f; + WorldGen.tempTime.time = fileIO.ReadSingle(); + WorldGen.tempTime.dayTime = fileIO.ReadBoolean(); + WorldGen.tempTime.moonPhase = fileIO.ReadByte(); + WorldGen.tempTime.bloodMoon = fileIO.ReadBoolean(); + Main.dungeonX = fileIO.ReadInt16(); + Main.dungeonY = fileIO.ReadInt16(); + NPC.downedBoss1 = fileIO.ReadBoolean(); + NPC.downedBoss2 = fileIO.ReadBoolean(); + NPC.downedBoss3 = fileIO.ReadBoolean(); + NPC.savedGoblin = fileIO.ReadBoolean(); + NPC.savedWizard = fileIO.ReadBoolean(); + NPC.savedMech = fileIO.ReadBoolean(); + NPC.downedGoblins = fileIO.ReadBoolean(); + NPC.downedClown = fileIO.ReadBoolean(); + NPC.downedFrost = fileIO.ReadBoolean(); + WorldGen.shadowOrbSmashed = fileIO.ReadBoolean(); + WorldGen.spawnMeteor = fileIO.ReadBoolean(); + WorldGen.shadowOrbCount = (int) fileIO.ReadByte(); + WorldGen.altarCount = fileIO.ReadInt32(); + Main.hardMode = fileIO.ReadBoolean(); + Main.invasionDelay = (int) fileIO.ReadByte(); + Main.invasionSize = (int) fileIO.ReadInt16(); + Main.invasionType = (int) fileIO.ReadByte(); + Main.invasionX = fileIO.ReadSingle(); + for (int index = 0; index < (int) Main.maxTilesX; ++index) + { + if ((index & 31) == 0) + UI.main.progress = (float) index / (float) Main.maxTilesX; + fixed (Tile* tilePtr1 = &Main.tile[index, 0]) + { + Tile* tilePtr2 = tilePtr1; + int num3 = 0; + while (num3 < (int) Main.maxTilesY) + { + tilePtr2->flags = ~(Tile.Flags.WALLFRAME_MASK | Tile.Flags.HIGHLIGHT_MASK | Tile.Flags.VISITED | Tile.Flags.WIRE | Tile.Flags.CHECKING_LIQUID | Tile.Flags.SKIP_LIQUID); + tilePtr2->active = fileIO.ReadByte(); + if ((int) tilePtr2->active != 0) + { + tilePtr2->type = fileIO.ReadByte(); + if ((int) tilePtr2->type == (int) sbyte.MaxValue) + tilePtr2->active = (byte) 0; + if (Main.tileFrameImportant[(int) tilePtr2->type]) + { + tilePtr2->frameX = fileIO.ReadInt16(); + tilePtr2->frameY = fileIO.ReadInt16(); + if ((int) tilePtr2->type == 144) + tilePtr2->frameY = (short) 0; + } + else + { + tilePtr2->frameX = (short) -1; + tilePtr2->frameY = (short) -1; + } + } + tilePtr2->wall = fileIO.ReadByte(); + tilePtr2->liquid = fileIO.ReadByte(); + if ((int) tilePtr2->liquid > 0 && fileIO.ReadBoolean()) + tilePtr2->lava = (byte) 32; + tilePtr2->flags |= (Tile.Flags) fileIO.ReadByte(); + if (Main.IsTutorial()) + tilePtr2->flags &= Tile.Flags.WALLFRAME_MASK | Tile.Flags.HIGHLIGHT_MASK | Tile.Flags.WIRE | Tile.Flags.CHECKING_LIQUID | Tile.Flags.SKIP_LIQUID; + int num4 = (int) fileIO.ReadByte(); + if ((num4 & 128) != 0) + num4 = num4 & (int) sbyte.MaxValue | (int) fileIO.ReadByte() << 7; + int num5 = num3 + num4; + for (; num4 > 0; --num4) + { + tilePtr2[1] = *tilePtr2; + ++tilePtr2; + } + num3 = num5 + 1; + ++tilePtr2; + } + } + } + for (int index1 = 0; index1 < 1000; ++index1) + { + if (fileIO.ReadBoolean()) + { + Main.chest[index1] = new Chest(); + Main.chest[index1].x = fileIO.ReadInt16(); + Main.chest[index1].y = fileIO.ReadInt16(); + for (int index2 = 0; index2 < 20; ++index2) + { + byte num3 = fileIO.ReadByte(); + if ((int) num3 > 0) + { + Main.chest[index1].item[index2].netDefaults((int) fileIO.ReadInt16(), (int) num3); + Main.chest[index1].item[index2].Prefix((int) fileIO.ReadByte()); + } + } + } + } + for (int index = 0; index < 1000; ++index) + Main.sign[index].Read(fileIO, release); + bool flag = fileIO.ReadBoolean(); + int index3 = 0; + for (; flag; flag = fileIO.ReadBoolean()) + { + int Type = (int) fileIO.ReadByte(); + Main.npc[index3].SetDefaults(Type, -1.0); + Main.npc[index3].position.X = fileIO.ReadSingle(); + Main.npc[index3].position.Y = fileIO.ReadSingle(); + Main.npc[index3].aabb.X = (int) Main.npc[index3].position.X; + Main.npc[index3].aabb.Y = (int) Main.npc[index3].position.Y; + Main.npc[index3].homeless = fileIO.ReadBoolean(); + Main.npc[index3].homeTileX = fileIO.ReadInt16(); + Main.npc[index3].homeTileY = fileIO.ReadInt16(); + ++index3; + } + NPC.chrName[17] = fileIO.ReadString(); + NPC.chrName[18] = fileIO.ReadString(); + NPC.chrName[19] = fileIO.ReadString(); + NPC.chrName[20] = fileIO.ReadString(); + NPC.chrName[22] = fileIO.ReadString(); + NPC.chrName[54] = fileIO.ReadString(); + NPC.chrName[38] = fileIO.ReadString(); + NPC.chrName[107] = fileIO.ReadString(); + NPC.chrName[108] = fileIO.ReadString(); + NPC.chrName[124] = fileIO.ReadString(); + } + + public static void saveNewWorld() + { + if (WorldGen.saveLock) + return; + WorldGen.saveLock = true; + if (WorldGen.hardLock) + { + UI.main.statusText = Lang.gen[48]; + do + { + Thread.Sleep(16); + } + while (WorldGen.hardLock); + } + bool flag = false; + lock (WorldGen.padlock) + { + UI.main.FirstProgressStep(1, Lang.gen[49]); + using (MemoryStream resource_3 = new MemoryStream(6291456)) + { + using (BinaryWriter resource_2 = new BinaryWriter((Stream) resource_3)) + { + resource_2.Write(49); + resource_2.Write(0U); + resource_2.Write(Main.worldName); + resource_2.Write(Main.worldID); + resource_2.Write(Main.worldTimestamp); + resource_2.Write(Main.rightWorld); + resource_2.Write((short) Main.bottomWorld); + resource_2.Write(Main.maxTilesY); + resource_2.Write(Main.maxTilesX); + resource_2.Write(Main.spawnTileX); + resource_2.Write(Main.spawnTileY); + resource_2.Write((short) Main.worldSurface); + resource_2.Write((short) Main.rockLayer); + resource_2.Write(WorldGen.tempTime.time); + resource_2.Write(WorldGen.tempTime.dayTime); + resource_2.Write(WorldGen.tempTime.moonPhase); + resource_2.Write(WorldGen.tempTime.bloodMoon); + resource_2.Write(Main.dungeonX); + resource_2.Write(Main.dungeonY); + resource_2.Write(NPC.downedBoss1); + resource_2.Write(NPC.downedBoss2); + resource_2.Write(NPC.downedBoss3); + resource_2.Write(NPC.savedGoblin); + resource_2.Write(NPC.savedWizard); + resource_2.Write(NPC.savedMech); + resource_2.Write(NPC.downedGoblins); + resource_2.Write(NPC.downedClown); + resource_2.Write(NPC.downedFrost); + resource_2.Write(WorldGen.shadowOrbSmashed); + resource_2.Write(WorldGen.spawnMeteor); + resource_2.Write((byte) WorldGen.shadowOrbCount); + resource_2.Write(WorldGen.altarCount); + resource_2.Write(Main.hardMode); + resource_2.Write((byte) Main.invasionDelay); + resource_2.Write((short) Main.invasionSize); + resource_2.Write((byte) Main.invasionType); + resource_2.Write(Main.invasionX); + for (int local_3 = 0; local_3 < (int) Main.maxTilesX; ++local_3) + { + if ((local_3 & 31) == 0) + UI.main.progress = (float) local_3 / (float) Main.maxTilesX; + for (int local_4 = 0; local_4 < (int) Main.maxTilesY; { + int local_4_1; + local_4 = local_4_1 + 1; + } + ) + { + Tile local_5 = Main.tile[local_3, local_4]; + if ((int) local_5.type == (int) sbyte.MaxValue) + local_5.active = (byte) 0; + if ((int) local_5.active != 0) + { + resource_2.Write(true); + resource_2.Write(local_5.type); + if (Main.tileFrameImportant[(int) local_5.type]) + { + resource_2.Write(local_5.frameX); + resource_2.Write(local_5.frameY); + } + } + else + resource_2.Write(false); + resource_2.Write(local_5.wall); + resource_2.Write(local_5.liquid); + if ((int) local_5.liquid > 0) + resource_2.Write((int) local_5.lava != 0); + resource_2.Write((byte) (local_5.flags & (Tile.Flags.VISITED | Tile.Flags.WIRE))); + int local_6 = 1; + while (local_4 + local_6 < (int) Main.maxTilesY && local_5.isTheSameAs(Main.tile.Address(local_3, local_4 + local_6))) + ++local_6; + int local_6_1 = local_6 - 1; + local_4_1 = local_4 + local_6_1; + if (local_6_1 < 128) + { + resource_2.Write((byte) local_6_1); + } + else + { + int local_7 = local_6_1 & (int) sbyte.MaxValue | 128; + int local_6_2 = local_6_1 >> 7; + resource_2.Write((ushort) (local_7 | local_6_2 << 8)); + } + } + } + for (int local_8 = 0; local_8 < 1000; ++local_8) + { + if (Main.chest[local_8] == null) + { + resource_2.Write(false); + } + else + { + Chest local_9 = Main.chest[local_8]; + resource_2.Write(true); + resource_2.Write(local_9.x); + resource_2.Write(local_9.y); + for (int local_10 = 0; local_10 < 20; ++local_10) + { + if ((int) local_9.item[local_10].type == 0) + local_9.item[local_10].stack = (short) 0; + resource_2.Write((byte) local_9.item[local_10].stack); + if ((int) local_9.item[local_10].stack > 0) + { + resource_2.Write(local_9.item[local_10].netID); + resource_2.Write(local_9.item[local_10].prefix); + } + } + } + } + for (int local_11 = 0; local_11 < 1000; ++local_11) + Main.sign[local_11].Write(resource_2); + for (int local_13 = 0; local_13 < 196; ++local_13) + { + NPC local_14 = Main.npc[local_13]; + if (local_14.townNPC && (int) local_14.active != 0) + { + NPC local_14_1 = (NPC) local_14.Clone(); + resource_2.Write(true); + resource_2.Write(local_14_1.type); + resource_2.Write(local_14_1.position.X); + resource_2.Write(local_14_1.position.Y); + resource_2.Write(local_14_1.homeless); + resource_2.Write(local_14_1.homeTileX); + resource_2.Write(local_14_1.homeTileY); + } + } + resource_2.Write(false); + resource_2.Write(NPC.chrName[17]); + resource_2.Write(NPC.chrName[18]); + resource_2.Write(NPC.chrName[19]); + resource_2.Write(NPC.chrName[20]); + resource_2.Write(NPC.chrName[22]); + resource_2.Write(NPC.chrName[54]); + resource_2.Write(NPC.chrName[38]); + resource_2.Write(NPC.chrName[107]); + resource_2.Write(NPC.chrName[108]); + resource_2.Write(NPC.chrName[124]); + CRC32 local_15 = new CRC32(); + local_15.Update(resource_3.GetBuffer(), 8, (int) resource_3.Length - 8); + resource_2.Seek(4, SeekOrigin.Begin); + resource_2.Write(local_15.GetValue()); + Main.ShowSaveIcon(); + try + { + if (UI.main.TestStorageSpace("Worlds", WorldSelect.worldPathName, (int) resource_3.Length)) + { + using (StorageContainer resource_1 = UI.main.OpenPlayerStorage("Worlds")) + { + using (Stream resource_0 = resource_1.OpenFile(WorldSelect.worldPathName, FileMode.Create)) + { + resource_0.Write(resource_3.GetBuffer(), 0, (int) resource_3.Length); + resource_0.Close(); + flag = true; + } + } + } + } + catch (IOException exception_0) + { + UI.main.WriteError(); + } + catch (Exception exception_1) + { + } + resource_2.Close(); + Main.HideSaveIcon(); + } + } + WorldGen.saveLock = false; + if (flag) + return; + WorldSelect.LoadWorlds(); + } + } + + private static void resetGen() + { + WorldGen.mudWall = false; + WorldGen.hellChest = 0; + WorldGen.JungleX = 0; + WorldGen.numMCaves = 0; + WorldGen.numIslandHouses = 0; + WorldGen.houseCount = 0; + WorldGen.dEnteranceX = 0; + WorldGen.numDRooms = 0; + WorldGen.numDDoors = 0; + WorldGen.numDPlats = 0; + WorldGen.numJChests = 0; + } + + public static bool placeTrap(int x2, int y2, int type = -1) + { + int i1 = x2; + int j1 = y2; + while (!WorldGen.SolidTileUnsafe(i1, j1)) + { + if (++j1 >= (int) Main.maxTilesY - 300) + return false; + } + int j2 = j1 - 1; + if ((int) Main.tile[i1, j2].liquid > 0 && (int) Main.tile[i1, j2].lava != 0) + return false; + if (type == -1 && Main.rand.Next(20) == 0) + type = 2; + else if (type == -1) + type = Main.rand.Next(2); + if ((int) Main.tile[i1, j2].active != 0 || (int) Main.tile[i1 - 1, j2].active != 0 || ((int) Main.tile[i1 + 1, j2].active != 0 || (int) Main.tile[i1, j2 - 1].active != 0) || ((int) Main.tile[i1 - 1, j2 - 1].active != 0 || (int) Main.tile[i1 + 1, j2 - 1].active != 0 || ((int) Main.tile[i1, j2 - 2].active != 0 || (int) Main.tile[i1 - 1, j2 - 2].active != 0)) || ((int) Main.tile[i1 + 1, j2 - 2].active != 0 || (int) Main.tile[i1, j2 + 1].type == 48)) + return false; + if (type == 0) + { + int i2 = i1; + int j3 = j2 - WorldGen.genRand.Next(3); + while (!WorldGen.SolidTileUnsafe(i2, j3)) + { + if (--i2 < 0) + return false; + } + int i3 = i2; + int i4 = i1; + while (!WorldGen.SolidTileUnsafe(i4, j3)) + { + if (++i4 >= (int) Main.maxTilesX) + return false; + } + int i5 = i4; + int num1 = i1 - i3; + int num2 = i5 - i1; + bool flag1 = num1 > 5 && num1 < 50; + bool flag2 = num2 > 5 && num2 < 50; + if (flag1 && !WorldGen.SolidTileUnsafe(i3, j3 + 1)) + flag1 = false; + else if (flag1 && ((int) Main.tile[i3, j3].type == 10 || (int) Main.tile[i3, j3].type == 48 || ((int) Main.tile[i3, j3 + 1].type == 10 || (int) Main.tile[i3, j3 + 1].type == 48))) + flag1 = false; + if (flag2 && !WorldGen.SolidTileUnsafe(i5, j3 + 1)) + flag2 = false; + else if (flag2 && ((int) Main.tile[i5, j3].type == 10 || (int) Main.tile[i5, j3].type == 48 || ((int) Main.tile[i5, j3 + 1].type == 10 || (int) Main.tile[i5, j3 + 1].type == 48))) + flag2 = false; + int style; + int i6; + if (flag1 && flag2) + { + style = 1; + i6 = i3; + if (WorldGen.genRand.Next(2) == 0) + { + i6 = i5; + style = -1; + } + } + else if (flag2) + { + i6 = i5; + style = -1; + } + else + { + if (!flag1) + return false; + i6 = i3; + style = 1; + } + WorldGen.PlaceTile(i1, j2, 135, true, true, -1, (int) Main.tile[i1, j2].wall > 0 ? 2 : WorldGen.genRand.Next(2, 4)); + WorldGen.KillTile(i6, j3); + WorldGen.PlaceTile(i6, j3, 137, true, true, -1, style); + int index1 = i1; + int index2 = j2; + while (index1 != i6 || index2 != j3) + { + Main.tile[index1, index2].wire = 16; + if (index1 > i6) + --index1; + if (index1 < i6) + ++index1; + Main.tile[index1, index2].wire = 16; + if (index2 > j3) + --index2; + if (index2 < j3) + ++index2; + Main.tile[index1, index2].wire = 16; + } + return true; + } + else if (type == 1) + { + int num1 = i1; + int num2 = j2 - 8; + int i2 = num1 + WorldGen.genRand.Next(-1, 2); + bool flag1 = true; + while (flag1) + { + bool flag2 = true; + int num3 = 0; + for (int i3 = i2 - 2; i3 <= i2 + 3; ++i3) + { + for (int j3 = num2; j3 <= num2 + 3; ++j3) + { + if (!WorldGen.SolidTileUnsafe(i3, j3)) + flag2 = false; + if ((int) Main.tile[i3, j3].active != 0 && ((int) Main.tile[i3, j3].type == 0 || (int) Main.tile[i3, j3].type == 1 || (int) Main.tile[i3, j3].type == 59)) + ++num3; + } + } + --num2; + if (num2 < Main.worldSurface) + return false; + if (flag2 && num3 > 2) + flag1 = false; + } + if (j2 - num2 <= 5 || j2 - num2 >= 40) + return false; + for (int i3 = i2; i3 <= i2 + 1; ++i3) + { + for (int j3 = num2; j3 <= j2; ++j3) + { + if (WorldGen.SolidTileUnsafe(i3, j3)) + WorldGen.KillTile(i3, j3); + } + } + for (int i3 = i2 - 2; i3 <= i2 + 3; ++i3) + { + for (int j3 = num2 - 2; j3 <= num2 + 3; ++j3) + { + if (WorldGen.SolidTileUnsafe(i3, j3)) + Main.tile[i3, j3].type = (byte) 1; + } + } + WorldGen.PlaceTile(i1, j2, 135, true, true, -1, WorldGen.genRand.Next(2, 4)); + WorldGen.PlaceTile(i2, num2 + 2, 130, true, false, -1, 0); + WorldGen.PlaceTile(i2 + 1, num2 + 2, 130, true, false, -1, 0); + WorldGen.PlaceTile(i2 + 1, num2 + 1, 138, true, false, -1, 0); + int index1 = num2 + 2; + Main.tile[i2, index1].wire = 16; + Main.tile[i2 + 1, index1].wire = 16; + int j4 = index1 + 1; + WorldGen.PlaceTile(i2, j4, 130, true, false, -1, 0); + WorldGen.PlaceTile(i2 + 1, j4, 130, true, false, -1, 0); + Main.tile[i2, j4].wire = 16; + Main.tile[i2 + 1, j4].wire = 16; + WorldGen.PlaceTile(i2, j4 + 1, 130, true, false, -1, 0); + WorldGen.PlaceTile(i2 + 1, j4 + 1, 130, true, false, -1, 0); + Main.tile[i2, j4 + 1].wire = 16; + Main.tile[i2 + 1, j4 + 1].wire = 16; + int index2 = i1; + int index3 = j2; + while (index2 != i2 || index3 != j4) + { + Main.tile[index2, index3].wire = 16; + if (index2 > i2) + --index2; + if (index2 < i2) + ++index2; + Main.tile[index2, index3].wire = 16; + if (index3 > j4) + --index3; + if (index3 < j4) + ++index3; + Main.tile[index2, index3].wire = 16; + } + return true; + } + else + { + if (type == 2) + { + int num = Main.rand.Next(4, 7); + int i2 = i1 + Main.rand.Next(-1, 2); + int j3 = j2; + for (int index = 0; index < num; ++index) + { + ++j3; + if (!WorldGen.SolidTileUnsafe(i2, j3)) + return false; + } + for (int i3 = i2 - 2; i3 <= i2 + 2; ++i3) + { + for (int j4 = j3 - 2; j4 <= j3 + 2; ++j4) + { + if (!WorldGen.SolidTileUnsafe(i3, j4)) + return false; + } + } + WorldGen.KillTile(i2, j3); + Main.tile[i2, j3].active = (byte) 1; + Main.tile[i2, j3].type = (byte) 141; + Main.tile[i2, j3].frameX = (short) 0; + Main.tile[i2, j3].frameY = (short) (18 * Main.rand.Next(2)); + WorldGen.PlaceTile(i1, j2, 135, true, true, -1, WorldGen.genRand.Next(2, 4)); + int index1 = i1; + int index2 = j2; + while (index1 != i2 || index2 != j3) + { + Main.tile[index1, index2].wire = 16; + if (index1 > i2) + --index1; + if (index1 < i2) + ++index1; + Main.tile[index1, index2].wire = 16; + if (index2 > j3) + --index2; + if (index2 < j3) + ++index2; + Main.tile[index1, index2].wire = 16; + } + } + return false; + } + } + + public static unsafe void generateWorld(int seed = -1) + { + Time.checkXMas(); + NPC.clrNames(); + NPC.setNames(); + WorldGen.gen = true; + WorldGen.resetGen(); + UI.main.FirstProgressStep(47, Lang.gen[0]); + if (seed > 0) + WorldGen.genRand = new FastRandom((uint) seed); + Main.worldID = WorldGen.genRand.Next(); + Main.worldTimestamp = (int) (DateTime.UtcNow.Ticks / 10000000L); + int num1 = 0; + int num2 = 0; + float num3 = (float) Main.maxTilesY * 0.3f * ((float) WorldGen.genRand.Next(90, 110) * 0.005f); + float num4 = (num3 + (float) Main.maxTilesY * 0.2f) * ((float) WorldGen.genRand.Next(90, 110) * 0.01f); + float num5 = num3; + float num6 = num3; + float num7 = num4; + float num8 = num4; + int num9 = (WorldGen.genRand.Next(2) << 1) - 1; + float num10 = 1f / (float) Main.maxTilesX; + Tile[,] tileArray; + // ISSUE: cast to a reference type + // ISSUE: explicit reference operation + fixed (Tile* tilePtr1 = &^((tileArray = Main.tile) == null || tileArray.Length == 0 ? (Tile&) IntPtr.Zero : tileArray.Address(0, 0))) + { + for (int index = 0; index < (int) Main.maxTilesX; ++index) + { + UI.main.progress = (float) index * num10; + if ((double) num3 < (double) num5) + num5 = num3; + if ((double) num3 > (double) num6) + num6 = num3; + if ((double) num4 < (double) num7) + num7 = num4; + if ((double) num4 > (double) num8) + num8 = num4; + if (--num2 <= 0) + { + num1 = WorldGen.genRand.Next(5); + num2 = WorldGen.genRand.Next(5, 40); + if (num1 == 0) + num2 *= WorldGen.genRand.Next(1, 6); + } + switch (num1) + { + case 0: + while (WorldGen.genRand.Next(7) == 0) + num3 += (float) WorldGen.genRand.Next(-1, 2); + break; + case 1: + while (WorldGen.genRand.Next(4) == 0) + --num3; + while (WorldGen.genRand.Next(10) == 0) + ++num3; + break; + case 2: + while (WorldGen.genRand.Next(4) == 0) + ++num3; + while (WorldGen.genRand.Next(10) == 0) + --num3; + break; + case 3: + while (WorldGen.genRand.Next(2) == 0) + --num3; + while (WorldGen.genRand.Next(6) == 0) + ++num3; + break; + default: + while (WorldGen.genRand.Next(2) == 0) + ++num3; + while (WorldGen.genRand.Next(5) == 0) + --num3; + break; + } + if ((double) num3 < (double) Main.maxTilesY * 0.170000001788139) + { + num3 = (float) Main.maxTilesY * 0.17f; + num2 = 0; + } + else if ((double) num3 > (double) Main.maxTilesY * 0.300000011920929) + { + num3 = (float) Main.maxTilesY * 0.3f; + num2 = 0; + } + if ((index < 275 || index > (int) Main.maxTilesX - 275) && (double) num3 > (double) ((int) Main.maxTilesY >> 2)) + { + num3 = (float) ((int) Main.maxTilesY >> 2); + num2 = 1; + } + while (WorldGen.genRand.Next(3) == 0) + num4 += (float) WorldGen.genRand.Next(-2, 3); + if ((double) num4 < (double) num3 + (double) Main.maxTilesY * 0.05) + ++num4; + else if ((double) num4 > (double) num3 + (double) Main.maxTilesY * 0.35) + --num4; + int num11 = (int) Main.maxTilesY - 1; + Tile* tilePtr2 = tilePtr1 + (index * 1440 + num11); + do + { + tilePtr2->active = (byte) 1; + tilePtr2->type = num11 < (int) num4 ? (byte) 0 : (byte) 1; + tilePtr2->frameX = (short) -1; + tilePtr2->frameY = (short) -1; + --tilePtr2; + } + while (--num11 >= (int) num3); + do + { + tilePtr2->active = (byte) 0; + tilePtr2->frameX = (short) -1; + tilePtr2->frameY = (short) -1; + --tilePtr2; + } + while (--num11 >= 0); + } + Main.worldSurface = (int) num6 + 25; + Main.worldSurfacePixels = Main.worldSurface << 4; + int num12 = (int) (((double) num8 - (double) num6 + 25.0) * 0.16666667163372) * 6; + Main.rockLayer = Main.worldSurface + num12; + Main.rockLayerPixels = Main.rockLayer << 4; + WorldGen.UpdateMagmaLayerPos(); + WorldGen.waterLine = Main.rockLayer + (int) Main.maxTilesY >> 1; + WorldGen.waterLine += WorldGen.genRand.Next(-100, 20); + WorldGen.lavaLine = WorldGen.waterLine + WorldGen.genRand.Next(50, 80); + int num13 = 0; + Location[] locationArray = new Location[10]; + for (int index1 = 0; index1 < (int) ((double) Main.maxTilesX * 0.00150000001303852); ++index1) + { + int index2 = WorldGen.genRand.Next(450, (int) Main.maxTilesX - 450); + int index3 = 0; + for (int index4 = 0; index4 < 10; ++index4) + { + while ((int) Main.tile[index2, index3].active == 0) + ++index3; + locationArray[index4].X = (short) index2; + locationArray[index4].Y = (short) (index3 - WorldGen.genRand.Next(11, 16)); + index2 += WorldGen.genRand.Next(5, 11); + } + for (int index4 = 0; index4 < 10; ++index4) + { + WorldGen.TileRunner((int) locationArray[index4].X, (int) locationArray[index4].Y, WorldGen.genRand.Next(5, 8), WorldGen.genRand.Next(6, 9), 0, true, new Vector2(-2f, -0.3f), false, true); + WorldGen.TileRunner((int) locationArray[index4].X, (int) locationArray[index4].Y, WorldGen.genRand.Next(5, 8), WorldGen.genRand.Next(6, 9), 0, true, new Vector2(2f, -0.3f), false, true); + } + } + UI.main.NextProgressStep(Lang.gen[1]); + int num14 = 2 + WorldGen.genRand.Next((int) ((double) Main.maxTilesX * 0.0007999999797903), (int) ((double) Main.maxTilesX * (1.0 / 400.0))); + for (int index1 = 0; index1 < num14; ++index1) + { + int num11 = WorldGen.genRand.Next((int) Main.maxTilesX); + while ((double) num11 > (double) Main.maxTilesX * 0.400000005960464 && (double) num11 < (double) Main.maxTilesX * 0.600000023841858) + num11 = WorldGen.genRand.Next((int) Main.maxTilesX); + int num15 = WorldGen.genRand.Next(35, 90); + if (index1 == 1) + { + float num16 = (float) Main.maxTilesX * 0.0002380952f; + num15 += (int) ((double) WorldGen.genRand.Next(20, 40) * (double) num16); + } + if (WorldGen.genRand.Next(3) == 0) + num15 *= 2; + if (index1 == 1) + num15 *= 2; + int num17 = num11 - num15; + int num18 = WorldGen.genRand.Next(35, 90); + if (WorldGen.genRand.Next(3) == 0) + num18 *= 2; + if (index1 == 1) + num18 *= 2; + int num19 = num11 + num18; + if (num17 < 0) + num17 = 0; + if (num19 > (int) Main.maxTilesX) + num19 = (int) Main.maxTilesX; + if (index1 == 0) + { + num17 = 0; + num19 = WorldGen.genRand.Next(260, 300); + if (num9 == 1) + num19 += 40; + } + else if (index1 == 2) + { + num17 = (int) Main.maxTilesX - WorldGen.genRand.Next(260, 300); + num19 = (int) Main.maxTilesX; + if (num9 == -1) + num17 -= 40; + } + int num20 = WorldGen.genRand.Next(50, 100); + for (int index2 = num17; index2 < num19; ++index2) + { + if (WorldGen.genRand.Next(2) == 0) + { + num20 += WorldGen.genRand.Next(-1, 2); + if (num20 < 50) + num20 = 50; + if (num20 > 100) + num20 = 100; + } + for (int index3 = 0; index3 < Main.worldSurface; ++index3) + { + if ((int) Main.tile[index2, index3].active != 0) + { + int num16 = num20; + if (index2 - num17 < num16) + num16 = index2 - num17; + if (num19 - index2 < num16) + num16 = num19 - index2; + int num21 = num16 + WorldGen.genRand.Next(5); + for (int index4 = index3; index4 < index3 + num21; ++index4) + { + if (index2 > num17 + WorldGen.genRand.Next(5) && index2 < num19 - WorldGen.genRand.Next(5)) + Main.tile[index2, index4].type = (byte) 53; + } + break; + } + } + } + } + for (int index = (int) ((double) ((int) Main.maxTilesX * (int) Main.maxTilesY) * 7.99999997980194E-06); index > 0; --index) + WorldGen.TileRunner(WorldGen.genRand.Next((int) Main.maxTilesX), WorldGen.genRand.Next(Main.worldSurface, Main.rockLayer), WorldGen.genRand.Next(15, 70), WorldGen.genRand.Next(20, 130), 53, false, new Vector2(), false, true); + WorldGen.numMCaves = 0; + UI.main.NextProgressStep(Lang.gen[2]); + for (int index1 = 0; index1 < (int) ((double) Main.maxTilesX * 0.0007999999797903); ++index1) + { + int num11 = 0; + bool flag1 = false; + int i = WorldGen.genRand.Next((int) ((double) Main.maxTilesX * 0.25), (int) ((double) Main.maxTilesX * 0.75)); + bool flag2; + do + { + flag2 = true; + while (i > ((int) Main.maxTilesX >> 1) - 100 && i < ((int) Main.maxTilesX >> 1) + 100) + i = WorldGen.genRand.Next((int) ((double) Main.maxTilesX * 0.25), (int) ((double) Main.maxTilesX * 0.75)); + for (int index2 = 0; index2 < WorldGen.numMCaves; ++index2) + { + if (i > (int) WorldGen.mCave[index2].X - 50 && i < (int) WorldGen.mCave[index2].X + 50) + { + ++num11; + flag2 = false; + break; + } + } + if (num11 >= 200) + { + flag1 = true; + break; + } + } + while (!flag2); + if (!flag1) + { + for (int j = 0; j < Main.worldSurface; ++j) + { + if ((int) Main.tile[i, j].active != 0) + { + WorldGen.Mountinater(i, j); + WorldGen.mCave[WorldGen.numMCaves].X = (short) i; + WorldGen.mCave[WorldGen.numMCaves].Y = (short) j; + ++WorldGen.numMCaves; + break; + } + } + } + } + bool flag3 = Time.xMas; + if (WorldGen.genRand.Next(3) == 0) + flag3 = true; + if (flag3) + { + UI.main.statusText = Lang.gen[56]; + int num11 = WorldGen.genRand.Next((int) Main.maxTilesX / 3, ((int) Main.maxTilesX << 1) / 3); + int num15 = WorldGen.genRand.Next(35, 90); + float num16 = (float) Main.maxTilesX * 0.0004761905f; + int num17 = num15 + (int) ((double) WorldGen.genRand.Next(20, 40) * (double) num16); + int num18 = num11 - num17; + if (num18 < 0) + num18 = 0; + int num19 = WorldGen.genRand.Next(35, 90) + (int) ((double) WorldGen.genRand.Next(20, 40) * (double) num16); + int num20 = num11 + num19; + if (num20 > (int) Main.maxTilesX) + num20 = (int) Main.maxTilesX; + int num21 = WorldGen.genRand.Next(50, 100); + for (int index1 = num18; index1 < num20; ++index1) + { + if (WorldGen.genRand.Next(2) == 0) + { + num21 += WorldGen.genRand.Next(-1, 2); + if (num21 < 50) + num21 = 50; + if (num21 > 100) + num21 = 100; + } + for (int index2 = 0; index2 < Main.worldSurface; ++index2) + { + if ((int) Main.tile[index1, index2].active != 0) + { + int num22 = num21; + if (index1 - num18 < num22) + num22 = index1 - num18; + if (num20 - index1 < num22) + num22 = num20 - index1; + int num23 = num22 + WorldGen.genRand.Next(5); + for (int index3 = index2; index3 < index2 + num23; ++index3) + { + if (index1 > num18 + WorldGen.genRand.Next(5) && index1 < num20 - WorldGen.genRand.Next(5)) + Main.tile[index1, index3].type = (byte) 147; + } + break; + } + } + } + } + UI.main.NextProgressStep(Lang.gen[3]); + for (int index1 = 1; index1 < (int) Main.maxTilesX - 1; ++index1) + { + UI.main.progress = (float) index1 / (float) Main.maxTilesX; + bool flag1 = false; + num13 += WorldGen.genRand.Next(-1, 2); + if (num13 < 0) + num13 = 0; + if (num13 > 10) + num13 = 10; + for (int index2 = 0; index2 < Main.worldSurface + 10 && index2 <= Main.worldSurface + num13; ++index2) + { + if (flag1) + Main.tile[index1, index2].wall = (byte) 2; + if ((int) Main.tile[index1, index2].active != 0 && (int) Main.tile[index1 - 1, index2].active != 0 && ((int) Main.tile[index1 + 1, index2].active != 0 && (int) Main.tile[index1, index2 + 1].active != 0) && ((int) Main.tile[index1 - 1, index2 + 1].active != 0 && (int) Main.tile[index1 + 1, index2 + 1].active != 0)) + flag1 = true; + } + } + UI.main.NextProgressStep(Lang.gen[4]); + for (int index = 0; index < (int) ((double) ((int) Main.maxTilesX * (int) Main.maxTilesY) * 0.000199999994947575); ++index) + WorldGen.TileRunner(WorldGen.genRand.Next((int) Main.maxTilesX), WorldGen.genRand.Next((int) num5 + 1), WorldGen.genRand.Next(4, 15), WorldGen.genRand.Next(5, 40), 1, false, new Vector2(), false, true); + for (int index = 0; index < (int) ((double) ((int) Main.maxTilesX * (int) Main.maxTilesY) * 0.000199999994947575); ++index) + WorldGen.TileRunner(WorldGen.genRand.Next((int) Main.maxTilesX), WorldGen.genRand.Next((int) num5, (int) num6 + 1), WorldGen.genRand.Next(4, 10), WorldGen.genRand.Next(5, 30), 1, false, new Vector2(), false, true); + for (int index = 0; index < (int) ((double) ((int) Main.maxTilesX * (int) Main.maxTilesY) * 0.0044999998062849); ++index) + WorldGen.TileRunner(WorldGen.genRand.Next((int) Main.maxTilesX), WorldGen.genRand.Next((int) num6, (int) num8 + 1), WorldGen.genRand.Next(2, 7), WorldGen.genRand.Next(2, 23), 1, false, new Vector2(), false, true); + UI.main.NextProgressStep(Lang.gen[5]); + for (int index = 0; index < (int) ((double) ((int) Main.maxTilesX * (int) Main.maxTilesY) * 0.00499999988824129); ++index) + WorldGen.TileRunner(WorldGen.genRand.Next((int) Main.maxTilesX), WorldGen.genRand.Next((int) num7, (int) Main.maxTilesY), WorldGen.genRand.Next(2, 6), WorldGen.genRand.Next(2, 40), 0, false, new Vector2(), false, true); + UI.main.NextProgressStep(Lang.gen[6]); + for (int index = 0; index < (int) ((double) ((int) Main.maxTilesX * (int) Main.maxTilesY) * 1.99999994947575E-05); ++index) + WorldGen.TileRunner(WorldGen.genRand.Next((int) Main.maxTilesX), WorldGen.genRand.Next((int) num5), WorldGen.genRand.Next(4, 14), WorldGen.genRand.Next(10, 50), 40, false, new Vector2(), false, true); + for (int index = 0; index < (int) ((double) ((int) Main.maxTilesX * (int) Main.maxTilesY) * 4.99999987368938E-05); ++index) + WorldGen.TileRunner(WorldGen.genRand.Next((int) Main.maxTilesX), WorldGen.genRand.Next((int) num5, (int) num6 + 1), WorldGen.genRand.Next(8, 14), WorldGen.genRand.Next(15, 45), 40, false, new Vector2(), false, true); + for (int index = 0; index < (int) ((double) ((int) Main.maxTilesX * (int) Main.maxTilesY) * 1.99999994947575E-05); ++index) + WorldGen.TileRunner(WorldGen.genRand.Next((int) Main.maxTilesX), WorldGen.genRand.Next((int) num6, (int) num8 + 1), WorldGen.genRand.Next(8, 15), WorldGen.genRand.Next(5, 50), 40, false, new Vector2(), false, true); + for (int index1 = 5; index1 < (int) Main.maxTilesX - 5; ++index1) + { + for (int index2 = 1; index2 < Main.worldSurface - 1; ++index2) + { + if ((int) Main.tile[index1, index2].active != 0) + { + for (int index3 = index2; index3 < index2 + 5; ++index3) + { + if ((int) Main.tile[index1, index3].type == 40) + Main.tile[index1, index3].type = (byte) 0; + } + break; + } + } + } + UI.main.NextProgressStep(Lang.gen[7]); + int num24 = (int) ((double) ((int) Main.maxTilesX * (int) Main.maxTilesY) * 0.00150000001303852); + for (int index = 0; index < num24; ++index) + { + UI.main.progress = (float) index / (float) num24; + int type = -1; + if (WorldGen.genRand.Next(5) == 0) + type = -2; + WorldGen.TileRunner(WorldGen.genRand.Next((int) Main.maxTilesX), WorldGen.genRand.Next((int) num6, (int) Main.maxTilesY), WorldGen.genRand.Next(2, 5), WorldGen.genRand.Next(2, 20), type, false, new Vector2(), false, true); + WorldGen.TileRunner(WorldGen.genRand.Next((int) Main.maxTilesX), WorldGen.genRand.Next((int) num6, (int) Main.maxTilesY), WorldGen.genRand.Next(8, 15), WorldGen.genRand.Next(7, 30), type, false, new Vector2(), false, true); + } + if ((double) num8 <= (double) Main.maxTilesY) + { + UI.main.NextProgressStep(Lang.gen[8]); + int num11 = (int) ((double) ((int) Main.maxTilesX * (int) Main.maxTilesY) * 2.99999992421363E-05); + for (int index = 0; index < num11; ++index) + { + UI.main.progress = (float) index / (float) num11; + int type = -1; + if (WorldGen.genRand.Next(6) == 0) + type = -2; + WorldGen.TileRunner(WorldGen.genRand.Next((int) Main.maxTilesX), WorldGen.genRand.Next((int) num5, (int) num8 + 1), WorldGen.genRand.Next(5, 15), WorldGen.genRand.Next(30, 200), type, false, new Vector2(), false, true); + } + } + if ((double) num8 <= (double) Main.maxTilesY) + { + UI.main.NextProgressStep(Lang.gen[9]); + int num11 = (int) ((double) ((int) Main.maxTilesX * (int) Main.maxTilesY) * 0.000130000000353903); + for (int index = 0; index < num11; ++index) + { + UI.main.progress = (float) index / (float) num11; + int type = -1; + if (WorldGen.genRand.Next(10) == 0) + type = -2; + WorldGen.TileRunner(WorldGen.genRand.Next((int) Main.maxTilesX), WorldGen.genRand.Next((int) num8, (int) Main.maxTilesY), WorldGen.genRand.Next(6, 20), WorldGen.genRand.Next(50, 300), type, false, new Vector2(), false, true); + } + } + UI.main.NextProgressStep(Lang.gen[10]); + int num25 = (int) ((double) Main.maxTilesX * (1.0 / 400.0)); + for (int index = 0; index < num25; ++index) + { + int i = WorldGen.genRand.Next((int) Main.maxTilesX); + for (int j = 0; (double) j < (double) num6; ++j) + { + if ((int) Main.tile[i, j].active != 0) + { + WorldGen.TileRunner(i, j, WorldGen.genRand.Next(3, 6), WorldGen.genRand.Next(5, 50), -1, false, new Vector2((float) WorldGen.genRand.Next(-10, 11) * 0.1f, 1f), false, true); + break; + } + } + } + int num26 = (int) ((double) Main.maxTilesX * 0.000699999975040555); + for (int index = 0; index < num26; ++index) + { + int i = WorldGen.genRand.Next((int) Main.maxTilesX); + for (int j = 0; (double) j < (double) num6; ++j) + { + if ((int) Main.tile[i, j].active != 0) + { + WorldGen.TileRunner(i, j, WorldGen.genRand.Next(10, 15), WorldGen.genRand.Next(50, 130), -1, false, new Vector2((float) WorldGen.genRand.Next(-10, 11) * 0.1f, 2f), false, true); + break; + } + } + } + int num27 = (int) ((double) Main.maxTilesX * 0.000300000014249235); + for (int index = 0; index < num27; ++index) + { + int i = WorldGen.genRand.Next((int) Main.maxTilesX); + for (int j = 0; (double) j < (double) num6; ++j) + { + if ((int) Main.tile[i, j].active != 0) + { + WorldGen.TileRunner(i, j, WorldGen.genRand.Next(12, 25), WorldGen.genRand.Next(150, 500), -1, false, new Vector2((float) WorldGen.genRand.Next(-10, 11) * 0.1f, 4f), false, true); + WorldGen.TileRunner(i, j, WorldGen.genRand.Next(8, 17), WorldGen.genRand.Next(60, 200), -1, false, new Vector2((float) WorldGen.genRand.Next(-10, 11) * 0.1f, 2f), false, true); + WorldGen.TileRunner(i, j, WorldGen.genRand.Next(5, 13), WorldGen.genRand.Next(40, 170), -1, false, new Vector2((float) WorldGen.genRand.Next(-10, 11) * 0.1f, 2f), false, true); + break; + } + } + } + int num28 = (int) ((double) Main.maxTilesX * 0.00039999998989515); + for (int index = 0; index < num28; ++index) + { + int i = WorldGen.genRand.Next((int) Main.maxTilesX); + for (int j = 0; (double) j < (double) num6; ++j) + { + if ((int) Main.tile[i, j].active != 0) + { + WorldGen.TileRunner(i, j, WorldGen.genRand.Next(7, 12), WorldGen.genRand.Next(150, 250), -1, false, new Vector2(0.0f, 1f), true, true); + break; + } + } + } + int num29 = (int) ((double) Main.maxTilesX * (1.0 / 840.0)); + for (int index = 0; index < num29; ++index) + WorldGen.Caverer(WorldGen.genRand.Next(100, (int) Main.maxTilesX - 100), WorldGen.genRand.Next(Main.rockLayer, (int) Main.maxTilesY - 400)); + int num30 = (int) ((double) ((int) Main.maxTilesX * (int) Main.maxTilesY) * (1.0 / 500.0)); + for (int index1 = 0; index1 < num30; ++index1) + { + int index2 = WorldGen.genRand.Next(1, (int) Main.maxTilesX - 1); + int index3 = WorldGen.genRand.Next((int) num5, (int) num6); + if (index3 >= (int) Main.maxTilesY) + index3 = (int) Main.maxTilesY - 2; + if ((int) Main.tile[index2 - 1, index3].active != 0 && (int) Main.tile[index2 - 1, index3].type == 0 && ((int) Main.tile[index2 + 1, index3].active != 0 && (int) Main.tile[index2 + 1, index3].type == 0) && ((int) Main.tile[index2, index3 - 1].active != 0 && (int) Main.tile[index2, index3 - 1].type == 0 && ((int) Main.tile[index2, index3 + 1].active != 0 && (int) Main.tile[index2, index3 + 1].type == 0))) + { + Main.tile[index2, index3].active = (byte) 1; + Main.tile[index2, index3].type = (byte) 2; + } + int index4 = WorldGen.genRand.Next(1, (int) Main.maxTilesX - 1); + int index5 = WorldGen.genRand.Next((int) num5); + if (index5 >= (int) Main.maxTilesY) + index5 = (int) Main.maxTilesY - 2; + if ((int) Main.tile[index4 - 1, index5].active != 0 && (int) Main.tile[index4 - 1, index5].type == 0 && ((int) Main.tile[index4 + 1, index5].active != 0 && (int) Main.tile[index4 + 1, index5].type == 0) && ((int) Main.tile[index4, index5 - 1].active != 0 && (int) Main.tile[index4, index5 - 1].type == 0 && ((int) Main.tile[index4, index5 + 1].active != 0 && (int) Main.tile[index4, index5 + 1].type == 0))) + { + Main.tile[index4, index5].active = (byte) 1; + Main.tile[index4, index5].type = (byte) 2; + } + } + UI.main.NextProgressStep(Lang.gen[11]); + float num31 = (float) WorldGen.genRand.Next(15, 30) * 0.01f; + if (num9 == -1) + num31 = 1f - num31; + int num32 = (int) ((double) Main.maxTilesX * (double) num31); + int num33 = (int) Main.maxTilesY + Main.rockLayer >> 1; + float num34 = (float) Main.maxTilesX * 0.0003571429f; + int i1 = num32 + WorldGen.genRand.Next((int) (-100.0 * (double) num34), (int) (101.0 * (double) num34)); + int j1 = num33 + WorldGen.genRand.Next((int) (-100.0 * (double) num34), (int) (101.0 * (double) num34)); + int num35 = i1; + int num36 = j1; + WorldGen.TileRunner(i1, j1, WorldGen.genRand.Next((int) (250.0 * (double) num34), (int) (500.0 * (double) num34)), WorldGen.genRand.Next(50, 150), 59, false, new Vector2((float) (num9 * 3), 0.0f), false, true); + for (int index = (int) (6.0 * (double) num34); index > 0; --index) + WorldGen.TileRunner(i1 + WorldGen.genRand.Next(-(int) (125.0 * (double) num34), (int) (125.0 * (double) num34)), j1 + WorldGen.genRand.Next(-(int) (125.0 * (double) num34), (int) (125.0 * (double) num34)), WorldGen.genRand.Next(3, 7), WorldGen.genRand.Next(3, 8), WorldGen.genRand.Next(63, 65), false, new Vector2(), false, true); + UI.main.progress = 0.15f; + int i2 = i1 + WorldGen.genRand.Next((int) (-250.0 * (double) num34), (int) (251.0 * (double) num34)); + int j2 = j1 + WorldGen.genRand.Next((int) (-150.0 * (double) num34), (int) (151.0 * (double) num34)); + int num37 = i2; + int num38 = j2; + int num39 = i2; + int num40 = j2; + WorldGen.mudWall = true; + WorldGen.TileRunner(i2, j2, WorldGen.genRand.Next((int) (250.0 * (double) num34), (int) (500.0 * (double) num34)), WorldGen.genRand.Next(50, 150), 59, false, new Vector2(), false, true); + WorldGen.mudWall = false; + for (int index = (int) (6.0 * (double) num34); index > 0; --index) + WorldGen.TileRunner(i2 + WorldGen.genRand.Next(-(int) (125.0 * (double) num34), (int) (125.0 * (double) num34)), j2 + WorldGen.genRand.Next(-(int) (125.0 * (double) num34), (int) (125.0 * (double) num34)), WorldGen.genRand.Next(3, 7), WorldGen.genRand.Next(3, 8), WorldGen.genRand.Next(65, 67), false, new Vector2(), false, true); + WorldGen.mudWall = true; + UI.main.progress = 0.3f; + int i3 = i2 + WorldGen.genRand.Next((int) (-400.0 * (double) num34), (int) (401.0 * (double) num34)); + int j3 = j2 + WorldGen.genRand.Next((int) (-150.0 * (double) num34), (int) (151.0 * (double) num34)); + int num41 = i3; + int num42 = j3; + WorldGen.TileRunner(i3, j3, WorldGen.genRand.Next((int) (250.0 * (double) num34), (int) (500.0 * (double) num34)), WorldGen.genRand.Next(50, 150), 59, false, new Vector2((float) (num9 * -3), 0.0f), false, true); + WorldGen.mudWall = false; + for (int index = (int) (6.0 * (double) num34); index > 0; --index) + WorldGen.TileRunner(i3 + WorldGen.genRand.Next(-(int) (125.0 * (double) num34), (int) (125.0 * (double) num34)), j3 + WorldGen.genRand.Next(-(int) (125.0 * (double) num34), (int) (125.0 * (double) num34)), WorldGen.genRand.Next(3, 7), WorldGen.genRand.Next(3, 8), WorldGen.genRand.Next(67, 69), false, new Vector2(), false, true); + WorldGen.mudWall = true; + UI.main.progress = 0.45f; + int i4 = (num35 + num37 + num41) / 3; + int j4 = (num36 + num38 + num42) / 3; + WorldGen.TileRunner(i4, j4, WorldGen.genRand.Next((int) (400.0 * (double) num34), (int) (600.0 * (double) num34)), 10000, 59, false, new Vector2(0.0f, -20f), true, true); + WorldGen.JungleRunner(i4, j4); + UI.main.progress = 0.6f; + WorldGen.mudWall = false; + List list = new List(); + int num43 = 0; + for (int index1 = 20; index1 < (int) Main.maxTilesX - 20; ++index1) + { + for (int index2 = Main.rockLayer; index2 < (int) Main.maxTilesY - 200; ++index2) + { + if ((int) Main.tile[index1, index2].wall == 15) + { + list.Add((uint) (i4 << 16 | j4)); + ++num43; + } + } + } + for (int index1 = 0; num43 > 0 && index1 < (int) Main.maxTilesX / 10; ++index1) + { + int index2 = WorldGen.genRand.Next(num43--); + int i5 = (int) (list[index2] >> 16); + int j5 = (int) list[index2] & (int) ushort.MaxValue; + list.RemoveAt(index2); + WorldGen.MudWallRunner(i5, j5); + } + int i6 = num39; + int j6 = num40; + int num44 = (int) (20.0 * (double) num34); + for (int index = 0; index <= num44; ++index) + { + UI.main.progress = (float) (0.600000023841858 + 0.200000002980232 * ((double) index / (double) num44)); + i6 += WorldGen.genRand.Next((int) (-5.0 * (double) num34), (int) (6.0 * (double) num34)); + j6 += WorldGen.genRand.Next((int) (-5.0 * (double) num34), (int) (6.0 * (double) num34)); + WorldGen.TileRunner(i6, j6, WorldGen.genRand.Next(40, 100), WorldGen.genRand.Next(300, 500), 59, false, new Vector2(), false, true); + } + int num45 = (int) (10.0 * (double) num34); + for (int index1 = 0; index1 <= num45; ++index1) + { + UI.main.progress = (float) (0.800000011920929 + 0.200000002980232 * ((double) index1 / (double) num45)); + int i5 = num39 + WorldGen.genRand.Next((int) (-600.0 * (double) num34), (int) (600.0 * (double) num34)); + int j5; + for (j5 = num40 + WorldGen.genRand.Next((int) (-200.0 * (double) num34), (int) (200.0 * (double) num34)); i5 < 1 || i5 >= (int) Main.maxTilesX - 1 || (j5 < 1 || j5 >= (int) Main.maxTilesY - 1) || (int) Main.tile[i5, j5].type != 59; j5 = num40 + WorldGen.genRand.Next((int) (-200.0 * (double) num34), (int) (200.0 * (double) num34))) + i5 = num39 + WorldGen.genRand.Next((int) (-600.0 * (double) num34), (int) (600.0 * (double) num34)); + for (int index2 = 0; (double) index2 < 8.0 * (double) num34; ++index2) + { + i5 += WorldGen.genRand.Next(-30, 31); + j5 += WorldGen.genRand.Next(-30, 31); + int type = -1; + if (WorldGen.genRand.Next(7) == 0) + type = -2; + WorldGen.TileRunner(i5, j5, WorldGen.genRand.Next(10, 20), WorldGen.genRand.Next(30, 70), type, false, new Vector2(), false, true); + } + } + for (int index = 0; (double) index <= 300.0 * (double) num34; ++index) + { + int i5 = num39 + WorldGen.genRand.Next((int) (-600.0 * (double) num34), (int) (600.0 * (double) num34)); + int j5; + for (j5 = num40 + WorldGen.genRand.Next((int) (-200.0 * (double) num34), (int) (200.0 * (double) num34)); i5 < 1 || i5 >= (int) Main.maxTilesX - 1 || (j5 < 1 || j5 >= (int) Main.maxTilesY - 1) || (int) Main.tile[i5, j5].type != 59; j5 = num40 + WorldGen.genRand.Next((int) (-200.0 * (double) num34), (int) (200.0 * (double) num34))) + i5 = num39 + WorldGen.genRand.Next((int) (-600.0 * (double) num34), (int) (600.0 * (double) num34)); + WorldGen.TileRunner(i5, j5, WorldGen.genRand.Next(4, 10), WorldGen.genRand.Next(5, 30), 1, false, new Vector2(), false, true); + if (WorldGen.genRand.Next(4) == 0) + { + int type = WorldGen.genRand.Next(63, 69); + WorldGen.TileRunner(i5 + WorldGen.genRand.Next(-1, 2), j5 + WorldGen.genRand.Next(-1, 2), WorldGen.genRand.Next(3, 7), WorldGen.genRand.Next(4, 8), type, false, new Vector2(), false, true); + } + } + for (int index1 = (int) ((double) (WorldGen.genRand.Next(6, 10) * (int) Main.maxTilesX) * 0.000238095235545188) - 1; index1 >= 0; --index1) + { + int index2; + int index3; + do + { + index2 = WorldGen.genRand.Next(20, (int) Main.maxTilesX - 20); + index3 = WorldGen.genRand.Next(Main.worldSurface + Main.rockLayer >> 1, (int) Main.maxTilesY - 300); + } + while ((int) Main.tile[index2, index3].type != 59); + int num11 = WorldGen.genRand.Next(2, 4); + int num15 = WorldGen.genRand.Next(2, 4); + for (int index4 = index2 - num11 - 1; index4 <= index2 + num11 + 1; ++index4) + { + for (int index5 = index3 - num15 - 1; index5 <= index3 + num15 + 1; ++index5) + { + Main.tile[index4, index5].active = (byte) 1; + Main.tile[index4, index5].type = (byte) 45; + Main.tile[index4, index5].liquid = (byte) 0; + Main.tile[index4, index5].lava = (byte) 0; + } + } + for (int index4 = index2 - num11; index4 <= index2 + num11; ++index4) + { + for (int index5 = index3 - num15; index5 <= index3 + num15; ++index5) + Main.tile[index4, index5].active = (byte) 0; + } + int num16 = 0; + do + ; + while (!WorldGen.PlaceTile(WorldGen.genRand.Next(index2 - num11, index2 + num11 + 1), WorldGen.genRand.Next(index3 - num15, index3 + num15 - 2), 4, true, false, -1, 0) && ++num16 < 100); + for (int index4 = index3 + num15 - 2; index4 <= index3 + num15 - 1; ++index4) + { + for (int index5 = index2 - num11 - 1; index5 <= index2 + num11 + 1; ++index5) + Main.tile[index5, index4].active = (byte) 0; + } + for (int index4 = index2 - num11 - 1; index4 <= index2 + num11 + 1; ++index4) + { + int num17 = 4; + for (int index5 = index3 + num15 + 2; (int) Main.tile[index4, index5].active == 0 && index5 < (int) Main.maxTilesY && num17 > 0; --num17) + { + Main.tile[index4, index5].active = (byte) 1; + Main.tile[index4, index5].type = (byte) 59; + ++index5; + } + } + int num18 = num11 - WorldGen.genRand.Next(1, 3); + int index6 = index3 - num15 - 2; + while (num18 >= 0) + { + for (int index4 = index2 - num18 - 1; index4 <= index2 + num18 + 1; ++index4) + { + Main.tile[index4, index6].active = (byte) 1; + Main.tile[index4, index6].type = (byte) 45; + } + num18 -= WorldGen.genRand.Next(1, 3); + --index6; + } + WorldGen.JChest[WorldGen.numJChests].X = (short) index2; + WorldGen.JChest[WorldGen.numJChests].Y = (short) index3; + ++WorldGen.numJChests; + } + for (int j5 = 0; j5 < (int) Main.maxTilesY; ++j5) + { + for (int i5 = 0; i5 < (int) Main.maxTilesX; ++i5) + { + if ((int) Main.tile[i5, j5].active != 0) + { + try + { + WorldGen.grassSpread = 0; + WorldGen.SpreadGrass(i5, j5, 59, 60, true); + } + catch + { + WorldGen.grassSpread = 0; + WorldGen.SpreadGrass(i5, j5, 59, 60, false); + } + } + } + } + WorldGen.numIslandHouses = 0; + WorldGen.houseCount = 0; + UI.main.NextProgressStep(Lang.gen[12]); + int num46 = (int) ((double) Main.maxTilesX * 0.0008); + for (int index1 = 0; index1 < num46; ++index1) + { + int num11 = 0; + bool flag1 = false; + int index2 = WorldGen.genRand.Next((int) ((double) Main.maxTilesX * 0.1), (int) ((double) Main.maxTilesX * 0.9)); + bool flag2; + do + { + flag2 = true; + while (index2 > ((int) Main.maxTilesX >> 1) - 80 && index2 < ((int) Main.maxTilesX >> 1) + 80) + index2 = WorldGen.genRand.Next((int) ((double) Main.maxTilesX * 0.1), (int) ((double) Main.maxTilesX * 0.9)); + for (int index3 = 0; index3 < WorldGen.numIslandHouses; ++index3) + { + if (index2 > (int) WorldGen.fih[index3].X - 80 && index2 < (int) WorldGen.fih[index3].X + 80) + { + ++num11; + flag2 = false; + break; + } + } + if (num11 >= 200) + { + flag1 = true; + break; + } + } + while (!flag2); + if (!flag1) + { + for (int index3 = 200; index3 < Main.worldSurface; ++index3) + { + if ((int) Main.tile[index2, index3].active != 0) + { + int i5 = index2; + int j5 = WorldGen.genRand.Next(90, index3 - 100); + while ((double) j5 > (double) num5 - 50.0) + --j5; + WorldGen.FloatingIsland(i5, j5); + WorldGen.fih[WorldGen.numIslandHouses].X = (short) i5; + WorldGen.fih[WorldGen.numIslandHouses].Y = (short) j5; + ++WorldGen.numIslandHouses; + break; + } + } + } + } + UI.main.NextProgressStep(Lang.gen[13]); + for (int index = (int) Main.maxTilesX / 500 - 1; index >= 0; --index) + WorldGen.ShroomPatch(WorldGen.genRand.Next((int) ((double) Main.maxTilesX * 0.300000011920929), (int) ((double) Main.maxTilesX * 0.699999988079071)), WorldGen.genRand.Next(Main.rockLayer, (int) Main.maxTilesY - 249)); + for (int i5 = 0; i5 < (int) Main.maxTilesX; ++i5) + { + for (int j5 = Main.worldSurface; j5 < (int) Main.maxTilesY; ++j5) + { + if ((int) Main.tile[i5, j5].active != 0) + { + WorldGen.grassSpread = 0; + WorldGen.SpreadGrass(i5, j5, 59, 70, false); + } + } + } + UI.main.NextProgressStep(Lang.gen[14]); + int num47 = (int) ((double) ((int) Main.maxTilesX * (int) Main.maxTilesY) * (1.0 / 1000.0)); + for (int index = 0; index < num47; ++index) + WorldGen.TileRunner(WorldGen.genRand.Next((int) Main.maxTilesX), WorldGen.genRand.Next((int) num7, (int) Main.maxTilesY), WorldGen.genRand.Next(2, 6), WorldGen.genRand.Next(2, 40), 59, false, new Vector2(), false, true); + UI.main.NextProgressStep(Lang.gen[15]); + int num48 = (int) ((double) ((int) Main.maxTilesX * (int) Main.maxTilesY) * 9.99999974737875E-05); + for (int index = 0; index < num48; ++index) + WorldGen.TileRunner(WorldGen.genRand.Next((int) Main.maxTilesX), WorldGen.genRand.Next((int) num8, (int) Main.maxTilesY), WorldGen.genRand.Next(5, 12), WorldGen.genRand.Next(15, 50), 123, false, new Vector2(), false, true); + int num49 = (int) ((double) ((int) Main.maxTilesX * (int) Main.maxTilesY) * 0.000500000023748726); + for (int index = 0; index < num49; ++index) + WorldGen.TileRunner(WorldGen.genRand.Next((int) Main.maxTilesX), WorldGen.genRand.Next((int) num8, (int) Main.maxTilesY), WorldGen.genRand.Next(2, 5), WorldGen.genRand.Next(2, 5), 123, false, new Vector2(), false, true); + UI.main.NextProgressStep(Lang.gen[16]); + int num50 = (int) ((double) ((int) Main.maxTilesX * (int) Main.maxTilesY) * 5.99999984842725E-05); + for (int index = 0; index < num50; ++index) + WorldGen.TileRunner(WorldGen.genRand.Next((int) Main.maxTilesX), WorldGen.genRand.Next((int) num5, (int) num6), WorldGen.genRand.Next(3, 6), WorldGen.genRand.Next(2, 6), 7, false, new Vector2(), false, true); + int num51 = (int) ((double) ((int) Main.maxTilesX * (int) Main.maxTilesY) * 7.999999797903E-05); + for (int index = 0; index < num51; ++index) + WorldGen.TileRunner(WorldGen.genRand.Next((int) Main.maxTilesX), WorldGen.genRand.Next((int) num6, (int) num8), WorldGen.genRand.Next(3, 7), WorldGen.genRand.Next(3, 7), 7, false, new Vector2(), false, true); + int num52 = (int) ((double) ((int) Main.maxTilesX * (int) Main.maxTilesY) * 0.000199999994947575); + for (int index = 0; index < num52; ++index) + WorldGen.TileRunner(WorldGen.genRand.Next((int) Main.maxTilesX), WorldGen.genRand.Next((int) num7, (int) Main.maxTilesY), WorldGen.genRand.Next(4, 9), WorldGen.genRand.Next(4, 8), 7, false, new Vector2(), false, true); + int num53 = (int) ((double) ((int) Main.maxTilesX * (int) Main.maxTilesY) * 2.99999992421363E-05); + for (int index = 0; index < num53; ++index) + WorldGen.TileRunner(WorldGen.genRand.Next((int) Main.maxTilesX), WorldGen.genRand.Next((int) num5, (int) num6), WorldGen.genRand.Next(3, 7), WorldGen.genRand.Next(2, 5), 6, false, new Vector2(), false, true); + int num54 = (int) ((double) ((int) Main.maxTilesX * (int) Main.maxTilesY) * 7.999999797903E-05); + for (int index = 0; index < num54; ++index) + WorldGen.TileRunner(WorldGen.genRand.Next((int) Main.maxTilesX), WorldGen.genRand.Next((int) num6, (int) num8), WorldGen.genRand.Next(3, 6), WorldGen.genRand.Next(3, 6), 6, false, new Vector2(), false, true); + int num55 = (int) ((double) ((int) Main.maxTilesX * (int) Main.maxTilesY) * 0.000199999994947575); + for (int index = 0; index < num55; ++index) + WorldGen.TileRunner(WorldGen.genRand.Next((int) Main.maxTilesX), WorldGen.genRand.Next((int) num7, (int) Main.maxTilesY), WorldGen.genRand.Next(4, 9), WorldGen.genRand.Next(4, 8), 6, false, new Vector2(), false, true); + int num56 = (int) ((double) ((int) Main.maxTilesX * (int) Main.maxTilesY) * 2.59999997069826E-05); + for (int index = 0; index < num56; ++index) + WorldGen.TileRunner(WorldGen.genRand.Next((int) Main.maxTilesX), WorldGen.genRand.Next((int) num6, (int) num8), WorldGen.genRand.Next(3, 6), WorldGen.genRand.Next(3, 6), 9, false, new Vector2(), false, true); + int num57 = (int) ((double) ((int) Main.maxTilesX * (int) Main.maxTilesY) * 0.000150000007124618); + for (int index = 0; index < num57; ++index) + WorldGen.TileRunner(WorldGen.genRand.Next((int) Main.maxTilesX), WorldGen.genRand.Next((int) num7, (int) Main.maxTilesY), WorldGen.genRand.Next(4, 9), WorldGen.genRand.Next(4, 8), 9, false, new Vector2(), false, true); + int num58 = (int) ((double) ((int) Main.maxTilesX * (int) Main.maxTilesY) * 0.000169999999343418); + for (int index = 0; index < num58; ++index) + WorldGen.TileRunner(WorldGen.genRand.Next((int) Main.maxTilesX), WorldGen.genRand.Next((int) num5), WorldGen.genRand.Next(4, 9), WorldGen.genRand.Next(4, 8), 9, false, new Vector2(), false, true); + int num59 = (int) ((double) ((int) Main.maxTilesX * (int) Main.maxTilesY) * 0.000119999996968545); + for (int index = 0; index < num59; ++index) + { + WorldGen.TileRunner(WorldGen.genRand.Next((int) Main.maxTilesX), WorldGen.genRand.Next((int) num7, (int) Main.maxTilesY), WorldGen.genRand.Next(4, 8), WorldGen.genRand.Next(4, 8), 8, false, new Vector2(), false, true); + WorldGen.TileRunner(WorldGen.genRand.Next((int) Main.maxTilesX), WorldGen.genRand.Next((int) num5 - 20), WorldGen.genRand.Next(4, 8), WorldGen.genRand.Next(4, 8), 8, false, new Vector2(), false, true); + } + int num60 = (int) ((double) ((int) Main.maxTilesX * (int) Main.maxTilesY) * 1.99999994947575E-05); + for (int index = 0; index < num60; ++index) + WorldGen.TileRunner(WorldGen.genRand.Next((int) Main.maxTilesX), WorldGen.genRand.Next((int) num7, (int) Main.maxTilesY), WorldGen.genRand.Next(2, 4), WorldGen.genRand.Next(3, 6), 22, false, new Vector2(), false, true); + UI.main.NextProgressStep(Lang.gen[17]); + int num61 = (int) ((double) ((int) Main.maxTilesX * (int) Main.maxTilesY) * 0.000600000028498471); + for (int index1 = 0; index1 < num61; ++index1) + { + int index2 = WorldGen.genRand.Next(20, (int) Main.maxTilesX - 20); + int index3 = WorldGen.genRand.Next((int) num5, (int) Main.maxTilesY - 20); + if (index1 < WorldGen.numMCaves) + { + index2 = (int) WorldGen.mCave[index1].X; + index3 = (int) WorldGen.mCave[index1].Y; + } + if ((int) Main.tile[index2, index3].active == 0 && (index3 > Main.worldSurface || (int) Main.tile[index2, index3].wall > 0)) + { + while ((int) Main.tile[index2, index3].active == 0 && index3 > (int) num5) + --index3; + int j5 = index3 + 1; + int num11 = 1; + if (WorldGen.genRand.Next(2) == 0) + num11 = -1; + while ((int) Main.tile[index2, j5].active == 0 && index2 > 10 && index2 < (int) Main.maxTilesX - 10) + index2 += num11; + int i5 = index2 - num11; + if (j5 > Main.worldSurface || (int) Main.tile[i5, j5].wall > 0) + WorldGen.TileRunner(i5, j5, WorldGen.genRand.Next(4, 11), WorldGen.genRand.Next(2, 4), 51, true, new Vector2((float) num11, -1f), false, false); + } + } + UI.main.NextProgressStep(Lang.gen[18]); + int num62 = (int) Main.maxTilesY - WorldGen.genRand.Next(150, 190); + for (int index = 0; index < (int) Main.maxTilesX; ++index) + { + UI.main.progress = (float) index * 0.2f / (float) Main.maxTilesX; + num62 += WorldGen.genRand.Next(-3, 4); + if (num62 < (int) Main.maxTilesY - 190) + num62 = (int) Main.maxTilesY - 190; + else if (num62 > (int) Main.maxTilesY - 160) + num62 = (int) Main.maxTilesY - 160; + int num11 = num62 - 20 - WorldGen.genRand.Next(3); + Tile* tilePtr2 = tilePtr1 + (index * 1440 + num11); + do + { + if (num11 >= num62) + { + tilePtr2->active = (byte) 0; + tilePtr2->lava = (byte) 0; + tilePtr2->liquid = (byte) 0; + } + else + tilePtr2->type = (byte) 57; + ++tilePtr2; + } + while (++num11 < (int) Main.maxTilesY); + } + int num63 = (int) Main.maxTilesY - WorldGen.genRand.Next(40, 70); + for (int index = 10; index < (int) Main.maxTilesX - 10; ++index) + { + num63 += WorldGen.genRand.Next(-10, 11); + if (num63 > (int) Main.maxTilesY - 60) + num63 = (int) Main.maxTilesY - 60; + else if (num63 < (int) Main.maxTilesY - 100) + num63 = (int) Main.maxTilesY - 120; + int num11 = num63; + Tile* tilePtr2 = tilePtr1 + (index * 1440 + num11); + do + { + if ((int) tilePtr2->active == 0) + { + tilePtr2->lava = (byte) 32; + tilePtr2->liquid = byte.MaxValue; + } + } + while (++num11 < (int) Main.maxTilesY - 10); + } + for (int index1 = 0; index1 < (int) Main.maxTilesX; ++index1) + { + if (WorldGen.genRand.Next(50) == 0) + { + int index2 = (int) Main.maxTilesY - 65; + while ((int) Main.tile[index1, index2].active == 0 && index2 > (int) Main.maxTilesY - 135) + --index2; + WorldGen.TileRunner(WorldGen.genRand.Next((int) Main.maxTilesX), index2 + WorldGen.genRand.Next(20, 50), WorldGen.genRand.Next(15, 20), 1000, 57, true, new Vector2(0.0f, (float) WorldGen.genRand.Next(1, 3)), true, true); + UI.main.progress = (float) (0.200000002980232 + (double) ((float) index1 * 0.05f) / (double) Main.maxTilesX); + } + } + Liquid.QuickWater(0.25, 3, -1, 0.25); + for (int i5 = 0; i5 < (int) Main.maxTilesX; ++i5) + { + if (WorldGen.genRand.Next(13) == 0) + { + int index = (int) Main.maxTilesY - 65; + while (((int) Main.tile[i5, index].liquid > 0 || (int) Main.tile[i5, index].active != 0) && index > (int) Main.maxTilesY - 140) + --index; + WorldGen.TileRunner(i5, index - WorldGen.genRand.Next(2, 5), WorldGen.genRand.Next(5, 30), 1000, 57, true, new Vector2(0.0f, (float) WorldGen.genRand.Next(1, 3)), true, true); + int num11 = WorldGen.genRand.Next(1, 3); + if (WorldGen.genRand.Next(3) == 0) + num11 >>= 1; + if (WorldGen.genRand.Next(2) == 0) + WorldGen.TileRunner(i5, index - WorldGen.genRand.Next(2, 5), WorldGen.genRand.Next(5, 15) * num11, WorldGen.genRand.Next(10, 15) * num11, 57, true, new Vector2(1f, 0.3f), false, true); + if (WorldGen.genRand.Next(2) == 0) + { + int num15 = WorldGen.genRand.Next(1, 3); + WorldGen.TileRunner(i5, index - WorldGen.genRand.Next(2, 5), WorldGen.genRand.Next(5, 15) * num15, WorldGen.genRand.Next(10, 15) * num15, 57, true, new Vector2(-1f, 0.3f), false, true); + } + WorldGen.TileRunner(i5 + WorldGen.genRand.Next(-10, 10), index + WorldGen.genRand.Next(-10, 10), WorldGen.genRand.Next(5, 15), WorldGen.genRand.Next(5, 10), -2, false, new Vector2((float) WorldGen.genRand.Next(-1, 3), (float) WorldGen.genRand.Next(-1, 3)), false, true); + if (WorldGen.genRand.Next(3) == 0) + WorldGen.TileRunner(i5 + WorldGen.genRand.Next(-10, 10), index + WorldGen.genRand.Next(-10, 10), WorldGen.genRand.Next(10, 30), WorldGen.genRand.Next(10, 20), -2, false, new Vector2((float) WorldGen.genRand.Next(-1, 3), (float) WorldGen.genRand.Next(-1, 3)), false, true); + if (WorldGen.genRand.Next(5) == 0) + WorldGen.TileRunner(i5 + WorldGen.genRand.Next(-15, 15), index + WorldGen.genRand.Next(-15, 10), WorldGen.genRand.Next(15, 30), WorldGen.genRand.Next(5, 20), -2, false, new Vector2((float) WorldGen.genRand.Next(-1, 3), (float) WorldGen.genRand.Next(-1, 3)), false, true); + UI.main.progress = (float) (0.5 + (double) ((float) i5 * 0.4f) / (double) Main.maxTilesX); + } + } + UI.main.progress = 0.9f; + for (int index = 0; index < (int) Main.maxTilesX; ++index) + WorldGen.TileRunner(WorldGen.genRand.Next(20, (int) Main.maxTilesX - 20), WorldGen.genRand.Next((int) Main.maxTilesY - 180, (int) Main.maxTilesY - 10), WorldGen.genRand.Next(2, 7), WorldGen.genRand.Next(2, 7), -2, false, new Vector2(), false, true); + for (int index = 0; index < (int) Main.maxTilesX; ++index) + { + if ((int) Main.tile[index, (int) Main.maxTilesY - 145].active == 0) + { + Main.tile[index, (int) Main.maxTilesY - 145].liquid = byte.MaxValue; + Main.tile[index, (int) Main.maxTilesY - 145].lava = (byte) 32; + } + if ((int) Main.tile[index, (int) Main.maxTilesY - 144].active == 0) + { + Main.tile[index, (int) Main.maxTilesY - 144].liquid = byte.MaxValue; + Main.tile[index, (int) Main.maxTilesY - 144].lava = (byte) 32; + } + } + UI.main.progress = 0.95f; + int num64 = (int) ((double) ((int) Main.maxTilesX * (int) Main.maxTilesY) * 0.0007999999797903); + for (int index = 0; index < num64; ++index) + WorldGen.TileRunner(WorldGen.genRand.Next((int) Main.maxTilesX), WorldGen.genRand.Next((int) Main.maxTilesY - 140, (int) Main.maxTilesY), WorldGen.genRand.Next(2, 7), WorldGen.genRand.Next(3, 7), 58, false, new Vector2(), false, true); + UI.main.progress = 0.98f; + WorldGen.AddHellHouses(); + UI.main.NextProgressStep(Lang.gen[19]); + int num65 = WorldGen.genRand.Next(2, (int) ((double) Main.maxTilesX * 0.00499999988824129)); + for (int index = 0; index < num65; ++index) + { + UI.main.progress = (float) index / (float) num65; + int i5 = WorldGen.genRand.Next(300, (int) Main.maxTilesX - 300); + while (i5 > ((int) Main.maxTilesX >> 1) - 50 && i5 < ((int) Main.maxTilesX >> 1) + 50) + i5 = WorldGen.genRand.Next(300, (int) Main.maxTilesX - 300); + int j5 = (int) num5 - 20; + while ((int) Main.tile[i5, j5].active == 0) + ++j5; + WorldGen.Lakinater(i5, j5); + } + UI.main.NextProgressStep(Lang.gen[58]); + int x1; + int num66; + if (num9 == -1) + { + x1 = WorldGen.genRand.Next((int) ((double) Main.maxTilesX * 0.0500000007450581), (int) ((double) Main.maxTilesX * 0.200000002980232)); + num66 = -1; + } + else + { + x1 = WorldGen.genRand.Next((int) ((double) Main.maxTilesX * 0.800000011920929), (int) ((double) Main.maxTilesX * 0.949999988079071)); + num66 = 1; + } + int y1 = (Main.rockLayer + (int) Main.maxTilesY >> 1) + WorldGen.genRand.Next(-200, 200); + WorldGen.MakeDungeon(x1, y1, 41, 7); + UI.main.NextProgressStep(Lang.gen[20]); + int num67 = (int) ((double) Main.maxTilesX * 0.000449999992270023); + for (int index1 = 0; index1 < num67; ++index1) + { + UI.main.progress = (float) index1 / (float) num67; + int num11; + int num15; + int num16; + bool flag1; + do + { + int num17 = 0; + int num18 = (int) Main.maxTilesX >> 1; + int num19 = 200; + num11 = WorldGen.genRand.Next(320, (int) Main.maxTilesX - 320); + num15 = num11 - WorldGen.genRand.Next(200) - 100; + num16 = num11 + WorldGen.genRand.Next(200) + 100; + if (num15 < 285) + num15 = 285; + if (num16 > (int) Main.maxTilesX - 285) + num16 = (int) Main.maxTilesX - 285; + if (num11 > num18 - num19 && num11 < num18 + num19) + flag1 = false; + else if (num15 > num18 - num19 && num15 < num18 + num19) + flag1 = false; + else if (num16 > num18 - num19 && num16 < num18 + num19) + { + flag1 = false; + } + else + { + flag1 = true; + for (int index2 = num15; flag1 && index2 < num16; ++index2) + { + int index3 = 0; + while (index3 < Main.worldSurface) + { + if ((int) Main.tile[index2, index3].active != 0 && Main.tileDungeon[(int) Main.tile[index2, index3].type]) + { + flag1 = false; + break; + } + else + index3 += 5; + } + } + } + if (num17 < 200 && WorldGen.JungleX > num15 && WorldGen.JungleX < num16) + { + int num20 = num17 + 1; + flag1 = false; + } + } + while (!flag1); + int num21 = 0; + for (int i5 = num15; i5 < num16; ++i5) + { + if (num21 > 0) + --num21; + if (i5 == num11 || num21 == 0) + { + for (int j5 = (int) num5; j5 < Main.worldSurface - 1; ++j5) + { + if ((int) Main.tile[i5, j5].active != 0 || (int) Main.tile[i5, j5].wall > 0) + { + if (i5 == num11) + { + num21 = 20; + WorldGen.ChasmRunner(i5, j5, WorldGen.genRand.Next(150) + 150, true); + break; + } + else if (WorldGen.genRand.Next(35) == 0 && num21 == 0) + { + num21 = 30; + bool makeOrb = true; + WorldGen.ChasmRunner(i5, j5, WorldGen.genRand.Next(50) + 50, makeOrb); + break; + } + else + break; + } + } + } + for (int index2 = (int) num5; index2 < Main.worldSurface - 1; ++index2) + { + if ((int) Main.tile[i5, index2].active != 0) + { + int num17 = index2 + WorldGen.genRand.Next(10, 14); + for (int index3 = index2; index3 < num17; ++index3) + { + if (((int) Main.tile[i5, index3].type == 59 || (int) Main.tile[i5, index3].type == 60) && (i5 >= num15 + WorldGen.genRand.Next(5) && i5 < num16 - WorldGen.genRand.Next(5))) + Main.tile[i5, index3].type = (byte) 0; + } + break; + } + } + } + double num22 = (double) (Main.worldSurface + 40); + for (int index2 = num15; index2 < num16; ++index2) + { + num22 += (double) WorldGen.genRand.Next(-2, 3); + if (num22 < (double) (Main.worldSurface + 30)) + num22 = (double) (Main.worldSurface + 30); + if (num22 > (double) (Main.worldSurface + 50)) + num22 = (double) (Main.worldSurface + 50); + int i5 = index2; + bool flag2 = false; + for (int j5 = (int) num5; (double) j5 < num22; ++j5) + { + if ((int) Main.tile[i5, j5].active != 0) + { + if ((int) Main.tile[i5, j5].type == 53 && i5 >= num15 + WorldGen.genRand.Next(5) && i5 <= num16 - WorldGen.genRand.Next(5)) + Main.tile[i5, j5].type = (byte) 0; + if ((int) Main.tile[i5, j5].type == 0 && j5 < Main.worldSurface - 1 && !flag2) + { + WorldGen.grassSpread = 0; + WorldGen.SpreadGrass(i5, j5, 0, 23, true); + } + flag2 = true; + if ((int) Main.tile[i5, j5].type == 1 && i5 >= num15 + WorldGen.genRand.Next(5) && i5 <= num16 - WorldGen.genRand.Next(5)) + Main.tile[i5, j5].type = (byte) 25; + if ((int) Main.tile[i5, j5].type == 2) + Main.tile[i5, j5].type = (byte) 23; + } + } + } + for (int index2 = num15; index2 < num16; ++index2) + { + for (int index3 = 0; index3 < (int) Main.maxTilesY - 50; ++index3) + { + if ((int) Main.tile[index2, index3].active != 0 && (int) Main.tile[index2, index3].type == 31) + { + int num17 = index2 - 13; + int num18 = index2 + 13; + int num19 = index3 - 13; + int num20 = index3 + 13; + for (int index4 = num17; index4 < num18; ++index4) + { + if (index4 > 10 && index4 < (int) Main.maxTilesX - 10) + { + for (int index5 = num19; index5 < num20; ++index5) + { + if (WorldGen.genRand.Next(3) != 0 && Math.Abs(index4 - index2) + Math.Abs(index5 - index3) < 9 + WorldGen.genRand.Next(11) && (int) Main.tile[index4, index5].type != 31) + { + Main.tile[index4, index5].active = (byte) 1; + Main.tile[index4, index5].type = (byte) 25; + if (Math.Abs(index4 - index2) <= 1 && Math.Abs(index5 - index3) <= 1) + Main.tile[index4, index5].active = (byte) 0; + } + if ((int) Main.tile[index4, index5].type != 31 && Math.Abs(index4 - index2) <= 2 + WorldGen.genRand.Next(3) && Math.Abs(index5 - index3) <= 2 + WorldGen.genRand.Next(3)) + Main.tile[index4, index5].active = (byte) 0; + } + } + } + } + } + } + } + UI.main.NextProgressStep(Lang.gen[21]); + for (int index = 0; index < WorldGen.numMCaves; ++index) + { + int i5 = (int) WorldGen.mCave[index].X; + int j5 = (int) WorldGen.mCave[index].Y; + WorldGen.CaveOpenater(i5, j5); + WorldGen.Cavinator(i5, j5, WorldGen.genRand.Next(40, 50)); + } + int index7 = 0; + int index8 = 0; + int index9 = 20; + int index10 = (int) Main.maxTilesX - 20; + UI.main.NextProgressStep(Lang.gen[22]); + for (int index1 = 0; index1 < 2; ++index1) + { + if (index1 == 0) + { + int num11 = 0; + int num15 = WorldGen.genRand.Next(125, 200) + 50; + if (num66 == 1) + num15 = 275; + int num16 = 0; + float num17 = 1f; + int index2 = 0; + while ((int) Main.tile[num15 - 1, index2].active == 0) + ++index2; + index7 = index2; + int num18 = index2 + WorldGen.genRand.Next(1, 5); + for (int index3 = num15 - 1; index3 >= num11; --index3) + { + ++num16; + if (num16 < 3) + num17 += (float) WorldGen.genRand.Next(10, 20) * 0.2f; + else if (num16 < 6) + num17 += (float) WorldGen.genRand.Next(10, 20) * 0.15f; + else if (num16 < 9) + num17 += (float) WorldGen.genRand.Next(10, 20) * 0.1f; + else if (num16 < 15) + num17 += (float) WorldGen.genRand.Next(10, 20) * 0.07f; + else if (num16 < 50) + num17 += (float) WorldGen.genRand.Next(10, 20) * 0.05f; + else if (num16 < 75) + num17 += (float) WorldGen.genRand.Next(10, 20) * 0.04f; + else if (num16 < 100) + num17 += (float) WorldGen.genRand.Next(10, 20) * 0.03f; + else if (num16 < 125) + num17 += (float) WorldGen.genRand.Next(10, 20) * 0.02f; + else if (num16 < 150) + num17 += (float) WorldGen.genRand.Next(10, 20) * 0.01f; + else if (num16 < 175) + num17 += (float) WorldGen.genRand.Next(10, 20) * 0.005f; + else if (num16 < 200) + num17 += (float) WorldGen.genRand.Next(10, 20) * (1.0 / 1000.0); + else if (num16 < 230) + num17 += (float) WorldGen.genRand.Next(10, 20) * 0.01f; + else if (num16 < 235) + num17 += (float) WorldGen.genRand.Next(10, 20) * 0.05f; + else if (num16 < 240) + num17 += (float) WorldGen.genRand.Next(10, 20) * 0.1f; + else if (num16 < 245) + num17 += (float) WorldGen.genRand.Next(10, 20) * 0.05f; + else if (num16 < (int) byte.MaxValue) + num17 += (float) WorldGen.genRand.Next(10, 20) * 0.01f; + if (num16 == 235) + index10 = index3; + if (num16 == 235) + index9 = index3; + int num19 = WorldGen.genRand.Next(15, 20); + for (int index4 = 0; (double) index4 < (double) num18 + (double) num17 + (double) num19; ++index4) + { + if ((double) index4 < (double) num18 + (double) num17 * 0.75 - 3.0) + { + Main.tile[index3, index4].active = (byte) 0; + if (index4 > num18) + Main.tile[index3, index4].liquid = byte.MaxValue; + else if (index4 == num18) + Main.tile[index3, index4].liquid = (byte) 127; + } + else if (index4 > num18) + { + Main.tile[index3, index4].type = (byte) 53; + Main.tile[index3, index4].active = (byte) 1; + } + Main.tile[index3, index4].wall = (byte) 0; + } + } + } + else + { + int index2 = (int) Main.maxTilesX - WorldGen.genRand.Next(125, 200) - 50; + int num11 = (int) Main.maxTilesX; + if (num66 == -1) + index2 = (int) Main.maxTilesX - 275; + float num15 = 1f; + int num16 = 0; + int index3 = 0; + while ((int) Main.tile[index2, index3].active == 0) + ++index3; + index8 = index3; + int num17 = index3 + WorldGen.genRand.Next(1, 5); + for (int index4 = index2; index4 < num11; ++index4) + { + ++num16; + if (num16 < 3) + num15 += (float) WorldGen.genRand.Next(10, 20) * 0.2f; + else if (num16 < 6) + num15 += (float) WorldGen.genRand.Next(10, 20) * 0.15f; + else if (num16 < 9) + num15 += (float) WorldGen.genRand.Next(10, 20) * 0.1f; + else if (num16 < 15) + num15 += (float) WorldGen.genRand.Next(10, 20) * 0.07f; + else if (num16 < 50) + num15 += (float) WorldGen.genRand.Next(10, 20) * 0.05f; + else if (num16 < 75) + num15 += (float) WorldGen.genRand.Next(10, 20) * 0.04f; + else if (num16 < 100) + num15 += (float) WorldGen.genRand.Next(10, 20) * 0.03f; + else if (num16 < 125) + num15 += (float) WorldGen.genRand.Next(10, 20) * 0.02f; + else if (num16 < 150) + num15 += (float) WorldGen.genRand.Next(10, 20) * 0.01f; + else if (num16 < 175) + num15 += (float) WorldGen.genRand.Next(10, 20) * 0.005f; + else if (num16 < 200) + num15 += (float) WorldGen.genRand.Next(10, 20) * (1.0 / 1000.0); + else if (num16 < 230) + num15 += (float) WorldGen.genRand.Next(10, 20) * 0.01f; + else if (num16 < 235) + num15 += (float) WorldGen.genRand.Next(10, 20) * 0.05f; + else if (num16 < 240) + num15 += (float) WorldGen.genRand.Next(10, 20) * 0.1f; + else if (num16 < 245) + num15 += (float) WorldGen.genRand.Next(10, 20) * 0.05f; + else if (num16 < (int) byte.MaxValue) + num15 += (float) WorldGen.genRand.Next(10, 20) * 0.01f; + if (num16 == 235) + index10 = index4; + int num18 = WorldGen.genRand.Next(15, 20); + for (int index5 = 0; (double) index5 < (double) num17 + (double) num15 + (double) num18; ++index5) + { + if ((double) index5 < (double) num17 + (double) num15 * 0.75 - 3.0 && index5 < Main.worldSurface - 2) + { + Main.tile[index4, index5].active = (byte) 0; + if (index5 > num17) + Main.tile[index4, index5].liquid = byte.MaxValue; + else if (index5 == num17) + Main.tile[index4, index5].liquid = (byte) 127; + } + else if (index5 > num17) + { + Main.tile[index4, index5].type = (byte) 53; + Main.tile[index4, index5].active = (byte) 1; + } + Main.tile[index4, index5].wall = (byte) 0; + } + } + } + } + while ((int) Main.tile[index9, index7].active == 0) + ++index7; + int num68 = index7 + 1; + while ((int) Main.tile[index10, index8].active == 0) + ++index8; + int num69 = index8 + 1; + UI.main.NextProgressStep(Lang.gen[23]); + for (int type = 63; type <= 68; ++type) + { + float num11 = 0.0f; + if (type == 67) + num11 = (float) Main.maxTilesX * 0.5f; + else if (type == 66) + num11 = (float) Main.maxTilesX * 0.45f; + else if (type == 63) + num11 = (float) Main.maxTilesX * 0.3f; + else if (type == 65) + num11 = (float) Main.maxTilesX * 0.25f; + else if (type == 64) + num11 = (float) Main.maxTilesX * 0.1f; + else if (type == 68) + num11 = (float) Main.maxTilesX * 0.05f; + float num15 = num11 * 0.2f; + for (int index1 = 0; (double) index1 < (double) num15; ++index1) + { + int i5 = WorldGen.genRand.Next((int) Main.maxTilesX); + int j5; + for (j5 = WorldGen.genRand.Next(Main.worldSurface, (int) Main.maxTilesY); (int) Main.tile[i5, j5].type != 1; j5 = WorldGen.genRand.Next(Main.worldSurface, (int) Main.maxTilesY)) + i5 = WorldGen.genRand.Next((int) Main.maxTilesX); + WorldGen.TileRunner(i5, j5, WorldGen.genRand.Next(2, 6), WorldGen.genRand.Next(3, 7), type, false, new Vector2(), false, true); + } + } + for (int index1 = 0; index1 < 2; ++index1) + { + int num11 = 1; + int num15 = 5; + int num16 = (int) Main.maxTilesX - 5; + if (index1 == 1) + { + num11 = -1; + num15 = (int) Main.maxTilesX - 5; + num16 = 5; + } + int index2 = num15; + while (index2 != num16) + { + for (int index3 = 10; index3 < (int) Main.maxTilesY - 10; ++index3) + { + if ((int) Main.tile[index2, index3].active != 0 && (int) Main.tile[index2, index3].type == 53 && ((int) Main.tile[index2, index3 + 1].active != 0 && (int) Main.tile[index2, index3 + 1].type == 53)) + { + int index4 = index2 + num11; + int index5 = index3 + 1; + if ((int) Main.tile[index4, index3].active == 0 && (int) Main.tile[index4, index3 + 1].active == 0) + { + while ((int) Main.tile[index4, index5].active == 0) + ++index5; + int index6 = index5 - 1; + Main.tile[index2, index3].active = (byte) 0; + Main.tile[index4, index6].active = (byte) 1; + Main.tile[index4, index6].type = (byte) 53; + } + } + } + index2 += num11; + } + } + UI.main.NextProgressStep(Lang.gen[24]); + for (int index1 = 0; index1 < (int) Main.maxTilesX; ++index1) + { + UI.main.progress = (float) index1 / (float) Main.maxTilesX; + for (int index2 = (int) Main.maxTilesY - 5; index2 > 0; --index2) + { + if ((int) Main.tile[index1, index2].active != 0) + { + if ((int) Main.tile[index1, index2].type == 53) + { + for (int index3 = index2; (int) Main.tile[index1, index3 + 1].active == 0 && index3 < (int) Main.maxTilesY - 5; ++index3) + { + Main.tile[index1, index3 + 1].active = (byte) 1; + Main.tile[index1, index3 + 1].type = (byte) 53; + } + } + else if ((int) Main.tile[index1, index2].type == 123) + { + for (int index3 = index2; (int) Main.tile[index1, index3 + 1].active == 0 && index3 < (int) Main.maxTilesY - 5; ++index3) + { + Main.tile[index1, index3 + 1].active = (byte) 1; + Main.tile[index1, index3 + 1].type = (byte) 123; + Main.tile[index1, index3].active = (byte) 0; + } + } + } + } + } + UI.main.NextProgressStep(Lang.gen[25]); + for (int index1 = 3; index1 < (int) Main.maxTilesX - 3; ++index1) + { + UI.main.progress = (float) index1 / (float) ((int) Main.maxTilesX - 4); + bool flag1 = true; + for (int index2 = 0; index2 < Main.worldSurface; ++index2) + { + if (flag1) + { + if ((int) Main.tile[index1, index2].wall == 2) + Main.tile[index1, index2].wall = (byte) 0; + if ((int) Main.tile[index1, index2].type != 53) + { + if ((int) Main.tile[index1 - 1, index2].wall == 2) + Main.tile[index1 - 1, index2].wall = (byte) 0; + if ((int) Main.tile[index1 - 2, index2].wall == 2 && WorldGen.genRand.Next(2) == 0) + Main.tile[index1 - 2, index2].wall = (byte) 0; + if ((int) Main.tile[index1 - 3, index2].wall == 2 && WorldGen.genRand.Next(2) == 0) + Main.tile[index1 - 3, index2].wall = (byte) 0; + if ((int) Main.tile[index1 + 1, index2].wall == 2) + Main.tile[index1 + 1, index2].wall = (byte) 0; + if ((int) Main.tile[index1 + 2, index2].wall == 2 && WorldGen.genRand.Next(2) == 0) + Main.tile[index1 + 2, index2].wall = (byte) 0; + if ((int) Main.tile[index1 + 3, index2].wall == 2 && WorldGen.genRand.Next(2) == 0) + Main.tile[index1 + 3, index2].wall = (byte) 0; + if ((int) Main.tile[index1, index2].active != 0) + flag1 = false; + } + } + else if ((int) Main.tile[index1, index2].wall == 0 && (int) Main.tile[index1, index2 + 1].wall == 0 && ((int) Main.tile[index1, index2 + 2].wall == 0 && (int) Main.tile[index1, index2 + 3].wall == 0) && ((int) Main.tile[index1, index2 + 4].wall == 0 && (int) Main.tile[index1 - 1, index2].wall == 0 && ((int) Main.tile[index1 + 1, index2].wall == 0 && (int) Main.tile[index1 - 2, index2].wall == 0)) && ((int) Main.tile[index1 + 2, index2].wall == 0 && (int) Main.tile[index1, index2].active == 0 && ((int) Main.tile[index1, index2 + 1].active == 0 && (int) Main.tile[index1, index2 + 2].active == 0) && (int) Main.tile[index1, index2 + 3].active == 0)) + flag1 = true; + } + } + UI.main.NextProgressStep(Lang.gen[26]); + int y2 = (int) num6 + 20; + int num70 = (int) Main.maxTilesX * (int) Main.maxTilesY / 50000; + for (int index1 = 0; index1 < num70; ++index1) + { + UI.main.progress = (float) index1 / (float) num70; + int num11 = 0; + while (num11 < 4096 && !WorldGen.Place3x2(WorldGen.genRand.Next(5, (int) Main.maxTilesX - 5), y2, 26)) + ++num11; + } + int num71 = (int) num5; +label_820: + for (int index1 = 0; index1 < (int) Main.maxTilesX; ++index1) + { + int num11 = num71; + Tile* tilePtr2 = tilePtr1 + (index1 * 1440 + num11); + while ((int) tilePtr2->active == 0) + { + ++tilePtr2; + if (++num11 >= Main.worldSurface - 1) + goto label_820; + } + if ((int) tilePtr2->type == 60) + { + tilePtr2[-1].liquid = byte.MaxValue; + tilePtr2[-2].liquid = byte.MaxValue; + } + } +label_831: + for (int index1 = 400; index1 < (int) Main.maxTilesX - 400; ++index1) + { + int num11 = num71; + Tile* tilePtr2 = tilePtr1 + (index1 * 1440 + num11); + while ((int) tilePtr2->active == 0) + { + ++tilePtr2; + if (++num11 >= Main.worldSurface - 1) + goto label_831; + } + if ((int) tilePtr2->type == 53) + { + Tile* tilePtr3 = tilePtr2; + while (num11 > num71) + { + --num11; + --tilePtr3; + if ((int) tilePtr3->liquid > 0) + tilePtr3->liquid = (byte) 0; + else + break; + } + } + } + Liquid.QuickWater(1.0 / 3.0, 3, -1, 0.0); + WorldGen.WaterCheck(); + int num72 = 0; + Liquid.QuickSettleOn(); + do + { + int num11 = Liquid.numLiquid + LiquidBuffer.numLiquidBuffer; + ++num72; + float num15 = 0.0f; + while (Liquid.numLiquid > 0) + { + float num16 = (float) (num11 - (Liquid.numLiquid + LiquidBuffer.numLiquidBuffer)) / (float) num11; + if (Liquid.numLiquid + LiquidBuffer.numLiquidBuffer > num11) + num11 = Liquid.numLiquid + LiquidBuffer.numLiquidBuffer; + if ((double) num16 > (double) num15) + num15 = num16; + else + num16 = num15; + if (num72 == 1) + UI.main.progress = (float) ((double) num16 * 0.333333343267441 + 0.333400011062622); + int num17 = 10; + if (num72 > num17) + ; + Liquid.UpdateLiquid(); + } + WorldGen.WaterCheck(); + } + while (num72 < 10); + Liquid.QuickSettleOff(); + UI.main.NextProgressStep(Lang.gen[28]); + int num73 = (int) Main.maxTilesX * (int) Main.maxTilesY / 50000; + for (int index1 = 0; index1 < num73; ++index1) + { + UI.main.progress = (float) index1 / (float) num73; + int num11 = 0; + do + ; + while (!WorldGen.AddLifeCrystal(WorldGen.genRand.Next(1, (int) Main.maxTilesX), WorldGen.genRand.Next((int) ((double) num6 + 20.0), (int) Main.maxTilesY)) && ++num11 < 10000); + } + UI.main.NextProgressStep(Lang.gen[29]); + float num74 = (float) Main.maxTilesX * 0.0002380952f; + int style = 0; + int num75 = (int) ((double) num74 * 82.0); + for (int index1 = 0; index1 < num75; ++index1) + { + if (style > 41) + style = 0; + UI.main.progress = (float) index1 / (float) num75; + int num11 = 0; + do + { + int i5 = WorldGen.genRand.Next(20, (int) Main.maxTilesX - 20); + int index2 = WorldGen.genRand.Next((int) ((double) num6 + 20.0), (int) Main.maxTilesY - 300); + while ((int) Main.tile[i5, index2].active == 0) + ++index2; + int j5 = index2 - 1; + if (WorldGen.PlaceTile(i5, j5, 105, true, true, -1, style)) + { + ++style; + break; + } + } + while (++num11 < 10000); + } + UI.main.NextProgressStep(Lang.gen[30]); + int num76 = (int) Main.maxTilesX * (int) Main.maxTilesY / 62500; + for (int index1 = 0; index1 < num76; ++index1) + { + UI.main.progress = (float) index1 / (float) num76; + int num11 = 0; + do + { + int i5; + int j5; + int num15; + do + { + i5 = WorldGen.genRand.Next(1, (int) Main.maxTilesX); + j5 = index1 <= 3 ? WorldGen.genRand.Next((int) Main.maxTilesY - 200, (int) Main.maxTilesY - 50) : WorldGen.genRand.Next((int) ((double) num6 + 20.0), (int) Main.maxTilesY - 230); + num15 = (int) Main.tile[i5, j5].wall; + } + while (num15 >= 7 && num15 <= 9); + if (WorldGen.AddBuriedChest(i5, j5, 0, false, -1)) + { + if (WorldGen.genRand.Next(2) == 0) + { + int j7 = j5; + while ((int) Main.tile[i5, j7].type != 21 && j7 < (int) Main.maxTilesY - 300) + ++j7; + if (j5 < (int) Main.maxTilesY - 300) + { + WorldGen.MineHouse(i5, j7); + break; + } + else + break; + } + else + break; + } + } + while (++num11 < 5000); + } + UI.main.NextProgressStep(Lang.gen[31]); + int num77 = (int) Main.maxTilesX / 200; + for (int index1 = 0; index1 < num77; ++index1) + { + UI.main.progress = (float) index1 / (float) num77; + int num11 = 0; + int i5; + int j5; + do + { + i5 = WorldGen.genRand.Next(300, (int) Main.maxTilesX - 300); + j5 = WorldGen.genRand.Next((int) num5, Main.worldSurface); + } + while (((int) Main.tile[i5, j5].wall != 2 || (int) Main.tile[i5, j5].active != 0 || !WorldGen.AddBuriedChest(i5, j5, 0, true, -1)) && ++num11 < 2000); + } + UI.main.NextProgressStep(Lang.gen[32]); + int num78 = 0; + for (int index1 = 0; index1 < WorldGen.numJChests; ++index1) + { + UI.main.progress = (float) index1 / (float) WorldGen.numJChests; + int contain = 211; + switch (++num78) + { + case 1: + if (!WorldGen.AddBuriedChest((int) WorldGen.JChest[index1].X + WorldGen.genRand.Next(2), (int) WorldGen.JChest[index1].Y, contain, false, -1)) + { + WorldGen.KillTile((int) WorldGen.JChest[index1].X, (int) WorldGen.JChest[index1].Y); + WorldGen.KillTile((int) WorldGen.JChest[index1].X, (int) WorldGen.JChest[index1].Y + 1); + WorldGen.KillTile((int) WorldGen.JChest[index1].X + 1, (int) WorldGen.JChest[index1].Y); + WorldGen.KillTile((int) WorldGen.JChest[index1].X + 1, (int) WorldGen.JChest[index1].Y + 1); + WorldGen.AddBuriedChest((int) WorldGen.JChest[index1].X, (int) WorldGen.JChest[index1].Y, contain, false, -1); + continue; + } + else + continue; + case 2: + contain = 212; + goto case 1; + case 3: + contain = 213; + goto case 1; + default: + if (Main.rand.Next(2) == 0) + { + num78 = Main.rand.Next(6) != 0 ? 622 : 624; + goto case 1; + } + else + goto case 1; + } + } + UI.main.NextProgressStep(Lang.gen[33]); + int num79 = 0; + int num80 = (int) (9.0 * (double) num74); + for (int index1 = 0; index1 < num80; ++index1) + { + UI.main.progress = (float) index1 / (float) num80; + int contain = 187; + if (++num79 == 1) + contain = 186; + else if (num79 == 2) + contain = 277; + else + num79 = 0; + for (bool flag1 = false; !flag1; { + int i5; + int j5; + flag1 = WorldGen.AddBuriedChest(i5, j5, contain, false, -1); + } + ) + { + i5 = WorldGen.genRand.Next(1, (int) Main.maxTilesX); + for (j5 = WorldGen.genRand.Next(1, (int) Main.maxTilesY - 200); (int) Main.tile[i5, j5].liquid < 200 || (int) Main.tile[i5, j5].lava != 0; j5 = WorldGen.genRand.Next(1, (int) Main.maxTilesY - 200)) + i5 = WorldGen.genRand.Next(1, (int) Main.maxTilesX); + } + } + for (int index1 = 0; index1 < WorldGen.numIslandHouses; ++index1) + WorldGen.IslandHouse((int) WorldGen.fih[index1].X, (int) WorldGen.fih[index1].Y); + UI.main.NextProgressStep(Lang.gen[34]); + int num81 = (int) ((double) Main.maxTilesX * 0.0500000007450581); + for (int index1 = 0; index1 < num81; ++index1) + { + UI.main.progress = (float) index1 / (float) num81; + for (int index2 = 0; index2 < 1000; ++index2) + { + int x2 = Main.rand.Next(200, (int) Main.maxTilesX - 200); + int y2_1 = Main.rand.Next(Main.worldSurface, (int) Main.maxTilesY - 300); + if ((int) Main.tile[x2, y2_1].wall == 0 && WorldGen.placeTrap(x2, y2_1, -1)) + break; + } + } + UI.main.NextProgressStep(Lang.gen[35]); + int num82 = (int) ((double) ((int) Main.maxTilesX * (int) Main.maxTilesY) * 0.0008); + for (int index1 = 0; index1 < num82; ++index1) + { + float num11 = (float) index1 / (float) num82; + UI.main.progress = num11; + bool flag1 = false; + int num15 = 0; + while (!flag1) + { + int num16 = WorldGen.genRand.Next((int) num6, (int) Main.maxTilesY - 10); + if ((double) num11 > 0.930000007152557) + num16 = (int) Main.maxTilesY - 150; + else if ((double) num11 > 0.75) + num16 = (int) num5; + int x2 = WorldGen.genRand.Next(1, (int) Main.maxTilesX - 1); + bool flag2 = false; + for (int y3 = num16; y3 < (int) Main.maxTilesY - 1; ++y3) + { + if (!flag2) + { + if ((int) Main.tile[x2, y3].active != 0 && Main.tileSolid[(int) Main.tile[x2, y3].type] && (int) Main.tile[x2, y3 - 1].lava == 0) + flag2 = true; + } + else if (WorldGen.PlacePot(x2, y3)) + { + flag1 = true; + break; + } + else + { + ++num15; + if (num15 >= 10000) + { + flag1 = true; + break; + } + } + } + } + } + UI.main.NextProgressStep(Lang.gen[36]); + int num83 = (int) Main.maxTilesX / 200; + for (int index1 = 0; index1 < num83; ++index1) + { + UI.main.progress = (float) index1 / (float) num83; + int num11 = 0; +label_936: + while (true) + { + int i5 = WorldGen.genRand.Next(5, (int) Main.maxTilesX - 5); + int index2 = (int) Main.maxTilesY - 250; + try + { + while ((int) Main.tile[i5, index2].active == 0 && (int) Main.tile[i5, index2].wall != 13 && (int) Main.tile[i5, index2].wall != 14) + { + if (++index2 == (int) Main.maxTilesY) + goto label_936; + } + int j5 = index2 - 1; + if (!WorldGen.PlaceTile(i5, j5, 77, false, false, -1, 0)) + { + if (++num11 >= 10000) + break; + } + else + break; + } + catch + { + } + } + } + UI.main.NextProgressStep(Lang.gen[37]); + for (int index1 = 0; index1 < (int) Main.maxTilesX; ++index1) + { + int i5 = index1; + bool flag1 = true; + for (int j5 = 0; j5 < Main.worldSurface - 1; ++j5) + { + if ((int) Main.tile[i5, j5].active != 0) + { + if (flag1) + { + if ((int) Main.tile[i5, j5].type == 0) + { + try + { + WorldGen.grassSpread = 0; + WorldGen.SpreadGrass(i5, j5, 0, 2, true); + } + catch + { + WorldGen.grassSpread = 0; + WorldGen.SpreadGrass(i5, j5, 0, 2, false); + } + } + } + if ((double) j5 <= (double) num6) + flag1 = false; + else + break; + } + else if ((int) Main.tile[i5, j5].wall == 0) + flag1 = true; + } + } + UI.main.NextProgressStep(Lang.gen[38]); + for (int i5 = 5; i5 < (int) Main.maxTilesX - 5; ++i5) + { + if (WorldGen.genRand.Next(8) == 0) + { + Tile* tilePtr2 = tilePtr1 + (i5 * 1440 + 5); + int j5 = 5; + do + { + if ((int) tilePtr2->type == 53 && (int) tilePtr2->active != 0) + { + Tile* tilePtr3 = tilePtr2 - 1; + if ((int) tilePtr3->active == 0 && (int) tilePtr3->wall == 0) + { + if (i5 < 250 || i5 > (int) Main.maxTilesX - 250) + { + Tile* tilePtr4 = tilePtr3 - 1; + if ((int) tilePtr4->liquid == (int) byte.MaxValue) + { + Tile* tilePtr5 = tilePtr4 - 1; + if ((int) tilePtr5->liquid == (int) byte.MaxValue) + { + Tile* tilePtr6 = tilePtr5 - 1; + if ((int) tilePtr6->liquid == (int) byte.MaxValue) + WorldGen.PlaceTile(i5, j5 - 1, 81, true, false, -1, 0); + tilePtr5 = tilePtr6 + 1; + } + tilePtr4 = tilePtr5 + 1; + } + tilePtr3 = tilePtr4 + 1; + } + else if (i5 > 400 && i5 < (int) Main.maxTilesX - 400) + WorldGen.PlantCactus(i5, j5); + } + tilePtr2 = tilePtr3 + 1; + } + ++tilePtr2; + } + while (++j5 < Main.worldSurface - 1); + } + } + int num84 = 5; + while (true) + { + int index1 = ((int) Main.maxTilesX >> 1) + WorldGen.genRand.Next(-num84, num84 + 1); + for (int index2 = 5; index2 <= Main.worldSurface; ++index2) + { + if ((int) Main.tile[index1, index2].active != 0) + { + Main.spawnTileX = (short) index1; + Main.spawnTileY = (short) index2; + break; + } + } + if ((int) Main.tile[(int) Main.spawnTileX, (int) Main.spawnTileY - 1].liquid != 0) + ++num84; + else + break; + } + int index11 = NPC.NewNPC((int) Main.spawnTileX * 16, (int) Main.spawnTileY * 16, 22, 0); + Main.npc[index11].homeTileX = Main.spawnTileX; + Main.npc[index11].homeTileY = Main.spawnTileY; + Main.npc[index11].direction = (sbyte) 1; + Main.npc[index11].homeless = true; + UI.main.NextProgressStep(Lang.gen[39]); + for (int index1 = 0; (double) index1 < (double) Main.maxTilesX * 0.002; ++index1) + { + int num11 = (int) Main.maxTilesX; + int num15 = WorldGen.genRand.Next((int) Main.maxTilesX); + int num16 = num15 - WorldGen.genRand.Next(10) - 7; + int num17 = num15 + WorldGen.genRand.Next(10) + 7; + if (num16 < 0) + num16 = 0; + if (num17 > (int) Main.maxTilesX - 1) + num17 = (int) Main.maxTilesX - 1; + for (int i5 = num16; i5 < num17; ++i5) + { + for (int index2 = 5; index2 < Main.worldSurface - 1; ++index2) + { + if ((int) Main.tile[i5, index2].type == 2 && (int) Main.tile[i5, index2].active != 0 && (int) Main.tile[i5, index2 - 1].active == 0) + WorldGen.PlaceTile(i5, index2 - 1, 27, true, false, -1, 0); + if ((int) Main.tile[i5, index2].active != 0) + break; + } + } + } + UI.main.NextProgressStep(Lang.gen[40]); + for (int index1 = (int) ((double) Main.maxTilesX * 0.003) - 1; index1 >= 0; --index1) + { + int num11 = WorldGen.genRand.Next(50, (int) Main.maxTilesX - 50); + int num15 = WorldGen.genRand.Next(25, 50); + for (int i5 = num11 - num15; i5 < num11 + num15; ++i5) + { + for (int y3 = 20; y3 < Main.worldSurface; ++y3) + WorldGen.GrowEpicTree(i5, y3); + } + } + WorldGen.AddTrees(); + UI.main.NextProgressStep(Lang.gen[41]); + for (int index1 = (int) ((double) Main.maxTilesX * 1.7) - 1; index1 >= 0; --index1) + WorldGen.PlantAlch(); + UI.main.NextProgressStep(Lang.gen[42]); + WorldGen.AddPlants(); + for (int i5 = 0; i5 < (int) Main.maxTilesX; ++i5) + { + for (int y3 = 1; y3 < (int) Main.maxTilesY; ++y3) + { + if ((int) Main.tile[i5, y3].active != 0) + { + if (y3 >= Main.worldSurface && (int) Main.tile[i5, y3].type == 70 && (int) Main.tile[i5, y3 - 1].active == 0) + { + WorldGen.GrowShroom(i5, y3); + if ((int) Main.tile[i5, y3 - 1].active == 0) + WorldGen.PlaceTile(i5, y3 - 1, 71, true, false, -1, 0); + } + if ((int) Main.tile[i5, y3].type == 60 && (int) Main.tile[i5, y3 - 1].active == 0) + WorldGen.PlaceTile(i5, y3 - 1, 61, true, false, -1, 0); + } + } + } + UI.main.NextProgressStep(Lang.gen[43]); + for (int index1 = 0; index1 < (int) Main.maxTilesX; ++index1) + { + int num11 = 0; + for (int index2 = 0; index2 < Main.worldSurface; ++index2) + { + if (num11 > 0 && (int) Main.tile[index1, index2].active == 0) + { + Main.tile[index1, index2].active = (byte) 1; + Main.tile[index1, index2].type = (byte) 52; + --num11; + } + else + num11 = 0; + if ((int) Main.tile[index1, index2].active != 0 && (int) Main.tile[index1, index2].type == 2 && WorldGen.genRand.Next(5) < 3) + num11 = WorldGen.genRand.Next(1, 10); + } + int num15 = 0; + for (int index2 = 0; index2 < (int) Main.maxTilesY; ++index2) + { + if (num15 > 0 && (int) Main.tile[index1, index2].active == 0) + { + Main.tile[index1, index2].active = (byte) 1; + Main.tile[index1, index2].type = (byte) 62; + --num15; + } + else + num15 = 0; + if ((int) Main.tile[index1, index2].active != 0 && (int) Main.tile[index1, index2].type == 60 && WorldGen.genRand.Next(5) < 3) + num15 = WorldGen.genRand.Next(1, 10); + } + } + UI.main.NextProgressStep(Lang.gen[44]); + for (int index1 = (int) Main.maxTilesX / 200; index1 > 0; --index1) + { + int index2 = WorldGen.genRand.Next(20, (int) Main.maxTilesX - 20); + int num11 = WorldGen.genRand.Next(5, 15); + int num15 = WorldGen.genRand.Next(15, 30); + for (int index3 = 30; index3 < Main.worldSurface - 1; ++index3) + { + if ((int) Main.tile[index2, index3].active != 0) + { + for (int index4 = index2 - num11; index4 < index2 + num11; ++index4) + { + for (int index5 = index3 - num15; index5 < index3 + num15; ++index5) + { + if ((int) Main.tile[index4, index5].type == 3 || (int) Main.tile[index4, index5].type == 24) + Main.tile[index4, index5].frameX = (short) (WorldGen.genRand.Next(6, 8) * 18); + } + } + break; + } + } + } + UI.main.NextProgressStep(Lang.gen[45]); + for (int index1 = (int) Main.maxTilesX / 500; index1 > 0; --index1) + { + int index2 = WorldGen.genRand.Next(20, (int) Main.maxTilesX - 20); + int num11 = WorldGen.genRand.Next(4, 10); + int num15 = WorldGen.genRand.Next(15, 30); + for (int index3 = 30; index3 < Main.worldSurface - 1; ++index3) + { + if ((int) Main.tile[index2, index3].active != 0) + { + for (int index4 = index2 - num11; index4 < index2 + num11; ++index4) + { + for (int index5 = index3 - num15; index5 < index3 + num15; ++index5) + { + if ((int) Main.tile[index4, index5].type == 3 || (int) Main.tile[index4, index5].type == 24) + Main.tile[index4, index5].frameX = (short) 144; + } + } + break; + } + } + } + } + WorldGen.gen = false; + } + + public static void GrowEpicTree(int i, int y) + { + int index1 = y; + while ((int) Main.tile[i, index1].type == 20) + ++index1; + if ((int) Main.tile[i, index1].active == 0 || (int) Main.tile[i, index1].type != 2 || ((int) Main.tile[i, index1 - 1].wall != 0 || (int) Main.tile[i, index1 - 1].liquid != 0) || ((int) Main.tile[i - 1, index1].active == 0 || (int) Main.tile[i - 1, index1].type != 2 && (int) Main.tile[i - 1, index1].type != 23 && ((int) Main.tile[i - 1, index1].type != 60 && (int) Main.tile[i - 1, index1].type != 109)) && ((int) Main.tile[i + 1, index1].active == 0 || (int) Main.tile[i + 1, index1].type != 2 && (int) Main.tile[i + 1, index1].type != 23 && ((int) Main.tile[i + 1, index1].type != 60 && (int) Main.tile[i + 1, index1].type != 109))) + return; + int num1 = 1; + if (!WorldGen.EmptyTileCheckTree(i - num1, i + num1, index1 - 55, index1 - 1)) + return; + int num2 = WorldGen.genRand.Next(10); + int num3 = WorldGen.genRand.Next(20, 30); + for (int index2 = index1 - num3; index2 < index1; ++index2) + { + Main.tile[i, index2].frameNumber = (byte) WorldGen.genRand.Next(3); + Main.tile[i, index2].active = (byte) 1; + Main.tile[i, index2].type = (byte) 5; + int num4 = WorldGen.genRand.Next(3); + if (index2 == index1 - 1 || index2 == index1 - num3) + num2 = 0; + if (num2 == 1) + { + Main.tile[i, index2].frameX = (short) 0; + Main.tile[i, index2].frameY = (short) (66 + num4 * 22); + } + else if (num2 == 2) + { + Main.tile[i, index2].frameX = (short) 22; + Main.tile[i, index2].frameY = (short) (num4 * 22); + } + else if (num2 == 3) + { + Main.tile[i, index2].frameX = (short) 44; + Main.tile[i, index2].frameY = (short) (66 + num4 * 22); + } + else if (num2 == 4) + { + Main.tile[i, index2].frameX = (short) 22; + Main.tile[i, index2].frameY = (short) (66 + num4 * 22); + } + else if (num2 == 5) + { + Main.tile[i, index2].frameX = (short) 88; + Main.tile[i, index2].frameY = (short) (num4 * 22); + } + else if (num2 == 6) + { + Main.tile[i, index2].frameX = (short) 66; + Main.tile[i, index2].frameY = (short) (66 + num4 * 22); + } + else if (num2 == 7) + { + Main.tile[i, index2].frameX = (short) 110; + Main.tile[i, index2].frameY = (short) (66 + num4 * 22); + } + else + { + Main.tile[i, index2].frameX = (short) 0; + Main.tile[i, index2].frameY = (short) (num4 * 22); + } + bool flag1 = num2 == 5 || num2 == 7; + bool flag2 = num2 == 6 || num2 == 7; + if (flag1) + { + Main.tile[i - 1, index2].active = (byte) 1; + Main.tile[i - 1, index2].type = (byte) 5; + int num5 = WorldGen.genRand.Next(3); + if (WorldGen.genRand.Next(3) < 2) + { + Main.tile[i - 1, index2].frameX = (short) 44; + Main.tile[i - 1, index2].frameY = (short) (198 + num5 * 22); + } + else + { + Main.tile[i - 1, index2].frameX = (short) 66; + Main.tile[i - 1, index2].frameY = (short) (num5 * 22); + } + } + if (flag2) + { + Main.tile[i + 1, index2].active = (byte) 1; + Main.tile[i + 1, index2].type = (byte) 5; + int num5 = WorldGen.genRand.Next(3); + if (WorldGen.genRand.Next(3) < 2) + { + Main.tile[i + 1, index2].frameX = (short) 66; + Main.tile[i + 1, index2].frameY = (short) (198 + num5 * 22); + } + else + { + Main.tile[i + 1, index2].frameX = (short) 88; + Main.tile[i + 1, index2].frameY = (short) (66 + num5 * 22); + } + } + do + { + num2 = WorldGen.genRand.Next(10); + } + while ((num2 == 5 || num2 == 7) && flag1 || (num2 == 6 || num2 == 7) && flag2); + } + int num6 = WorldGen.genRand.Next(3); + bool flag3 = false; + bool flag4 = false; + if ((int) Main.tile[i - 1, index1].active != 0 && ((int) Main.tile[i - 1, index1].type == 2 || (int) Main.tile[i - 1, index1].type == 23 || ((int) Main.tile[i - 1, index1].type == 60 || (int) Main.tile[i - 1, index1].type == 109))) + flag3 = true; + if ((int) Main.tile[i + 1, index1].active != 0 && ((int) Main.tile[i + 1, index1].type == 2 || (int) Main.tile[i + 1, index1].type == 23 || ((int) Main.tile[i + 1, index1].type == 60 || (int) Main.tile[i + 1, index1].type == 109))) + flag4 = true; + if (!flag3) + { + if (num6 == 0) + num6 = 2; + if (num6 == 1) + num6 = 3; + } + if (!flag4) + { + if (num6 == 0) + num6 = 1; + if (num6 == 2) + num6 = 3; + } + if (flag4 && !flag3) + num6 = 1; + if (flag3 && !flag4) + num6 = 2; + if (num6 == 0 || num6 == 1) + { + Main.tile[i + 1, index1 - 1].active = (byte) 1; + Main.tile[i + 1, index1 - 1].type = (byte) 5; + int num4 = WorldGen.genRand.Next(3); + if (num4 == 0) + { + Main.tile[i + 1, index1 - 1].frameX = (short) 22; + Main.tile[i + 1, index1 - 1].frameY = (short) 132; + } + if (num4 == 1) + { + Main.tile[i + 1, index1 - 1].frameX = (short) 22; + Main.tile[i + 1, index1 - 1].frameY = (short) 154; + } + if (num4 == 2) + { + Main.tile[i + 1, index1 - 1].frameX = (short) 22; + Main.tile[i + 1, index1 - 1].frameY = (short) 176; + } + } + if (num6 == 0 || num6 == 2) + { + Main.tile[i - 1, index1 - 1].active = (byte) 1; + Main.tile[i - 1, index1 - 1].type = (byte) 5; + int num4 = WorldGen.genRand.Next(3); + if (num4 == 0) + { + Main.tile[i - 1, index1 - 1].frameX = (short) 44; + Main.tile[i - 1, index1 - 1].frameY = (short) 132; + } + if (num4 == 1) + { + Main.tile[i - 1, index1 - 1].frameX = (short) 44; + Main.tile[i - 1, index1 - 1].frameY = (short) 154; + } + if (num4 == 2) + { + Main.tile[i - 1, index1 - 1].frameX = (short) 44; + Main.tile[i - 1, index1 - 1].frameY = (short) 176; + } + } + int num7 = WorldGen.genRand.Next(3); + if (num6 == 0) + { + if (num7 == 0) + { + Main.tile[i, index1 - 1].frameX = (short) 88; + Main.tile[i, index1 - 1].frameY = (short) 132; + } + if (num7 == 1) + { + Main.tile[i, index1 - 1].frameX = (short) 88; + Main.tile[i, index1 - 1].frameY = (short) 154; + } + if (num7 == 2) + { + Main.tile[i, index1 - 1].frameX = (short) 88; + Main.tile[i, index1 - 1].frameY = (short) 176; + } + } + else if (num6 == 1) + { + if (num7 == 0) + { + Main.tile[i, index1 - 1].frameX = (short) 0; + Main.tile[i, index1 - 1].frameY = (short) 132; + } + if (num7 == 1) + { + Main.tile[i, index1 - 1].frameX = (short) 0; + Main.tile[i, index1 - 1].frameY = (short) 154; + } + if (num7 == 2) + { + Main.tile[i, index1 - 1].frameX = (short) 0; + Main.tile[i, index1 - 1].frameY = (short) 176; + } + } + else if (num6 == 2) + { + if (num7 == 0) + { + Main.tile[i, index1 - 1].frameX = (short) 66; + Main.tile[i, index1 - 1].frameY = (short) 132; + } + if (num7 == 1) + { + Main.tile[i, index1 - 1].frameX = (short) 66; + Main.tile[i, index1 - 1].frameY = (short) 154; + } + if (num7 == 2) + { + Main.tile[i, index1 - 1].frameX = (short) 66; + Main.tile[i, index1 - 1].frameY = (short) 176; + } + } + if (WorldGen.genRand.Next(3) < 2) + { + int num4 = WorldGen.genRand.Next(3); + if (num4 == 0) + { + Main.tile[i, index1 - num3].frameX = (short) 22; + Main.tile[i, index1 - num3].frameY = (short) 198; + } + if (num4 == 1) + { + Main.tile[i, index1 - num3].frameX = (short) 22; + Main.tile[i, index1 - num3].frameY = (short) 220; + } + if (num4 == 2) + { + Main.tile[i, index1 - num3].frameX = (short) 22; + Main.tile[i, index1 - num3].frameY = (short) 242; + } + } + else + { + int num4 = WorldGen.genRand.Next(3); + if (num4 == 0) + { + Main.tile[i, index1 - num3].frameX = (short) 0; + Main.tile[i, index1 - num3].frameY = (short) 198; + } + if (num4 == 1) + { + Main.tile[i, index1 - num3].frameX = (short) 0; + Main.tile[i, index1 - num3].frameY = (short) 220; + } + if (num4 == 2) + { + Main.tile[i, index1 - num3].frameX = (short) 0; + Main.tile[i, index1 - num3].frameY = (short) 242; + } + } + WorldGen.RangeFrame(i - 2, index1 - num3 - 1, i + 2, index1 + 1); + if (Main.netMode != 2) + return; + NetMessage.SendTileSquare(i, (int) ((double) index1 - (double) num3 * 0.5), num3 + 1); + } + + public static unsafe void GrowTree(int i, int y) + { + int index1 = y; + while ((int) Main.tile[i, index1].type == 20) + ++index1; + if (((int) Main.tile[i - 1, index1 - 1].liquid != 0 || (int) Main.tile[i - 1, index1 - 1].liquid != 0 || (int) Main.tile[i + 1, index1 - 1].liquid != 0) && (int) Main.tile[i, index1].type != 60 || (int) Main.tile[i, index1].active == 0 || ((int) Main.tile[i, index1].type != 2 && (int) Main.tile[i, index1].type != 23 && ((int) Main.tile[i, index1].type != 60 && (int) Main.tile[i, index1].type != 109) && (int) Main.tile[i, index1].type != 147 || (int) Main.tile[i, index1 - 1].wall != 0) || ((int) Main.tile[i - 1, index1].active == 0 || (int) Main.tile[i - 1, index1].type != 2 && (int) Main.tile[i - 1, index1].type != 23 && ((int) Main.tile[i - 1, index1].type != 60 && (int) Main.tile[i - 1, index1].type != 109) && (int) Main.tile[i - 1, index1].type != 147) && ((int) Main.tile[i + 1, index1].active == 0 || (int) Main.tile[i + 1, index1].type != 2 && (int) Main.tile[i + 1, index1].type != 23 && ((int) Main.tile[i + 1, index1].type != 60 && (int) Main.tile[i + 1, index1].type != 109) && (int) Main.tile[i + 1, index1].type != 147)) + return; + int num1 = 1; + int num2 = 16; + if ((int) Main.tile[i, index1].type == 60) + num2 += 5; + if (!WorldGen.EmptyTileCheckTree(i - num1, i + num1, index1 - num2, index1 - 1)) + return; + int num3 = WorldGen.genRand.Next(10); + int num4 = WorldGen.genRand.Next(5, num2 + 1); + for (int index2 = index1 - num4; index2 < index1; ++index2) + { + Main.tile[i, index2].frameNumber = (byte) WorldGen.genRand.Next(3); + Main.tile[i, index2].active = (byte) 1; + Main.tile[i, index2].type = (byte) 5; + int num5 = WorldGen.genRand.Next(3); + if (index2 == index1 - 1 || index2 == index1 - num4) + num3 = 0; + if (num3 == 1) + { + Main.tile[i, index2].frameX = (short) 0; + Main.tile[i, index2].frameY = (short) (66 + num5 * 22); + } + else if (num3 == 2) + { + Main.tile[i, index2].frameX = (short) 22; + Main.tile[i, index2].frameY = (short) (num5 * 22); + } + else if (num3 == 3) + { + Main.tile[i, index2].frameX = (short) 44; + Main.tile[i, index2].frameY = (short) (66 + num5 * 22); + } + else if (num3 == 4) + { + Main.tile[i, index2].frameX = (short) 22; + Main.tile[i, index2].frameY = (short) (66 + num5 * 22); + } + else if (num3 == 5) + { + Main.tile[i, index2].frameX = (short) 88; + Main.tile[i, index2].frameY = (short) (num5 * 22); + } + else if (num3 == 6) + { + Main.tile[i, index2].frameX = (short) 66; + Main.tile[i, index2].frameY = (short) (66 + num5 * 22); + } + else if (num3 == 7) + { + Main.tile[i, index2].frameX = (short) 110; + Main.tile[i, index2].frameY = (short) (66 + num5 * 22); + } + else + { + Main.tile[i, index2].frameX = (short) 0; + Main.tile[i, index2].frameY = (short) (num5 * 22); + } + bool flag1 = num3 == 5 || num3 == 7; + bool flag2 = num3 == 6 || num3 == 7; + if (flag1) + { + Main.tile[i - 1, index2].active = (byte) 1; + Main.tile[i - 1, index2].type = (byte) 5; + int num6 = WorldGen.genRand.Next(3); + if (WorldGen.genRand.Next(3) < 2) + { + Main.tile[i - 1, index2].frameX = (short) 44; + Main.tile[i - 1, index2].frameY = (short) (198 + num6 * 22); + } + else + { + Main.tile[i - 1, index2].frameX = (short) 66; + Main.tile[i - 1, index2].frameY = (short) (num6 * 22); + } + } + if (flag2) + { + Main.tile[i + 1, index2].active = (byte) 1; + Main.tile[i + 1, index2].type = (byte) 5; + int num6 = WorldGen.genRand.Next(3); + if (WorldGen.genRand.Next(3) < 2) + { + Main.tile[i + 1, index2].frameX = (short) 66; + Main.tile[i + 1, index2].frameY = (short) (198 + num6 * 22); + } + else + { + Main.tile[i + 1, index2].frameX = (short) 88; + Main.tile[i + 1, index2].frameY = (short) (66 + num6 * 22); + } + } + do + { + num3 = WorldGen.genRand.Next(10); + } + while ((num3 == 5 || num3 == 7) && flag1 || (num3 == 6 || num3 == 7) && flag2); + } + int num7 = WorldGen.genRand.Next(3); + bool flag3 = false; + bool flag4 = false; + fixed (Tile* tilePtr = &Main.tile[i - 1, index1]) + { + if ((int) tilePtr->active != 0) + { + byte num5 = tilePtr->type; + if ((uint) num5 <= 23U) + { + if ((int) num5 != 2 && (int) num5 != 23) + goto label_41; + } + else if ((int) num5 != 60 && (int) num5 != 109 && (int) num5 != 147) + goto label_41; + flag3 = true; + } +label_41:; + } + fixed (Tile* tilePtr = &Main.tile[i + 1, index1]) + { + if ((int) tilePtr->active != 0) + { + byte num5 = tilePtr->type; + if ((uint) num5 <= 23U) + { + if ((int) num5 != 2 && (int) num5 != 23) + goto label_47; + } + else if ((int) num5 != 60 && (int) num5 != 109 && (int) num5 != 147) + goto label_47; + flag4 = true; + } +label_47:; + } + if (!flag3) + { + if (num7 == 0) + num7 = 2; + if (num7 == 1) + num7 = 3; + } + if (!flag4) + { + if (num7 == 0) + num7 = 1; + if (num7 == 2) + num7 = 3; + } + if (flag4 && !flag3) + num7 = 1; + if (flag3 && !flag4) + num7 = 2; + if (num7 == 0 || num7 == 1) + { + Main.tile[i + 1, index1 - 1].active = (byte) 1; + Main.tile[i + 1, index1 - 1].type = (byte) 5; + int num5 = WorldGen.genRand.Next(3); + if (num5 == 0) + { + Main.tile[i + 1, index1 - 1].frameX = (short) 22; + Main.tile[i + 1, index1 - 1].frameY = (short) 132; + } + if (num5 == 1) + { + Main.tile[i + 1, index1 - 1].frameX = (short) 22; + Main.tile[i + 1, index1 - 1].frameY = (short) 154; + } + if (num5 == 2) + { + Main.tile[i + 1, index1 - 1].frameX = (short) 22; + Main.tile[i + 1, index1 - 1].frameY = (short) 176; + } + } + if (num7 == 0 || num7 == 2) + { + Main.tile[i - 1, index1 - 1].active = (byte) 1; + Main.tile[i - 1, index1 - 1].type = (byte) 5; + int num5 = WorldGen.genRand.Next(3); + if (num5 == 0) + { + Main.tile[i - 1, index1 - 1].frameX = (short) 44; + Main.tile[i - 1, index1 - 1].frameY = (short) 132; + } + if (num5 == 1) + { + Main.tile[i - 1, index1 - 1].frameX = (short) 44; + Main.tile[i - 1, index1 - 1].frameY = (short) 154; + } + if (num5 == 2) + { + Main.tile[i - 1, index1 - 1].frameX = (short) 44; + Main.tile[i - 1, index1 - 1].frameY = (short) 176; + } + } + int num8 = WorldGen.genRand.Next(3); + if (num7 == 0) + { + if (num8 == 0) + { + Main.tile[i, index1 - 1].frameX = (short) 88; + Main.tile[i, index1 - 1].frameY = (short) 132; + } + if (num8 == 1) + { + Main.tile[i, index1 - 1].frameX = (short) 88; + Main.tile[i, index1 - 1].frameY = (short) 154; + } + if (num8 == 2) + { + Main.tile[i, index1 - 1].frameX = (short) 88; + Main.tile[i, index1 - 1].frameY = (short) 176; + } + } + else if (num7 == 1) + { + if (num8 == 0) + { + Main.tile[i, index1 - 1].frameX = (short) 0; + Main.tile[i, index1 - 1].frameY = (short) 132; + } + if (num8 == 1) + { + Main.tile[i, index1 - 1].frameX = (short) 0; + Main.tile[i, index1 - 1].frameY = (short) 154; + } + if (num8 == 2) + { + Main.tile[i, index1 - 1].frameX = (short) 0; + Main.tile[i, index1 - 1].frameY = (short) 176; + } + } + else if (num7 == 2) + { + if (num8 == 0) + { + Main.tile[i, index1 - 1].frameX = (short) 66; + Main.tile[i, index1 - 1].frameY = (short) 132; + } + if (num8 == 1) + { + Main.tile[i, index1 - 1].frameX = (short) 66; + Main.tile[i, index1 - 1].frameY = (short) 154; + } + if (num8 == 2) + { + Main.tile[i, index1 - 1].frameX = (short) 66; + Main.tile[i, index1 - 1].frameY = (short) 176; + } + } + if (WorldGen.genRand.Next(4) < 3) + { + int num5 = WorldGen.genRand.Next(3); + if (num5 == 0) + { + Main.tile[i, index1 - num4].frameX = (short) 22; + Main.tile[i, index1 - num4].frameY = (short) 198; + } + if (num5 == 1) + { + Main.tile[i, index1 - num4].frameX = (short) 22; + Main.tile[i, index1 - num4].frameY = (short) 220; + } + if (num5 == 2) + { + Main.tile[i, index1 - num4].frameX = (short) 22; + Main.tile[i, index1 - num4].frameY = (short) 242; + } + } + else + { + int num5 = WorldGen.genRand.Next(3); + if (num5 == 0) + { + Main.tile[i, index1 - num4].frameX = (short) 0; + Main.tile[i, index1 - num4].frameY = (short) 198; + } + if (num5 == 1) + { + Main.tile[i, index1 - num4].frameX = (short) 0; + Main.tile[i, index1 - num4].frameY = (short) 220; + } + if (num5 == 2) + { + Main.tile[i, index1 - num4].frameX = (short) 0; + Main.tile[i, index1 - num4].frameY = (short) 242; + } + } + WorldGen.RangeFrame(i - 2, index1 - num4 - 1, i + 2, index1 + 1); + if (Main.netMode != 2) + return; + NetMessage.SendTileSquare(i, (int) ((double) index1 - (double) num4 * 0.5), num4 + 1); + } + + public static void GrowShroom(int i, int y) + { + int index1 = y; + if ((int) Main.tile[i - 1, index1 - 1].lava != 0 || (int) Main.tile[i - 1, index1 - 1].lava != 0 || ((int) Main.tile[i + 1, index1 - 1].lava != 0 || (int) Main.tile[i, index1].active == 0) || ((int) Main.tile[i, index1].type != 70 || (int) Main.tile[i, index1 - 1].wall != 0 || ((int) Main.tile[i - 1, index1].active == 0 || (int) Main.tile[i - 1, index1].type != 70)) || ((int) Main.tile[i + 1, index1].active == 0 || (int) Main.tile[i + 1, index1].type != 70 || !WorldGen.EmptyTileCheckShroom(i - 2, i + 2, index1 - 13, index1 - 1))) + return; + int num1 = WorldGen.genRand.Next(4, 11); + for (int index2 = index1 - num1; index2 < index1; ++index2) + { + Main.tile[i, index2].frameNumber = (byte) WorldGen.genRand.Next(3); + Main.tile[i, index2].active = (byte) 1; + Main.tile[i, index2].type = (byte) 72; + int num2 = WorldGen.genRand.Next(3); + if (num2 == 0) + { + Main.tile[i, index2].frameX = (short) 0; + Main.tile[i, index2].frameY = (short) 0; + } + if (num2 == 1) + { + Main.tile[i, index2].frameX = (short) 0; + Main.tile[i, index2].frameY = (short) 18; + } + if (num2 == 2) + { + Main.tile[i, index2].frameX = (short) 0; + Main.tile[i, index2].frameY = (short) 36; + } + } + int num3 = WorldGen.genRand.Next(3); + if (num3 == 0) + { + Main.tile[i, index1 - num1].frameX = (short) 36; + Main.tile[i, index1 - num1].frameY = (short) 0; + } + if (num3 == 1) + { + Main.tile[i, index1 - num1].frameX = (short) 36; + Main.tile[i, index1 - num1].frameY = (short) 18; + } + if (num3 == 2) + { + Main.tile[i, index1 - num1].frameX = (short) 36; + Main.tile[i, index1 - num1].frameY = (short) 36; + } + WorldGen.RangeFrame(i - 2, index1 - num1 - 1, i + 2, index1 + 1); + if (Main.netMode != 2) + return; + NetMessage.SendTileSquare(i, (int) ((double) index1 - (double) num1 * 0.5), num1 + 1); + } + + public static void AddTrees() + { + for (int i = 1; i < (int) Main.maxTilesX - 1; ++i) + { + for (int y = 20; y < Main.worldSurface; ++y) + WorldGen.GrowTree(i, y); + int num = WorldGen.genRand.Next(12); + if (num <= 6) + { + ++i; + if (num == 0) + ++i; + } + } + } + + public static unsafe bool EmptyTileCheck(int startX, int endX, int startY, int endY) + { + if (startX < 0 || endX >= (int) Main.maxTilesX || (startY < 0 || endY >= (int) Main.maxTilesY)) + return false; + Tile[,] tileArray; + // ISSUE: cast to a reference type + // ISSUE: explicit reference operation + fixed (Tile* tilePtr1 = &^((tileArray = Main.tile) == null || tileArray.Length == 0 ? (Tile&) IntPtr.Zero : tileArray.Address(0, 0))) + { +label_3: + int num = startY; + Tile* tilePtr2 = tilePtr1 + (startX * 1440 + num); + while ((int) tilePtr2->active == 0) + { + ++tilePtr2; + if (++num > endY) + { + if (++startX > endX) + { + // ISSUE: __unpin statement + __unpin(tilePtr1); + return true; + } + else + goto label_3; + } + } + return false; + } + } + + public static unsafe bool EmptyTileCheckTree(int startX, int endX, int startY, int endY) + { + if (startX < 0 || endX >= (int) Main.maxTilesX || (startY < 0 || endY >= (int) Main.maxTilesY)) + return false; + Tile[,] tileArray; + // ISSUE: cast to a reference type + // ISSUE: explicit reference operation + fixed (Tile* tilePtr1 = &^((tileArray = Main.tile) == null || tileArray.Length == 0 ? (Tile&) IntPtr.Zero : tileArray.Address(0, 0))) + { + do + { + int num = startY; + Tile* tilePtr2 = tilePtr1 + (startX * 1440 + num); + do + { + if ((int) tilePtr2->active != 0) + { + switch (tilePtr2->type) + { + case (byte) 20: + case (byte) 3: + case (byte) 24: + case (byte) 61: + case (byte) 32: + case (byte) 69: + case (byte) 73: + case (byte) 74: + case (byte) 110: + case (byte) 113: + break; + default: + return false; + } + } + ++tilePtr2; + } + while (++num <= endY); + } + while (++startX <= endX); + } + return true; + } + + public static unsafe bool EmptyTileCheckShroom(int startX, int endX, int startY, int endY) + { + if (startX < 0 || endX >= (int) Main.maxTilesX || (startY < 0 || endY >= (int) Main.maxTilesY)) + return false; + Tile[,] tileArray; + // ISSUE: cast to a reference type + // ISSUE: explicit reference operation + fixed (Tile* tilePtr1 = &^((tileArray = Main.tile) == null || tileArray.Length == 0 ? (Tile&) IntPtr.Zero : tileArray.Address(0, 0))) + { +label_3: + int num = startY; + Tile* tilePtr2 = tilePtr1 + (startX * 1440 + num); + while ((int) tilePtr2->active == 0 || (int) tilePtr2->type == 71) + { + ++tilePtr2; + if (++num > endY) + { + if (++startX > endX) + { + // ISSUE: __unpin statement + __unpin(tilePtr1); + return true; + } + else + goto label_3; + } + } + return false; + } + } + + public static void StartHardmodeCallBack() + { + Thread.CurrentThread.SetProcessorAffinity(new int[1] + { + 4 + }); + WorldGen.hardLock = true; + float num1 = (float) WorldGen.genRand.Next(300, 400) * (1.0 / 1000.0); + int i1 = (int) ((double) Main.maxTilesX * (double) num1); + int i2 = (int) ((double) Main.maxTilesX * (1.0 - (double) num1)); + int num2 = 1; + if (WorldGen.genRand.Next(2) == 0) + { + int num3 = i2; + i2 = i1; + i1 = num3; + num2 = -1; + } + Vector2i vector2i1 = new Vector2i(); + vector2i1.X = (int) Main.maxTilesX; + vector2i1.Y = (int) Main.maxTilesY; + Vector2i vector2i2 = new Vector2i(); + WorldGen.GERunner(i1, new Vector2((float) (3 * num2), 5f), true, ref vector2i1, ref vector2i2); + WorldGen.GERunner(i2, new Vector2((float) (-3 * num2), 5f), false, ref vector2i1, ref vector2i2); + Netplay.ResetSections(ref vector2i1, ref vector2i2); + Main.hardMode = true; + WorldGen.hardLock = false; + } + + public static void StartHardmode() + { + if (Main.netMode == 1 || Main.hardMode) + return; + new Thread(new ThreadStart(WorldGen.StartHardmodeCallBack)) + { + IsBackground = true + }.Start(); + NetMessage.SendText(15, 50, (int) byte.MaxValue, 130, -1); + UI.SetTriggerStateForAll(Trigger.UnlockedHardMode); + } + + public static unsafe bool PlaceDoor(int i, int j, int type) + { + if (j >= 2 && j < (int) Main.maxTilesY - 2) + { + fixed (Tile* tilePtr = &Main.tile[i, j]) + { + if ((int) tilePtr[-2].active != 0 && Main.tileSolid[(int) tilePtr[-2].type] && ((int) tilePtr[2].active != 0 && Main.tileSolid[(int) tilePtr[2].type])) + { + tilePtr[-1].active = (byte) 1; + tilePtr[-1].type = (byte) 10; + tilePtr[-1].frameY = (short) 0; + tilePtr[-1].frameX = (short) (WorldGen.genRand.Next(3) * 18); + tilePtr->active = (byte) 1; + tilePtr->type = (byte) 10; + tilePtr->frameY = (short) 18; + tilePtr->frameX = (short) (WorldGen.genRand.Next(3) * 18); + tilePtr[1].active = (byte) 1; + tilePtr[1].type = (byte) 10; + tilePtr[1].frameY = (short) 36; + tilePtr[1].frameX = (short) (WorldGen.genRand.Next(3) * 18); + return true; + } + else + { + // ISSUE: __unpin statement + __unpin(tilePtr); + } + } + } + return false; + } + + public static bool CanCloseDoor(int i, int j) + { + int i1 = i; + int num1 = j; + switch (Main.tile[i, j].frameX) + { + case (short) 18: + --i1; + break; + case (short) 36: + ++i1; + break; + } + int num2 = (int) Main.tile[i, j].frameY; + int j1 = num1 - num2 / 18; + return !Collision.AnyPlayerOrNPC(i1, j1, 3); + } + + public static bool CloseDoor(int i, int j, bool forced = false) + { + int num1 = 0; + int i1 = i; + int num2 = j; + switch (Main.tile[i, j].frameX) + { + case (short) 0: + num1 = 1; + break; + case (short) 18: + --i1; + num1 = 1; + break; + case (short) 36: + ++i1; + num1 = -1; + break; + case (short) 54: + num1 = -1; + break; + } + int num3 = (int) Main.tile[i, j].frameY; + int j1 = num2 - num3 / 18; + if (!forced && Collision.AnyPlayerOrNPC(i1, j1, 3)) + return false; + int num4 = i1; + if (num1 == -1) + --num4; + for (int index1 = num4; index1 < num4 + 2; ++index1) + { + for (int index2 = j1; index2 < j1 + 3; ++index2) + { + if (index1 == i1) + { + Main.tile[index1, index2].type = (byte) 10; + Main.tile[index1, index2].frameX = (short) (WorldGen.genRand.Next(3) * 18); + } + else + Main.tile[index1, index2].active = (byte) 0; + } + } + if (Main.netMode != 1) + { + for (int index = 0; index < 3; ++index) + { + if (WorldGen.numNoWire < 999) + { + WorldGen.noWire[WorldGen.numNoWire].X = (short) i1; + WorldGen.noWire[WorldGen.numNoWire].Y = (short) (j1 + index); + ++WorldGen.numNoWire; + } + } + } + bool flag = WorldGen.tileFrameRecursion; + WorldGen.tileFrameRecursion = false; + WorldGen.TileFrame(i1 - 1, j1 - 1, 0); + WorldGen.TileFrame(i1 - 1, j1, 0); + WorldGen.TileFrame(i1 - 1, j1 + 1, 0); + WorldGen.TileFrame(i1 - 1, j1 + 2, 0); + WorldGen.TileFrame(i1, j1 - 1, 0); + WorldGen.TileFrame(i1, j1, 0); + WorldGen.TileFrame(i1, j1 + 1, 0); + WorldGen.TileFrame(i1, j1 + 2, 0); + WorldGen.TileFrame(i1 + 1, j1 - 1, 0); + WorldGen.TileFrame(i1 + 1, j1, 0); + WorldGen.TileFrame(i1 + 1, j1 + 1, 0); + WorldGen.TileFrame(i1 + 1, j1 + 2, 0); + WorldGen.tileFrameRecursion = flag; + Main.PlaySound(9, i * 16, j * 16, 1); + return true; + } + + public static unsafe bool AddLifeCrystal(int i, int j) + { + Tile[,] tileArray; + // ISSUE: cast to a reference type + // ISSUE: explicit reference operation + fixed (Tile* tilePtr1 = &^((tileArray = Main.tile) == null || tileArray.Length == 0 ? (Tile&) IntPtr.Zero : tileArray.Address(0, 0))) + { + Tile* tilePtr2 = tilePtr1 + (i * 1440 + j); + while (j < (int) Main.maxTilesY) + { + if ((int) tilePtr2->active != 0 && Main.tileSolid[(int) tilePtr2->type]) + { + if ((int) tilePtr2[-2].lava != 0 || (int) tilePtr2[-1442].lava != 0 || !WorldGen.EmptyTileCheck(i - 1, i, j - 2, j - 1)) + return false; + tilePtr2[-1442].active = (byte) 1; + tilePtr2[-1442].type = (byte) 12; + tilePtr2[-1442].frameX = (short) 0; + tilePtr2[-1442].frameY = (short) 0; + tilePtr2[-1441].active = (byte) 1; + tilePtr2[-1441].type = (byte) 12; + tilePtr2[-1441].frameX = (short) 0; + tilePtr2[-1441].frameY = (short) 18; + tilePtr2[-2].active = (byte) 1; + tilePtr2[-2].type = (byte) 12; + tilePtr2[-2].frameX = (short) 18; + tilePtr2[-2].frameY = (short) 0; + tilePtr2[-1].active = (byte) 1; + tilePtr2[-1].type = (byte) 12; + tilePtr2[-1].frameX = (short) 18; + tilePtr2[-1].frameY = (short) 18; + return true; + } + else + { + ++j; + ++tilePtr2; + } + } + } + return false; + } + + public static void AddShadowOrb(int x, int y) + { + if (x < 10 || x > (int) Main.maxTilesX - 10 || (y < 10 || y > (int) Main.maxTilesY - 10)) + return; + for (int index1 = x - 1; index1 < x + 1; ++index1) + { + for (int index2 = y - 1; index2 < y + 1; ++index2) + { + if ((int) Main.tile[index1, index2].active != 0 && (int) Main.tile[index1, index2].type == 31) + return; + } + } + Main.tile[x - 1, y - 1].active = (byte) 1; + Main.tile[x - 1, y - 1].type = (byte) 31; + Main.tile[x - 1, y - 1].frameX = (short) 0; + Main.tile[x - 1, y - 1].frameY = (short) 0; + Main.tile[x, y - 1].active = (byte) 1; + Main.tile[x, y - 1].type = (byte) 31; + Main.tile[x, y - 1].frameX = (short) 18; + Main.tile[x, y - 1].frameY = (short) 0; + Main.tile[x - 1, y].active = (byte) 1; + Main.tile[x - 1, y].type = (byte) 31; + Main.tile[x - 1, y].frameX = (short) 0; + Main.tile[x - 1, y].frameY = (short) 18; + Main.tile[x, y].active = (byte) 1; + Main.tile[x, y].type = (byte) 31; + Main.tile[x, y].frameX = (short) 18; + Main.tile[x, y].frameY = (short) 18; + } + + public static void AddHellHouses() + { + int num1 = (int) ((double) Main.maxTilesX * 0.25); + for (int i = num1; i < (int) Main.maxTilesX - num1; ++i) + { + int j = (int) Main.maxTilesY - 40; + while ((int) Main.tile[i, j].active != 0 || (int) Main.tile[i, j].liquid > 0) + --j; + if ((int) Main.tile[i, j + 1].active != 0) + { + int type; + int wall; + if (WorldGen.genRand.Next(10) == 0) + { + type = 76; + wall = 13; + } + else + { + type = 75; + wall = 14; + } + WorldGen.HellHouse(i, j, type, wall); + i += WorldGen.genRand.Next(15, 80); + } + } + float num2 = (float) Main.maxTilesX * 0.0002380952f; + for (int index1 = 0; (double) index1 < 200.0 * (double) num2; ++index1) + { + int num3 = 0; + bool flag1 = false; + while (!flag1) + { + ++num3; + int index2 = WorldGen.genRand.Next((int) ((double) Main.maxTilesX * 0.2), (int) ((double) Main.maxTilesX * 0.8)); + int j = WorldGen.genRand.Next((int) Main.maxTilesY - 300, (int) Main.maxTilesY - 20); + if ((int) Main.tile[index2, j].active != 0 && ((int) Main.tile[index2, j].type == 75 || (int) Main.tile[index2, j].type == 76)) + { + int num4 = 0; + if ((int) Main.tile[index2 - 1, j].wall > 0) + num4 = -1; + else if ((int) Main.tile[index2 + 1, j].wall > 0) + num4 = 1; + if ((int) Main.tile[index2 + num4, j].active == 0 && (int) Main.tile[index2 + num4, j + 1].active == 0) + { + bool flag2 = false; + for (int index3 = index2 - 8; index3 < index2 + 8; ++index3) + { + for (int index4 = j - 8; index4 < j + 8; ++index4) + { + if ((int) Main.tile[index3, index4].active != 0 && (int) Main.tile[index3, index4].type == 4) + { + flag2 = true; + break; + } + } + } + if (!flag2) + { + WorldGen.PlaceTile(index2 + num4, j, 4, true, true, -1, 7); + flag1 = true; + } + } + } + if (num3 > 1000) + flag1 = true; + } + } + } + + public static void HellHouse(int i, int j, int type, int wall) + { + int width = WorldGen.genRand.Next(8, 20); + int num1 = WorldGen.genRand.Next(1, 3); + int num2 = WorldGen.genRand.Next(4, 13); + int i1 = i; + int j1 = j; + for (int index = 0; index < num1; ++index) + { + int height = WorldGen.genRand.Next(5, 9); + WorldGen.HellRoom(i1, j1, width, height, type, wall); + j1 -= height; + } + int j2 = j; + for (int index = 0; index < num2; ++index) + { + int height = WorldGen.genRand.Next(5, 9); + j2 += height; + WorldGen.HellRoom(i1, j2, width, height, type, wall); + } + for (int index1 = i - (width >> 1); index1 <= i + (width >> 1); ++index1) + { + int index2 = j; + while (index2 < (int) Main.maxTilesY && ((int) Main.tile[index1, index2].active != 0 && ((int) Main.tile[index1, index2].type == 76 || (int) Main.tile[index1, index2].type == 75) || ((int) Main.tile[i, index2].wall == 13 || (int) Main.tile[i, index2].wall == 14))) + ++index2; + int num3 = 6 + WorldGen.genRand.Next(3); + while (index2 < (int) Main.maxTilesY && (int) Main.tile[index1, index2].active == 0) + { + --num3; + Main.tile[index1, index2].active = (byte) 1; + Main.tile[index1, index2].type = (byte) 57; + ++index2; + if (num3 <= 0) + break; + } + } + int index3 = j; + while (index3 < (int) Main.maxTilesY && ((int) Main.tile[i, index3].active != 0 && ((int) Main.tile[i, index3].type == 76 || (int) Main.tile[i, index3].type == 75) || ((int) Main.tile[i, index3].wall == 13 || (int) Main.tile[i, index3].wall == 14))) + ++index3; + int index4 = index3 - 1; + int upperBound = index4; + while ((int) Main.tile[i, index4].active != 0 && ((int) Main.tile[i, index4].type == 76 || (int) Main.tile[i, index4].type == 75) || ((int) Main.tile[i, index4].wall == 13 || (int) Main.tile[i, index4].wall == 14)) + { + --index4; + if ((int) Main.tile[i, index4].active != 0 && ((int) Main.tile[i, index4].type == 76 || (int) Main.tile[i, index4].type == 75)) + { + int num3 = WorldGen.genRand.Next(i - (width >> 1) + 1, i + (width >> 1) - 1); + int num4 = WorldGen.genRand.Next(i - (width >> 1) + 1, i + (width >> 1) - 1); + if (num3 > num4) + { + int num5 = num3; + num3 = num4; + num4 = num5; + } + if (num3 == num4) + { + if (num3 < i) + ++num4; + else + --num3; + } + for (int index1 = num3; index1 <= num4; ++index1) + { + if ((int) Main.tile[index1, index4 - 1].wall == 13) + Main.tile[index1, index4].wall = (byte) 13; + if ((int) Main.tile[index1, index4 - 1].wall == 14) + Main.tile[index1, index4].wall = (byte) 14; + Main.tile[index1, index4].type = (byte) 19; + Main.tile[index1, index4].active = (byte) 1; + } + --index4; + } + } + int lowerBound = index4; + float num6 = (float) ((upperBound - lowerBound) * width) * 0.02f; + for (int index1 = 0; (double) index1 < (double) num6; ++index1) + { + int num3 = WorldGen.genRand.Next(i - (width >> 1), i + (width >> 1) + 1); + int num4 = WorldGen.genRand.Next(lowerBound, upperBound); + int num5 = WorldGen.genRand.Next(3, 8); + float num7 = (float) num5 * 0.4f; + float num8 = num7 * num7; + for (int index2 = num3 - num5; index2 <= num3 + num5; ++index2) + { + float num9 = (float) (index2 - num3); + float num10 = num9 * num9; + for (int index5 = num4 - num5; index5 <= num4 + num5; ++index5) + { + float num11 = (float) (index5 - num4); + if ((double) (num10 + num11 * num11) < (double) num8) + { + try + { + if ((int) Main.tile[index2, index5].type == 76 || (int) Main.tile[index2, index5].type == 19) + Main.tile[index2, index5].active = (byte) 0; + Main.tile[index2, index5].wall = (byte) 0; + } + catch + { + } + } + } + } + } + } + + public static void HellRoom(int i, int j, int width, int height, int type, int wall) + { + if (j > (int) Main.maxTilesY - 40) + return; + width >>= 1; + for (int index1 = i - width; index1 <= i + width; ++index1) + { + for (int index2 = j - height; index2 <= j; ++index2) + { + try + { + Main.tile[index1, index2].active = (byte) 1; + Main.tile[index1, index2].type = (byte) type; + Main.tile[index1, index2].liquid = (byte) 0; + Main.tile[index1, index2].lava = (byte) 0; + } + catch + { + } + } + } + for (int index1 = i - width + 1; index1 <= i + width - 1; ++index1) + { + for (int index2 = j - height + 1; index2 <= j - 1; ++index2) + { + try + { + Main.tile[index1, index2].active = (byte) 0; + Main.tile[index1, index2].wall = (byte) wall; + Main.tile[index1, index2].liquid = (byte) 0; + Main.tile[index1, index2].lava = (byte) 0; + } + catch + { + } + } + } + } + + public static void MakeDungeon(int x, int y, int tileType = 41, int wallType = 7) + { + int num1 = WorldGen.genRand.Next(3); + int num2 = WorldGen.genRand.Next(3); + if (num1 == 1) + tileType = 43; + else if (num1 == 2) + tileType = 44; + if (num2 == 1) + wallType = 8; + else if (num2 == 2) + wallType = 9; + WorldGen.numDDoors = 0; + WorldGen.numDPlats = 0; + WorldGen.numDRooms = 0; + WorldGen.dungeonX = x; + WorldGen.dungeonY = y; + WorldGen.dMinX = x; + WorldGen.dMaxX = x; + WorldGen.dMinY = y; + WorldGen.dMaxY = y; + WorldGen.dxStrength1 = (double) WorldGen.genRand.Next(25, 30); + WorldGen.dyStrength1 = (double) WorldGen.genRand.Next(20, 25); + WorldGen.dxStrength2 = (double) WorldGen.genRand.Next(35, 50); + WorldGen.dyStrength2 = (double) WorldGen.genRand.Next(10, 15); + int num3 = (int) Main.maxTilesX / 60; + int num4 = num3 + WorldGen.genRand.Next(num3 / 3); + int num5 = num4; + int num6 = 5; + WorldGen.DungeonRoom(WorldGen.dungeonX, WorldGen.dungeonY, tileType, wallType); + while (num4 > 0) + { + if (WorldGen.dungeonX < WorldGen.dMinX) + WorldGen.dMinX = WorldGen.dungeonX; + if (WorldGen.dungeonX > WorldGen.dMaxX) + WorldGen.dMaxX = WorldGen.dungeonX; + if (WorldGen.dungeonY > WorldGen.dMaxY) + WorldGen.dMaxY = WorldGen.dungeonY; + --num4; + UI.main.progress = (float) (num5 - num4) * 0.6f / (float) num5; + if (num6 > 0) + --num6; + if (num6 == 0 & WorldGen.genRand.Next(3) == 0) + { + num6 = 5; + if (WorldGen.genRand.Next(2) == 0) + { + int num7 = WorldGen.dungeonX; + int num8 = WorldGen.dungeonY; + WorldGen.DungeonHalls(WorldGen.dungeonX, WorldGen.dungeonY, tileType, wallType, false); + if (WorldGen.genRand.Next(2) == 0) + WorldGen.DungeonHalls(WorldGen.dungeonX, WorldGen.dungeonY, tileType, wallType, false); + WorldGen.DungeonRoom(WorldGen.dungeonX, WorldGen.dungeonY, tileType, wallType); + WorldGen.dungeonX = num7; + WorldGen.dungeonY = num8; + } + else + WorldGen.DungeonRoom(WorldGen.dungeonX, WorldGen.dungeonY, tileType, wallType); + } + else + WorldGen.DungeonHalls(WorldGen.dungeonX, WorldGen.dungeonY, tileType, wallType, false); + } + WorldGen.DungeonRoom(WorldGen.dungeonX, WorldGen.dungeonY, tileType, wallType); + int num9 = (int) WorldGen.dRoom[0].X; + int num10 = (int) WorldGen.dRoom[0].Y; + for (int index = 1; index < WorldGen.numDRooms; ++index) + { + if ((int) WorldGen.dRoom[index].Y < num10) + { + num9 = (int) WorldGen.dRoom[index].X; + num10 = (int) WorldGen.dRoom[index].Y; + } + } + WorldGen.dungeonX = num9; + WorldGen.dungeonY = num10; + WorldGen.dEnteranceX = num9; + WorldGen.dSurface = false; + int num11 = 5; + while (!WorldGen.dSurface) + { + if (num11 > 0) + --num11; + if (num11 == 0 & WorldGen.genRand.Next(5) == 0 && WorldGen.dungeonY > Main.worldSurface + 50) + { + num11 = 10; + int num7 = WorldGen.dungeonX; + int num8 = WorldGen.dungeonY; + WorldGen.DungeonHalls(WorldGen.dungeonX, WorldGen.dungeonY, tileType, wallType, true); + WorldGen.DungeonRoom(WorldGen.dungeonX, WorldGen.dungeonY, tileType, wallType); + WorldGen.dungeonX = num7; + WorldGen.dungeonY = num8; + } + WorldGen.DungeonStairs(WorldGen.dungeonX, WorldGen.dungeonY, tileType, wallType); + } + WorldGen.DungeonEnt(WorldGen.dungeonX, WorldGen.dungeonY, tileType, wallType); + UI.main.progress = 0.65f; + for (int index1 = 0; index1 < WorldGen.numDRooms; ++index1) + { + for (int index2 = (int) WorldGen.dRoom[index1].L; index2 <= (int) WorldGen.dRoom[index1].R; ++index2) + { + int index3 = (int) WorldGen.dRoom[index1].T - 1; + if ((int) Main.tile[index2, index3].active == 0) + { + WorldGen.DPlat[WorldGen.numDPlats].X = (short) index2; + WorldGen.DPlat[WorldGen.numDPlats].Y = (short) index3; + ++WorldGen.numDPlats; + break; + } + } + for (int index2 = (int) WorldGen.dRoom[index1].L; index2 <= (int) WorldGen.dRoom[index1].R; ++index2) + { + int index3 = (int) WorldGen.dRoom[index1].B + 1; + if ((int) Main.tile[index2, index3].active == 0) + { + WorldGen.DPlat[WorldGen.numDPlats].X = (short) index2; + WorldGen.DPlat[WorldGen.numDPlats].Y = (short) index3; + ++WorldGen.numDPlats; + break; + } + } + for (int index2 = (int) WorldGen.dRoom[index1].T; index2 <= (int) WorldGen.dRoom[index1].B; ++index2) + { + int index3 = (int) WorldGen.dRoom[index1].L - 1; + if ((int) Main.tile[index3, index2].active == 0) + { + WorldGen.dDoor[WorldGen.numDDoors].X = (short) index3; + WorldGen.dDoor[WorldGen.numDDoors].Y = (short) index2; + WorldGen.dDoor[WorldGen.numDDoors].Pos = (short) -1; + ++WorldGen.numDDoors; + break; + } + } + for (int index2 = (int) WorldGen.dRoom[index1].T; index2 <= (int) WorldGen.dRoom[index1].B; ++index2) + { + int index3 = (int) WorldGen.dRoom[index1].R + 1; + if ((int) Main.tile[index3, index2].active == 0) + { + WorldGen.dDoor[WorldGen.numDDoors].X = (short) index3; + WorldGen.dDoor[WorldGen.numDDoors].Y = (short) index2; + WorldGen.dDoor[WorldGen.numDDoors].Pos = (short) 1; + ++WorldGen.numDDoors; + break; + } + } + } + UI.main.progress = 0.7f; + int num12 = 0; + int num13 = 1000; + int num14 = 0; + while (num14 < (int) Main.maxTilesX / 100) + { + ++num12; + int index1 = WorldGen.genRand.Next(WorldGen.dMinX, WorldGen.dMaxX); + int index2 = WorldGen.genRand.Next(Main.worldSurface + 25, WorldGen.dMaxY); + int num7 = index1; + if ((int) Main.tile[index1, index2].wall == wallType && (int) Main.tile[index1, index2].active == 0) + { + int num8 = 1; + if (WorldGen.genRand.Next(2) == 0) + num8 = -1; + while ((int) Main.tile[index1, index2].active == 0) + index2 += num8; + if ((int) Main.tile[index1 - 1, index2].active != 0 && (int) Main.tile[index1 + 1, index2].active != 0 && ((int) Main.tile[index1 - 1, index2 - num8].active == 0 && (int) Main.tile[index1 + 1, index2 - num8].active == 0)) + { + ++num14; + for (int index3 = WorldGen.genRand.Next(5, 13); (int) Main.tile[index1 - 1, index2].active != 0 && (int) Main.tile[index1, index2 + num8].active != 0 && ((int) Main.tile[index1, index2].active != 0 && (int) Main.tile[index1, index2 - num8].active == 0) && index3 > 0; --index3) + { + Main.tile[index1, index2].type = (byte) 48; + if ((int) Main.tile[index1 - 1, index2 - num8].active == 0 && (int) Main.tile[index1 + 1, index2 - num8].active == 0) + { + Main.tile[index1, index2 - num8].type = (byte) 48; + Main.tile[index1, index2 - num8].active = (byte) 1; + } + --index1; + } + int num15 = WorldGen.genRand.Next(5, 13); + for (int index3 = num7 + 1; (int) Main.tile[index3 + 1, index2].active != 0 && (int) Main.tile[index3, index2 + num8].active != 0 && ((int) Main.tile[index3, index2].active != 0 && (int) Main.tile[index3, index2 - num8].active == 0) && num15 > 0; --num15) + { + Main.tile[index3, index2].type = (byte) 48; + if ((int) Main.tile[index3 - 1, index2 - num8].active == 0 && (int) Main.tile[index3 + 1, index2 - num8].active == 0) + { + Main.tile[index3, index2 - num8].type = (byte) 48; + Main.tile[index3, index2 - num8].active = (byte) 1; + } + ++index3; + } + } + } + if (num12 > num13) + { + num12 = 0; + ++num14; + } + } + int num16 = 0; + int num17 = 1000; + int num18 = 0; + UI.main.progress = 0.75f; + while (num18 < (int) Main.maxTilesX / 100) + { + ++num16; + int index1 = WorldGen.genRand.Next(WorldGen.dMinX, WorldGen.dMaxX); + int index2 = WorldGen.genRand.Next(Main.worldSurface + 25, WorldGen.dMaxY); + int num7 = index2; + if ((int) Main.tile[index1, index2].wall == wallType && (int) Main.tile[index1, index2].active == 0) + { + int num8 = 1; + if (WorldGen.genRand.Next(2) == 0) + num8 = -1; + while (index1 > 5 && index1 < (int) Main.maxTilesX - 5 && (int) Main.tile[index1, index2].active == 0) + index1 += num8; + if ((int) Main.tile[index1, index2 - 1].active != 0 && (int) Main.tile[index1, index2 + 1].active != 0 && ((int) Main.tile[index1 - num8, index2 - 1].active == 0 && (int) Main.tile[index1 - num8, index2 + 1].active == 0)) + { + ++num18; + for (int index3 = WorldGen.genRand.Next(5, 13); (int) Main.tile[index1, index2 - 1].active != 0 && (int) Main.tile[index1 + num8, index2].active != 0 && ((int) Main.tile[index1, index2].active != 0 && (int) Main.tile[index1 - num8, index2].active == 0) && index3 > 0; --index3) + { + Main.tile[index1, index2].type = (byte) 48; + if ((int) Main.tile[index1 - num8, index2 - 1].active == 0 && (int) Main.tile[index1 - num8, index2 + 1].active == 0) + { + Main.tile[index1 - num8, index2].type = (byte) 48; + Main.tile[index1 - num8, index2].active = (byte) 1; + } + --index2; + } + int num15 = WorldGen.genRand.Next(5, 13); + for (int index3 = num7 + 1; (int) Main.tile[index1, index3 + 1].active != 0 && (int) Main.tile[index1 + num8, index3].active != 0 && ((int) Main.tile[index1, index3].active != 0 && (int) Main.tile[index1 - num8, index3].active == 0) && num15 > 0; --num15) + { + Main.tile[index1, index3].type = (byte) 48; + if ((int) Main.tile[index1 - num8, index3 - 1].active == 0 && (int) Main.tile[index1 - num8, index3 + 1].active == 0) + { + Main.tile[index1 - num8, index3].type = (byte) 48; + Main.tile[index1 - num8, index3].active = (byte) 1; + } + ++index3; + } + } + } + if (num16 > num17) + { + num16 = 0; + ++num18; + } + } + UI.main.progress = 0.8f; + for (int index1 = 0; index1 < WorldGen.numDDoors; ++index1) + { + int num7 = (int) WorldGen.dDoor[index1].X - 10; + int num8 = (int) WorldGen.dDoor[index1].X + 10; + int num15 = 100; + int num19 = 0; + for (int index2 = num7; index2 < num8; ++index2) + { + bool flag = true; + int index3 = (int) WorldGen.dDoor[index1].Y; + while ((int) Main.tile[index2, index3].active == 0) + --index3; + if (!Main.tileDungeon[(int) Main.tile[index2, index3].type]) + flag = false; + int num20 = index3; + int index4 = (int) WorldGen.dDoor[index1].Y; + while ((int) Main.tile[index2, index4].active == 0) + ++index4; + if (!Main.tileDungeon[(int) Main.tile[index2, index4].type]) + flag = false; + int num21 = index4; + if (num21 - num20 >= 3) + { + int num22 = index2 - 20; + int num23 = index2 + 20; + int num24 = num21 - 10; + int num25 = num21 + 10; + for (int index5 = num22; index5 < num23; ++index5) + { + for (int index6 = num24; index6 < num25; ++index6) + { + if ((int) Main.tile[index5, index6].active != 0 && (int) Main.tile[index5, index6].type == 10) + { + flag = false; + break; + } + } + } + if (flag) + { + for (int index5 = num21 - 3; index5 < num21; ++index5) + { + for (int index6 = index2 - 3; index6 <= index2 + 3; ++index6) + { + if ((int) Main.tile[index6, index5].active != 0) + { + flag = false; + break; + } + } + } + } + if (flag && num21 - num20 < 20 && ((int) WorldGen.dDoor[index1].Pos == 0 && num21 - num20 < num15 || (int) WorldGen.dDoor[index1].Pos == -1 && index2 > num19 || (int) WorldGen.dDoor[index1].Pos == 1 && (index2 < num19 || num19 == 0))) + { + num19 = index2; + num15 = num21 - num20; + } + } + } + if (num15 < 20) + { + int i = num19; + int index2 = (int) WorldGen.dDoor[index1].Y; + int index3 = index2; + for (; (int) Main.tile[i, index2].active == 0; ++index2) + Main.tile[i, index2].active = (byte) 0; + while ((int) Main.tile[i, index3].active == 0) + --index3; + int j = index2 - 1; + int num20 = index3 + 1; + for (int index4 = num20; index4 < j - 2; ++index4) + { + Main.tile[i, index4].active = (byte) 1; + Main.tile[i, index4].type = (byte) tileType; + } + WorldGen.PlaceTile(i, j, 10, true, false, -1, 0); + int index5 = i - 1; + int index6 = j - 3; + while ((int) Main.tile[index5, index6].active == 0) + --index6; + if (j - index6 < j - num20 + 5 && Main.tileDungeon[(int) Main.tile[index5, index6].type]) + { + for (int index4 = j - 4 - WorldGen.genRand.Next(3); index4 > index6; --index4) + { + Main.tile[index5, index4].active = (byte) 1; + Main.tile[index5, index4].type = (byte) tileType; + } + } + int index7 = index5 + 2; + int index8 = j - 3; + while ((int) Main.tile[index7, index8].active == 0) + --index8; + if (j - index8 < j - num20 + 5 && Main.tileDungeon[(int) Main.tile[index7, index8].type]) + { + for (int index4 = j - 4 - WorldGen.genRand.Next(3); index4 > index8; --index4) + { + Main.tile[index7, index4].active = (byte) 1; + Main.tile[index7, index4].type = (byte) tileType; + } + } + int index9 = j + 1; + int num21 = index7 - 1; + Main.tile[num21 - 1, index9].active = (byte) 1; + Main.tile[num21 - 1, index9].type = (byte) tileType; + Main.tile[num21 + 1, index9].active = (byte) 1; + Main.tile[num21 + 1, index9].type = (byte) tileType; + } + } + UI.main.progress = 0.85f; + for (int index1 = 0; index1 < WorldGen.numDPlats; ++index1) + { + int index2 = (int) WorldGen.DPlat[index1].X; + int num7 = (int) WorldGen.DPlat[index1].Y; + int num8 = (int) Main.maxTilesX; + int num15 = 10; + for (int index3 = num7 - 5; index3 <= num7 + 5; ++index3) + { + int index4 = index2; + int index5 = index2; + bool flag1 = false; + if ((int) Main.tile[index4, index3].active != 0) + { + flag1 = true; + } + else + { + while ((int) Main.tile[index4, index3].active == 0) + { + --index4; + if (!Main.tileDungeon[(int) Main.tile[index4, index3].type]) + flag1 = true; + } + while ((int) Main.tile[index5, index3].active == 0) + { + ++index5; + if (!Main.tileDungeon[(int) Main.tile[index5, index3].type]) + flag1 = true; + } + } + if (!flag1 && index5 - index4 <= num15) + { + bool flag2 = true; + int num19 = index2 - (num15 >> 1) - 2; + int num20 = index2 + (num15 >> 1) + 2; + int num21 = index3 - 5; + int num22 = index3 + 5; + for (int index6 = num19; index6 <= num20; ++index6) + { + for (int index7 = num21; index7 <= num22; ++index7) + { + if ((int) Main.tile[index6, index7].active != 0 && (int) Main.tile[index6, index7].type == 19) + { + flag2 = false; + break; + } + } + } + for (int index6 = index3 + 3; index6 >= index3 - 5; --index6) + { + if ((int) Main.tile[index2, index6].active != 0) + { + flag2 = false; + break; + } + } + if (flag2) + { + num8 = index3; + break; + } + } + } + if (num8 > num7 - 10 && num8 < num7 + 10) + { + int index3 = index2; + int index4 = num8; + int index5 = index2 + 1; + for (; (int) Main.tile[index3, index4].active == 0; --index3) + { + Main.tile[index3, index4].active = (byte) 1; + Main.tile[index3, index4].type = (byte) 19; + } + for (; (int) Main.tile[index5, index4].active == 0; ++index5) + { + Main.tile[index5, index4].active = (byte) 1; + Main.tile[index5, index4].type = (byte) 19; + } + } + } + UI.main.progress = 0.9f; + int num26 = 0; + int num27 = 1000; + int num28 = 0; + while (num28 < (int) Main.maxTilesX / 20) + { + ++num26; + int index1 = WorldGen.genRand.Next(WorldGen.dMinX, WorldGen.dMaxX); + int index2 = WorldGen.genRand.Next(WorldGen.dMinY, WorldGen.dMaxY); + bool flag1 = true; + if ((int) Main.tile[index1, index2].wall == wallType && (int) Main.tile[index1, index2].active == 0) + { + int num7 = 1; + if (WorldGen.genRand.Next(2) == 0) + num7 = -1; + while (flag1 && (int) Main.tile[index1, index2].active == 0) + { + index1 -= num7; + if (index1 < 5 || index1 > (int) Main.maxTilesX - 5) + flag1 = false; + else if ((int) Main.tile[index1, index2].active != 0 && !Main.tileDungeon[(int) Main.tile[index1, index2].type]) + flag1 = false; + } + if (flag1 && (int) Main.tile[index1, index2].active != 0 && (Main.tileDungeon[(int) Main.tile[index1, index2].type] && (int) Main.tile[index1, index2 - 1].active != 0) && (Main.tileDungeon[(int) Main.tile[index1, index2 - 1].type] && (int) Main.tile[index1, index2 + 1].active != 0 && Main.tileDungeon[(int) Main.tile[index1, index2 + 1].type])) + { + int i1 = index1 + num7; + for (int index3 = i1 - 3; index3 <= i1 + 3; ++index3) + { + for (int index4 = index2 - 3; index4 <= index2 + 3; ++index4) + { + if ((int) Main.tile[index3, index4].active != 0 && (int) Main.tile[index3, index4].type == 19) + { + flag1 = false; + break; + } + } + } + if (flag1 && (int) Main.tile[i1, index2 - 1].active == 0 & (int) Main.tile[i1, index2 - 2].active == 0 & (int) Main.tile[i1, index2 - 3].active == 0) + { + int index3 = i1; + int num8 = i1; + while (index3 > WorldGen.dMinX && index3 < WorldGen.dMaxX && ((int) Main.tile[index3, index2].active == 0 && (int) Main.tile[index3, index2 - 1].active == 0) && (int) Main.tile[index3, index2 + 1].active == 0) + index3 += num7; + int num15 = Math.Abs(i1 - index3); + bool flag2 = false; + if (WorldGen.genRand.Next(2) == 0) + flag2 = true; + if (num15 > 5) + { + for (int index4 = WorldGen.genRand.Next(1, 4); index4 > 0; --index4) + { + Main.tile[i1, index2].active = (byte) 1; + Main.tile[i1, index2].type = (byte) 19; + if (flag2) + { + WorldGen.PlaceTile(i1, index2 - 1, 50, true, false, -1, 0); + if (WorldGen.genRand.Next(50) == 0 && (int) Main.tile[i1, index2 - 1].type == 50) + Main.tile[i1, index2 - 1].frameX = (short) 90; + } + i1 += num7; + } + num26 = 0; + ++num28; + if (!flag2 && WorldGen.genRand.Next(2) == 0) + { + int i2 = num8; + int j = index2 - 1; + int type = 0; + if (WorldGen.genRand.Next(4) == 0) + type = 1; + if (type == 0) + type = 13; + else if (type == 1) + type = 49; + WorldGen.PlaceTile(i2, j, type, true, false, -1, 0); + if ((int) Main.tile[i2, j].type == 13) + { + if (WorldGen.genRand.Next(2) == 0) + Main.tile[i2, j].frameX = (short) 18; + else + Main.tile[i2, j].frameX = (short) 36; + } + } + } + } + } + } + if (num26 > num27) + { + num26 = 0; + ++num28; + } + } + UI.main.progress = 0.95f; + int num29 = 0; + for (int index = 0; index < WorldGen.numDRooms; ++index) + { + int num7 = 0; + while (num7 < 1000) + { + int num8 = (int) ((double) WorldGen.dRoom[index].Size * 0.400000005960464); + int i = (int) WorldGen.dRoom[index].X + WorldGen.genRand.Next(-num8, num8 + 1); + int j = (int) WorldGen.dRoom[index].Y + WorldGen.genRand.Next(-num8, num8 + 1); + ++num29; + int Style = 2; + int contain; + if (num29 == 1) + contain = 329; + else if (num29 == 2) + contain = 155; + else if (num29 == 3) + contain = 156; + else if (num29 == 4) + contain = 157; + else if (num29 == 5) + contain = 163; + else if (num29 == 6) + contain = 113; + else if (num29 == 7) + { + contain = 327; + Style = 0; + } + else + { + contain = 164; + num29 = 0; + } + if (j < Main.worldSurface + 50) + { + contain = 327; + Style = 0; + } + if (contain == 0 && WorldGen.genRand.Next(2) == 0) + { + num7 = 1000; + } + else + { + if (WorldGen.AddBuriedChest(i, j, contain, false, Style)) + num7 += 1000; + ++num7; + } + } + } + WorldGen.dMinX -= 25; + WorldGen.dMaxX += 25; + WorldGen.dMinY -= 25; + WorldGen.dMaxY += 25; + if (WorldGen.dMinX < 0) + WorldGen.dMinX = 0; + if (WorldGen.dMaxX > (int) Main.maxTilesX) + WorldGen.dMaxX = (int) Main.maxTilesX; + if (WorldGen.dMinY < 0) + WorldGen.dMinY = 0; + if (WorldGen.dMaxY > (int) Main.maxTilesY) + WorldGen.dMaxY = (int) Main.maxTilesY; + int num30 = 0; + int num31 = 1000; + int num32 = 0; + while (num32 < (int) Main.maxTilesX / 150) + { + ++num30; + int x1 = WorldGen.genRand.Next(WorldGen.dMinX, WorldGen.dMaxX); + int index1 = WorldGen.genRand.Next(WorldGen.dMinY, WorldGen.dMaxY); + if ((int) Main.tile[x1, index1].wall == wallType) + { + for (int y1 = index1; y1 > WorldGen.dMinY; --y1) + { + if ((int) Main.tile[x1, y1 - 1].active != 0 && (int) Main.tile[x1, y1 - 1].type == tileType) + { + bool flag = false; + for (int index2 = x1 - 15; index2 < x1 + 15; ++index2) + { + for (int index3 = y1 - 15; index3 < y1 + 15; ++index3) + { + if (index2 > 0 && index2 < (int) Main.maxTilesX && (index3 > 0 && index3 < (int) Main.maxTilesY) && (int) Main.tile[index2, index3].type == 42) + { + flag = true; + break; + } + } + } + if ((int) Main.tile[x1 - 1, y1].active != 0 || (int) Main.tile[x1 + 1, y1].active != 0 || ((int) Main.tile[x1 - 1, y1 + 1].active != 0 || (int) Main.tile[x1 + 1, y1 + 1].active != 0) || (int) Main.tile[x1, y1 + 2].active != 0) + flag = true; + if (!flag && WorldGen.Place1x2Top(x1, y1, 42)) + { + num30 = 0; + ++num32; + Rectangle aabb1 = new Rectangle(); + Rectangle aabb2 = new Rectangle(); + aabb2.X = x1 << 4; + aabb2.Y = (y1 << 4) + 1; + aabb1.Width = aabb2.Width = 16; + aabb1.Height = aabb2.Height = 16; + for (int index2 = 0; index2 < 1000; ++index2) + { + int i = x1 + WorldGen.genRand.Next(-12, 13); + int j = y1 + WorldGen.genRand.Next(3, 21); + if ((int) Main.tile[i, j].active == 0 && (int) Main.tile[i, j + 1].active == 0 && ((int) Main.tile[i - 1, j].type != 48 && (int) Main.tile[i + 1, j].type != 48)) + { + aabb1.X = i << 4; + aabb1.Y = j << 4; + if (Collision.CanHit(ref aabb1, ref aabb2)) + { + WorldGen.PlaceTile(i, j, 136, true, false, -1, 0); + if ((int) Main.tile[i, j].active != 0) + { + while (i != x1 || j != y1) + { + Main.tile[i, j].wire = 16; + if (i > x1) + --i; + if (i < x1) + ++i; + Main.tile[i, j].wire = 16; + if (j > y1) + --j; + if (j < y1) + ++j; + Main.tile[i, j].wire = 16; + } + if (Main.rand.Next(3) > 0) + { + Main.tile[x1, y1].frameX = (short) 18; + Main.tile[x1, y1 + 1].frameX = (short) 18; + break; + } + else + break; + } + } + } + } + break; + } + else + break; + } + } + } + if (num30 > num31) + { + ++num32; + num30 = 0; + } + } + int num33 = 0; + int num34 = 1000; + int num35 = 0; + while (num35 < (int) Main.maxTilesX / 500) + { + ++num33; + int x2 = WorldGen.genRand.Next(WorldGen.dMinX, WorldGen.dMaxX); + int y2 = WorldGen.genRand.Next(WorldGen.dMinY, WorldGen.dMaxY); + if ((int) Main.tile[x2, y2].wall == wallType && WorldGen.placeTrap(x2, y2, 0)) + num33 = num34; + if (num33 > num34) + { + ++num35; + num33 = 0; + } + } + } + + public static void DungeonStairs(int i, int j, int tileType, int wallType) + { + Vector2 vector2_1 = new Vector2(); + Vector2 vector2_2 = new Vector2(); + double num1 = (double) WorldGen.genRand.Next(5, 9); + vector2_1.X = (float) i; + vector2_1.Y = (float) j; + int num2 = WorldGen.genRand.Next(10, 30); + int num3 = i <= WorldGen.dEnteranceX ? 1 : -1; + if (i > (int) Main.maxTilesX - 400) + num3 = -1; + else if (i < 400) + num3 = 1; + vector2_2.Y = -1f; + vector2_2.X = (float) num3; + if (WorldGen.genRand.Next(3) == 0) + vector2_2.X *= 0.5f; + else if (WorldGen.genRand.Next(3) == 0) + vector2_2.Y *= 2f; + while (num2 > 0) + { + --num2; + int num4 = (int) ((double) vector2_1.X - num1 - 4.0 - (double) WorldGen.genRand.Next(6)); + int num5 = (int) ((double) vector2_1.X + num1 + 4.0 + (double) WorldGen.genRand.Next(6)); + int num6 = (int) ((double) vector2_1.Y - num1 - 4.0); + int num7 = (int) ((double) vector2_1.Y + num1 + 4.0 + (double) WorldGen.genRand.Next(6)); + if (num4 < 0) + num4 = 0; + if (num5 > (int) Main.maxTilesX) + num5 = (int) Main.maxTilesX; + if (num6 < 0) + num6 = 0; + if (num7 > (int) Main.maxTilesY) + num7 = (int) Main.maxTilesY; + double num8 = 1.0; + if ((double) vector2_1.X > (double) ((int) Main.maxTilesX >> 1)) + num8 = -1.0; + int i1 = (int) ((double) vector2_1.X + WorldGen.dxStrength1 * 0.6 * num8 + WorldGen.dxStrength2 * num8); + double num9 = Math.Floor(WorldGen.dyStrength2 * 0.5); + int num10 = (int) ((double) vector2_1.Y - num1 + num9); + if ((double) vector2_1.Y < (double) (Main.worldSurface - 5) && (int) Main.tile[i1, num10 - 6].wall == 0 && ((int) Main.tile[i1, num10 - 7].wall == 0 && (int) Main.tile[i1, num10 - 8].wall == 0)) + { + WorldGen.dSurface = true; + WorldGen.TileRunner(i1, (int) ((double) vector2_1.Y - num1 - 6.0 + num9), WorldGen.genRand.Next(25, 35), WorldGen.genRand.Next(10, 20), -1, false, new Vector2(0.0f, -1f), false, true); + } + for (int index1 = num4; index1 < num5; ++index1) + { + for (int index2 = num6; index2 < num7; ++index2) + { + Main.tile[index1, index2].liquid = (byte) 0; + if ((int) Main.tile[index1, index2].wall != wallType) + { + Main.tile[index1, index2].wall = (byte) 0; + Main.tile[index1, index2].active = (byte) 1; + Main.tile[index1, index2].type = (byte) tileType; + } + } + } + for (int index1 = num4 + 1; index1 < num5 - 1; ++index1) + { + for (int index2 = num6 + 1; index2 < num7 - 1; ++index2) + { + if ((int) Main.tile[index1, index2].wall == 0) + Main.tile[index1, index2].wall = (byte) wallType; + } + } + int num11 = 0; + if (WorldGen.genRand.Next((int) num1) == 0) + num11 = WorldGen.genRand.Next(1, 3); + int num12 = (int) ((double) vector2_1.X - num1 * 0.5 - (double) num11); + int num13 = (int) ((double) vector2_1.X + num1 * 0.5 + (double) num11); + int num14 = (int) ((double) vector2_1.Y - num1 * 0.5 - (double) num11); + int num15 = (int) ((double) vector2_1.Y + num1 * 0.5 + (double) num11); + if (num12 < 0) + num12 = 0; + if (num13 > (int) Main.maxTilesX) + num13 = (int) Main.maxTilesX; + if (num14 < 0) + num14 = 0; + if (num15 > (int) Main.maxTilesY) + num15 = (int) Main.maxTilesY; + for (int index1 = num12; index1 < num13; ++index1) + { + for (int index2 = num14; index2 < num15; ++index2) + { + Main.tile[index1, index2].active = (byte) 0; + if ((int) Main.tile[index1, index2].wall == 0) + Main.tile[index1, index2].wall = (byte) wallType; + } + } + if (WorldGen.dSurface) + num2 = 0; + vector2_1.X += vector2_2.X; + vector2_1.Y += vector2_2.Y; + } + WorldGen.dungeonX = (int) vector2_1.X; + WorldGen.dungeonY = (int) vector2_1.Y; + } + + public static void DungeonHalls(int i, int j, int tileType, int wallType, bool forceX = false) + { + Vector2 vector2_1 = new Vector2(); + Vector2 vector2_2 = new Vector2(); + double num1 = (double) WorldGen.genRand.Next(4, 6); + Vector2i vector2i1 = new Vector2i(); + Vector2i vector2i2 = new Vector2i(); + vector2_1.X = (float) i; + vector2_1.Y = (float) j; + int num2 = WorldGen.genRand.Next(35, 80); + if (forceX) + { + num2 += 20; + WorldGen.lastDungeonHall = new Vector2i(); + } + else if (WorldGen.genRand.Next(5) == 0) + { + num1 *= 2.0; + num2 >>= 1; + } + do + { + int num3 = (WorldGen.genRand.Next(2) << 1) - 1; + if (forceX || WorldGen.genRand.Next(2) == 0) + { + vector2i1.Y = 0; + vector2i1.X = num3; + vector2i2.Y = 0; + vector2i2.X = -num3; + vector2_2.Y = 0.0f; + vector2_2.X = (float) num3; + if (WorldGen.genRand.Next(3) == 0) + vector2_2.Y = WorldGen.genRand.Next(2) != 0 ? 0.2f : -0.2f; + } + else + { + ++num1; + vector2_2.Y = (float) num3; + vector2_2.X = 0.0f; + vector2i1.X = 0; + vector2i1.Y = num3; + vector2i2.X = 0; + vector2i2.Y = -num3; + if (WorldGen.genRand.Next(2) == 0) + vector2_2.X = WorldGen.genRand.Next(2) != 0 ? -0.3f : 0.3f; + else + num2 >>= 1; + } + } + while (WorldGen.lastDungeonHall.X == vector2i2.X && WorldGen.lastDungeonHall.Y == vector2i2.Y); + if (!forceX) + { + if ((double) vector2_1.X > (double) ((int) WorldGen.lastMaxTilesX - 200)) + { + int num3 = -1; + vector2i1.Y = 0; + vector2i1.X = num3; + vector2_2.Y = 0.0f; + vector2_2.X = (float) num3; + if (WorldGen.genRand.Next(3) == 0) + vector2_2.Y = WorldGen.genRand.Next(2) != 0 ? 0.2f : -0.2f; + } + else if ((double) vector2_1.X < 200.0) + { + int num3 = 1; + vector2i1.Y = 0; + vector2i1.X = num3; + vector2_2.Y = 0.0f; + vector2_2.X = (float) num3; + if (WorldGen.genRand.Next(3) == 0) + vector2_2.Y = WorldGen.genRand.Next(2) != 0 ? 0.2f : -0.2f; + } + else if ((double) vector2_1.Y > (double) ((int) WorldGen.lastMaxTilesY - 300)) + { + int num3 = -1; + ++num1; + vector2_2.Y = (float) num3; + vector2_2.X = 0.0f; + vector2i1.X = 0; + vector2i1.Y = num3; + if (WorldGen.genRand.Next(2) == 0) + vector2_2.X = WorldGen.genRand.Next(2) != 0 ? -0.3f : 0.3f; + } + else if ((double) vector2_1.Y < (double) Main.rockLayer) + { + int num3 = 1; + ++num1; + vector2_2.Y = (float) num3; + vector2_2.X = 0.0f; + vector2i1.X = 0; + vector2i1.Y = num3; + if (WorldGen.genRand.Next(2) == 0) + vector2_2.X = WorldGen.genRand.Next(2) != 0 ? -0.3f : 0.3f; + } + else if ((double) vector2_1.X < (double) ((int) Main.maxTilesX >> 1) && (double) vector2_1.X > (double) ((int) Main.maxTilesX >> 2)) + { + int num3 = -1; + vector2i1.Y = 0; + vector2i1.X = num3; + vector2_2.Y = 0.0f; + vector2_2.X = (float) num3; + if (WorldGen.genRand.Next(3) == 0) + vector2_2.Y = WorldGen.genRand.Next(2) != 0 ? 0.2f : -0.2f; + } + else if ((double) vector2_1.X > (double) ((int) Main.maxTilesX >> 1) && (double) vector2_1.X < (double) Main.maxTilesX * 0.75) + { + int num3 = 1; + vector2i1.Y = 0; + vector2i1.X = num3; + vector2_2.Y = 0.0f; + vector2_2.X = (float) num3; + if (WorldGen.genRand.Next(3) == 0) + vector2_2.Y = WorldGen.genRand.Next(2) != 0 ? 0.2f : -0.2f; + } + } + if (vector2i1.Y == 0) + { + WorldGen.dDoor[WorldGen.numDDoors].X = (short) vector2_1.X; + WorldGen.dDoor[WorldGen.numDDoors].Y = (short) vector2_1.Y; + WorldGen.dDoor[WorldGen.numDDoors].Pos = (short) 0; + ++WorldGen.numDDoors; + } + else + { + WorldGen.DPlat[WorldGen.numDPlats].X = (short) vector2_1.X; + WorldGen.DPlat[WorldGen.numDPlats].Y = (short) vector2_1.Y; + ++WorldGen.numDPlats; + } + WorldGen.lastDungeonHall = vector2i1; + while (num2 > 0) + { + if (vector2i1.X > 0 && (double) vector2_1.X > (double) ((int) Main.maxTilesX - 100)) + num2 = 0; + else if (vector2i1.X < 0 && (double) vector2_1.X < 100.0) + num2 = 0; + else if (vector2i1.Y > 0 && (double) vector2_1.Y > (double) ((int) Main.maxTilesY - 100)) + num2 = 0; + else if (vector2i1.Y < 0 && (double) vector2_1.Y < (double) (Main.rockLayer + 50)) + num2 = 0; + --num2; + int num3 = (int) ((double) vector2_1.X - num1 - 4.0 - (double) WorldGen.genRand.Next(6)); + int num4 = (int) ((double) vector2_1.X + num1 + 4.0 + (double) WorldGen.genRand.Next(6)); + int num5 = (int) ((double) vector2_1.Y - num1 - 4.0 - (double) WorldGen.genRand.Next(6)); + int num6 = (int) ((double) vector2_1.Y + num1 + 4.0 + (double) WorldGen.genRand.Next(6)); + if (num3 < 0) + num3 = 0; + if (num4 > (int) Main.maxTilesX) + num4 = (int) Main.maxTilesX; + if (num5 < 0) + num5 = 0; + if (num6 > (int) Main.maxTilesY) + num6 = (int) Main.maxTilesY; + for (int index1 = num3; index1 < num4; ++index1) + { + for (int index2 = num5; index2 < num6; ++index2) + { + Main.tile[index1, index2].liquid = (byte) 0; + if ((int) Main.tile[index1, index2].wall == 0) + { + Main.tile[index1, index2].active = (byte) 1; + Main.tile[index1, index2].type = (byte) tileType; + } + } + } + for (int index1 = num3 + 1; index1 < num4 - 1; ++index1) + { + for (int index2 = num5 + 1; index2 < num6 - 1; ++index2) + { + if ((int) Main.tile[index1, index2].wall == 0) + Main.tile[index1, index2].wall = (byte) wallType; + } + } + int num7 = 0; + if ((double) vector2_2.Y == 0.0 && WorldGen.genRand.Next((int) num1 + 1) == 0) + num7 = WorldGen.genRand.Next(1, 3); + else if ((double) vector2_2.X == 0.0 && WorldGen.genRand.Next((int) num1 - 1) == 0) + num7 = WorldGen.genRand.Next(1, 3); + else if (WorldGen.genRand.Next((int) num1 * 3) == 0) + num7 = WorldGen.genRand.Next(1, 3); + int num8 = (int) ((double) vector2_1.X - num1 * 0.5 - (double) num7); + int num9 = (int) ((double) vector2_1.X + num1 * 0.5 + (double) num7); + int num10 = (int) ((double) vector2_1.Y - num1 * 0.5 - (double) num7); + int num11 = (int) ((double) vector2_1.Y + num1 * 0.5 + (double) num7); + if (num8 < 0) + num8 = 0; + if (num9 > (int) Main.maxTilesX) + num9 = (int) Main.maxTilesX; + if (num10 < 0) + num10 = 0; + if (num11 > (int) Main.maxTilesY) + num11 = (int) Main.maxTilesY; + for (int index1 = num8; index1 < num9; ++index1) + { + for (int index2 = num10; index2 < num11; ++index2) + { + Main.tile[index1, index2].active = (byte) 0; + Main.tile[index1, index2].wall = (byte) wallType; + } + } + vector2_1.X += vector2_2.X; + vector2_1.Y += vector2_2.Y; + } + WorldGen.dungeonX = (int) vector2_1.X; + WorldGen.dungeonY = (int) vector2_1.Y; + if (vector2i1.Y == 0) + { + WorldGen.dDoor[WorldGen.numDDoors].X = (short) vector2_1.X; + WorldGen.dDoor[WorldGen.numDDoors].Y = (short) vector2_1.Y; + WorldGen.dDoor[WorldGen.numDDoors].Pos = (short) 0; + ++WorldGen.numDDoors; + } + else + { + WorldGen.DPlat[WorldGen.numDPlats].X = (short) vector2_1.X; + WorldGen.DPlat[WorldGen.numDPlats].Y = (short) vector2_1.Y; + ++WorldGen.numDPlats; + } + } + + public static void DungeonRoom(int i, int j, int tileType, int wallType) + { + Vector2 vector2_1 = new Vector2(); + Vector2 vector2_2 = new Vector2(); + float num1 = (float) WorldGen.genRand.Next(15, 30); + vector2_2.X = (float) WorldGen.genRand.Next(-10, 11) * 0.1f; + vector2_2.Y = (float) WorldGen.genRand.Next(-10, 11) * 0.1f; + vector2_1.X = (float) i; + vector2_1.Y = (float) j - num1 * 0.5f; + int num2 = WorldGen.genRand.Next(10, 20); + float num3 = vector2_1.X; + float num4 = vector2_1.X; + float num5 = vector2_1.Y; + float num6 = vector2_1.Y; + while (num2 > 0) + { + --num2; + int num7 = (int) ((double) vector2_1.X - (double) num1 * 0.800000011920929 - 5.0); + int num8 = (int) ((double) vector2_1.X + (double) num1 * 0.800000011920929 + 5.0); + int num9 = (int) ((double) vector2_1.Y - (double) num1 * 0.800000011920929 - 5.0); + int num10 = (int) ((double) vector2_1.Y + (double) num1 * 0.800000011920929 + 5.0); + if (num7 < 0) + num7 = 0; + if (num8 > (int) Main.maxTilesX) + num8 = (int) Main.maxTilesX; + if (num9 < 0) + num9 = 0; + if (num10 > (int) Main.maxTilesY) + num10 = (int) Main.maxTilesY; + for (int index1 = num7; index1 < num8; ++index1) + { + for (int index2 = num9; index2 < num10; ++index2) + { + Main.tile[index1, index2].liquid = (byte) 0; + if ((int) Main.tile[index1, index2].wall == 0) + { + Main.tile[index1, index2].active = (byte) 1; + Main.tile[index1, index2].type = (byte) tileType; + } + } + } + for (int index1 = num7 + 1; index1 < num8 - 1; ++index1) + { + for (int index2 = num9 + 1; index2 < num10 - 1; ++index2) + { + if ((int) Main.tile[index1, index2].wall == 0) + Main.tile[index1, index2].wall = (byte) wallType; + } + } + int num11 = (int) ((double) vector2_1.X - (double) num1 * 0.5); + int num12 = (int) ((double) vector2_1.X + (double) num1 * 0.5); + int num13 = (int) ((double) vector2_1.Y - (double) num1 * 0.5); + int num14 = (int) ((double) vector2_1.Y + (double) num1 * 0.5); + if (num11 < 0) + num11 = 0; + if (num12 > (int) Main.maxTilesX) + num12 = (int) Main.maxTilesX; + if (num13 < 0) + num13 = 0; + if (num14 > (int) Main.maxTilesY) + num14 = (int) Main.maxTilesY; + if ((double) num11 < (double) num3) + num3 = (float) num11; + if ((double) num12 > (double) num4) + num4 = (float) num12; + if ((double) num13 < (double) num5) + num5 = (float) num13; + if ((double) num14 > (double) num6) + num6 = (float) num14; + for (int index1 = num11; index1 < num12; ++index1) + { + for (int index2 = num13; index2 < num14; ++index2) + { + Main.tile[index1, index2].active = (byte) 0; + Main.tile[index1, index2].wall = (byte) wallType; + } + } + vector2_1.X += vector2_2.X; + vector2_1.Y += vector2_2.Y; + vector2_2.X += (float) WorldGen.genRand.Next(-10, 11) * 0.05f; + vector2_2.Y += (float) WorldGen.genRand.Next(-10, 11) * 0.05f; + if ((double) vector2_2.X > 1.0) + vector2_2.X = 1f; + if ((double) vector2_2.X < -1.0) + vector2_2.X = -1f; + if ((double) vector2_2.Y > 1.0) + vector2_2.Y = 1f; + if ((double) vector2_2.Y < -1.0) + vector2_2.Y = -1f; + } + WorldGen.dRoom[WorldGen.numDRooms].X = (short) vector2_1.X; + WorldGen.dRoom[WorldGen.numDRooms].Y = (short) vector2_1.Y; + WorldGen.dRoom[WorldGen.numDRooms].Size = num1; + WorldGen.dRoom[WorldGen.numDRooms].L = (short) num3; + WorldGen.dRoom[WorldGen.numDRooms].R = (short) num4; + WorldGen.dRoom[WorldGen.numDRooms].T = (short) num5; + WorldGen.dRoom[WorldGen.numDRooms].B = (short) num6; + ++WorldGen.numDRooms; + } + + public static void DungeonEnt(int i, int j, int tileType, int wallType) + { + int num1 = 60; + for (int index1 = i - num1; index1 < i + num1; ++index1) + { + for (int index2 = j - num1; index2 < j + num1; ++index2) + { + Main.tile[index1, index2].liquid = (byte) 0; + Main.tile[index1, index2].lava = (byte) 0; + } + } + double num2 = WorldGen.dxStrength1; + double num3 = WorldGen.dyStrength1; + Vector2 vector2; + vector2.X = (float) i; + vector2.Y = (float) j - (float) (num3 * 0.5); + WorldGen.dMinY = (int) vector2.Y; + int num4 = 1; + if (i > (int) Main.maxTilesX >> 1) + num4 = -1; + int num5 = (int) ((double) vector2.X - num2 * 0.600000023841858 - (double) WorldGen.genRand.Next(2, 5)); + int num6 = (int) ((double) vector2.X + num2 * 0.600000023841858 + (double) WorldGen.genRand.Next(2, 5)); + int num7 = (int) ((double) vector2.Y - num3 * 0.600000023841858 - (double) WorldGen.genRand.Next(2, 5)); + int num8 = (int) ((double) vector2.Y + num3 * 0.600000023841858 + (double) WorldGen.genRand.Next(8, 16)); + if (num5 < 0) + num5 = 0; + if (num6 > (int) Main.maxTilesX) + num6 = (int) Main.maxTilesX; + if (num7 < 0) + num7 = 0; + if (num8 > (int) Main.maxTilesY) + num8 = (int) Main.maxTilesY; + for (int index1 = num5; index1 < num6; ++index1) + { + for (int index2 = num7; index2 < num8; ++index2) + { + Main.tile[index1, index2].liquid = (byte) 0; + if ((int) Main.tile[index1, index2].wall != wallType) + { + Main.tile[index1, index2].wall = (byte) 0; + if (index1 > num5 + 1 && index1 < num6 - 2 && (index2 > num7 + 1 && index2 < num8 - 2)) + Main.tile[index1, index2].wall = (byte) wallType; + Main.tile[index1, index2].active = (byte) 1; + Main.tile[index1, index2].type = (byte) tileType; + } + } + } + int num9 = num5; + int num10 = num5 + 5 + WorldGen.genRand.Next(4); + int num11 = num7 - 3 - WorldGen.genRand.Next(3); + int num12 = num7; + for (int index1 = num9; index1 < num10; ++index1) + { + for (int index2 = num11; index2 < num12; ++index2) + { + if ((int) Main.tile[index1, index2].wall != wallType) + { + Main.tile[index1, index2].active = (byte) 1; + Main.tile[index1, index2].type = (byte) tileType; + } + } + } + int num13 = num6 - 5 - WorldGen.genRand.Next(4); + int num14 = num6; + int num15 = num7 - 3 - WorldGen.genRand.Next(3); + int num16 = num7; + for (int index1 = num13; index1 < num14; ++index1) + { + for (int index2 = num15; index2 < num16; ++index2) + { + if ((int) Main.tile[index1, index2].wall != wallType) + { + Main.tile[index1, index2].active = (byte) 1; + Main.tile[index1, index2].type = (byte) tileType; + } + } + } + int num17 = 1 + WorldGen.genRand.Next(2); + int num18 = 2 + WorldGen.genRand.Next(4); + int num19 = 0; + for (int index1 = num5; index1 < num6; ++index1) + { + for (int index2 = num7 - num17; index2 < num7; ++index2) + { + if ((int) Main.tile[index1, index2].wall != wallType) + { + Main.tile[index1, index2].active = (byte) 1; + Main.tile[index1, index2].type = (byte) tileType; + } + } + ++num19; + if (num19 >= num18) + { + index1 += num18; + num19 = 0; + } + } + for (int index1 = num5; index1 < num6; ++index1) + { + for (int index2 = num8; index2 < num8 + 100; ++index2) + { + if ((int) Main.tile[index1, index2].wall == 0) + Main.tile[index1, index2].wall = (byte) 2; + } + } + int num20 = (int) ((double) vector2.X - num2 * 0.600000023841858); + int num21 = (int) ((double) vector2.X + num2 * 0.600000023841858); + int num22 = (int) ((double) vector2.Y - num3 * 0.600000023841858); + int num23 = (int) ((double) vector2.Y + num3 * 0.600000023841858); + if (num20 < 0) + num20 = 0; + if (num21 > (int) Main.maxTilesX) + num21 = (int) Main.maxTilesX; + if (num22 < 0) + num22 = 0; + if (num23 > (int) Main.maxTilesY) + num23 = (int) Main.maxTilesY; + for (int index1 = num20; index1 < num21; ++index1) + { + for (int index2 = num22; index2 < num23; ++index2) + { + if ((int) Main.tile[index1, index2].wall == 0) + Main.tile[index1, index2].wall = (byte) wallType; + } + } + int num24 = (int) ((double) vector2.X - num2 * 0.6 - 1.0); + int num25 = (int) ((double) vector2.X + num2 * 0.6 + 1.0); + int num26 = (int) ((double) vector2.Y - num3 * 0.6 - 1.0); + int num27 = (int) ((double) vector2.Y + num3 * 0.6 + 1.0); + if (num24 < 0) + num24 = 0; + if (num25 > (int) Main.maxTilesX) + num25 = (int) Main.maxTilesX; + if (num26 < 0) + num26 = 0; + if (num27 > (int) Main.maxTilesY) + num27 = (int) Main.maxTilesY; + for (int index1 = num24; index1 < num25; ++index1) + { + for (int index2 = num26; index2 < num27; ++index2) + Main.tile[index1, index2].wall = (byte) wallType; + } + int num28 = (int) ((double) vector2.X - num2 * 0.5); + int num29 = (int) ((double) vector2.X + num2 * 0.5); + int num30 = (int) ((double) vector2.Y - num3 * 0.5); + int num31 = (int) ((double) vector2.Y + num3 * 0.5); + if (num28 < 0) + num28 = 0; + if (num29 > (int) Main.maxTilesX) + num29 = (int) Main.maxTilesX; + if (num30 < 0) + num30 = 0; + if (num31 > (int) Main.maxTilesY) + num31 = (int) Main.maxTilesY; + for (int index1 = num28; index1 < num29; ++index1) + { + for (int index2 = num30; index2 < num31; ++index2) + { + Main.tile[index1, index2].active = (byte) 0; + Main.tile[index1, index2].wall = (byte) wallType; + } + } + WorldGen.DPlat[WorldGen.numDPlats].X = (short) vector2.X; + WorldGen.DPlat[WorldGen.numDPlats].Y = (short) num31; + ++WorldGen.numDPlats; + vector2.X += (float) (num2 * 0.600000023841858) * (float) num4; + vector2.Y += (float) num3 * 0.5f; + double num32 = WorldGen.dxStrength2; + double num33 = WorldGen.dyStrength2; + vector2.X += (float) (num32 * 0.550000011920929) * (float) num4; + vector2.Y -= (float) num33 * 0.5f; + int num34 = (int) ((double) vector2.X - num32 * 0.600000023841858 - (double) WorldGen.genRand.Next(1, 3)); + int num35 = (int) ((double) vector2.X + num32 * 0.600000023841858 + (double) WorldGen.genRand.Next(1, 3)); + int num36 = (int) ((double) vector2.Y - num33 * 0.600000023841858 - (double) WorldGen.genRand.Next(1, 3)); + int num37 = (int) ((double) vector2.Y + num33 * 0.600000023841858 + (double) WorldGen.genRand.Next(6, 16)); + if (num34 < 0) + num34 = 0; + if (num35 > (int) Main.maxTilesX) + num35 = (int) Main.maxTilesX; + if (num36 < 0) + num36 = 0; + if (num37 > (int) Main.maxTilesY) + num37 = (int) Main.maxTilesY; + for (int index1 = num34; index1 < num35; ++index1) + { + for (int index2 = num36; index2 < num37; ++index2) + { + if ((int) Main.tile[index1, index2].wall != wallType) + { + bool flag = true; + if (num4 < 0) + { + if ((double) index1 < (double) vector2.X - num32 * 0.5) + flag = false; + } + else if ((double) index1 > (double) vector2.X + num32 * 0.5 - 1.0) + flag = false; + if (flag) + { + Main.tile[index1, index2].wall = (byte) 0; + Main.tile[index1, index2].active = (byte) 1; + Main.tile[index1, index2].type = (byte) tileType; + } + } + } + } + for (int index1 = num34; index1 < num35; ++index1) + { + for (int index2 = num37; index2 < num37 + 100; ++index2) + { + if ((int) Main.tile[index1, index2].wall == 0) + Main.tile[index1, index2].wall = (byte) 2; + } + } + int num38 = (int) ((double) vector2.X - num32 * 0.5); + int num39 = (int) ((double) vector2.X + num32 * 0.5); + int num40 = num38; + if (num4 < 0) + ++num40; + int num41 = num40 + 5 + WorldGen.genRand.Next(4); + int num42 = num36 - 3 - WorldGen.genRand.Next(3); + int num43 = num36; + for (int index1 = num40; index1 < num41; ++index1) + { + for (int index2 = num42; index2 < num43; ++index2) + { + if ((int) Main.tile[index1, index2].wall != wallType) + { + Main.tile[index1, index2].active = (byte) 1; + Main.tile[index1, index2].type = (byte) tileType; + } + } + } + int num44 = num39 - 5 - WorldGen.genRand.Next(4); + int num45 = num39; + int num46 = num36 - 3 - WorldGen.genRand.Next(3); + int num47 = num36; + for (int index1 = num44; index1 < num45; ++index1) + { + for (int index2 = num46; index2 < num47; ++index2) + { + if ((int) Main.tile[index1, index2].wall != wallType) + { + Main.tile[index1, index2].active = (byte) 1; + Main.tile[index1, index2].type = (byte) tileType; + } + } + } + int num48 = 1 + WorldGen.genRand.Next(2); + int num49 = 2 + WorldGen.genRand.Next(4); + int num50 = 0; + if (num4 < 0) + ++num39; + for (int index1 = num38 + 1; index1 < num39 - 1; ++index1) + { + for (int index2 = num36 - num48; index2 < num36; ++index2) + { + if ((int) Main.tile[index1, index2].wall != wallType) + { + Main.tile[index1, index2].active = (byte) 1; + Main.tile[index1, index2].type = (byte) tileType; + } + } + ++num50; + if (num50 >= num49) + { + index1 += num49; + num50 = 0; + } + } + int num51 = (int) ((double) vector2.X - num32 * 0.6); + int num52 = (int) ((double) vector2.X + num32 * 0.6); + int num53 = (int) ((double) vector2.Y - num33 * 0.6); + int num54 = (int) ((double) vector2.Y + num33 * 0.6); + if (num51 < 0) + num51 = 0; + if (num52 > (int) Main.maxTilesX) + num52 = (int) Main.maxTilesX; + if (num53 < 0) + num53 = 0; + if (num54 > (int) Main.maxTilesY) + num54 = (int) Main.maxTilesY; + for (int index1 = num51; index1 < num52; ++index1) + { + for (int index2 = num53; index2 < num54; ++index2) + Main.tile[index1, index2].wall = (byte) 0; + } + int num55 = (int) ((double) vector2.X - num32 * 0.5); + int num56 = (int) ((double) vector2.X + num32 * 0.5); + int num57 = (int) ((double) vector2.Y - num33 * 0.5); + int index3 = (int) ((double) vector2.Y + num33 * 0.5); + if (num55 < 0) + num55 = 0; + if (num56 > (int) Main.maxTilesX) + num56 = (int) Main.maxTilesX; + if (num57 < 0) + num57 = 0; + if (index3 > (int) Main.maxTilesY) + index3 = (int) Main.maxTilesY; + for (int index1 = num55; index1 < num56; ++index1) + { + for (int index2 = num57; index2 < index3; ++index2) + { + Main.tile[index1, index2].active = (byte) 0; + Main.tile[index1, index2].wall = (byte) 0; + } + } + for (int index1 = num55; index1 < num56; ++index1) + { + if ((int) Main.tile[index1, index3].active == 0) + { + Main.tile[index1, index3].active = (byte) 1; + Main.tile[index1, index3].type = (byte) 19; + } + } + Main.dungeonX = (short) vector2.X; + Main.dungeonY = (short) index3; + int index4 = NPC.NewNPC((int) Main.dungeonX * 16 + 8, (int) Main.dungeonY * 16, 37, 0); + Main.npc[index4].homeless = false; + Main.npc[index4].homeTileX = Main.dungeonX; + Main.npc[index4].homeTileY = Main.dungeonY; + if (num4 == 1) + { + int num58 = 0; + for (int index1 = num56; index1 < num56 + 25; ++index1) + { + ++num58; + for (int index2 = index3 + num58; index2 < index3 + 25; ++index2) + { + Main.tile[index1, index2].active = (byte) 1; + Main.tile[index1, index2].type = (byte) tileType; + } + } + } + else + { + int num58 = 0; + for (int index1 = num55; index1 > num55 - 25; --index1) + { + ++num58; + for (int index2 = index3 + num58; index2 < index3 + 25; ++index2) + { + Main.tile[index1, index2].active = (byte) 1; + Main.tile[index1, index2].type = (byte) tileType; + } + } + } + int num59 = 1 + WorldGen.genRand.Next(2); + int num60 = 2 + WorldGen.genRand.Next(4); + int num61 = 0; + int num62 = (int) ((double) vector2.X - num32 * 0.5); + int num63 = (int) ((double) vector2.X + num32 * 0.5); + int num64 = num62 + 2; + int num65 = num63 - 2; + for (int index1 = num64; index1 < num65; ++index1) + { + for (int index2 = num57; index2 < index3; ++index2) + { + if ((int) Main.tile[index1, index2].wall == 0) + Main.tile[index1, index2].wall = (byte) wallType; + } + if (++num61 >= num60) + { + index1 += num60 * 2; + num61 = 0; + } + } + vector2.X -= (float) (num32 * 0.600000023841858) * (float) num4; + vector2.Y += (float) num33 * 0.5f; + double num66 = 15.0; + double num67 = 3.0; + vector2.Y -= (float) num67 * 0.5f; + int num68 = (int) ((double) vector2.X - num66 * 0.5); + int num69 = (int) ((double) vector2.X + num66 * 0.5); + int num70 = (int) ((double) vector2.Y - num67 * 0.5); + int num71 = (int) ((double) vector2.Y + num67 * 0.5); + if (num68 < 0) + num68 = 0; + if (num69 > (int) Main.maxTilesX) + num69 = (int) Main.maxTilesX; + if (num70 < 0) + num70 = 0; + if (num71 > (int) Main.maxTilesY) + num71 = (int) Main.maxTilesY; + for (int index1 = num68; index1 < num69; ++index1) + { + for (int index2 = num70; index2 < num71; ++index2) + Main.tile[index1, index2].active = (byte) 0; + } + if (num4 < 0) + --vector2.X; + WorldGen.PlaceTile((int) vector2.X, (int) vector2.Y + 1, 10, false, false, -1, 0); + } + + public static bool AddBuriedChest(int i, int j, int contain = 0, bool notNearOtherChests = false, int Style = -1) + { + for (int index1 = j; index1 < (int) Main.maxTilesY; ++index1) + { + if ((int) Main.tile[i, index1].active != 0 && Main.tileSolid[(int) Main.tile[i, index1].type]) + { + bool flag = false; + int num1 = i; + int num2 = index1; + int style = 0; + if (num2 >= Main.worldSurface + 25 || contain > 0) + style = 1; + if (Style >= 0) + style = Style; + if (num2 > (int) Main.maxTilesY - 205 && contain == 0) + { + if (WorldGen.hellChest == 0) + { + contain = 274; + style = 4; + flag = true; + } + else if (WorldGen.hellChest == 1) + { + contain = 220; + style = 4; + flag = true; + } + else if (WorldGen.hellChest == 2) + { + contain = 112; + style = 4; + flag = true; + } + else if (WorldGen.hellChest == 3) + { + contain = 218; + style = 4; + flag = true; + WorldGen.hellChest = 0; + } + } + int index2 = WorldGen.PlaceChest(num1 - 1, num2 - 1, notNearOtherChests, style); + if (index2 < 0) + return false; + if (flag) + ++WorldGen.hellChest; + int index3 = 0; + do + { + if (num2 < Main.worldSurface + 25) + { + if (contain > 0) + { + Main.chest[index2].item[index3].SetDefaults(contain, 1, false); + Main.chest[index2].item[index3].Prefix(-1); + } + else + { + switch (WorldGen.genRand.Next(7)) + { + case 0: + Main.chest[index2].item[index3].SetDefaults(280, 1, false); + Main.chest[index2].item[index3].Prefix(-1); + break; + case 1: + Main.chest[index2].item[index3].SetDefaults(281, 1, false); + Main.chest[index2].item[index3].Prefix(-1); + break; + case 2: + Main.chest[index2].item[index3].SetDefaults(284, 1, false); + Main.chest[index2].item[index3].Prefix(-1); + break; + case 3: + Main.chest[index2].item[index3].SetDefaults(282, WorldGen.genRand.Next(50, 75), false); + break; + case 4: + Main.chest[index2].item[index3].SetDefaults(279, WorldGen.genRand.Next(25, 50), false); + break; + default: + if (WorldGen.genRand.Next(32) == 0) + { + Main.chest[index2].item[index3].SetDefaults(603, 1, false); + break; + } + else + { + Main.chest[index2].item[index3].SetDefaults(285, 1, false); + Main.chest[index2].item[index3].Prefix(-1); + break; + } + } + } + ++index3; + if (WorldGen.genRand.Next(3) == 0) + { + Main.chest[index2].item[index3].SetDefaults(168, WorldGen.genRand.Next(3, 6), false); + ++index3; + } + if (WorldGen.genRand.Next(2) == 0) + { + Main.chest[index2].item[index3].SetDefaults(WorldGen.genRand.Next(2) == 0 ? 20 : 22, WorldGen.genRand.Next(3, 11), false); + ++index3; + } + if (WorldGen.genRand.Next(2) == 0) + { + Main.chest[index2].item[index3].SetDefaults(WorldGen.genRand.Next(2) == 0 ? 40 : 42, WorldGen.genRand.Next(25, 51), false); + ++index3; + } + if (WorldGen.genRand.Next(2) == 0) + { + Main.chest[index2].item[index3].SetDefaults(28, WorldGen.genRand.Next(3, 6), false); + ++index3; + } + if (WorldGen.genRand.Next(3) > 0) + { + int num3 = WorldGen.genRand.Next(4); + WorldGen.genRand.Next(1, 3); + int Type = num3 != 0 ? (num3 != 1 ? (num3 != 2 ? 290 : 299) : 298) : 292; + Main.chest[index2].item[index3].SetDefaults(Type, WorldGen.genRand.Next(1, 3), false); + ++index3; + } + if (WorldGen.genRand.Next(2) == 0) + { + Main.chest[index2].item[index3].SetDefaults(WorldGen.genRand.Next(2) == 0 ? 8 : 31, WorldGen.genRand.Next(10, 21), false); + ++index3; + } + if (WorldGen.genRand.Next(2) == 0) + { + Main.chest[index2].item[index3].SetDefaults(72, WorldGen.genRand.Next(10, 30), false); + ++index3; + } + } + else if (num2 < Main.rockLayer) + { + if (contain > 0) + { + Main.chest[index2].item[index3].SetDefaults(contain, 1, false); + Main.chest[index2].item[index3].Prefix(-1); + ++index3; + } + else + { + int num3 = WorldGen.genRand.Next(7); + if (num3 == 0) + { + Main.chest[index2].item[index3].SetDefaults(49, 1, false); + Main.chest[index2].item[index3].Prefix(-1); + } + if (num3 == 1) + { + Main.chest[index2].item[index3].SetDefaults(50, 1, false); + Main.chest[index2].item[index3].Prefix(-1); + } + if (num3 == 2) + Main.chest[index2].item[index3].SetDefaults(52, 1, false); + if (num3 == 3) + { + Main.chest[index2].item[index3].SetDefaults(53, 1, false); + Main.chest[index2].item[index3].Prefix(-1); + } + if (num3 == 4) + { + Main.chest[index2].item[index3].SetDefaults(54, 1, false); + Main.chest[index2].item[index3].Prefix(-1); + } + if (num3 == 5) + { + Main.chest[index2].item[index3].SetDefaults(55, 1, false); + Main.chest[index2].item[index3].Prefix(-1); + } + if (num3 == 6) + { + Main.chest[index2].item[index3].SetDefaults(51, 1, false); + Main.chest[index2].item[index3].stack = (short) (WorldGen.genRand.Next(26) + 25); + } + ++index3; + if (WorldGen.genRand.Next(40) == 0) + { + Main.chest[index2].item[index3].SetDefaults(WorldGen.genRand.Next(2) + 603, 1, false); + ++index3; + } + } + if (WorldGen.genRand.Next(3) == 0) + { + Main.chest[index2].item[index3].SetDefaults(166, WorldGen.genRand.Next(10, 20), false); + ++index3; + } + if (WorldGen.genRand.Next(2) == 0) + { + int Type = WorldGen.genRand.Next(21, 22); + Main.chest[index2].item[index3].SetDefaults(Type, WorldGen.genRand.Next(5, 15), false); + ++index3; + } + if (WorldGen.genRand.Next(2) == 0) + { + int num3 = WorldGen.genRand.Next(2); + int Stack = WorldGen.genRand.Next(25, 50); + if (num3 == 0) + Main.chest[index2].item[index3].SetDefaults(40, Stack, false); + else + Main.chest[index2].item[index3].SetDefaults(42, Stack, false); + ++index3; + } + if (WorldGen.genRand.Next(2) == 0) + { + Main.chest[index2].item[index3].SetDefaults(28, WorldGen.genRand.Next(3, 6), false); + ++index3; + } + if (WorldGen.genRand.Next(3) > 0) + { + int Type; + switch (WorldGen.genRand.Next(7)) + { + case 0: + Type = 289; + break; + case 1: + Type = 298; + break; + case 2: + Type = 299; + break; + case 3: + Type = 290; + break; + case 4: + Type = 303; + break; + case 5: + Type = 291; + break; + default: + Type = 304; + break; + } + Main.chest[index2].item[index3].SetDefaults(Type, WorldGen.genRand.Next(1, 3), false); + ++index3; + } + if (WorldGen.genRand.Next(2) == 0) + { + Main.chest[index2].item[index3].SetDefaults(8, WorldGen.genRand.Next(10, 21), false); + ++index3; + } + if (WorldGen.genRand.Next(2) == 0) + { + Main.chest[index2].item[index3].SetDefaults(72, WorldGen.genRand.Next(50, 90), false); + ++index3; + } + } + else if (num2 < (int) Main.maxTilesY - 250) + { + if (contain > 0) + { + Main.chest[index2].item[index3].SetDefaults(contain, 1, false); + Main.chest[index2].item[index3].Prefix(-1); + ++index3; + } + else + { + int num3 = WorldGen.genRand.Next(7); + if (num3 == 2 && WorldGen.genRand.Next(2) == 0) + num3 = WorldGen.genRand.Next(7); + if (num3 == 0) + { + Main.chest[index2].item[index3].SetDefaults(49, 1, false); + Main.chest[index2].item[index3].Prefix(-1); + } + else if (num3 == 1) + { + Main.chest[index2].item[index3].SetDefaults(50, 1, false); + Main.chest[index2].item[index3].Prefix(-1); + } + else if (num3 == 2) + { + Main.chest[index2].item[index3].SetDefaults(52, 1, false); + Main.chest[index2].item[index3].Prefix(-1); + } + else if (num3 == 3) + { + Main.chest[index2].item[index3].SetDefaults(53, 1, false); + Main.chest[index2].item[index3].Prefix(-1); + } + else if (num3 == 4) + { + Main.chest[index2].item[index3].SetDefaults(54, 1, false); + Main.chest[index2].item[index3].Prefix(-1); + } + else if (num3 == 5) + { + Main.chest[index2].item[index3].SetDefaults(55, 1, false); + Main.chest[index2].item[index3].Prefix(-1); + } + else + Main.chest[index2].item[index3].SetDefaults(51, WorldGen.genRand.Next(26) + 25, false); + ++index3; + } + if (WorldGen.genRand.Next(5) == 0) + { + Main.chest[index2].item[index3].SetDefaults(43, 1, false); + ++index3; + } + if (WorldGen.genRand.Next(3) == 0) + { + Main.chest[index2].item[index3].SetDefaults(167, 1, false); + ++index3; + } + if (WorldGen.genRand.Next(2) == 0) + { + int num3 = WorldGen.genRand.Next(2); + int num4 = WorldGen.genRand.Next(8) + 3; + if (num3 == 0) + Main.chest[index2].item[index3].SetDefaults(19, 1, false); + if (num3 == 1) + Main.chest[index2].item[index3].SetDefaults(21, 1, false); + Main.chest[index2].item[index3].stack = (short) num4; + ++index3; + } + if (WorldGen.genRand.Next(2) == 0) + { + int num3 = WorldGen.genRand.Next(2); + int num4 = WorldGen.genRand.Next(26) + 25; + if (num3 == 0) + Main.chest[index2].item[index3].SetDefaults(41, 1, false); + if (num3 == 1) + Main.chest[index2].item[index3].SetDefaults(279, 1, false); + Main.chest[index2].item[index3].stack = (short) num4; + ++index3; + } + if (WorldGen.genRand.Next(2) == 0) + { + int num3 = WorldGen.genRand.Next(1); + int num4 = WorldGen.genRand.Next(3) + 3; + if (num3 == 0) + Main.chest[index2].item[index3].SetDefaults(188, 1, false); + Main.chest[index2].item[index3].stack = (short) num4; + ++index3; + } + if (WorldGen.genRand.Next(3) > 0) + { + int num3 = WorldGen.genRand.Next(6); + int num4 = WorldGen.genRand.Next(1, 3); + if (num3 == 0) + Main.chest[index2].item[index3].SetDefaults(296, 1, false); + if (num3 == 1) + Main.chest[index2].item[index3].SetDefaults(295, 1, false); + if (num3 == 2) + Main.chest[index2].item[index3].SetDefaults(299, 1, false); + if (num3 == 3) + Main.chest[index2].item[index3].SetDefaults(302, 1, false); + if (num3 == 4) + Main.chest[index2].item[index3].SetDefaults(303, 1, false); + if (num3 == 5) + Main.chest[index2].item[index3].SetDefaults(305, 1, false); + Main.chest[index2].item[index3].stack = (short) num4; + ++index3; + } + if (WorldGen.genRand.Next(3) > 1) + { + int num3 = WorldGen.genRand.Next(4); + int num4 = WorldGen.genRand.Next(1, 3); + if (num3 == 0) + Main.chest[index2].item[index3].SetDefaults(301, 1, false); + if (num3 == 1) + Main.chest[index2].item[index3].SetDefaults(302, 1, false); + if (num3 == 2) + Main.chest[index2].item[index3].SetDefaults(297, 1, false); + if (num3 == 3) + Main.chest[index2].item[index3].SetDefaults(304, 1, false); + Main.chest[index2].item[index3].stack = (short) num4; + ++index3; + } + if (WorldGen.genRand.Next(2) == 0) + { + int num3 = WorldGen.genRand.Next(2); + int num4 = WorldGen.genRand.Next(15) + 15; + if (num3 == 0) + Main.chest[index2].item[index3].SetDefaults(8, 1, false); + if (num3 == 1) + Main.chest[index2].item[index3].SetDefaults(282, 1, false); + Main.chest[index2].item[index3].stack = (short) num4; + ++index3; + } + if (WorldGen.genRand.Next(2) == 0) + { + Main.chest[index2].item[index3].SetDefaults(73, 1, false); + Main.chest[index2].item[index3].stack = (short) WorldGen.genRand.Next(1, 3); + ++index3; + } + if (WorldGen.genRand.Next(32) == 0) + Main.chest[index2].item[index3].SetDefaults(621, 1, false); + else if (WorldGen.genRand.Next(48) == 0) + Main.chest[index2].item[index3].SetDefaults(623, 1, false); + } + else + { + if (contain > 0) + { + Main.chest[index2].item[index3].SetDefaults(contain, 1, false); + Main.chest[index2].item[index3].Prefix(-1); + ++index3; + } + else + { + switch (WorldGen.genRand.Next(4)) + { + case 0: + Main.chest[index2].item[index3].SetDefaults(49, 1, false); + Main.chest[index2].item[index3].Prefix(-1); + break; + case 1: + Main.chest[index2].item[index3].SetDefaults(50, 1, false); + Main.chest[index2].item[index3].Prefix(-1); + break; + case 2: + Main.chest[index2].item[index3].SetDefaults(53, 1, false); + Main.chest[index2].item[index3].Prefix(-1); + break; + default: + Main.chest[index2].item[index3].SetDefaults(54, 1, false); + Main.chest[index2].item[index3].Prefix(-1); + break; + } + ++index3; + } + if (WorldGen.genRand.Next(3) == 0) + { + Main.chest[index2].item[index3].SetDefaults(167, 1, false); + ++index3; + } + if (WorldGen.genRand.Next(2) == 0) + { + int num3 = WorldGen.genRand.Next(2); + int num4 = WorldGen.genRand.Next(15) + 15; + if (num3 == 0) + Main.chest[index2].item[index3].SetDefaults(117, 1, false); + if (num3 == 1) + Main.chest[index2].item[index3].SetDefaults(19, 1, false); + Main.chest[index2].item[index3].stack = (short) num4; + ++index3; + } + if (WorldGen.genRand.Next(2) == 0) + { + int num3 = WorldGen.genRand.Next(2); + int num4 = WorldGen.genRand.Next(25) + 50; + if (num3 == 0) + Main.chest[index2].item[index3].SetDefaults(265, 1, false); + if (num3 == 1) + Main.chest[index2].item[index3].SetDefaults(278, 1, false); + Main.chest[index2].item[index3].stack = (short) num4; + ++index3; + } + if (WorldGen.genRand.Next(2) == 0) + { + int num3 = WorldGen.genRand.Next(2); + int num4 = WorldGen.genRand.Next(15) + 15; + if (num3 == 0) + Main.chest[index2].item[index3].SetDefaults(226, 1, false); + if (num3 == 1) + Main.chest[index2].item[index3].SetDefaults(227, 1, false); + Main.chest[index2].item[index3].stack = (short) num4; + ++index3; + } + if (WorldGen.genRand.Next(4) > 0) + { + int num3 = WorldGen.genRand.Next(7); + int num4 = WorldGen.genRand.Next(1, 3); + if (num3 == 0) + Main.chest[index2].item[index3].SetDefaults(296, 1, false); + if (num3 == 1) + Main.chest[index2].item[index3].SetDefaults(295, 1, false); + if (num3 == 2) + Main.chest[index2].item[index3].SetDefaults(293, 1, false); + if (num3 == 3) + Main.chest[index2].item[index3].SetDefaults(288, 1, false); + if (num3 == 4) + Main.chest[index2].item[index3].SetDefaults(294, 1, false); + if (num3 == 5) + Main.chest[index2].item[index3].SetDefaults(297, 1, false); + if (num3 == 6) + Main.chest[index2].item[index3].SetDefaults(304, 1, false); + Main.chest[index2].item[index3].stack = (short) num4; + ++index3; + } + if (WorldGen.genRand.Next(3) > 0) + { + int num3 = WorldGen.genRand.Next(5); + int num4 = WorldGen.genRand.Next(1, 3); + if (num3 == 0) + Main.chest[index2].item[index3].SetDefaults(305, 1, false); + if (num3 == 1) + Main.chest[index2].item[index3].SetDefaults(301, 1, false); + if (num3 == 2) + Main.chest[index2].item[index3].SetDefaults(302, 1, false); + if (num3 == 3) + Main.chest[index2].item[index3].SetDefaults(288, 1, false); + if (num3 == 4) + Main.chest[index2].item[index3].SetDefaults(300, 1, false); + Main.chest[index2].item[index3].stack = (short) num4; + ++index3; + } + if (WorldGen.genRand.Next(2) == 0) + { + int num3 = WorldGen.genRand.Next(2); + int num4 = WorldGen.genRand.Next(15) + 15; + if (num3 == 0) + Main.chest[index2].item[index3].SetDefaults(8, 1, false); + if (num3 == 1) + Main.chest[index2].item[index3].SetDefaults(282, 1, false); + Main.chest[index2].item[index3].stack = (short) num4; + ++index3; + } + else if (WorldGen.genRand.Next(48) == 0) + { + Main.chest[index2].item[index3].SetDefaults(625, 1, false); + ++index3; + } + if (WorldGen.genRand.Next(2) == 0) + { + Main.chest[index2].item[index3].SetDefaults(73, 1, false); + Main.chest[index2].item[index3].stack = (short) WorldGen.genRand.Next(2, 5); + ++index3; + } + } + } + while (index3 == 0); + return true; + } + } + return false; + } + + public static int OpenDoor(int i, int j, int direction) + { + if (!WorldGen.DoOpenDoor(i, j, direction)) + { + direction = -direction; + if (!WorldGen.DoOpenDoor(i, j, direction)) + direction = 0; + } + return direction; + } + + public static bool CanOpenDoor(int i, int j) + { + bool flag = WorldGen.DoCanOpenDoor(i, j, 1); + if (!flag) + flag = WorldGen.DoCanOpenDoor(i, j, -1); + return flag; + } + + private static bool DoCanOpenDoor(int i, int j, int direction) + { + if ((int) Main.tile[i, j - 1].frameY == 0 && (int) Main.tile[i, j - 1].type == (int) Main.tile[i, j].type) + --j; + else if ((int) Main.tile[i, j - 2].frameY == 0 && (int) Main.tile[i, j - 2].type == (int) Main.tile[i, j].type) + j -= 2; + else if ((int) Main.tile[i, j + 1].frameY == 0 && (int) Main.tile[i, j + 1].type == (int) Main.tile[i, j].type) + ++j; + i += direction; + for (int index1 = j; index1 < j + 3; ++index1) + { + if ((int) Main.tile[i, index1].active != 0) + { + int index2 = (int) Main.tile[i, index1].type; + if (!Main.tileCut[index2] && index2 != 3 && (index2 != 24 && index2 != 52) && (index2 != 61 && index2 != 62 && (index2 != 69 && index2 != 71)) && (index2 != 73 && index2 != 74 && (index2 != 110 && index2 != 113) && index2 != 115)) + return false; + } + } + return true; + } + + private static bool DoOpenDoor(int i, int j, int direction) + { + int index1 = j; + if ((int) Main.tile[i, j - 1].frameY == 0 && (int) Main.tile[i, j - 1].type == (int) Main.tile[i, j].type) + --index1; + else if ((int) Main.tile[i, j - 2].frameY == 0 && (int) Main.tile[i, j - 2].type == (int) Main.tile[i, j].type) + index1 -= 2; + else if ((int) Main.tile[i, j + 1].frameY == 0 && (int) Main.tile[i, j + 1].type == (int) Main.tile[i, j].type) + ++index1; + int index2 = i; + int num1 = i; + int i1; + int num2; + if (direction == -1) + { + --index2; + i1 = num1 - 1; + num2 = 36; + } + else + { + i1 = num1 + 1; + num2 = 0; + } + bool flag1 = true; + for (int j1 = index1; j1 < index1 + 3; ++j1) + { + if ((int) Main.tile[i1, j1].active != 0) + { + int index3 = (int) Main.tile[i1, j1].type; + if (Main.tileCut[index3] || index3 == 3 || (index3 == 24 || index3 == 52) || (index3 == 61 || index3 == 62 || (index3 == 69 || index3 == 71)) || (index3 == 73 || index3 == 74 || (index3 == 110 || index3 == 113) || index3 == 115)) + { + WorldGen.KillTile(i1, j1); + } + else + { + flag1 = false; + break; + } + } + } + if (flag1) + { + if (Main.netMode != 1) + { + for (int index3 = index2; index3 <= index2 + 1; ++index3) + { + for (int index4 = index1; index4 <= index1 + 2; ++index4) + { + if (WorldGen.numNoWire < 999) + { + WorldGen.noWire[WorldGen.numNoWire].X = (short) index3; + WorldGen.noWire[WorldGen.numNoWire].Y = (short) index4; + ++WorldGen.numNoWire; + } + } + } + } + Main.PlaySound(8, i * 16, j * 16, 1); + Main.tile[index2, index1].active = (byte) 1; + Main.tile[index2, index1].type = (byte) 11; + Main.tile[index2, index1].frameY = (short) 0; + Main.tile[index2, index1].frameX = (short) num2; + Main.tile[index2 + 1, index1].active = (byte) 1; + Main.tile[index2 + 1, index1].type = (byte) 11; + Main.tile[index2 + 1, index1].frameY = (short) 0; + Main.tile[index2 + 1, index1].frameX = (short) (num2 + 18); + Main.tile[index2, index1 + 1].active = (byte) 1; + Main.tile[index2, index1 + 1].type = (byte) 11; + Main.tile[index2, index1 + 1].frameY = (short) 18; + Main.tile[index2, index1 + 1].frameX = (short) num2; + Main.tile[index2 + 1, index1 + 1].active = (byte) 1; + Main.tile[index2 + 1, index1 + 1].type = (byte) 11; + Main.tile[index2 + 1, index1 + 1].frameY = (short) 18; + Main.tile[index2 + 1, index1 + 1].frameX = (short) (num2 + 18); + Main.tile[index2, index1 + 2].active = (byte) 1; + Main.tile[index2, index1 + 2].type = (byte) 11; + Main.tile[index2, index1 + 2].frameY = (short) 36; + Main.tile[index2, index1 + 2].frameX = (short) num2; + Main.tile[index2 + 1, index1 + 2].active = (byte) 1; + Main.tile[index2 + 1, index1 + 2].type = (byte) 11; + Main.tile[index2 + 1, index1 + 2].frameY = (short) 36; + Main.tile[index2 + 1, index1 + 2].frameX = (short) (num2 + 18); + bool flag2 = WorldGen.tileFrameRecursion; + WorldGen.tileFrameRecursion = false; + for (int i2 = index2 - 1; i2 <= index2 + 2; ++i2) + { + for (int j1 = index1 - 1; j1 <= index1 + 2; ++j1) + WorldGen.TileFrame(i2, j1, 0); + } + WorldGen.tileFrameRecursion = flag2; + } + return flag1; + } + + public static void Check1xX(int x, int j, int type) + { + if (WorldGen.destroyObject) + return; + int num1 = j - (int) Main.tile[x, j].frameY / 18; + int num2 = (int) Main.tile[x, j].frameX; + int num3 = 3; + if (type == 92) + num3 = 6; + for (int index = 0; index < num3; ++index) + { + if ((int) Main.tile[x, num1 + index].active == 0 || (int) Main.tile[x, num1 + index].type != type || ((int) Main.tile[x, num1 + index].frameY != index * 18 || (int) Main.tile[x, num1 + index].frameX != num2)) + goto label_9; + } + if ((int) Main.tile[x, num1 + num3].active != 0 && Main.tileSolid[(int) Main.tile[x, num1 + num3].type]) + return; +label_9: + WorldGen.destroyObject = true; + for (int index = 0; index < num3; ++index) + { + if ((int) Main.tile[x, num1 + index].type == type) + WorldGen.KillTile(x, num1 + index); + } + if (!WorldGen.gen) + { + if (type == 92) + Item.NewItem(x * 16, j * 16, 32, 32, 341, 1, false, 0); + else if (type == 93) + Item.NewItem(x * 16, j * 16, 32, 32, 342, 1, false, 0); + } + WorldGen.destroyObject = false; + } + + public static void Check2xX(int i, int j, int type) + { + if (WorldGen.destroyObject) + return; + int i1 = i; + if ((int) Main.tile[i, j].frameX % 36 == 18) + --i1; + int num1 = j - (int) Main.tile[i1, j].frameY / 18; + int num2 = (int) Main.tile[i1, j].frameX; + int num3 = 3; + if (type == 104) + num3 = 5; + for (int index = 0; index < num3; ++index) + { + if ((int) Main.tile[i1, num1 + index].active == 0 || (int) Main.tile[i1, num1 + index].type != type || ((int) Main.tile[i1, num1 + index].frameY != index * 18 || (int) Main.tile[i1, num1 + index].frameX != num2) || ((int) Main.tile[i1 + 1, num1 + index].active == 0 || (int) Main.tile[i1 + 1, num1 + index].type != type || ((int) Main.tile[i1 + 1, num1 + index].frameY != index * 18 || (int) Main.tile[i1 + 1, num1 + index].frameX != num2 + 18))) + goto label_11; + } + if ((int) Main.tile[i1, num1 + num3].active != 0 && Main.tileSolid[(int) Main.tile[i1, num1 + num3].type] && ((int) Main.tile[i1 + 1, num1 + num3].active != 0 && Main.tileSolid[(int) Main.tile[i1 + 1, num1 + num3].type])) + return; +label_11: + WorldGen.destroyObject = true; + for (int index = 0; index < num3; ++index) + { + if ((int) Main.tile[i1, num1 + index].type == type) + WorldGen.KillTile(i1, num1 + index); + if ((int) Main.tile[i1 + 1, num1 + index].type == type) + WorldGen.KillTile(i1 + 1, num1 + index); + } + if (!WorldGen.gen) + { + if (type == 104) + Item.NewItem(i1 * 16, j * 16, 32, 32, 359, 1, false, 0); + else if (type == 105) + { + int num4 = num2 / 36; + int Type; + switch (num4) + { + case 0: + Type = 360; + break; + case 1: + Type = 52; + break; + default: + Type = 438 + num4 - 2; + break; + } + Item.NewItem(i1 * 16, j * 16, 32, 32, Type, 1, false, 0); + } + } + WorldGen.destroyObject = false; + } + + public static bool Place1xX(int x, int y, int type, int style = 0) + { + int num1 = style * 18; + int num2 = 3; + if (type == 92) + num2 = 6; + for (int index = y - num2 + 1; index < y + 1; ++index) + { + if ((int) Main.tile[x, index].active != 0 || type == 93 && (int) Main.tile[x, index].liquid > 0) + return false; + } + if ((int) Main.tile[x, y + 1].active == 0 || !Main.tileSolid[(int) Main.tile[x, y + 1].type]) + return false; + for (int index = 0; index < num2; ++index) + { + Main.tile[x, y - num2 + 1 + index].active = (byte) 1; + Main.tile[x, y - num2 + 1 + index].frameY = (short) (index * 18); + Main.tile[x, y - num2 + 1 + index].frameX = (short) num1; + Main.tile[x, y - num2 + 1 + index].type = (byte) type; + } + return true; + } + + public static bool Place2xX(int x, int y, int type, int style = 0) + { + int num1 = style * 36; + int num2 = 3; + if (type == 104) + num2 = 5; + for (int index = y - num2 + 1; index < y + 1; ++index) + { + if ((int) Main.tile[x, index].active != 0 || (int) Main.tile[x + 1, index].active != 0) + return false; + } + if ((int) Main.tile[x, y + 1].active == 0 || !Main.tileSolid[(int) Main.tile[x, y + 1].type] || ((int) Main.tile[x + 1, y + 1].active == 0 || !Main.tileSolid[(int) Main.tile[x + 1, y + 1].type])) + return false; + for (int index = 0; index < num2; ++index) + { + Main.tile[x, y - num2 + 1 + index].active = (byte) 1; + Main.tile[x, y - num2 + 1 + index].frameY = (short) (index * 18); + Main.tile[x, y - num2 + 1 + index].frameX = (short) num1; + Main.tile[x, y - num2 + 1 + index].type = (byte) type; + Main.tile[x + 1, y - num2 + 1 + index].active = (byte) 1; + Main.tile[x + 1, y - num2 + 1 + index].frameY = (short) (index * 18); + Main.tile[x + 1, y - num2 + 1 + index].frameX = (short) (num1 + 18); + Main.tile[x + 1, y - num2 + 1 + index].type = (byte) type; + } + return true; + } + + public static void Check1x2(int x, int j, int type) + { + if (WorldGen.destroyObject) + return; + int j1 = j; + bool flag = true; + int num1 = (int) Main.tile[x, j1].frameY; + int num2 = num1 / 40; + if (num1 % 40 == 18) + --j1; + if ((int) Main.tile[x, j1].frameY == 40 * num2 && (int) Main.tile[x, j1 + 1].frameY == 40 * num2 + 18 && ((int) Main.tile[x, j1].type == type && (int) Main.tile[x, j1 + 1].type == type)) + flag = false; + if ((int) Main.tile[x, j1 + 2].active == 0 || !Main.tileSolid[(int) Main.tile[x, j1 + 2].type]) + flag = true; + if ((int) Main.tile[x, j1 + 2].type != 2 && (int) Main.tile[x, j1 + 2].type != 109 && ((int) Main.tile[x, j1 + 2].type != 147 && (int) Main.tile[x, j1].type == 20)) + flag = true; + if (!flag) + return; + WorldGen.destroyObject = true; + if ((int) Main.tile[x, j1].type == type) + WorldGen.KillTile(x, j1); + if ((int) Main.tile[x, j1 + 1].type == type) + WorldGen.KillTile(x, j1 + 1); + if (!WorldGen.gen) + { + if (type == 15) + { + if (num2 == 1) + Item.NewItem(x * 16, j1 * 16, 32, 32, 358, 1, false, 0); + else + Item.NewItem(x * 16, j1 * 16, 32, 32, 34, 1, false, 0); + } + else if (type == 134) + Item.NewItem(x * 16, j1 * 16, 32, 32, 525, 1, false, 0); + } + WorldGen.destroyObject = false; + } + + public static void CheckOnTableClaypot(int x, int y) + { + if ((int) Main.tile[x, y + 1].active != 0 && Main.tileTable[(int) Main.tile[x, y + 1].type] || (int) Main.tile[x, y + 1].active != 0 && Main.tileSolid[(int) Main.tile[x, y + 1].type]) + return; + WorldGen.KillTile(x, y); + } + + public static void CheckOnTable1x1(int x, int y) + { + if ((int) Main.tile[x, y + 1].active != 0 && Main.tileTable[(int) Main.tile[x, y + 1].type]) + return; + WorldGen.KillTile(x, y); + } + + public static void CheckSign(int x, int y, int type) + { + if (WorldGen.destroyObject) + return; + int num1 = x - 2; + int num2 = x + 3; + int num3 = y - 2; + int num4 = y + 3; + if (num1 < 0 || num2 > (int) Main.maxTilesX || (num3 < 0 || num4 > (int) Main.maxTilesY)) + return; + bool flag = false; + int num5 = (int) Main.tile[x, y].frameX / 18 & 1; + int num6 = (int) Main.tile[x, y].frameY / 18; + int x1 = x - num5; + int y1 = y - num6; + int num7 = (int) Main.tile[x1, y1].frameX / 36; + int num8 = x1; + int num9 = x1 + 2; + int num10 = y1; + int num11 = y1 + 2; + int num12 = 0; + for (int index1 = num8; index1 < num9; ++index1) + { + int num13 = 0; + for (int index2 = num10; index2 < num11; ++index2) + { + if ((int) Main.tile[index1, index2].active == 0 || (int) Main.tile[index1, index2].type != type) + { + flag = true; + break; + } + else if ((int) Main.tile[index1, index2].frameX / 18 != num12 + num7 * 2 || (int) Main.tile[index1, index2].frameY / 18 != num13) + { + flag = true; + break; + } + else + ++num13; + } + ++num12; + } + if (!flag) + { + if (type == 85) + { + if ((int) Main.tile[x1, y1 + 2].active != 0 && Main.tileSolid[(int) Main.tile[x1, y1 + 2].type] && ((int) Main.tile[x1 + 1, y1 + 2].active != 0 && Main.tileSolid[(int) Main.tile[x1 + 1, y1 + 2].type])) + num7 = 0; + else + flag = true; + } + else if ((int) Main.tile[x1, y1 + 2].active != 0 && Main.tileSolid[(int) Main.tile[x1, y1 + 2].type] && ((int) Main.tile[x1 + 1, y1 + 2].active != 0 && Main.tileSolid[(int) Main.tile[x1 + 1, y1 + 2].type])) + num7 = 0; + else if ((int) Main.tile[x1, y1 - 1].active != 0 && Main.tileSolidNotSolidTop[(int) Main.tile[x1, y1 - 1].type] && ((int) Main.tile[x1 + 1, y1 - 1].active != 0 && Main.tileSolidNotSolidTop[(int) Main.tile[x1 + 1, y1 - 1].type])) + num7 = 1; + else if ((int) Main.tile[x1 - 1, y1].active != 0 && Main.tileSolidNotSolidTop[(int) Main.tile[x1 - 1, y1].type] && ((int) Main.tile[x1 - 1, y1 + 1].active != 0 && Main.tileSolidNotSolidTop[(int) Main.tile[x1 - 1, y1 + 1].type])) + num7 = 2; + else if ((int) Main.tile[x1 + 2, y1].active != 0 && Main.tileSolidNotSolidTop[(int) Main.tile[x1 + 2, y1].type] && ((int) Main.tile[x1 + 2, y1 + 1].active != 0 && Main.tileSolidNotSolidTop[(int) Main.tile[x1 + 2, y1 + 1].type])) + num7 = 3; + else + flag = true; + } + if (flag) + { + WorldGen.destroyObject = true; + for (int i = num8; i < num9; ++i) + { + for (int j = num10; j < num11; ++j) + { + if ((int) Main.tile[i, j].type == type) + WorldGen.KillTile(i, j); + } + } + Sign.KillSign(x1, y1); + if (!WorldGen.gen) + { + if (type == 85) + Item.NewItem(x * 16, y * 16, 32, 32, 321, 1, false, 0); + else + Item.NewItem(x * 16, y * 16, 32, 32, 171, 1, false, 0); + } + WorldGen.destroyObject = false; + } + else + { + int num13 = 36 * num7; + for (int index1 = 0; index1 < 2; ++index1) + { + for (int index2 = 0; index2 < 2; ++index2) + { + Main.tile[x1 + index1, y1 + index2].active = (byte) 1; + Main.tile[x1 + index1, y1 + index2].type = (byte) type; + Main.tile[x1 + index1, y1 + index2].frameX = (short) (num13 + 18 * index1); + Main.tile[x1 + index1, y1 + index2].frameY = (short) (18 * index2); + } + } + } + } + + public static bool PlaceSign(int x, int y, int type) + { + int num1 = x - 2; + int num2 = x + 3; + int num3 = y - 2; + int num4 = y + 3; + if (num1 < 0 || num2 > (int) Main.maxTilesX || (num3 < 0 || num4 > (int) Main.maxTilesY)) + return false; + int index1 = x; + int index2 = y; + int num5 = 0; + if (type == 55) + { + if ((int) Main.tile[x, y + 1].active != 0 && Main.tileSolid[(int) Main.tile[x, y + 1].type] && ((int) Main.tile[x + 1, y + 1].active != 0 && Main.tileSolid[(int) Main.tile[x + 1, y + 1].type])) + { + --index2; + num5 = 0; + } + else if ((int) Main.tile[x, y - 1].active != 0 && Main.tileSolidNotSolidTop[(int) Main.tile[x, y - 1].type] && ((int) Main.tile[x + 1, y - 1].active != 0 && Main.tileSolidNotSolidTop[(int) Main.tile[x + 1, y - 1].type])) + num5 = 1; + else if ((int) Main.tile[x - 1, y].active != 0 && Main.tileSolidNotSolidTop[(int) Main.tile[x - 1, y].type] && (!Main.tileNoAttach[(int) Main.tile[x - 1, y].type] && (int) Main.tile[x - 1, y + 1].active != 0) && (Main.tileSolidNotSolidTop[(int) Main.tile[x - 1, y + 1].type] && !Main.tileNoAttach[(int) Main.tile[x - 1, y + 1].type])) + { + num5 = 2; + } + else + { + if ((int) Main.tile[x + 1, y].active == 0 || !Main.tileSolidNotSolidTop[(int) Main.tile[x + 1, y].type] || (Main.tileNoAttach[(int) Main.tile[x + 1, y].type] || (int) Main.tile[x + 1, y + 1].active == 0) || (!Main.tileSolidNotSolidTop[(int) Main.tile[x + 1, y + 1].type] || Main.tileNoAttach[(int) Main.tile[x + 1, y + 1].type])) + return false; + --index1; + num5 = 3; + } + } + else if (type == 85) + { + if ((int) Main.tile[x, y + 1].active == 0 || !Main.tileSolid[(int) Main.tile[x, y + 1].type] || ((int) Main.tile[x + 1, y + 1].active == 0 || !Main.tileSolid[(int) Main.tile[x + 1, y + 1].type])) + return false; + --index2; + num5 = 0; + } + if ((int) Main.tile[index1, index2].active != 0 || (int) Main.tile[index1 + 1, index2].active != 0 || ((int) Main.tile[index1, index2 + 1].active != 0 || (int) Main.tile[index1 + 1, index2 + 1].active != 0)) + return false; + int num6 = 36 * num5; + for (int index3 = 0; index3 < 2; ++index3) + { + for (int index4 = 0; index4 < 2; ++index4) + { + Main.tile[index1 + index3, index2 + index4].active = (byte) 1; + Main.tile[index1 + index3, index2 + index4].type = (byte) type; + Main.tile[index1 + index3, index2 + index4].frameX = (short) (num6 + 18 * index3); + Main.tile[index1 + index3, index2 + index4].frameY = (short) (18 * index4); + } + } + return true; + } + + public static bool Place1x1(int x, int y, int type, int style = 0) + { + if ((int) Main.tile[x, y].active != 0 || !WorldGen.SolidTileUnsafe(x, y + 1)) + return false; + Main.tile[x, y].active = (byte) 1; + Main.tile[x, y].type = (byte) type; + if (type == 144) + { + Main.tile[x, y].frameX = (short) (style * 18); + Main.tile[x, y].frameY = (short) 0; + } + else + Main.tile[x, y].frameY = (short) (style * 18); + return true; + } + + public static void Check1x1(int x, int y, int type) + { + if ((int) Main.tile[x, y + 1].active != 0 && Main.tileSolid[(int) Main.tile[x, y + 1].type]) + return; + WorldGen.KillTile(x, y); + } + + public static bool PlaceOnTable1x1(int x, int y, int type, int style = 0) + { + if ((int) Main.tile[x, y].active != 0 || (int) Main.tile[x, y + 1].active == 0 || !Main.tileTable[(int) Main.tile[x, y + 1].type] || type == 78 && ((int) Main.tile[x, y].active != 0 || (int) Main.tile[x, y + 1].active == 0 || !Main.tileSolid[(int) Main.tile[x, y + 1].type])) + return false; + Main.tile[x, y].active = (byte) 1; + Main.tile[x, y].frameX = (short) (style * 18); + Main.tile[x, y].frameY = (short) 0; + Main.tile[x, y].type = (byte) type; + if (type == 50) + Main.tile[x, y].frameX = (short) (18 * WorldGen.genRand.Next(5)); + return true; + } + + public static bool PlaceAlch(int x, int y, int style) + { + if ((int) Main.tile[x, y].active == 0 && (int) Main.tile[x, y + 1].active != 0) + { + bool flag = false; + if (style == 0) + { + if ((int) Main.tile[x, y + 1].type != 2 && (int) Main.tile[x, y + 1].type != 78 && (int) Main.tile[x, y + 1].type != 109) + flag = true; + if ((int) Main.tile[x, y].liquid > 0) + flag = true; + } + else if (style == 1) + { + if ((int) Main.tile[x, y + 1].type != 60 && (int) Main.tile[x, y + 1].type != 78) + flag = true; + if ((int) Main.tile[x, y].liquid > 0) + flag = true; + } + else if (style == 2) + { + if ((int) Main.tile[x, y + 1].type != 0 && (int) Main.tile[x, y + 1].type != 59 && (int) Main.tile[x, y + 1].type != 78) + flag = true; + if ((int) Main.tile[x, y].liquid > 0) + flag = true; + } + else if (style == 3) + { + if ((int) Main.tile[x, y + 1].type != 23 && (int) Main.tile[x, y + 1].type != 25 && (int) Main.tile[x, y + 1].type != 78) + flag = true; + if ((int) Main.tile[x, y].liquid > 0) + flag = true; + } + else if (style == 4) + { + if ((int) Main.tile[x, y + 1].type != 53 && (int) Main.tile[x, y + 1].type != 78 && (int) Main.tile[x, y + 1].type != 116) + flag = true; + if ((int) Main.tile[x, y].liquid > 0 && (int) Main.tile[x, y].lava != 0) + flag = true; + } + else if (style == 5) + { + if ((int) Main.tile[x, y + 1].type != 57 && (int) Main.tile[x, y + 1].type != 78) + flag = true; + if ((int) Main.tile[x, y].liquid > 0 && (int) Main.tile[x, y].lava == 0) + flag = true; + } + if (!flag) + { + Main.tile[x, y].active = (byte) 1; + Main.tile[x, y].type = (byte) 82; + Main.tile[x, y].frameX = (short) (18 * style); + Main.tile[x, y].frameY = (short) 0; + return true; + } + } + return false; + } + + public static void GrowAlch(int x, int y) + { + if ((int) Main.tile[x, y].active == 0) + return; + if ((int) Main.tile[x, y].type == 82 && WorldGen.genRand.Next(50) == 0) + { + Main.tile[x, y].type = (byte) 83; + WorldGen.SquareTileFrame(x, y, -1); + if (Main.netMode != 2) + return; + NetMessage.SendTile(x, y); + } + else + { + if ((int) Main.tile[x, y].frameX != 36) + return; + if ((int) Main.tile[x, y].type == 83) + Main.tile[x, y].type = (byte) 84; + else + Main.tile[x, y].type = (byte) 83; + if (Main.netMode != 2) + return; + NetMessage.SendTile(x, y); + } + } + + public static void PlantAlch() + { + int index1 = WorldGen.genRand.Next(20, (int) Main.maxTilesX - 20); + int index2; + switch (WorldGen.genRand.Next(40)) + { + case 0: + index2 = WorldGen.genRand.Next(Main.rockLayer + (int) Main.maxTilesY >> 1, (int) Main.maxTilesY - 20); + break; + case 1: + case 2: + case 3: + case 4: + index2 = WorldGen.genRand.Next((int) Main.maxTilesY - 20); + break; + default: + index2 = WorldGen.genRand.Next(Main.worldSurface, (int) Main.maxTilesY - 20); + break; + } + while (index2 < (int) Main.maxTilesY - 20 && (int) Main.tile[index1, index2].active == 0) + ++index2; + if ((int) Main.tile[index1, index2].active == 0 || (int) Main.tile[index1, index2 - 1].active != 0 || (int) Main.tile[index1, index2 - 1].liquid != 0) + return; + int style = -1; + byte num = Main.tile[index1, index2].type; + if ((uint) num <= 53U) + { + switch (num) + { + case (byte) 0: + goto label_13; + case (byte) 2: + break; + case (byte) 23: + case (byte) 25: + style = 3; + goto label_17; + case (byte) 53: + goto label_15; + default: + goto label_17; + } + } + else + { + switch (num) + { + case (byte) 57: + style = 5; + goto label_17; + case (byte) 59: + goto label_13; + case (byte) 60: + style = 1; + goto label_17; + case (byte) 109: + break; + case (byte) 116: + goto label_15; + default: + goto label_17; + } + } + style = 0; + goto label_17; +label_13: + style = 2; + goto label_17; +label_15: + style = 4; +label_17: + if (style < 0 || !WorldGen.PlaceAlch(index1, index2 - 1, style) || Main.netMode != 2) + return; + NetMessage.SendTile(index1, index2 - 1); + } + + public static void CheckAlch(int x, int y) + { + bool flag = (int) Main.tile[x, y + 1].active == 0; + Main.tile[x, y].frameY = (short) 0; + if (!flag) + { + int num1 = (int) Main.tile[x, y].frameX / 18; + int num2 = (int) Main.tile[x, y + 1].type; + if (num1 == 0) + { + if (num2 != 109 && num2 != 2 && num2 != 78) + flag = true; + else if ((int) Main.tile[x, y].liquid > 0 && (int) Main.tile[x, y].lava != 0) + flag = true; + } + else if (num1 == 1) + { + if (num2 != 60 && num2 != 78) + flag = true; + else if ((int) Main.tile[x, y].liquid > 0 && (int) Main.tile[x, y].lava != 0) + flag = true; + } + else if (num1 == 2) + { + if (num2 != 0 && num2 != 59 && num2 != 78) + flag = true; + else if ((int) Main.tile[x, y].liquid > 0 && (int) Main.tile[x, y].lava != 0) + flag = true; + } + else if (num1 == 3) + { + if (num2 != 23 && num2 != 25 && num2 != 78) + flag = true; + else if ((int) Main.tile[x, y].liquid > 0 && (int) Main.tile[x, y].lava != 0) + flag = true; + } + else + { + int num3 = (int) Main.tile[x, y].type; + if (num1 == 4) + { + if (num2 != 53 && num2 != 78 && num2 != 116) + flag = true; + else if ((int) Main.tile[x, y].liquid > 0 && (int) Main.tile[x, y].lava != 0) + flag = true; + if (num3 != 82 && (int) Main.tile[x, y].lava == 0 && Main.netMode != 1) + { + if ((int) Main.tile[x, y].liquid > 16) + { + if (num3 == 83) + { + Main.tile[x, y].type = (byte) 84; + if (Main.netMode == 2) + NetMessage.SendTile(x, y); + } + } + else if (num3 == 84) + { + Main.tile[x, y].type = (byte) 83; + if (Main.netMode == 2) + NetMessage.SendTile(x, y); + } + } + } + else if (num1 == 5) + { + if (num2 != 57 && num2 != 78) + flag = true; + else if ((int) Main.tile[x, y].liquid > 0 && (int) Main.tile[x, y].lava == 0) + flag = true; + if (Main.netMode != 1 && num3 != 82 && (int) Main.tile[x, y].lava != 0) + { + if ((int) Main.tile[x, y].liquid > 16) + { + if (num3 == 83) + { + Main.tile[x, y].type = (byte) 84; + if (Main.netMode == 2) + NetMessage.SendTile(x, y); + } + } + else if (num3 == 84) + { + Main.tile[x, y].type = (byte) 83; + if (Main.netMode == 2) + NetMessage.SendTile(x, y); + } + } + } + } + } + if (!flag) + return; + WorldGen.KillTile(x, y); + } + + public static void CheckBanner(int x, int j) + { + if (WorldGen.destroyObject) + return; + int num1 = j - (int) Main.tile[x, j].frameY / 18; + int num2 = (int) Main.tile[x, j].frameX; + bool flag = false; + for (int index = 0; index < 3; ++index) + { + if ((int) Main.tile[x, num1 + index].active == 0) + { + flag = true; + break; + } + else if ((int) Main.tile[x, num1 + index].type != 91) + { + flag = true; + break; + } + else if ((int) Main.tile[x, num1 + index].frameY != index * 18) + { + flag = true; + break; + } + else if ((int) Main.tile[x, num1 + index].frameX != num2) + { + flag = true; + break; + } + } + if (!flag) + flag = (int) Main.tile[x, num1 - 1].active == 0 || !Main.tileSolidNotSolidTop[(int) Main.tile[x, num1 - 1].type]; + if (!flag) + return; + WorldGen.destroyObject = true; + for (int index = 0; index < 3; ++index) + { + if ((int) Main.tile[x, num1 + index].type == 91) + WorldGen.KillTile(x, num1 + index); + } + if (!WorldGen.gen) + Item.NewItem(x * 16, (num1 + 1) * 16, 32, 32, 337 + num2 / 18, 1, false, 0); + WorldGen.destroyObject = false; + } + + public static bool PlaceBanner(int x, int y, int type, int style = 0) + { + int num = style * 18; + if ((int) Main.tile[x, y - 1].active == 0 || !Main.tileSolidNotSolidTop[(int) Main.tile[x, y - 1].type] || ((int) Main.tile[x, y].active != 0 || (int) Main.tile[x, y + 1].active != 0) || (int) Main.tile[x, y + 2].active != 0) + return false; + Main.tile[x, y].active = (byte) 1; + Main.tile[x, y].frameY = (short) 0; + Main.tile[x, y].frameX = (short) num; + Main.tile[x, y].type = (byte) type; + Main.tile[x, y + 1].active = (byte) 1; + Main.tile[x, y + 1].frameY = (short) 18; + Main.tile[x, y + 1].frameX = (short) num; + Main.tile[x, y + 1].type = (byte) type; + Main.tile[x, y + 2].active = (byte) 1; + Main.tile[x, y + 2].frameY = (short) 36; + Main.tile[x, y + 2].frameX = (short) num; + Main.tile[x, y + 2].type = (byte) type; + return true; + } + + public static bool PlaceMan(int i, int j, int dir) + { + for (int index1 = i; index1 <= i + 1; ++index1) + { + for (int index2 = j - 2; index2 <= j; ++index2) + { + if ((int) Main.tile[index1, index2].active != 0) + return false; + } + } + if (!WorldGen.SolidTileUnsafe(i, j + 1) || !WorldGen.SolidTileUnsafe(i + 1, j + 1)) + return false; + int num = dir == 1 ? 36 : 0; + Main.tile[i, j - 2].active = (byte) 1; + Main.tile[i, j - 2].frameY = (short) 0; + Main.tile[i, j - 2].frameX = (short) (byte) num; + Main.tile[i, j - 2].type = (byte) sbyte.MinValue; + Main.tile[i, j - 1].active = (byte) 1; + Main.tile[i, j - 1].frameY = (short) 18; + Main.tile[i, j - 1].frameX = (short) (byte) num; + Main.tile[i, j - 1].type = (byte) sbyte.MinValue; + Main.tile[i, j].active = (byte) 1; + Main.tile[i, j].frameY = (short) 36; + Main.tile[i, j].frameX = (short) (byte) num; + Main.tile[i, j].type = (byte) sbyte.MinValue; + Main.tile[i + 1, j - 2].active = (byte) 1; + Main.tile[i + 1, j - 2].frameY = (short) 0; + Main.tile[i + 1, j - 2].frameX = (short) (byte) (18 + num); + Main.tile[i + 1, j - 2].type = (byte) sbyte.MinValue; + Main.tile[i + 1, j - 1].active = (byte) 1; + Main.tile[i + 1, j - 1].frameY = (short) 18; + Main.tile[i + 1, j - 1].frameX = (short) (byte) (18 + num); + Main.tile[i + 1, j - 1].type = (byte) sbyte.MinValue; + Main.tile[i + 1, j].active = (byte) 1; + Main.tile[i + 1, j].frameY = (short) 36; + Main.tile[i + 1, j].frameX = (short) (byte) (18 + num); + Main.tile[i + 1, j].type = (byte) sbyte.MinValue; + return true; + } + + public static void CheckMan(int i, int j) + { + if (WorldGen.destroyObject) + return; + int num1 = i; + int num2 = j - (int) Main.tile[i, j].frameY / 18; + int num3 = (int) Main.tile[i, j].frameX % 100 % 36; + int i1 = num1 - num3 / 18; + bool flag = false; + for (int index1 = 0; index1 <= 1; ++index1) + { + for (int index2 = 0; index2 <= 2; ++index2) + { + int index3 = i1 + index1; + int index4 = num2 + index2; + int num4 = (int) Main.tile[index3, index4].frameX % 100; + if (num4 >= 36) + num4 -= 36; + if ((int) Main.tile[index3, index4].active == 0 || (int) Main.tile[index3, index4].type != 128 || ((int) Main.tile[index3, index4].frameY != index2 * 18 || num4 != index1 * 18)) + { + flag = true; + break; + } + } + } + if (!flag && WorldGen.SolidTileUnsafe(i1, num2 + 3) && WorldGen.SolidTileUnsafe(i1 + 1, num2 + 3)) + return; + WorldGen.destroyObject = true; + for (int index1 = 0; index1 <= 1; ++index1) + { + for (int index2 = 0; index2 <= 2; ++index2) + { + int i2 = i1 + index1; + int j1 = num2 + index2; + if ((int) Main.tile[i2, j1].active != 0 && (int) Main.tile[i2, j1].type == 128) + WorldGen.KillTile(i2, j1); + } + } + if (!WorldGen.gen) + Item.NewItem(i * 16, j * 16, 32, 32, 498, 1, false, 0); + WorldGen.destroyObject = false; + } + + public static bool Place1x2(int x, int y, int type, int style) + { + if ((int) Main.tile[x, y + 1].active == 0 || !Main.tileSolid[(int) Main.tile[x, y + 1].type] || (int) Main.tile[x, y - 1].active != 0) + return false; + int num1 = type == 20 ? WorldGen.genRand.Next(3) * 18 : 0; + int num2 = style * 40; + Main.tile[x, y - 1].active = (byte) 1; + Main.tile[x, y - 1].frameY = (short) num2; + Main.tile[x, y - 1].frameX = (short) num1; + Main.tile[x, y - 1].type = (byte) type; + Main.tile[x, y].active = (byte) 1; + Main.tile[x, y].frameY = (short) (num2 + 18); + Main.tile[x, y].frameX = (short) num1; + Main.tile[x, y].type = (byte) type; + return true; + } + + public static bool Place1x2Top(int x, int y, int type) + { + if ((int) Main.tile[x, y - 1].active == 0 || !Main.tileSolidNotSolidTop[(int) Main.tile[x, y - 1].type] || (int) Main.tile[x, y + 1].active != 0) + return false; + Main.tile[x, y].active = (byte) 1; + Main.tile[x, y].frameY = (short) 0; + Main.tile[x, y].frameX = (short) 0; + Main.tile[x, y].type = (byte) type; + Main.tile[x, y + 1].active = (byte) 1; + Main.tile[x, y + 1].frameY = (short) 18; + Main.tile[x, y + 1].frameX = (short) 0; + Main.tile[x, y + 1].type = (byte) type; + return true; + } + + public static void Check1x2Top(int x, int j) + { + if (WorldGen.destroyObject) + return; + int j1 = j; + if ((int) Main.tile[x, j1].frameY == 18) + --j1; + if ((int) Main.tile[x, j1].frameY == 0 && (int) Main.tile[x, j1 + 1].frameY == 18 && ((int) Main.tile[x, j1].type == 42 && (int) Main.tile[x, j1 + 1].type == 42) && ((int) Main.tile[x, j1 - 1].active != 0 && Main.tileSolidNotSolidTop[(int) Main.tile[x, j1 - 1].type])) + return; + WorldGen.destroyObject = true; + if ((int) Main.tile[x, j1].type == 42) + WorldGen.KillTile(x, j1); + if ((int) Main.tile[x, j1 + 1].type == 42) + WorldGen.KillTile(x, j1 + 1); + if (!WorldGen.gen) + Item.NewItem(x * 16, j1 * 16, 32, 32, 136, 1, false, 0); + WorldGen.destroyObject = false; + } + + public static void Check2x1(int i, int y, int type) + { + if (WorldGen.destroyObject) + return; + int i1 = i; + if ((int) Main.tile[i1, y].frameX == 18) + --i1; + if ((int) Main.tile[i1, y].frameX == 0 && (int) Main.tile[i1 + 1, y].frameX == 18 && ((int) Main.tile[i1, y].type == type && (int) Main.tile[i1 + 1, y].type == type)) + { + if (type == 29 || type == 103) + { + if ((int) Main.tile[i1, y + 1].active != 0 && Main.tileTable[(int) Main.tile[i1, y + 1].type] && ((int) Main.tile[i1 + 1, y + 1].active != 0 && Main.tileTable[(int) Main.tile[i1 + 1, y + 1].type])) + return; + } + else if ((int) Main.tile[i1, y + 1].active != 0 && Main.tileSolid[(int) Main.tile[i1, y + 1].type] && ((int) Main.tile[i1 + 1, y + 1].active != 0 && Main.tileSolid[(int) Main.tile[i1 + 1, y + 1].type])) + return; + } + WorldGen.destroyObject = true; + if ((int) Main.tile[i1, y].type == type) + WorldGen.KillTile(i1, y); + if ((int) Main.tile[i1 + 1, y].type == type) + WorldGen.KillTile(i1 + 1, y); + if (!WorldGen.gen) + { + if (type == 16) + Item.NewItem(i1 * 16, y * 16, 32, 32, 35, 1, false, 0); + else if (type == 18) + Item.NewItem(i1 * 16, y * 16, 32, 32, 36, 1, false, 0); + else if (type == 29) + { + Item.NewItem(i1 * 16, y * 16, 32, 32, 87, 1, false, 0); + Main.PlaySound(13, i * 16, y * 16, 1); + } + else if (type == 103) + { + Item.NewItem(i1 * 16, y * 16, 32, 32, 356, 1, false, 0); + Main.PlaySound(13, i * 16, y * 16, 1); + } + else if (type == 134) + Item.NewItem(i1 * 16, y * 16, 32, 32, 525, 1, false, 0); + } + WorldGen.destroyObject = false; + WorldGen.SquareTileFrame(i1, y, -1); + WorldGen.SquareTileFrame(i1 + 1, y, -1); + } + + public static bool Place2x1(int x, int y, int type) + { + if ((type == 29 || type == 103 || ((int) Main.tile[x, y + 1].active == 0 || (int) Main.tile[x + 1, y + 1].active == 0) || (!Main.tileSolid[(int) Main.tile[x, y + 1].type] || !Main.tileSolid[(int) Main.tile[x + 1, y + 1].type] || ((int) Main.tile[x, y].active != 0 || (int) Main.tile[x + 1, y].active != 0))) && (type != 29 && type != 103 || ((int) Main.tile[x, y + 1].active == 0 || (int) Main.tile[x + 1, y + 1].active == 0) || (!Main.tileTable[(int) Main.tile[x, y + 1].type] || !Main.tileTable[(int) Main.tile[x + 1, y + 1].type] || ((int) Main.tile[x, y].active != 0 || (int) Main.tile[x + 1, y].active != 0)))) + return false; + Main.tile[x, y].active = (byte) 1; + Main.tile[x, y].frameY = (short) 0; + Main.tile[x, y].frameX = (short) 0; + Main.tile[x, y].type = (byte) type; + Main.tile[x + 1, y].active = (byte) 1; + Main.tile[x + 1, y].frameY = (short) 0; + Main.tile[x + 1, y].frameX = (short) 18; + Main.tile[x + 1, y].type = (byte) type; + return true; + } + + private static void Destroy4x2(int i, int j, int x2, int y2, int type) + { + WorldGen.destroyObject = true; + for (int i1 = x2; i1 < x2 + 4; ++i1) + { + for (int j1 = y2; j1 < y2 + 3; ++j1) + { + if ((int) Main.tile[i1, j1].type == type && (int) Main.tile[i1, j1].active != 0) + WorldGen.KillTile(i1, j1); + } + } + if (!WorldGen.gen) + { + if (type == 79) + Item.NewItem(i * 16, j * 16, 32, 32, 224, 1, false, 0); + else if (type == 90) + Item.NewItem(i * 16, j * 16, 32, 32, 336, 1, false, 0); + } + WorldGen.destroyObject = false; + bool flag = WorldGen.tileFrameRecursion; + WorldGen.tileFrameRecursion = false; + for (int i1 = x2 - 1; i1 < x2 + 4; ++i1) + { + for (int j1 = y2 - 1; j1 < y2 + 4; ++j1) + WorldGen.TileFrame(i1, j1, 0); + } + WorldGen.tileFrameRecursion = flag; + } + + public static void Check4x2(int i, int j, int type) + { + if (WorldGen.destroyObject) + return; + int num1 = i; + int num2 = j; + int x2 = num1 - (int) Main.tile[i, j].frameX / 18; + if ((type == 79 || type == 90) && (int) Main.tile[i, j].frameX >= 72) + x2 += 4; + int y2 = num2 - (int) Main.tile[i, j].frameY / 18; + for (int index1 = x2; index1 < x2 + 4; ++index1) + { + for (int index2 = y2; index2 < y2 + 2; ++index2) + { + int num3 = (index1 - x2) * 18; + if ((type == 79 || type == 90) && (int) Main.tile[i, j].frameX >= 72) + num3 = (index1 - x2 + 4) * 18; + if ((int) Main.tile[index1, index2].active == 0 || (int) Main.tile[index1, index2].type != type || ((int) Main.tile[index1, index2].frameX != num3 || (int) Main.tile[index1, index2].frameY != (index2 - y2) * 18)) + { + WorldGen.Destroy4x2(i, j, x2, y2, type); + return; + } + } + if ((int) Main.tile[index1, y2 + 2].active == 0 || !Main.tileSolid[(int) Main.tile[index1, y2 + 2].type]) + { + WorldGen.Destroy4x2(i, j, x2, y2, type); + break; + } + } + } + + private static void Destroy2x2(int i, int j, int x2, int y2, int type) + { + WorldGen.destroyObject = true; + for (int i1 = x2; i1 < x2 + 2; ++i1) + { + for (int j1 = y2; j1 < y2 + 2; ++j1) + { + if ((int) Main.tile[i1, j1].type == type && (int) Main.tile[i1, j1].active != 0) + WorldGen.KillTile(i1, j1); + } + } + if (!WorldGen.gen) + { + if (type == 85) + Item.NewItem(i * 16, j * 16, 32, 32, 321, 1, false, 0); + else if (type == 94) + Item.NewItem(i * 16, j * 16, 32, 32, 352, 1, false, 0); + else if (type == 95) + Item.NewItem(i * 16, j * 16, 32, 32, 344, 1, false, 0); + else if (type == 96) + Item.NewItem(i * 16, j * 16, 32, 32, 345, 1, false, 0); + else if (type == 97) + Item.NewItem(i * 16, j * 16, 32, 32, 346, 1, false, 0); + else if (type == 98) + Item.NewItem(i * 16, j * 16, 32, 32, 347, 1, false, 0); + else if (type == 99) + Item.NewItem(i * 16, j * 16, 32, 32, 348, 1, false, 0); + else if (type == 100) + Item.NewItem(i * 16, j * 16, 32, 32, 349, 1, false, 0); + else if (type == 125) + Item.NewItem(i * 16, j * 16, 32, 32, 487, 1, false, 0); + else if (type == 126) + Item.NewItem(i * 16, j * 16, 32, 32, 488, 1, false, 0); + else if (type == 132) + Item.NewItem(i * 16, j * 16, 32, 32, 513, 1, false, 0); + else if (type == 142) + Item.NewItem(i * 16, j * 16, 32, 32, 581, 1, false, 0); + else if (type == 143) + Item.NewItem(i * 16, j * 16, 32, 32, 582, 1, false, 0); + else if (type == 138 && Main.netMode != 1) + Projectile.NewProjectile((float) (x2 * 16) + 15.5f, (float) (y2 * 16 + 16), 0.0f, 0.0f, 99, 70, 10f, 8, true); + } + WorldGen.destroyObject = false; + bool flag = WorldGen.tileFrameRecursion; + WorldGen.tileFrameRecursion = false; + for (int i1 = x2 - 1; i1 < x2 + 3; ++i1) + { + for (int j1 = y2 - 1; j1 < y2 + 3; ++j1) + WorldGen.TileFrame(i1, j1, 0); + } + WorldGen.tileFrameRecursion = flag; + } + + public static void Check2x2(int i, int j, int type) + { + if (WorldGen.destroyObject) + return; + int num1 = 0; + int num2 = -((int) Main.tile[i, j].frameX / 18); + int num3 = -((int) Main.tile[i, j].frameY / 18); + if (num2 < -1) + { + num2 += 2; + num1 = 36; + } + int num4 = num2 + i; + int y2 = num3 + j; + for (int index1 = num4; index1 < num4 + 2; ++index1) + { + for (int index2 = y2; index2 < y2 + 2; ++index2) + { + if ((int) Main.tile[index1, index2].active == 0 || (int) Main.tile[index1, index2].type != type || ((int) Main.tile[index1, index2].frameX != (index1 - num4) * 18 + num1 || (int) Main.tile[index1, index2].frameY != (index2 - y2) * 18)) + { + WorldGen.Destroy2x2(i, j, num4, y2, type); + return; + } + } + if (type == 95 || type == 126) + { + if ((int) Main.tile[index1, y2 - 1].active == 0 || !Main.tileSolidNotSolidTop[(int) Main.tile[index1, y2 - 1].type]) + { + WorldGen.Destroy2x2(i, j, num4, y2, type); + return; + } + } + else if (type != 138 && ((int) Main.tile[index1, y2 + 2].active == 0 || !Main.tileSolid[(int) Main.tile[index1, y2 + 2].type] && !Main.tileTable[(int) Main.tile[index1, y2 + 2].type])) + { + WorldGen.Destroy2x2(i, j, num4, y2, type); + return; + } + } + if (type != 138 || WorldGen.SolidTileUnsafe(num4, y2 + 2) || WorldGen.SolidTileUnsafe(num4 + 1, y2 + 2)) + return; + WorldGen.Destroy2x2(i, j, num4, y2, type); + } + + public static void OreRunner(int i, int j, double strength, int steps, int type) + { + Vector2 vector2_1 = new Vector2(); + Vector2 vector2_2 = new Vector2(); + double num1 = strength; + float num2 = (float) steps; + vector2_1.X = (float) i; + vector2_1.Y = (float) j; + vector2_2.X = (float) WorldGen.genRand.Next(-10, 11) * 0.1f; + vector2_2.Y = (float) WorldGen.genRand.Next(-10, 11) * 0.1f; + while (num1 > 0.0 && (double) num2 > 0.0) + { + if ((double) vector2_1.Y < 0.0 && (double) num2 > 0.0 && type == 59) + num2 = 0.0f; + num1 = strength * ((double) num2 / (double) steps); + --num2; + int num3 = (int) ((double) vector2_1.X - num1 * 0.5); + int num4 = (int) ((double) vector2_1.X + num1 * 0.5); + int num5 = (int) ((double) vector2_1.Y - num1 * 0.5); + int num6 = (int) ((double) vector2_1.Y + num1 * 0.5); + if (num3 < 0) + num3 = 0; + if (num4 > (int) Main.maxTilesX) + num4 = (int) Main.maxTilesX; + if (num5 < 0) + num5 = 0; + if (num6 > (int) Main.maxTilesY) + num6 = (int) Main.maxTilesY; + for (int index1 = num3; index1 < num4; ++index1) + { + for (int index2 = num5; index2 < num6; ++index2) + { + if ((double) Math.Abs((float) index1 - vector2_1.X) + (double) Math.Abs((float) index2 - vector2_1.Y) < strength * 0.5 * (1.0 + (double) WorldGen.genRand.Next(-10, 11) * 0.0149999996647239) && (int) Main.tile[index1, index2].active != 0 && ((int) Main.tile[index1, index2].type == 0 || (int) Main.tile[index1, index2].type == 1 || ((int) Main.tile[index1, index2].type == 23 || (int) Main.tile[index1, index2].type == 25) || ((int) Main.tile[index1, index2].type == 40 || (int) Main.tile[index1, index2].type == 53 || ((int) Main.tile[index1, index2].type == 57 || (int) Main.tile[index1, index2].type == 59)) || ((int) Main.tile[index1, index2].type == 60 || (int) Main.tile[index1, index2].type == 70 || ((int) Main.tile[index1, index2].type == 109 || (int) Main.tile[index1, index2].type == 112) || ((int) Main.tile[index1, index2].type == 116 || (int) Main.tile[index1, index2].type == 117)))) + { + Main.tile[index1, index2].type = (byte) type; + WorldGen.SquareTileFrame(index1, index2, -1); + if (Main.netMode == 2) + NetMessage.SendTile(index1, index2); + } + } + } + vector2_1.X += vector2_2.X; + vector2_1.Y += vector2_2.Y; + vector2_2.X += (float) WorldGen.genRand.Next(-10, 11) * 0.05f; + if ((double) vector2_2.X > 1.0) + vector2_2.X = 1f; + else if ((double) vector2_2.X < -1.0) + vector2_2.X = -1f; + } + } + + public static void SmashAltar(int i, int j) + { + if (!Main.hardMode || Main.netMode == 1) + return; + int num1 = WorldGen.altarCount % 3; + NetMessage.SendText(12 + num1, 50, (int) byte.MaxValue, 130, -1); + int num2 = WorldGen.altarCount / 3 + 1; + float num3 = (float) Main.maxTilesX * 0.0002380952f; + int num4 = 1 - num1; + float num5 = (num3 * 310f - (float) (85 * num1)) * 0.85f / (float) num2; + int type; + if (num1 == 0) + { + type = 107; + num5 *= 1.05f; + } + else + type = num1 != 1 ? 111 : 108; + for (int index = 0; (double) index < (double) num5; ++index) + { + int i1 = WorldGen.genRand.Next(100, (int) Main.maxTilesX - 100); + int lowerBound = Main.worldSurface; + if (type == 108) + lowerBound = Main.rockLayer; + else if (type == 111) + lowerBound = (Main.rockLayer + Main.rockLayer + (int) Main.maxTilesY) / 3; + int j1 = WorldGen.genRand.Next(lowerBound, (int) Main.maxTilesY - 150); + WorldGen.OreRunner(i1, j1, (double) WorldGen.genRand.Next(5, 9 + num4), WorldGen.genRand.Next(5, 9 + num4), type); + } + int num6 = WorldGen.genRand.Next(3); + while (num6 != 2) + { + int tileX = WorldGen.genRand.Next(100, (int) Main.maxTilesX - 100); + int tileY = WorldGen.genRand.Next(Main.rockLayer + 50, (int) Main.maxTilesY - 300); + if ((int) Main.tile[tileX, tileY].active != 0 && (int) Main.tile[tileX, tileY].type == 1) + { + if (num6 == 0) + Main.tile[tileX, tileY].type = (byte) 25; + else + Main.tile[tileX, tileY].type = (byte) 117; + if (Main.netMode == 2) + { + NetMessage.SendTile(tileX, tileY); + break; + } + else + break; + } + } + if (Main.netMode != 1) + { + int num7 = Main.rand.Next(2) + 1; + Rectangle rect = new Rectangle(); + rect.X = i << 4; + rect.Y = j << 4; + rect.Width = rect.Height = 16; + for (int index = 0; index < num7; ++index) + NPC.SpawnOnPlayer(Player.FindClosest(ref rect), 82); + } + ++WorldGen.altarCount; + } + + public static void Check3x2(int i, int j, int type) + { + if (WorldGen.destroyObject) + return; + int num1 = i; + int num2 = j; + int i1 = num1 - (int) Main.tile[i, j].frameX / 18; + int j1 = num2 - (int) Main.tile[i, j].frameY / 18; + for (int index1 = i1; index1 < i1 + 3; ++index1) + { + if ((int) Main.tile[index1, j1 + 2].active != 0 && Main.tileSolid[(int) Main.tile[index1, j1 + 2].type]) + { + for (int index2 = j1; index2 < j1 + 2; ++index2) + { + if ((int) Main.tile[index1, index2].active == 0 || (int) Main.tile[index1, index2].type != type || ((int) Main.tile[index1, index2].frameX != (index1 - i1) * 18 || (int) Main.tile[index1, index2].frameY != (index2 - j1) * 18)) + goto label_10; + } + continue; + } +label_10: + WorldGen.destroyObject = true; + for (int i2 = i1; i2 < i1 + 3; ++i2) + { + for (int j2 = j1; j2 < j1 + 3; ++j2) + { + if ((int) Main.tile[i2, j2].type == type && (int) Main.tile[i2, j2].active != 0) + WorldGen.KillTile(i2, j2); + } + } + if (!WorldGen.gen) + { + if (type == 14) + Item.NewItem(i * 16, j * 16, 32, 32, 32, 1, false, 0); + else if (type == 114) + Item.NewItem(i * 16, j * 16, 32, 32, 398, 1, false, 0); + else if (type == 26) + WorldGen.SmashAltar(i, j); + else if (type == 17) + Item.NewItem(i * 16, j * 16, 32, 32, 33, 1, false, 0); + else if (type == 77) + Item.NewItem(i * 16, j * 16, 32, 32, 221, 1, false, 0); + else if (type == 86) + Item.NewItem(i * 16, j * 16, 32, 32, 332, 1, false, 0); + else if (type == 87) + Item.NewItem(i * 16, j * 16, 32, 32, 333, 1, false, 0); + else if (type == 88) + Item.NewItem(i * 16, j * 16, 32, 32, 334, 1, false, 0); + else if (type == 89) + Item.NewItem(i * 16, j * 16, 32, 32, 335, 1, false, 0); + else if (type == 133) + Item.NewItem(i * 16, j * 16, 32, 32, 524, 1, false, 0); + } + WorldGen.destroyObject = false; + bool flag = WorldGen.tileFrameRecursion; + WorldGen.tileFrameRecursion = false; + WorldGen.TileFrame(i1 - 1, j1 - 1, 0); + WorldGen.TileFrame(i1, j1 - 1, 0); + WorldGen.TileFrame(i1 + 1, j1 - 1, 0); + WorldGen.TileFrame(i1 + 2, j1 - 1, 0); + WorldGen.TileFrame(i1 - 1, j1, 0); + WorldGen.TileFrame(i1, j1, 0); + WorldGen.TileFrame(i1 + 1, j1, 0); + WorldGen.TileFrame(i1 + 2, j1, 0); + WorldGen.TileFrame(i1 - 1, j1 + 1, 0); + WorldGen.TileFrame(i1, j1 + 1, 0); + WorldGen.TileFrame(i1 + 1, j1 + 1, 0); + WorldGen.TileFrame(i1 + 2, j1 + 1, 0); + WorldGen.TileFrame(i1 - 1, j1 + 2, 0); + WorldGen.TileFrame(i1, j1 + 2, 0); + WorldGen.TileFrame(i1 + 1, j1 + 2, 0); + WorldGen.TileFrame(i1 + 2, j1 + 2, 0); + WorldGen.TileFrame(i1 - 1, j1 + 3, 0); + WorldGen.TileFrame(i1, j1 + 3, 0); + WorldGen.TileFrame(i1 + 1, j1 + 3, 0); + WorldGen.TileFrame(i1 + 2, j1 + 3, 0); + WorldGen.tileFrameRecursion = flag; + break; + } + } + + public static void Check3x4(int i, int j, int type) + { + if (WorldGen.destroyObject) + return; + int num1 = i; + int num2 = j; + int num3 = num1 - (int) Main.tile[i, j].frameX / 18; + int num4 = num2 - (int) Main.tile[i, j].frameY / 18; + for (int index1 = num3; index1 < num3 + 3; ++index1) + { + for (int index2 = num4; index2 < num4 + 4; ++index2) + { + if ((int) Main.tile[index1, index2].active == 0 || (int) Main.tile[index1, index2].type != type || ((int) Main.tile[index1, index2].frameX != (index1 - num3) * 18 || (int) Main.tile[index1, index2].frameY != (index2 - num4) * 18)) + goto label_10; + } + if ((int) Main.tile[index1, num4 + 4].active != 0 && Main.tileSolid[(int) Main.tile[index1, num4 + 4].type]) + continue; +label_10: + WorldGen.destroyObject = true; + for (int i1 = num3; i1 < num3 + 3; ++i1) + { + for (int j1 = num4; j1 < num4 + 4; ++j1) + { + if ((int) Main.tile[i1, j1].type == type && (int) Main.tile[i1, j1].active != 0) + WorldGen.KillTile(i1, j1); + } + } + if (!WorldGen.gen) + { + if (type == 101) + Item.NewItem(i * 16, j * 16, 32, 32, 354, 1, false, 0); + else if (type == 102) + Item.NewItem(i * 16, j * 16, 32, 32, 355, 1, false, 0); + } + WorldGen.destroyObject = false; + bool flag = WorldGen.tileFrameRecursion; + WorldGen.tileFrameRecursion = false; + for (int i1 = num3 - 1; i1 < num3 + 4; ++i1) + { + for (int j1 = num4 - 1; j1 < num4 + 4; ++j1) + WorldGen.TileFrame(i1, j1, 0); + } + WorldGen.tileFrameRecursion = flag; + break; + } + } + + public static bool Place4x2(int x, int y, int type, int direction = -1) + { + if (x < 5 || x > (int) Main.maxTilesX - 5 || (y < 5 || y > (int) Main.maxTilesY - 5)) + return false; + for (int index1 = x - 1; index1 < x + 3; ++index1) + { + if ((int) Main.tile[index1, y + 1].active == 0 || !Main.tileSolid[(int) Main.tile[index1, y + 1].type]) + return false; + for (int index2 = y - 1; index2 < y + 1; ++index2) + { + if ((int) Main.tile[index1, index2].active != 0) + return false; + } + } + int num = direction == 1 ? 72 : 0; + Main.tile[x - 1, y - 1].active = (byte) 1; + Main.tile[x - 1, y - 1].frameY = (short) 0; + Main.tile[x - 1, y - 1].frameX = (short) num; + Main.tile[x - 1, y - 1].type = (byte) type; + Main.tile[x, y - 1].active = (byte) 1; + Main.tile[x, y - 1].frameY = (short) 0; + Main.tile[x, y - 1].frameX = (short) (18 + num); + Main.tile[x, y - 1].type = (byte) type; + Main.tile[x + 1, y - 1].active = (byte) 1; + Main.tile[x + 1, y - 1].frameY = (short) 0; + Main.tile[x + 1, y - 1].frameX = (short) (36 + num); + Main.tile[x + 1, y - 1].type = (byte) type; + Main.tile[x + 2, y - 1].active = (byte) 1; + Main.tile[x + 2, y - 1].frameY = (short) 0; + Main.tile[x + 2, y - 1].frameX = (short) (54 + num); + Main.tile[x + 2, y - 1].type = (byte) type; + Main.tile[x - 1, y].active = (byte) 1; + Main.tile[x - 1, y].frameY = (short) 18; + Main.tile[x - 1, y].frameX = (short) num; + Main.tile[x - 1, y].type = (byte) type; + Main.tile[x, y].active = (byte) 1; + Main.tile[x, y].frameY = (short) 18; + Main.tile[x, y].frameX = (short) (18 + num); + Main.tile[x, y].type = (byte) type; + Main.tile[x + 1, y].active = (byte) 1; + Main.tile[x + 1, y].frameY = (short) 18; + Main.tile[x + 1, y].frameX = (short) (36 + num); + Main.tile[x + 1, y].type = (byte) type; + Main.tile[x + 2, y].active = (byte) 1; + Main.tile[x + 2, y].frameY = (short) 18; + Main.tile[x + 2, y].frameX = (short) (54 + num); + Main.tile[x + 2, y].type = (byte) type; + return true; + } + + public static void SwitchMB(int i, int j) + { + int num1 = (int) Main.tile[i, j].frameY / 18 & 1; + int num2 = (int) Main.tile[i, j].frameX / 18; + if (num2 >= 2) + num2 -= 2; + int tileX = i - num2; + int tileY = j - num1; + for (int index1 = tileX; index1 < tileX + 2; ++index1) + { + for (int index2 = tileY; index2 < tileY + 2; ++index2) + { + if ((int) Main.tile[index1, index2].active != 0 && (int) Main.tile[index1, index2].type == 139) + { + if ((int) Main.tile[index1, index2].frameX < 36) + Main.tile[index1, index2].frameX += (short) 36; + else + Main.tile[index1, index2].frameX -= (short) 36; + WorldGen.noWire[WorldGen.numNoWire].X = (short) index1; + WorldGen.noWire[WorldGen.numNoWire].Y = (short) index2; + ++WorldGen.numNoWire; + } + } + } + NetMessage.SendTileSquare(tileX, tileY, 3); + } + + public static void CheckMusicBox(int i, int j) + { + if (WorldGen.destroyObject) + return; + int num1 = (int) Main.tile[i, j].frameY / 18; + int num2 = num1 >> 1; + int num3 = num1 & 1; + int num4 = (int) Main.tile[i, j].frameX / 18; + int num5 = 0; + if (num4 >= 2) + { + num4 -= 2; + ++num5; + } + int num6 = i - num4; + int num7 = j - num3; + for (int index1 = num6; index1 < num6 + 2; ++index1) + { + for (int index2 = num7; index2 < num7 + 2; ++index2) + { + if ((int) Main.tile[index1, index2].active == 0 || (int) Main.tile[index1, index2].type != 139 || ((int) Main.tile[index1, index2].frameX != (index1 - num6) * 18 + num5 * 36 || (int) Main.tile[index1, index2].frameY != (index2 - num7) * 18 + num2 * 36)) + goto label_12; + } + if (Main.tileSolid[(int) Main.tile[index1, num7 + 2].type]) + continue; +label_12: + WorldGen.destroyObject = true; + for (int i1 = num6; i1 < num6 + 2; ++i1) + { + for (int j1 = num7; j1 < num7 + 3; ++j1) + { + if ((int) Main.tile[i1, j1].type == 139 && (int) Main.tile[i1, j1].active != 0) + WorldGen.KillTile(i1, j1); + } + } + Item.NewItem(i * 16, j * 16, 32, 32, 562 + num2, 1, false, 0); + bool flag = WorldGen.tileFrameRecursion; + WorldGen.tileFrameRecursion = false; + for (int i1 = num6 - 1; i1 < num6 + 3; ++i1) + { + for (int j1 = num7 - 1; j1 < num7 + 3; ++j1) + WorldGen.TileFrame(i1, j1, 0); + } + WorldGen.tileFrameRecursion = flag; + WorldGen.destroyObject = false; + break; + } + } + + public static bool PlaceMB(int X, int y, int type, int style) + { + int index1 = X + 1; + if (index1 < 5 || index1 > (int) Main.maxTilesX - 5 || (y < 5 || y > (int) Main.maxTilesY - 5)) + return false; + for (int index2 = index1 - 1; index2 < index1 + 1; ++index2) + { + for (int index3 = y - 1; index3 < y + 1; ++index3) + { + if ((int) Main.tile[index2, index3].active != 0) + return false; + } + if ((int) Main.tile[index2, y + 1].active == 0 || !Main.tileSolid[(int) Main.tile[index2, y + 1].type] && !Main.tileTable[(int) Main.tile[index2, y + 1].type]) + return false; + } + Main.tile[index1 - 1, y - 1].active = (byte) 1; + Main.tile[index1 - 1, y - 1].frameY = (short) (style * 36); + Main.tile[index1 - 1, y - 1].frameX = (short) 0; + Main.tile[index1 - 1, y - 1].type = (byte) type; + Main.tile[index1, y - 1].active = (byte) 1; + Main.tile[index1, y - 1].frameY = (short) (style * 36); + Main.tile[index1, y - 1].frameX = (short) 18; + Main.tile[index1, y - 1].type = (byte) type; + Main.tile[index1 - 1, y].active = (byte) 1; + Main.tile[index1 - 1, y].frameY = (short) (style * 36 + 18); + Main.tile[index1 - 1, y].frameX = (short) 0; + Main.tile[index1 - 1, y].type = (byte) type; + Main.tile[index1, y].active = (byte) 1; + Main.tile[index1, y].frameY = (short) (style * 36 + 18); + Main.tile[index1, y].frameX = (short) 18; + Main.tile[index1, y].type = (byte) type; + return true; + } + + public static bool Place2x2(int x, int y, int type) + { + if (type == 95 || type == 126) + ++y; + if (x < 5 || x > (int) Main.maxTilesX - 5 || (y < 5 || y > (int) Main.maxTilesY - 5)) + return false; + for (int index1 = x - 1; index1 < x + 1; ++index1) + { + if (type == 95 || type == 126) + { + if ((int) Main.tile[index1, y - 2].active == 0 || !Main.tileSolidNotSolidTop[(int) Main.tile[index1, y - 2].type]) + return false; + } + else if ((int) Main.tile[index1, y + 1].active == 0 || !Main.tileSolid[(int) Main.tile[index1, y + 1].type] && !Main.tileTable[(int) Main.tile[index1, y + 1].type]) + return false; + for (int index2 = y - 1; index2 < y + 1; ++index2) + { + if ((int) Main.tile[index1, index2].active != 0 || type == 98 && (int) Main.tile[index1, index2].liquid > 0) + return false; + } + } + Main.tile[x - 1, y - 1].active = (byte) 1; + Main.tile[x - 1, y - 1].frameY = (short) 0; + Main.tile[x - 1, y - 1].frameX = (short) 0; + Main.tile[x - 1, y - 1].type = (byte) type; + Main.tile[x, y - 1].active = (byte) 1; + Main.tile[x, y - 1].frameY = (short) 0; + Main.tile[x, y - 1].frameX = (short) 18; + Main.tile[x, y - 1].type = (byte) type; + Main.tile[x - 1, y].active = (byte) 1; + Main.tile[x - 1, y].frameY = (short) 18; + Main.tile[x - 1, y].frameX = (short) 0; + Main.tile[x - 1, y].type = (byte) type; + Main.tile[x, y].active = (byte) 1; + Main.tile[x, y].frameY = (short) 18; + Main.tile[x, y].frameX = (short) 18; + Main.tile[x, y].type = (byte) type; + return true; + } + + public static bool Place3x4(int x, int y, int type) + { + if (x < 5 || x > (int) Main.maxTilesX - 5 || (y < 5 || y > (int) Main.maxTilesY - 5)) + return false; + for (int index1 = x - 1; index1 < x + 2; ++index1) + { + if ((int) Main.tile[index1, y + 1].active == 0 || !Main.tileSolid[(int) Main.tile[index1, y + 1].type]) + return false; + for (int index2 = y - 3; index2 < y + 1; ++index2) + { + if ((int) Main.tile[index1, index2].active != 0) + return false; + } + } + for (int index = -3; index <= 0; ++index) + { + short num = (short) ((3 + index) * 18); + Main.tile[x - 1, y + index].active = (byte) 1; + Main.tile[x - 1, y + index].frameY = num; + Main.tile[x - 1, y + index].frameX = (short) 0; + Main.tile[x - 1, y + index].type = (byte) type; + Main.tile[x, y + index].active = (byte) 1; + Main.tile[x, y + index].frameY = num; + Main.tile[x, y + index].frameX = (short) 18; + Main.tile[x, y + index].type = (byte) type; + Main.tile[x + 1, y + index].active = (byte) 1; + Main.tile[x + 1, y + index].frameY = num; + Main.tile[x + 1, y + index].frameX = (short) 36; + Main.tile[x + 1, y + index].type = (byte) type; + } + return true; + } + + public static bool Place3x2(int x, int y, int type) + { + if (x < 5 || x > (int) Main.maxTilesX - 5 || (y < 5 || y > (int) Main.maxTilesY - 5)) + return false; + for (int index1 = x - 1; index1 < x + 2; ++index1) + { + for (int index2 = y - 1; index2 < y + 1; ++index2) + { + if ((int) Main.tile[index1, index2].active != 0) + return false; + } + if ((int) Main.tile[index1, y + 1].active == 0 || !Main.tileSolid[(int) Main.tile[index1, y + 1].type]) + return false; + } + Main.tile[x - 1, y - 1].active = (byte) 1; + Main.tile[x - 1, y - 1].frameY = (short) 0; + Main.tile[x - 1, y - 1].frameX = (short) 0; + Main.tile[x - 1, y - 1].type = (byte) type; + Main.tile[x, y - 1].active = (byte) 1; + Main.tile[x, y - 1].frameY = (short) 0; + Main.tile[x, y - 1].frameX = (short) 18; + Main.tile[x, y - 1].type = (byte) type; + Main.tile[x + 1, y - 1].active = (byte) 1; + Main.tile[x + 1, y - 1].frameY = (short) 0; + Main.tile[x + 1, y - 1].frameX = (short) 36; + Main.tile[x + 1, y - 1].type = (byte) type; + Main.tile[x - 1, y].active = (byte) 1; + Main.tile[x - 1, y].frameY = (short) 18; + Main.tile[x - 1, y].frameX = (short) 0; + Main.tile[x - 1, y].type = (byte) type; + Main.tile[x, y].active = (byte) 1; + Main.tile[x, y].frameY = (short) 18; + Main.tile[x, y].frameX = (short) 18; + Main.tile[x, y].type = (byte) type; + Main.tile[x + 1, y].active = (byte) 1; + Main.tile[x + 1, y].frameY = (short) 18; + Main.tile[x + 1, y].frameX = (short) 36; + Main.tile[x + 1, y].type = (byte) type; + return true; + } + + public static void Check3x3(int i, int j, int type) + { + if (WorldGen.destroyObject) + return; + int num1 = j; + int num2 = (int) Main.tile[i, j].frameX / 18; + int num3 = i - num2; + if (num2 >= 3) + num2 -= 3; + int num4 = i - num2; + int num5 = num1 + (int) Main.tile[i, j].frameY / 18 * -1; + for (int index1 = num4; index1 < num4 + 3; ++index1) + { + for (int index2 = num5; index2 < num5 + 3; ++index2) + { + if ((int) Main.tile[index1, index2].active == 0 || (int) Main.tile[index1, index2].type != type || ((int) Main.tile[index1, index2].frameX != (index1 - num3) * 18 || (int) Main.tile[index1, index2].frameY != (index2 - num5) * 18)) + goto label_18; + } + } + if (type == 106) + { + for (int index = num4; index < num4 + 3; ++index) + { + if ((int) Main.tile[index, num5 + 3].active == 0 || !Main.tileSolid[(int) Main.tile[index, num5 + 3].type]) + goto label_18; + } + return; + } + else if ((int) Main.tile[num4 + 1, num5 - 1].active != 0 && Main.tileSolidNotSolidTop[(int) Main.tile[num4 + 1, num5 - 1].type]) + return; +label_18: + WorldGen.destroyObject = true; + for (int i1 = num4; i1 < num4 + 3; ++i1) + { + for (int j1 = num5; j1 < num5 + 3; ++j1) + { + if ((int) Main.tile[i1, j1].type == type && (int) Main.tile[i1, j1].active != 0) + WorldGen.KillTile(i1, j1); + } + } + if (type == 34) + Item.NewItem(i * 16, j * 16, 32, 32, 106, 1, false, 0); + else if (type == 35) + Item.NewItem(i * 16, j * 16, 32, 32, 107, 1, false, 0); + else if (type == 36) + Item.NewItem(i * 16, j * 16, 32, 32, 108, 1, false, 0); + else if (type == 106) + Item.NewItem(i * 16, j * 16, 32, 32, 363, 1, false, 0); + WorldGen.destroyObject = false; + bool flag = WorldGen.tileFrameRecursion; + WorldGen.tileFrameRecursion = false; + for (int i1 = num4 - 1; i1 < num4 + 4; ++i1) + { + for (int j1 = num5 - 1; j1 < num5 + 4; ++j1) + WorldGen.TileFrame(i1, j1, 0); + } + WorldGen.tileFrameRecursion = flag; + } + + public static bool Place3x3(int x, int y, int type) + { + int num = 0; + if (type == 106) + { + num = -2; + for (int index1 = x - 1; index1 < x + 2; ++index1) + { + for (int index2 = y - 2; index2 < y + 1; ++index2) + { + if ((int) Main.tile[index1, index2].active != 0) + return false; + } + } + for (int index = x - 1; index < x + 2; ++index) + { + if ((int) Main.tile[index, y + 1].active == 0 || !Main.tileSolid[(int) Main.tile[index, y + 1].type]) + return false; + } + } + else + { + for (int index1 = x - 1; index1 < x + 2; ++index1) + { + for (int index2 = y; index2 < y + 3; ++index2) + { + if ((int) Main.tile[index1, index2].active != 0) + return false; + } + } + if ((int) Main.tile[x, y - 1].active == 0 || !Main.tileSolidNotSolidTop[(int) Main.tile[x, y - 1].type]) + return false; + } + Main.tile[x - 1, y + num].active = (byte) 1; + Main.tile[x - 1, y + num].frameY = (short) 0; + Main.tile[x - 1, y + num].frameX = (short) 0; + Main.tile[x - 1, y + num].type = (byte) type; + Main.tile[x, y + num].active = (byte) 1; + Main.tile[x, y + num].frameY = (short) 0; + Main.tile[x, y + num].frameX = (short) 18; + Main.tile[x, y + num].type = (byte) type; + Main.tile[x + 1, y + num].active = (byte) 1; + Main.tile[x + 1, y + num].frameY = (short) 0; + Main.tile[x + 1, y + num].frameX = (short) 36; + Main.tile[x + 1, y + num].type = (byte) type; + Main.tile[x - 1, y + 1 + num].active = (byte) 1; + Main.tile[x - 1, y + 1 + num].frameY = (short) 18; + Main.tile[x - 1, y + 1 + num].frameX = (short) 0; + Main.tile[x - 1, y + 1 + num].type = (byte) type; + Main.tile[x, y + 1 + num].active = (byte) 1; + Main.tile[x, y + 1 + num].frameY = (short) 18; + Main.tile[x, y + 1 + num].frameX = (short) 18; + Main.tile[x, y + 1 + num].type = (byte) type; + Main.tile[x + 1, y + 1 + num].active = (byte) 1; + Main.tile[x + 1, y + 1 + num].frameY = (short) 18; + Main.tile[x + 1, y + 1 + num].frameX = (short) 36; + Main.tile[x + 1, y + 1 + num].type = (byte) type; + Main.tile[x - 1, y + 2 + num].active = (byte) 1; + Main.tile[x - 1, y + 2 + num].frameY = (short) 36; + Main.tile[x - 1, y + 2 + num].frameX = (short) 0; + Main.tile[x - 1, y + 2 + num].type = (byte) type; + Main.tile[x, y + 2 + num].active = (byte) 1; + Main.tile[x, y + 2 + num].frameY = (short) 36; + Main.tile[x, y + 2 + num].frameX = (short) 18; + Main.tile[x, y + 2 + num].type = (byte) type; + Main.tile[x + 1, y + 2 + num].active = (byte) 1; + Main.tile[x + 1, y + 2 + num].frameY = (short) 36; + Main.tile[x + 1, y + 2 + num].frameX = (short) 36; + Main.tile[x + 1, y + 2 + num].type = (byte) type; + return true; + } + + public static bool PlaceSunflower(int x, int y) + { + if (y > Main.worldSurface - 1) + return false; + for (int index1 = x; index1 < x + 2; ++index1) + { + for (int index2 = y - 3; index2 < y + 1; ++index2) + { + if ((int) Main.tile[index1, index2].active != 0 || (int) Main.tile[index1, index2].wall > 0) + return false; + } + if ((int) Main.tile[index1, y + 1].active == 0 || (int) Main.tile[index1, y + 1].type != 2 && (int) Main.tile[index1, y + 1].type != 109) + return false; + } + for (int index1 = 0; index1 < 2; ++index1) + { + for (int index2 = -3; index2 < 1; ++index2) + { + int num1 = index1 * 18 + WorldGen.genRand.Next(3) * 36; + int num2 = (index2 + 3) * 18; + Main.tile[x + index1, y + index2].active = (byte) 1; + Main.tile[x + index1, y + index2].frameX = (short) num1; + Main.tile[x + index1, y + index2].frameY = (short) num2; + Main.tile[x + index1, y + index2].type = (byte) 27; + } + } + return true; + } + + public static void CheckSunflower(int i, int j) + { + if (WorldGen.destroyObject) + return; + int num1 = 0; + int num2 = j; + int num3 = num1 + (int) Main.tile[i, j].frameX / 18; + int num4 = num2 - (int) Main.tile[i, j].frameY / 18; + int num5 = -(num3 & 1) + i; + for (int index1 = num5; index1 < num5 + 2; ++index1) + { + for (int index2 = num4; index2 < num4 + 4; ++index2) + { + int num6 = (int) Main.tile[index1, index2].frameX / 18 & 1; + if ((int) Main.tile[index1, index2].active == 0 || (int) Main.tile[index1, index2].type != 27 || (num6 != index1 - num5 || (int) Main.tile[index1, index2].frameY != (index2 - num4) * 18)) + goto label_10; + } + if ((int) Main.tile[index1, num4 + 4].active != 0 && ((int) Main.tile[index1, num4 + 4].type == 2 || (int) Main.tile[index1, num4 + 4].type == 109)) + continue; +label_10: + WorldGen.destroyObject = true; + for (int i1 = num5; i1 < num5 + 2; ++i1) + { + for (int j1 = num4; j1 < num4 + 4; ++j1) + { + if ((int) Main.tile[i1, j1].type == 27 && (int) Main.tile[i1, j1].active != 0) + WorldGen.KillTile(i1, j1); + } + } + Item.NewItem(i * 16, j * 16, 32, 32, 63, 1, false, 0); + WorldGen.destroyObject = false; + break; + } + } + + public static bool PlacePot(int x, int y) + { + for (int index1 = x; index1 < x + 2; ++index1) + { + for (int index2 = y - 1; index2 < y + 1; ++index2) + { + if ((int) Main.tile[index1, index2].active != 0) + return false; + } + if ((int) Main.tile[index1, y + 1].active == 0 || !Main.tileSolid[(int) Main.tile[index1, y + 1].type]) + return false; + } + for (int index1 = 0; index1 < 2; ++index1) + { + for (int index2 = -1; index2 < 1; ++index2) + { + Main.tile[x + index1, y + index2].active = (byte) 1; + Main.tile[x + index1, y + index2].frameX = (short) (index1 * 18 + WorldGen.genRand.Next(3) * 36); + Main.tile[x + index1, y + index2].frameY = (short) ((index2 + 1) * 18); + Main.tile[x + index1, y + index2].type = (byte) 28; + } + } + return true; + } + + public static bool CheckCactus(int i, int j) + { + int index1 = j; + int index2 = i; + while ((int) Main.tile[index2, index1].active != 0 && (int) Main.tile[index2, index1].type == 80) + { + ++index1; + if ((int) Main.tile[index2, index1].active == 0 || (int) Main.tile[index2, index1].type != 80) + { + if ((int) Main.tile[index2 - 1, index1].active != 0 && (int) Main.tile[index2 - 1, index1].type == 80 && ((int) Main.tile[index2 - 1, index1 - 1].active != 0 && (int) Main.tile[index2 - 1, index1 - 1].type == 80) && index2 >= i) + --index2; + if ((int) Main.tile[index2 + 1, index1].active != 0 && (int) Main.tile[index2 + 1, index1].type == 80 && ((int) Main.tile[index2 + 1, index1 - 1].active != 0 && (int) Main.tile[index2 + 1, index1 - 1].type == 80) && index2 <= i) + ++index2; + } + } + if ((int) Main.tile[index2, index1].active == 0 || (int) Main.tile[index2, index1].type != 53 && (int) Main.tile[index2, index1].type != 112 && (int) Main.tile[index2, index1].type != 116) + { + WorldGen.KillTile(i, j); + return true; + } + else + { + if (i != index2) + { + if (((int) Main.tile[i, j + 1].active == 0 || (int) Main.tile[i, j + 1].type != 80) && ((int) Main.tile[i - 1, j].active == 0 || (int) Main.tile[i - 1, j].type != 80) && ((int) Main.tile[i + 1, j].active == 0 || (int) Main.tile[i + 1, j].type != 80)) + { + WorldGen.KillTile(i, j); + return true; + } + } + else if (i == index2 && ((int) Main.tile[i, j + 1].active == 0 || (int) Main.tile[i, j + 1].type != 80 && (int) Main.tile[i, j + 1].type != 53 && ((int) Main.tile[i, j + 1].type != 112 && (int) Main.tile[i, j + 1].type != 116))) + { + WorldGen.KillTile(i, j); + return true; + } + return false; + } + } + + public static void PlantCactus(int i, int j) + { + WorldGen.GrowCactus(i, j); + for (int index = 0; index < 150; ++index) + WorldGen.GrowCactus(WorldGen.genRand.Next(i - 1, i + 2), WorldGen.genRand.Next(j - 10, j + 2)); + } + + public static void CheckOrb(int i, int j, int type) + { + if (WorldGen.destroyObject) + return; + int i1 = (int) Main.tile[i, j].frameX != 0 ? i - 1 : i; + int j1 = (int) Main.tile[i, j].frameY != 0 ? j - 1 : j; + if ((int) Main.tile[i1, j1].active != 0 && (int) Main.tile[i1, j1].type == type && ((int) Main.tile[i1 + 1, j1].active != 0 && (int) Main.tile[i1 + 1, j1].type == type) && ((int) Main.tile[i1, j1 + 1].active != 0 && (int) Main.tile[i1, j1 + 1].type == type && ((int) Main.tile[i1 + 1, j1 + 1].active != 0 && (int) Main.tile[i1 + 1, j1 + 1].type == type))) + return; + WorldGen.destroyObject = true; + if ((int) Main.tile[i1, j1].type == type) + WorldGen.KillTile(i1, j1); + if ((int) Main.tile[i1 + 1, j1].type == type) + WorldGen.KillTile(i1 + 1, j1); + if ((int) Main.tile[i1, j1 + 1].type == type) + WorldGen.KillTile(i1, j1 + 1); + if ((int) Main.tile[i1 + 1, j1 + 1].type == type) + WorldGen.KillTile(i1 + 1, j1 + 1); + if (!WorldGen.gen) + { + Main.PlaySound(13, i * 16, j * 16, 1); + if (Main.netMode != 1) + { + if (type == 12) + Item.NewItem(i1 * 16, j1 * 16, 32, 32, 29, 1, false, 0); + else if (type == 31) + { + if (WorldGen.genRand.Next(2) == 0) + WorldGen.spawnMeteor = true; + int num = Main.rand.Next(5); + if (!WorldGen.shadowOrbSmashed) + num = 0; + if (num == 0) + { + Item.NewItem(i1 * 16, j1 * 16, 32, 32, 96, 1, false, -1); + int Stack = WorldGen.genRand.Next(25, 51); + Item.NewItem(i1 * 16, j1 * 16, 32, 32, 97, Stack, false, 0); + } + else if (num == 1) + Item.NewItem(i1 * 16, j1 * 16, 32, 32, 64, 1, false, -1); + else if (num == 2) + Item.NewItem(i1 * 16, j1 * 16, 32, 32, 162, 1, false, -1); + else if (num == 3) + Item.NewItem(i1 * 16, j1 * 16, 32, 32, 115, 1, false, -1); + else if (num == 4) + Item.NewItem(i1 * 16, j1 * 16, 32, 32, 111, 1, false, -1); + WorldGen.shadowOrbSmashed = true; + ++WorldGen.shadowOrbCount; + if (WorldGen.shadowOrbCount >= 3) + { + WorldGen.shadowOrbCount = 0; + Rectangle rect = new Rectangle(); + rect.X = i1 << 4; + rect.Y = j1 << 4; + rect.Width = rect.Height = 0; + NPC.SpawnOnPlayer(Player.FindClosest(ref rect), 13); + } + else + { + int textId = 10; + if (WorldGen.shadowOrbCount == 2) + textId = 11; + NetMessage.SendText(textId, 50, (int) byte.MaxValue, 130, -1); + } + } + } + } + WorldGen.destroyObject = false; + } + + public static void CheckTree(int i, int j) + { + int index1 = -1; + int index2 = -1; + int index3 = -1; + int index4 = -1; + if ((int) Main.tile[i - 1, j].active != 0) + index2 = (int) Main.tile[i - 1, j].type; + if ((int) Main.tile[i + 1, j].active != 0) + index3 = (int) Main.tile[i + 1, j].type; + if ((int) Main.tile[i, j - 1].active != 0) + index1 = (int) Main.tile[i, j - 1].type; + if ((int) Main.tile[i, j + 1].active != 0) + index4 = (int) Main.tile[i, j + 1].type; + if (index2 >= 0 && Main.tileStone[index2]) + index2 = 1; + if (index3 >= 0 && Main.tileStone[index3]) + index3 = 1; + if (index1 >= 0 && Main.tileStone[index1]) + index1 = 1; + if (index4 >= 0 && Main.tileStone[index4]) + index4 = 1; + if (index4 == 23) + index4 = 2; + else if (index4 == 60) + index4 = 2; + else if (index4 == 109) + index4 = 2; + else if (index4 == 147) + index4 = 2; + int num1 = (int) Main.tile[i, j].frameNumber; + int num2 = (int) Main.tile[i, j].type; + int num3; + int num4 = num3 = (int) Main.tile[i, j].frameX; + int num5; + int num6 = num5 = (int) Main.tile[i, j].frameY; + if (num3 >= 22 && num3 <= 44 && (num5 >= 132 && num5 <= 176)) + { + if (index4 != 2) + WorldGen.KillTile(i, j); + else if ((num3 != 22 || index2 != num2) && (num3 != 44 || index3 != num2)) + WorldGen.KillTile(i, j); + } + else if (num3 == 88 && num5 >= 0 && num5 <= 44 || num3 == 66 && num5 >= 66 && num5 <= 130 || (num3 == 110 && num5 >= 66 && num5 <= 110 || num3 == 132 && num5 >= 0 && num5 <= 176)) + { + if (index2 == num2 && index3 == num2) + { + Main.tile[i, j].frameX = (short) 110; + Main.tile[i, j].frameY = (short) (66 + 22 * num1); + } + else if (index2 == num2) + { + Main.tile[i, j].frameX = (short) 88; + Main.tile[i, j].frameY = (short) (22 * num1); + } + else if (index3 == num2) + { + Main.tile[i, j].frameX = (short) 66; + Main.tile[i, j].frameY = (short) (66 + 22 * num1); + } + else + { + Main.tile[i, j].frameX = (short) 0; + Main.tile[i, j].frameY = (short) (22 * num1); + } + } + int num7 = (int) Main.tile[i, j].frameX; + int num8 = (int) Main.tile[i, j].frameY; + if (num8 >= 132 && num8 <= 176) + { + if (num7 == 0 || num7 == 66 || num7 == 88) + { + if (index4 != 2) + WorldGen.KillTile(i, j); + if (index2 != num2 && index3 != num2) + { + Main.tile[i, j].frameX = (short) 0; + Main.tile[i, j].frameY = (short) (22 * num1); + } + else if (index2 != num2) + { + Main.tile[i, j].frameX = (short) 0; + Main.tile[i, j].frameY = (short) (132 + 22 * num1); + } + else if (index3 != num2) + { + Main.tile[i, j].frameX = (short) 66; + Main.tile[i, j].frameY = (short) (132 + 22 * num1); + } + else + { + Main.tile[i, j].frameX = (short) 88; + Main.tile[i, j].frameY = (short) (132 + 22 * num1); + } + } + } + else if (num7 == 66 && (num8 == 0 || num8 == 22 || num8 == 44) || num7 == 44 && (num8 == 198 || num8 == 220 || num8 == 242)) + { + if (index3 != num2) + WorldGen.KillTile(i, j); + } + else if (num7 == 88 && (num8 == 66 || num8 == 88 || num8 == 110) || num7 == 66 && (num8 == 198 || num8 == 220 || num8 == 242)) + { + if (index2 != num2) + WorldGen.KillTile(i, j); + } + else if (index4 == -1 || index4 == 23) + WorldGen.KillTile(i, j); + else if (index1 != num2 && num8 < 198 && (num7 != 22 && num7 != 44 || num8 < 132)) + { + if (index2 == num2 || index3 == num2) + { + if (index4 == num2) + { + if (index2 == num2 && index3 == num2) + { + Main.tile[i, j].frameX = (short) 132; + Main.tile[i, j].frameY = (short) (132 + 22 * num1); + } + else if (index2 == num2) + { + Main.tile[i, j].frameX = (short) 132; + Main.tile[i, j].frameY = (short) (22 * num1); + } + else if (index3 == num2) + { + Main.tile[i, j].frameX = (short) 132; + Main.tile[i, j].frameY = (short) (66 + 22 * num1); + } + } + else if (index2 == num2 && index3 == num2) + { + Main.tile[i, j].frameX = (short) 154; + Main.tile[i, j].frameY = (short) (132 + 22 * num1); + } + else if (index2 == num2) + { + Main.tile[i, j].frameX = (short) 154; + Main.tile[i, j].frameY = (short) (22 * num1); + } + else if (index3 == num2) + { + Main.tile[i, j].frameX = (short) 154; + Main.tile[i, j].frameY = (short) (66 + 22 * num1); + } + } + else + { + Main.tile[i, j].frameX = (short) 110; + Main.tile[i, j].frameY = (short) (22 * num1); + } + } + if (num4 < 0 || num6 < 0 || ((int) Main.tile[i, j].frameX == num4 || (int) Main.tile[i, j].frameY == num6)) + return; + WorldGen.TileFrame(i - 1, j, 0); + WorldGen.TileFrame(i + 1, j, 0); + WorldGen.TileFrame(i, j - 1, 0); + WorldGen.TileFrame(i, j + 1, 0); + } + + public static void CactusFrame(int i, int j) + { + try + { + int index1 = j; + int index2 = i; + if (WorldGen.CheckCactus(i, j)) + return; + while ((int) Main.tile[index2, index1].active != 0 && (int) Main.tile[index2, index1].type == 80) + { + ++index1; + if ((int) Main.tile[index2, index1].active == 0 || (int) Main.tile[index2, index1].type != 80) + { + if ((int) Main.tile[index2 - 1, index1].active != 0 && (int) Main.tile[index2 - 1, index1].type == 80 && ((int) Main.tile[index2 - 1, index1 - 1].active != 0 && (int) Main.tile[index2 - 1, index1 - 1].type == 80) && index2 >= i) + --index2; + if ((int) Main.tile[index2 + 1, index1].active != 0 && (int) Main.tile[index2 + 1, index1].type == 80 && ((int) Main.tile[index2 + 1, index1 - 1].active != 0 && (int) Main.tile[index2 + 1, index1 - 1].type == 80) && index2 <= i) + ++index2; + } + } + int num1 = index1 - 1; + int num2 = i - index2; + num1 = j; + int num3 = (int) Main.tile[i - 2, j].type; + int num4 = (int) Main.tile[i - 1, j].type; + int num5 = (int) Main.tile[i + 1, j].type; + int num6 = (int) Main.tile[i, j - 1].type; + int index3 = (int) Main.tile[i, j + 1].type; + int num7 = (int) Main.tile[i - 1, j + 1].type; + int num8 = (int) Main.tile[i + 1, j + 1].type; + if ((int) Main.tile[i - 1, j].active == 0) + num4 = -1; + if ((int) Main.tile[i + 1, j].active == 0) + num5 = -1; + if ((int) Main.tile[i, j - 1].active == 0) + num6 = -1; + if ((int) Main.tile[i, j + 1].active == 0) + index3 = -1; + if ((int) Main.tile[i - 1, j + 1].active == 0) + num7 = -1; + if ((int) Main.tile[i + 1, j + 1].active == 0) + num8 = -1; + short num9 = Main.tile[i, j].frameX; + short num10 = Main.tile[i, j].frameY; + if (num2 == 0) + { + if (num6 != 80) + { + if (num4 == 80 && num5 == 80 && (num7 != 80 && num8 != 80) && num3 != 80) + { + num9 = (short) 90; + num10 = (short) 0; + } + else if (num4 == 80 && num7 != 80 && num3 != 80) + { + num9 = (short) 72; + num10 = (short) 0; + } + else if (num5 == 80 && num8 != 80) + { + num9 = (short) 18; + num10 = (short) 0; + } + else + { + num9 = (short) 0; + num10 = (short) 0; + } + } + else if (num4 == 80 && num5 == 80 && (num7 != 80 && num8 != 80) && num3 != 80) + { + num9 = (short) 90; + num10 = (short) 36; + } + else if (num4 == 80 && num7 != 80 && num3 != 80) + { + num9 = (short) 72; + num10 = (short) 36; + } + else if (num5 == 80 && num8 != 80) + { + num9 = (short) 18; + num10 = (short) 36; + } + else if (index3 >= 0 && Main.tileSolid[index3]) + { + num9 = (short) 0; + num10 = (short) 36; + } + else + { + num9 = (short) 0; + num10 = (short) 18; + } + } + else if (num2 == -1) + { + if (num5 == 80) + { + if (num6 != 80 && index3 != 80) + { + num9 = (short) 108; + num10 = (short) 36; + } + else if (index3 != 80) + { + num9 = (short) 54; + num10 = (short) 36; + } + else if (num6 != 80) + { + num9 = (short) 54; + num10 = (short) 0; + } + else + { + num9 = (short) 54; + num10 = (short) 18; + } + } + else if (num6 != 80) + { + num9 = (short) 54; + num10 = (short) 0; + } + else + { + num9 = (short) 54; + num10 = (short) 18; + } + } + else if (num2 == 1) + { + if (num4 == 80) + { + if (num6 != 80 && index3 != 80) + { + num9 = (short) 108; + num10 = (short) 16; + } + else if (index3 != 80) + { + num9 = (short) 36; + num10 = (short) 36; + } + else if (num6 != 80) + { + num9 = (short) 36; + num10 = (short) 0; + } + else + { + num9 = (short) 36; + num10 = (short) 18; + } + } + else if (num6 != 80) + { + num9 = (short) 36; + num10 = (short) 0; + } + else + { + num9 = (short) 36; + num10 = (short) 18; + } + } + if ((int) num9 == (int) Main.tile[i, j].frameX && (int) num10 == (int) Main.tile[i, j].frameY) + return; + Main.tile[i, j].frameX = num9; + Main.tile[i, j].frameY = num10; + WorldGen.SquareTileFrame(i, j, -1); + } + catch + { + Main.tile[i, j].frameX = (short) 0; + Main.tile[i, j].frameY = (short) 0; + } + } + + public static void GrowCactus(int i, int j) + { + int index1 = j; + int i1 = i; + if ((int) Main.tile[i, j].active == 0 || (int) Main.tile[i, j - 1].liquid > 0 || (int) Main.tile[i, j].type != 53 && (int) Main.tile[i, j].type != 80 && ((int) Main.tile[i, j].type != 112 && (int) Main.tile[i, j].type != 116)) + return; + if ((int) Main.tile[i, j].type == 53 || (int) Main.tile[i, j].type == 112 || (int) Main.tile[i, j].type == 116) + { + if ((int) Main.tile[i, j - 1].active != 0 || (int) Main.tile[i - 1, j - 1].active != 0 || (int) Main.tile[i + 1, j - 1].active != 0) + return; + int num1 = 0; + int num2 = 0; + for (int index2 = i - 6; index2 <= i + 6; ++index2) + { + for (int index3 = j - 3; index3 <= j + 1; ++index3) + { + try + { + if ((int) Main.tile[index2, index3].active != 0) + { + if ((int) Main.tile[index2, index3].type == 80) + { + ++num1; + if (num1 >= 4) + return; + } + if ((int) Main.tile[index2, index3].type != 53 && (int) Main.tile[index2, index3].type != 112) + { + if ((int) Main.tile[index2, index3].type != 116) + continue; + } + ++num2; + } + } + catch + { + } + } + } + if (num2 <= 10) + return; + Main.tile[i, j - 1].active = (byte) 1; + Main.tile[i, j - 1].type = (byte) 80; + WorldGen.SquareTileFrame(i1, index1 - 1, -1); + if (Main.netMode != 2) + return; + NetMessage.SendTile(i, j - 1); + } + else + { + if ((int) Main.tile[i, j].type != 80) + return; + while ((int) Main.tile[i1, index1].active != 0 && (int) Main.tile[i1, index1].type == 80) + { + ++index1; + if ((int) Main.tile[i1, index1].active == 0 || (int) Main.tile[i1, index1].type != 80) + { + if ((int) Main.tile[i1 - 1, index1].active != 0 && (int) Main.tile[i1 - 1, index1].type == 80 && ((int) Main.tile[i1 - 1, index1 - 1].active != 0 && (int) Main.tile[i1 - 1, index1 - 1].type == 80) && i1 >= i) + --i1; + if ((int) Main.tile[i1 + 1, index1].active != 0 && (int) Main.tile[i1 + 1, index1].type == 80 && ((int) Main.tile[i1 + 1, index1 - 1].active != 0 && (int) Main.tile[i1 + 1, index1 - 1].type == 80) && i1 <= i) + ++i1; + } + } + int num1 = index1 - 1 - j; + int num2 = i - i1; + int num3 = i - num2; + int num4 = j; + int num5 = 11 - num1; + int num6 = 0; + for (int index2 = num3 - 2; index2 <= num3 + 2; ++index2) + { + for (int index3 = num4 - num5; index3 <= num4 + num1; ++index3) + { + if ((int) Main.tile[index2, index3].active != 0 && (int) Main.tile[index2, index3].type == 80) + ++num6; + } + } + if (num6 >= WorldGen.genRand.Next(11, 13)) + return; + int index4 = i; + int index5 = j; + if (num2 == 0) + { + if (num1 == 0) + { + if ((int) Main.tile[index4, index5 - 1].active != 0) + return; + Main.tile[index4, index5 - 1].active = (byte) 1; + Main.tile[index4, index5 - 1].type = (byte) 80; + WorldGen.SquareTileFrame(index4, index5 - 1, -1); + if (Main.netMode != 2) + return; + NetMessage.SendTile(index4, index5 - 1); + } + else + { + bool flag1 = false; + bool flag2 = false; + if ((int) Main.tile[index4, index5 - 1].active != 0 && (int) Main.tile[index4, index5 - 1].type == 80) + { + if ((int) Main.tile[index4 - 1, index5].active == 0 && (int) Main.tile[index4 - 2, index5 + 1].active == 0 && ((int) Main.tile[index4 - 1, index5 - 1].active == 0 && (int) Main.tile[index4 - 1, index5 + 1].active == 0) && (int) Main.tile[index4 - 2, index5].active == 0) + flag1 = true; + if ((int) Main.tile[index4 + 1, index5].active == 0 && (int) Main.tile[index4 + 2, index5 + 1].active == 0 && ((int) Main.tile[index4 + 1, index5 - 1].active == 0 && (int) Main.tile[index4 + 1, index5 + 1].active == 0) && (int) Main.tile[index4 + 2, index5].active == 0) + flag2 = true; + } + int num7 = WorldGen.genRand.Next(3); + if (num7 == 0 && flag1) + { + Main.tile[index4 - 1, index5].active = (byte) 1; + Main.tile[index4 - 1, index5].type = (byte) 80; + WorldGen.SquareTileFrame(index4 - 1, index5, -1); + if (Main.netMode != 2) + return; + NetMessage.SendTile(index4 - 1, index5); + } + else if (num7 == 1 && flag2) + { + Main.tile[index4 + 1, index5].active = (byte) 1; + Main.tile[index4 + 1, index5].type = (byte) 80; + WorldGen.SquareTileFrame(index4 + 1, index5, -1); + if (Main.netMode != 2) + return; + NetMessage.SendTile(index4 + 1, index5); + } + else + { + if (num1 >= WorldGen.genRand.Next(2, 8)) + return; + if ((int) Main.tile[index4 - 1, index5 - 1].active != 0) + { + int num8 = (int) Main.tile[index4 - 1, index5 - 1].type; + } + if ((int) Main.tile[index4 + 1, index5 - 1].active != 0 && (int) Main.tile[index4 + 1, index5 - 1].type == 80 || (int) Main.tile[index4, index5 - 1].active != 0) + return; + Main.tile[index4, index5 - 1].active = (byte) 1; + Main.tile[index4, index5 - 1].type = (byte) 80; + WorldGen.SquareTileFrame(index4, index5 - 1, -1); + if (Main.netMode != 2) + return; + NetMessage.SendTile(index4, index5 - 1); + } + } + } + else + { + if ((int) Main.tile[index4, index5 - 1].active != 0 || (int) Main.tile[index4, index5 - 2].active != 0 || ((int) Main.tile[index4 + num2, index5 - 1].active != 0 || (int) Main.tile[index4 - num2, index5 - 1].active == 0) || (int) Main.tile[index4 - num2, index5 - 1].type != 80) + return; + Main.tile[index4, index5 - 1].active = (byte) 1; + Main.tile[index4, index5 - 1].type = (byte) 80; + WorldGen.SquareTileFrame(index4, index5 - 1, -1); + if (Main.netMode != 2) + return; + NetMessage.SendTile(index4, index5 - 1); + } + } + } + + public static void CheckPot(int i, int j) + { + if (WorldGen.destroyObject) + return; + int num1 = 0; + int num2 = j; + int num3 = num1 + (int) Main.tile[i, j].frameX / 18; + int index1 = num2 - (int) Main.tile[i, j].frameY / 18; + int index2 = -(num3 & 1) + i; + for (int index3 = index2; index3 < index2 + 2; ++index3) + { + for (int index4 = index1; index4 < index1 + 2; ++index4) + { + if (((int) Main.tile[index3, index4].frameX / 18 & 1) != index3 - index2 || (int) Main.tile[index3, index4].active == 0 || ((int) Main.tile[index3, index4].type != 28 || (int) Main.tile[index3, index4].frameY != (index4 - index1) * 18)) + goto label_10; + } + if ((int) Main.tile[index3, index1 + 2].active != 0 && Main.tileSolid[(int) Main.tile[index3, index1 + 2].type]) + continue; +label_10: + WorldGen.destroyObject = true; + for (int i1 = index2; i1 < index2 + 2; ++i1) + { + for (int j1 = index1; j1 < index1 + 2; ++j1) + { + if ((int) Main.tile[i1, j1].type == 28 && (int) Main.tile[i1, j1].active != 0) + WorldGen.KillTile(i1, j1); + } + } + if (!WorldGen.gen) + { + Rectangle rect = new Rectangle(); + rect.X = i << 4; + rect.Y = j << 4; + rect.Width = rect.Height = 16; + Main.PlaySound(13, rect.X, rect.Y, 1); + Gore.NewGore(new Vector2((float) rect.X, (float) rect.Y), new Vector2(), 51, 1.0); + Gore.NewGore(new Vector2((float) rect.X, (float) rect.Y), new Vector2(), 52, 1.0); + Gore.NewGore(new Vector2((float) rect.X, (float) rect.Y), new Vector2(), 53, 1.0); + if (WorldGen.genRand.Next(40) == 0 && ((int) Main.tile[index2, index1].wall == 7 || (int) Main.tile[index2, index1].wall == 8 || (int) Main.tile[index2, index1].wall == 9)) + Item.NewItem(rect.X, rect.Y, 16, 16, 327, 1, false, 0); + else if (WorldGen.genRand.Next(45) == 0) + { + if (j < Main.worldSurface) + { + int num4 = WorldGen.genRand.Next(4); + if (num4 == 0) + Item.NewItem(rect.X, rect.Y, 16, 16, 292, 1, false, 0); + if (num4 == 1) + Item.NewItem(rect.X, rect.Y, 16, 16, 298, 1, false, 0); + if (num4 == 2) + Item.NewItem(rect.X, rect.Y, 16, 16, 299, 1, false, 0); + if (num4 == 3) + Item.NewItem(rect.X, rect.Y, 16, 16, 290, 1, false, 0); + } + else if (j < Main.rockLayer) + { + int num4 = WorldGen.genRand.Next(7); + if (num4 == 0) + Item.NewItem(rect.X, rect.Y, 16, 16, 289, 1, false, 0); + if (num4 == 1) + Item.NewItem(rect.X, rect.Y, 16, 16, 298, 1, false, 0); + if (num4 == 2) + Item.NewItem(rect.X, rect.Y, 16, 16, 299, 1, false, 0); + if (num4 == 3) + Item.NewItem(rect.X, rect.Y, 16, 16, 290, 1, false, 0); + if (num4 == 4) + Item.NewItem(rect.X, rect.Y, 16, 16, 303, 1, false, 0); + if (num4 == 5) + Item.NewItem(rect.X, rect.Y, 16, 16, 291, 1, false, 0); + if (num4 == 6) + Item.NewItem(rect.X, rect.Y, 16, 16, 304, 1, false, 0); + } + else if (j < (int) Main.maxTilesY - 200) + { + int num4 = WorldGen.genRand.Next(10); + if (num4 == 0) + Item.NewItem(rect.X, rect.Y, 16, 16, 296, 1, false, 0); + if (num4 == 1) + Item.NewItem(rect.X, rect.Y, 16, 16, 295, 1, false, 0); + if (num4 == 2) + Item.NewItem(rect.X, rect.Y, 16, 16, 299, 1, false, 0); + if (num4 == 3) + Item.NewItem(rect.X, rect.Y, 16, 16, 302, 1, false, 0); + if (num4 == 4) + Item.NewItem(rect.X, rect.Y, 16, 16, 303, 1, false, 0); + if (num4 == 5) + Item.NewItem(rect.X, rect.Y, 16, 16, 305, 1, false, 0); + if (num4 == 6) + Item.NewItem(rect.X, rect.Y, 16, 16, 301, 1, false, 0); + if (num4 == 7) + Item.NewItem(rect.X, rect.Y, 16, 16, 302, 1, false, 0); + if (num4 == 8) + Item.NewItem(rect.X, rect.Y, 16, 16, 297, 1, false, 0); + if (num4 == 9) + Item.NewItem(rect.X, rect.Y, 16, 16, 304, 1, false, 0); + } + else + { + int num4 = WorldGen.genRand.Next(12); + if (num4 == 0) + Item.NewItem(rect.X, rect.Y, 16, 16, 296, 1, false, 0); + if (num4 == 1) + Item.NewItem(rect.X, rect.Y, 16, 16, 295, 1, false, 0); + if (num4 == 2) + Item.NewItem(rect.X, rect.Y, 16, 16, 293, 1, false, 0); + if (num4 == 3) + Item.NewItem(rect.X, rect.Y, 16, 16, 288, 1, false, 0); + if (num4 == 4) + Item.NewItem(rect.X, rect.Y, 16, 16, 294, 1, false, 0); + if (num4 == 5) + Item.NewItem(rect.X, rect.Y, 16, 16, 297, 1, false, 0); + if (num4 == 6) + Item.NewItem(rect.X, rect.Y, 16, 16, 304, 1, false, 0); + if (num4 == 7) + Item.NewItem(rect.X, rect.Y, 16, 16, 305, 1, false, 0); + if (num4 == 8) + Item.NewItem(rect.X, rect.Y, 16, 16, 301, 1, false, 0); + if (num4 == 9) + Item.NewItem(rect.X, rect.Y, 16, 16, 302, 1, false, 0); + if (num4 == 10) + Item.NewItem(rect.X, rect.Y, 16, 16, 288, 1, false, 0); + if (num4 == 11) + Item.NewItem(rect.X, rect.Y, 16, 16, 300, 1, false, 0); + } + } + else + { + switch (Main.rand.Next(8)) + { + case 0: + Player closest1 = Player.FindClosest(ref rect); + if ((int) closest1.statLife < (int) closest1.statLifeMax) + { + Item.NewItem(rect.X, rect.Y, 16, 16, 58, 1, false, 0); + goto label_156; + } + else + goto label_156; + case 1: + Player closest2 = Player.FindClosest(ref rect); + if ((int) closest2.statMana < (int) closest2.statManaMax) + { + Item.NewItem(rect.X, rect.Y, 16, 16, 184, 1, false, 0); + goto label_156; + } + else + goto label_156; + case 2: + int Stack1 = Main.rand.Next(1, 6); + if ((int) Main.tile[i, j].liquid > 0) + { + Item.NewItem(rect.X, rect.Y, 16, 16, 282, Stack1, false, 0); + goto label_156; + } + else + { + Item.NewItem(rect.X, rect.Y, 16, 16, 8, Stack1, false, 0); + goto label_156; + } + case 3: + int Stack2 = Main.rand.Next(8) + 3; + int Type1 = 40; + if (j < Main.rockLayer && WorldGen.genRand.Next(2) == 0) + Type1 = !Main.hardMode ? 42 : 168; + if (j > (int) Main.maxTilesY - 200) + Type1 = 265; + else if (Main.hardMode) + Type1 = Main.rand.Next(2) != 0 ? 47 : 278; + Item.NewItem(rect.X, rect.Y, 16, 16, Type1, Stack2, false, 0); + goto label_156; + case 4: + int Type2 = 28; + if (j > (int) Main.maxTilesY - 200 || Main.hardMode) + Type2 = 188; + Item.NewItem(rect.X, rect.Y, 16, 16, Type2, 1, false, 0); + goto label_156; + case 5: + if (j > Main.rockLayer) + { + int Stack3 = Main.rand.Next(4) + 1; + Item.NewItem(rect.X, rect.Y, 16, 16, 166, Stack3, false, 0); + goto label_156; + } + else + break; + } + float num4 = (float) (200 + WorldGen.genRand.Next(-100, 101)); + if (j < Main.worldSurface) + num4 *= 0.5f; + else if (j < Main.rockLayer) + num4 *= 0.75f; + else if (j > (int) Main.maxTilesY - 250) + num4 *= 1.25f; + float num5 = num4 * (float) (1.0 + (double) Main.rand.Next(-20, 21) * 0.00999999977648258); + if (Main.rand.Next(5) == 0) + num5 *= (float) (1.0 + (double) Main.rand.Next(5, 11) * 0.00999999977648258); + if (Main.rand.Next(10) == 0) + num5 *= (float) (1.0 + (double) Main.rand.Next(10, 21) * 0.00999999977648258); + if (Main.rand.Next(15) == 0) + num5 *= (float) (1.0 + (double) Main.rand.Next(20, 41) * 0.00999999977648258); + if (Main.rand.Next(20) == 0) + num5 *= (float) (1.0 + (double) Main.rand.Next(40, 81) * 0.00999999977648258); + if (Main.rand.Next(25) == 0) + num5 *= (float) (1.0 + (double) Main.rand.Next(50, 101) * 0.00999999977648258); + while ((int) num5 > 0) + { + if ((double) num5 > 1000000.0) + { + int Stack3 = (int) ((double) num5 / 1000000.0); + if (Stack3 > 50 && Main.rand.Next(2) == 0) + Stack3 /= Main.rand.Next(3) + 1; + if (Main.rand.Next(2) == 0) + Stack3 /= Main.rand.Next(3) + 1; + if (Stack3 > 0) + { + num5 -= (float) (1000000 * Stack3); + Item.NewItem(rect.X, rect.Y, 16, 16, 74, Stack3, false, 0); + } + } + else if ((double) num5 > 10000.0) + { + int Stack3 = (int) ((double) num5 / 10000.0); + if (Stack3 > 50 && Main.rand.Next(2) == 0) + Stack3 /= Main.rand.Next(3) + 1; + if (Main.rand.Next(2) == 0) + Stack3 /= Main.rand.Next(3) + 1; + if (Stack3 > 0) + { + num5 -= (float) (10000 * Stack3); + Item.NewItem(rect.X, rect.Y, 16, 16, 73, Stack3, false, 0); + } + } + else if ((double) num5 > 100.0) + { + int Stack3 = (int) ((double) num5 / 100.0); + if (Stack3 > 50 && Main.rand.Next(2) == 0) + Stack3 /= Main.rand.Next(3) + 1; + if (Main.rand.Next(2) == 0) + Stack3 /= Main.rand.Next(3) + 1; + if (Stack3 > 0) + { + num5 -= (float) (100 * Stack3); + Item.NewItem(rect.X, rect.Y, 16, 16, 72, Stack3, false, 0); + } + } + else + { + int Stack3 = (int) num5; + if (Stack3 > 50 && Main.rand.Next(2) == 0) + Stack3 /= Main.rand.Next(3) + 1; + if (Main.rand.Next(2) == 0) + Stack3 /= Main.rand.Next(4) + 1; + if (Stack3 < 1) + Stack3 = 1; + num5 -= (float) Stack3; + Item.NewItem(rect.X, rect.Y, 16, 16, 71, Stack3, false, 0); + } + } + } + } +label_156: + WorldGen.destroyObject = false; + break; + } + } + + public static int PlaceChest(int x, int y, bool notNearOtherChests = false, int style = 0) + { + for (int index1 = x; index1 < x + 2; ++index1) + { + for (int index2 = y - 1; index2 < y + 1; ++index2) + { + if ((int) Main.tile[index1, index2].active != 0 || (int) Main.tile[index1, index2].lava != 0) + return -1; + } + if ((int) Main.tile[index1, y + 1].active == 0 || !Main.tileSolid[(int) Main.tile[index1, y + 1].type]) + return -1; + } + if (notNearOtherChests) + { + for (int index1 = x - 25; index1 < x + 25; ++index1) + { + for (int index2 = y - 8; index2 < y + 8; ++index2) + { + try + { + if ((int) Main.tile[index1, index2].active != 0) + { + if ((int) Main.tile[index1, index2].type == 21) + return -1; + } + } + catch + { + } + } + } + } + int chest = Chest.CreateChest(x, y - 1); + if (chest != -1) + { + Main.tile[x, y - 1].active = (byte) 1; + Main.tile[x, y - 1].frameY = (short) 0; + Main.tile[x, y - 1].frameX = (short) (36 * style); + Main.tile[x, y - 1].type = (byte) 21; + Main.tile[x + 1, y - 1].active = (byte) 1; + Main.tile[x + 1, y - 1].frameY = (short) 0; + Main.tile[x + 1, y - 1].frameX = (short) (18 + 36 * style); + Main.tile[x + 1, y - 1].type = (byte) 21; + Main.tile[x, y].active = (byte) 1; + Main.tile[x, y].frameY = (short) 18; + Main.tile[x, y].frameX = (short) (36 * style); + Main.tile[x, y].type = (byte) 21; + Main.tile[x + 1, y].active = (byte) 1; + Main.tile[x + 1, y].frameY = (short) 18; + Main.tile[x + 1, y].frameX = (short) (18 + 36 * style); + Main.tile[x + 1, y].type = (byte) 21; + } + return chest; + } + + public static void CheckChest(int i, int j) + { + if (WorldGen.destroyObject) + return; + int num1 = 0; + int num2 = j; + int num3 = num1 + (int) Main.tile[i, j].frameX / 18; + int num4 = num2 - (int) Main.tile[i, j].frameY / 18; + int num5 = -(num3 & 1) + i; + for (int index1 = num5; index1 < num5 + 2; ++index1) + { + for (int index2 = num4; index2 < num4 + 2; ++index2) + { + int num6 = (int) Main.tile[index1, index2].frameX / 18 & 1; + if ((int) Main.tile[index1, index2].active == 0 || (int) Main.tile[index1, index2].type != 21 || (num6 != index1 - num5 || (int) Main.tile[index1, index2].frameY != (index2 - num4) * 18)) + goto label_10; + } + if ((int) Main.tile[index1, num4 + 2].active != 0 && Main.tileSolid[(int) Main.tile[index1, num4 + 2].type]) + continue; +label_10: + int Type = 48; + if ((int) Main.tile[i, j].frameX >= 216) + Type = 348; + else if ((int) Main.tile[i, j].frameX >= 180) + Type = 343; + else if ((int) Main.tile[i, j].frameX >= 108) + Type = 328; + else if ((int) Main.tile[i, j].frameX >= 36) + Type = 306; + WorldGen.destroyObject = true; + for (int index2 = num5; index2 < num5 + 2; ++index2) + { + for (int index3 = num4; index3 < num4 + 3; ++index3) + { + if ((int) Main.tile[index2, index3].type == 21 && (int) Main.tile[index2, index3].active != 0) + { + Chest.DestroyChest(index2, index3); + WorldGen.KillTile(index2, index3); + } + } + } + if (!WorldGen.gen) + Item.NewItem(i * 16, j * 16, 32, 32, Type, 1, false, 0); + WorldGen.destroyObject = false; + break; + } + } + + public static bool PlaceWire(int i, int j) + { + if (Main.tile[i, j].wire != 0) + return false; + Main.tile[i, j].wire = 16; + Main.PlaySound(0, i << 4, j << 4, 1); + return true; + } + + public static unsafe bool KillWire(int i, int j) + { + if (Main.tile[i, j].wire == 0) + return false; + Main.tile[i, j].wire = 0; + i <<= 4; + j <<= 4; + Main.PlaySound(0, i, j, 1); + if (Main.netMode != 1) + Item.NewItem(i, j, 16, 16, 530, 1, false, 0); + int num = 0; + while (num < 3 && IntPtr.Zero != (IntPtr) Main.dust.NewDust(i, j, 16, 16, 50, 0.0, 0.0, 0, new Color(), 1.0)) + ++num; + return true; + } + + public static bool CanPlaceTile(int i, ref int j, int type, int style = 0) + { + if (i < 0 || j < 0 || (i >= (int) Main.maxTilesX || j >= (int) Main.maxTilesY) || style >= 0 && (int) Main.tile[i, j].active == 0 && (Main.tileSolid[type] && Collision.AnyPlayerOrNPC(i, j, 1))) + return false; + switch (type) + { + case 136: + if ((int) Main.tile[i - 1, j].active != 0 && (Main.tileSolid[(int) Main.tile[i - 1, j].type] || (int) Main.tile[i - 1, j].type == 124 || (int) Main.tile[i - 1, j].type == 5 && (int) Main.tile[i - 1, j - 1].type == 5 && (int) Main.tile[i - 1, j + 1].type == 5) || (int) Main.tile[i + 1, j].active != 0 && (Main.tileSolid[(int) Main.tile[i + 1, j].type] || (int) Main.tile[i + 1, j].type == 124 || (int) Main.tile[i + 1, j].type == 5 && (int) Main.tile[i + 1, j - 1].type == 5 && (int) Main.tile[i + 1, j + 1].type == 5)) + return true; + if ((int) Main.tile[i, j + 1].active != 0) + return Main.tileSolid[(int) Main.tile[i, j + 1].type]; + else + return false; + case 149: + case 129: + if (!WorldGen.SolidTileUnsafe(i - 1, j) && !WorldGen.SolidTileUnsafe(i + 1, j) && !WorldGen.SolidTileUnsafe(i, j - 1)) + return WorldGen.SolidTileUnsafe(i, j + 1); + else + return true; + case 109: + case 2: + case 23: + if ((int) Main.tile[i, j].type == 0) + return (int) Main.tile[i, j].active != 0; + else + return false; + case 60: + case 70: + if ((int) Main.tile[i, j].type == 59) + return (int) Main.tile[i, j].active != 0; + else + return false; + case 61: + case 71: + if (j + 1 < (int) Main.maxTilesY && (int) Main.tile[i, j + 1].active != 0) + return (int) Main.tile[i, j + 1].type == type - 1; + else + return false; + case 69: + case 72: + case 27: + case 32: + case 51: + case 3: + case 24: + return (int) Main.tile[i, j].liquid == 0; + case 81: + if ((int) Main.tile[i - 1, j].active != 0 || (int) Main.tile[i + 1, j].active != 0 || ((int) Main.tile[i, j - 1].active != 0 || (int) Main.tile[i, j + 1].active == 0) || !Main.tileSolid[(int) Main.tile[i, j + 1].type]) + return false; + else + break; + case 4: + if (((int) Main.tile[i - 1, j].active == 0 || !Main.tileSolid[(int) Main.tile[i - 1, j].type] && (int) Main.tile[i - 1, j].type != 124 && ((int) Main.tile[i - 1, j].type != 5 || (int) Main.tile[i - 1, j - 1].type != 5 || (int) Main.tile[i - 1, j + 1].type != 5)) && ((int) Main.tile[i + 1, j].active == 0 || !Main.tileSolid[(int) Main.tile[i + 1, j].type] && (int) Main.tile[i + 1, j].type != 124 && ((int) Main.tile[i + 1, j].type != 5 || (int) Main.tile[i + 1, j - 1].type != 5 || (int) Main.tile[i + 1, j + 1].type != 5)) && ((int) Main.tile[i, j + 1].active == 0 || !Main.tileSolid[(int) Main.tile[i, j + 1].type])) + return false; + if (style != 8) + return (int) Main.tile[i, j].liquid == 0; + else + return true; + case 10: + if ((int) Main.tile[i, j - 1].active == 0 && (int) Main.tile[i, j - 2].active == 0 && ((int) Main.tile[i, j - 3].active != 0 && Main.tileSolid[(int) Main.tile[i, j - 3].type])) + { + --j; + return true; + } + else + { + if ((int) Main.tile[i, j + 1].active != 0 || (int) Main.tile[i, j + 2].active != 0 || ((int) Main.tile[i, j + 3].active == 0 || !Main.tileSolid[(int) Main.tile[i, j + 3].type])) + return false; + ++j; + return true; + } + case 20: + if ((int) Main.tile[i, j + 1].active != 0 && ((int) Main.tile[i, j + 1].type == 2 || (int) Main.tile[i, j + 1].type == 109 || (int) Main.tile[i, j + 1].type == 147)) + return (int) Main.tile[i, j].liquid == 0; + else + return false; + } + return true; + } + + public static unsafe bool PlaceTile(int i, int j, int type, bool mute = false, bool forced = false, int plr = -1, int style = 0) + { + bool flag = false; + fixed (Tile* tilePtr = &Main.tile[i, j]) + { + if (WorldGen.CanPlaceTile(i, ref j, type, style) || forced) + { + tilePtr->frameX = (short) 0; + tilePtr->frameY = (short) 0; + if (type == 3 || type == 24 || type == 110) + { + if (j + 1 < (int) Main.maxTilesY && (int) tilePtr[1].active != 0 && (type == 3 && (int) tilePtr[1].type == 2 || type == 24 && (int) tilePtr[1].type == 23 || (type == 3 && (int) tilePtr[1].type == 78 || type == 110 && (int) tilePtr[1].type == 109))) + { + if (type == 24 && WorldGen.genRand.Next(13) == 0) + { + type = 32; + flag = true; + } + else if ((int) tilePtr[1].type == 78) + { + tilePtr->frameX = (short) (WorldGen.genRand.Next(2) * 18 + 108); + flag = true; + } + else if ((int) tilePtr->wall == 0 && (int) tilePtr[1].wall == 0) + { + if (WorldGen.genRand.Next(50) == 0 || type == 24 && WorldGen.genRand.Next(40) == 0) + tilePtr->frameX = (short) 144; + else if (WorldGen.genRand.Next(35) == 0) + tilePtr->frameX = (short) (WorldGen.genRand.Next(2) * 18 + 108); + else + tilePtr->frameX = (short) (WorldGen.genRand.Next(6) * 18); + flag = true; + } + if (flag) + { + tilePtr->active = (byte) 1; + tilePtr->type = (byte) type; + } + } + } + else if (type == 61) + { + tilePtr->active = (byte) 1; + if (WorldGen.genRand.Next(16) == 0 && j > Main.worldSurface) + { + tilePtr->type = (byte) 69; + } + else + { + tilePtr->type = (byte) type; + if (j > Main.rockLayer && WorldGen.genRand.Next(60) == 0) + tilePtr->frameX = (short) 144; + else if (j > Main.rockLayer && WorldGen.genRand.Next(1000) == 0) + tilePtr->frameX = (short) 162; + else if (WorldGen.genRand.Next(15) == 0) + tilePtr->frameX = (short) (WorldGen.genRand.Next(2) * 18 + 108); + else + tilePtr->frameX = (short) (WorldGen.genRand.Next(6) * 18); + } + flag = true; + } + else if (type == 71) + { + tilePtr->active = (byte) 1; + tilePtr->type = (byte) type; + tilePtr->frameX = (short) (WorldGen.genRand.Next(5) * 18); + flag = true; + } + else if (type == 129) + { + tilePtr->active = (byte) 1; + tilePtr->type = (byte) type; + tilePtr->frameX = (short) (WorldGen.genRand.Next(8) * 18); + flag = true; + } + else if (type == 136) + { + tilePtr->active = (byte) 1; + tilePtr->type = (byte) type; + flag = true; + } + else if (type == 4) + { + tilePtr->active = (byte) 1; + tilePtr->type = (byte) type; + tilePtr->frameY = (short) (22 * style); + flag = true; + } + else if (type == 10) + flag = WorldGen.PlaceDoor(i, j, type); + else if (type == 128) + flag = WorldGen.PlaceMan(i, j, style); + else if (type == 149) + { + tilePtr->active = (byte) 1; + tilePtr->type = (byte) type; + tilePtr->frameX = (short) (18 * style); + flag = true; + } + else if (type == 139) + flag = WorldGen.PlaceMB(i, j, type, style); + else if (type == 34 || type == 35 || (type == 36 || type == 106)) + flag = WorldGen.Place3x3(i, j, type); + else if (type == 13 || type == 33 || (type == 49 || type == 50) || type == 78) + flag = WorldGen.PlaceOnTable1x1(i, j, type, style); + else if (type == 14 || type == 26 || (type == 86 || type == 87) || (type == 88 || type == 89 || type == 114)) + flag = WorldGen.Place3x2(i, j, type); + else if (type == 20 || type == 15) + flag = WorldGen.Place1x2(i, j, type, style); + else if (type == 16 || type == 18 || (type == 29 || type == 103) || type == 134) + flag = WorldGen.Place2x1(i, j, type); + else if (type == 92 || type == 93) + flag = WorldGen.Place1xX(i, j, type, 0); + else if (type == 104 || type == 105) + flag = WorldGen.Place2xX(i, j, type, style); + else if (type == 17 || type == 77 || type == 133) + flag = WorldGen.Place3x2(i, j, type); + else if (type == 21) + flag = WorldGen.PlaceChest(i, j, false, style) >= 0; + else if (type == 91) + flag = WorldGen.PlaceBanner(i, j, type, style); + else if (type == 135 || type == 141 || type == 144) + flag = WorldGen.Place1x1(i, j, type, style); + else if (type == 101 || type == 102) + flag = WorldGen.Place3x4(i, j, type); + else if (type == 27) + flag = WorldGen.PlaceSunflower(i, j); + else if (type == 28) + flag = WorldGen.PlacePot(i, j); + else if (type == 42) + flag = WorldGen.Place1x2Top(i, j, type); + else if (type == 55 || type == 85) + flag = WorldGen.PlaceSign(i, j, type); + else if (type >= 82 && type <= 84) + flag = WorldGen.PlaceAlch(i, j, style); + else if (type == 94 || type == 95 || (type == 96 || type == 97) || (type == 98 || type == 99 || (type == 100 || type == 125)) || (type == 126 || type == 132 || (type == 138 || type == 142) || type == 143)) + flag = WorldGen.Place2x2(i, j, type); + else if (type == 79 || type == 90) + { + flag = WorldGen.Place4x2(i, j, type, plr >= 0 ? (int) Main.player[plr].direction : 1); + } + else + { + tilePtr->active = (byte) 1; + tilePtr->type = (byte) type; + if (type == 81) + tilePtr->frameX = (short) (26 * WorldGen.genRand.Next(6)); + else if (type == 137 && style == 1) + tilePtr->frameX = (short) 18; + flag = true; + } + if (flag && !mute && !WorldGen.gen) + { + WorldGen.SquareTileFrame(i, j, -1); + if (type == (int) sbyte.MaxValue) + { + Main.PlaySound(2, i * 16, j * 16, 30); + } + else + { + Main.PlaySound(0, i * 16, j * 16, 1); + if (type == 22 || type == 140) + { + Main.dust.NewDust(i * 16, j * 16, 16, 16, 14, 0.0, 0.0, 0, new Color(), 1.0); + Main.dust.NewDust(i * 16, j * 16, 16, 16, 14, 0.0, 0.0, 0, new Color(), 1.0); + } + } + } + } + } + return flag; + } + + public static void UpdateMech() + { + for (int index1 = WorldGen.numMechs - 1; index1 >= 0; --index1) + { + --WorldGen.mech[index1].Time; + if ((int) Main.tile[(int) WorldGen.mech[index1].X, (int) WorldGen.mech[index1].Y].active != 0 && (int) Main.tile[(int) WorldGen.mech[index1].X, (int) WorldGen.mech[index1].Y].type == 144) + { + if ((int) Main.tile[(int) WorldGen.mech[index1].X, (int) WorldGen.mech[index1].Y].frameY == 0) + { + WorldGen.mech[index1].Time = 0; + } + else + { + int num = (int) Main.tile[(int) WorldGen.mech[index1].X, (int) WorldGen.mech[index1].Y].frameX / 18; + switch (num) + { + case 0: + num = 60; + break; + case 1: + num = 180; + break; + case 2: + num = 300; + break; + } + if (Math.IEEERemainder((double) WorldGen.mech[index1].Time, (double) num) == 0.0) + { + WorldGen.mech[index1].Time = 18000; + WorldGen.TripWire((int) WorldGen.mech[index1].X, (int) WorldGen.mech[index1].Y); + } + } + } + if (WorldGen.mech[index1].Time <= 0) + { + if ((int) Main.tile[(int) WorldGen.mech[index1].X, (int) WorldGen.mech[index1].Y].active != 0 && (int) Main.tile[(int) WorldGen.mech[index1].X, (int) WorldGen.mech[index1].Y].type == 144) + { + Main.tile[(int) WorldGen.mech[index1].X, (int) WorldGen.mech[index1].Y].frameY = (short) 0; + NetMessage.SendTile((int) WorldGen.mech[index1].X, (int) WorldGen.mech[index1].Y); + } + for (int index2 = index1; index2 < WorldGen.numMechs; ++index2) + WorldGen.mech[index2] = WorldGen.mech[index2 + 1]; + --WorldGen.numMechs; + } + } + } + + public static bool checkMech(int i, int j, int time) + { + for (int index = 0; index < WorldGen.numMechs; ++index) + { + if ((int) WorldGen.mech[index].X == i && (int) WorldGen.mech[index].Y == j) + return false; + } + if (WorldGen.numMechs >= 999) + return false; + WorldGen.mech[WorldGen.numMechs].X = (short) i; + WorldGen.mech[WorldGen.numMechs].Y = (short) j; + WorldGen.mech[WorldGen.numMechs].Time = time; + ++WorldGen.numMechs; + return true; + } + + public static void hitSwitch(int i, int j) + { + if ((int) Main.tile[i, j].type == 135) + { + Main.PlaySound(28, i * 16, j * 16, 0); + WorldGen.TripWire(i, j); + } + else if ((int) Main.tile[i, j].type == 136) + { + if ((int) Main.tile[i, j].frameY == 0) + Main.tile[i, j].frameY = (short) 18; + else + Main.tile[i, j].frameY = (short) 0; + Main.PlaySound(28, i * 16, j * 16, 0); + WorldGen.TripWire(i, j); + } + else if ((int) Main.tile[i, j].type == 144) + { + if ((int) Main.tile[i, j].frameY == 0) + { + Main.tile[i, j].frameY = (short) 18; + if (Main.netMode != 1) + WorldGen.checkMech(i, j, 18000); + } + else + Main.tile[i, j].frameY = (short) 0; + Main.PlaySound(28, i * 16, j * 16, 0); + } + else + { + if ((int) Main.tile[i, j].type != 132) + return; + short num1 = (short) 36; + int num2 = (int) Main.tile[i, j].frameX / 18 * -1; + int num3 = (int) Main.tile[i, j].frameY / 18 * -1; + if (num2 < -1) + { + num2 += 2; + num1 = (short) -36; + } + int i1 = num2 + i; + int j1 = num3 + j; + for (int index1 = i1; index1 < i1 + 2; ++index1) + { + for (int index2 = j1; index2 < j1 + 2; ++index2) + { + if ((int) Main.tile[index1, index2].type == 132) + Main.tile[index1, index2].frameX += num1; + } + } + WorldGen.TileFrame(i1, j1, 0); + Main.PlaySound(28, i * 16, j * 16, 0); + for (int i2 = i1; i2 < i1 + 2; ++i2) + { + for (int j2 = j1; j2 < j1 + 2; ++j2) + { + if ((int) Main.tile[i2, j2].type == 132 && (int) Main.tile[i2, j2].active != 0 && Main.tile[i2, j2].wire != 0) + { + WorldGen.TripWire(i2, j2); + return; + } + } + } + } + } + + public static void TripWire(int i, int j) + { + if (Main.netMode == 1) + return; + WorldGen.numWire = 0; + WorldGen.numNoWire = 0; + WorldGen.numInPump = 0; + WorldGen.numOutPump = 0; + WorldGen.NoWire(i, j); + WorldGen.hitWire(i, j); + if (WorldGen.numInPump <= 0 || WorldGen.numOutPump <= 0) + return; + WorldGen.xferWater(); + } + + public static void xferWater() + { + for (int index1 = 0; index1 < WorldGen.numInPump; ++index1) + { + int i1 = (int) WorldGen.inPump[index1].X; + int j1 = (int) WorldGen.inPump[index1].Y; + int num1 = (int) Main.tile[i1, j1].liquid; + if (num1 > 0) + { + int num2 = (int) Main.tile[i1, j1].lava; + for (int index2 = 0; index2 < WorldGen.numOutPump; ++index2) + { + int i2 = (int) WorldGen.outPump[index2].X; + int j2 = (int) WorldGen.outPump[index2].Y; + int num3 = (int) Main.tile[i2, j2].liquid; + if (num3 < (int) byte.MaxValue) + { + int num4 = (int) Main.tile[i2, j2].lava; + if (num3 == 0) + num4 = num2; + if (num2 == num4) + { + int num5 = num1; + if (num5 + num3 > (int) byte.MaxValue) + num5 = (int) byte.MaxValue - num3; + Main.tile[i2, j2].liquid += (byte) num5; + Main.tile[i1, j1].liquid -= (byte) num5; + num1 = (int) Main.tile[i1, j1].liquid; + Main.tile[i2, j2].lava = (byte) num2; + WorldGen.SquareTileFrame(i2, j2, -1); + if ((int) Main.tile[i1, j1].liquid == 0) + { + Main.tile[i1, j1].lava = (byte) 0; + WorldGen.SquareTileFrame(i1, j1, -1); + break; + } + } + } + } + WorldGen.SquareTileFrame(i1, j1, -1); + } + } + } + + public static void NoWire(int i, int j) + { + if (WorldGen.numNoWire >= 999) + return; + WorldGen.noWire[WorldGen.numNoWire].X = (short) i; + WorldGen.noWire[WorldGen.numNoWire].Y = (short) j; + ++WorldGen.numNoWire; + } + + public static void hitWire(int i, int j) + { + if (WorldGen.numWire >= 999 || Main.tile[i, j].wire == 0) + return; + for (int index = 0; index < WorldGen.numWire; ++index) + { + if ((int) WorldGen.wire[index].X == i && (int) WorldGen.wire[index].Y == j) + return; + } + WorldGen.wire[WorldGen.numWire].X = (short) i; + WorldGen.wire[WorldGen.numWire].Y = (short) j; + ++WorldGen.numWire; + int num1 = (int) Main.tile[i, j].type; + bool flag = true; + for (int index = 0; index < WorldGen.numNoWire; ++index) + { + if ((int) WorldGen.noWire[index].X == i && (int) WorldGen.noWire[index].Y == j) + flag = false; + } + if (flag && (int) Main.tile[i, j].active != 0) + { + if (num1 == 144) + { + WorldGen.hitSwitch(i, j); + WorldGen.SquareTileFrame(i, j, -1); + NetMessage.SendTile(i, j); + } + else if (num1 == 130) + { + Main.tile[i, j].type = (byte) 131; + WorldGen.SquareTileFrame(i, j, -1); + NetMessage.SendTile(i, j); + } + else if (num1 == 131) + { + Main.tile[i, j].type = (byte) 130; + WorldGen.SquareTileFrame(i, j, -1); + NetMessage.SendTile(i, j); + } + else if (num1 == 11) + { + WorldGen.CloseDoor(i, j, true); + NetMessage.CreateMessage2(24, i, j); + NetMessage.SendMessage(); + } + else if (num1 == 10) + { + int direction = (Main.rand.Next(2) << 1) - 1; + int number3 = WorldGen.OpenDoor(i, j, direction); + if (number3 != 0) + { + NetMessage.CreateMessage3(19, i, j, number3); + NetMessage.SendMessage(); + } + } + else if (num1 == 4) + { + if ((int) Main.tile[i, j].frameX < 66) + Main.tile[i, j].frameX += (short) 66; + else + Main.tile[i, j].frameX -= (short) 66; + NetMessage.SendTile(i, j); + } + else if (num1 == 149) + { + if ((int) Main.tile[i, j].frameX < 54) + Main.tile[i, j].frameX += (short) 54; + else + Main.tile[i, j].frameX -= (short) 54; + NetMessage.SendTile(i, j); + } + else if (num1 == 42) + { + int j1 = j - (int) Main.tile[i, j].frameY / 18; + short num2 = (short) 18; + if ((int) Main.tile[i, j].frameX > 0) + num2 = (short) -18; + Main.tile[i, j1].frameX += num2; + Main.tile[i, j1 + 1].frameX += num2; + WorldGen.NoWire(i, j1); + WorldGen.NoWire(i, j1 + 1); + NetMessage.SendTileSquare(i, j, 2); + } + else if (num1 == 93) + { + int j1 = j - (int) Main.tile[i, j].frameY / 18; + short num2 = (short) 18; + if ((int) Main.tile[i, j].frameX > 0) + num2 = (short) -18; + Main.tile[i, j1].frameX += num2; + Main.tile[i, j1 + 1].frameX += num2; + Main.tile[i, j1 + 2].frameX += num2; + WorldGen.NoWire(i, j1); + WorldGen.NoWire(i, j1 + 1); + WorldGen.NoWire(i, j1 + 2); + NetMessage.SendTileSquare(i, j1 + 1, 3); + } + else if (num1 == 126 || num1 == 100 || num1 == 95) + { + int index1 = j - (int) Main.tile[i, j].frameY / 18; + int num2 = (int) Main.tile[i, j].frameX / 18; + if (num2 > 1) + num2 -= 2; + int index2 = i - num2; + short num3 = (short) 36; + if ((int) Main.tile[index2, index1].frameX > 0) + num3 = (short) -36; + Main.tile[index2, index1].frameX += num3; + Main.tile[index2, index1 + 1].frameX += num3; + Main.tile[index2 + 1, index1].frameX += num3; + Main.tile[index2 + 1, index1 + 1].frameX += num3; + WorldGen.NoWire(index2, index1); + WorldGen.NoWire(index2, index1 + 1); + WorldGen.NoWire(index2 + 1, index1); + WorldGen.NoWire(index2 + 1, index1 + 1); + NetMessage.SendTileSquare(index2, index1, 3); + } + else if (num1 == 34 || num1 == 35 || num1 == 36) + { + int index1 = j - (int) Main.tile[i, j].frameY / 18; + int num2 = (int) Main.tile[i, j].frameX / 18; + if (num2 > 2) + num2 -= 3; + int index2 = i - num2; + short num3 = (short) 54; + if ((int) Main.tile[index2, index1].frameX > 0) + num3 = (short) -54; + for (int i1 = index2; i1 < index2 + 3; ++i1) + { + for (int j1 = index1; j1 < index1 + 3; ++j1) + { + Main.tile[i1, j1].frameX += num3; + WorldGen.NoWire(i1, j1); + } + } + NetMessage.SendTileSquare(index2 + 1, index1 + 1, 3); + } + else if (num1 == 33) + { + short num2 = (short) 18; + if ((int) Main.tile[i, j].frameX > 0) + num2 = (short) -18; + Main.tile[i, j].frameX += num2; + NetMessage.SendTileSquare(i, j, 3); + } + else if (num1 == 92) + { + int j1 = j - (int) Main.tile[i, j].frameY / 18; + short num2 = (short) 18; + if ((int) Main.tile[i, j].frameX > 0) + num2 = (short) -18; + Main.tile[i, j1].frameX += num2; + Main.tile[i, j1 + 1].frameX += num2; + Main.tile[i, j1 + 2].frameX += num2; + Main.tile[i, j1 + 3].frameX += num2; + Main.tile[i, j1 + 4].frameX += num2; + Main.tile[i, j1 + 5].frameX += num2; + WorldGen.NoWire(i, j1); + WorldGen.NoWire(i, j1 + 1); + WorldGen.NoWire(i, j1 + 2); + WorldGen.NoWire(i, j1 + 3); + WorldGen.NoWire(i, j1 + 4); + WorldGen.NoWire(i, j1 + 5); + NetMessage.SendTileSquare(i, j1 + 3, 7); + } + else if (num1 == 137) + { + if (WorldGen.checkMech(i, j, 180)) + { + int num2 = -1; + if ((int) Main.tile[i, j].frameX != 0) + num2 = 1; + float SpeedX = (float) (12 * num2); + int Damage = 20; + int Type = 98; + Vector2 vector2 = new Vector2((float) (i * 16 + 8), (float) (j * 16 + 7)); + vector2.X += (float) (10 * num2); + vector2.Y += 2f; + Projectile.NewProjectile((float) (int) vector2.X, (float) (int) vector2.Y, SpeedX, 0.0f, Type, Damage, 2f, 8, true); + } + } + else if (num1 == 139) + WorldGen.SwitchMB(i, j); + else if (num1 == 141) + { + WorldGen.KillTile(i, j, false, false, true); + NetMessage.SendTile(i, j); + Projectile.NewProjectile((float) (i * 16 + 8), (float) (j * 16 + 8), 0.0f, 0.0f, 108, 250, 10f, 8, true); + } + else if (num1 == 142 || num1 == 143) + { + int j1 = j - (int) Main.tile[i, j].frameY / 18; + int num2 = (int) Main.tile[i, j].frameX / 18; + if (num2 > 1) + num2 -= 2; + int i1 = i - num2; + WorldGen.NoWire(i1, j1); + WorldGen.NoWire(i1, j1 + 1); + WorldGen.NoWire(i1 + 1, j1); + WorldGen.NoWire(i1 + 1, j1 + 1); + if (num1 == 142) + { + for (int index = 0; index < 4 && WorldGen.numInPump < 19; ++index) + { + int num3; + int num4; + if (index == 0) + { + num3 = i1; + num4 = j1 + 1; + } + else if (index == 1) + { + num3 = i1 + 1; + num4 = j1 + 1; + } + else if (index == 2) + { + num3 = i1; + num4 = j1; + } + else + { + num3 = i1 + 1; + num4 = j1; + } + WorldGen.inPump[WorldGen.numInPump].X = (short) num3; + WorldGen.inPump[WorldGen.numInPump].Y = (short) num4; + ++WorldGen.numInPump; + } + } + else + { + for (int index = 0; index < 4 && WorldGen.numOutPump < 19; ++index) + { + int num3; + int num4; + if (index == 0) + { + num3 = i1; + num4 = j1 + 1; + } + else if (index == 1) + { + num3 = i1 + 1; + num4 = j1 + 1; + } + else if (index == 2) + { + num3 = i1; + num4 = j1; + } + else + { + num3 = i1 + 1; + num4 = j1; + } + WorldGen.outPump[WorldGen.numOutPump].X = (short) num3; + WorldGen.outPump[WorldGen.numOutPump].Y = (short) num4; + ++WorldGen.numOutPump; + } + } + } + else if (num1 == 105) + { + int j1 = j - (int) Main.tile[i, j].frameY / 18; + int num2 = (int) Main.tile[i, j].frameX / 18; + int num3 = num2 >> 1; + int i1 = i - (num2 & 1); + WorldGen.NoWire(i1, j1); + WorldGen.NoWire(i1, j1 + 1); + WorldGen.NoWire(i1, j1 + 2); + WorldGen.NoWire(i1 + 1, j1); + WorldGen.NoWire(i1 + 1, j1 + 1); + WorldGen.NoWire(i1 + 1, j1 + 2); + int num4 = i1 * 16 + 16; + int num5 = (j1 + 3) * 16; + int index1 = -1; + if (num3 == 4) + { + if (WorldGen.checkMech(i, j, 30) && NPC.MechSpawn(num4, num5, 1)) + index1 = NPC.NewNPC(num4, num5 - 12, 1, 0); + } + else if (num3 == 7) + { + if (WorldGen.checkMech(i, j, 30) && NPC.MechSpawn(num4, num5, 49)) + index1 = NPC.NewNPC(num4 - 4, num5 - 6, 49, 0); + } + else if (num3 == 8) + { + if (WorldGen.checkMech(i, j, 30) && NPC.MechSpawn(num4, num5, 55)) + index1 = NPC.NewNPC(num4, num5 - 12, 55, 0); + } + else if (num3 == 9) + { + if (WorldGen.checkMech(i, j, 30) && NPC.MechSpawn(num4, num5, 46)) + index1 = NPC.NewNPC(num4, num5 - 12, 46, 0); + } + else if (num3 == 10) + { + if (WorldGen.checkMech(i, j, 30) && NPC.MechSpawn(num4, num5, 21)) + index1 = NPC.NewNPC(num4, num5, 21, 0); + } + else if (num3 == 18) + { + if (WorldGen.checkMech(i, j, 30) && NPC.MechSpawn(num4, num5, 67)) + index1 = NPC.NewNPC(num4, num5 - 12, 67, 0); + } + else if (num3 == 23) + { + if (WorldGen.checkMech(i, j, 30) && NPC.MechSpawn(num4, num5, 63)) + index1 = NPC.NewNPC(num4, num5 - 12, 63, 0); + } + else if (num3 == 27) + { + if (WorldGen.checkMech(i, j, 30) && NPC.MechSpawn(num4, num5, 85)) + index1 = NPC.NewNPC(num4 - 9, num5, 85, 0); + } + else if (num3 == 28) + { + if (WorldGen.checkMech(i, j, 30) && NPC.MechSpawn(num4, num5, 74)) + index1 = NPC.NewNPC(num4, num5 - 12, 74, 0); + } + else if (num3 == 42) + { + if (WorldGen.checkMech(i, j, 30) && NPC.MechSpawn(num4, num5, 58)) + index1 = NPC.NewNPC(num4, num5 - 12, 58, 0); + } + else if (num3 == 37) + { + if (WorldGen.checkMech(i, j, 600) && Item.MechSpawn(num4, num5, 58)) + Item.NewItem(num4, num5 - 16, 0, 0, 58, 1, false, 0); + } + else if (num3 == 2) + { + if (WorldGen.checkMech(i, j, 600) && Item.MechSpawn(num4, num5, 184)) + Item.NewItem(num4, num5 - 16, 0, 0, 184, 1, false, 0); + } + else if (num3 == 17) + { + if (WorldGen.checkMech(i, j, 600) && Item.MechSpawn(num4, num5, 166)) + Item.NewItem(num4, num5 - 20, 0, 0, 166, 1, false, 0); + } + else if (num3 == 40) + { + if (WorldGen.checkMech(i, j, 300)) + { + int[] numArray = new int[10]; + int upperBound = 0; + for (int index2 = 0; index2 < 196; ++index2) + { + if ((int) Main.npc[index2].active != 0 && ((int) Main.npc[index2].type == 17 || (int) Main.npc[index2].type == 19 || ((int) Main.npc[index2].type == 22 || (int) Main.npc[index2].type == 38) || ((int) Main.npc[index2].type == 54 || (int) Main.npc[index2].type == 107 || (int) Main.npc[index2].type == 108))) + { + numArray[upperBound] = index2; + ++upperBound; + if (upperBound >= 9) + break; + } + } + if (upperBound > 0) + { + int number = numArray[Main.rand.Next(upperBound)]; + Main.npc[number].aabb.X = num4 - ((int) Main.npc[number].width >> 1); + Main.npc[number].aabb.Y = num5 - (int) Main.npc[number].height - 1; + Main.npc[number].position.X = (float) Main.npc[number].aabb.X; + Main.npc[number].position.Y = (float) Main.npc[number].aabb.Y; + NetMessage.CreateMessage1(23, number); + NetMessage.SendMessage(); + } + } + } + else if (num3 == 41 && WorldGen.checkMech(i, j, 300)) + { + int[] numArray = new int[10]; + int upperBound = 0; + for (int index2 = 0; index2 < 196; ++index2) + { + if ((int) Main.npc[index2].active != 0 && ((int) Main.npc[index2].type == 18 || (int) Main.npc[index2].type == 20 || (int) Main.npc[index2].type == 124)) + { + numArray[upperBound] = index2; + ++upperBound; + if (upperBound >= 9) + break; + } + } + if (upperBound > 0) + { + int number = numArray[Main.rand.Next(upperBound)]; + Main.npc[number].aabb.X = num4 - ((int) Main.npc[number].width >> 1); + Main.npc[number].aabb.Y = num5 - (int) Main.npc[number].height - 1; + Main.npc[number].position.X = (float) Main.npc[number].aabb.X; + Main.npc[number].position.Y = (float) Main.npc[number].aabb.Y; + NetMessage.CreateMessage1(23, number); + NetMessage.SendMessage(); + } + } + if (index1 >= 0) + { + Main.npc[index1].value = 0.0f; + Main.npc[index1].npcSlots = 0.0f; + } + } + } + WorldGen.hitWire(i - 1, j); + WorldGen.hitWire(i + 1, j); + WorldGen.hitWire(i, j - 1); + WorldGen.hitWire(i, j + 1); + } + + public static unsafe bool CanKillTile(int i, int j) + { + fixed (Tile* tilePtr1 = &Main.tile[i, j]) + { + if ((int) tilePtr1->active != 0 && j >= 1) + { + Tile* tilePtr2 = tilePtr1 - 1; + if ((int) tilePtr2->active != 0) + { + int num1 = (int) tilePtr1->type; + int num2 = (int) tilePtr2->type; + switch (num2) + { + case 21: + case 26: + case 72: + case 12: + return num1 == num2; + case 5: + if (num1 != num2) + return (int) tilePtr1[-1].frameX == 66 && (int) tilePtr1[-1].frameY >= 0 && (int) tilePtr1[-1].frameY <= 44 || (int) tilePtr1[-1].frameX == 88 && (int) tilePtr1[-1].frameY >= 66 && (int) tilePtr1[-1].frameY <= 110 || (int) tilePtr1[-1].frameY >= 198; + else + return true; + } + } + } + } + return true; + } + + public static bool CanKillWall(int i, int j) + { + int index1 = (int) Main.tile[i, j].wall; + if (Main.wallHouse[index1]) + return true; + for (int index2 = i - 1; index2 < i + 2; ++index2) + { + for (int index3 = j - 1; index3 < j + 2; ++index3) + { + if ((int) Main.tile[index2, index3].wall != index1) + return true; + } + } + return false; + } + + public static unsafe void KillWall(int i, int j, bool fail = false) + { + if (i < 0 || j < 0 || (i >= (int) Main.maxTilesX || j >= (int) Main.maxTilesY)) + return; + int num = (int) Main.tile[i, j].wall; + if (num <= 0) + return; + int Type1 = 0; + int type = 0; + switch (num) + { + case 1: + case 5: + case 6: + case 7: + case 8: + case 9: + Type1 = 1; + break; + case 4: + Type1 = 7; + break; + case 10: + case 11: + Type1 = num; + break; + case 12: + Type1 = 9; + break; + case 21: + type = 13; + Type1 = 13; + break; + case 22: + case 28: + Type1 = 51; + break; + case 23: + Type1 = 38; + break; + case 24: + Type1 = 36; + break; + case 25: + Type1 = 48; + break; + case 26: + case 30: + Type1 = 49; + break; + case 29: + Type1 = 50; + break; + case 31: + Type1 = 51; + break; + } + Main.PlaySound(type, i * 16, j * 16, 1); + for (int index = fail ? 1 : 5; index >= 0; --index) + { + switch (num) + { + case 3: + Type1 = 1 + 13 * WorldGen.genRand.Next(2); + break; + case 27: + Type1 = 1 + 6 * WorldGen.genRand.Next(2); + break; + } + Main.dust.NewDust(i * 16, j * 16, 16, 16, Type1, 0.0, 0.0, 0, new Color(), 1.0); + } + if (fail) + return; + int Type2 = 0; + switch (num) + { + case 1: + Type2 = 26; + break; + case 4: + Type2 = 93; + break; + case 5: + Type2 = 130; + break; + case 6: + Type2 = 132; + break; + case 7: + Type2 = 135; + break; + case 8: + Type2 = 138; + break; + case 9: + Type2 = 140; + break; + case 10: + Type2 = 142; + break; + case 11: + Type2 = 144; + break; + case 12: + Type2 = 146; + break; + case 14: + Type2 = 330; + break; + case 16: + Type2 = 30; + break; + case 17: + Type2 = 135; + break; + case 18: + Type2 = 138; + break; + case 19: + Type2 = 140; + break; + case 20: + Type2 = 330; + break; + case 21: + Type2 = 392; + break; + case 22: + Type2 = 417; + break; + case 23: + Type2 = 418; + break; + case 24: + Type2 = 419; + break; + case 25: + Type2 = 420; + break; + case 26: + Type2 = 421; + break; + case 27: + Type2 = 479; + break; + case 29: + Type2 = 587; + break; + case 30: + Type2 = 592; + break; + case 31: + Type2 = 595; + break; + } + if (Type2 > 0) + Item.NewItem(i * 16, j * 16, 16, 16, Type2, 1, false, 0); + Main.tile[i, j].wall = (byte) 0; + WorldGen.SquareWallFrame(i, j, true); + } + + public static unsafe void KillTileFast(int i, int j) + { + fixed (Tile* tilePtr1 = &Main.tile[i, j]) + { + if ((int) tilePtr1->active != 0) + { + int num1 = (int) tilePtr1->type; + if (j >= 1) + { + Tile* tilePtr2 = tilePtr1 - 1; + if ((int) tilePtr2->active != 0) + { + int num2 = (int) tilePtr2->type; + switch (num2) + { + case 21: + case 26: + case 72: + case 12: + if (num1 != num2) + return; + else + break; + case 5: + if (num1 != num2 && ((int) tilePtr1[-1].frameX != 66 || (int) tilePtr1[-1].frameY < 0 || (int) tilePtr1[-1].frameY > 44) && (((int) tilePtr1[-1].frameX != 88 || (int) tilePtr1[-1].frameY < 66 || (int) tilePtr1[-1].frameY > 110) && (int) tilePtr1[-1].frameY < 198)) + return; + else + break; + } + } + } + if (num1 != 138) + { + if (num1 == 128) + { + int index1 = i; + int num2 = (int) tilePtr1->frameX; + if ((int) tilePtr1->frameX % 100 % 36 == 18) + { + num2 = (int) tilePtr1[-1440].frameX; + --index1; + } + if (num2 >= 100) + { + int index2 = num2 / 100; + int num3 = num2 % 100; + switch ((int) Main.tile[index1, j].frameY / 18) + { + case 0: + Item.NewItem(i * 16, j * 16, 16, 16, (int) Item.headType[index2], 1, false, 0); + break; + case 1: + Item.NewItem(i * 16, j * 16, 16, 16, (int) Item.bodyType[index2], 1, false, 0); + break; + case 2: + Item.NewItem(i * 16, j * 16, 16, 16, (int) Item.legType[index2], 1, false, 0); + break; + } + int num4 = (int) Main.tile[index1, j].frameX % 100; + Main.tile[index1, j].frameX = (short) num4; + } + } + else if (num1 == 21 && Main.netMode != 1) + { + int num2 = (int) tilePtr1->frameX / 18; + int Y = j - (int) tilePtr1->frameY / 18; + if (!Chest.DestroyChest(i - (num2 & 1), Y)) + return; + } + } + tilePtr1->active = (byte) 0; + tilePtr1->type = (byte) 0; + tilePtr1->frameX = (short) -1; + tilePtr1->frameY = (short) -1; + tilePtr1->frameNumber = (byte) 0; + if (num1 == 58 && j > (int) Main.maxTilesY - 200) + { + tilePtr1->lava = (byte) 32; + tilePtr1->liquid = (byte) sbyte.MinValue; + } + WorldGen.SquareTileFrame(i, j, -1); + } + } + } + + public static unsafe bool KillTile(int i, int j) + { + if (i >= 0 && j >= 0 && (i < (int) Main.maxTilesX && j < (int) Main.maxTilesY)) + { + fixed (Tile* tilePtr1 = &Main.tile[i, j]) + { + if ((int) tilePtr1->active != 0) + { + int index1 = (int) tilePtr1->type; + if (j >= 1) + { + Tile* tilePtr2 = tilePtr1 - 1; + if ((int) tilePtr2->active != 0) + { + int num = (int) tilePtr2->type; + switch (num) + { + case 21: + case 26: + case 72: + case 12: + if (index1 != num) + return false; + else + break; + case 5: + if (index1 != num && ((int) tilePtr1[-1].frameX != 66 || (int) tilePtr1[-1].frameY < 0 || (int) tilePtr1[-1].frameY > 44) && (((int) tilePtr1[-1].frameX != 88 || (int) tilePtr1[-1].frameY < 66 || (int) tilePtr1[-1].frameY > 110) && (int) tilePtr1[-1].frameY < 198)) + return false; + else + break; + } + } + } + if (!WorldGen.gen && !WorldGen.stopDrops) + { + if (index1 == (int) sbyte.MaxValue) + Main.PlaySound(2, i * 16, j * 16, 27); + else if (index1 == 3 || index1 == 110) + { + Main.PlaySound(6, i * 16, j * 16, 1); + if ((int) tilePtr1->frameX == 144) + Item.NewItem(i * 16, j * 16, 16, 16, 5, 1, false, 0); + } + else if (index1 == 24) + { + Main.PlaySound(6, i * 16, j * 16, 1); + if ((int) tilePtr1->frameX == 144) + Item.NewItem(i * 16, j * 16, 16, 16, 60, 1, false, 0); + } + else if (index1 == 32 || index1 == 51 || (index1 == 52 || index1 == 61) || (index1 == 62 || index1 == 69 || (index1 == 71 || index1 == 73)) || (index1 == 74 || index1 >= 82 && index1 <= 84 || (index1 == 113 || index1 == 115))) + Main.PlaySound(6, i * 16, j * 16, 1); + else if (index1 == 1 || index1 == 6 || (index1 == 7 || index1 == 8) || (index1 == 9 || index1 == 22 || (index1 == 25 || index1 == 37)) || (index1 == 38 || index1 == 39 || (index1 == 41 || index1 == 43) || (index1 == 44 || index1 == 45 || (index1 == 46 || index1 == 47))) || (index1 == 48 || index1 == 56 || (index1 == 58 || index1 == 63) || (index1 == 64 || index1 == 65 || (index1 == 66 || index1 == 67)) || (index1 == 68 || index1 == 75 || (index1 == 76 || index1 == 107) || (index1 == 108 || index1 == 111 || (index1 == 117 || index1 == 118)))) || (index1 == 119 || index1 == 120 || (index1 == 121 || index1 == 122) || index1 == 140)) + Main.PlaySound(21, i * 16, j * 16, 1); + else if (index1 != 138) + { + Main.PlaySound(0, i * 16, j * 16, 1); + if (index1 == 129) + Main.PlaySound(2, i * 16, j * 16, 27); + } + } + if (index1 != 138) + { + if (index1 == 128) + { + int index2 = i; + int num1 = (int) tilePtr1->frameX; + if ((int) tilePtr1->frameX % 100 % 36 == 18) + { + num1 = (int) tilePtr1[-1440].frameX; + --index2; + } + if (num1 >= 100) + { + int index3 = num1 / 100; + int num2 = num1 % 100; + switch ((int) Main.tile[index2, j].frameY / 18) + { + case 0: + Item.NewItem(i * 16, j * 16, 16, 16, (int) Item.headType[index3], 1, false, 0); + break; + case 1: + Item.NewItem(i * 16, j * 16, 16, 16, (int) Item.bodyType[index3], 1, false, 0); + break; + case 2: + Item.NewItem(i * 16, j * 16, 16, 16, (int) Item.legType[index3], 1, false, 0); + break; + } + int num3 = (int) Main.tile[index2, j].frameX % 100; + Main.tile[index2, j].frameX = (short) num3; + } + } + if (!WorldGen.gen) + { + int Type = 0; + if (index1 != 0) + { + if (index1 == 1 || index1 == 16 || (index1 == 17 || index1 == 38) || (index1 == 39 || index1 == 41 || (index1 == 43 || index1 == 44)) || (index1 == 48 || index1 == 85 || (index1 == 90 || index1 == 92) || (index1 == 96 || index1 == 97 || (index1 == 99 || index1 == 105))) || (index1 == 117 || index1 == 130 || (index1 == 131 || index1 == 132) || (index1 == 135 || index1 == 137 || (index1 == 142 || index1 == 143)) || (index1 == 144 || Main.tileStone[index1]))) + Type = 1; + else if (index1 == 33 || index1 == 95 || (index1 == 98 || index1 == 100)) + Type = 6; + else if (index1 == 5 || index1 == 10 || (index1 == 11 || index1 == 14) || (index1 == 15 || index1 == 19 || (index1 == 30 || index1 == 86)) || (index1 == 87 || index1 == 88 || (index1 == 89 || index1 == 93) || (index1 == 94 || index1 == 104 || (index1 == 106 || index1 == 114))) || (index1 == 124 || index1 == 128 || index1 == 139)) + Type = 7; + else if (index1 == 21) + Type = (int) tilePtr1->frameX < 108 ? ((int) tilePtr1->frameX < 36 ? 7 : 10) : 37; + else if (index1 == (int) sbyte.MaxValue) + Type = 67; + else if (index1 == 91) + Type = -1; + else if (index1 == 6 || index1 == 26) + Type = 8; + else if (index1 == 7 || index1 == 34 || index1 == 47) + Type = 9; + else if (index1 == 8 || index1 == 36 || (index1 == 45 || index1 == 102)) + Type = 10; + else if (index1 == 9 || index1 == 35 || (index1 == 42 || index1 == 46) || (index1 == 126 || index1 == 136)) + Type = 11; + else if (index1 == 12) + Type = 12; + else if (index1 == 3 || index1 == 73) + Type = 3; + else if (index1 == 13 || index1 == 54) + Type = 13; + else if (index1 == 22 || index1 == 140) + Type = 14; + else if (index1 == 28 || index1 == 78) + Type = 22; + else if (index1 == 29) + Type = 23; + else if (index1 == 40 || index1 == 103) + Type = 28; + else if (index1 == 49) + Type = 29; + else if (index1 == 50) + Type = 22; + else if (index1 == 51) + Type = 30; + else if (index1 == 52) + Type = 3; + else if (index1 == 53 || index1 == 81) + Type = 32; + else if (index1 == 56 || index1 == 75) + Type = 37; + else if (index1 == 57 || index1 == 119 || index1 == 141) + Type = 36; + else if (index1 == 59 || index1 == 120) + Type = 38; + else if (index1 == 61 || index1 == 62 || (index1 == 74 || index1 == 80)) + Type = 40; + else if (index1 == 69) + Type = 7; + else if (index1 == 71 || index1 == 72) + Type = 26; + else if (index1 == 70) + Type = 17; + else if (index1 == 112) + Type = 14; + else if (index1 == 123) + Type = 53; + else if (index1 == 116 || index1 == 118 || (index1 == 147 || index1 == 148)) + Type = 51; + else if (index1 == 110 || index1 == 113 || index1 == 115) + Type = 47; + else if (index1 == 107 || index1 == 121) + Type = 48; + else if (index1 == 108 || index1 == 122 || (index1 == 134 || index1 == 146)) + Type = 49; + else if (index1 == 111 || index1 == 133 || index1 == 145) + Type = 50; + else if (index1 == 149) + Type = 49; + else if (index1 >= 82 && index1 <= 84) + { + switch ((int) tilePtr1->frameX / 18) + { + case 0: + Type = 3; + break; + case 1: + Type = 3; + break; + case 2: + Type = 7; + break; + case 3: + Type = 17; + break; + case 4: + Type = 3; + break; + case 5: + Type = 6; + break; + } + } + else if (index1 == 129) + Type = (int) tilePtr1->frameX == 0 || (int) tilePtr1->frameX == 54 || (int) tilePtr1->frameX == 108 ? 68 : ((int) tilePtr1->frameX == 18 || (int) tilePtr1->frameX == 72 || (int) tilePtr1->frameX == 126 ? 69 : 70); + else if (index1 == 4) + { + int num = (int) tilePtr1->frameY / 22; + switch (num) + { + case 0: + Type = 6; + break; + case 8: + Type = 75; + break; + default: + Type = 58 + num; + break; + } + } + } + if (Type >= 0) + { + for (int index2 = 4; index2 >= 0; --index2) + { + switch (index1) + { + case 61: + Type = 38 + WorldGen.genRand.Next(2); + break; + case 76: + case 77: + case 58: + Type = WorldGen.genRand.Next(2) == 0 ? 6 : 25; + break; + case 109: + Type = WorldGen.genRand.Next(2) * 47; + break; + case 2: + Type = WorldGen.genRand.Next(2) << 1; + break; + case 20: + Type = WorldGen.genRand.Next(2) == 0 ? 7 : 2; + break; + case 23: + case 24: + Type = WorldGen.genRand.Next(2) == 0 ? 14 : 17; + break; + case 25: + case 31: + Type = WorldGen.genRand.Next(2) == 0 ? 14 : 1; + break; + case 27: + Type = WorldGen.genRand.Next(2) == 0 ? 3 : 19; + break; + case 32: + Type = WorldGen.genRand.Next(2) == 0 ? 14 : 24; + break; + case 34: + case 35: + case 36: + case 42: + Type = WorldGen.genRand.Next(2) * 6; + break; + case 37: + Type = WorldGen.genRand.Next(2) == 0 ? 6 : 23; + break; + } + Main.dust.NewDust(i * 16, j * 16, 16, 16, Type, 0.0, 0.0, 0, new Color(), 1.0); + } + } + } + } + if (index1 == 21 && Main.netMode != 1) + { + int num = (int) tilePtr1->frameX / 18; + int Y = j - (int) tilePtr1->frameY / 18; + if (!Chest.DestroyChest(i - (num & 1), Y)) + return false; + } + if (!WorldGen.gen && !WorldGen.stopDrops && Main.netMode != 1) + { + int Type = 0; + if (index1 == 0 || index1 == 2 || index1 == 109) + Type = 2; + else if (index1 == 1) + Type = 3; + else if (index1 == 3 || index1 == 73) + { + if (Main.rand.Next(2) == 0) + { + Rectangle rect = new Rectangle(); + rect.X = i << 4; + rect.Y = j << 4; + rect.Width = rect.Height = 16; + if (Player.FindClosest(ref rect).HasItem(281)) + Type = 283; + } + } + else if (index1 == 4) + { + int num = (int) tilePtr1->frameY / 22; + switch (num) + { + case 0: + Type = 8; + break; + case 8: + Type = 523; + break; + default: + Type = 426 + num; + break; + } + } + else if (index1 == 5) + { + if ((int) tilePtr1->frameX >= 22 && (int) tilePtr1->frameY >= 198) + { + if (Main.netMode != 1) + { + Type = 9; + if (WorldGen.genRand.Next(2) == 0) + { + int index2 = j - 1; + int index3; + do + { + index3 = (int) Main.tile[i, ++index2].type; + } + while (!Main.tileSolidNotSolidTop[index3] || (int) Main.tile[i, index2].active == 0); + if (index3 == 2 || index3 == 109) + Type = 27; + } + } + } + else + Type = 9; + ++WorldGen.woodSpawned; + } + else if (index1 == 6) + Type = 11; + else if (index1 == 7) + Type = 12; + else if (index1 == 8) + Type = 13; + else if (index1 == 9) + Type = 14; + else if (index1 == 123) + Type = 424; + else if (index1 == 124) + Type = 480; + else if (index1 == 149) + { + if ((int) tilePtr1->frameX == 0 || (int) tilePtr1->frameX == 54) + Type = 596; + else if ((int) tilePtr1->frameX == 18 || (int) tilePtr1->frameX == 72) + Type = 597; + else if ((int) tilePtr1->frameX == 36 || (int) tilePtr1->frameX == 90) + Type = 598; + } + else if (index1 == 13) + { + Main.PlaySound(13, i * 16, j * 16, 1); + Type = (int) tilePtr1->frameX != 18 ? ((int) tilePtr1->frameX != 36 ? ((int) tilePtr1->frameX != 54 ? ((int) tilePtr1->frameX != 72 ? 31 : 351) : 350) : 110) : 28; + } + else if (index1 == 19) + Type = 94; + else if (index1 == 22) + Type = 56; + else if (index1 == 140) + Type = 577; + else if (index1 == 23) + Type = 2; + else if (index1 == 25) + Type = 61; + else if (index1 == 30) + Type = 9; + else if (index1 == 33) + Type = 105; + else if (index1 == 37) + Type = 116; + else if (index1 == 38) + Type = 129; + else if (index1 == 39) + Type = 131; + else if (index1 == 40) + Type = 133; + else if (index1 == 41) + Type = 134; + else if (index1 == 43) + Type = 137; + else if (index1 == 44) + Type = 139; + else if (index1 == 45) + Type = 141; + else if (index1 == 46) + Type = 143; + else if (index1 == 47) + Type = 145; + else if (index1 == 48) + Type = 147; + else if (index1 == 49) + Type = 148; + else if (index1 == 51) + Type = 150; + else if (index1 == 53) + Type = 169; + else if (index1 == 54) + { + Type = 170; + Main.PlaySound(13, i * 16, j * 16, 1); + } + else if (index1 == 56) + Type = 173; + else if (index1 == 57) + Type = 172; + else if (index1 == 58) + Type = 174; + else if (index1 == 60) + Type = 176; + else if (index1 == 70) + Type = 176; + else if (index1 == 75) + Type = 192; + else if (index1 == 76) + Type = 214; + else if (index1 == 78) + Type = 222; + else if (index1 == 81) + Type = 275; + else if (index1 == 80) + Type = 276; + else if (index1 == 107) + Type = 364; + else if (index1 == 108) + Type = 365; + else if (index1 == 111) + Type = 366; + else if (index1 == 112) + Type = 370; + else if (index1 == 116) + Type = 408; + else if (index1 == 117) + Type = 409; + else if (index1 == 118) + Type = 412; + else if (index1 == 119) + Type = 413; + else if (index1 == 120) + Type = 414; + else if (index1 == 121) + Type = 415; + else if (index1 == 122) + Type = 416; + else if (index1 == 129) + Type = 502; + else if (index1 == 130) + Type = 511; + else if (index1 == 131) + Type = 512; + else if (index1 == 136) + Type = 538; + else if (index1 == 137) + Type = 539; + else if (index1 == 141) + Type = 580; + else if (index1 == 145) + Type = 586; + else if (index1 == 146) + Type = 591; + else if (index1 == 147) + Type = 593; + else if (index1 == 148) + Type = 594; + else if (index1 == 135) + { + if ((int) tilePtr1->frameY == 0) + Type = 529; + else if ((int) tilePtr1->frameY == 18) + Type = 541; + else if ((int) tilePtr1->frameY == 36) + Type = 542; + else if ((int) tilePtr1->frameY == 54) + Type = 543; + } + else if (index1 == 144) + { + if ((int) tilePtr1->frameX == 0) + Type = 583; + else if ((int) tilePtr1->frameX == 18) + Type = 584; + else if ((int) tilePtr1->frameX == 36) + Type = 585; + } + else if (index1 == 61 || index1 == 74) + { + if ((int) tilePtr1->frameX == 144) + Item.NewItem(i * 16, j * 16, 16, 16, 331, WorldGen.genRand.Next(2, 4), false, 0); + else if ((int) tilePtr1->frameX == 162) + Type = 223; + else if ((int) tilePtr1->frameX >= 108 && (int) tilePtr1->frameX <= 126 && WorldGen.genRand.Next(100) == 0) + Type = 208; + else if (WorldGen.genRand.Next(100) == 0) + Type = 195; + } + else if (index1 == 59 || index1 == 60) + Type = 176; + else if (index1 == 71 || index1 == 72) + { + int num = WorldGen.genRand.Next(50); + if (num < 25) + Type = num != 0 ? 183 : 194; + } + else if ((int) tilePtr1->type >= 63 && (int) tilePtr1->type <= 68) + Type = (int) tilePtr1->type - 63 + 177; + else if (index1 == 50) + Type = (int) tilePtr1->frameX != 90 ? 149 : 165; + else if (index1 == 83 || index1 == 84) + { + int num = (int) tilePtr1->frameX / 18; + bool flag = index1 == 84; + if (!flag) + { + if (num == 0 && Main.gameTime.dayTime) + flag = true; + else if (num == 1 && !Main.gameTime.dayTime) + flag = true; + else if (num == 3 && Main.gameTime.bloodMoon) + flag = true; + } + if (flag) + Item.NewItem(i * 16, j * 16, 16, 16, 307 + num, WorldGen.genRand.Next(1, 4), false, 0); + Type = 313 + num; + } + if (Type > 0) + Item.NewItem(i * 16, j * 16, 16, 16, Type, 1, false, -1); + } + tilePtr1->active = (byte) 0; + tilePtr1->type = (byte) 0; + tilePtr1->frameX = (short) -1; + tilePtr1->frameY = (short) -1; + tilePtr1->frameNumber = (byte) 0; + if (index1 == 58 && j > (int) Main.maxTilesY - 200) + { + tilePtr1->lava = (byte) 32; + tilePtr1->liquid = (byte) sbyte.MinValue; + } + WorldGen.SquareTileFrame(i, j, -1); + return true; + } + else + { + // ISSUE: __unpin statement + __unpin(tilePtr1); + } + } + } + return false; + } + + public static unsafe void KillTile(int i, int j, bool fail, bool effectOnly = false, bool noItem = false) + { + if (i < 0 || j < 0 || (i >= (int) Main.maxTilesX || j >= (int) Main.maxTilesY)) + return; + fixed (Tile* tilePtr1 = &Main.tile[i, j]) + { + if ((int) tilePtr1->active != 0) + { + int index1 = (int) tilePtr1->type; + if (j >= 1) + { + Tile* tilePtr2 = tilePtr1 - 1; + if ((int) tilePtr2->active != 0) + { + int num = (int) tilePtr2->type; + switch (num) + { + case 21: + case 26: + case 72: + case 12: + if (index1 != num) + return; + else + break; + case 5: + if (index1 != num && ((int) tilePtr1[-1].frameX != 66 || (int) tilePtr1[-1].frameY < 0 || (int) tilePtr1[-1].frameY > 44) && (((int) tilePtr1[-1].frameX != 88 || (int) tilePtr1[-1].frameY < 66 || (int) tilePtr1[-1].frameY > 110) && (int) tilePtr1[-1].frameY < 198)) + return; + else + break; + } + } + } + if (!WorldGen.gen && !effectOnly && !WorldGen.stopDrops) + { + if (index1 == (int) sbyte.MaxValue) + Main.PlaySound(2, i * 16, j * 16, 27); + else if (index1 == 3 || index1 == 110) + { + Main.PlaySound(6, i * 16, j * 16, 1); + if ((int) tilePtr1->frameX == 144) + Item.NewItem(i * 16, j * 16, 16, 16, 5, 1, false, 0); + } + else if (index1 == 24) + { + Main.PlaySound(6, i * 16, j * 16, 1); + if ((int) tilePtr1->frameX == 144) + Item.NewItem(i * 16, j * 16, 16, 16, 60, 1, false, 0); + } + else if (index1 == 32 || index1 == 51 || (index1 == 52 || index1 == 61) || (index1 == 62 || index1 == 69 || (index1 == 71 || index1 == 73)) || (index1 == 74 || index1 >= 82 && index1 <= 84 || (index1 == 113 || index1 == 115))) + Main.PlaySound(6, i * 16, j * 16, 1); + else if (index1 == 1 || index1 == 6 || (index1 == 7 || index1 == 8) || (index1 == 9 || index1 == 22 || (index1 == 25 || index1 == 37)) || (index1 == 38 || index1 == 39 || (index1 == 41 || index1 == 43) || (index1 == 44 || index1 == 45 || (index1 == 46 || index1 == 47))) || (index1 == 48 || index1 == 56 || (index1 == 58 || index1 == 63) || (index1 == 64 || index1 == 65 || (index1 == 66 || index1 == 67)) || (index1 == 68 || index1 == 75 || (index1 == 76 || index1 == 107) || (index1 == 108 || index1 == 111 || (index1 == 117 || index1 == 118)))) || (index1 == 119 || index1 == 120 || (index1 == 121 || index1 == 122) || index1 == 140)) + Main.PlaySound(21, i * 16, j * 16, 1); + else if (index1 != 138) + { + Main.PlaySound(0, i * 16, j * 16, 1); + if (index1 == 129 && !fail) + Main.PlaySound(2, i * 16, j * 16, 27); + } + } + if (index1 != 138) + { + if (index1 == 128) + { + int index2 = i; + int num1 = (int) tilePtr1->frameX; + if ((int) tilePtr1->frameX % 100 % 36 == 18) + { + num1 = (int) tilePtr1[-1440].frameX; + --index2; + } + if (num1 >= 100) + { + int index3 = num1 / 100; + int num2 = num1 % 100; + switch ((int) Main.tile[index2, j].frameY / 18) + { + case 0: + Item.NewItem(i * 16, j * 16, 16, 16, (int) Item.headType[index3], 1, false, 0); + break; + case 1: + Item.NewItem(i * 16, j * 16, 16, 16, (int) Item.bodyType[index3], 1, false, 0); + break; + case 2: + Item.NewItem(i * 16, j * 16, 16, 16, (int) Item.legType[index3], 1, false, 0); + break; + } + int num3 = (int) Main.tile[index2, j].frameX % 100; + Main.tile[index2, j].frameX = (short) num3; + } + } + if (!WorldGen.gen) + { + int Type = 0; + if (index1 != 0) + { + if (index1 == 1 || index1 == 16 || (index1 == 17 || index1 == 38) || (index1 == 39 || index1 == 41 || (index1 == 43 || index1 == 44)) || (index1 == 48 || index1 == 85 || (index1 == 90 || index1 == 92) || (index1 == 96 || index1 == 97 || (index1 == 99 || index1 == 105))) || (index1 == 117 || index1 == 130 || (index1 == 131 || index1 == 132) || (index1 == 135 || index1 == 137 || (index1 == 142 || index1 == 143)) || (index1 == 144 || Main.tileStone[index1]))) + Type = 1; + else if (index1 == 33 || index1 == 95 || (index1 == 98 || index1 == 100)) + Type = 6; + else if (index1 == 5 || index1 == 10 || (index1 == 11 || index1 == 14) || (index1 == 15 || index1 == 19 || (index1 == 30 || index1 == 86)) || (index1 == 87 || index1 == 88 || (index1 == 89 || index1 == 93) || (index1 == 94 || index1 == 104 || (index1 == 106 || index1 == 114))) || (index1 == 124 || index1 == 128 || index1 == 139)) + Type = 7; + else if (index1 == 21) + Type = (int) tilePtr1->frameX < 108 ? ((int) tilePtr1->frameX < 36 ? 7 : 10) : 37; + else if (index1 == (int) sbyte.MaxValue) + Type = 67; + else if (index1 == 91) + Type = -1; + else if (index1 == 6 || index1 == 26) + Type = 8; + else if (index1 == 7 || index1 == 34 || index1 == 47) + Type = 9; + else if (index1 == 8 || index1 == 36 || (index1 == 45 || index1 == 102)) + Type = 10; + else if (index1 == 9 || index1 == 35 || (index1 == 42 || index1 == 46) || (index1 == 126 || index1 == 136)) + Type = 11; + else if (index1 == 12) + Type = 12; + else if (index1 == 3 || index1 == 73) + Type = 3; + else if (index1 == 13 || index1 == 54) + Type = 13; + else if (index1 == 22 || index1 == 140) + Type = 14; + else if (index1 == 28 || index1 == 78) + Type = 22; + else if (index1 == 29) + Type = 23; + else if (index1 == 40 || index1 == 103) + Type = 28; + else if (index1 == 49) + Type = 29; + else if (index1 == 50) + Type = 22; + else if (index1 == 51) + Type = 30; + else if (index1 == 52) + Type = 3; + else if (index1 == 53 || index1 == 81) + Type = 32; + else if (index1 == 56 || index1 == 75) + Type = 37; + else if (index1 == 57 || index1 == 119 || index1 == 141) + Type = 36; + else if (index1 == 59 || index1 == 120) + Type = 38; + else if (index1 == 61 || index1 == 62 || (index1 == 74 || index1 == 80)) + Type = 40; + else if (index1 == 69) + Type = 7; + else if (index1 == 71 || index1 == 72) + Type = 26; + else if (index1 == 70) + Type = 17; + else if (index1 == 112) + Type = 14; + else if (index1 == 123) + Type = 53; + else if (index1 == 116 || index1 == 118 || (index1 == 147 || index1 == 148)) + Type = 51; + else if (index1 == 110 || index1 == 113 || index1 == 115) + Type = 47; + else if (index1 == 107 || index1 == 121) + Type = 48; + else if (index1 == 108 || index1 == 122 || (index1 == 134 || index1 == 146)) + Type = 49; + else if (index1 == 111 || index1 == 133 || index1 == 145) + Type = 50; + else if (index1 == 149) + Type = 49; + else if (index1 >= 82 && index1 <= 84) + { + switch ((int) tilePtr1->frameX / 18) + { + case 0: + Type = 3; + break; + case 1: + Type = 3; + break; + case 2: + Type = 7; + break; + case 3: + Type = 17; + break; + case 4: + Type = 3; + break; + case 5: + Type = 6; + break; + } + } + else if (index1 == 129) + Type = (int) tilePtr1->frameX == 0 || (int) tilePtr1->frameX == 54 || (int) tilePtr1->frameX == 108 ? 68 : ((int) tilePtr1->frameX == 18 || (int) tilePtr1->frameX == 72 || (int) tilePtr1->frameX == 126 ? 69 : 70); + else if (index1 == 4) + { + int num = (int) tilePtr1->frameY / 22; + switch (num) + { + case 0: + Type = 6; + break; + case 8: + Type = 75; + break; + default: + Type = 58 + num; + break; + } + } + } + if (Type >= 0) + { + for (int index2 = fail ? 1 : 4; index2 >= 0; --index2) + { + switch (index1) + { + case 61: + Type = 38 + WorldGen.genRand.Next(2); + break; + case 76: + case 77: + case 58: + Type = WorldGen.genRand.Next(2) == 0 ? 6 : 25; + break; + case 109: + Type = WorldGen.genRand.Next(2) * 47; + break; + case 2: + Type = WorldGen.genRand.Next(2) << 1; + break; + case 20: + Type = WorldGen.genRand.Next(2) == 0 ? 7 : 2; + break; + case 23: + case 24: + Type = WorldGen.genRand.Next(2) == 0 ? 14 : 17; + break; + case 25: + case 31: + Type = WorldGen.genRand.Next(2) == 0 ? 14 : 1; + break; + case 27: + Type = WorldGen.genRand.Next(2) == 0 ? 3 : 19; + break; + case 32: + Type = WorldGen.genRand.Next(2) == 0 ? 14 : 24; + break; + case 34: + case 35: + case 36: + case 42: + Type = WorldGen.genRand.Next(2) * 6; + break; + case 37: + Type = WorldGen.genRand.Next(2) == 0 ? 6 : 23; + break; + } + Main.dust.NewDust(i * 16, j * 16, 16, 16, Type, 0.0, 0.0, 0, new Color(), 1.0); + } + } + } + } + if (effectOnly) + return; + if (fail) + { + if (index1 == 2 || index1 == 23 || index1 == 109) + tilePtr1->type = (byte) 0; + else if (index1 == 60 || index1 == 70) + tilePtr1->type = (byte) 59; + WorldGen.SquareTileFrame(i, j, -1); + } + else + { + if (index1 == 21 && Main.netMode != 1) + { + int num = (int) tilePtr1->frameX / 18; + int Y = j - (int) tilePtr1->frameY / 18; + if (!Chest.DestroyChest(i - (num & 1), Y)) + return; + } + if (!noItem && !WorldGen.stopDrops && (Main.netMode != 1 && !WorldGen.gen)) + { + int Type = 0; + if (index1 == 0 || index1 == 2 || index1 == 109) + Type = 2; + else if (index1 == 1) + Type = 3; + else if (index1 == 3 || index1 == 73) + { + if (Main.rand.Next(2) == 0) + { + Rectangle rect = new Rectangle(); + rect.X = i << 4; + rect.Y = j << 4; + rect.Width = rect.Height = 16; + if (Player.FindClosest(ref rect).HasItem(281)) + Type = 283; + } + } + else if (index1 == 4) + { + int num = (int) tilePtr1->frameY / 22; + switch (num) + { + case 0: + Type = 8; + break; + case 8: + Type = 523; + break; + default: + Type = 426 + num; + break; + } + } + else if (index1 == 5) + { + if ((int) tilePtr1->frameX >= 22 && (int) tilePtr1->frameY >= 198) + { + if (Main.netMode != 1) + { + Type = 9; + if (WorldGen.genRand.Next(2) == 0) + { + int index2 = j - 1; + int index3; + do + { + index3 = (int) Main.tile[i, ++index2].type; + } + while (!Main.tileSolidNotSolidTop[index3] || (int) Main.tile[i, index2].active == 0); + if (index3 == 2 || index3 == 109) + Type = 27; + } + } + } + else + Type = 9; + ++WorldGen.woodSpawned; + } + else if (index1 == 6) + Type = 11; + else if (index1 == 7) + Type = 12; + else if (index1 == 8) + Type = 13; + else if (index1 == 9) + Type = 14; + else if (index1 == 123) + Type = 424; + else if (index1 == 124) + Type = 480; + else if (index1 == 149) + { + if ((int) tilePtr1->frameX == 0 || (int) tilePtr1->frameX == 54) + Type = 596; + else if ((int) tilePtr1->frameX == 18 || (int) tilePtr1->frameX == 72) + Type = 597; + else if ((int) tilePtr1->frameX == 36 || (int) tilePtr1->frameX == 90) + Type = 598; + } + else if (index1 == 13) + { + Main.PlaySound(13, i * 16, j * 16, 1); + Type = (int) tilePtr1->frameX != 18 ? ((int) tilePtr1->frameX != 36 ? ((int) tilePtr1->frameX != 54 ? ((int) tilePtr1->frameX != 72 ? 31 : 351) : 350) : 110) : 28; + } + else if (index1 == 19) + Type = 94; + else if (index1 == 22) + Type = 56; + else if (index1 == 140) + Type = 577; + else if (index1 == 23) + Type = 2; + else if (index1 == 25) + Type = 61; + else if (index1 == 30) + Type = 9; + else if (index1 == 33) + Type = 105; + else if (index1 == 37) + Type = 116; + else if (index1 == 38) + Type = 129; + else if (index1 == 39) + Type = 131; + else if (index1 == 40) + Type = 133; + else if (index1 == 41) + Type = 134; + else if (index1 == 43) + Type = 137; + else if (index1 == 44) + Type = 139; + else if (index1 == 45) + Type = 141; + else if (index1 == 46) + Type = 143; + else if (index1 == 47) + Type = 145; + else if (index1 == 48) + Type = 147; + else if (index1 == 49) + Type = 148; + else if (index1 == 51) + Type = 150; + else if (index1 == 53) + Type = 169; + else if (index1 == 54) + { + Type = 170; + Main.PlaySound(13, i * 16, j * 16, 1); + } + else if (index1 == 56) + Type = 173; + else if (index1 == 57) + Type = 172; + else if (index1 == 58) + Type = 174; + else if (index1 == 60) + Type = 176; + else if (index1 == 70) + Type = 176; + else if (index1 == 75) + Type = 192; + else if (index1 == 76) + Type = 214; + else if (index1 == 78) + Type = 222; + else if (index1 == 81) + Type = 275; + else if (index1 == 80) + Type = 276; + else if (index1 == 107) + Type = 364; + else if (index1 == 108) + Type = 365; + else if (index1 == 111) + Type = 366; + else if (index1 == 112) + Type = 370; + else if (index1 == 116) + Type = 408; + else if (index1 == 117) + Type = 409; + else if (index1 == 118) + Type = 412; + else if (index1 == 119) + Type = 413; + else if (index1 == 120) + Type = 414; + else if (index1 == 121) + Type = 415; + else if (index1 == 122) + Type = 416; + else if (index1 == 129) + Type = 502; + else if (index1 == 130) + Type = 511; + else if (index1 == 131) + Type = 512; + else if (index1 == 136) + Type = 538; + else if (index1 == 137) + Type = 539; + else if (index1 == 141) + Type = 580; + else if (index1 == 145) + Type = 586; + else if (index1 == 146) + Type = 591; + else if (index1 == 147) + Type = 593; + else if (index1 == 148) + Type = 594; + else if (index1 == 135) + { + if ((int) tilePtr1->frameY == 0) + Type = 529; + else if ((int) tilePtr1->frameY == 18) + Type = 541; + else if ((int) tilePtr1->frameY == 36) + Type = 542; + else if ((int) tilePtr1->frameY == 54) + Type = 543; + } + else if (index1 == 144) + { + if ((int) tilePtr1->frameX == 0) + Type = 583; + else if ((int) tilePtr1->frameX == 18) + Type = 584; + else if ((int) tilePtr1->frameX == 36) + Type = 585; + } + else if (index1 == 61 || index1 == 74) + { + if ((int) tilePtr1->frameX == 144) + Item.NewItem(i * 16, j * 16, 16, 16, 331, WorldGen.genRand.Next(2, 4), false, 0); + else if ((int) tilePtr1->frameX == 162) + Type = 223; + else if ((int) tilePtr1->frameX >= 108 && (int) tilePtr1->frameX <= 126 && WorldGen.genRand.Next(100) == 0) + Type = 208; + else if (WorldGen.genRand.Next(100) == 0) + Type = 195; + } + else if (index1 == 59 || index1 == 60) + Type = 176; + else if (index1 == 71 || index1 == 72) + { + int num = WorldGen.genRand.Next(50); + if (num < 25) + Type = num != 0 ? 183 : 194; + } + else if ((int) tilePtr1->type >= 63 && (int) tilePtr1->type <= 68) + Type = (int) tilePtr1->type - 63 + 177; + else if (index1 == 50) + Type = (int) tilePtr1->frameX != 90 ? 149 : 165; + else if (index1 == 83 || index1 == 84) + { + int num = (int) tilePtr1->frameX / 18; + bool flag = index1 == 84; + if (!flag) + { + if (num == 0 && Main.gameTime.dayTime) + flag = true; + else if (num == 1 && !Main.gameTime.dayTime) + flag = true; + else if (num == 3 && Main.gameTime.bloodMoon) + flag = true; + } + if (flag) + Item.NewItem(i * 16, j * 16, 16, 16, 307 + num, WorldGen.genRand.Next(1, 4), false, 0); + Type = 313 + num; + } + if (Type > 0) + Item.NewItem(i * 16, j * 16, 16, 16, Type, 1, false, -1); + } + tilePtr1->active = (byte) 0; + tilePtr1->type = (byte) 0; + tilePtr1->frameX = (short) -1; + tilePtr1->frameY = (short) -1; + tilePtr1->frameNumber = (byte) 0; + if (index1 == 58 && j > (int) Main.maxTilesY - 200) + { + tilePtr1->lava = (byte) 32; + tilePtr1->liquid = (byte) sbyte.MinValue; + } + WorldGen.SquareTileFrame(i, j, -1); + } + } + } + } + + public static bool PlayerLOS(int x, int y) + { + Rectangle rectangle1 = new Rectangle(x * 16, y * 16, 16, 16); + Rectangle rectangle2 = new Rectangle(); + bool result = false; + for (int index = 0; index < 8; ++index) + { + if ((int) Main.player[index].active != 0) + { + rectangle2.X = (int) ((double) Main.player[index].position.X + 10.0 - 1152.0); + rectangle2.Y = (int) ((double) Main.player[index].position.Y + 21.0 - 648.0); + rectangle2.Width = 2304; + rectangle2.Height = 1296; + rectangle1.Intersects(ref rectangle2, out result); + if (result) + break; + } + } + return result; + } + + public static void hardUpdateWorld(int i, int j) + { + int num1 = (int) Main.tile[i, j].type; + if (num1 == 117 && j > Main.rockLayer && Main.rand.Next(110) == 0) + { + int num2 = WorldGen.genRand.Next(4); + int num3 = 0; + int num4 = 0; + if (num2 == 0) + num3 = -1; + else if (num2 == 1) + num3 = 1; + else + num4 = num2 != 0 ? 1 : -1; + if ((int) Main.tile[i + num3, j + num4].active == 0) + { + int num5 = 0; + int num6 = 6; + for (int index1 = i - num6; index1 <= i + num6; ++index1) + { + for (int index2 = j - num6; index2 <= j + num6; ++index2) + { + if ((int) Main.tile[index1, index2].active != 0 && (int) Main.tile[index1, index2].type == 129) + ++num5; + } + } + if (num5 < 2) + { + WorldGen.PlaceTile(i + num3, j + num4, 129, true, false, -1, 0); + NetMessage.SendTile(i + num3, j + num4); + } + } + } + else if (num1 == 23 || num1 == 25 || (num1 == 32 || num1 == 112)) + { + do + { + int index1 = i + WorldGen.genRand.Next(-3, 4); + int index2 = j + WorldGen.genRand.Next(-3, 4); + if ((int) Main.tile[index1, index2].type == 2) + { + Main.tile[index1, index2].type = (byte) 23; + WorldGen.SquareTileFrame(index1, index2, -1); + NetMessage.SendTile(index1, index2); + if (WorldGen.genRand.Next(2) != 0) + goto label_41; + } + else if ((int) Main.tile[index1, index2].type == 1) + { + Main.tile[index1, index2].type = (byte) 25; + WorldGen.SquareTileFrame(index1, index2, -1); + NetMessage.SendTile(index1, index2); + if (WorldGen.genRand.Next(2) != 0) + goto label_39; + } + else if ((int) Main.tile[index1, index2].type == 53) + { + Main.tile[index1, index2].type = (byte) 112; + WorldGen.SquareTileFrame(index1, index2, -1); + NetMessage.SendTile(index1, index2); + if (WorldGen.genRand.Next(2) != 0) + goto label_32; + } + else if ((int) Main.tile[index1, index2].type == 59) + { + Main.tile[index1, index2].type = (byte) 0; + WorldGen.SquareTileFrame(index1, index2, -1); + NetMessage.SendTile(index1, index2); + if (WorldGen.genRand.Next(2) != 0) + goto label_29; + } + else if ((int) Main.tile[index1, index2].type == 60) + { + Main.tile[index1, index2].type = (byte) 23; + WorldGen.SquareTileFrame(index1, index2, -1); + NetMessage.SendTile(index1, index2); + if (WorldGen.genRand.Next(2) != 0) + goto label_26; + } + else if ((int) Main.tile[index1, index2].type == 69) + { + Main.tile[index1, index2].type = (byte) 32; + WorldGen.SquareTileFrame(index1, index2, -1); + NetMessage.SendTile(index1, index2); + } + else + goto label_23; + } + while (WorldGen.genRand.Next(2) == 0); + goto label_20; +label_41: + return; +label_39: + return; +label_32: + return; +label_29: + return; +label_26: + return; +label_23: + return; +label_20: + return; + } + if (num1 != 109 && num1 != 110 && (num1 != 113 && num1 != 115) && (num1 != 116 && num1 != 117 && num1 != 118)) + return; + do + { + int index1; + int index2; + do + { + do + { + index1 = i + WorldGen.genRand.Next(-3, 4); + index2 = j + WorldGen.genRand.Next(-3, 4); + switch (Main.tile[index1, index2].type) + { + case (byte) 2: + Main.tile[index1, index2].type = (byte) 109; + WorldGen.SquareTileFrame(index1, index2, -1); + NetMessage.SendTile(index1, index2); + continue; + case (byte) 1: + goto label_40; + case (byte) 53: + goto label_42; + default: + goto label_45; + } + } + while (WorldGen.genRand.Next(2) == 0); + goto label_43; +label_40: + Main.tile[index1, index2].type = (byte) 117; + WorldGen.SquareTileFrame(index1, index2, -1); + NetMessage.SendTile(index1, index2); + } + while (WorldGen.genRand.Next(2) == 0); + goto label_44; +label_42: + Main.tile[index1, index2].type = (byte) 116; + WorldGen.SquareTileFrame(index1, index2, -1); + NetMessage.SendTile(index1, index2); + } + while (WorldGen.genRand.Next(2) == 0); + goto label_46; +label_43: + return; +label_44: + return; +label_45: + return; +label_46:; + } + + public static unsafe bool SolidTile(int i, int j) + { + try + { + fixed (Tile* tilePtr = &Main.tile[i, j]) + return (int) tilePtr->active != 0 && Main.tileSolidNotSolidTop[(int) tilePtr->type]; + } + catch + { + return false; + } + } + + public static unsafe bool SolidTileUnsafe(int i, int j) + { + fixed (Tile* tilePtr = &Main.tile[i, j]) + return (int) tilePtr->active != 0 && Main.tileSolidNotSolidTop[(int) tilePtr->type]; + } + + public static bool CanStandOnTop(int i, int j) + { + try + { + return Main.tile[i, j].canStandOnTop(); + } + catch + { + return false; + } + } + + public static unsafe void MineHouse(int i, int j) + { + if (i < 50 || i > (int) Main.maxTilesX - 50 || (j < 50 || j > (int) Main.maxTilesY - 50) || (WorldGen.SolidTileUnsafe(i, j) || (int) Main.tile[i, j].wall > 0)) + return; + int num1 = WorldGen.genRand.Next(6, 12); + int num2 = WorldGen.genRand.Next(3, 6); + int num3 = WorldGen.genRand.Next(15, 30); + int num4 = WorldGen.genRand.Next(15, 30); + int num5 = j - num1; + int num6 = j + num2; + for (int index1 = 0; index1 < 2; ++index1) + { + int i1 = i; + int j1 = j; + int num7 = -1; + int num8 = num3; + if (index1 == 1) + { + num7 = 1; + num8 = num4; + ++i1; + } + do + { + if (j1 - num1 < num5) + num5 = j1 - num1; + if (j1 + num2 > num6) + num6 = j1 + num2; + for (int index2 = 0; index2 < 2; ++index2) + { + int j2 = j1; + int num9 = num1; + int num10 = -1; + if (index2 == 1) + { + ++j2; + num9 = num2; + num10 = 1; + } + bool flag = true; + do + { + if (i1 != i) + { + fixed (Tile* tilePtr = &Main.tile[i1 - num7, j2]) + { + if ((int) tilePtr->wall != 27 && ((int) tilePtr->active == 0 || Main.tileSolidNotSolidTop[(int) tilePtr->type])) + { + tilePtr->active = (byte) 1; + tilePtr->type = (byte) 30; + } + } + } + if (WorldGen.SolidTileUnsafe(i1 - 1, j2)) + Main.tile[i1 - 1, j2].type = (byte) 30; + if (WorldGen.SolidTileUnsafe(i1 + 1, j2)) + Main.tile[i1 + 1, j2].type = (byte) 30; + if (WorldGen.SolidTileUnsafe(i1, j2)) + { + int num11 = 0; + if (WorldGen.SolidTileUnsafe(i1 - 1, j2)) + num11 = 1; + if (WorldGen.SolidTileUnsafe(i1 + 1, j2)) + ++num11; + if (WorldGen.SolidTileUnsafe(i1, j2 - 1)) + ++num11; + if (WorldGen.SolidTileUnsafe(i1, j2 + 1)) + ++num11; + if (num11 < 2) + { + Main.tile[i1, j2].active = (byte) 0; + } + else + { + flag = false; + Main.tile[i1, j2].type = (byte) 30; + } + } + else + { + Main.tile[i1, j2].wall = (byte) 27; + Main.tile[i1, j2].liquid = (byte) 0; + Main.tile[i1, j2].lava = (byte) 0; + } + j2 += num10; + if (--num9 <= 0) + { + if ((int) Main.tile[i1, j2].active == 0) + { + Main.tile[i1, j2].active = (byte) 1; + Main.tile[i1, j2].type = (byte) 30; + break; + } + else + break; + } + } + while (flag); + } + --num8; + i1 += num7; + if (WorldGen.SolidTileUnsafe(i1, j1)) + { + int num9 = 0; + int num10 = 0; + int j2 = j1; + do + { + --j2; + ++num9; + if (WorldGen.SolidTileUnsafe(i1 - num7, j2)) + { + num9 = 999; + break; + } + } + while (WorldGen.SolidTileUnsafe(i1, j2)); + int j3 = j1; + do + { + ++j3; + ++num10; + if (WorldGen.SolidTileUnsafe(i1 - num7, j3)) + { + num10 = 999; + break; + } + } + while (WorldGen.SolidTileUnsafe(i1, j3)); + if (num10 <= num9) + { + if (num10 > num2) + num8 = 0; + else + j1 += num10 + 1; + } + else if (num9 > num1) + num8 = 0; + else + j1 -= num9 + 1; + } + } + while (num8 > 0); + } + int num12 = i - num3 - 1; + int num13 = i + num4 + 2; + int num14 = num5 - 1; + int num15 = num6 + 2; + for (int i1 = num12; i1 < num13; ++i1) + { + for (int j1 = num14; j1 < num15; ++j1) + { + if ((int) Main.tile[i1, j1].wall == 27 && (int) Main.tile[i1, j1].active == 0) + { + if ((int) Main.tile[i1 - 1, j1].wall != 27 && i1 < i && !WorldGen.SolidTileUnsafe(i1 - 1, j1)) + { + WorldGen.PlaceTile(i1, j1, 30, true, false, -1, 0); + Main.tile[i1, j1].wall = (byte) 0; + } + if ((int) Main.tile[i1 + 1, j1].wall != 27 && i1 > i && !WorldGen.SolidTileUnsafe(i1 + 1, j1)) + { + WorldGen.PlaceTile(i1, j1, 30, true, false, -1, 0); + Main.tile[i1, j1].wall = (byte) 0; + } + for (int i2 = i1 - 1; i2 <= i1 + 1; ++i2) + { + for (int j2 = j1 - 1; j2 <= j1 + 1; ++j2) + { + if (WorldGen.SolidTileUnsafe(i2, j2)) + Main.tile[i2, j2].type = (byte) 30; + } + } + } + if ((int) Main.tile[i1, j1].type == 30 && (int) Main.tile[i1 - 1, j1].wall == 27 && (int) Main.tile[i1 + 1, j1].wall == 27 && (((int) Main.tile[i1, j1 - 1].wall == 27 || (int) Main.tile[i1, j1 - 1].active != 0) && ((int) Main.tile[i1, j1 + 1].wall == 27 || (int) Main.tile[i1, j1 + 1].active != 0))) + { + Main.tile[i1, j1].active = (byte) 0; + Main.tile[i1, j1].wall = (byte) 27; + } + } + } + for (int index1 = num12; index1 < num13; ++index1) + { + for (int index2 = num14; index2 < num15; ++index2) + { + if ((int) Main.tile[index1, index2].type == 30) + { + if ((int) Main.tile[index1 - 1, index2].wall == 27 && (int) Main.tile[index1 + 1, index2].wall == 27 && ((int) Main.tile[index1 - 1, index2].active == 0 && (int) Main.tile[index1 + 1, index2].active == 0)) + { + Main.tile[index1, index2].active = (byte) 0; + Main.tile[index1, index2].wall = (byte) 27; + } + if ((int) Main.tile[index1, index2 - 1].type != 21 && (int) Main.tile[index1 - 1, index2].wall == 27 && ((int) Main.tile[index1 + 1, index2].type == 30 && (int) Main.tile[index1 + 2, index2].wall == 27) && ((int) Main.tile[index1 - 1, index2].active == 0 && (int) Main.tile[index1 + 2, index2].active == 0)) + { + Main.tile[index1, index2].active = (byte) 0; + Main.tile[index1, index2].wall = (byte) 27; + Main.tile[index1 + 1, index2].active = (byte) 0; + Main.tile[index1 + 1, index2].wall = (byte) 27; + } + if ((int) Main.tile[index1, index2 - 1].wall == 27 && (int) Main.tile[index1, index2 + 1].wall == 27 && ((int) Main.tile[index1, index2 - 1].active == 0 && (int) Main.tile[index1, index2 + 1].active == 0)) + { + Main.tile[index1, index2].active = (byte) 0; + Main.tile[index1, index2].wall = (byte) 27; + } + } + } + } + for (int i1 = num12; i1 < num13; ++i1) + { + for (int j1 = num15; j1 > num14; --j1) + { + bool flag1 = false; + if ((int) Main.tile[i1, j1].active != 0 && (int) Main.tile[i1, j1].type == 30) + { + int num7 = -1; + for (int index1 = 0; index1 < 2; ++index1) + { + if (!WorldGen.SolidTileUnsafe(i1 + num7, j1) && (int) Main.tile[i1 + num7, j1].wall == 0) + { + int num8 = 0; + int j2 = j1; + int num9 = j1; + while ((int) Main.tile[i1, j2].active != 0 && (int) Main.tile[i1, j2].type == 30 && (!WorldGen.SolidTileUnsafe(i1 + num7, j2) && (int) Main.tile[i1 + num7, j2].wall == 0)) + { + --j2; + ++num8; + } + int num10 = j2 + 1 + 1; + if (num8 > 4) + { + if (WorldGen.genRand.Next(2) == 0) + { + int j3 = num9 - 1; + bool flag2 = true; + for (int index2 = i1 - 2; index2 <= i1 + 2; ++index2) + { + for (int index3 = j3 - 2; index3 <= j3; ++index3) + { + if (index2 != i1 && (int) Main.tile[index2, index3].active != 0) + flag2 = false; + } + } + if (flag2) + { + Main.tile[i1, j3].active = (byte) 0; + Main.tile[i1, j3 - 1].active = (byte) 0; + Main.tile[i1, j3 - 2].active = (byte) 0; + WorldGen.PlaceTile(i1, j3, 10, true, false, -1, 0); + flag1 = true; + } + } + if (!flag1) + { + for (int index2 = num10; index2 < num9; ++index2) + Main.tile[i1, index2].type = (byte) 124; + } + } + } + num7 = 1; + } + } + if (flag1) + break; + } + } + for (int i1 = num12; i1 < num13; i1 = i1 + WorldGen.genRand.Next(3) + 1) + { + bool flag = true; + for (int j1 = num14; j1 < num15; ++j1) + { + for (int i2 = i1 - 2; i2 <= i1 + 2; ++i2) + { + if ((int) Main.tile[i2, j1].active != 0 && (!WorldGen.SolidTileUnsafe(i2, j1) || (int) Main.tile[i2, j1].type == 10)) + flag = false; + } + } + if (flag) + { + for (int j1 = num14; j1 < num15; ++j1) + { + if ((int) Main.tile[i1, j1].wall == 27 && (int) Main.tile[i1, j1].active == 0) + WorldGen.PlaceTile(i1, j1, 124, true, false, -1, 0); + } + } + } + for (int index1 = 0; index1 < 4; ++index1) + { + int i1 = WorldGen.genRand.Next(num12 + 2, num13 - 1); + int index2; + for (index2 = WorldGen.genRand.Next(num14 + 2, num15 - 1); (int) Main.tile[i1, index2].wall != 27; index2 = WorldGen.genRand.Next(num14 + 2, num15 - 1)) + i1 = WorldGen.genRand.Next(num12 + 2, num13 - 1); + while ((int) Main.tile[i1, index2].active != 0) + --index2; + while ((int) Main.tile[i1, index2].active == 0) + ++index2; + int j1 = index2 - 1; + if ((int) Main.tile[i1, j1].wall == 27) + { + if (WorldGen.genRand.Next(3) == 0) + { + int type; + switch (WorldGen.genRand.Next(9)) + { + case 0: + type = 14; + break; + case 1: + type = 16; + break; + case 2: + type = 18; + break; + case 3: + type = 86; + break; + case 4: + type = 87; + break; + case 5: + type = 94; + break; + case 6: + type = 101; + break; + case 7: + type = 104; + break; + default: + type = 106; + break; + } + WorldGen.PlaceTile(i1, j1, type, true, false, -1, 0); + } + else + { + int style = WorldGen.genRand.Next(2, 43); + WorldGen.PlaceTile(i1, j1, 105, true, true, -1, style); + } + } + } + } + + public static void CountTiles(int X) + { + if (X == 0) + { + WorldGen.totalEvil = WorldGen.totalEvil2; + WorldGen.totalSolid = WorldGen.totalSolid2; + WorldGen.totalGood = WorldGen.totalGood2; + if (!WorldGen.gen) + { + if (WorldGen.totalSolid > 0) + { + WorldGen.tGood = (byte) Math.Round((double) (WorldGen.totalGood * 100) / (double) WorldGen.totalSolid); + WorldGen.tEvil = (byte) Math.Round((double) (WorldGen.totalEvil * 100) / (double) WorldGen.totalSolid); + if ((double) WorldGen.tEvil >= 50.0) + UI.SetTriggerStateForAll(Trigger.CorruptedWorld); + if ((double) WorldGen.tGood >= 50.0) + UI.SetTriggerStateForAll(Trigger.HallowedWorld); + } + else + { + WorldGen.tGood = (byte) 0; + WorldGen.tEvil = (byte) 0; + } + NetMessage.CreateMessage0(57); + NetMessage.SendMessage(); + } + WorldGen.totalEvil2 = 0; + WorldGen.totalSolid2 = 0; + WorldGen.totalGood2 = 0; + } + int num = Main.worldSurface; + int j = (int) Main.maxTilesY - 1; + do + { + if (WorldGen.SolidTileUnsafe(X, j)) + { + switch (Main.tile[X, j].type) + { + case (byte) 109: + case (byte) 116: + case (byte) 117: + ++WorldGen.totalGood2; + break; + case (byte) 23: + case (byte) 25: + case (byte) 112: + ++WorldGen.totalEvil2; + break; + } + ++WorldGen.totalSolid2; + } + } + while (--j > num); + do + { + if (WorldGen.SolidTileUnsafe(X, j)) + { + switch (Main.tile[X, j].type) + { + case (byte) 109: + case (byte) 116: + case (byte) 117: + WorldGen.totalGood2 += 5; + break; + case (byte) 23: + case (byte) 25: + case (byte) 112: + WorldGen.totalEvil2 += 5; + break; + } + WorldGen.totalSolid2 += 5; + } + } + while (--j >= 0); + } + + public static unsafe void UpdateWorld() + { + WorldGen.UpdateSand(); + WorldGen.UpdateMech(); + if ((++Liquid.skipCount & 1) == 0) + Liquid.UpdateLiquid(); + if (WorldGen.hardLock) + return; + if ((++WorldGen.totalD & 15) == 0) + { + WorldGen.CountTiles(WorldGen.totalX); + if (++WorldGen.totalX >= (int) Main.maxTilesX) + WorldGen.totalX = 0; + } + bool flag1 = false; + if (Main.invasionType > 0) + WorldGen.spawnDelay = 0; + if (++WorldGen.spawnDelay >= 20) + { + flag1 = true; + WorldGen.spawnDelay = 0; + if (WorldGen.spawnNPC != 37) + { + for (int index = 0; index < 196; ++index) + { + if ((int) Main.npc[index].active != 0 && Main.npc[index].homeless && Main.npc[index].townNPC) + { + WorldGen.spawnNPC = (int) Main.npc[index].type; + break; + } + } + } + } + float num1 = 3E-05f; + for (int index1 = (int) ((double) ((int) Main.maxTilesX * (int) Main.maxTilesY) * (double) num1); index1 > 0; --index1) + { + int index2 = WorldGen.genRand.Next(10, (int) Main.maxTilesX - 10); + int index3 = WorldGen.genRand.Next(10, Main.worldSurface - 1); + int num2 = index2 - 1; + int num3 = index2 + 2; + int index4 = index3 - 1; + int num4 = index3 + 2; + if (num2 < 10) + num2 = 10; + if (num3 > (int) Main.maxTilesX - 10) + num3 = (int) Main.maxTilesX - 10; + if (index4 < 10) + index4 = 10; + if (num4 > (int) Main.maxTilesY - 10) + num4 = (int) Main.maxTilesY - 10; + fixed (Tile* tilePtr = &Main.tile[index2, index3]) + { + int grass = (int) tilePtr->type; + if (grass >= 82 && grass <= 84) + WorldGen.GrowAlch(index2, index3); + if ((int) tilePtr->liquid > 32) + { + if ((int) tilePtr->active != 0 && (grass == 3 || grass == 20 || (grass == 24 || grass == 27) || grass == 73)) + { + WorldGen.KillTile(index2, index3); + if (Main.netMode == 2) + { + NetMessage.CreateMessage5(17, 0, index2, index3, 0, 0); + NetMessage.SendMessage(); + } + } + } + else if ((int) tilePtr->active != 0) + { + if (Main.hardMode) + WorldGen.hardUpdateWorld(index2, index3); + if (grass == 80) + { + if (WorldGen.genRand.Next(15) == 0) + WorldGen.GrowCactus(index2, index3); + } + else if (grass == 53) + { + if ((int) Main.tile[index2, index4].active == 0) + { + if (index2 < 250 || index2 > (int) Main.maxTilesX - 250) + { + if (WorldGen.genRand.Next(500) == 0 && (int) Main.tile[index2, index4].liquid == (int) byte.MaxValue && ((int) Main.tile[index2, index4 - 1].liquid == (int) byte.MaxValue && (int) Main.tile[index2, index4 - 2].liquid == (int) byte.MaxValue) && ((int) Main.tile[index2, index4 - 3].liquid == (int) byte.MaxValue && (int) Main.tile[index2, index4 - 4].liquid == (int) byte.MaxValue && WorldGen.PlaceTile(index2, index4, 81, true, false, -1, 0))) + NetMessage.SendTile(index2, index4); + } + else if (index2 > 400 && index2 < (int) Main.maxTilesX - 400 && WorldGen.genRand.Next(300) == 0) + WorldGen.GrowCactus(index2, index3); + } + } + else if (grass == 116 || grass == 112) + { + if ((int) Main.tile[index2, index4].active == 0 && index2 > 400 && (index2 < (int) Main.maxTilesX - 400 && WorldGen.genRand.Next(300) == 0)) + WorldGen.GrowCactus(index2, index3); + } + else if (grass == 78) + { + if ((int) Main.tile[index2, index4].active == 0 && WorldGen.PlaceTile(index2, index4, 3, true, false, -1, 0)) + NetMessage.SendTile(index2, index4); + } + else if (grass == 2 || grass == 23 || (grass == 32 || grass == 109)) + { + if ((int) Main.tile[index2, index4].active == 0 && WorldGen.genRand.Next(12) == 0 && (grass == 2 && WorldGen.PlaceTile(index2, index4, 3, true, false, -1, 0))) + NetMessage.SendTile(index2, index4); + if ((int) Main.tile[index2, index4].active == 0 && WorldGen.genRand.Next(10) == 0 && (grass == 23 && WorldGen.PlaceTile(index2, index4, 24, true, false, -1, 0))) + NetMessage.SendTile(index2, index4); + if ((int) Main.tile[index2, index4].active == 0 && WorldGen.genRand.Next(10) == 0 && (grass == 109 && WorldGen.PlaceTile(index2, index4, 110, true, false, -1, 0))) + NetMessage.SendTile(index2, index4); + bool flag2 = false; + for (int i = num2; i < num3; ++i) + { + for (int j = index4; j < num4; ++j) + { + if ((index2 != i || index3 != j) && (int) Main.tile[i, j].active != 0) + { + if (grass == 32) + grass = 23; + if ((int) Main.tile[i, j].type == 0 || grass == 23 && (int) Main.tile[i, j].type == 2 || grass == 23 && (int) Main.tile[i, j].type == 109) + { + WorldGen.SpreadGrass(i, j, 0, grass, false); + if (grass == 23) + { + WorldGen.SpreadGrass(i, j, 2, grass, false); + WorldGen.SpreadGrass(i, j, 109, grass, false); + } + if ((int) Main.tile[i, j].type == grass) + { + WorldGen.SquareTileFrame(i, j, -1); + flag2 = true; + } + } + if ((int) Main.tile[i, j].type == 0 || grass == 109 && (int) Main.tile[i, j].type == 2 || grass == 109 && (int) Main.tile[i, j].type == 23) + { + WorldGen.SpreadGrass(i, j, 0, grass, false); + if (grass == 109) + { + WorldGen.SpreadGrass(i, j, 2, grass, false); + WorldGen.SpreadGrass(i, j, 23, grass, false); + } + if ((int) Main.tile[i, j].type == grass) + { + WorldGen.SquareTileFrame(i, j, -1); + flag2 = true; + } + } + } + } + } + if (flag2) + NetMessage.SendTileSquare(index2, index3, 3); + } + else if (grass == 20) + { + if (WorldGen.genRand.Next(20) == 0 && !WorldGen.PlayerLOS(index2, index3)) + WorldGen.GrowTree(index2, index3); + } + else if (grass == 3 && WorldGen.genRand.Next(20) == 0) + { + if ((int) tilePtr->frameX < 144) + { + tilePtr->type = (byte) 73; + NetMessage.SendTileSquare(index2, index3, 3); + } + } + else if (grass == 110 && WorldGen.genRand.Next(20) == 0) + { + if ((int) tilePtr->frameX < 144) + { + tilePtr->type = (byte) 113; + NetMessage.SendTileSquare(index2, index3, 3); + } + } + else if (grass == 32 && WorldGen.genRand.Next(3) == 0) + { + int index5 = index2; + int index6 = index3; + int num5 = 0; + if ((int) Main.tile[index5 + 1, index6].active != 0 && (int) Main.tile[index5 + 1, index6].type == 32) + ++num5; + if ((int) Main.tile[index5 - 1, index6].active != 0 && (int) Main.tile[index5 - 1, index6].type == 32) + ++num5; + if ((int) Main.tile[index5, index6 + 1].active != 0 && (int) Main.tile[index5, index6 + 1].type == 32) + ++num5; + if ((int) Main.tile[index5, index6 - 1].active != 0 && (int) Main.tile[index5, index6 - 1].type == 32) + ++num5; + if (num5 < 3 || grass == 23) + { + switch (WorldGen.genRand.Next(4)) + { + case 0: + --index6; + break; + case 1: + ++index6; + break; + case 2: + --index5; + break; + case 3: + ++index5; + break; + } + if ((int) Main.tile[index5, index6].active == 0) + { + int num6 = 0; + if ((int) Main.tile[index5 + 1, index6].active != 0 && (int) Main.tile[index5 + 1, index6].type == 32) + num6 = 1; + if ((int) Main.tile[index5 - 1, index6].active != 0 && (int) Main.tile[index5 - 1, index6].type == 32) + ++num6; + if ((int) Main.tile[index5, index6 + 1].active != 0 && (int) Main.tile[index5, index6 + 1].type == 32) + ++num6; + if ((int) Main.tile[index5, index6 - 1].active != 0 && (int) Main.tile[index5, index6 - 1].type == 32) + ++num6; + if (num6 < 2) + { + int num7 = 7; + int num8 = index5 - num7; + int num9 = index5 + num7; + int num10 = index6 - num7; + int num11 = index6 + num7; + for (int index7 = num8; index7 < num9; ++index7) + { + for (int index8 = num10; index8 < num11; ++index8) + { + if (Math.Abs(index7 - index5) * 2 + Math.Abs(index8 - index6) < 9 && (int) Main.tile[index7, index8].active != 0 && ((int) Main.tile[index7, index8].type == 23 && (int) Main.tile[index7, index8 - 1].active != 0) && ((int) Main.tile[index7, index8 - 1].type == 32 && (int) Main.tile[index7, index8 - 1].liquid == 0)) + { + Main.tile[index5, index6].type = (byte) 32; + Main.tile[index5, index6].active = (byte) 1; + WorldGen.SquareTileFrame(index5, index6, -1); + NetMessage.SendTileSquare(index5, index6, 3); + break; + } + } + } + } + } + } + } + else if (grass == 2 || grass == 52) + { + if (WorldGen.genRand.Next(40) == 0 && (int) Main.tile[index2, index3 + 1].active == 0 && (int) Main.tile[index2, index3 + 1].lava == 0) + { + for (int index5 = index3; index5 > index3 - 10; --index5) + { + if ((int) Main.tile[index2, index5].active != 0 && (int) Main.tile[index2, index5].type == 2) + { + int index6 = index3 + 1; + Main.tile[index2, index6].type = (byte) 52; + Main.tile[index2, index6].active = (byte) 1; + WorldGen.SquareTileFrame(index2, index6, -1); + NetMessage.SendTileSquare(index2, index6, 3); + break; + } + } + } + } + else if (grass == 60) + { + if ((int) Main.tile[index2, index4].active == 0 && WorldGen.genRand.Next(7) == 0) + { + if (WorldGen.PlaceTile(index2, index4, 61, true, false, -1, 0)) + NetMessage.SendTile(index2, index4); + } + else if (WorldGen.genRand.Next(500) == 0 && ((int) Main.tile[index2, index4].active == 0 || (int) Main.tile[index2, index4].type == 61 || ((int) Main.tile[index2, index4].type == 74 || (int) Main.tile[index2, index4].type == 69)) && !WorldGen.PlayerLOS(index2, index3)) + WorldGen.GrowTree(index2, index3); + bool flag2 = false; + for (int i = num2; i < num3; ++i) + { + for (int j = index4; j < num4; ++j) + { + if ((index2 != i || index3 != j) && ((int) Main.tile[i, j].active != 0 && (int) Main.tile[i, j].type == 59)) + { + WorldGen.SpreadGrass(i, j, 59, grass, false); + if ((int) Main.tile[i, j].type == grass) + { + WorldGen.SquareTileFrame(i, j, -1); + flag2 = true; + } + } + } + } + if (flag2) + NetMessage.SendTileSquare(index2, index3, 3); + } + else if (grass == 61 && WorldGen.genRand.Next(3) == 0) + { + if ((int) tilePtr->frameX < 144) + { + tilePtr->type = (byte) 74; + NetMessage.SendTileSquare(index2, index3, 3); + } + } + else if (grass == 60 || grass == 62) + { + if (WorldGen.genRand.Next(15) == 0 && (int) Main.tile[index2, index3 + 1].active == 0 && (int) Main.tile[index2, index3 + 1].lava == 0) + { + for (int index5 = index3; index5 > index3 - 10; --index5) + { + if ((int) Main.tile[index2, index5].active != 0 && (int) Main.tile[index2, index5].type == 60) + { + int index6 = index3 + 1; + Main.tile[index2, index6].type = (byte) 62; + Main.tile[index2, index6].active = (byte) 1; + WorldGen.SquareTileFrame(index2, index6, -1); + NetMessage.SendTileSquare(index2, index6, 3); + break; + } + } + } + } + else if ((grass == 109 || grass == 115) && (WorldGen.genRand.Next(15) == 0 && (int) Main.tile[index2, index3 + 1].active == 0) && (int) Main.tile[index2, index3 + 1].lava == 0) + { + for (int index5 = index3; index5 > index3 - 10; --index5) + { + if ((int) Main.tile[index2, index5].active != 0 && (int) Main.tile[index2, index5].type == 109) + { + int index6 = index3 + 1; + Main.tile[index2, index6].type = (byte) 115; + Main.tile[index2, index6].active = (byte) 1; + WorldGen.SquareTileFrame(index2, index6, -1); + NetMessage.SendTileSquare(index2, index6, 3); + break; + } + } + } + } + else if (flag1 && WorldGen.spawnNPC > 0) + WorldGen.SpawnNPC(index2, index3); + } + } + float num12 = 1.5E-05f; + for (int index1 = (int) ((double) ((int) Main.maxTilesX * (int) Main.maxTilesY) * (double) num12); index1 > 0; --index1) + { + int index2 = WorldGen.genRand.Next(10, (int) Main.maxTilesX - 10); + int index3 = WorldGen.genRand.Next(Main.worldSurface - 1, (int) Main.maxTilesY - 20); + int num2 = index2 - 1; + int num3 = index2 + 2; + int index4 = index3 - 1; + int num4 = index3 + 2; + if (num2 < 10) + num2 = 10; + if (num3 > (int) Main.maxTilesX - 10) + num3 = (int) Main.maxTilesX - 10; + if (index4 < 10) + index4 = 10; + if (num4 > (int) Main.maxTilesY - 10) + num4 = (int) Main.maxTilesY - 10; + fixed (Tile* tilePtr = &Main.tile[index2, index3]) + { + int grass = (int) tilePtr->type; + if (grass >= 82 && grass <= 84) + WorldGen.GrowAlch(index2, index3); + if ((int) tilePtr->liquid <= 32) + { + if ((int) tilePtr->active != 0) + { + if (Main.hardMode) + WorldGen.hardUpdateWorld(index2, index3); + if (grass == 23) + { + if ((int) Main.tile[index2, index4].active == 0 && WorldGen.genRand.Next(1) == 0 && WorldGen.PlaceTile(index2, index4, 24, true, false, -1, 0)) + NetMessage.SendTile(index2, index4); + } + else if (grass == 32) + { + if (WorldGen.genRand.Next(3) == 0) + { + int index5 = index2; + int index6 = index3; + int num5 = 0; + if ((int) Main.tile[index5 + 1, index6].active != 0 && (int) Main.tile[index5 + 1, index6].type == 32) + ++num5; + if ((int) Main.tile[index5 - 1, index6].active != 0 && (int) Main.tile[index5 - 1, index6].type == 32) + ++num5; + if ((int) Main.tile[index5, index6 + 1].active != 0 && (int) Main.tile[index5, index6 + 1].type == 32) + ++num5; + if ((int) Main.tile[index5, index6 - 1].active != 0 && (int) Main.tile[index5, index6 - 1].type == 32) + ++num5; + if (num5 < 3 || grass == 23) + { + switch (WorldGen.genRand.Next(4)) + { + case 0: + --index6; + break; + case 1: + ++index6; + break; + case 2: + --index5; + break; + case 3: + ++index5; + break; + } + if ((int) Main.tile[index5, index6].active == 0) + { + int num6 = 0; + if ((int) Main.tile[index5 + 1, index6].active != 0 && (int) Main.tile[index5 + 1, index6].type == 32) + ++num6; + if ((int) Main.tile[index5 - 1, index6].active != 0 && (int) Main.tile[index5 - 1, index6].type == 32) + ++num6; + if ((int) Main.tile[index5, index6 + 1].active != 0 && (int) Main.tile[index5, index6 + 1].type == 32) + ++num6; + if ((int) Main.tile[index5, index6 - 1].active != 0 && (int) Main.tile[index5, index6 - 1].type == 32) + ++num6; + if (num6 < 2) + { + int num7 = 7; + int num8 = index5 - num7; + int num9 = index5 + num7; + int num10 = index6 - num7; + int num11 = index6 + num7; + for (int index7 = num8; index7 < num9; ++index7) + { + for (int index8 = num10; index8 < num11; ++index8) + { + if (Math.Abs(index7 - index5) * 2 + Math.Abs(index8 - index6) < 9 && (int) Main.tile[index7, index8].active != 0 && ((int) Main.tile[index7, index8].type == 23 && (int) Main.tile[index7, index8 - 1].active != 0) && ((int) Main.tile[index7, index8 - 1].type == 32 && (int) Main.tile[index7, index8 - 1].liquid == 0)) + { + Main.tile[index5, index6].type = (byte) 32; + Main.tile[index5, index6].active = (byte) 1; + WorldGen.SquareTileFrame(index5, index6, -1); + NetMessage.SendTileSquare(index5, index6, 3); + break; + } + } + } + } + } + } + } + } + else if (grass == 60) + { + if ((int) Main.tile[index2, index4].active == 0 && WorldGen.genRand.Next(10) == 0) + { + if (WorldGen.PlaceTile(index2, index4, 61, true, false, -1, 0)) + NetMessage.SendTile(index2, index4); + } + else + { + bool flag2 = false; + for (int i = num2; i < num3; ++i) + { + for (int j = index4; j < num4; ++j) + { + if ((index2 != i || index3 != j) && ((int) Main.tile[i, j].type == 59 && (int) Main.tile[i, j].active != 0)) + { + WorldGen.SpreadGrass(i, j, 59, grass, false); + if ((int) Main.tile[i, j].type == grass) + { + WorldGen.SquareTileFrame(i, j, -1); + flag2 = true; + } + } + } + } + if (flag2) + NetMessage.SendTileSquare(index2, index3, 3); + } + } + else if (grass == 61) + { + if ((int) tilePtr->frameX < 144 && WorldGen.genRand.Next(3) == 0) + { + tilePtr->type = (byte) 74; + NetMessage.SendTileSquare(index2, index3, 3); + } + } + else if (grass == 60 || grass == 62) + { + if (WorldGen.genRand.Next(5) == 0 && (int) Main.tile[index2, index3 + 1].active == 0 && (int) Main.tile[index2, index3 + 1].lava == 0) + { + for (int index5 = index3; index5 > index3 - 10; --index5) + { + if ((int) Main.tile[index2, index5].active != 0 && (int) Main.tile[index2, index5].type == 60) + { + int index6 = index3 + 1; + Main.tile[index2, index6].type = (byte) 62; + Main.tile[index2, index6].active = (byte) 1; + WorldGen.SquareTileFrame(index2, index6, -1); + NetMessage.SendTileSquare(index2, index6, 3); + break; + } + } + } + } + else if (grass == 69) + { + if (WorldGen.genRand.Next(3) == 0) + { + int index5 = index2; + int index6 = index3; + int num5 = 0; + if ((int) Main.tile[index5 + 1, index6].active != 0 && (int) Main.tile[index5 + 1, index6].type == 69) + ++num5; + if ((int) Main.tile[index5 - 1, index6].active != 0 && (int) Main.tile[index5 - 1, index6].type == 69) + ++num5; + if ((int) Main.tile[index5, index6 + 1].active != 0 && (int) Main.tile[index5, index6 + 1].type == 69) + ++num5; + if ((int) Main.tile[index5, index6 - 1].active != 0 && (int) Main.tile[index5, index6 - 1].type == 69) + ++num5; + if (num5 < 3 || grass == 60) + { + switch (WorldGen.genRand.Next(4)) + { + case 0: + --index6; + break; + case 1: + ++index6; + break; + case 2: + --index5; + break; + case 3: + ++index5; + break; + } + if ((int) Main.tile[index5, index6].active == 0) + { + int num6 = 0; + if ((int) Main.tile[index5 + 1, index6].active != 0 && (int) Main.tile[index5 + 1, index6].type == 69) + ++num6; + if ((int) Main.tile[index5 - 1, index6].active != 0 && (int) Main.tile[index5 - 1, index6].type == 69) + ++num6; + if ((int) Main.tile[index5, index6 + 1].active != 0 && (int) Main.tile[index5, index6 + 1].type == 69) + ++num6; + if ((int) Main.tile[index5, index6 - 1].active != 0 && (int) Main.tile[index5, index6 - 1].type == 69) + ++num6; + if (num6 < 2) + { + int num7 = 7; + int num8 = index5 - num7; + int num9 = index5 + num7; + int num10 = index6 - num7; + int num11 = index6 + num7; + for (int index7 = num8; index7 < num9; ++index7) + { + for (int index8 = num10; index8 < num11; ++index8) + { + if (Math.Abs(index7 - index5) * 2 + Math.Abs(index8 - index6) < 9 && (int) Main.tile[index7, index8].active != 0 && ((int) Main.tile[index7, index8].type == 60 && (int) Main.tile[index7, index8 - 1].active != 0) && ((int) Main.tile[index7, index8 - 1].type == 69 && (int) Main.tile[index7, index8 - 1].liquid == 0)) + { + Main.tile[index5, index6].type = (byte) 69; + Main.tile[index5, index6].active = (byte) 1; + WorldGen.SquareTileFrame(index5, index6, -1); + NetMessage.SendTileSquare(index5, index6, 3); + break; + } + } + } + } + } + } + } + } + else if (grass == 70) + { + if ((int) Main.tile[index2, index4].active == 0 && WorldGen.genRand.Next(10) == 0) + { + if (WorldGen.PlaceTile(index2, index4, 71, true, false, -1, 0)) + NetMessage.SendTile(index2, index4); + } + else if (WorldGen.genRand.Next(200) == 0 && !WorldGen.PlayerLOS(index2, index3)) + { + WorldGen.GrowShroom(index2, index3); + } + else + { + bool flag2 = false; + for (int i = num2; i < num3; ++i) + { + for (int j = index4; j < num4; ++j) + { + if ((index2 != i || index3 != j) && ((int) Main.tile[i, j].active != 0 && (int) Main.tile[i, j].type == 59)) + { + WorldGen.SpreadGrass(i, j, 59, grass, false); + if ((int) Main.tile[i, j].type == grass) + { + WorldGen.SquareTileFrame(i, j, -1); + flag2 = true; + } + } + } + } + if (flag2) + NetMessage.SendTileSquare(index2, index3, 3); + } + } + } + else if (flag1 && WorldGen.spawnNPC > 0) + WorldGen.SpawnNPC(index2, index3); + } + } + } + if (Main.rand.Next(100) == 0) + WorldGen.PlantAlch(); + if (Main.gameTime.dayTime) + return; + float num13 = (float) Main.maxTilesX / 4200f; + if ((double) Main.rand.Next(8000) >= 10.0 * (double) num13) + return; + int num14 = 12; + Vector2 vector2 = new Vector2((float) ((Main.rand.Next((int) Main.maxTilesX - 50) + 100) * 16), (float) (Main.rand.Next((int) ((double) Main.maxTilesY * 0.05)) * 16)); + float num15 = (float) Main.rand.Next(-100, 101); + float num16 = (float) (Main.rand.Next(200) + 100); + float num17 = (float) Math.Sqrt((double) num15 * (double) num15 + (double) num16 * (double) num16); + float num18 = (float) num14 / num17; + float SpeedX = num15 * num18; + float SpeedY = num16 * num18; + Projectile.NewProjectile(vector2.X, vector2.Y, SpeedX, SpeedY, 12, 1000, 10f, 8, true); + } + + public static bool PlaceWall(int i, int j, int type) + { + if (i <= 1 || j <= 1 || (i >= (int) Main.maxTilesX - 2 || j >= (int) Main.maxTilesY - 2) || (int) Main.tile[i, j].wall != 0) + return false; + Main.tile[i, j].wall = (byte) type; + WorldGen.WallFrame(i - 1, j - 1, false); + WorldGen.WallFrame(i - 1, j, false); + WorldGen.WallFrame(i - 1, j + 1, false); + WorldGen.WallFrame(i, j - 1, false); + WorldGen.WallFrame(i, j, true); + WorldGen.WallFrame(i, j + 1, false); + WorldGen.WallFrame(i + 1, j - 1, false); + WorldGen.WallFrame(i + 1, j, false); + WorldGen.WallFrame(i + 1, j + 1, false); + Main.PlaySound(0, i << 4, j << 4, 1); + return true; + } + + public static unsafe void AddPlants() + { + Tile[,] tileArray; + // ISSUE: cast to a reference type + // ISSUE: explicit reference operation + fixed (Tile* tilePtr1 = &^((tileArray = Main.tile) == null || tileArray.Length == 0 ? (Tile&) IntPtr.Zero : tileArray.Address(0, 0))) + { + for (int i = 0; i < (int) Main.maxTilesX; ++i) + { + Tile* tilePtr2 = tilePtr1 + (i * 1440 + 5); + int num = 5; + while (num < (int) Main.maxTilesY) + { + if ((int) tilePtr2->active != 0) + { + if ((int) tilePtr2->type == 2) + { + Tile* tilePtr3 = tilePtr2 - 1; + if ((int) tilePtr3->active == 0) + WorldGen.PlaceTile(i, num - 1, 3, true, false, -1, 0); + tilePtr2 = tilePtr3 + 1; + } + else if ((int) tilePtr2->type == 23) + { + Tile* tilePtr3 = tilePtr2 - 1; + if ((int) tilePtr3->active == 0) + WorldGen.PlaceTile(i, num - 1, 24, true, false, -1, 0); + tilePtr2 = tilePtr3 + 1; + } + } + ++num; + ++tilePtr2; + } + } + } + } + + public static void SpreadGrass(int i, int j, int dirt = 0, int grass = 2, bool repeat = true) + { + try + { + if ((int) Main.tile[i, j].type != dirt || (int) Main.tile[i, j].active == 0 || j < Main.worldSurface && grass == 70 || j >= Main.worldSurface && dirt == 0) + return; + int num1 = i - 1; + int num2 = i + 2; + int num3 = j - 1; + int num4 = j + 2; + if (num1 < 0) + num1 = 0; + if (num2 > (int) Main.maxTilesX) + num2 = (int) Main.maxTilesX; + if (num3 < 0) + num3 = 0; + if (num4 > (int) Main.maxTilesY) + num4 = (int) Main.maxTilesY; + bool flag = true; + for (int index1 = num1; index1 < num2; ++index1) + { + for (int index2 = num3; index2 < num4; ++index2) + { + if ((int) Main.tile[index1, index2].active == 0 || !Main.tileSolid[(int) Main.tile[index1, index2].type]) + flag = false; + if ((int) Main.tile[index1, index2].lava != 0 && (int) Main.tile[index1, index2].liquid > 0) + { + flag = true; + break; + } + } + } + if (flag || grass == 23 && (int) Main.tile[i, j - 1].type == 27) + return; + Main.tile[i, j].type = (byte) grass; + for (int i1 = num1; i1 < num2; ++i1) + { + for (int j1 = num3; j1 < num4; ++j1) + { + if ((int) Main.tile[i1, j1].active != 0) + { + if ((int) Main.tile[i1, j1].type == dirt) + { + try + { + if (repeat) + { + if (WorldGen.grassSpread < 400) + { + ++WorldGen.grassSpread; + WorldGen.SpreadGrass(i1, j1, dirt, grass, true); + --WorldGen.grassSpread; + } + } + } + catch + { + } + } + } + } + } + } + catch + { + } + } + + public static void ChasmRunnerSideways(int i, int j, int direction, int steps) + { + Vector2 vector2_1 = new Vector2(); + Vector2 vector2_2 = new Vector2(); + float num1 = (float) steps; + vector2_1.X = (float) i; + vector2_1.Y = (float) j; + vector2_2.X = (float) WorldGen.genRand.Next(10, 21) * 0.1f * (float) direction; + vector2_2.Y = (float) WorldGen.genRand.Next(-10, 10) * 0.01f; + int num2 = WorldGen.genRand.Next(5) + 7; + while (num2 > 0) + { + if ((double) num1 > 0.0) + { + num2 = num2 + WorldGen.genRand.Next(3) - WorldGen.genRand.Next(3); + if (num2 < 7) + num2 = 7; + else if (num2 > 20) + num2 = 20; + if ((double) num1 == 1.0 && num2 < 10) + num2 = 10; + } + else + num2 -= WorldGen.genRand.Next(4); + if ((double) vector2_1.Y > (double) Main.rockLayer && (double) num1 > 0.0) + num1 = 0.0f; + --num1; + int num3 = (int) ((double) vector2_1.X - (double) num2 * 0.5); + int num4 = (int) ((double) vector2_1.X + (double) num2 * 0.5); + int num5 = (int) ((double) vector2_1.Y - (double) num2 * 0.5); + int num6 = (int) ((double) vector2_1.Y + (double) num2 * 0.5); + if (num3 < 0) + num3 = 0; + if (num4 > (int) Main.maxTilesX - 1) + num4 = (int) Main.maxTilesX - 1; + if (num5 < 0) + num5 = 0; + if (num6 > (int) Main.maxTilesY) + num6 = (int) Main.maxTilesY; + for (int index1 = num3; index1 < num4; ++index1) + { + for (int index2 = num5; index2 < num6; ++index2) + { + if ((double) Math.Abs((float) index1 - vector2_1.X) + (double) Math.Abs((float) index2 - vector2_1.Y) < (double) num2 * 0.5 * (1.0 + (double) WorldGen.genRand.Next(-10, 11) * 0.0149999996647239) && (int) Main.tile[index1, index2].type != 31 && (int) Main.tile[index1, index2].type != 22) + Main.tile[index1, index2].active = (byte) 0; + } + } + vector2_1.X += vector2_2.X; + vector2_1.Y += vector2_2.Y; + vector2_2.Y += (float) WorldGen.genRand.Next(-10, 10) * 0.1f; + if ((double) vector2_1.Y < (double) (j - 20)) + vector2_2.Y += (float) WorldGen.genRand.Next(20) * 0.01f; + else if ((double) vector2_1.Y > (double) (j + 20)) + vector2_2.Y -= (float) WorldGen.genRand.Next(20) * 0.01f; + if ((double) vector2_2.Y < -0.5) + vector2_2.Y = -0.5f; + else if ((double) vector2_2.Y > 0.5) + vector2_2.Y = 0.5f; + vector2_2.X += (float) WorldGen.genRand.Next(-10, 11) * 0.01f; + if (direction == -1) + { + if ((double) vector2_2.X > -0.5) + vector2_2.X = -0.5f; + else if ((double) vector2_2.X < -2.0) + vector2_2.X = -2f; + } + else if (direction == 1) + { + if ((double) vector2_2.X < 0.5) + vector2_2.X = 0.5f; + else if ((double) vector2_2.X > 2.0) + vector2_2.X = 2f; + } + int num7 = (int) ((double) vector2_1.X - (double) num2 * 1.10000002384186); + int num8 = (int) ((double) vector2_1.X + (double) num2 * 1.10000002384186); + int num9 = (int) ((double) vector2_1.Y - (double) num2 * 1.10000002384186); + int num10 = (int) ((double) vector2_1.Y + (double) num2 * 1.10000002384186); + if (num7 < 1) + num7 = 1; + if (num8 > (int) Main.maxTilesX - 1) + num8 = (int) Main.maxTilesX - 1; + if (num9 < 0) + num9 = 0; + if (num10 > (int) Main.maxTilesY) + num10 = (int) Main.maxTilesY; + for (int index1 = num7; index1 < num8; ++index1) + { + for (int index2 = num9; index2 < num10; ++index2) + { + if ((double) Math.Abs((float) index1 - vector2_1.X) + (double) Math.Abs((float) index2 - vector2_1.Y) < (double) num2 * 1.10000002384186 * (1.0 + (double) WorldGen.genRand.Next(-10, 11) * 0.0149999996647239) && (int) Main.tile[index1, index2].wall != 3) + { + if ((int) Main.tile[index1, index2].type != 25 && index2 > j + WorldGen.genRand.Next(3, 20)) + Main.tile[index1, index2].active = (byte) 1; + Main.tile[index1, index2].active = (byte) 1; + if ((int) Main.tile[index1, index2].type != 31 && (int) Main.tile[index1, index2].type != 22) + Main.tile[index1, index2].type = (byte) 25; + if ((int) Main.tile[index1, index2].wall == 2) + Main.tile[index1, index2].wall = (byte) 0; + } + } + } + for (int index1 = num7; index1 < num8; ++index1) + { + for (int index2 = num9; index2 < num10; ++index2) + { + if ((double) Math.Abs((float) index1 - vector2_1.X) + (double) Math.Abs((float) index2 - vector2_1.Y) < (double) num2 * 1.10000002384186 * (1.0 + (double) WorldGen.genRand.Next(-10, 11) * 0.0149999996647239) && (int) Main.tile[index1, index2].wall != 3) + { + if ((int) Main.tile[index1, index2].type != 31 && (int) Main.tile[index1, index2].type != 22) + Main.tile[index1, index2].type = (byte) 25; + Main.tile[index1, index2].active = (byte) 1; + if ((int) Main.tile[index1, index2].wall == 0) + Main.tile[index1, index2].wall = (byte) 3; + } + } + } + } + if (WorldGen.genRand.Next(3) != 0) + return; + int i1 = (int) vector2_1.X; + int j1 = (int) vector2_1.Y; + while ((int) Main.tile[i1, j1].active == 0) + ++j1; + WorldGen.TileRunner(i1, j1, WorldGen.genRand.Next(2, 6), WorldGen.genRand.Next(3, 7), 22, false, new Vector2(), false, true); + } + + public static void ChasmRunner(int i, int j, int steps, bool makeOrb = false) + { + bool flag1 = false; + bool flag2 = !makeOrb; + Vector2 vector2_1 = new Vector2((float) i, (float) j); + Vector2 vector2_2 = new Vector2(); + float num1 = (float) steps; + vector2_2.X = (float) WorldGen.genRand.Next(-10, 11) * 0.1f; + vector2_2.Y = (float) ((double) WorldGen.genRand.Next(11) * 0.200000002980232 + 0.5); + int num2 = 5; + int num3 = WorldGen.genRand.Next(5) + 7; + while (num3 > 0) + { + if ((double) num1 > 0.0) + { + num3 = num3 + WorldGen.genRand.Next(3) - WorldGen.genRand.Next(3); + if (num3 < 7) + num3 = 7; + else if (num3 > 20) + num3 = 20; + if ((double) num1 == 1.0 && num3 < 10) + num3 = 10; + } + else if ((double) vector2_1.Y > (double) (Main.worldSurface + 45)) + num3 -= WorldGen.genRand.Next(4); + if ((double) vector2_1.Y > (double) Main.rockLayer && (double) num1 > 0.0) + num1 = 0.0f; + --num1; + if (!flag1 && (double) vector2_1.Y > (double) (Main.worldSurface + 20)) + { + flag1 = true; + WorldGen.ChasmRunnerSideways((int) vector2_1.X, (int) vector2_1.Y, -1, WorldGen.genRand.Next(20, 40)); + WorldGen.ChasmRunnerSideways((int) vector2_1.X, (int) vector2_1.Y, 1, WorldGen.genRand.Next(20, 40)); + } + if ((double) num1 > (double) num2) + { + int num4 = (int) ((double) vector2_1.X - (double) num3 * 0.5); + int num5 = (int) ((double) vector2_1.X + (double) num3 * 0.5); + int num6 = (int) ((double) vector2_1.Y - (double) num3 * 0.5); + int num7 = (int) ((double) vector2_1.Y + (double) num3 * 0.5); + if (num4 < 0) + num4 = 0; + if (num5 > (int) Main.maxTilesX - 1) + num5 = (int) Main.maxTilesX - 1; + if (num6 < 0) + num6 = 0; + if (num7 > (int) Main.maxTilesY) + num7 = (int) Main.maxTilesY; + for (int index1 = num4; index1 < num5; ++index1) + { + for (int index2 = num6; index2 < num7; ++index2) + { + if ((double) Math.Abs((float) index1 - vector2_1.X) + (double) Math.Abs((float) index2 - vector2_1.Y) < (double) num3 * 0.5 * (1.0 + (double) WorldGen.genRand.Next(-10, 11) * 0.0149999996647239) && (int) Main.tile[index1, index2].type != 31 && (int) Main.tile[index1, index2].type != 22) + Main.tile[index1, index2].active = (byte) 0; + } + } + } + if ((double) num1 <= 2.0 && (double) vector2_1.Y < (double) (Main.worldSurface + 45)) + num1 = 2f; + if ((double) num1 <= 0.0) + { + if (!flag2) + { + flag2 = true; + WorldGen.AddShadowOrb((int) vector2_1.X, (int) vector2_1.Y); + } + else + { + for (int index = 0; index < 10000; ++index) + { + int y = WorldGen.genRand.Next((int) vector2_1.Y - 50, (int) vector2_1.Y); + if (y > Main.worldSurface) + { + if (y > (int) Main.maxTilesY - 5) + y = (int) Main.maxTilesY - 5; + int x = WorldGen.genRand.Next((int) vector2_1.X - 25, (int) vector2_1.X + 25); + if (x < 5) + x = 5; + else if (x > (int) Main.maxTilesX - 5) + x = (int) Main.maxTilesX - 5; + if (WorldGen.Place3x2(x, y, 26)) + break; + } + else + break; + } + } + } + vector2_1.X += vector2_2.X; + vector2_1.Y += vector2_2.Y; + vector2_2.X += (float) WorldGen.genRand.Next(-10, 11) * 0.01f; + if ((double) vector2_2.X > 0.300000011920929) + vector2_2.X = 0.3f; + else if ((double) vector2_2.X < -0.300000011920929) + vector2_2.X = -0.3f; + int num8 = (int) ((double) vector2_1.X - (double) num3 * 1.10000002384186); + int num9 = (int) ((double) vector2_1.X + (double) num3 * 1.10000002384186); + int num10 = (int) ((double) vector2_1.Y - (double) num3 * 1.10000002384186); + int num11 = (int) ((double) vector2_1.Y + (double) num3 * 1.10000002384186); + if (num8 < 1) + num8 = 1; + if (num9 > (int) Main.maxTilesX - 1) + num9 = (int) Main.maxTilesX - 1; + if (num10 < 0) + num10 = 0; + if (num11 > (int) Main.maxTilesY) + num11 = (int) Main.maxTilesY; + for (int index1 = num8; index1 < num9; ++index1) + { + for (int index2 = num10; index2 < num11; ++index2) + { + if ((double) Math.Abs((float) index1 - vector2_1.X) + (double) Math.Abs((float) index2 - vector2_1.Y) < (double) num3 * 1.10000002384186 * (1.0 + (double) WorldGen.genRand.Next(-10, 11) * 0.0149999996647239)) + { + if ((int) Main.tile[index1, index2].type != 25 && index2 > j + WorldGen.genRand.Next(3, 20)) + Main.tile[index1, index2].active = (byte) 1; + if (steps <= num2) + Main.tile[index1, index2].active = (byte) 1; + if ((int) Main.tile[index1, index2].type != 31) + Main.tile[index1, index2].type = (byte) 25; + if ((int) Main.tile[index1, index2].wall == 2) + Main.tile[index1, index2].wall = (byte) 0; + } + } + } + for (int index1 = num8; index1 < num9; ++index1) + { + for (int index2 = num10; index2 < num11; ++index2) + { + if ((double) Math.Abs((float) index1 - vector2_1.X) + (double) Math.Abs((float) index2 - vector2_1.Y) < (double) num3 * 1.10000002384186 * (1.0 + (double) WorldGen.genRand.Next(-10, 11) * 0.0149999996647239)) + { + if ((int) Main.tile[index1, index2].type != 31) + Main.tile[index1, index2].type = (byte) 25; + if (steps <= num2) + Main.tile[index1, index2].active = (byte) 1; + if (index2 > j + WorldGen.genRand.Next(3, 20) && (int) Main.tile[index1, index2].wall == 0) + Main.tile[index1, index2].wall = (byte) 3; + } + } + } + } + } + + public static void JungleRunner(int i, int j) + { + Vector2 vector2_1 = new Vector2((float) i, (float) j); + Vector2 vector2_2 = new Vector2(); + double num1 = (double) WorldGen.genRand.Next(5, 11); + vector2_2.X = (float) WorldGen.genRand.Next(-10, 11) * 0.1f; + vector2_2.Y = (float) WorldGen.genRand.Next(10, 20) * 0.1f; + int num2 = 0; + bool flag = true; + do + { + int index1 = (int) vector2_1.X; + int index2 = (int) vector2_1.Y; + if (index2 < Main.worldSurface && (int) Main.tile[index1, index2].wall == 0 && ((int) Main.tile[index1, index2].active == 0 && (int) Main.tile[index1, index2 - 3].wall == 0) && ((int) Main.tile[index1, index2 - 3].active == 0 && (int) Main.tile[index1, index2 - 1].wall == 0 && ((int) Main.tile[index1, index2 - 1].active == 0 && (int) Main.tile[index1, index2 - 4].wall == 0)) && ((int) Main.tile[index1, index2 - 4].active == 0 && (int) Main.tile[index1, index2 - 2].wall == 0 && ((int) Main.tile[index1, index2 - 2].active == 0 && (int) Main.tile[index1, index2 - 5].wall == 0) && (int) Main.tile[index1, index2 - 5].active == 0)) + flag = false; + WorldGen.JungleX = index1; + num1 += (double) WorldGen.genRand.Next(-20, 21) * 0.100000001490116; + if (num1 < 5.0) + num1 = 5.0; + else if (num1 > 10.0) + num1 = 10.0; + int num3 = (int) ((double) vector2_1.X - num1 * 0.5); + int num4 = (int) ((double) vector2_1.X + num1 * 0.5); + int num5 = (int) ((double) vector2_1.Y - num1 * 0.5); + int num6 = (int) ((double) vector2_1.Y + num1 * 0.5); + if (num3 < 0) + num3 = 0; + if (num4 > (int) Main.maxTilesX) + num4 = (int) Main.maxTilesX; + if (num5 < 0) + num5 = 0; + if (num6 > (int) Main.maxTilesY) + num6 = (int) Main.maxTilesY; + for (int i1 = num3; i1 < num4; ++i1) + { + for (int j1 = num5; j1 < num6; ++j1) + { + if ((double) Math.Abs((float) i1 - vector2_1.X) + (double) Math.Abs((float) j1 - vector2_1.Y) < num1 * 0.5 * (1.0 + (double) WorldGen.genRand.Next(-10, 11) * 0.015)) + WorldGen.KillTileFast(i1, j1); + } + } + if (++num2 > 10 && WorldGen.genRand.Next(50) < num2) + { + num2 = 0; + int num7 = -2; + if (WorldGen.genRand.Next(2) == 0) + num7 = 2; + WorldGen.TileRunner((int) vector2_1.X, (int) vector2_1.Y, WorldGen.genRand.Next(3, 20), WorldGen.genRand.Next(10, 100), -1, false, new Vector2((float) num7, 0.0f), false, true); + } + vector2_1.X += vector2_2.X; + vector2_1.Y += vector2_2.Y; + vector2_2.Y += (float) WorldGen.genRand.Next(-10, 11) * 0.01f; + if ((double) vector2_2.Y > 0.0) + vector2_2.Y = 0.0f; + else if ((double) vector2_2.Y < -2.0) + vector2_2.Y = -2f; + vector2_2.X += (float) WorldGen.genRand.Next(-10, 11) * 0.1f; + if ((double) vector2_1.X < (double) (i - 200)) + vector2_2.X += (float) WorldGen.genRand.Next(5, 21) * 0.1f; + if ((double) vector2_1.X > (double) (i + 200)) + vector2_2.X -= (float) WorldGen.genRand.Next(5, 21) * 0.1f; + if ((double) vector2_2.X > 1.5) + vector2_2.X = 1.5f; + else if ((double) vector2_2.X < -1.5) + vector2_2.X = -1.5f; + } + while (flag); + } + + public static void GERunner(int i, Vector2 speed, bool good, ref Vector2i minArea, ref Vector2i maxArea) + { + Vector2 vector2_1 = new Vector2((float) i, 0.0f); + Vector2 vector2_2 = speed; + int num1 = (int) ((double) WorldGen.genRand.Next(200, 250) * (double) ((float) Main.maxTilesX * 0.0002380952f)); + int num2 = num1; + while (true) + { + do + { + int num3 = (int) ((double) vector2_1.X - (double) num2 * 0.5); + int num4 = (int) ((double) vector2_1.X + (double) num2 * 0.5); + int num5 = (int) ((double) vector2_1.Y - (double) num2 * 0.5); + int num6 = (int) ((double) vector2_1.Y + (double) num2 * 0.5); + if (num3 < 0) + num3 = 0; + if (num4 > (int) Main.maxTilesX) + num4 = (int) Main.maxTilesX; + if (num5 < 0) + num5 = 0; + if (num6 > (int) Main.maxTilesY) + num6 = (int) Main.maxTilesY; + for (int i1 = num3; i1 < num4; ++i1) + { + for (int j = num5; j < num6; ++j) + { + if ((double) Math.Abs((float) i1 - vector2_1.X) + (double) Math.Abs((float) j - vector2_1.Y) < (double) num1 * 0.5 * (1.0 + (double) WorldGen.genRand.Next(-10, 11) * 0.015)) + { + int num7 = 0; + if (good) + { + if ((int) Main.tile[i1, j].wall == 3) + Main.tile[i1, j].wall = (byte) 28; + byte num8 = Main.tile[i1, j].type; + if ((uint) num8 <= 25U) + { + switch (num8) + { + case (byte) 1: + case (byte) 25: + num7 = 117; + break; + case (byte) 2: + case (byte) 23: + num7 = 109; + break; + } + } + else if ((int) num8 == 53 || (int) num8 == 112 || (int) num8 == 123) + num7 = 116; + } + else + { + byte num8 = Main.tile[i1, j].type; + if ((uint) num8 <= 53U) + { + switch (num8) + { + case (byte) 1: + break; + case (byte) 2: + goto label_25; + case (byte) 53: + goto label_26; + default: + goto label_27; + } + } + else + { + switch (num8) + { + case (byte) 109: + goto label_25; + case (byte) 116: + case (byte) 123: + goto label_26; + case (byte) 117: + break; + default: + goto label_27; + } + } + num7 = 25; + goto label_27; +label_25: + num7 = 23; + goto label_27; +label_26: + num7 = 112; + } +label_27: + if (num7 > 0) + { + if (i1 < minArea.X) + minArea.X = i1; + if (j < minArea.Y) + minArea.Y = j; + if (i1 > maxArea.X) + maxArea.X = i1; + if (j > maxArea.Y) + maxArea.Y = j; + Main.tile[i1, j].type = (byte) num7; + WorldGen.SquareTileFrameNoLiquid(i1, j, -1); + } + } + } + } + vector2_1.X += vector2_2.X; + vector2_1.Y += vector2_2.Y; + if ((double) vector2_1.X >= (double) -num1 && (double) vector2_1.Y >= (double) -num1 && ((double) vector2_1.X <= (double) ((int) Main.maxTilesX + num1) && (double) vector2_1.Y <= (double) ((int) Main.maxTilesX + num1))) + { + vector2_2.X += (float) WorldGen.genRand.Next(-10, 11) * 0.05f; + if ((double) vector2_2.X > (double) speed.X + 1.0) + vector2_2.X = speed.X + 1f; + } + else + goto label_42; + } + while ((double) vector2_2.X >= (double) speed.X - 1.0); + vector2_2.X = speed.X - 1f; + } +label_42:; + } + + public static unsafe void TileRunner(int i, int j, int strength, int steps, int type, bool addTile = false, Vector2 velocity = null, bool noYChange = false, bool overRide = true) + { + Vector2 vector2 = new Vector2((float) i, (float) j); + float num1 = (float) strength; + int num2 = steps; + float num3 = 1f / (float) steps; + if ((double) velocity.X == 0.0 && (double) velocity.Y == 0.0) + { + velocity.X = (float) WorldGen.genRand.Next(-10, 11) * 0.1f; + velocity.Y = (float) WorldGen.genRand.Next(-10, 11) * 0.1f; + } + while ((double) num1 > 0.0 && num2 > 0) + { + if ((double) vector2.Y < 0.0 && type == 59) + num2 = 0; + num1 = (float) strength * ((float) num2 * num3); + --num2; + int num4 = (int) ((double) vector2.Y - (double) num1 * 0.5); + int num5 = (int) ((double) vector2.Y + (double) num1 * 0.5); + if (num4 < 0) + num4 = 0; + if (num5 > (int) Main.maxTilesY) + num5 = (int) Main.maxTilesY; + if (num4 < num5) + { + int num6 = (int) ((double) vector2.X - (double) num1 * 0.5); + int num7 = (int) ((double) vector2.X + (double) num1 * 0.5); + if (num6 < 0) + num6 = 0; + if (num7 > (int) Main.maxTilesX) + num7 = (int) Main.maxTilesX; + Tile[,] tileArray; + // ISSUE: cast to a reference type + // ISSUE: explicit reference operation + fixed (Tile* tilePtr1 = &^((tileArray = Main.tile) == null || tileArray.Length == 0 ? (Tile&) IntPtr.Zero : tileArray.Address(0, 0))) + { + for (int index = num6; index < num7; ++index) + { + int num8 = num4; + Tile* tilePtr2 = tilePtr1 + (index * 1440 + num8); + do + { + if ((double) Math.Abs((float) index - vector2.X) + (double) Math.Abs((float) num8 - vector2.Y) < (double) strength * 0.5 * (1.0 + (double) WorldGen.genRand.Next(-10, 11) * 0.0149999996647239)) + { + if (WorldGen.mudWall && num8 > Main.worldSurface && (num8 < (int) Main.maxTilesY - 210 - WorldGen.genRand.Next(3) && (int) tilePtr2->wall == 0)) + tilePtr2->wall = (byte) 15; + if (type < 0) + { + if (type == -2 && (int) tilePtr2->active != 0 && (num8 < WorldGen.waterLine || num8 > WorldGen.lavaLine)) + { + tilePtr2->liquid = byte.MaxValue; + if (num8 > WorldGen.lavaLine) + tilePtr2->lava = (byte) 32; + } + tilePtr2->active = (byte) 0; + } + else + { + if (overRide || (int) tilePtr2->active == 0) + { + int num9 = (int) tilePtr2->type; + if ((type != 40 || num9 != 53) && (!Main.tileStone[type] || num9 == 1) && (num9 != 45 && num9 != 147) && (num9 != 1 || type != 59 || num8 >= Main.worldSurface + WorldGen.genRand.Next(-50, 50))) + { + if (num9 != 53 || num8 >= Main.worldSurface) + tilePtr2->type = (byte) type; + else if (type == 59) + tilePtr2->type = (byte) type; + } + } + if (addTile) + { + tilePtr2->active = (byte) 1; + tilePtr2->liquid = (byte) 0; + tilePtr2->lava = (byte) 0; + } + if (type == 59) + { + if (num8 > WorldGen.waterLine && (int) tilePtr2->liquid > 0) + { + tilePtr2->liquid = (byte) 0; + tilePtr2->lava = (byte) 0; + } + } + else if (noYChange && num8 < Main.worldSurface) + tilePtr2->wall = (byte) 2; + } + } + ++tilePtr2; + } + while (++num8 < num5); + } + } + } + vector2.X += velocity.X; + vector2.Y += velocity.Y; + if ((double) num1 > 50.0) + { + vector2.X += velocity.X; + vector2.Y += velocity.Y; + --num2; + velocity.Y += (float) WorldGen.genRand.Next(-10, 11) * 0.05f; + velocity.X += (float) WorldGen.genRand.Next(-10, 11) * 0.05f; + if ((double) num1 > 100.0) + { + vector2.X += velocity.X; + vector2.Y += velocity.Y; + --num2; + velocity.Y += (float) WorldGen.genRand.Next(-10, 11) * 0.05f; + velocity.X += (float) WorldGen.genRand.Next(-10, 11) * 0.05f; + if ((double) num1 > 150.0) + { + vector2.X += velocity.X; + vector2.Y += velocity.Y; + --num2; + velocity.Y += (float) WorldGen.genRand.Next(-10, 11) * 0.05f; + velocity.X += (float) WorldGen.genRand.Next(-10, 11) * 0.05f; + if ((double) num1 > 200.0) + { + vector2.X += velocity.X; + vector2.Y += velocity.Y; + --num2; + velocity.Y += (float) WorldGen.genRand.Next(-10, 11) * 0.05f; + velocity.X += (float) WorldGen.genRand.Next(-10, 11) * 0.05f; + if ((double) num1 > 250.0) + { + vector2.X += velocity.X; + vector2.Y += velocity.Y; + --num2; + velocity.Y += (float) WorldGen.genRand.Next(-10, 11) * 0.05f; + velocity.X += (float) WorldGen.genRand.Next(-10, 11) * 0.05f; + if ((double) num1 > 300.0) + { + vector2.X += velocity.X; + vector2.Y += velocity.Y; + --num2; + velocity.Y += (float) WorldGen.genRand.Next(-10, 11) * 0.05f; + velocity.X += (float) WorldGen.genRand.Next(-10, 11) * 0.05f; + if ((double) num1 > 400.0) + { + vector2.X += velocity.X; + vector2.Y += velocity.Y; + --num2; + velocity.Y += (float) WorldGen.genRand.Next(-10, 11) * 0.05f; + velocity.X += (float) WorldGen.genRand.Next(-10, 11) * 0.05f; + if ((double) num1 > 500.0) + { + vector2.X += velocity.X; + vector2.Y += velocity.Y; + --num2; + velocity.Y += (float) WorldGen.genRand.Next(-10, 11) * 0.05f; + velocity.X += (float) WorldGen.genRand.Next(-10, 11) * 0.05f; + if ((double) num1 > 600.0) + { + vector2.X += velocity.X; + vector2.Y += velocity.Y; + --num2; + velocity.Y += (float) WorldGen.genRand.Next(-10, 11) * 0.05f; + velocity.X += (float) WorldGen.genRand.Next(-10, 11) * 0.05f; + if ((double) num1 > 700.0) + { + vector2.X += velocity.X; + vector2.Y += velocity.Y; + --num2; + velocity.Y += (float) WorldGen.genRand.Next(-10, 11) * 0.05f; + velocity.X += (float) WorldGen.genRand.Next(-10, 11) * 0.05f; + if ((double) num1 > 800.0) + { + vector2.X += velocity.X; + vector2.Y += velocity.Y; + --num2; + velocity.Y += (float) WorldGen.genRand.Next(-10, 11) * 0.05f; + velocity.X += (float) WorldGen.genRand.Next(-10, 11) * 0.05f; + if ((double) num1 > 900.0) + { + vector2.X += velocity.X; + vector2.Y += velocity.Y; + --num2; + velocity.Y += (float) WorldGen.genRand.Next(-10, 11) * 0.05f; + velocity.X += (float) WorldGen.genRand.Next(-10, 11) * 0.05f; + } + } + } + } + } + } + } + } + } + } + } + } + velocity.X += (float) WorldGen.genRand.Next(-10, 11) * 0.05f; + if ((double) velocity.X > 1.0) + velocity.X = 1f; + else if ((double) velocity.X < -1.0) + velocity.X = -1f; + if (!noYChange) + { + velocity.Y += (float) WorldGen.genRand.Next(-10, 11) * 0.05f; + if ((double) velocity.Y > 1.0) + velocity.Y = 1f; + else if ((double) velocity.Y < -1.0) + velocity.Y = -1f; + if (type == 59) + { + int num6 = (int) vector2.Y; + if (num6 < Main.rockLayer + 100) + velocity.Y = 1f; + else if (num6 > (int) Main.maxTilesY - 300) + velocity.Y = -1f; + else if ((double) velocity.Y > 0.5) + velocity.Y = 0.5f; + else if ((double) velocity.Y < -0.5) + velocity.Y = -0.5f; + } + } + else if (type != 59 && (double) num1 < 3.0) + { + if ((double) velocity.Y > 1.0) + velocity.Y = 1f; + else if ((double) velocity.Y < -1.0) + velocity.Y = -1f; + } + } + } + + public static void MudWallRunner(int i, int j) + { + Vector2 vector2_1 = new Vector2((float) i, (float) j); + Vector2 vector2_2 = new Vector2(); + float num1 = (float) WorldGen.genRand.Next(5, 15); + float num2 = (float) WorldGen.genRand.Next(5, 20); + float num3 = num2; + vector2_2.X = (float) WorldGen.genRand.Next(-10, 11) * 0.1f; + vector2_2.Y = (float) WorldGen.genRand.Next(-10, 11) * 0.1f; + while ((double) num1 > 0.0 && (double) num3 > 0.0) + { + float num4 = num1 * (num3 / num2); + --num3; + int num5 = (int) ((double) vector2_1.X - (double) num4 * 0.5); + int num6 = (int) ((double) vector2_1.X + (double) num4 * 0.5); + int num7 = (int) ((double) vector2_1.Y - (double) num4 * 0.5); + int num8 = (int) ((double) vector2_1.Y + (double) num4 * 0.5); + if (num5 < 0) + num5 = 0; + if (num6 > (int) Main.maxTilesX) + num6 = (int) Main.maxTilesX; + if (num7 < 0) + num7 = 0; + if (num8 > (int) Main.maxTilesY) + num8 = (int) Main.maxTilesY; + for (int index1 = num5; index1 < num6; ++index1) + { + float num9 = Math.Abs((float) index1 - vector2_1.X); + for (int index2 = num7; index2 < num8; ++index2) + { + if ((double) num9 + (double) Math.Abs((float) index2 - vector2_1.Y) < (double) num1 * 0.5 * (1.0 + (double) WorldGen.genRand.Next(-10, 11) * 0.0149999996647239)) + Main.tile[index1, index2].wall = (byte) 0; + } + } + vector2_1.X += vector2_2.X; + vector2_1.Y += vector2_2.Y; + vector2_2.X += (float) WorldGen.genRand.Next(-10, 11) * 0.05f; + if ((double) vector2_2.X > 1.0) + vector2_2.X = 1f; + else if ((double) vector2_2.X < -1.0) + vector2_2.X = -1f; + vector2_2.Y += (float) WorldGen.genRand.Next(-10, 11) * 0.05f; + if ((double) vector2_2.Y > 1.0) + vector2_2.Y = 1f; + else if ((double) vector2_2.Y < -1.0) + vector2_2.Y = -1f; + } + } + + public static void FloatingIsland(int i, int j) + { + Vector2 vector2_1 = new Vector2((float) i, (float) j); + Vector2 vector2_2 = new Vector2(); + float num1 = (float) WorldGen.genRand.Next(80, 120); + float num2 = (float) WorldGen.genRand.Next(20, 25); + vector2_2.X = (float) WorldGen.genRand.Next(-20, 21) * 0.2f; + while ((double) vector2_2.X > -2.0 && (double) vector2_2.X < 2.0) + vector2_2.X = (float) WorldGen.genRand.Next(-20, 21) * 0.2f; + vector2_2.Y = (float) WorldGen.genRand.Next(-20, -10) * 0.02f; + while ((double) num1 > 0.0 && (double) num2 > 0.0) + { + num1 -= (float) WorldGen.genRand.Next(4); + --num2; + int num3 = (int) ((double) vector2_1.X - (double) num1 * 0.5); + int num4 = (int) ((double) vector2_1.X + (double) num1 * 0.5); + int num5 = (int) ((double) vector2_1.Y - (double) num1 * 0.5); + int num6 = (int) ((double) vector2_1.Y + (double) num1 * 0.5); + if (num3 < 0) + num3 = 0; + if (num4 > (int) Main.maxTilesX) + num4 = (int) Main.maxTilesX; + if (num6 > (int) Main.maxTilesY) + num6 = (int) Main.maxTilesY; + float num7 = (float) ((double) num1 * (double) WorldGen.genRand.Next(80, 120) * 0.00999999977648258); + float num8 = num7 * 0.4f; + float num9 = num8 * num8; + int num10 = (int) vector2_1.Y + 1; + for (int index1 = num3; index1 < num4; ++index1) + { + if (WorldGen.genRand.Next(2) == 0) + num10 += WorldGen.genRand.Next(-1, 2); + if (num10 < (int) vector2_1.Y) + num10 = (int) vector2_1.Y; + else if (num10 > (int) vector2_1.Y + 2) + num10 = (int) vector2_1.Y + 2; + float num11 = (float) index1 - vector2_1.X; + float num12 = num11 * num11; + for (int index2 = num5 < num10 ? num10 : num5; index2 < num6; ++index2) + { + float num13 = (float) (((double) index2 - (double) vector2_1.Y) * 2.0); + if ((double) (num12 + num13 * num13) < (double) num9) + { + Main.tile[index1, index2].active = (byte) 1; + if ((int) Main.tile[index1, index2].type == 59) + Main.tile[index1, index2].type = (byte) 0; + } + } + } + WorldGen.TileRunner(WorldGen.genRand.Next(num3 + 10, num4 - 10), (int) ((double) vector2_1.Y + (double) num7 * 0.100000001490116 + 5.0), WorldGen.genRand.Next(5, 10), WorldGen.genRand.Next(10, 15), 0, true, new Vector2(0.0f, 2f), true, true); + int num14 = (int) ((double) vector2_1.X - (double) num1 * 0.400000005960464); + int num15 = (int) ((double) vector2_1.X + (double) num1 * 0.400000005960464); + int num16 = (int) ((double) vector2_1.Y - (double) num1 * 0.400000005960464); + int num17 = (int) ((double) vector2_1.Y + (double) num1 * 0.400000005960464); + int num18 = (int) vector2_1.Y + 2; + if (num14 < 0) + num14 = 0; + if (num15 > (int) Main.maxTilesX) + num15 = (int) Main.maxTilesX; + if (num16 < num18) + num16 = num18; + if (num17 > (int) Main.maxTilesY) + num17 = (int) Main.maxTilesY; + float num19 = (float) ((double) num1 * (double) WorldGen.genRand.Next(80, 120) * 0.00999999977648258) * 0.4f; + float num20 = num19 * num19; + for (int index1 = num14; index1 < num15; ++index1) + { + float num11 = (float) index1 - vector2_1.X; + float num12 = num11 * num11; + for (int index2 = num16; index2 < num17; ++index2) + { + float num13 = (float) (((double) index2 - (double) vector2_1.Y) * 2.0); + if ((double) (num12 + num13 * num13) < (double) num20) + Main.tile[index1, index2].wall = (byte) 2; + } + } + vector2_1.X += vector2_2.X; + vector2_1.Y += vector2_2.Y; + vector2_2.Y += (float) WorldGen.genRand.Next(-10, 11) * 0.05f; + if ((double) vector2_2.X > 1.0) + vector2_2.X = 1f; + else if ((double) vector2_2.X < -1.0) + vector2_2.X = -1f; + if ((double) vector2_2.Y > 0.200000002980232) + vector2_2.Y = -0.2f; + else if ((double) vector2_2.Y < -0.200000002980232) + vector2_2.Y = -0.2f; + } + } + + public static void Caverer(int X, int Y) + { + int num = WorldGen.genRand.Next(2); + double xDir1 = (double) WorldGen.genRand.Next(100) * 0.01; + double yDir1 = 1.0 - xDir1; + if (WorldGen.genRand.Next(2) == 0) + xDir1 = -xDir1; + if (WorldGen.genRand.Next(2) == 0) + yDir1 = -yDir1; + Vector2 pos1 = new Vector2((float) X, (float) Y); + if (num == 0) + { + for (int index = WorldGen.genRand.Next(6, 8); index >= 0; --index) + { + WorldGen.digTunnel(ref pos1, xDir1, yDir1, WorldGen.genRand.Next(6, 20), WorldGen.genRand.Next(4, 9), false); + xDir1 += (double) WorldGen.genRand.Next(-20, 21) * 0.1; + yDir1 += (double) WorldGen.genRand.Next(-20, 21) * 0.1; + if (xDir1 < -1.5) + xDir1 = -1.5; + else if (xDir1 > 1.5) + xDir1 = 1.5; + if (yDir1 < -1.5) + yDir1 = -1.5; + else if (yDir1 > 1.5) + yDir1 = 1.5; + double xDir2 = (double) WorldGen.genRand.Next(100) * 0.01; + double yDir2 = 1.0 - xDir2; + if (WorldGen.genRand.Next(2) == 0) + xDir2 = -xDir2; + if (WorldGen.genRand.Next(2) == 0) + yDir2 = -yDir2; + Vector2 pos2 = pos1; + WorldGen.digTunnel(ref pos2, xDir2, yDir2, WorldGen.genRand.Next(30, 50), WorldGen.genRand.Next(3, 6), false); + WorldGen.TileRunner((int) pos2.X, (int) pos2.Y, WorldGen.genRand.Next(10, 20), WorldGen.genRand.Next(5, 10), -1, false, new Vector2(), false, true); + } + } + else + { + for (int index = WorldGen.genRand.Next(14, 29); index >= 0; --index) + { + WorldGen.digTunnel(ref pos1, xDir1, yDir1, WorldGen.genRand.Next(5, 15), WorldGen.genRand.Next(2, 6), true); + xDir1 += (double) WorldGen.genRand.Next(-20, 21) * 0.1; + yDir1 += (double) WorldGen.genRand.Next(-20, 21) * 0.1; + if (xDir1 < -1.5) + xDir1 = -1.5; + else if (xDir1 > 1.5) + xDir1 = 1.5; + if (yDir1 < -1.5) + yDir1 = -1.5; + else if (yDir1 > 1.5) + yDir1 = 1.5; + } + } + } + + public static void digTunnel(ref Vector2 pos, double xDir, double yDir, int Steps, int Size, bool Wet = false) + { + try + { + double num1 = 0.0; + double num2 = 0.0; + double num3 = (double) Size; + while (Steps > 0) + { + --Steps; + for (int index1 = (int) ((double) pos.X - num3); (double) index1 <= (double) pos.X + num3; ++index1) + { + float num4 = Math.Abs((float) index1 - pos.X); + for (int index2 = (int) ((double) pos.Y - num3); (double) index2 <= (double) pos.Y + num3; ++index2) + { + if ((double) num4 + (double) Math.Abs((float) index2 - pos.Y) < num3 * (1.0 + (double) WorldGen.genRand.Next(-10, 11) * 0.005)) + { + Main.tile[index1, index2].active = (byte) 0; + if (Wet) + Main.tile[index1, index2].liquid = byte.MaxValue; + } + } + } + num3 += (double) WorldGen.genRand.Next(-50, 51) * 0.03; + if (num3 < (double) Size * 0.6) + num3 = (double) Size * 0.6; + else if (num3 > (double) (Size * 2)) + num3 = (double) (Size * 2); + num1 += (double) WorldGen.genRand.Next(-20, 21) * 0.01; + num2 += (double) WorldGen.genRand.Next(-20, 21) * 0.01; + if (num1 < -1.0) + num1 = -1.0; + else if (num1 > 1.0) + num1 = 1.0; + if (num2 < -1.0) + num2 = -1.0; + else if (num2 > 1.0) + num2 = 1.0; + pos.X = pos.X + (float) ((xDir + num1) * 0.6); + pos.Y = pos.Y + (float) ((yDir + num2) * 0.6); + } + } + catch + { + } + } + + public static void IslandHouse(int i, int j) + { + byte num1 = (byte) WorldGen.genRand.Next(45, 48); + byte num2 = (byte) WorldGen.genRand.Next(10, 13); + Vector2 vector2 = new Vector2((float) i, (float) j); + int num3 = 1; + if (WorldGen.genRand.Next(2) == 0) + num3 = -1; + int num4 = WorldGen.genRand.Next(7, 12); + int num5 = WorldGen.genRand.Next(5, 7); + vector2.X = (float) (i + (num4 + 2) * num3); + for (int index = j - 15; index < j + 30; ++index) + { + if ((int) Main.tile[(int) vector2.X, index].active != 0) + { + vector2.Y = (float) (index - 1); + break; + } + } + vector2.X = (float) i; + int num6 = (int) ((double) vector2.X - (double) num4 - 2.0); + int num7 = (int) ((double) vector2.X + (double) num4 + 2.0); + int num8 = (int) ((double) vector2.Y - (double) num5 - 2.0); + int num9 = (int) ((double) vector2.Y + 2.0 + (double) WorldGen.genRand.Next(3, 5)); + if (num6 < 0) + num6 = 0; + if (num7 > (int) Main.maxTilesX) + num7 = (int) Main.maxTilesX; + if (num8 < 0) + num8 = 0; + if (num9 > (int) Main.maxTilesY) + num9 = (int) Main.maxTilesY; + for (int index1 = num6; index1 <= num7; ++index1) + { + for (int index2 = num8; index2 < num9; ++index2) + { + Main.tile[index1, index2].active = (byte) 1; + Main.tile[index1, index2].type = num1; + Main.tile[index1, index2].wall = (byte) 0; + } + } + int num10 = (int) ((double) vector2.X - (double) num4); + int num11 = (int) ((double) vector2.X + (double) num4); + int num12 = (int) ((double) vector2.Y - (double) num5); + int num13 = (int) ((double) vector2.Y + 1.0); + if (num10 < 0) + num10 = 0; + if (num11 > (int) Main.maxTilesX) + num11 = (int) Main.maxTilesX; + if (num12 < 0) + num12 = 0; + if (num13 > (int) Main.maxTilesY) + num13 = (int) Main.maxTilesY; + for (int index1 = num10; index1 <= num11; ++index1) + { + for (int index2 = num12; index2 < num13; ++index2) + { + if ((int) Main.tile[index1, index2].wall == 0) + { + Main.tile[index1, index2].active = (byte) 0; + Main.tile[index1, index2].wall = num2; + } + } + } + int i1 = i + (num4 + 1) * num3; + int j1 = (int) vector2.Y; + for (int index = i1 - 2; index <= i1 + 2; ++index) + { + Main.tile[index, j1].active = (byte) 0; + Main.tile[index, j1 - 1].active = (byte) 0; + Main.tile[index, j1 - 2].active = (byte) 0; + } + WorldGen.PlaceTile(i1, j1, 10, true, false, -1, 0); + int contain = 0; + int num14 = WorldGen.houseCount; + if (num14 > 2) + num14 = WorldGen.genRand.Next(3); + if (num14 == 0) + contain = 159; + else if (num14 == 1) + contain = 65; + else if (num14 == 2) + contain = 158; + WorldGen.AddBuriedChest(i, j1 - 3, contain, false, 2); + ++WorldGen.houseCount; + } + + public static void Mountinater(int i, int j) + { + Vector2 vector2_1 = new Vector2((float) i, (float) j); + Vector2 vector2_2 = new Vector2(); + double num1 = (double) WorldGen.genRand.Next(80, 120); + float num2 = (float) WorldGen.genRand.Next(40, 55); + vector2_1.Y += num2 * 0.5f; + vector2_2.X = (float) WorldGen.genRand.Next(-10, 11) * 0.1f; + vector2_2.Y = (float) WorldGen.genRand.Next(-20, -10) * 0.1f; + while (num1 > 0.0 && (double) num2 > 0.0) + { + num1 -= (double) WorldGen.genRand.Next(4); + --num2; + int num3 = (int) ((double) vector2_1.X - num1 * 0.5); + int num4 = (int) ((double) vector2_1.X + num1 * 0.5); + int num5 = (int) ((double) vector2_1.Y - num1 * 0.5); + int num6 = (int) ((double) vector2_1.Y + num1 * 0.5); + if (num3 < 0) + num3 = 0; + if (num4 > (int) Main.maxTilesX) + num4 = (int) Main.maxTilesX; + if (num5 < 0) + num5 = 0; + if (num6 > (int) Main.maxTilesY) + num6 = (int) Main.maxTilesY; + double num7 = num1 * (double) WorldGen.genRand.Next(80, 120) * 0.01 * 0.4; + double num8 = num7 * num7; + for (int index1 = num3; index1 < num4; ++index1) + { + double num9 = (double) index1 - (double) vector2_1.X; + double num10 = num9 * num9; + for (int index2 = num5; index2 < num6; ++index2) + { + double num11 = (double) index2 - (double) vector2_1.Y; + if (num10 + num11 * num11 < num8 && (int) Main.tile[index1, index2].active == 0) + { + Main.tile[index1, index2].active = (byte) 1; + Main.tile[index1, index2].type = (byte) 0; + } + } + } + vector2_1.X += vector2_2.X; + vector2_1.Y += vector2_2.Y; + vector2_2.X += (float) WorldGen.genRand.Next(-10, 11) * 0.05f; + vector2_2.Y += (float) WorldGen.genRand.Next(-10, 11) * 0.05f; + if ((double) vector2_2.X > 0.5) + vector2_2.X = 0.5f; + else if ((double) vector2_2.X < -0.5) + vector2_2.X = -0.5f; + if ((double) vector2_2.Y > -0.5) + vector2_2.Y = -0.5f; + else if ((double) vector2_2.Y < -1.5) + vector2_2.Y = -1.5f; + } + } + + public static void Lakinater(int i, int j) + { + Vector2 vector2_1 = new Vector2((float) i, (float) j); + Vector2 vector2_2 = new Vector2(); + double num1 = (double) WorldGen.genRand.Next(25, 50); + double num2 = num1; + double num3 = (double) WorldGen.genRand.Next(30, 80); + if (WorldGen.genRand.Next(5) == 0) + { + num1 *= 1.5; + num2 *= 1.5; + num3 *= 1.2; + } + vector2_1.Y = vector2_1.Y - (float) (num3 * 0.3); + vector2_2.X = (float) WorldGen.genRand.Next(-10, 11) * 0.1f; + vector2_2.Y = (float) WorldGen.genRand.Next(-20, -10) * 0.1f; + while (num1 > 0.0 && num3 > 0.0) + { + if ((double) vector2_1.Y + num2 * 0.5 > (double) Main.worldSurface) + num3 = 0.0; + num1 -= (double) WorldGen.genRand.Next(3); + --num3; + int num4 = (int) ((double) vector2_1.X - num1 * 0.5); + int num5 = (int) ((double) vector2_1.X + num1 * 0.5); + int num6 = (int) ((double) vector2_1.Y - num1 * 0.5); + int num7 = (int) ((double) vector2_1.Y + num1 * 0.5); + if (num4 < 0) + num4 = 0; + if (num5 > (int) Main.maxTilesX) + num5 = (int) Main.maxTilesX; + if (num6 < 0) + num6 = 0; + if (num7 > (int) Main.maxTilesY) + num7 = (int) Main.maxTilesY; + double num8 = num1 * (double) WorldGen.genRand.Next(80, 120) * 0.01 * 0.4; + num2 = num8 * num8; + for (int index1 = num4; index1 < num5; ++index1) + { + double num9 = (double) index1 - (double) vector2_1.X; + double num10 = num9 * num9; + for (int index2 = num6; index2 < num7; ++index2) + { + double num11 = (double) index2 - (double) vector2_1.Y; + if (num10 + num11 * num11 < num2 && (int) Main.tile[index1, index2].active != 0) + { + Main.tile[index1, index2].active = (byte) 0; + Main.tile[index1, index2].liquid = byte.MaxValue; + } + } + } + vector2_1.X += vector2_2.X; + vector2_1.Y += vector2_2.Y; + vector2_2.X += (float) WorldGen.genRand.Next(-10, 11) * 0.05f; + vector2_2.Y += (float) WorldGen.genRand.Next(-10, 11) * 0.05f; + if ((double) vector2_2.X > 0.5) + vector2_2.X = 0.5f; + else if ((double) vector2_2.X < -0.5) + vector2_2.X = -0.5f; + if ((double) vector2_2.Y > 1.5) + vector2_2.Y = 1.5f; + else if ((double) vector2_2.Y < 0.5) + vector2_2.Y = 0.5f; + } + } + + public static void ShroomPatch(int i, int j) + { + Vector2 vector2_1 = new Vector2((float) i, (float) j); + Vector2 vector2_2 = new Vector2(); + double num1 = (double) WorldGen.genRand.Next(40, 70); + double num2 = num1; + double num3 = (double) WorldGen.genRand.Next(20, 30); + if (WorldGen.genRand.Next(5) == 0) + { + num1 *= 1.5; + double num4 = num2 * 1.5; + num3 *= 1.2; + } + vector2_1.Y -= (float) (num3 * 0.3); + vector2_2.X = (float) WorldGen.genRand.Next(-10, 11) * 0.1f; + vector2_2.Y = (float) WorldGen.genRand.Next(-20, -10) * 0.1f; + while (num1 > 0.0 && num3 > 0.0) + { + num1 -= (double) WorldGen.genRand.Next(3); + --num3; + int num4 = (int) ((double) vector2_1.X - num1 * 0.5); + int num5 = (int) ((double) vector2_1.X + num1 * 0.5); + int num6 = (int) ((double) vector2_1.Y - num1 * 0.5); + int num7 = (int) ((double) vector2_1.Y + num1 * 0.5); + if (num4 < 0) + num4 = 0; + if (num5 > (int) Main.maxTilesX) + num5 = (int) Main.maxTilesX; + if (num6 < 0) + num6 = 0; + if (num7 > (int) Main.maxTilesY) + num7 = (int) Main.maxTilesY; + double num8 = num1 * (double) WorldGen.genRand.Next(80, 120) * 0.01; + float num9 = (float) num8 * 0.4f; + float num10 = num9 * num9; + for (int index1 = num4; index1 < num5; ++index1) + { + float num11 = (float) index1 - vector2_1.X; + float num12 = num11 * num11; + for (int index2 = num6; index2 < num7; ++index2) + { + float num13 = (float) (((double) index2 - (double) vector2_1.Y) * 2.29999995231628); + if ((double) (num12 + num13 * num13) < (double) num10) + { + if ((double) index2 < (double) vector2_1.Y + num8 * 0.02) + { + if ((int) Main.tile[index1, index2].type != 59) + Main.tile[index1, index2].active = (byte) 0; + } + else + Main.tile[index1, index2].type = (byte) 59; + Main.tile[index1, index2].liquid = (byte) 0; + Main.tile[index1, index2].lava = (byte) 0; + } + } + } + vector2_1.X += vector2_2.X; + vector2_1.X += vector2_2.X; + vector2_1.Y += vector2_2.Y; + vector2_2.X += (float) WorldGen.genRand.Next(-10, 11) * 0.05f; + vector2_2.Y -= (float) WorldGen.genRand.Next(11) * 0.05f; + if ((double) vector2_2.X > -0.5 && (double) vector2_2.X < 0.5) + vector2_2.X = (double) vector2_2.X >= 0.0 ? 0.5f : -0.5f; + if ((double) vector2_2.X > 2.0) + vector2_2.X = 1f; + else if ((double) vector2_2.X < -2.0) + vector2_2.X = -1f; + if ((double) vector2_2.Y > 1.0) + vector2_2.Y = 1f; + else if ((double) vector2_2.Y < -1.0) + vector2_2.Y = -1f; + int num14 = (int) vector2_1.X; + int num15 = (int) vector2_1.Y; + for (int index = 0; index < 2; ++index) + { + int i1; + int j1; + do + { + i1 = num14 + WorldGen.genRand.Next(-20, 20); + j1 = num15 + WorldGen.genRand.Next(20); + } + while ((int) Main.tile[i1, j1].active == 0 && (int) Main.tile[i1, j1].type != 59); + int strength = WorldGen.genRand.Next(7, 10); + int steps = WorldGen.genRand.Next(7, 10); + WorldGen.TileRunner(i1, j1, strength, steps, 59, false, new Vector2(0.0f, 2f), true, true); + if (WorldGen.genRand.Next(3) == 0) + WorldGen.TileRunner(i1, j1, strength - 3, steps - 3, -1, false, new Vector2(0.0f, 2f), true, true); + } + } + } + + public static void Cavinator(int i, int j, int steps) + { + Vector2 vector2_1 = new Vector2((float) i, (float) j); + Vector2 vector2_2 = new Vector2(); + double num1 = (double) WorldGen.genRand.Next(7, 15); + int num2 = 1; + if (WorldGen.genRand.Next(2) == 0) + num2 = -1; + int num3 = WorldGen.genRand.Next(20, 40); + vector2_2.Y = (float) WorldGen.genRand.Next(10, 20) * 0.01f; + vector2_2.X = (float) num2; + while (num3 > 0) + { + --num3; + int num4 = (int) ((double) vector2_1.X - num1 * 0.5); + int num5 = (int) ((double) vector2_1.X + num1 * 0.5); + int num6 = (int) ((double) vector2_1.Y - num1 * 0.5); + int num7 = (int) ((double) vector2_1.Y + num1 * 0.5); + if (num4 < 0) + num4 = 0; + if (num5 > (int) Main.maxTilesX) + num5 = (int) Main.maxTilesX; + if (num6 < 0) + num6 = 0; + if (num7 > (int) Main.maxTilesY) + num7 = (int) Main.maxTilesY; + double num8 = num1 * (double) WorldGen.genRand.Next(80, 120) * 0.01 * 0.4; + double num9 = num8 * num8; + for (int index1 = num4; index1 < num5; ++index1) + { + double num10 = (double) index1 - (double) vector2_1.X; + double num11 = num10 * num10; + for (int index2 = num6; index2 < num7; ++index2) + { + double num12 = (double) index2 - (double) vector2_1.Y; + if (num11 + num12 * num12 < num9) + Main.tile[index1, index2].active = (byte) 0; + } + } + vector2_1.X += vector2_2.X; + vector2_1.Y += vector2_2.Y; + vector2_2.X += (float) WorldGen.genRand.Next(-10, 11) * 0.05f; + vector2_2.Y += (float) WorldGen.genRand.Next(-10, 11) * 0.05f; + if ((double) vector2_2.X > (double) num2 + 0.5) + vector2_2.X = (float) num2 + 0.5f; + else if ((double) vector2_2.X < (double) num2 - 0.5) + vector2_2.X = (float) num2 - 0.5f; + if ((double) vector2_2.Y > 2.0) + vector2_2.Y = 2f; + else if ((double) vector2_2.Y < 0.0) + vector2_2.Y = 0.0f; + } + if (steps <= 0 || (int) vector2_1.Y >= Main.rockLayer + 50) + return; + WorldGen.Cavinator((int) vector2_1.X, (int) vector2_1.Y, steps - 1); + } + + public static void CaveOpenater(int i, int j) + { + int num1 = (WorldGen.genRand.Next(2) << 1) - 1; + Vector2 vector2_1 = new Vector2((float) i, (float) j); + Vector2 vector2_2 = new Vector2(0.0f, (float) num1); + double num2 = (double) WorldGen.genRand.Next(7, 12); + int num3 = 100; + do + { + if ((int) Main.tile[(int) vector2_1.X, (int) vector2_1.Y].wall == 0) + num3 = 0; + else + --num3; + int num4 = (int) ((double) vector2_1.X - num2 * 0.5); + int num5 = (int) ((double) vector2_1.X + num2 * 0.5); + int num6 = (int) ((double) vector2_1.Y - num2 * 0.5); + int num7 = (int) ((double) vector2_1.Y + num2 * 0.5); + if (num4 < 0) + num4 = 0; + if (num5 > (int) Main.maxTilesX) + num5 = (int) Main.maxTilesX; + if (num6 < 0) + num6 = 0; + if (num7 > (int) Main.maxTilesY) + num7 = (int) Main.maxTilesY; + double num8 = num2 * (double) WorldGen.genRand.Next(80, 120) * 0.01 * 0.4; + double num9 = num8 * num8; + for (int index1 = num4; index1 < num5; ++index1) + { + double num10 = (double) index1 - (double) vector2_1.X; + double num11 = num10 * num10; + for (int index2 = num6; index2 < num7; ++index2) + { + double num12 = (double) index2 - (double) vector2_1.Y; + if (num11 + num12 * num12 < num9) + Main.tile[index1, index2].active = (byte) 0; + } + } + vector2_1.X += vector2_2.X; + vector2_1.Y += vector2_2.Y; + vector2_2.X += (float) WorldGen.genRand.Next(-10, 11) * 0.05f; + vector2_2.Y += (float) WorldGen.genRand.Next(-10, 11) * 0.05f; + if ((double) vector2_2.X > (double) num1 + 0.5) + vector2_2.X = (float) num1 + 0.5f; + else if ((double) vector2_2.X < (double) num1 - 0.5) + vector2_2.X = (float) num1 - 0.5f; + if ((double) vector2_2.Y > 0.0) + vector2_2.Y = 0.0f; + else if ((double) vector2_2.Y < -0.5) + vector2_2.Y = -0.5f; + } + while (num3 > 0); + } + + public static void SquareTileFrame(int i, int j, int frameNumber = -1) + { + if (WorldGen.gen) + return; + bool flag = WorldGen.tileFrameRecursion; + WorldGen.tileFrameRecursion = false; + WorldGen.TileFrame(i - 1, j - 1, 0); + WorldGen.TileFrame(i - 1, j, 0); + WorldGen.TileFrame(i - 1, j + 1, 0); + WorldGen.TileFrame(i, j - 1, 0); + WorldGen.TileFrame(i, j, frameNumber); + WorldGen.TileFrame(i, j + 1, 0); + WorldGen.TileFrame(i + 1, j - 1, 0); + WorldGen.TileFrame(i + 1, j, 0); + WorldGen.TileFrame(i + 1, j + 1, 0); + WorldGen.tileFrameRecursion = flag; + } + + public static void SquareTileFrameNoLiquid(int i, int j, int frameNumber = -1) + { + WorldGen.TileFrameNoLiquid(i - 1, j - 1, 0); + WorldGen.TileFrameNoLiquid(i - 1, j, 0); + WorldGen.TileFrameNoLiquid(i - 1, j + 1, 0); + WorldGen.TileFrameNoLiquid(i, j - 1, 0); + WorldGen.TileFrameNoLiquid(i, j, frameNumber); + WorldGen.TileFrameNoLiquid(i, j + 1, 0); + WorldGen.TileFrameNoLiquid(i + 1, j - 1, 0); + WorldGen.TileFrameNoLiquid(i + 1, j, 0); + WorldGen.TileFrameNoLiquid(i + 1, j + 1, 0); + } + + public static void SquareWallFrame(int i, int j, bool resetFrame = true) + { + WorldGen.WallFrame(i - 1, j - 1, false); + WorldGen.WallFrame(i - 1, j, false); + WorldGen.WallFrame(i - 1, j + 1, false); + WorldGen.WallFrame(i, j - 1, false); + WorldGen.WallFrame(i, j, resetFrame); + WorldGen.WallFrame(i, j + 1, false); + WorldGen.WallFrame(i + 1, j - 1, false); + WorldGen.WallFrame(i + 1, j, false); + WorldGen.WallFrame(i + 1, j + 1, false); + } + + public static void SectionTileFrame(int startX, int startY) + { + int num1 = startX; + int num2 = startX + 40; + int num3 = startY; + int num4 = startY + 30; + if (num1 < 6) + num1 = 6; + if (num3 < 6) + num3 = 6; + if (num1 > (int) Main.maxTilesX - 6) + num1 = (int) Main.maxTilesX - 6; + if (num3 > (int) Main.maxTilesY - 6) + num3 = (int) Main.maxTilesY - 6; + WorldGen.tileFrameRecursion = false; + for (int i = num1 - 1; i < num2 + 1; ++i) + { + for (int j = num3 - 1; j < num4 + 1; ++j) + { + int index = (int) Main.tile[i, j].type; + if (index == 4 || !Main.tileFrameImportant[index]) + WorldGen.TileFrame(i, j, -1); + WorldGen.WallFrame(i, j, true); + } + } + WorldGen.tileFrameRecursion = true; + } + + public static void RangeFrame(int startX, int startY, int endX, int endY) + { + if (WorldGen.gen) + return; + bool flag = WorldGen.tileFrameRecursion; + WorldGen.tileFrameRecursion = false; + for (int i = startX - 1; i < endX + 2; ++i) + { + for (int j = startY - 1; j < endY + 2; ++j) + { + WorldGen.TileFrame(i, j, 0); + WorldGen.WallFrame(i, j, false); + } + } + WorldGen.tileFrameRecursion = flag; + } + + public static unsafe void WaterCheck() + { + Liquid.numLiquid = 0; + LiquidBuffer.numLiquidBuffer = 0; + Tile[,] tileArray; + // ISSUE: cast to a reference type + // ISSUE: explicit reference operation + fixed (Tile* tilePtr1 = &^((tileArray = Main.tile) == null || tileArray.Length == 0 ? (Tile&) IntPtr.Zero : tileArray.Address(0, 0))) + { + for (int index = (int) Main.maxTilesX - 2; index > 0; --index) + { + Tile* tilePtr2 = tilePtr1 + (index * 1440 + (int) Main.maxTilesY - 2); + int num = (int) Main.maxTilesY - 2; + while (num > 0) + { + tilePtr2->checkingLiquid = 0; + if ((int) tilePtr2->liquid > 0) + { + if ((int) tilePtr2->active != 0 && Main.tileSolidNotSolidTop[(int) tilePtr2->type]) + { + tilePtr2->liquid = (byte) 0; + } + else + { + if ((int) tilePtr2->active != 0) + { + if (Main.tileWaterDeath[(int) tilePtr2->type] && ((int) tilePtr2->type != 4 || (int) tilePtr2->frameY != 176)) + WorldGen.KillTile(index, num); + if ((int) tilePtr2->lava != 0 && Main.tileLavaDeath[(int) tilePtr2->type]) + WorldGen.KillTile(index, num); + } + Tile* tilePtr3 = tilePtr2 + 1; + if (((int) tilePtr3->active == 0 || !Main.tileSolidNotSolidTop[(int) tilePtr3->type]) && (int) tilePtr3->liquid < (int) byte.MaxValue) + { + if ((int) tilePtr3->liquid > 250) + tilePtr3->liquid = byte.MaxValue; + else + Liquid.AddWater(index, num); + } + Tile* tilePtr4 = tilePtr2 - 1440; + if (((int) tilePtr4->active == 0 || !Main.tileSolidNotSolidTop[(int) tilePtr4->type]) && (int) tilePtr4->liquid != (int) tilePtr2->liquid) + { + Liquid.AddWater(index, num); + } + else + { + Tile* tilePtr5 = tilePtr2 + 1440; + if (((int) tilePtr5->active == 0 || !Main.tileSolidNotSolidTop[(int) tilePtr5->type]) && (int) tilePtr5->liquid != (int) tilePtr2->liquid) + Liquid.AddWater(index, num); + } + if ((int) tilePtr2->lava != 0) + { + Tile* tilePtr5 = tilePtr2 - 1; + if ((int) tilePtr5->liquid > 0 && (int) tilePtr5->lava == 0) + { + Liquid.AddWater(index, num); + } + else + { + Tile* tilePtr6 = tilePtr2 + 1; + if ((int) tilePtr6->liquid > 0 && (int) tilePtr6->lava == 0) + { + Liquid.AddWater(index, num); + } + else + { + Tile* tilePtr7 = tilePtr2 - 1440; + if ((int) tilePtr7->liquid > 0 && (int) tilePtr7->lava == 0) + { + Liquid.AddWater(index, num); + } + else + { + Tile* tilePtr8 = tilePtr2 + 1440; + if ((int) tilePtr8->liquid > 0 && (int) tilePtr8->lava == 0) + Liquid.AddWater(index, num); + } + } + } + } + } + } + --num; + --tilePtr2; + } + } + } + } + + public static unsafe void everyTileFrame() + { + UI.main.NextProgressStep(Lang.gen[55]); + WorldGen.gen = true; + Tile[,] tileArray; + // ISSUE: cast to a reference type + // ISSUE: explicit reference operation + fixed (Tile* tilePtr1 = &^((tileArray = Main.tile) == null || tileArray.Length == 0 ? (Tile&) IntPtr.Zero : tileArray.Address(0, 0))) + { + for (int i = 0; i < (int) Main.maxTilesX; ++i) + { + if ((i & 63) == 0) + UI.main.progress = (float) i / (float) Main.maxTilesX; + Tile* tilePtr2 = tilePtr1 + (1440 * i + (int) Main.maxTilesY); + for (int j = (int) Main.maxTilesY - 1; j >= 0; --j) + { + --tilePtr2; + if ((int) tilePtr2->active != 0) + WorldGen.TileFrameNoLiquid(i, j, -1); + if ((int) tilePtr2->wall > 0) + WorldGen.WallFrame(i, j, true); + } + } + } + WorldGen.gen = false; + } + + private static void PlantCheck(int i, int j) + { + int num1 = -1; + int num2 = (int) Main.tile[i, j].type; + if (j + 1 >= (int) Main.maxTilesY) + num1 = num2; + if (j + 1 < (int) Main.maxTilesY && (int) Main.tile[i, j + 1].active != 0) + num1 = (int) Main.tile[i, j + 1].type; + if ((num2 != 3 || num1 == 2 || num1 == 78) && ((num2 != 24 || num1 == 23) && (num2 != 61 || num1 == 60)) && ((num2 != 71 || num1 == 70) && (num2 != 73 || num1 == 2 || num1 == 78)) && ((num2 != 74 || num1 == 60) && (num2 != 110 || num1 == 109) && (num2 != 113 || num1 == 109))) + return; + if (num1 == 23) + { + num2 = 24; + if ((int) Main.tile[i, j].frameX >= 162) + Main.tile[i, j].frameX = (short) 126; + } + else if (num1 == 2) + num2 = num2 != 113 ? 3 : 73; + else if (num1 == 109) + num2 = num2 != 73 ? 110 : 113; + if (num2 != (int) Main.tile[i, j].type) + Main.tile[i, j].type = (byte) num2; + else + WorldGen.KillTile(i, j); + } + + public static unsafe void WallFrame(int i, int j, bool resetFrame = false) + { + if (i < 0 || j < 0 || (i >= (int) Main.maxTilesX || j >= (int) Main.maxTilesY)) + return; + fixed (Tile* tilePtr = &Main.tile[i, j]) + { + int num1 = (int) tilePtr->wall; + if (num1 == 0) + return; + int num2 = num1; + int num3 = num1; + int num4 = num1; + int num5 = num1; + int num6 = num1; + int num7 = num1; + int num8 = num1; + int num9 = num1; + int num10 = (int) tilePtr->wallFrameX; + int num11 = (int) tilePtr->wallFrameY; + int num12 = -1; + int num13 = -1; + if (j - 1 >= 0) + num3 = (int) tilePtr[-1].wall; + if (j + 1 < (int) Main.maxTilesY) + num8 = (int) tilePtr[1].wall; + if (i - 1 >= 0) + { + num5 = (int) tilePtr[-1440].wall; + if (j - 1 >= 0) + num2 = (int) tilePtr[-1441].wall; + if (j + 1 < (int) Main.maxTilesY) + num7 = (int) tilePtr[-1439].wall; + } + if (i + 1 < (int) Main.maxTilesX) + { + num6 = (int) tilePtr[1440].wall; + if (j - 1 >= 0) + num4 = (int) tilePtr[1439].wall; + if (j + 1 < (int) Main.maxTilesY) + num9 = (int) tilePtr[1441].wall; + } + if (num1 == 2 && j >= Main.worldSurface) + { + num8 = num1; + num7 = num1; + num9 = num1; + if (j > Main.worldSurface) + { + num3 = num1; + num2 = num1; + num4 = num1; + num5 = num1; + num6 = num1; + } + } + else + { + if (num8 > 0) + num8 = num1; + if (num7 > 0) + num7 = num1; + if (num9 > 0) + num9 = num1; + } + if (num3 > 0) + num3 = num1; + if (num2 > 0) + num2 = num1; + if (num4 > 0) + num4 = num1; + if (num5 > 0) + num5 = num1; + if (num6 > 0) + num6 = num1; + int num14; + if (resetFrame) + { + num14 = WorldGen.genRand.Next(3); + Main.tile[i, j].wallFrameNumber = num14; + } + else + num14 = Main.tile[i, j].wallFrameNumber; + if (num12 < 0 || num13 < 0) + { + if (num3 == num1 && num8 == num1 && num5 == num1 & num6 == num1) + { + if (num2 != num1 && num4 != num1) + { + num12 = 108 + num14 * 18; + num13 = 18; + } + else if (num7 != num1 && num9 != num1) + { + num12 = 108 + num14 * 18; + num13 = 36; + } + else if (num2 != num1 && num7 != num1) + { + num12 = 180; + num13 = num14 * 18; + } + else if (num4 != num1 && num9 != num1) + { + num12 = 198; + num13 = num14 * 18; + } + else + { + num12 = 18 + num14 * 18; + num13 = 18; + } + } + else if (num3 != num1 && num8 == num1 && num5 == num1 & num6 == num1) + { + num12 = 18 + num14 * 18; + num13 = 0; + } + else if (num3 == num1 && num8 != num1 && num5 == num1 & num6 == num1) + { + num12 = 18 + num14 * 18; + num13 = 36; + } + else if (num3 == num1 && num8 == num1 && num5 != num1 & num6 == num1) + { + num12 = 0; + num13 = num14 * 18; + } + else if (num3 == num1 && num8 == num1 && num5 == num1 & num6 != num1) + { + num12 = 72; + num13 = num14 * 18; + } + else if (num3 != num1 && num8 == num1 && num5 != num1 & num6 == num1) + { + num12 = num14 * 36; + num13 = 54; + } + else if (num3 != num1 && num8 == num1 && num5 == num1 & num6 != num1) + { + num12 = 18 + num14 * 36; + num13 = 54; + } + else if (num3 == num1 && num8 != num1 && num5 != num1 & num6 == num1) + { + num12 = num14 * 36; + num13 = 72; + } + else if (num3 == num1 && num8 != num1 && num5 == num1 & num6 != num1) + { + num12 = 18 + num14 * 36; + num13 = 72; + } + else if (num3 == num1 && num8 == num1 && num5 != num1 & num6 != num1) + { + num12 = 90; + num13 = num14 * 18; + } + else if (num3 != num1 && num8 != num1 && num5 == num1 & num6 == num1) + { + num12 = 108 + num14 * 18; + num13 = 72; + } + else if (num3 != num1 && num8 == num1 && num5 != num1 & num6 != num1) + { + num12 = 108 + num14 * 18; + num13 = 0; + } + else if (num3 == num1 && num8 != num1 && num5 != num1 & num6 != num1) + { + num12 = 108 + num14 * 18; + num13 = 54; + } + else if (num3 != num1 && num8 != num1 && num5 != num1 & num6 == num1) + { + num12 = 162; + num13 = num14 * 18; + } + else if (num3 != num1 && num8 != num1 && num5 == num1 & num6 != num1) + { + num12 = 216; + num13 = num14 * 18; + } + else if (num3 != num1 && num8 != num1 && num5 != num1 & num6 != num1) + { + num12 = 162 + num14 * 18; + num13 = 54; + } + } + if (num12 < 0 || num13 < 0) + { + num12 = 18 + num14 * 18; + num13 = 18; + } + tilePtr->wallFrameX = (ushort) num12; + tilePtr->wallFrameY = (byte) num13; + } + } + + public static unsafe void TileFrame(int i, int j, int frameNumber = 0) + { + if (i <= 5 || j <= 5 || (i >= (int) Main.maxTilesX - 5 || j >= (int) Main.maxTilesY - 5)) + return; + fixed (Tile* tilePtr1 = &Main.tile[i, j]) + { + if ((int) tilePtr1->liquid > 0 && Main.netMode != 1) + Liquid.AddWater(i, j); + if ((int) tilePtr1->active != 0) + { + int type = (int) tilePtr1->type; + if (Main.tileStone[type]) + type = 1; + int num1 = (int) tilePtr1->frameX; + int num2 = (int) tilePtr1->frameY; + int num3 = -1; + int num4 = -1; + if (Main.tileFrameImportant[type]) + { + switch (type) + { + case 3: + case 24: + case 61: + case 71: + case 73: + case 74: + case 110: + case 113: + WorldGen.PlantCheck(i, j); + break; + case 4: + int num5 = (int) tilePtr1->frameX >= 66 ? 66 : 0; + int index1 = -1; + int index2 = -1; + int index3 = -1; + int num6 = -1; + int num7 = -1; + int num8 = -1; + int num9 = -1; + if ((int) tilePtr1[-1].active != 0) + { + int num10 = (int) tilePtr1[-1].type; + } + if ((int) tilePtr1[1].active != 0) + index1 = (int) tilePtr1[1].type; + if ((int) tilePtr1[-1440].active != 0) + index2 = (int) tilePtr1[-1440].type; + if ((int) tilePtr1[1440].active != 0) + index3 = (int) tilePtr1[1440].type; + if ((int) tilePtr1[-1439].active != 0) + num6 = (int) tilePtr1[-1439].type; + if ((int) tilePtr1[1441].active != 0) + num7 = (int) tilePtr1[1441].type; + if ((int) tilePtr1[-1441].active != 0) + num8 = (int) tilePtr1[-1441].type; + if ((int) tilePtr1[1439].active != 0) + num9 = (int) tilePtr1[1439].type; + if (index1 >= 0 && Main.tileSolidAndAttach[index1]) + { + tilePtr1->frameX = (short) num5; + break; + } + else if (index2 >= 0 && (Main.tileSolidAndAttach[index2] || index2 == 124 || index2 == 5 && num8 == 5 && num6 == 5)) + { + tilePtr1->frameX = (short) (22 + num5); + break; + } + else if (index3 >= 0 && (Main.tileSolidAndAttach[index3] || index3 == 124 || index3 == 5 && num9 == 5 && num7 == 5)) + { + tilePtr1->frameX = (short) (44 + num5); + break; + } + else + { + WorldGen.KillTile(i, j); + break; + } + case 5: + WorldGen.CheckTree(i, j); + break; + case 6: + break; + case 7: + break; + case 8: + break; + case 9: + break; + case 10: + if (WorldGen.destroyObject) + break; + int j1 = j - num2 / 18; + bool flag1 = false; + if ((int) Main.tile[i, j1 - 1].active == 0 || !Main.tileSolid[(int) Main.tile[i, j1 - 1].type]) + flag1 = true; + else if ((int) Main.tile[i, j1 + 3].active == 0 || !Main.tileSolid[(int) Main.tile[i, j1 + 3].type]) + flag1 = true; + else if ((int) Main.tile[i, j1].active == 0 || (int) Main.tile[i, j1].type != type) + flag1 = true; + else if ((int) Main.tile[i, j1 + 1].active == 0 || (int) Main.tile[i, j1 + 1].type != type) + flag1 = true; + else if ((int) Main.tile[i, j1 + 2].active == 0 || (int) Main.tile[i, j1 + 2].type != type) + flag1 = true; + if (flag1) + { + WorldGen.destroyObject = true; + WorldGen.KillTile(i, j1); + WorldGen.KillTile(i, j1 + 1); + WorldGen.KillTile(i, j1 + 2); + if (!WorldGen.gen) + Item.NewItem(i * 16, j * 16, 16, 16, 25, 1, false, 0); + } + WorldGen.destroyObject = false; + break; + case 11: + if (WorldGen.destroyObject) + break; + int num11 = 0; + int num12 = 0; + int num13 = i; + int num14 = j; + bool flag2 = false; + if (num1 == 0) + num11 = 1; + else if (num1 == 18) + { + num13 = i - 1; + num12 = -1440; + num11 = 1; + } + else if (num1 == 36) + { + num12 = 1440; + num13 = i + 1; + num11 = -1; + } + else if (num1 == 54) + num11 = -1; + if (num2 == 18) + { + --num12; + num14 = j - 1; + } + else if (num2 == 36) + { + num14 = j - 2; + num12 -= 2; + } + if ((int) tilePtr1[num12 - 1].active == 0 || !Main.tileSolid[(int) tilePtr1[num12 - 1].type] || ((int) tilePtr1[num12 + 3].active == 0 || !Main.tileSolid[(int) tilePtr1[num12 + 3].type])) + { + flag2 = true; + WorldGen.destroyObject = true; + if (!WorldGen.gen) + Item.NewItem(i * 16, j * 16, 16, 16, 25, 1, false, 0); + } + int num15 = num13; + if (num11 == -1) + num15 = num13 - 1; + for (int i1 = num15; i1 < num15 + 2; ++i1) + { + for (int j2 = num14; j2 < num14 + 3; ++j2) + { + if (!flag2) + { + fixed (Tile* tilePtr2 = &Main.tile[i1, j2]) + { + if ((int) tilePtr2->type != 11 || (int) tilePtr2->active == 0) + { + WorldGen.destroyObject = true; + flag2 = true; + i1 = num15; + j2 = num14; + if (!WorldGen.gen) + Item.NewItem(i * 16, j * 16, 16, 16, 25, 1, false, 0); + } + } + } + if (flag2) + WorldGen.KillTile(i1, j2); + } + } + WorldGen.destroyObject = false; + break; + case 12: + case 31: + WorldGen.CheckOrb(i, j, type); + break; + case 13: + case 33: + case 50: + WorldGen.CheckOnTable1x1(i, j); + break; + case 14: + case 17: + case 26: + case 77: + case 86: + case 87: + case 88: + case 89: + case 114: + case 133: + WorldGen.Check3x2(i, j, type); + break; + case 15: + case 20: + WorldGen.Check1x2(i, j, type); + break; + case 16: + case 18: + case 29: + case 103: + case 134: + WorldGen.Check2x1(i, j, type); + break; + case 19: + break; + case 21: + WorldGen.CheckChest(i, j); + break; + case 22: + break; + case 23: + break; + case 25: + break; + case 27: + WorldGen.CheckSunflower(i, j); + break; + case 28: + WorldGen.CheckPot(i, j); + break; + case 30: + break; + case 32: + break; + case 34: + case 35: + case 36: + case 106: + WorldGen.Check3x3(i, j, type); + break; + case 37: + break; + case 38: + break; + case 39: + break; + case 40: + break; + case 41: + break; + case 42: + WorldGen.Check1x2Top(i, j); + break; + case 43: + break; + case 44: + break; + case 45: + break; + case 46: + break; + case 47: + break; + case 48: + break; + case 49: + break; + case 51: + break; + case 52: + break; + case 53: + break; + case 54: + break; + case 55: + case 85: + WorldGen.CheckSign(i, j, type); + break; + case 56: + break; + case 57: + break; + case 58: + break; + case 59: + break; + case 60: + break; + case 62: + break; + case 63: + break; + case 64: + break; + case 65: + break; + case 66: + break; + case 67: + break; + case 68: + break; + case 69: + break; + case 70: + break; + case 72: + int num16 = -1; + int num17 = -1; + if ((int) tilePtr1[-1].active != 0) + num17 = (int) tilePtr1[-1].type; + if ((int) tilePtr1[1].active != 0) + num16 = (int) tilePtr1[1].type; + if (num16 != type && num16 != 70) + { + WorldGen.KillTile(i, j); + break; + } + else + { + if (num17 == type || (int) tilePtr1->frameX != 0) + break; + tilePtr1->frameNumber = (byte) WorldGen.genRand.Next(3); + tilePtr1->frameX = (short) 18; + tilePtr1->frameY = (short) (18 * (int) tilePtr1->frameNumber); + break; + } + case 75: + break; + case 76: + break; + case 78: + WorldGen.CheckOnTableClaypot(i, j); + break; + case 79: + case 90: + WorldGen.Check4x2(i, j, type); + break; + case 80: + break; + case 81: + int index4 = -1; + int num18 = -1; + int num19 = -1; + int num20 = -1; + if ((int) tilePtr1[-1].active != 0) + num18 = (int) tilePtr1[-1].type; + if ((int) tilePtr1[1].active != 0) + index4 = (int) tilePtr1[1].type; + if ((int) tilePtr1[-1440].active != 0) + num19 = (int) tilePtr1[-1440].type; + if ((int) tilePtr1[1440].active != 0) + num20 = (int) tilePtr1[1440].type; + if (num19 != -1 || num18 != -1 || num20 != -1) + { + WorldGen.KillTile(i, j); + break; + } + else + { + if (index4 >= 0 && Main.tileSolid[index4]) + break; + WorldGen.KillTile(i, j); + break; + } + case 82: + case 83: + case 84: + WorldGen.CheckAlch(i, j); + break; + case 91: + WorldGen.CheckBanner(i, j); + break; + case 92: + case 93: + WorldGen.Check1xX(i, j, type); + break; + case 94: + case 95: + case 96: + case 97: + case 98: + case 99: + case 100: + case 125: + case 126: + case 132: + case 138: + case 142: + case 143: + WorldGen.Check2x2(i, j, type); + break; + case 101: + case 102: + WorldGen.Check3x4(i, j, type); + break; + case 104: + case 105: + WorldGen.Check2xX(i, j, type); + break; + case 107: + break; + case 108: + break; + case 109: + break; + case 111: + break; + case 112: + break; + case 115: + break; + case 116: + break; + case 117: + break; + case 118: + break; + case 119: + break; + case 120: + break; + case 121: + break; + case 122: + break; + case 123: + break; + case 124: + break; + case (int) sbyte.MaxValue: + break; + case 128: + WorldGen.CheckMan(i, j); + break; + case 129: + case 149: + int index5 = -1; + int index6 = -1; + int index7 = -1; + int index8 = -1; + if ((int) tilePtr1[-1].active != 0) + index6 = (int) tilePtr1[-1].type; + if ((int) tilePtr1[1].active != 0) + index5 = (int) tilePtr1[1].type; + if ((int) tilePtr1[-1440].active != 0) + index7 = (int) tilePtr1[-1440].type; + if ((int) tilePtr1[1440].active != 0) + index8 = (int) tilePtr1[1440].type; + if (index5 >= 0 && Main.tileSolidNotSolidTop[index5]) + { + tilePtr1->frameY = (short) 0; + break; + } + else if (index7 >= 0 && Main.tileSolidNotSolidTop[index7]) + { + tilePtr1->frameY = (short) 54; + break; + } + else if (index8 >= 0 && Main.tileSolidNotSolidTop[index8]) + { + tilePtr1->frameY = (short) 36; + break; + } + else if (index6 >= 0 && Main.tileSolidNotSolidTop[index6]) + { + tilePtr1->frameY = (short) 18; + break; + } + else + { + WorldGen.KillTile(i, j); + break; + } + case 130: + break; + case 131: + break; + case 135: + case 141: + case 144: + WorldGen.Check1x1(i, j, type); + break; + case 136: + int index9 = -1; + int index10 = -1; + int index11 = -1; + if ((int) tilePtr1[-1].active != 0) + { + int num21 = (int) tilePtr1[-1].type; + } + if ((int) tilePtr1[1].active != 0) + index9 = (int) tilePtr1[1].type; + if ((int) tilePtr1[-1440].active != 0) + index10 = (int) tilePtr1[-1440].type; + if ((int) tilePtr1[1440].active != 0) + index11 = (int) tilePtr1[1440].type; + if (index9 >= 0 && Main.tileSolidAndAttach[index9]) + { + tilePtr1->frameX = (short) 0; + break; + } + else if (index10 >= 0 && (Main.tileSolidAndAttach[index10] || index10 == 124 || index10 == 5)) + { + tilePtr1->frameX = (short) 18; + break; + } + else if (index11 >= 0 && (Main.tileSolidAndAttach[index11] || index11 == 124 || index11 == 5)) + { + tilePtr1->frameX = (short) 36; + break; + } + else + { + WorldGen.KillTile(i, j); + break; + } + case 137: + break; + case 139: + WorldGen.CheckMusicBox(i, j); + break; + case 140: + break; + case 145: + break; + case 146: + break; + case 147: + break; + case 148: + break; + default: + break; + } + } + else + { + int index12 = -1; + int index13 = -1; + int index14 = -1; + int index15 = -1; + int index16 = -1; + int index17 = -1; + int index18 = -1; + int index19 = -1; + if ((int) tilePtr1[-1440].active != 0) + { + int index20 = (int) tilePtr1[-1440].type; + index15 = Main.tileStone[index20] ? 1 : index20; + } + if ((int) tilePtr1[1440].active != 0) + { + int index20 = (int) tilePtr1[1440].type; + index16 = Main.tileStone[index20] ? 1 : index20; + } + if ((int) tilePtr1[-1].active != 0) + { + int index20 = (int) tilePtr1[-1].type; + index13 = Main.tileStone[index20] ? 1 : index20; + } + if ((int) tilePtr1[1].active != 0) + { + int index20 = (int) tilePtr1[1].type; + index18 = Main.tileStone[index20] ? 1 : index20; + } + if ((int) tilePtr1[-1441].active != 0) + { + int index20 = (int) tilePtr1[-1441].type; + index12 = Main.tileStone[index20] ? 1 : index20; + } + if ((int) tilePtr1[1439].active != 0) + { + int index20 = (int) tilePtr1[1439].type; + index14 = Main.tileStone[index20] ? 1 : index20; + } + if ((int) tilePtr1[-1439].active != 0) + { + int index20 = (int) tilePtr1[-1439].type; + index17 = Main.tileStone[index20] ? 1 : index20; + } + if ((int) tilePtr1[1441].active != 0) + { + int index20 = (int) tilePtr1[1441].type; + index19 = Main.tileStone[index20] ? 1 : index20; + } + if (type == 19) + { + if (index16 >= 0 && !Main.tileSolid[index16]) + index16 = -1; + if (index15 >= 0 && !Main.tileSolid[index15]) + index15 = -1; + num3 = index15 != type ? (index15 >= 0 ? (index16 != type ? (index16 >= 0 ? 90 : 108) : 54) : (index16 != type ? (index16 <= 0 ? 90 : 126) : 36)) : (index16 != type ? (index16 >= 0 ? 72 : 18) : 0); + num4 = 18 * (int) tilePtr1->frameNumber; + } + else if (type == 80) + { + WorldGen.CactusFrame(i, j); + return; + } + else if (type == 49) + { + WorldGen.CheckOnTable1x1(i, j); + return; + } + WorldGen.mergeUp = false; + WorldGen.mergeDown = false; + WorldGen.mergeLeft = false; + WorldGen.mergeRight = false; + if (frameNumber < 0) + { + frameNumber = WorldGen.genRand.Next(3); + tilePtr1->frameNumber = (byte) frameNumber; + } + else + frameNumber = (int) tilePtr1->frameNumber; + if (type == 0) + { + if (index13 >= 0 && Main.tileMergeDirt[index13]) + { + WorldGen.TileFrame(i, j - 1, 0); + if (WorldGen.mergeDown) + index13 = type; + } + if (index18 >= 0 && Main.tileMergeDirt[index18]) + { + WorldGen.TileFrame(i, j + 1, 0); + if (WorldGen.mergeUp) + index18 = type; + } + if (index15 >= 0 && Main.tileMergeDirt[index15]) + { + WorldGen.TileFrame(i - 1, j, 0); + if (WorldGen.mergeRight) + index15 = type; + } + if (index16 >= 0 && Main.tileMergeDirt[index16]) + { + WorldGen.TileFrame(i + 1, j, 0); + if (WorldGen.mergeLeft) + index16 = type; + } + if (index13 == 2 || index13 == 23 || index13 == 109) + index13 = type; + if (index18 == 2 || index18 == 23 || index18 == 109) + index18 = type; + if (index15 == 2 || index15 == 23 || index15 == 109) + index15 = type; + if (index16 == 2 || index16 == 23 || index16 == 109) + index16 = type; + if (index12 >= 0 && Main.tileMergeDirt[index12]) + index12 = type; + else if (index12 == 2 || index12 == 23 || index12 == 109) + index12 = type; + if (index14 >= 0 && Main.tileMergeDirt[index14]) + index14 = type; + else if (index14 == 2 || index14 == 23 || index14 == 109) + index14 = type; + if (index17 >= 0 && Main.tileMergeDirt[index17]) + index17 = type; + else if (index17 == 2 || index17 == 23 || index14 == 109) + index17 = type; + if (index19 >= 0 && Main.tileMergeDirt[index19]) + index19 = type; + else if (index19 == 2 || index19 == 23 || index19 == 109) + index19 = type; + if (j < Main.rockLayer) + { + if (index13 == 59) + index13 = -2; + if (index18 == 59) + index18 = -2; + if (index15 == 59) + index15 = -2; + if (index16 == 59) + index16 = -2; + if (index12 == 59) + index12 = -2; + if (index14 == 59) + index14 = -2; + if (index17 == 59) + index17 = -2; + if (index19 == 59) + index19 = -2; + } + } + else if (Main.tileMergeDirt[type]) + { + if (index13 == 0) + index13 = -2; + if (index18 == 0) + index18 = -2; + if (index15 == 0) + index15 = -2; + if (index16 == 0) + index16 = -2; + if (index12 == 0) + index12 = -2; + if (index14 == 0) + index14 = -2; + if (index17 == 0) + index17 = -2; + if (index19 == 0) + index19 = -2; + if (type == 1) + { + if (j > Main.rockLayer) + { + if (index13 == 59) + { + WorldGen.TileFrame(i, j - 1, 0); + if (WorldGen.mergeDown) + index13 = type; + } + if (index18 == 59) + { + WorldGen.TileFrame(i, j + 1, 0); + if (WorldGen.mergeUp) + index18 = type; + } + if (index15 == 59) + { + WorldGen.TileFrame(i - 1, j, 0); + if (WorldGen.mergeRight) + index15 = type; + } + if (index16 == 59) + { + WorldGen.TileFrame(i + 1, j, 0); + if (WorldGen.mergeLeft) + index16 = type; + } + if (index12 == 59) + index12 = type; + if (index14 == 59) + index14 = type; + if (index17 == 59) + index17 = type; + if (index19 == 59) + index19 = type; + } + if (index13 == 57) + { + WorldGen.TileFrame(i, j - 1, 0); + if (WorldGen.mergeDown) + index13 = type; + } + if (index18 == 57) + { + WorldGen.TileFrame(i, j + 1, 0); + if (WorldGen.mergeUp) + index18 = type; + } + if (index15 == 57) + { + WorldGen.TileFrame(i - 1, j, 0); + if (WorldGen.mergeRight) + index15 = type; + } + if (index16 == 57) + { + WorldGen.TileFrame(i + 1, j, 0); + if (WorldGen.mergeLeft) + index16 = type; + } + if (index12 == 57) + index12 = type; + if (index14 == 57) + index14 = type; + if (index17 == 57) + index17 = type; + if (index19 == 57) + index19 = type; + } + } + else if (type == 58 || type == 76 || type == 75) + { + if (index13 == 57) + index13 = -2; + if (index18 == 57) + index18 = -2; + if (index15 == 57) + index15 = -2; + if (index16 == 57) + index16 = -2; + if (index12 == 57) + index12 = -2; + if (index14 == 57) + index14 = -2; + if (index17 == 57) + index17 = -2; + if (index19 == 57) + index19 = -2; + } + else if (type == 59) + { + if (j > Main.rockLayer) + { + if (index13 == 1) + index13 = -2; + if (index18 == 1) + index18 = -2; + if (index15 == 1) + index15 = -2; + if (index16 == 1) + index16 = -2; + if (index12 == 1) + index12 = -2; + if (index14 == 1) + index14 = -2; + if (index17 == 1) + index17 = -2; + if (index19 == 1) + index19 = -2; + } + if (index13 == 60 || index13 == 70) + index13 = type; + if (index18 == 60 || index18 == 70) + index18 = type; + if (index15 == 60 || index15 == 70) + index15 = type; + if (index16 == 60 || index16 == 70) + index16 = type; + if (index12 == 60 || index12 == 70) + index12 = type; + if (index14 == 60 || index14 == 70) + index14 = type; + if (index17 == 60 || index17 == 70) + index17 = type; + if (index19 == 60 || index19 == 70) + index19 = type; + if (j < Main.rockLayer) + { + if (index13 == 0) + { + WorldGen.TileFrame(i, j - 1, 0); + if (WorldGen.mergeDown) + index13 = type; + } + if (index18 == 0) + { + WorldGen.TileFrame(i, j + 1, 0); + if (WorldGen.mergeUp) + index18 = type; + } + if (index15 == 0) + { + WorldGen.TileFrame(i - 1, j, 0); + if (WorldGen.mergeRight) + index15 = type; + } + if (index16 == 0) + { + WorldGen.TileFrame(i + 1, j, 0); + if (WorldGen.mergeLeft) + index16 = type; + } + if (index12 == 0) + index12 = type; + if (index14 == 0) + index14 = type; + if (index17 == 0) + index17 = type; + if (index19 == 0) + index19 = type; + } + } + else if (type == 57) + { + if (index13 == 1) + index13 = -2; + if (index18 == 1) + index18 = -2; + if (index15 == 1) + index15 = -2; + if (index16 == 1) + index16 = -2; + if (index12 == 1) + index12 = -2; + if (index14 == 1) + index14 = -2; + if (index17 == 1) + index17 = -2; + if (index19 == 1) + index19 = -2; + if (index13 == 58 || index13 == 76 || index13 == 75) + { + WorldGen.TileFrame(i, j - 1, 0); + if (WorldGen.mergeDown) + index13 = type; + } + if (index18 == 58 || index18 == 76 || index18 == 75) + { + WorldGen.TileFrame(i, j + 1, 0); + if (WorldGen.mergeUp) + index18 = type; + } + if (index15 == 58 || index15 == 76 || index15 == 75) + { + WorldGen.TileFrame(i - 1, j, 0); + if (WorldGen.mergeRight) + index15 = type; + } + if (index16 == 58 || index16 == 76 || index16 == 75) + { + WorldGen.TileFrame(i + 1, j, 0); + if (WorldGen.mergeLeft) + index16 = type; + } + if (index12 == 58 || index12 == 76 || index12 == 75) + index12 = type; + if (index14 == 58 || index14 == 76 || index14 == 75) + index14 = type; + if (index17 == 58 || index17 == 76 || index17 == 75) + index17 = type; + if (index19 == 58 || index19 == 76 || index19 == 75) + index19 = type; + } + else if (type == 32) + { + if (index18 == 23) + index18 = type; + } + else if (type == 69) + { + if (index18 == 60) + index18 = type; + } + else if (type == 51) + { + if (index13 >= 0 && !Main.tileNoAttach[index13]) + index13 = type; + if (index18 >= 0 && !Main.tileNoAttach[index18]) + index18 = type; + if (index15 >= 0 && !Main.tileNoAttach[index15]) + index15 = type; + if (index16 >= 0 && !Main.tileNoAttach[index16]) + index16 = type; + if (index12 >= 0 && !Main.tileNoAttach[index12]) + index12 = type; + if (index14 >= 0 && !Main.tileNoAttach[index14]) + index14 = type; + if (index17 >= 0 && !Main.tileNoAttach[index17]) + index17 = type; + if (index19 >= 0 && !Main.tileNoAttach[index19]) + index19 = type; + } + bool flag3 = false; + if (type == 2 || type == 23 || (type == 60 || type == 70) || type == 109) + { + flag3 = true; + if (index13 >= 0 && index13 != type && !Main.tileSolid[index13]) + index13 = -1; + if (index18 >= 0 && index18 != type && !Main.tileSolid[index18]) + index18 = -1; + if (index15 >= 0 && index15 != type && !Main.tileSolid[index15]) + index15 = -1; + if (index16 >= 0 && index16 != type && !Main.tileSolid[index16]) + index16 = -1; + if (index12 >= 0 && index12 != type && !Main.tileSolid[index12]) + index12 = -1; + if (index14 >= 0 && index14 != type && !Main.tileSolid[index14]) + index14 = -1; + if (index17 >= 0 && index17 != type && !Main.tileSolid[index17]) + index17 = -1; + if (index19 >= 0 && index19 != type && !Main.tileSolid[index19]) + index19 = -1; + int num22 = 0; + if (type == 60 || type == 70) + num22 = 59; + else if (type == 2) + { + if (index13 == 23) + index13 = num22; + if (index18 == 23) + index18 = num22; + if (index15 == 23) + index15 = num22; + if (index16 == 23) + index16 = num22; + if (index12 == 23) + index12 = num22; + if (index14 == 23) + index14 = num22; + if (index17 == 23) + index17 = num22; + if (index19 == 23) + index19 = num22; + } + else if (type == 23) + { + if (index13 == 2) + index13 = num22; + if (index18 == 2) + index18 = num22; + if (index15 == 2) + index15 = num22; + if (index16 == 2) + index16 = num22; + if (index12 == 2) + index12 = num22; + if (index14 == 2) + index14 = num22; + if (index17 == 2) + index17 = num22; + if (index19 == 2) + index19 = num22; + } + if (index13 != type && index13 != num22 && (index18 == type || index18 == num22)) + { + if (index15 == num22 && index16 == type) + { + num3 = 18 * frameNumber; + num4 = 198; + } + else if (index15 == type && index16 == num22) + { + num3 = 54 + 18 * frameNumber; + num4 = 198; + } + } + else if (index18 != type && index18 != num22 && (index13 == type || index13 == num22)) + { + if (index15 == num22 && index16 == type) + { + num3 = 18 * frameNumber; + num4 = 216; + } + else if (index15 == type && index16 == num22) + { + num3 = 54 + 18 * frameNumber; + num4 = 216; + } + } + else if (index15 != type && index15 != num22 && (index16 == type || index16 == num22)) + { + if (index13 == num22 && index18 == type) + { + num3 = 72; + num4 = 144 + 18 * frameNumber; + } + else if (index18 == type && index16 == index13) + { + num3 = 72; + num4 = 90 + 18 * frameNumber; + } + } + else if (index16 != type && index16 != num22 && (index15 == type || index15 == num22)) + { + if (index13 == num22 && index18 == type) + { + num3 = 90; + num4 = 144 + 18 * frameNumber; + } + else if (index18 == type && index16 == index13) + { + num3 = 90; + num4 = 90 + 18 * frameNumber; + } + } + else if (index13 == type && index18 == type && (index15 == type && index16 == type)) + { + if (index12 != type && index14 != type && (index17 != type && index19 != type)) + { + if (index19 == num22) + { + num4 = 324; + num3 = 108 + 18 * frameNumber; + } + else if (index14 == num22) + { + num4 = 342; + num3 = 108 + 18 * frameNumber; + } + else if (index17 == num22) + { + num4 = 360; + num3 = 108 + 18 * frameNumber; + } + else if (index12 == num22) + { + num4 = 378; + num3 = 108 + 18 * frameNumber; + } + else + { + num4 = 234; + num3 = 144 + 54 * frameNumber; + } + } + else if (index12 != type && index19 != type) + { + num4 = 306; + num3 = 36 + 18 * frameNumber; + } + else if (index14 != type && index17 != type) + { + num4 = 306; + num3 = 90 + 18 * frameNumber; + } + else if (index12 != type && index14 == type && (index17 == type && index19 == type)) + { + num3 = 54; + num4 = 108 + 36 * frameNumber; + } + else if (index12 == type && index14 != type && (index17 == type && index19 == type)) + { + num3 = 36; + num4 = 108 + 36 * frameNumber; + } + else if (index12 == type && index14 == type && (index17 != type && index19 == type)) + { + num3 = 54; + num4 = 90 + 36 * frameNumber; + } + else if (index12 == type && index14 == type && (index17 == type && index19 != type)) + { + num3 = 36; + num4 = 90 + 36 * frameNumber; + } + } + else if (index13 == type && index18 == num22 && (index15 == type && index16 == type) && (index12 == -1 && index14 == -1)) + { + num4 = 18; + num3 = 108 + 18 * frameNumber; + } + else if (index13 == num22 && index18 == type && (index15 == type && index16 == type) && (index17 == -1 && index19 == -1)) + { + num4 = 36; + num3 = 108 + 18 * frameNumber; + } + else if (index13 == type && index18 == type && (index15 == num22 && index16 == type) && (index14 == -1 && index19 == -1)) + { + num3 = 198; + num4 = 18 * frameNumber; + } + else if (index13 == type && index18 == type && (index15 == type && index16 == num22) && (index12 == -1 && index17 == -1)) + { + num3 = 180; + num4 = 18 * frameNumber; + } + else if (index13 == type && index18 == num22 && (index15 == type && index16 == type)) + { + if (index14 != -1) + { + num3 = 54; + num4 = 108 + 36 * frameNumber; + } + else if (index12 != -1) + { + num3 = 36; + num4 = 108 + 36 * frameNumber; + } + } + else if (index13 == num22 && index18 == type && (index15 == type && index16 == type)) + { + if (index19 != -1) + { + num3 = 54; + num4 = 90 + 36 * frameNumber; + } + else if (index17 != -1) + { + num3 = 36; + num4 = 90 + 36 * frameNumber; + } + } + else if (index13 == type && index18 == type && (index15 == type && index16 == num22)) + { + if (index12 != -1) + { + num3 = 54; + num4 = 90 + 36 * frameNumber; + } + else if (index17 != -1) + { + num3 = 54; + num4 = 108 + 36 * frameNumber; + } + } + else if (index13 == type && index18 == type && (index15 == num22 && index16 == type)) + { + if (index14 != -1) + { + num3 = 36; + num4 = 90 + 36 * frameNumber; + } + else if (index19 != -1) + { + num3 = 36; + num4 = 108 + 36 * frameNumber; + } + } + else if (index13 == num22 && index18 == type && (index15 == type && index16 == type) || index13 == type && index18 == num22 && (index15 == type && index16 == type) || (index13 == type && index18 == type && (index15 == num22 && index16 == type) || index13 == type && index18 == type && (index15 == type && index16 == num22))) + { + num4 = 18; + num3 = 18 + 18 * frameNumber; + } + if ((index13 == type || index13 == num22) && (index18 == type || index18 == num22) && ((index15 == type || index15 == num22) && (index16 == type || index16 == num22))) + { + if (index12 != type && index12 != num22 && (index14 == type || index14 == num22) && ((index17 == type || index17 == num22) && (index19 == type || index19 == num22))) + { + num3 = 54; + num4 = 108 + 36 * frameNumber; + } + else if (index14 != type && index14 != num22 && (index12 == type || index12 == num22) && ((index17 == type || index17 == num22) && (index19 == type || index19 == num22))) + { + num3 = 36; + num4 = 108 + 36 * frameNumber; + } + else if (index17 != type && index17 != num22 && (index12 == type || index12 == num22) && ((index14 == type || index14 == num22) && (index19 == type || index19 == num22))) + { + num3 = 54; + num4 = 90 + 36 * frameNumber; + } + else if (index19 != type && index19 != num22 && (index12 == type || index12 == num22) && ((index17 == type || index17 == num22) && (index14 == type || index14 == num22))) + { + num3 = 36; + num4 = 90 + 36 * frameNumber; + } + } + if (index13 != num22 && index13 != type && (index18 == type && index15 != num22) && (index15 != type && index16 == type && (index19 != num22 && index19 != type))) + { + num4 = 270; + num3 = 90 + 18 * frameNumber; + } + else if (index13 != num22 && index13 != type && (index18 == type && index15 == type) && (index16 != num22 && index16 != type && (index17 != num22 && index17 != type))) + { + num4 = 270; + num3 = 144 + 18 * frameNumber; + } + else if (index18 != num22 && index18 != type && (index13 == type && index15 != num22) && (index15 != type && index16 == type && (index14 != num22 && index14 != type))) + { + num4 = 288; + num3 = 90 + 18 * frameNumber; + } + else if (index18 != num22 && index18 != type && (index13 == type && index15 == type) && (index16 != num22 && index16 != type && (index12 != num22 && index12 != type))) + { + num4 = 288; + num3 = 144 + 18 * frameNumber; + } + else if (index13 != type && index13 != num22 && (index18 == type && index15 == type) && (index16 == type && index17 != type && (index17 != num22 && index19 != type)) && index19 != num22) + { + num4 = 216; + num3 = 144 + 54 * frameNumber; + } + else if (index18 != type && index18 != num22 && (index13 == type && index15 == type) && (index16 == type && index12 != type && (index12 != num22 && index14 != type)) && index14 != num22) + { + num4 = 252; + num3 = 144 + 54 * frameNumber; + } + else if (index15 != type && index15 != num22 && (index18 == type && index13 == type) && (index16 == type && index14 != type && (index14 != num22 && index19 != type)) && index19 != num22) + { + num4 = 234; + num3 = 126 + 54 * frameNumber; + } + else if (index16 != type && index16 != num22 && (index18 == type && index13 == type) && (index15 == type && index12 != type && (index12 != num22 && index17 != type)) && index17 != num22) + { + num4 = 234; + num3 = 162 + 54 * frameNumber; + } + else if (index13 != num22 && index13 != type && (index18 == num22 || index18 == type) && (index15 == num22 && index16 == num22)) + { + num4 = 270; + num3 = 36 + 18 * frameNumber; + } + else if (index18 != num22 && index18 != type && (index13 == num22 || index13 == type) && (index15 == num22 && index16 == num22)) + { + num4 = 288; + num3 = 36 + 18 * frameNumber; + } + else if (index15 != num22 && index15 != type && (index16 == num22 || index16 == type) && (index13 == num22 && index18 == num22)) + { + num3 = 0; + num4 = 270 + 18 * frameNumber; + } + else if (index16 != num22 && index16 != type && (index15 == num22 || index15 == type) && (index13 == num22 && index18 == num22)) + { + num3 = 18; + num4 = 270 + 18 * frameNumber; + } + else if (index13 == type && index18 == num22 && (index15 == num22 && index16 == num22)) + { + num4 = 288; + num3 = 198 + 18 * frameNumber; + } + else if (index13 == num22 && index18 == type && (index15 == num22 && index16 == num22)) + { + num4 = 270; + num3 = 198 + 18 * frameNumber; + } + else if (index13 == num22 && index18 == num22 && (index15 == type && index16 == num22)) + { + num4 = 306; + num3 = 198 + 18 * frameNumber; + } + else if (index13 == num22 && index18 == num22 && (index15 == num22 && index16 == type)) + { + num4 = 306; + num3 = 144 + 18 * frameNumber; + } + if (index13 != type && index13 != num22 && (index18 == type && index15 == type) && index16 == type) + { + if ((index17 == num22 || index17 == type) && (index19 != num22 && index19 != type)) + { + num4 = 324; + num3 = 18 * frameNumber; + } + else if ((index19 == num22 || index19 == type) && (index17 != num22 && index17 != type)) + { + num4 = 324; + num3 = 54 + 18 * frameNumber; + } + } + else if (index18 != type && index18 != num22 && (index13 == type && index15 == type) && index16 == type) + { + if ((index12 == num22 || index12 == type) && (index14 != num22 && index14 != type)) + { + num4 = 342; + num3 = 18 * frameNumber; + } + else if ((index14 == num22 || index14 == type) && (index12 != num22 && index12 != type)) + { + num4 = 342; + num3 = 54 + 18 * frameNumber; + } + } + else if (index15 != type && index15 != num22 && (index13 == type && index18 == type) && index16 == type) + { + if ((index14 == num22 || index14 == type) && (index19 != num22 && index19 != type)) + { + num4 = 360; + num3 = 54 + 18 * frameNumber; + } + else if ((index19 == num22 || index19 == type) && (index14 != num22 && index14 != type)) + { + num4 = 360; + num3 = 18 * frameNumber; + } + } + else if (index16 != type && index16 != num22 && (index13 == type && index18 == type) && index15 == type) + { + if ((index12 == num22 || index12 == type) && (index17 != num22 && index17 != type)) + { + num4 = 378; + num3 = 18 * frameNumber; + } + else if ((index17 == num22 || index17 == type) && (index12 != num22 && index12 != type)) + { + num4 = 378; + num3 = 54 + 18 * frameNumber; + } + } + if ((index13 == type || index13 == num22) && (index18 == type || index18 == num22) && ((index15 == type || index15 == num22) && (index16 == type || index16 == num22)) && (index12 != -1 && index14 != -1 && (index17 != -1 && index19 != -1))) + { + num4 = 18; + num3 = 18 + 18 * frameNumber; + } + if (index13 == num22) + index13 = -2; + if (index18 == num22) + index18 = -2; + if (index15 == num22) + index15 = -2; + if (index16 == num22) + index16 = -2; + if (index12 == num22) + index12 = -2; + if (index14 == num22) + index14 = -2; + if (index17 == num22) + index17 = -2; + if (index19 == num22) + index19 = -2; + } + if (num3 == -1 && (Main.tileMergeDirt[type] || type == 0 || (type == 2 || type == 57) || (type == 58 || type == 59 || (type == 60 || type == 70)) || (type == 109 || type == 76 || type == 75))) + { + if (!flag3) + { + flag3 = true; + if (index12 >= 0 && index12 != type && !Main.tileSolid[index12]) + index12 = -1; + if (index14 >= 0 && index14 != type && !Main.tileSolid[index14]) + index14 = -1; + if (index17 >= 0 && index17 != type && !Main.tileSolid[index17]) + index17 = -1; + if (index19 >= 0 && index19 != type && !Main.tileSolid[index19]) + index19 = -1; + } + if (index13 >= 0 && index13 != type) + index13 = -1; + if (index18 >= 0 && index18 != type) + index18 = -1; + if (index15 >= 0 && index15 != type) + index15 = -1; + if (index16 >= 0 && index16 != type) + index16 = -1; + if (index13 != -1 && index18 != -1 && (index15 != -1 && index16 != -1)) + { + if (index13 == -2 && index18 == type && (index15 == type && index16 == type)) + { + num4 = 108; + num3 = 144 + 18 * frameNumber; + WorldGen.mergeUp = true; + } + else if (index13 == type && index18 == -2 && (index15 == type && index16 == type)) + { + num4 = 90; + num3 = 144 + 18 * frameNumber; + WorldGen.mergeDown = true; + } + else if (index13 == type && index18 == type && (index15 == -2 && index16 == type)) + { + num3 = 162; + num4 = 126 + 18 * frameNumber; + WorldGen.mergeLeft = true; + } + else if (index13 == type && index18 == type && (index15 == type && index16 == -2)) + { + num3 = 144; + num4 = 126 + 18 * frameNumber; + WorldGen.mergeRight = true; + } + else if (index13 == -2 && index18 == type && (index15 == -2 && index16 == type)) + { + num3 = 36; + num4 = 90 + 36 * frameNumber; + WorldGen.mergeUp = true; + WorldGen.mergeLeft = true; + } + else if (index13 == -2 && index18 == type && (index15 == type && index16 == -2)) + { + num3 = 54; + num4 = 90 + 36 * frameNumber; + WorldGen.mergeUp = true; + WorldGen.mergeRight = true; + } + else if (index13 == type && index18 == -2 && (index15 == -2 && index16 == type)) + { + num3 = 36; + num4 = 108 + 36 * frameNumber; + WorldGen.mergeDown = true; + WorldGen.mergeLeft = true; + } + else if (index13 == type && index18 == -2 && (index15 == type && index16 == -2)) + { + num3 = 54; + num4 = 108 + 36 * frameNumber; + WorldGen.mergeDown = true; + WorldGen.mergeRight = true; + } + else if (index13 == type && index18 == type && (index15 == -2 && index16 == -2)) + { + num3 = 180; + num4 = 126 + 18 * frameNumber; + WorldGen.mergeLeft = true; + WorldGen.mergeRight = true; + } + else if (index13 == -2 && index18 == -2 && (index15 == type && index16 == type)) + { + num4 = 180; + num3 = 144 + 18 * frameNumber; + WorldGen.mergeUp = true; + WorldGen.mergeDown = true; + } + else if (index13 == -2 && index18 == type && (index15 == -2 && index16 == -2)) + { + num3 = 198; + num4 = 90 + 18 * frameNumber; + WorldGen.mergeUp = true; + WorldGen.mergeLeft = true; + WorldGen.mergeRight = true; + } + else if (index13 == type && index18 == -2 && (index15 == -2 && index16 == -2)) + { + num3 = 198; + num4 = 144 + 18 * frameNumber; + WorldGen.mergeDown = true; + WorldGen.mergeLeft = true; + WorldGen.mergeRight = true; + } + else if (index13 == -2 && index18 == -2 && (index15 == type && index16 == -2)) + { + num3 = 216; + num4 = 144 + 18 * frameNumber; + WorldGen.mergeUp = true; + WorldGen.mergeDown = true; + WorldGen.mergeRight = true; + } + else if (index13 == -2 && index18 == -2 && (index15 == -2 && index16 == type)) + { + num3 = 216; + num4 = 90 + 18 * frameNumber; + WorldGen.mergeUp = true; + WorldGen.mergeDown = true; + WorldGen.mergeLeft = true; + } + else if (index13 == -2 && index18 == -2 && (index15 == -2 && index16 == -2)) + { + num4 = 198; + num3 = 108 + 18 * frameNumber; + WorldGen.mergeUp = true; + WorldGen.mergeDown = true; + WorldGen.mergeLeft = true; + WorldGen.mergeRight = true; + } + else if (index13 == type && index18 == type && (index15 == type && index16 == type)) + { + if (index19 == -2) + { + num3 = 0; + num4 = 90 + 36 * frameNumber; + } + else if (index17 == -2) + { + num3 = 18; + num4 = 90 + 36 * frameNumber; + } + else if (index14 == -2) + { + num3 = 0; + num4 = 108 + 36 * frameNumber; + } + else if (index12 == -2) + { + num3 = 18; + num4 = 108 + 36 * frameNumber; + } + } + } + else + { + if (type != 2 && type != 23 && (type != 60 && type != 70) && type != 109) + { + if (index13 == -1 && index18 == -2 && (index15 == type && index16 == type)) + { + num4 = 0; + num3 = 234 + 18 * frameNumber; + WorldGen.mergeDown = true; + } + else if (index13 == -2 && index18 == -1 && (index15 == type && index16 == type)) + { + num4 = 18; + num3 = 234 + 18 * frameNumber; + WorldGen.mergeUp = true; + } + else if (index13 == type && index18 == type && (index15 == -1 && index16 == -2)) + { + num4 = 36; + num3 = 234 + 18 * frameNumber; + WorldGen.mergeRight = true; + } + else if (index13 == type && index18 == type && (index15 == -2 && index16 == -1)) + { + num4 = 54; + num3 = 234 + 18 * frameNumber; + WorldGen.mergeLeft = true; + } + } + if (index13 != -1 && index18 != -1 && (index15 == -1 && index16 == type)) + { + if (index13 == -2 && index18 == type) + { + num3 = 72; + num4 = 144 + 18 * frameNumber; + WorldGen.mergeUp = true; + } + else if (index18 == -2 && index13 == type) + { + num3 = 72; + num4 = 90 + 18 * frameNumber; + WorldGen.mergeDown = true; + } + } + else if (index13 != -1 && index18 != -1 && (index15 == type && index16 == -1)) + { + if (index13 == -2 && index18 == type) + { + num3 = 90; + num4 = 144 + 18 * frameNumber; + WorldGen.mergeUp = true; + } + else if (index18 == -2 && index13 == type) + { + num3 = 90; + num4 = 90 + 18 * frameNumber; + WorldGen.mergeDown = true; + } + } + else if (index13 == -1 && index18 == type && (index15 != -1 && index16 != -1)) + { + if (index15 == -2 && index16 == type) + { + num3 = 18 * frameNumber; + num4 = 198; + WorldGen.mergeLeft = true; + } + else if (index16 == -2 && index15 == type) + { + num3 = 54 + 18 * frameNumber; + num4 = 198; + WorldGen.mergeRight = true; + } + } + else if (index13 == type && index18 == -1 && (index15 != -1 && index16 != -1)) + { + if (index15 == -2 && index16 == type) + { + num3 = 18 * frameNumber; + num4 = 216; + WorldGen.mergeLeft = true; + } + else if (index16 == -2 && index15 == type) + { + num3 = 54 + 18 * frameNumber; + num4 = 216; + WorldGen.mergeRight = true; + } + } + else if (index13 != -1 && index18 != -1 && (index15 == -1 && index16 == -1)) + { + if (index13 == -2 && index18 == -2) + { + num3 = 108; + num4 = 216 + 18 * frameNumber; + WorldGen.mergeUp = true; + WorldGen.mergeDown = true; + } + else if (index13 == -2) + { + num3 = 126; + num4 = 144 + 18 * frameNumber; + WorldGen.mergeUp = true; + } + else if (index18 == -2) + { + num3 = 126; + num4 = 90 + 18 * frameNumber; + WorldGen.mergeDown = true; + } + } + else if (index13 == -1 && index18 == -1 && (index15 != -1 && index16 != -1)) + { + if (index15 == -2 && index16 == -2) + { + num4 = 198; + num3 = 162 + 18 * frameNumber; + WorldGen.mergeLeft = true; + WorldGen.mergeRight = true; + } + else if (index15 == -2) + { + num4 = 252; + num3 = 18 * frameNumber; + WorldGen.mergeLeft = true; + } + else if (index16 == -2) + { + num4 = 252; + num3 = 54 + 18 * frameNumber; + WorldGen.mergeRight = true; + } + } + else if (index13 == -2 && index18 == -1 && (index15 == -1 && index16 == -1)) + { + num3 = 108; + num4 = 144 + 18 * frameNumber; + WorldGen.mergeUp = true; + } + else if (index13 == -1 && index18 == -2 && (index15 == -1 && index16 == -1)) + { + num3 = 108; + num4 = 90 + 18 * frameNumber; + WorldGen.mergeDown = true; + } + else if (index13 == -1 && index18 == -1 && (index15 == -2 && index16 == -1)) + { + num4 = 234; + num3 = 18 * frameNumber; + WorldGen.mergeLeft = true; + } + else if (index13 == -1 && index18 == -1 && (index15 == -1 && index16 == -2)) + { + num4 = 234; + num3 = 54 + 18 * frameNumber; + WorldGen.mergeRight = true; + } + } + } + if (num3 < 0) + { + if (!flag3) + { + if (index13 >= 0 && index13 != type && !Main.tileSolid[index13]) + index13 = -1; + if (index18 >= 0 && index18 != type && !Main.tileSolid[index18]) + index18 = -1; + if (index15 >= 0 && index15 != type && !Main.tileSolid[index15]) + index15 = -1; + if (index16 >= 0 && index16 != type && !Main.tileSolid[index16]) + index16 = -1; + if (index12 >= 0 && index12 != type && !Main.tileSolid[index12]) + index12 = -1; + if (index14 >= 0 && index14 != type && !Main.tileSolid[index14]) + index14 = -1; + if (index17 >= 0 && index17 != type && !Main.tileSolid[index17]) + index17 = -1; + if (index19 >= 0 && index19 != type && !Main.tileSolid[index19]) + index19 = -1; + } + if (type == 2 || type == 23 || (type == 60 || type == 70) || type == 109) + { + if (index13 == -2) + index13 = type; + if (index18 == -2) + index18 = type; + if (index15 == -2) + index15 = type; + if (index16 == -2) + index16 = type; + if (index12 == -2) + index12 = type; + if (index14 == -2) + index14 = type; + if (index17 == -2) + index17 = type; + if (index19 == -2) + index19 = type; + } + if (index13 == type && index18 == type && index15 == type & index16 == type) + { + if (index12 != type && index14 != type) + { + num4 = 18; + num3 = 108 + 18 * frameNumber; + } + else if (index17 != type && index19 != type) + { + num4 = 36; + num3 = 108 + 18 * frameNumber; + } + else if (index12 != type && index17 != type) + { + num3 = 180; + num4 = 18 * frameNumber; + } + else if (index14 != type && index19 != type) + { + num3 = 198; + num4 = 18 * frameNumber; + } + else + { + num4 = 18; + num3 = 18 + 18 * frameNumber; + } + } + else if (index13 != type && index18 == type && index15 == type & index16 == type) + { + num4 = 0; + num3 = 18 + 18 * frameNumber; + } + else if (index13 == type && index18 != type && index15 == type & index16 == type) + { + num4 = 36; + num3 = 18 + 18 * frameNumber; + } + else if (index13 == type && index18 == type && index15 != type & index16 == type) + { + num3 = 0; + num4 = 18 * frameNumber; + } + else if (index13 == type && index18 == type && index15 == type & index16 != type) + { + num3 = 72; + num4 = 18 * frameNumber; + } + else if (index13 != type && index18 == type && index15 != type & index16 == type) + { + num3 = 36 * frameNumber; + num4 = 54; + } + else if (index13 != type && index18 == type && index15 == type & index16 != type) + { + num3 = 18 + 36 * frameNumber; + num4 = 54; + } + else if (index13 == type && index18 != type && index15 != type & index16 == type) + { + num3 = 36 * frameNumber; + num4 = 72; + } + else if (index13 == type && index18 != type && index15 == type & index16 != type) + { + num3 = 18 + 36 * frameNumber; + num4 = 72; + } + else if (index13 == type && index18 == type && index15 != type & index16 != type) + { + num3 = 90; + num4 = 18 * frameNumber; + } + else if (index13 != type && index18 != type && index15 == type & index16 == type) + { + num3 = 108 + 18 * frameNumber; + num4 = 72; + } + else if (index13 != type && index18 == type && index15 != type & index16 != type) + { + num3 = 108 + 18 * frameNumber; + num4 = 0; + } + else if (index13 == type && index18 != type && index15 != type & index16 != type) + { + num3 = 108 + 18 * frameNumber; + num4 = 54; + } + else if (index13 != type && index18 != type && index15 != type & index16 == type) + { + num3 = 162; + num4 = 18 * frameNumber; + } + else if (index13 != type && index18 != type && index15 == type & index16 != type) + { + num3 = 216; + num4 = 18 * frameNumber; + } + else if (index13 != type && index18 != type && index15 != type & index16 != type) + { + num3 = 162 + 18 * frameNumber; + num4 = 54; + } + } + if (num3 < 0) + { + num4 = 18; + num3 = 18 + 18 * frameNumber; + } + tilePtr1->frameX = (short) num3; + tilePtr1->frameY = (short) num4; + if (type == 52 || type == 62 || type == 115) + { + int num22 = (int) tilePtr1[-1].active != 0 ? (int) tilePtr1[-1].type : -1; + if (type == 52 && (num22 == 109 || num22 == 115)) + { + tilePtr1->type = (byte) 115; + WorldGen.SquareTileFrame(i, j, -1); + return; + } + else if (type == 115 && (num22 == 2 || num22 == 52)) + { + tilePtr1->type = (byte) 52; + WorldGen.SquareTileFrame(i, j, -1); + return; + } + else if (num22 != type && (num22 == -1 || type == 52 && num22 != 2 || (type == 62 && num22 != 60 || type == 115 && num22 != 109))) + WorldGen.KillTile(i, j); + } + if (!WorldGen.gen && Main.netMode != 1 && (type == 53 || type == 112 || (type == 116 || type == 123)) && (int) tilePtr1[1].active == 0) + { + Tile* tilePtr2 = tilePtr1 - 1; + if ((int) tilePtr2->active == 0 || (int) tilePtr2->type != 21) + { + tilePtr1->active = (byte) 0; + WorldGen.sandBuffer[WorldGen.currentSandBuffer].Add(i, j); + return; + } + } + if (num1 >= 0 && num3 != num1 && (num2 >= 0 && num4 != num2) && WorldGen.tileFrameRecursion) + { + bool flag4 = WorldGen.mergeUp; + bool flag5 = WorldGen.mergeDown; + bool flag6 = WorldGen.mergeLeft; + bool flag7 = WorldGen.mergeRight; + WorldGen.TileFrame(i, j - 1, 0); + WorldGen.TileFrame(i, j + 1, 0); + WorldGen.TileFrame(i - 1, j, 0); + WorldGen.TileFrame(i + 1, j, 0); + WorldGen.mergeUp = flag4; + WorldGen.mergeDown = flag5; + WorldGen.mergeLeft = flag6; + WorldGen.mergeRight = flag7; + } + } + } + } + } + + public static unsafe void TileFrameNoLiquid(int i, int j, int frameNumber = 0) + { + if (i <= 5 || j <= 5 || (i >= (int) Main.maxTilesX - 5 || j >= (int) Main.maxTilesY - 5)) + return; + fixed (Tile* tilePtr1 = &Main.tile[i, j]) + { + if ((int) tilePtr1->active != 0) + { + int index1 = (int) tilePtr1->type; + if (Main.tileStone[index1]) + index1 = 1; + int num1 = (int) tilePtr1->frameX; + int num2 = (int) tilePtr1->frameY; + int num3 = -1; + int num4 = -1; + if (Main.tileFrameImportant[index1]) + { + switch (index1) + { + case 3: + case 24: + case 61: + case 71: + case 73: + case 74: + case 110: + case 113: + WorldGen.PlantCheck(i, j); + break; + case 4: + int num5 = (int) tilePtr1->frameX >= 66 ? 66 : 0; + int index2 = -1; + int index3 = -1; + int index4 = -1; + int num6 = -1; + int num7 = -1; + int num8 = -1; + int num9 = -1; + if ((int) tilePtr1[-1].active != 0) + { + int num10 = (int) tilePtr1[-1].type; + } + if ((int) tilePtr1[1].active != 0) + index2 = (int) tilePtr1[1].type; + if ((int) tilePtr1[-1440].active != 0) + index3 = (int) tilePtr1[-1440].type; + if ((int) tilePtr1[1440].active != 0) + index4 = (int) tilePtr1[1440].type; + if ((int) tilePtr1[-1439].active != 0) + num6 = (int) tilePtr1[-1439].type; + if ((int) tilePtr1[1441].active != 0) + num7 = (int) tilePtr1[1441].type; + if ((int) tilePtr1[-1441].active != 0) + num8 = (int) tilePtr1[-1441].type; + if ((int) tilePtr1[1439].active != 0) + num9 = (int) tilePtr1[1439].type; + if (index2 >= 0 && Main.tileSolidAndAttach[index2]) + { + tilePtr1->frameX = (short) num5; + break; + } + else if (index3 >= 0 && (Main.tileSolidAndAttach[index3] || index3 == 124 || index3 == 5 && num8 == 5 && num6 == 5)) + { + tilePtr1->frameX = (short) (22 + num5); + break; + } + else if (index4 >= 0 && (Main.tileSolidAndAttach[index4] || index4 == 124 || index4 == 5 && num9 == 5 && num7 == 5)) + { + tilePtr1->frameX = (short) (44 + num5); + break; + } + else + { + WorldGen.KillTile(i, j); + break; + } + case 5: + break; + case 6: + break; + case 7: + break; + case 8: + break; + case 9: + break; + case 10: + if (WorldGen.destroyObject) + break; + int j1 = j - num2 / 18; + bool flag1 = false; + if ((int) Main.tile[i, j1 - 1].active == 0 || !Main.tileSolid[(int) Main.tile[i, j1 - 1].type]) + flag1 = true; + else if ((int) Main.tile[i, j1 + 3].active == 0 || !Main.tileSolid[(int) Main.tile[i, j1 + 3].type]) + flag1 = true; + else if ((int) Main.tile[i, j1].active == 0 || (int) Main.tile[i, j1].type != index1) + flag1 = true; + else if ((int) Main.tile[i, j1 + 1].active == 0 || (int) Main.tile[i, j1 + 1].type != index1) + flag1 = true; + else if ((int) Main.tile[i, j1 + 2].active == 0 || (int) Main.tile[i, j1 + 2].type != index1) + flag1 = true; + if (flag1) + { + WorldGen.destroyObject = true; + WorldGen.KillTile(i, j1); + WorldGen.KillTile(i, j1 + 1); + WorldGen.KillTile(i, j1 + 2); + if (!WorldGen.gen) + Item.NewItem(i * 16, j * 16, 16, 16, 25, 1, false, 0); + } + WorldGen.destroyObject = false; + break; + case 11: + if (WorldGen.destroyObject) + break; + int num11 = 0; + int num12 = 0; + int num13 = i; + int num14 = j; + bool flag2 = false; + if (num1 == 0) + num11 = 1; + else if (num1 == 18) + { + num13 = i - 1; + num12 = -1440; + num11 = 1; + } + else if (num1 == 36) + { + num12 = 1440; + num13 = i + 1; + num11 = -1; + } + else if (num1 == 54) + num11 = -1; + if (num2 == 18) + { + --num12; + num14 = j - 1; + } + else if (num2 == 36) + { + num14 = j - 2; + num12 -= 2; + } + if ((int) tilePtr1[num12 - 1].active == 0 || !Main.tileSolid[(int) tilePtr1[num12 - 1].type] || ((int) tilePtr1[num12 + 3].active == 0 || !Main.tileSolid[(int) tilePtr1[num12 + 3].type])) + { + flag2 = true; + WorldGen.destroyObject = true; + if (!WorldGen.gen) + Item.NewItem(i * 16, j * 16, 16, 16, 25, 1, false, 0); + } + int num15 = num13; + if (num11 == -1) + num15 = num13 - 1; + for (int i1 = num15; i1 < num15 + 2; ++i1) + { + for (int j2 = num14; j2 < num14 + 3; ++j2) + { + if (!flag2) + { + fixed (Tile* tilePtr2 = &Main.tile[i1, j2]) + { + if ((int) tilePtr2->type != 11 || (int) tilePtr2->active == 0) + { + WorldGen.destroyObject = true; + flag2 = true; + i1 = num15; + j2 = num14; + if (!WorldGen.gen) + Item.NewItem(i * 16, j * 16, 16, 16, 25, 1, false, 0); + } + } + } + if (flag2) + WorldGen.KillTile(i1, j2); + } + } + WorldGen.destroyObject = false; + break; + case 12: + break; + case 13: + break; + case 14: + break; + case 15: + break; + case 16: + break; + case 17: + break; + case 18: + break; + case 19: + break; + case 20: + break; + case 21: + break; + case 22: + break; + case 23: + break; + case 25: + break; + case 26: + break; + case 27: + break; + case 28: + break; + case 29: + break; + case 30: + break; + case 31: + break; + case 32: + break; + case 33: + break; + case 34: + break; + case 35: + break; + case 36: + break; + case 37: + break; + case 38: + break; + case 39: + break; + case 40: + break; + case 41: + break; + case 42: + break; + case 43: + break; + case 44: + break; + case 45: + break; + case 46: + break; + case 47: + break; + case 48: + break; + case 49: + break; + case 50: + break; + case 51: + break; + case 52: + break; + case 53: + break; + case 54: + break; + case 55: + break; + case 56: + break; + case 57: + break; + case 58: + break; + case 59: + break; + case 60: + break; + case 62: + break; + case 63: + break; + case 64: + break; + case 65: + break; + case 66: + break; + case 67: + break; + case 68: + break; + case 69: + break; + case 70: + break; + case 72: + int num16 = -1; + int num17 = -1; + if ((int) tilePtr1[-1].active != 0) + num17 = (int) tilePtr1[-1].type; + if ((int) tilePtr1[1].active != 0) + num16 = (int) tilePtr1[1].type; + if (num16 != index1 && num16 != 70) + { + WorldGen.KillTile(i, j); + break; + } + else + { + if (num17 == index1 || (int) tilePtr1->frameX != 0) + break; + tilePtr1->frameNumber = (byte) WorldGen.genRand.Next(3); + tilePtr1->frameX = (short) 18; + tilePtr1->frameY = (short) (18 * (int) tilePtr1->frameNumber); + break; + } + case 75: + break; + case 76: + break; + case 77: + break; + case 78: + break; + case 79: + break; + case 80: + break; + case 81: + int index5 = -1; + int num18 = -1; + int num19 = -1; + int num20 = -1; + if ((int) tilePtr1[-1].active != 0) + num18 = (int) tilePtr1[-1].type; + if ((int) tilePtr1[1].active != 0) + index5 = (int) tilePtr1[1].type; + if ((int) tilePtr1[-1440].active != 0) + num19 = (int) tilePtr1[-1440].type; + if ((int) tilePtr1[1440].active != 0) + num20 = (int) tilePtr1[1440].type; + if (num19 != -1 || num18 != -1 || num20 != -1) + { + WorldGen.KillTile(i, j); + break; + } + else + { + if (index5 >= 0 && Main.tileSolid[index5]) + break; + WorldGen.KillTile(i, j); + break; + } + case 82: + break; + case 83: + break; + case 84: + break; + case 85: + break; + case 86: + break; + case 87: + break; + case 88: + break; + case 89: + break; + case 90: + break; + case 91: + break; + case 92: + break; + case 93: + break; + case 94: + break; + case 95: + break; + case 96: + break; + case 97: + break; + case 98: + break; + case 99: + break; + case 100: + break; + case 101: + break; + case 102: + break; + case 103: + break; + case 104: + break; + case 105: + break; + case 106: + break; + case 107: + break; + case 108: + break; + case 109: + break; + case 111: + break; + case 112: + break; + case 114: + break; + case 115: + break; + case 116: + break; + case 117: + break; + case 118: + break; + case 119: + break; + case 120: + break; + case 121: + break; + case 122: + break; + case 123: + break; + case 124: + break; + case 125: + break; + case 126: + break; + case (int) sbyte.MaxValue: + break; + case 128: + break; + case 129: + case 149: + int index6 = -1; + int index7 = -1; + int index8 = -1; + int index9 = -1; + if ((int) tilePtr1[-1].active != 0) + index7 = (int) tilePtr1[-1].type; + if ((int) tilePtr1[1].active != 0) + index6 = (int) tilePtr1[1].type; + if ((int) tilePtr1[-1440].active != 0) + index8 = (int) tilePtr1[-1440].type; + if ((int) tilePtr1[1440].active != 0) + index9 = (int) tilePtr1[1440].type; + if (index6 >= 0 && Main.tileSolidNotSolidTop[index6]) + { + tilePtr1->frameY = (short) 0; + break; + } + else if (index8 >= 0 && Main.tileSolidNotSolidTop[index8]) + { + tilePtr1->frameY = (short) 54; + break; + } + else if (index9 >= 0 && Main.tileSolidNotSolidTop[index9]) + { + tilePtr1->frameY = (short) 36; + break; + } + else if (index7 >= 0 && Main.tileSolidNotSolidTop[index7]) + { + tilePtr1->frameY = (short) 18; + break; + } + else + { + WorldGen.KillTile(i, j); + break; + } + case 130: + break; + case 131: + break; + case 132: + break; + case 133: + break; + case 134: + break; + case 135: + break; + case 136: + int index10 = -1; + int index11 = -1; + int index12 = -1; + if ((int) tilePtr1[-1].active != 0) + { + int num21 = (int) tilePtr1[-1].type; + } + if ((int) tilePtr1[1].active != 0) + index10 = (int) tilePtr1[1].type; + if ((int) tilePtr1[-1440].active != 0) + index11 = (int) tilePtr1[-1440].type; + if ((int) tilePtr1[1440].active != 0) + index12 = (int) tilePtr1[1440].type; + if (index10 >= 0 && Main.tileSolidAndAttach[index10]) + { + tilePtr1->frameX = (short) 0; + break; + } + else if (index11 >= 0 && (Main.tileSolidAndAttach[index11] || index11 == 124 || index11 == 5)) + { + tilePtr1->frameX = (short) 18; + break; + } + else if (index12 >= 0 && (Main.tileSolidAndAttach[index12] || index12 == 124 || index12 == 5)) + { + tilePtr1->frameX = (short) 36; + break; + } + else + { + WorldGen.KillTile(i, j); + break; + } + case 137: + break; + case 138: + break; + case 139: + break; + case 140: + break; + case 141: + break; + case 142: + break; + case 143: + break; + case 144: + break; + case 145: + break; + case 146: + break; + case 147: + break; + case 148: + break; + default: + break; + } + } + else + { + int index13 = -1; + int index14 = -1; + int index15 = -1; + int index16 = -1; + int index17 = -1; + int index18 = -1; + int index19 = -1; + int index20 = -1; + if ((int) tilePtr1[-1440].active != 0) + { + int index21 = (int) tilePtr1[-1440].type; + index16 = Main.tileStone[index21] ? 1 : index21; + } + if ((int) tilePtr1[1440].active != 0) + { + int index21 = (int) tilePtr1[1440].type; + index17 = Main.tileStone[index21] ? 1 : index21; + } + if ((int) tilePtr1[-1].active != 0) + { + int index21 = (int) tilePtr1[-1].type; + index14 = Main.tileStone[index21] ? 1 : index21; + } + if ((int) tilePtr1[1].active != 0) + { + int index21 = (int) tilePtr1[1].type; + index19 = Main.tileStone[index21] ? 1 : index21; + } + if ((int) tilePtr1[-1441].active != 0) + { + int index21 = (int) tilePtr1[-1441].type; + index13 = Main.tileStone[index21] ? 1 : index21; + } + if ((int) tilePtr1[1439].active != 0) + { + int index21 = (int) tilePtr1[1439].type; + index15 = Main.tileStone[index21] ? 1 : index21; + } + if ((int) tilePtr1[-1439].active != 0) + { + int index21 = (int) tilePtr1[-1439].type; + index18 = Main.tileStone[index21] ? 1 : index21; + } + if ((int) tilePtr1[1441].active != 0) + { + int index21 = (int) tilePtr1[1441].type; + index20 = Main.tileStone[index21] ? 1 : index21; + } + if (index1 == 19) + { + if (index17 >= 0 && !Main.tileSolid[index17]) + index17 = -1; + if (index16 >= 0 && !Main.tileSolid[index16]) + index16 = -1; + num3 = index16 != index1 ? (index16 >= 0 ? (index17 != index1 ? (index17 >= 0 ? 90 : 108) : 54) : (index17 != index1 ? (index17 <= 0 ? 90 : 126) : 36)) : (index17 != index1 ? (index17 >= 0 ? 72 : 18) : 0); + num4 = 18 * (int) tilePtr1->frameNumber; + } + else if (index1 == 80) + { + WorldGen.CactusFrame(i, j); + return; + } + else if (index1 == 49) + return; + WorldGen.mergeUp2 = false; + WorldGen.mergeDown2 = false; + WorldGen.mergeLeft2 = false; + WorldGen.mergeRight2 = false; + if (frameNumber < 0) + { + frameNumber = WorldGen.genRand.Next(3); + tilePtr1->frameNumber = (byte) frameNumber; + } + else + frameNumber = (int) tilePtr1->frameNumber; + if (index1 == 0) + { + if (index14 >= 0 && Main.tileMergeDirt[index14]) + { + WorldGen.TileFrameNoLiquid(i, j - 1, 0); + if (WorldGen.mergeDown2) + index14 = index1; + } + if (index19 >= 0 && Main.tileMergeDirt[index19]) + { + WorldGen.TileFrameNoLiquid(i, j + 1, 0); + if (WorldGen.mergeUp2) + index19 = index1; + } + if (index16 >= 0 && Main.tileMergeDirt[index16]) + { + WorldGen.TileFrameNoLiquid(i - 1, j, 0); + if (WorldGen.mergeRight2) + index16 = index1; + } + if (index17 >= 0 && Main.tileMergeDirt[index17]) + { + WorldGen.TileFrameNoLiquid(i + 1, j, 0); + if (WorldGen.mergeLeft2) + index17 = index1; + } + if (index14 == 2 || index14 == 23 || index14 == 109) + index14 = index1; + if (index19 == 2 || index19 == 23 || index19 == 109) + index19 = index1; + if (index16 == 2 || index16 == 23 || index16 == 109) + index16 = index1; + if (index17 == 2 || index17 == 23 || index17 == 109) + index17 = index1; + if (index13 >= 0 && Main.tileMergeDirt[index13]) + index13 = index1; + else if (index13 == 2 || index13 == 23 || index13 == 109) + index13 = index1; + if (index15 >= 0 && Main.tileMergeDirt[index15]) + index15 = index1; + else if (index15 == 2 || index15 == 23 || index15 == 109) + index15 = index1; + if (index18 >= 0 && Main.tileMergeDirt[index18]) + index18 = index1; + else if (index18 == 2 || index18 == 23 || index15 == 109) + index18 = index1; + if (index20 >= 0 && Main.tileMergeDirt[index20]) + index20 = index1; + else if (index20 == 2 || index20 == 23 || index20 == 109) + index20 = index1; + if (j < Main.rockLayer) + { + if (index14 == 59) + index14 = -2; + if (index19 == 59) + index19 = -2; + if (index16 == 59) + index16 = -2; + if (index17 == 59) + index17 = -2; + if (index13 == 59) + index13 = -2; + if (index15 == 59) + index15 = -2; + if (index18 == 59) + index18 = -2; + if (index20 == 59) + index20 = -2; + } + } + else if (Main.tileMergeDirt[index1]) + { + if (index14 == 0) + index14 = -2; + if (index19 == 0) + index19 = -2; + if (index16 == 0) + index16 = -2; + if (index17 == 0) + index17 = -2; + if (index13 == 0) + index13 = -2; + if (index15 == 0) + index15 = -2; + if (index18 == 0) + index18 = -2; + if (index20 == 0) + index20 = -2; + if (index1 == 1) + { + if (j > Main.rockLayer) + { + if (index14 == 59) + { + WorldGen.TileFrameNoLiquid(i, j - 1, 0); + if (WorldGen.mergeDown2) + index14 = index1; + } + if (index19 == 59) + { + WorldGen.TileFrameNoLiquid(i, j + 1, 0); + if (WorldGen.mergeUp2) + index19 = index1; + } + if (index16 == 59) + { + WorldGen.TileFrameNoLiquid(i - 1, j, 0); + if (WorldGen.mergeRight2) + index16 = index1; + } + if (index17 == 59) + { + WorldGen.TileFrameNoLiquid(i + 1, j, 0); + if (WorldGen.mergeLeft2) + index17 = index1; + } + if (index13 == 59) + index13 = index1; + if (index15 == 59) + index15 = index1; + if (index18 == 59) + index18 = index1; + if (index20 == 59) + index20 = index1; + } + if (index14 == 57) + { + WorldGen.TileFrameNoLiquid(i, j - 1, 0); + if (WorldGen.mergeDown2) + index14 = index1; + } + if (index19 == 57) + { + WorldGen.TileFrameNoLiquid(i, j + 1, 0); + if (WorldGen.mergeUp2) + index19 = index1; + } + if (index16 == 57) + { + WorldGen.TileFrameNoLiquid(i - 1, j, 0); + if (WorldGen.mergeRight2) + index16 = index1; + } + if (index17 == 57) + { + WorldGen.TileFrameNoLiquid(i + 1, j, 0); + if (WorldGen.mergeLeft2) + index17 = index1; + } + if (index13 == 57) + index13 = index1; + if (index15 == 57) + index15 = index1; + if (index18 == 57) + index18 = index1; + if (index20 == 57) + index20 = index1; + } + } + else if (index1 == 58 || index1 == 76 || index1 == 75) + { + if (index14 == 57) + index14 = -2; + if (index19 == 57) + index19 = -2; + if (index16 == 57) + index16 = -2; + if (index17 == 57) + index17 = -2; + if (index13 == 57) + index13 = -2; + if (index15 == 57) + index15 = -2; + if (index18 == 57) + index18 = -2; + if (index20 == 57) + index20 = -2; + } + else if (index1 == 59) + { + if (j > Main.rockLayer) + { + if (index14 == 1) + index14 = -2; + if (index19 == 1) + index19 = -2; + if (index16 == 1) + index16 = -2; + if (index17 == 1) + index17 = -2; + if (index13 == 1) + index13 = -2; + if (index15 == 1) + index15 = -2; + if (index18 == 1) + index18 = -2; + if (index20 == 1) + index20 = -2; + } + if (index14 == 60 || index14 == 70) + index14 = index1; + if (index19 == 60 || index19 == 70) + index19 = index1; + if (index16 == 60 || index16 == 70) + index16 = index1; + if (index17 == 60 || index17 == 70) + index17 = index1; + if (index13 == 60 || index13 == 70) + index13 = index1; + if (index15 == 60 || index15 == 70) + index15 = index1; + if (index18 == 60 || index18 == 70) + index18 = index1; + if (index20 == 60 || index20 == 70) + index20 = index1; + if (j < Main.rockLayer) + { + if (index14 == 0) + { + WorldGen.TileFrameNoLiquid(i, j - 1, 0); + if (WorldGen.mergeDown2) + index14 = index1; + } + if (index19 == 0) + { + WorldGen.TileFrameNoLiquid(i, j + 1, 0); + if (WorldGen.mergeUp2) + index19 = index1; + } + if (index16 == 0) + { + WorldGen.TileFrameNoLiquid(i - 1, j, 0); + if (WorldGen.mergeRight2) + index16 = index1; + } + if (index17 == 0) + { + WorldGen.TileFrameNoLiquid(i + 1, j, 0); + if (WorldGen.mergeLeft2) + index17 = index1; + } + if (index13 == 0) + index13 = index1; + if (index15 == 0) + index15 = index1; + if (index18 == 0) + index18 = index1; + if (index20 == 0) + index20 = index1; + } + } + else if (index1 == 57) + { + if (index14 == 1) + index14 = -2; + if (index19 == 1) + index19 = -2; + if (index16 == 1) + index16 = -2; + if (index17 == 1) + index17 = -2; + if (index13 == 1) + index13 = -2; + if (index15 == 1) + index15 = -2; + if (index18 == 1) + index18 = -2; + if (index20 == 1) + index20 = -2; + if (index14 == 58 || index14 == 76 || index14 == 75) + { + WorldGen.TileFrameNoLiquid(i, j - 1, 0); + if (WorldGen.mergeDown2) + index14 = index1; + } + if (index19 == 58 || index19 == 76 || index19 == 75) + { + WorldGen.TileFrameNoLiquid(i, j + 1, 0); + if (WorldGen.mergeUp2) + index19 = index1; + } + if (index16 == 58 || index16 == 76 || index16 == 75) + { + WorldGen.TileFrameNoLiquid(i - 1, j, 0); + if (WorldGen.mergeRight2) + index16 = index1; + } + if (index17 == 58 || index17 == 76 || index17 == 75) + { + WorldGen.TileFrameNoLiquid(i + 1, j, 0); + if (WorldGen.mergeLeft2) + index17 = index1; + } + if (index13 == 58 || index13 == 76 || index13 == 75) + index13 = index1; + if (index15 == 58 || index15 == 76 || index15 == 75) + index15 = index1; + if (index18 == 58 || index18 == 76 || index18 == 75) + index18 = index1; + if (index20 == 58 || index20 == 76 || index20 == 75) + index20 = index1; + } + else if (index1 == 32) + { + if (index19 == 23) + index19 = index1; + } + else if (index1 == 69) + { + if (index19 == 60) + index19 = index1; + } + else if (index1 == 51) + { + if (index14 >= 0 && !Main.tileNoAttach[index14]) + index14 = index1; + if (index19 >= 0 && !Main.tileNoAttach[index19]) + index19 = index1; + if (index16 >= 0 && !Main.tileNoAttach[index16]) + index16 = index1; + if (index17 >= 0 && !Main.tileNoAttach[index17]) + index17 = index1; + if (index13 >= 0 && !Main.tileNoAttach[index13]) + index13 = index1; + if (index15 >= 0 && !Main.tileNoAttach[index15]) + index15 = index1; + if (index18 >= 0 && !Main.tileNoAttach[index18]) + index18 = index1; + if (index20 >= 0 && !Main.tileNoAttach[index20]) + index20 = index1; + } + bool flag3 = false; + if (index1 == 2 || index1 == 23 || (index1 == 60 || index1 == 70) || index1 == 109) + { + flag3 = true; + if (index14 >= 0 && index14 != index1 && !Main.tileSolid[index14]) + index14 = -1; + if (index19 >= 0 && index19 != index1 && !Main.tileSolid[index19]) + index19 = -1; + if (index16 >= 0 && index16 != index1 && !Main.tileSolid[index16]) + index16 = -1; + if (index17 >= 0 && index17 != index1 && !Main.tileSolid[index17]) + index17 = -1; + if (index13 >= 0 && index13 != index1 && !Main.tileSolid[index13]) + index13 = -1; + if (index15 >= 0 && index15 != index1 && !Main.tileSolid[index15]) + index15 = -1; + if (index18 >= 0 && index18 != index1 && !Main.tileSolid[index18]) + index18 = -1; + if (index20 >= 0 && index20 != index1 && !Main.tileSolid[index20]) + index20 = -1; + int num22 = 0; + if (index1 == 60 || index1 == 70) + num22 = 59; + else if (index1 == 2) + { + if (index14 == 23) + index14 = num22; + if (index19 == 23) + index19 = num22; + if (index16 == 23) + index16 = num22; + if (index17 == 23) + index17 = num22; + if (index13 == 23) + index13 = num22; + if (index15 == 23) + index15 = num22; + if (index18 == 23) + index18 = num22; + if (index20 == 23) + index20 = num22; + } + else if (index1 == 23) + { + if (index14 == 2) + index14 = num22; + if (index19 == 2) + index19 = num22; + if (index16 == 2) + index16 = num22; + if (index17 == 2) + index17 = num22; + if (index13 == 2) + index13 = num22; + if (index15 == 2) + index15 = num22; + if (index18 == 2) + index18 = num22; + if (index20 == 2) + index20 = num22; + } + if (index14 != index1 && index14 != num22 && (index19 == index1 || index19 == num22)) + { + if (index16 == num22 && index17 == index1) + { + num3 = 18 * frameNumber; + num4 = 198; + } + else if (index16 == index1 && index17 == num22) + { + num3 = 54 + 18 * frameNumber; + num4 = 198; + } + } + else if (index19 != index1 && index19 != num22 && (index14 == index1 || index14 == num22)) + { + if (index16 == num22 && index17 == index1) + { + num3 = 18 * frameNumber; + num4 = 216; + } + else if (index16 == index1 && index17 == num22) + { + num3 = 54 + 18 * frameNumber; + num4 = 216; + } + } + else if (index16 != index1 && index16 != num22 && (index17 == index1 || index17 == num22)) + { + if (index14 == num22 && index19 == index1) + { + num3 = 72; + num4 = 144 + 18 * frameNumber; + } + else if (index19 == index1 && index17 == index14) + { + num3 = 72; + num4 = 90 + 18 * frameNumber; + } + } + else if (index17 != index1 && index17 != num22 && (index16 == index1 || index16 == num22)) + { + if (index14 == num22 && index19 == index1) + { + num3 = 90; + num4 = 144 + 18 * frameNumber; + } + else if (index19 == index1 && index17 == index14) + { + num3 = 90; + num4 = 90 + 18 * frameNumber; + } + } + else if (index14 == index1 && index19 == index1 && (index16 == index1 && index17 == index1)) + { + if (index13 != index1 && index15 != index1 && (index18 != index1 && index20 != index1)) + { + if (index20 == num22) + { + num4 = 324; + num3 = 108 + 18 * frameNumber; + } + else if (index15 == num22) + { + num4 = 342; + num3 = 108 + 18 * frameNumber; + } + else if (index18 == num22) + { + num4 = 360; + num3 = 108 + 18 * frameNumber; + } + else if (index13 == num22) + { + num4 = 378; + num3 = 108 + 18 * frameNumber; + } + else + { + num4 = 234; + num3 = 144 + 54 * frameNumber; + } + } + else if (index13 != index1 && index20 != index1) + { + num4 = 306; + num3 = 36 + 18 * frameNumber; + } + else if (index15 != index1 && index18 != index1) + { + num4 = 306; + num3 = 90 + 18 * frameNumber; + } + else if (index13 != index1 && index15 == index1 && (index18 == index1 && index20 == index1)) + { + num3 = 54; + num4 = 108 + 36 * frameNumber; + } + else if (index13 == index1 && index15 != index1 && (index18 == index1 && index20 == index1)) + { + num3 = 36; + num4 = 108 + 36 * frameNumber; + } + else if (index13 == index1 && index15 == index1 && (index18 != index1 && index20 == index1)) + { + num3 = 54; + num4 = 90 + 36 * frameNumber; + } + else if (index13 == index1 && index15 == index1 && (index18 == index1 && index20 != index1)) + { + num3 = 36; + num4 = 90 + 36 * frameNumber; + } + } + else if (index14 == index1 && index19 == num22 && (index16 == index1 && index17 == index1) && (index13 == -1 && index15 == -1)) + { + num4 = 18; + num3 = 108 + 18 * frameNumber; + } + else if (index14 == num22 && index19 == index1 && (index16 == index1 && index17 == index1) && (index18 == -1 && index20 == -1)) + { + num4 = 36; + num3 = 108 + 18 * frameNumber; + } + else if (index14 == index1 && index19 == index1 && (index16 == num22 && index17 == index1) && (index15 == -1 && index20 == -1)) + { + num3 = 198; + num4 = 18 * frameNumber; + } + else if (index14 == index1 && index19 == index1 && (index16 == index1 && index17 == num22) && (index13 == -1 && index18 == -1)) + { + num3 = 180; + num4 = 18 * frameNumber; + } + else if (index14 == index1 && index19 == num22 && (index16 == index1 && index17 == index1)) + { + if (index15 != -1) + { + num3 = 54; + num4 = 108 + 36 * frameNumber; + } + else if (index13 != -1) + { + num3 = 36; + num4 = 108 + 36 * frameNumber; + } + } + else if (index14 == num22 && index19 == index1 && (index16 == index1 && index17 == index1)) + { + if (index20 != -1) + { + num3 = 54; + num4 = 90 + 36 * frameNumber; + } + else if (index18 != -1) + { + num3 = 36; + num4 = 90 + 36 * frameNumber; + } + } + else if (index14 == index1 && index19 == index1 && (index16 == index1 && index17 == num22)) + { + if (index13 != -1) + { + num3 = 54; + num4 = 90 + 36 * frameNumber; + } + else if (index18 != -1) + { + num3 = 54; + num4 = 108 + 36 * frameNumber; + } + } + else if (index14 == index1 && index19 == index1 && (index16 == num22 && index17 == index1)) + { + if (index15 != -1) + { + num3 = 36; + num4 = 90 + 36 * frameNumber; + } + else if (index20 != -1) + { + num3 = 36; + num4 = 108 + 36 * frameNumber; + } + } + else if (index14 == num22 && index19 == index1 && (index16 == index1 && index17 == index1) || index14 == index1 && index19 == num22 && (index16 == index1 && index17 == index1) || (index14 == index1 && index19 == index1 && (index16 == num22 && index17 == index1) || index14 == index1 && index19 == index1 && (index16 == index1 && index17 == num22))) + { + num4 = 18; + num3 = 18 + 18 * frameNumber; + } + if ((index14 == index1 || index14 == num22) && (index19 == index1 || index19 == num22) && ((index16 == index1 || index16 == num22) && (index17 == index1 || index17 == num22))) + { + if (index13 != index1 && index13 != num22 && (index15 == index1 || index15 == num22) && ((index18 == index1 || index18 == num22) && (index20 == index1 || index20 == num22))) + { + num3 = 54; + num4 = 108 + 36 * frameNumber; + } + else if (index15 != index1 && index15 != num22 && (index13 == index1 || index13 == num22) && ((index18 == index1 || index18 == num22) && (index20 == index1 || index20 == num22))) + { + num3 = 36; + num4 = 108 + 36 * frameNumber; + } + else if (index18 != index1 && index18 != num22 && (index13 == index1 || index13 == num22) && ((index15 == index1 || index15 == num22) && (index20 == index1 || index20 == num22))) + { + num3 = 54; + num4 = 90 + 36 * frameNumber; + } + else if (index20 != index1 && index20 != num22 && (index13 == index1 || index13 == num22) && ((index18 == index1 || index18 == num22) && (index15 == index1 || index15 == num22))) + { + num3 = 36; + num4 = 90 + 36 * frameNumber; + } + } + if (index14 != num22 && index14 != index1 && (index19 == index1 && index16 != num22) && (index16 != index1 && index17 == index1 && (index20 != num22 && index20 != index1))) + { + num4 = 270; + num3 = 90 + 18 * frameNumber; + } + else if (index14 != num22 && index14 != index1 && (index19 == index1 && index16 == index1) && (index17 != num22 && index17 != index1 && (index18 != num22 && index18 != index1))) + { + num4 = 270; + num3 = 144 + 18 * frameNumber; + } + else if (index19 != num22 && index19 != index1 && (index14 == index1 && index16 != num22) && (index16 != index1 && index17 == index1 && (index15 != num22 && index15 != index1))) + { + num4 = 288; + num3 = 90 + 18 * frameNumber; + } + else if (index19 != num22 && index19 != index1 && (index14 == index1 && index16 == index1) && (index17 != num22 && index17 != index1 && (index13 != num22 && index13 != index1))) + { + num4 = 288; + num3 = 144 + 18 * frameNumber; + } + else if (index14 != index1 && index14 != num22 && (index19 == index1 && index16 == index1) && (index17 == index1 && index18 != index1 && (index18 != num22 && index20 != index1)) && index20 != num22) + { + num4 = 216; + num3 = 144 + 54 * frameNumber; + } + else if (index19 != index1 && index19 != num22 && (index14 == index1 && index16 == index1) && (index17 == index1 && index13 != index1 && (index13 != num22 && index15 != index1)) && index15 != num22) + { + num4 = 252; + num3 = 144 + 54 * frameNumber; + } + else if (index16 != index1 && index16 != num22 && (index19 == index1 && index14 == index1) && (index17 == index1 && index15 != index1 && (index15 != num22 && index20 != index1)) && index20 != num22) + { + num4 = 234; + num3 = 126 + 54 * frameNumber; + } + else if (index17 != index1 && index17 != num22 && (index19 == index1 && index14 == index1) && (index16 == index1 && index13 != index1 && (index13 != num22 && index18 != index1)) && index18 != num22) + { + num4 = 234; + num3 = 162 + 54 * frameNumber; + } + else if (index14 != num22 && index14 != index1 && (index19 == num22 || index19 == index1) && (index16 == num22 && index17 == num22)) + { + num4 = 270; + num3 = 36 + 18 * frameNumber; + } + else if (index19 != num22 && index19 != index1 && (index14 == num22 || index14 == index1) && (index16 == num22 && index17 == num22)) + { + num4 = 288; + num3 = 36 + 18 * frameNumber; + } + else if (index16 != num22 && index16 != index1 && (index17 == num22 || index17 == index1) && (index14 == num22 && index19 == num22)) + { + num3 = 0; + num4 = 270 + 18 * frameNumber; + } + else if (index17 != num22 && index17 != index1 && (index16 == num22 || index16 == index1) && (index14 == num22 && index19 == num22)) + { + num3 = 18; + num4 = 270 + 18 * frameNumber; + } + else if (index14 == index1 && index19 == num22 && (index16 == num22 && index17 == num22)) + { + num4 = 288; + num3 = 198 + 18 * frameNumber; + } + else if (index14 == num22 && index19 == index1 && (index16 == num22 && index17 == num22)) + { + num4 = 270; + num3 = 198 + 18 * frameNumber; + } + else if (index14 == num22 && index19 == num22 && (index16 == index1 && index17 == num22)) + { + num4 = 306; + num3 = 198 + 18 * frameNumber; + } + else if (index14 == num22 && index19 == num22 && (index16 == num22 && index17 == index1)) + { + num4 = 306; + num3 = 144 + 18 * frameNumber; + } + if (index14 != index1 && index14 != num22 && (index19 == index1 && index16 == index1) && index17 == index1) + { + if ((index18 == num22 || index18 == index1) && (index20 != num22 && index20 != index1)) + { + num4 = 324; + num3 = 18 * frameNumber; + } + else if ((index20 == num22 || index20 == index1) && (index18 != num22 && index18 != index1)) + { + num4 = 324; + num3 = 54 + 18 * frameNumber; + } + } + else if (index19 != index1 && index19 != num22 && (index14 == index1 && index16 == index1) && index17 == index1) + { + if ((index13 == num22 || index13 == index1) && (index15 != num22 && index15 != index1)) + { + num4 = 342; + num3 = 18 * frameNumber; + } + else if ((index15 == num22 || index15 == index1) && (index13 != num22 && index13 != index1)) + { + num4 = 342; + num3 = 54 + 18 * frameNumber; + } + } + else if (index16 != index1 && index16 != num22 && (index14 == index1 && index19 == index1) && index17 == index1) + { + if ((index15 == num22 || index15 == index1) && (index20 != num22 && index20 != index1)) + { + num4 = 360; + num3 = 54 + 18 * frameNumber; + } + else if ((index20 == num22 || index20 == index1) && (index15 != num22 && index15 != index1)) + { + num4 = 360; + num3 = 18 * frameNumber; + } + } + else if (index17 != index1 && index17 != num22 && (index14 == index1 && index19 == index1) && index16 == index1) + { + if ((index13 == num22 || index13 == index1) && (index18 != num22 && index18 != index1)) + { + num4 = 378; + num3 = 18 * frameNumber; + } + else if ((index18 == num22 || index18 == index1) && (index13 != num22 && index13 != index1)) + { + num4 = 378; + num3 = 54 + 18 * frameNumber; + } + } + if ((index14 == index1 || index14 == num22) && (index19 == index1 || index19 == num22) && ((index16 == index1 || index16 == num22) && (index17 == index1 || index17 == num22)) && (index13 != -1 && index15 != -1 && (index18 != -1 && index20 != -1))) + { + num4 = 18; + num3 = 18 + 18 * frameNumber; + } + if (index14 == num22) + index14 = -2; + if (index19 == num22) + index19 = -2; + if (index16 == num22) + index16 = -2; + if (index17 == num22) + index17 = -2; + if (index13 == num22) + index13 = -2; + if (index15 == num22) + index15 = -2; + if (index18 == num22) + index18 = -2; + if (index20 == num22) + index20 = -2; + } + if (num3 == -1 && (Main.tileMergeDirt[index1] || index1 == 0 || (index1 == 2 || index1 == 57) || (index1 == 58 || index1 == 59 || (index1 == 60 || index1 == 70)) || (index1 == 109 || index1 == 76 || index1 == 75))) + { + if (!flag3) + { + flag3 = true; + if (index13 >= 0 && index13 != index1 && !Main.tileSolid[index13]) + index13 = -1; + if (index15 >= 0 && index15 != index1 && !Main.tileSolid[index15]) + index15 = -1; + if (index18 >= 0 && index18 != index1 && !Main.tileSolid[index18]) + index18 = -1; + if (index20 >= 0 && index20 != index1 && !Main.tileSolid[index20]) + index20 = -1; + } + if (index14 >= 0 && index14 != index1) + index14 = -1; + if (index19 >= 0 && index19 != index1) + index19 = -1; + if (index16 >= 0 && index16 != index1) + index16 = -1; + if (index17 >= 0 && index17 != index1) + index17 = -1; + if (index14 != -1 && index19 != -1 && (index16 != -1 && index17 != -1)) + { + if (index14 == -2 && index19 == index1 && (index16 == index1 && index17 == index1)) + { + num4 = 108; + num3 = 144 + 18 * frameNumber; + WorldGen.mergeUp2 = true; + } + else if (index14 == index1 && index19 == -2 && (index16 == index1 && index17 == index1)) + { + num4 = 90; + num3 = 144 + 18 * frameNumber; + WorldGen.mergeDown2 = true; + } + else if (index14 == index1 && index19 == index1 && (index16 == -2 && index17 == index1)) + { + num3 = 162; + num4 = 126 + 18 * frameNumber; + WorldGen.mergeLeft2 = true; + } + else if (index14 == index1 && index19 == index1 && (index16 == index1 && index17 == -2)) + { + num3 = 144; + num4 = 126 + 18 * frameNumber; + WorldGen.mergeRight2 = true; + } + else if (index14 == -2 && index19 == index1 && (index16 == -2 && index17 == index1)) + { + num3 = 36; + num4 = 90 + 36 * frameNumber; + WorldGen.mergeUp2 = true; + WorldGen.mergeLeft2 = true; + } + else if (index14 == -2 && index19 == index1 && (index16 == index1 && index17 == -2)) + { + num3 = 54; + num4 = 90 + 36 * frameNumber; + WorldGen.mergeUp2 = true; + WorldGen.mergeRight2 = true; + } + else if (index14 == index1 && index19 == -2 && (index16 == -2 && index17 == index1)) + { + num3 = 36; + num4 = 108 + 36 * frameNumber; + WorldGen.mergeDown2 = true; + WorldGen.mergeLeft2 = true; + } + else if (index14 == index1 && index19 == -2 && (index16 == index1 && index17 == -2)) + { + num3 = 54; + num4 = 108 + 36 * frameNumber; + WorldGen.mergeDown2 = true; + WorldGen.mergeRight2 = true; + } + else if (index14 == index1 && index19 == index1 && (index16 == -2 && index17 == -2)) + { + num3 = 180; + num4 = 126 + 18 * frameNumber; + WorldGen.mergeLeft2 = true; + WorldGen.mergeRight2 = true; + } + else if (index14 == -2 && index19 == -2 && (index16 == index1 && index17 == index1)) + { + num4 = 180; + num3 = 144 + 18 * frameNumber; + WorldGen.mergeUp2 = true; + WorldGen.mergeDown2 = true; + } + else if (index14 == -2 && index19 == index1 && (index16 == -2 && index17 == -2)) + { + num3 = 198; + num4 = 90 + 18 * frameNumber; + WorldGen.mergeUp2 = true; + WorldGen.mergeLeft2 = true; + WorldGen.mergeRight2 = true; + } + else if (index14 == index1 && index19 == -2 && (index16 == -2 && index17 == -2)) + { + num3 = 198; + num4 = 144 + 18 * frameNumber; + WorldGen.mergeDown2 = true; + WorldGen.mergeLeft2 = true; + WorldGen.mergeRight2 = true; + } + else if (index14 == -2 && index19 == -2 && (index16 == index1 && index17 == -2)) + { + num3 = 216; + num4 = 144 + 18 * frameNumber; + WorldGen.mergeUp2 = true; + WorldGen.mergeDown2 = true; + WorldGen.mergeRight2 = true; + } + else if (index14 == -2 && index19 == -2 && (index16 == -2 && index17 == index1)) + { + num3 = 216; + num4 = 90 + 18 * frameNumber; + WorldGen.mergeUp2 = true; + WorldGen.mergeDown2 = true; + WorldGen.mergeLeft2 = true; + } + else if (index14 == -2 && index19 == -2 && (index16 == -2 && index17 == -2)) + { + num4 = 198; + num3 = 108 + 18 * frameNumber; + WorldGen.mergeUp2 = true; + WorldGen.mergeDown2 = true; + WorldGen.mergeLeft2 = true; + WorldGen.mergeRight2 = true; + } + else if (index14 == index1 && index19 == index1 && (index16 == index1 && index17 == index1)) + { + if (index20 == -2) + { + num3 = 0; + num4 = 90 + 36 * frameNumber; + } + else if (index18 == -2) + { + num3 = 18; + num4 = 90 + 36 * frameNumber; + } + else if (index15 == -2) + { + num3 = 0; + num4 = 108 + 36 * frameNumber; + } + else if (index13 == -2) + { + num3 = 18; + num4 = 108 + 36 * frameNumber; + } + } + } + else + { + if (index1 != 2 && index1 != 23 && (index1 != 60 && index1 != 70) && index1 != 109) + { + if (index14 == -1 && index19 == -2 && (index16 == index1 && index17 == index1)) + { + num4 = 0; + num3 = 234 + 18 * frameNumber; + WorldGen.mergeDown2 = true; + } + else if (index14 == -2 && index19 == -1 && (index16 == index1 && index17 == index1)) + { + num4 = 18; + num3 = 234 + 18 * frameNumber; + WorldGen.mergeUp2 = true; + } + else if (index14 == index1 && index19 == index1 && (index16 == -1 && index17 == -2)) + { + num4 = 36; + num3 = 234 + 18 * frameNumber; + WorldGen.mergeRight2 = true; + } + else if (index14 == index1 && index19 == index1 && (index16 == -2 && index17 == -1)) + { + num4 = 54; + num3 = 234 + 18 * frameNumber; + WorldGen.mergeLeft2 = true; + } + } + if (index14 != -1 && index19 != -1 && (index16 == -1 && index17 == index1)) + { + if (index14 == -2 && index19 == index1) + { + num3 = 72; + num4 = 144 + 18 * frameNumber; + WorldGen.mergeUp2 = true; + } + else if (index19 == -2 && index14 == index1) + { + num3 = 72; + num4 = 90 + 18 * frameNumber; + WorldGen.mergeDown2 = true; + } + } + else if (index14 != -1 && index19 != -1 && (index16 == index1 && index17 == -1)) + { + if (index14 == -2 && index19 == index1) + { + num3 = 90; + num4 = 144 + 18 * frameNumber; + WorldGen.mergeUp2 = true; + } + else if (index19 == -2 && index14 == index1) + { + num3 = 90; + num4 = 90 + 18 * frameNumber; + WorldGen.mergeDown2 = true; + } + } + else if (index14 == -1 && index19 == index1 && (index16 != -1 && index17 != -1)) + { + if (index16 == -2 && index17 == index1) + { + num3 = 18 * frameNumber; + num4 = 198; + WorldGen.mergeLeft2 = true; + } + else if (index17 == -2 && index16 == index1) + { + num3 = 54 + 18 * frameNumber; + num4 = 198; + WorldGen.mergeRight2 = true; + } + } + else if (index14 == index1 && index19 == -1 && (index16 != -1 && index17 != -1)) + { + if (index16 == -2 && index17 == index1) + { + num3 = 18 * frameNumber; + num4 = 216; + WorldGen.mergeLeft2 = true; + } + else if (index17 == -2 && index16 == index1) + { + num3 = 54 + 18 * frameNumber; + num4 = 216; + WorldGen.mergeRight2 = true; + } + } + else if (index14 != -1 && index19 != -1 && (index16 == -1 && index17 == -1)) + { + if (index14 == -2 && index19 == -2) + { + num3 = 108; + num4 = 216 + 18 * frameNumber; + WorldGen.mergeUp2 = true; + WorldGen.mergeDown2 = true; + } + else if (index14 == -2) + { + num3 = 126; + num4 = 144 + 18 * frameNumber; + WorldGen.mergeUp2 = true; + } + else if (index19 == -2) + { + num3 = 126; + num4 = 90 + 18 * frameNumber; + WorldGen.mergeDown2 = true; + } + } + else if (index14 == -1 && index19 == -1 && (index16 != -1 && index17 != -1)) + { + if (index16 == -2 && index17 == -2) + { + num4 = 198; + num3 = 162 + 18 * frameNumber; + WorldGen.mergeLeft2 = true; + WorldGen.mergeRight2 = true; + } + else if (index16 == -2) + { + num4 = 252; + num3 = 18 * frameNumber; + WorldGen.mergeLeft2 = true; + } + else if (index17 == -2) + { + num4 = 252; + num3 = 54 + 18 * frameNumber; + WorldGen.mergeRight2 = true; + } + } + else if (index14 == -2 && index19 == -1 && (index16 == -1 && index17 == -1)) + { + num3 = 108; + num4 = 144 + 18 * frameNumber; + WorldGen.mergeUp2 = true; + } + else if (index14 == -1 && index19 == -2 && (index16 == -1 && index17 == -1)) + { + num3 = 108; + num4 = 90 + 18 * frameNumber; + WorldGen.mergeDown2 = true; + } + else if (index14 == -1 && index19 == -1 && (index16 == -2 && index17 == -1)) + { + num4 = 234; + num3 = 18 * frameNumber; + WorldGen.mergeLeft2 = true; + } + else if (index14 == -1 && index19 == -1 && (index16 == -1 && index17 == -2)) + { + num4 = 234; + num3 = 54 + 18 * frameNumber; + WorldGen.mergeRight2 = true; + } + } + } + if (num3 < 0) + { + if (!flag3) + { + if (index14 >= 0 && index14 != index1 && !Main.tileSolid[index14]) + index14 = -1; + if (index19 >= 0 && index19 != index1 && !Main.tileSolid[index19]) + index19 = -1; + if (index16 >= 0 && index16 != index1 && !Main.tileSolid[index16]) + index16 = -1; + if (index17 >= 0 && index17 != index1 && !Main.tileSolid[index17]) + index17 = -1; + if (index13 >= 0 && index13 != index1 && !Main.tileSolid[index13]) + index13 = -1; + if (index15 >= 0 && index15 != index1 && !Main.tileSolid[index15]) + index15 = -1; + if (index18 >= 0 && index18 != index1 && !Main.tileSolid[index18]) + index18 = -1; + if (index20 >= 0 && index20 != index1 && !Main.tileSolid[index20]) + index20 = -1; + } + if (index1 == 2 || index1 == 23 || (index1 == 60 || index1 == 70) || index1 == 109) + { + if (index14 == -2) + index14 = index1; + if (index19 == -2) + index19 = index1; + if (index16 == -2) + index16 = index1; + if (index17 == -2) + index17 = index1; + if (index13 == -2) + index13 = index1; + if (index15 == -2) + index15 = index1; + if (index18 == -2) + index18 = index1; + if (index20 == -2) + index20 = index1; + } + if (index14 == index1 && index19 == index1 && index16 == index1 & index17 == index1) + { + if (index13 != index1 && index15 != index1) + { + num4 = 18; + num3 = 108 + 18 * frameNumber; + } + else if (index18 != index1 && index20 != index1) + { + num4 = 36; + num3 = 108 + 18 * frameNumber; + } + else if (index13 != index1 && index18 != index1) + { + num3 = 180; + num4 = 18 * frameNumber; + } + else if (index15 != index1 && index20 != index1) + { + num3 = 198; + num4 = 18 * frameNumber; + } + else + { + num4 = 18; + num3 = 18 + 18 * frameNumber; + } + } + else if (index14 != index1 && index19 == index1 && index16 == index1 & index17 == index1) + { + num4 = 0; + num3 = 18 + 18 * frameNumber; + } + else if (index14 == index1 && index19 != index1 && index16 == index1 & index17 == index1) + { + num4 = 36; + num3 = 18 + 18 * frameNumber; + } + else if (index14 == index1 && index19 == index1 && index16 != index1 & index17 == index1) + { + num3 = 0; + num4 = 18 * frameNumber; + } + else if (index14 == index1 && index19 == index1 && index16 == index1 & index17 != index1) + { + num3 = 72; + num4 = 18 * frameNumber; + } + else if (index14 != index1 && index19 == index1 && index16 != index1 & index17 == index1) + { + num3 = 36 * frameNumber; + num4 = 54; + } + else if (index14 != index1 && index19 == index1 && index16 == index1 & index17 != index1) + { + num3 = 18 + 36 * frameNumber; + num4 = 54; + } + else if (index14 == index1 && index19 != index1 && index16 != index1 & index17 == index1) + { + num3 = 36 * frameNumber; + num4 = 72; + } + else if (index14 == index1 && index19 != index1 && index16 == index1 & index17 != index1) + { + num3 = 18 + 36 * frameNumber; + num4 = 72; + } + else if (index14 == index1 && index19 == index1 && index16 != index1 & index17 != index1) + { + num3 = 90; + num4 = 18 * frameNumber; + } + else if (index14 != index1 && index19 != index1 && index16 == index1 & index17 == index1) + { + num3 = 108 + 18 * frameNumber; + num4 = 72; + } + else if (index14 != index1 && index19 == index1 && index16 != index1 & index17 != index1) + { + num3 = 108 + 18 * frameNumber; + num4 = 0; + } + else if (index14 == index1 && index19 != index1 && index16 != index1 & index17 != index1) + { + num3 = 108 + 18 * frameNumber; + num4 = 54; + } + else if (index14 != index1 && index19 != index1 && index16 != index1 & index17 == index1) + { + num3 = 162; + num4 = 18 * frameNumber; + } + else if (index14 != index1 && index19 != index1 && index16 == index1 & index17 != index1) + { + num3 = 216; + num4 = 18 * frameNumber; + } + else if (index14 != index1 && index19 != index1 && index16 != index1 & index17 != index1) + { + num3 = 162 + 18 * frameNumber; + num4 = 54; + } + } + if (num3 < 0) + { + num4 = 18; + num3 = 18 + 18 * frameNumber; + } + tilePtr1->frameX = (short) num3; + tilePtr1->frameY = (short) num4; + if (index1 == 52 || index1 == 62 || index1 == 115) + { + int num22 = (int) tilePtr1[-1].active != 0 ? (int) tilePtr1[-1].type : -1; + if (index1 == 52 && (num22 == 109 || num22 == 115)) + { + tilePtr1->type = (byte) 115; + WorldGen.SquareTileFrameNoLiquid(i, j, -1); + return; + } + else if (index1 == 115 && (num22 == 2 || num22 == 52)) + { + tilePtr1->type = (byte) 52; + WorldGen.SquareTileFrameNoLiquid(i, j, -1); + return; + } + else if (num22 != index1 && (num22 == -1 || index1 == 52 && num22 != 2 || (index1 == 62 && num22 != 60 || index1 == 115 && num22 != 109))) + WorldGen.KillTile(i, j); + } + if (!WorldGen.gen && Main.netMode != 1 && (index1 == 53 || index1 == 112 || (index1 == 116 || index1 == 123)) && (int) tilePtr1[1].active == 0) + { + Tile* tilePtr2 = tilePtr1 - 1; + if ((int) tilePtr2->active == 0 || (int) tilePtr2->type != 21) + { + tilePtr1->active = (byte) 0; + WorldGen.sandBuffer[WorldGen.currentSandBuffer].Add(i, j); + } + } + } + } + } + } + + public static void UpdateMagmaLayerPos() + { + int num1 = (int) Main.maxTilesY - 230; + int num2 = Main.worldSurface + (num1 - Main.worldSurface) / 6 * 6 - 5; + Main.magmaLayer = num2; + Main.magmaLayerPixels = num2 << 4; + } + + public sealed class FallingSandBuffer + { + public Location[] buffer = new Location[64]; + public int count; + + public unsafe void Add(int i, int j) + { + fixed (Location* locationPtr = &this.buffer[this.count]) + { + locationPtr->X = (short) i; + locationPtr->Y = (short) j; + } + ++this.count; + } + } + + private struct DRoom + { + public short X; + public short Y; + public short L; + public short R; + public short T; + public short B; + public float Size; + } + + private struct DDoor + { + public short X; + public short Y; + public short Pos; + } + } +} diff --git a/Terraria/WorldSelect.cs b/Terraria/WorldSelect.cs new file mode 100644 index 0000000..209f81d --- /dev/null +++ b/Terraria/WorldSelect.cs @@ -0,0 +1,368 @@ +// Type: Terraria.WorldSelect +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.GamerServices; +using Microsoft.Xna.Framework.Input; +using Microsoft.Xna.Framework.Net; +using Microsoft.Xna.Framework.Storage; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.IO; +using System.Text; + +namespace Terraria +{ + public static class WorldSelect + { + private static string[] worldNames = new string[8]; + private static int cursorX = 0; + private const int MAX_WORLDS = 8; + private static byte selectedWorld; + private static byte selectedSession; + private static byte sessionListTop; + public static string worldPathName; + private static JoinableSession session; + + static WorldSelect() + { + } + + public static void Update() + { + if (UI.main.IsBackButtonTriggered()) + UI.main.PrevMenu(-1); + else if (UI.main.IsButtonTriggered(Buttons.Y)) + UI.main.ShowParty(); + else if (WorldSelect.cursorX == 0) + { + if (UI.main.IsButtonTriggered(Buttons.A)) + { + WorldSelect.SelectWorld(); + } + else + { + if (!UI.main.IsButtonTriggered(Buttons.X)) + return; + WorldSelect.DeleteWorld(); + } + } + else if (UI.main.IsButtonTriggered(Buttons.A)) + { + WorldSelect.JoinSession(); + } + else + { + if (!UI.main.IsButtonTriggered(Buttons.X) || !UI.main.CanViewGamerCard()) + return; + UI.main.ShowGamerCard(Gamer.GetFromGamertag(Netplay.availableSessions[(int) WorldSelect.selectedSession].host)); + } + } + + public static void UpdateCursor(int dx, int dy) + { + if (dx != 0 || dy != 0) + Main.PlaySound(12); + if (dx > 0) + WorldSelect.cursorX = 1; + else if (dx < 0) + WorldSelect.cursorX = 0; + int count = Netplay.availableSessions.Count; + if (count == 0) + { + WorldSelect.selectedSession = (byte) 0; + WorldSelect.sessionListTop = (byte) 0; + WorldSelect.cursorX = 0; + } + if (dy == 0) + return; + if (WorldSelect.cursorX == 0) + { + dy += (int) WorldSelect.selectedWorld; + if (dy < 0) + dy += 8; + else if (dy >= 8) + dy -= 8; + WorldSelect.selectedWorld = (byte) dy; + } + else + { + dy += (int) WorldSelect.selectedSession; + if (dy < 0) + dy += count; + else if (dy >= count) + dy -= count; + WorldSelect.selectedSession = (byte) dy; + if (dy < (int) WorldSelect.sessionListTop) + { + WorldSelect.sessionListTop = (byte) dy; + } + else + { + if (dy <= (int) WorldSelect.sessionListTop + 7) + return; + WorldSelect.sessionListTop += (byte) (dy - ((int) WorldSelect.sessionListTop + 7)); + } + } + } + + public static void Draw(WorldView view) + { + Rectangle rect = new Rectangle(); + Color white = Color.White; + rect.X = view.SAFE_AREA_OFFSET_L; + rect.Y = view.SAFE_AREA_OFFSET_T; + rect.Width = 416; + rect.Height = 446; + Main.DrawRect(451, rect, 64, 0); + rect.X += 448; + Main.DrawRect(451, rect, 64, 0); + UI.DrawStringCC(UI.fontBig, Lang.menu[83], view.SAFE_AREA_OFFSET_L + (rect.Width >> 1), rect.Y + 32, white); + UI.DrawStringCC(UI.fontBig, Lang.menu[84], rect.Center.X, rect.Y + 32, white); + int count = Netplay.availableSessions.Count; + if (count == 0) + { + string s = !Netplay.IsFindingSessions() ? Lang.menu[77] : Lang.menu[76]; + UI.DrawStringCC(UI.fontSmall, s, rect.Center.X, rect.Center.Y, UI.mouseTextColor); + } + else + { + rect.X += 8; + rect.Y += 80; + rect.Width = 400; + rect.Height = 24; + int num = Math.Min(count, (int) WorldSelect.sessionListTop + 8); + lock (Netplay.availableSessions) + { + for (int local_5 = (int) WorldSelect.sessionListTop; local_5 < num; ++local_5) + { + int local_6 = 450; + int local_7 = (int) byte.MaxValue; + if (local_5 == (int) WorldSelect.selectedSession && WorldSelect.cursorX == 1) + { + local_7 = (int) UI.mouseTextBrightness; + local_6 = 448; + } + Main.DrawRect(local_6, rect, local_7, 0); + rect.Y += 48; + } + rect.Y -= 48 * Math.Min(count, 8); + Color local_1_1 = Color.White; + for (int local_8 = (int) WorldSelect.sessionListTop; local_8 < num; ++local_8) + { + JoinableSession local_9 = Netplay.availableSessions[local_8]; + string local_10 = ToStringExtensions.ToStringLookup(local_8 + 1) + "."; + UI.DrawStringLC(UI.fontSmallOutline, local_10, rect.X, rect.Center.Y, local_1_1); + UI.DrawStringLC(UI.fontSmallOutline, local_9.host, rect.X + 32, rect.Center.Y, local_1_1); + string local_10_1 = Lang.menu[78] + ToStringExtensions.ToStringLookup(local_9.players) + "/8"; + UI.DrawStringRC(UI.fontSmallOutline, local_10_1, rect.Right, rect.Center.Y, local_1_1); + rect.Y += 48; + } + } + } + rect.X = view.SAFE_AREA_OFFSET_L + 8; + rect.Y = view.SAFE_AREA_OFFSET_T + 80; + rect.Width = 400; + rect.Height = 24; + for (int index = 0; index < 8; ++index) + { + int texId = 450; + int alpha = (int) byte.MaxValue; + if (index == (int) WorldSelect.selectedWorld && WorldSelect.cursorX == 0) + { + alpha = (int) UI.mouseTextBrightness; + texId = 448; + } + else if (WorldSelect.worldNames[index] == null) + { + alpha = 212; + texId = 451; + } + Main.DrawRect(texId, rect, alpha, 0); + rect.Y += 48; + } + rect.Y -= 384; + for (int index = 0; index < 8; ++index) + { + string s = WorldSelect.worldNames[index] == null ? Lang.menu[79] : WorldSelect.worldNames[index]; + Color c = WorldSelect.worldNames[index] == null ? new Color(200, 200, 220, (int) byte.MaxValue) : new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue); + UI.DrawStringCC(UI.fontSmallOutline, s, rect.Center.X, rect.Center.Y, c); + rect.Y += 48; + } + } + + public static void ControlDescription(StringBuilder strBuilder) + { + if (WorldSelect.cursorX == 0) + { + if (WorldSelect.worldNames[(int) WorldSelect.selectedWorld] == null) + strBuilder.Append(Lang.controls(Lang.CONTROLS.CREATE_WORLD)); + else + strBuilder.Append(Lang.controls(Lang.CONTROLS.SELECT)); + } + else + strBuilder.Append(Lang.controls(Lang.CONTROLS.JOIN)); + strBuilder.Append(' '); + strBuilder.Append(Lang.controls(Lang.CONTROLS.BACK)); + strBuilder.Append(' '); + if (WorldSelect.cursorX == 0) + { + if (WorldSelect.worldNames[(int) WorldSelect.selectedWorld] != null) + { + strBuilder.Append(Lang.menu[17]); + strBuilder.Append(' '); + } + } + else if (UI.main.CanViewGamerCard()) + { + strBuilder.Append(Lang.controls(Lang.CONTROLS.X_SHOW_GAMERCARD)); + strBuilder.Append(' '); + } + if (!UI.main.CanPlayOnline()) + return; + strBuilder.Append(Lang.controls(Lang.CONTROLS.SHOW_PARTY)); + } + + public static string WorldName() + { + return WorldSelect.worldNames[(int) WorldSelect.selectedWorld]; + } + + private static void SelectWorld() + { + Main.PlaySound(10); + WorldSelect.worldPathName = "world" + (object) WorldSelect.selectedWorld + ".wld"; + UI.main.SetMenu(MenuMode.GAME_MODE, true, false); + } + + public static void CreateWorld(string name) + { + if (UI.main.HasPlayerStorage()) + WorldSelect.worldNames[(int) WorldSelect.selectedWorld] = name; + Main.worldName = name; + WorldGen.CreateNewWorld(); + } + + public static bool LoadWorlds() + { + if (!UI.main.HasPlayerStorage()) + { + WorldSelect.worldPathName = (string) null; + for (int index = 0; index < 8; ++index) + WorldSelect.worldNames[index] = (string) null; + return true; + } + else + { + bool flag = true; + try + { + using (StorageContainer storageContainer = UI.main.OpenPlayerStorage("Worlds")) + { + for (int index = 0; index < 8; ++index) + { + string file = "world" + ToStringExtensions.ToStringLookup(index) + ".wld"; + if (storageContainer.FileExists(file)) + { + try + { + using (Stream input = storageContainer.OpenFile(file, FileMode.Open)) + { + using (BinaryReader binaryReader = new BinaryReader(input)) + { + if (binaryReader.ReadInt32() > 46) + { + int num = (int) binaryReader.ReadUInt32(); + } + WorldSelect.worldNames[index] = binaryReader.ReadString(); + binaryReader.Close(); + } + } + } + catch + { + Main.ShowSaveIcon(); + storageContainer.DeleteFile(file); + Main.HideSaveIcon(); + WorldSelect.worldNames[index] = (string) null; + flag = false; + } + } + else + WorldSelect.worldNames[index] = (string) null; + } + } + } + catch (IOException ex) + { + UI.main.ReadError(); + for (int index = 0; index < 8; ++index) + WorldSelect.worldNames[index] = (string) null; + flag = true; + } + catch (Exception ex) + { + flag = true; + } + return flag; + } + } + + private static void DeleteWorld() + { + if (WorldSelect.worldNames[(int) WorldSelect.selectedWorld] == null) + return; + Main.PlaySound(10); + UI.main.SetMenu(MenuMode.CONFIRM_DELETE_WORLD, true, false); + } + + public static void EraseWorld() + { + if (!UI.main.HasPlayerStorage()) + return; + Main.ShowSaveIcon(); + try + { + using (StorageContainer storageContainer = UI.main.OpenPlayerStorage("Worlds")) + { + WorldSelect.worldPathName = "world" + (object) WorldSelect.selectedWorld + ".wld"; + storageContainer.DeleteFile(WorldSelect.worldPathName); + } + } + catch (IOException ex) + { + UI.main.WriteError(); + } + catch (Exception ex) + { + } + Main.HideSaveIcon(); + WorldSelect.worldNames[(int) WorldSelect.selectedWorld] = (string) null; + } + + public static AvailableNetworkSession Session() + { + AvailableNetworkSessionCollection sessionCollection = NetworkSession.Find(NetworkSessionType.PlayerMatch, (IEnumerable) new List(1) + { + UI.main.signedInGamer + }, WorldSelect.session.joinableSession.SessionProperties); + WorldSelect.session = (JoinableSession) null; + if (((ReadOnlyCollection) sessionCollection).Count <= 0) + return (AvailableNetworkSession) null; + else + return ((ReadOnlyCollection) sessionCollection)[0]; + } + + private static void JoinSession() + { + WorldSelect.session = Netplay.availableSessions[(int) WorldSelect.selectedSession]; + Netplay.StopFindingSessions(); + UI.main.SetMenu(MenuMode.NETPLAY, true, false); + UI.main.statusText = Lang.menu[80]; + Netplay.StartClient(); + } + } +} diff --git a/Terraria/WorldView.cs b/Terraria/WorldView.cs new file mode 100644 index 0000000..f8244b2 --- /dev/null +++ b/Terraria/WorldView.cs @@ -0,0 +1,4789 @@ +// Type: Terraria.WorldView +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Content; +using Microsoft.Xna.Framework.Graphics; +using System; + +namespace Terraria +{ + public class WorldView : IDisposable + { + public static readonly short[] VIEW_WIDTH = new short[7] + { + (short) 960, + (short) 960, + (short) 960, + (short) 960, + (short) 960, + (short) 1920, + (short) 1920 + }; + public static readonly byte[] SAFE_AREA_OFFSETS = new byte[28] + { + (byte) 48, + (byte) 27, + (byte) 48, + (byte) 27, + (byte) 96, + (byte) 54, + (byte) 0, + (byte) 0, + (byte) 0, + (byte) 54, + (byte) 96, + (byte) 0, + (byte) 96, + (byte) 0, + (byte) 0, + (byte) 54, + (byte) 0, + (byte) 0, + (byte) 96, + (byte) 54, + (byte) 96, + (byte) 54, + (byte) 96, + (byte) 0, + (byte) 96, + (byte) 0, + (byte) 96, + (byte) 54 + }; + public static readonly Viewport[] VIEWPORT = new Viewport[7] + { + new Viewport(0, 0, 960, 540), + new Viewport(0, 0, 480, 270), + new Viewport(480, 0, 480, 270), + new Viewport(0, 270, 480, 270), + new Viewport(480, 270, 480, 270), + new Viewport(0, 0, 960, 270), + new Viewport(0, 270, 960, 270) + }; + public static Texture2D[] backgroundTexture = new Texture2D[32]; + private bool SMOOTH_LIGHT = true; + private WorldView.Type viewType = WorldView.Type.NONE; + public int SAFE_AREA_OFFSET_L = 48; + public int SAFE_AREA_OFFSET_T = 27; + public int SAFE_AREA_OFFSET_R = 48; + public int SAFE_AREA_OFFSET_B = 27; + private int currentSAFE_AREA_OFFSET_L = 48; + private int currentSAFE_AREA_OFFSET_T = 27; + private int currentSAFE_AREA_OFFSET_R = 48; + private int currentSAFE_AREA_OFFSET_B = 27; + private int targetSAFE_AREA_OFFSET_L = 48; + private int targetSAFE_AREA_OFFSET_T = 27; + private int targetSAFE_AREA_OFFSET_R = 48; + private int targetSAFE_AREA_OFFSET_B = 27; + public Rectangle clipArea = new Rectangle(0, 0, 0, 604); + public Rectangle viewArea = new Rectangle(0, 0, 0, 540); + public int quickBG = 2; + public float[] bgAlpha = new float[8]; + public float[] bgAlpha2 = new float[8]; + public Lighting lighting = new Lighting(); + public int musicBox = -1; + public bool[] drawNpcName = new bool[196]; + public Vector2i sceneWaterPos = new Vector2i(); + public Vector2i sceneTilePos = new Vector2i(); + public Vector2i sceneTile2Pos = new Vector2i(); + public Vector2i sceneWallPos = new Vector2i(); + public Vector2i sceneBackgroundPos = new Vector2i(); + public Vector2i sceneBlackPos = new Vector2i(); + private Matrix viewMtx = Matrix.Identity; + private float worldScale = 1f; + private float worldScaleTarget = 1f; + private float worldScalePrevious = 1f; + private WorldView.Spec[] spec = new WorldView.Spec[512]; + public const bool DRAW_TO_SCREEN = false; + public const int OFFSCREEN_RANGE_X = 32; + public const int OFFSCREEN_RANGE_TOP = 32; + public const int OFFSCREEN_RANGE_BOTTOM = 64; + public const int OFFSCREEN_RANGE_VERTICAL = 96; + public const float CAVE_PARALLAX = 0.9f; + public const float gfxQuality = 0.25f; + private const double VIEWPORT_ANIM_STEPS = 30.0; + private const double VIEWPORT_ANIM_THETA_DELTA = 0.0523598775598299; + private const double ZOOM_ANIM_STEPS = 90.0; + private const double ZOOM_ANIM_THETA_DELTA = 0.0174532925199433; + private const int CLIP_AREA_EXTRA_WIDTH = 32; + private const int CLIP_AREA_EXTRA_HEIGHT = 64; + public const int MAX_BACKGROUNDS = 32; + private bool isDisposed; + public short viewWidth; + private Viewport currentViewport; + private Viewport targetViewport; + public Viewport activeViewport; + private double viewportAnimTheta; + public Player player; + public UI ui; + public Time time; + public float atmo; + public short firstTileX; + public short lastTileX; + public short firstTileY; + public short lastTileY; + public Vector2i screenPosition; + public Vector2i screenLastPosition; + public int bgDelay; + public int bgStyle; + public DustPool dustLocal; + public ItemTextPool itemTextLocal; + public int inactiveTiles; + public int sandTiles; + public int evilTiles; + public int snowTiles; + public int holyTiles; + public int meteorTiles; + public int jungleTiles; + public int dungeonTiles; + private RenderTarget2D backWaterTarget; + private RenderTarget2D waterTarget; + private RenderTarget2D tileSolidTarget; + private RenderTarget2D blackTarget; + private RenderTarget2D tileNonSolidTarget; + private RenderTarget2D wallTarget; + private RenderTarget2D backgroundTarget; + public static GraphicsDevice graphicsDevice; + private static Matrix halfpixelOffset; + private static Matrix centerWideSplitscreen; + private BasicEffect renderTargetProjection; + public BasicEffect screenProjection; + public static RasterizerState scissorTest; + private double worldScaleAnimTheta; + + static WorldView() + { + } + + public WorldView() + { + this.dustLocal = new DustPool(this, 128); + this.itemTextLocal = new ItemTextPool(this); + this.bgAlpha[0] = 1f; + this.bgAlpha2[0] = 1f; + this.renderTargetProjection = new BasicEffect(WorldView.graphicsDevice); + this.renderTargetProjection.World = Matrix.Identity; + this.renderTargetProjection.View = Matrix.Identity; + this.renderTargetProjection.TextureEnabled = true; + this.renderTargetProjection.VertexColorEnabled = true; + this.screenProjection = new BasicEffect(WorldView.graphicsDevice); + this.screenProjection.World = Matrix.Identity; + this.screenProjection.View = Matrix.Identity; + this.screenProjection.TextureEnabled = true; + this.screenProjection.VertexColorEnabled = true; + } + + public static WorldView.Type getViewType(PlayerIndex controller, UI newUI = null) + { + int num1 = 0; + int num2 = 0; + for (int index = 0; index < 4; ++index) + { + UI ui = Main.ui[index]; + if (ui == newUI || ui.view != null) + { + ++num2; + if (ui.controller < controller) + ++num1; + } + } + switch (num2) + { + case 2: + return (WorldView.Type) (5 + num1); + case 3: + if (num1 == 0) + return WorldView.Type.TOP; + return num1 == 1 ? WorldView.Type.BOTTOM_LEFT : WorldView.Type.BOTTOM_RIGHT; + case 4: + return (WorldView.Type) (1 + num1); + default: + return WorldView.Type.FULLSCREEN; + } + } + + public static bool AnyViewContains(int X, int Y) + { + int num = UI.numActiveViews; + while (!UI.activeView[--num].clipArea.Contains(X, Y)) + { + if (num <= 0) + return false; + } + return true; + } + + public static bool AnyViewIntersects(ref Rectangle rect) + { + int num = UI.numActiveViews; + bool result; + do + { + UI.activeView[--num].clipArea.Intersects(ref rect, out result); + } + while (!result && num > 0); + return result; + } + + public static void LoadContent(ContentManager Content) + { + for (int index = 3; index < 32; ++index) + WorldView.backgroundTexture[index] = Content.Load("Images/Background_" + (object) index); + } + + public static void Initialize(GraphicsDevice device) + { + WorldView.graphicsDevice = device; + Matrix.CreateTranslation(0.5f, 0.5f, 0.0f, out WorldView.halfpixelOffset); + Matrix.CreateTranslation(480f, 0.0f, 0.0f, out WorldView.centerWideSplitscreen); + WorldView.scissorTest = new RasterizerState(); + WorldView.scissorTest.ScissorTestEnable = true; + } + + public void onStartGame() + { + this.lighting.StartWorkerThread(); + } + + public void onStopGame() + { + this.lighting.StopWorkerThread(); + this.itemTextLocal.Clear(); + } + + public bool setViewType(WorldView.Type type = WorldView.Type.FULLSCREEN) + { + if (type == this.viewType) + return false; + if (type != WorldView.Type.FULLSCREEN) + { + this.SMOOTH_LIGHT = false; + } + else + { + this.SMOOTH_LIGHT = true; + this.Zoom(1f); + } + WorldView.Type type1 = this.viewType; + bool flag = this.isFullScreen(); + int num = (int) this.viewWidth; + this.viewType = type; + if (type != WorldView.Type.NONE) + { + int width1 = (int) WorldView.VIEW_WIDTH[(int) type]; + if (num != width1) + { + this.viewWidth = (short) width1; + this.clipArea.Width = width1 + 32; + this.viewArea.Width = width1; + this.lighting.SetWidth(width1); + } + this.currentViewport = this.activeViewport; + this.targetViewport = WorldView.VIEWPORT[(int) type]; + this.currentSAFE_AREA_OFFSET_L = this.SAFE_AREA_OFFSET_L; + this.currentSAFE_AREA_OFFSET_T = this.SAFE_AREA_OFFSET_T; + this.currentSAFE_AREA_OFFSET_R = this.SAFE_AREA_OFFSET_R; + this.currentSAFE_AREA_OFFSET_B = this.SAFE_AREA_OFFSET_B; + this.targetSAFE_AREA_OFFSET_L = (int) WorldView.SAFE_AREA_OFFSETS[(int) type << 2]; + this.targetSAFE_AREA_OFFSET_T = (int) WorldView.SAFE_AREA_OFFSETS[((int) type << 2) + 1]; + this.targetSAFE_AREA_OFFSET_R = (int) WorldView.SAFE_AREA_OFFSETS[((int) type << 2) + 2]; + this.targetSAFE_AREA_OFFSET_B = (int) WorldView.SAFE_AREA_OFFSETS[((int) type << 2) + 3]; + if (type1 != WorldView.Type.NONE && flag == this.isFullScreen() && num == (int) this.viewWidth) + { + this.viewportAnimTheta = Math.PI / 2.0; + return false; + } + else + { + this.SAFE_AREA_OFFSET_L = this.targetSAFE_AREA_OFFSET_L; + this.SAFE_AREA_OFFSET_T = this.targetSAFE_AREA_OFFSET_T; + this.SAFE_AREA_OFFSET_R = this.targetSAFE_AREA_OFFSET_R; + this.SAFE_AREA_OFFSET_B = this.targetSAFE_AREA_OFFSET_B; + this.activeViewport = this.targetViewport; + this.viewportAnimTheta = 0.0; + this.UpdateProjection(); + int width2 = (int) this.viewWidth + 64; + int height = 636; + if (this.backWaterTarget == null || this.backWaterTarget.Width != width2 || this.backWaterTarget.Height != height) + { + this.DisposeRendertargets(); + this.backWaterTarget = new RenderTarget2D(WorldView.graphicsDevice, width2, height, false, SurfaceFormat.Color, DepthFormat.None); + this.waterTarget = new RenderTarget2D(WorldView.graphicsDevice, width2, height, false, SurfaceFormat.Color, DepthFormat.None); + this.blackTarget = new RenderTarget2D(WorldView.graphicsDevice, width2, height, false, SurfaceFormat.Color, DepthFormat.None); + this.tileSolidTarget = new RenderTarget2D(WorldView.graphicsDevice, width2, height, false, SurfaceFormat.Color, DepthFormat.None); + this.tileNonSolidTarget = new RenderTarget2D(WorldView.graphicsDevice, width2, height, false, SurfaceFormat.Color, DepthFormat.None); + this.wallTarget = new RenderTarget2D(WorldView.graphicsDevice, width2, height, false, SurfaceFormat.Color, DepthFormat.None); + this.backgroundTarget = new RenderTarget2D(WorldView.graphicsDevice, width2, height, false, SurfaceFormat.Color, DepthFormat.None); + } + return true; + } + } + else + { + this.DisposeRendertargets(); + return true; + } + } + + public void Dispose() + { + this.lighting.StopWorkerThread(); + this.Dispose(true); + GC.SuppressFinalize((object) this); + } + + private void DisposeRendertargets() + { + if (this.backWaterTarget == null) + return; + this.backWaterTarget.Dispose(); + this.backWaterTarget = (RenderTarget2D) null; + this.waterTarget.Dispose(); + this.waterTarget = (RenderTarget2D) null; + this.tileSolidTarget.Dispose(); + this.tileSolidTarget = (RenderTarget2D) null; + this.blackTarget.Dispose(); + this.blackTarget = (RenderTarget2D) null; + this.tileNonSolidTarget.Dispose(); + this.tileNonSolidTarget = (RenderTarget2D) null; + this.wallTarget.Dispose(); + this.wallTarget = (RenderTarget2D) null; + this.backgroundTarget.Dispose(); + this.backgroundTarget = (RenderTarget2D) null; + } + + protected virtual void Dispose(bool disposing) + { + if (this.isDisposed) + return; + if (disposing) + this.DisposeRendertargets(); + this.isDisposed = true; + } + + public bool isFullScreen() + { + return this.viewType == WorldView.Type.FULLSCREEN; + } + + public static void restoreViewport() + { + WorldView.graphicsDevice.Viewport = WorldView.VIEWPORT[0]; + } + + public void PrepareDraw(int pass) + { + this.screenLastPosition = this.screenPosition; + this.player.updateScreenPosition(); + if (this.screenPosition.X < 560) + this.screenPosition.X = 560; + else if (this.screenPosition.X + (int) this.viewWidth > Main.rightWorld - 544 - 32) + this.screenPosition.X = Main.rightWorld - (int) this.viewWidth - 544 - 32; + if (this.screenPosition.Y < 560) + this.screenPosition.Y = 560; + else if (this.screenPosition.Y + 540 > Main.bottomWorld - 544 - 32) + this.screenPosition.Y = Main.bottomWorld - 540 - 544 - 32; + this.viewArea.X = this.screenPosition.X; + this.viewArea.Y = this.screenPosition.Y; + this.clipArea.X = this.screenPosition.X - 16; + this.clipArea.Y = this.screenPosition.Y - 32; + this.firstTileX = (short) (this.screenPosition.X >> 4); + this.firstTileY = (short) (this.screenPosition.Y >> 4); + this.lastTileX = (short) ((int) this.firstTileX + ((int) this.viewWidth >> 4)); + if ((int) this.lastTileX > (int) Main.maxTilesX) + this.lastTileX = Main.maxTilesX; + this.lastTileY = (short) ((int) this.firstTileY + 33); + if ((int) this.lastTileY > (int) Main.maxTilesY) + this.lastTileY = Main.maxTilesY; + this.lighting.LightTiles(this); + this.firstTileX -= (short) 2; + if ((int) this.firstTileX < 0) + this.firstTileX = (short) 0; + this.firstTileY -= (short) 2; + if ((int) this.firstTileY < 0) + this.firstTileY = (short) 0; + this.lastTileX += (short) 2; + if ((int) this.lastTileX > (int) Main.maxTilesX) + this.lastTileX = Main.maxTilesX; + this.lastTileY += (short) 4; + if ((int) this.lastTileY > (int) Main.maxTilesY) + this.lastTileY = Main.maxTilesY; + if (pass > 0) + { + Vector2i vector2i = this.screenPosition; + this.screenPosition.X &= -2; + this.screenPosition.Y &= -2; + if (pass == 1) + this.RenderBackground(); + else if (pass == 2) + { + if ((int) this.firstTileY <= Main.worldSurface) + this.RenderBlack(); + this.RenderSolidTiles(); + } + else if (pass == 3) + { + this.RenderWalls(); + } + else + { + this.RenderNonSolidTiles(); + this.RenderBackWater(); + this.RenderWater(); + } + this.screenPosition = vector2i; + } + if (this.worldScaleAnimTheta > 0.0) + { + this.worldScaleAnimTheta -= Math.PI / 180.0; + this.worldScale = this.worldScaleAnimTheta > 0.0 ? this.worldScalePrevious + (float) ((1.0 - Math.Sin(this.worldScaleAnimTheta)) * ((double) this.worldScaleTarget - (double) this.worldScalePrevious)) : this.worldScaleTarget; + this.UpdateView(); + } + this.screenProjection.View = this.viewMtx; + } + + public void Zoom(float z) + { + if ((double) z == (double) this.worldScaleTarget) + return; + this.worldScaleTarget = z; + this.worldScalePrevious = this.worldScale; + this.worldScaleAnimTheta = Math.PI / 2.0; + } + + private void UpdateProjection() + { + this.screenProjection.Projection = !this.isFullScreen() ? WorldView.halfpixelOffset * Matrix.CreateOrthographicOffCenter(0.0f, (float) (this.activeViewport.Width << 1), (float) (this.activeViewport.Height << 1), 0.0f, 0.0f, 1f) : WorldView.halfpixelOffset * Matrix.CreateOrthographicOffCenter(0.0f, (float) this.activeViewport.Width, (float) this.activeViewport.Height, 0.0f, 0.0f, 1f); + this.renderTargetProjection.Projection = WorldView.halfpixelOffset * Matrix.CreateOrthographicOffCenter(0.0f, (float) ((int) this.viewWidth + 64), 636f, 0.0f, 0.0f, 1f); + } + + private void UpdateView() + { + int num1 = (int) this.viewWidth; + int num2 = 540; + int num3 = num1 >> 1; + int num4 = num2 >> 1; + this.viewMtx = Matrix.CreateTranslation((float) -num3, (float) -num4, 0.0f) * Matrix.CreateScale(this.worldScale, this.worldScale, 1f) * Matrix.CreateTranslation((float) num3, (float) num4, 0.0f); + } + + public void SetWorldView() + { + Main.spriteBatch.End(); + this.screenProjection.View = this.viewMtx; + Main.spriteBatch.Begin(SpriteSortMode.Deferred, (BlendState) null, (SamplerState) null, (DepthStencilState) null, (RasterizerState) null, (Effect) this.screenProjection); + } + + public void SetScreenView() + { + Main.spriteBatch.End(); + this.screenProjection.View = Matrix.Identity; + Main.spriteBatch.Begin(SpriteSortMode.Deferred, (BlendState) null, (SamplerState) null, (DepthStencilState) null, (RasterizerState) null, (Effect) this.screenProjection); + } + + public void SetScreenViewWideCentered() + { + Main.spriteBatch.End(); + this.screenProjection.View = (int) this.viewWidth == 960 ? Matrix.Identity : WorldView.centerWideSplitscreen; + Main.spriteBatch.Begin(SpriteSortMode.Deferred, (BlendState) null, (SamplerState) null, (DepthStencilState) null, (RasterizerState) null, (Effect) this.screenProjection); + } + + private void DrawCombatText() + { + for (int index1 = 0; index1 < 32; ++index1) + { + if ((int) Main.combatText[index1].active != 0) + { + Vector2 pivot = Main.combatText[index1].textSize; + pivot.X *= 0.5f; + pivot.Y *= 0.5f; + int index2 = Main.combatText[index1].crit ? 1 : 0; + float scale = Main.combatText[index1].scale; + float num = Main.combatText[index1].alpha * scale; + Color c = new Color(num, num, num, num); + Vector2 pos = Main.combatText[index1].position; + pos.X += pivot.X; + pos.X -= (float) this.screenPosition.X; + pos.Y += pivot.Y; + pos.Y -= (float) this.screenPosition.Y; + UI.DrawString(UI.fontCombatText[index2], Main.combatText[index1].text, pos, c, Main.combatText[index1].rotation, pivot, scale); + } + } + } + + private void DrawItemText() + { + for (int index = 0; index < 4; ++index) + { + if ((int) this.itemTextLocal.itemText[index].active != 0) + { + Vector2 pivot = this.itemTextLocal.itemText[index].textSize; + pivot.X *= 0.5f; + pivot.Y *= 0.5f; + float num1 = (float) this.itemTextLocal.itemText[index].color.R; + float num2 = (float) this.itemTextLocal.itemText[index].color.G; + float num3 = (float) this.itemTextLocal.itemText[index].color.B; + float num4 = (float) this.itemTextLocal.itemText[index].color.A; + float scale = this.itemTextLocal.itemText[index].scale; + double num5 = (double) this.itemTextLocal.itemText[index].alpha; + float num6 = num1 * scale; + float num7 = num3 * scale; + float num8 = num2 * scale; + float num9 = num4 * scale; + Vector2 pos = this.itemTextLocal.itemText[index].position; + pos.X += pivot.X; + pos.X -= (float) this.screenPosition.X; + pos.Y += pivot.Y; + pos.Y -= (float) this.screenPosition.Y; + UI.DrawStringScaled(UI.fontSmallOutline, this.itemTextLocal.itemText[index].text, pos, new Color((int) num6, (int) num8, (int) num7, (int) num9), pivot, scale); + } + } + } + + private void DrawProjectiles() + { + for (int index = 511; index >= 0; --index) + { + if ((int) Main.projectile[index].active != 0 && (int) Main.projectile[index].type > 0 && !Main.projectile[index].hide) + Main.projectile[index].Draw(this); + } + } + + private void DrawPlayers() + { + for (int index = 0; index < 8; ++index) + { + Player player = Main.player[index]; + if ((int) player.active != 0) + { + if (player.ghost) + { + Vector2 vector2 = player.position; + player.position = player.shadowPos[0]; + player.shadow = 0.5f; + player.DrawGhost(this); + player.position = player.shadowPos[1]; + player.shadow = 0.7f; + player.DrawGhost(this); + player.position = player.shadowPos[2]; + player.shadow = 0.9f; + player.DrawGhost(this); + player.position = vector2; + player.shadow = 0.0f; + player.DrawGhost(this); + } + else + { + bool flag1 = false; + bool flag2 = false; + if ((int) player.legs == 25) + flag1 = true; + else if ((int) player.head == 5 && (int) player.body == 5 && (int) player.legs == 5) + flag1 = true; + else if ((int) player.head == 7 && (int) player.body == 7 && (int) player.legs == 7) + flag1 = true; + else if ((int) player.head == 22 && (int) player.body == 14 && (int) player.legs == 14) + flag1 = true; + else if ((int) player.body == 17 && (int) player.legs == 16 && ((int) player.head == 29 || (int) player.head == 30 || (int) player.head == 31)) + flag1 = true; + if ((int) player.legs == 26) + flag2 = true; + else if ((int) player.body == 19 && (int) player.legs == 18) + { + if ((int) player.head == 35 || (int) player.head == 36 || (int) player.head == 37) + flag2 = true; + } + else if ((int) player.body == 24 && (int) player.legs == 23 && ((int) player.head == 41 || (int) player.head == 42 || (int) player.head == 43)) + { + flag2 = true; + flag1 = true; + } + if (flag2) + { + Vector2 vector2 = player.position; + player.ghostFade += player.ghostDir * 0.075f; + if ((double) player.ghostFade < 0.100000001490116) + { + player.ghostDir = 1f; + player.ghostFade = 0.1f; + } + if ((double) player.ghostFade > 0.899999976158142) + { + player.ghostDir = -1f; + player.ghostFade = 0.9f; + } + player.position.X = vector2.X - player.ghostFade * 5f; + player.shadow = player.ghostFade; + player.Draw(this, false, false); + player.position.X = vector2.X + player.ghostFade * 5f; + player.shadow = player.ghostFade; + player.Draw(this, false, false); + player.position = vector2; + player.position.Y = vector2.Y - player.ghostFade * 5f; + player.shadow = player.ghostFade; + player.Draw(this, false, false); + player.position.Y = vector2.Y + player.ghostFade * 5f; + player.shadow = player.ghostFade; + player.Draw(this, false, false); + player.position = vector2; + player.shadow = 0.0f; + } + if (flag1) + { + Vector2 vector2 = player.position; + player.position = player.shadowPos[0]; + player.shadow = 0.5f; + player.Draw(this, false, false); + player.position = player.shadowPos[1]; + player.shadow = 0.7f; + player.Draw(this, false, false); + player.position = player.shadowPos[2]; + player.shadow = 0.9f; + player.Draw(this, false, false); + player.position = vector2; + player.shadow = 0.0f; + } + player.Draw(this, false, false); + } + } + } + } + + private unsafe void DrawItems() + { + Rectangle rectangle = new Rectangle(); + Vector2 pos = new Vector2(); + fixed (Item* objPtr1 = Main.item) + { + Item* objPtr2 = objPtr1; + for (int index = 199; index >= 0; --index) + { + if ((int) objPtr2->active != 0) + { + int X = (int) objPtr2->position.X; + int Y = (int) objPtr2->position.Y; + int id = 451 + (int) objPtr2->type; + rectangle.Width = SpriteSheet<_sheetSprites>.src[id].Width; + rectangle.Height = SpriteSheet<_sheetSprites>.src[id].Height; + rectangle.X = X + ((int) objPtr2->width >> 1); + rectangle.Y = Y + (rectangle.Height >> 1) + (int) objPtr2->height - rectangle.Height + 2; + if (rectangle.Intersects(this.viewArea)) + { + Color colorUnsafe = this.lighting.GetColorUnsafe(X + ((int) objPtr2->width >> 1) >> 4, Y + ((int) objPtr2->height >> 1) >> 4); + if ((objPtr2->CanBePlacedInCoinSlot() || (int) objPtr2->type == 58 || (int) objPtr2->type == 109) && (Main.hasFocus && (int) colorUnsafe.R > 60 && (double) ((float) Main.rand.Next(500) - (float) (((double) Math.Abs(objPtr2->velocity.X) + (double) Math.Abs(objPtr2->velocity.Y)) * 10.0)) < (double) colorUnsafe.R * 0.0199999995529652)) + { + Dust* dustPtr = this.dustLocal.NewDust(X, Y, (int) objPtr2->width, (int) objPtr2->height, 43, 0.0, 0.0, 254, new Color(), 0.5); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.X = 0.0f; + dustPtr->velocity.Y = 0.0f; + } + } + float rot = objPtr2->velocity.X * 0.2f; + float scale = 1f; + Color alpha = objPtr2->GetAlpha(colorUnsafe); + if ((int) objPtr2->type == 58 || (int) objPtr2->type == 184) + { + scale = (float) ((double) UI.essScale * 0.25 + 0.75); + alpha.R = (byte) ((double) alpha.R * (double) scale); + alpha.G = (byte) ((double) alpha.G * (double) scale); + alpha.B = (byte) ((double) alpha.B * (double) scale); + alpha.A = (byte) ((double) alpha.A * (double) scale); + } + else if ((int) objPtr2->type == 520 || (int) objPtr2->type == 521 || ((int) objPtr2->type == 547 || (int) objPtr2->type == 548) || ((int) objPtr2->type == 549 || (int) objPtr2->type == 575 || (int) objPtr2->type == 620)) + { + scale = UI.essScale; + alpha.R = (byte) ((double) alpha.R * (double) scale); + alpha.G = (byte) ((double) alpha.G * (double) scale); + alpha.B = (byte) ((double) alpha.B * (double) scale); + alpha.A = (byte) ((double) alpha.A * (double) scale); + } + pos.X = (float) (rectangle.X - this.screenPosition.X); + pos.Y = (float) (rectangle.Y - this.screenPosition.Y); + SpriteSheet<_sheetSprites>.Draw(id, ref pos, alpha, rot, scale); + if ((int) objPtr2->color.PackedValue != 0) + SpriteSheet<_sheetSprites>.Draw(id, ref pos, objPtr2->GetColor(colorUnsafe), rot, scale); + } + } + ++objPtr2; + } + } + } + + private unsafe void DrawBlack() + { + float num1 = (float) (((double) this.time.tileColorf.X + (double) this.time.tileColorf.Y + (double) this.time.tileColorf.Z) * 0.133333340287209); + Rectangle dest = new Rectangle(); + dest.X = 32 + ((int) this.firstTileX << 4) - this.screenPosition.X; + dest.Width = 16; + Color black = Color.Black; + int num2 = (int) this.lastTileY - 1; + if (num2 > Main.worldSurface) + num2 = Main.worldSurface; + for (int x = (int) this.firstTileX; x < (int) this.lastTileX; ++x) + { + int y = (int) this.firstTileY; + fixed (Tile* tilePtr1 = &Main.tile[x, y]) + { + Tile* tilePtr2 = tilePtr1; + while (true) + { + float num3 = this.lighting.BrightnessUnsafe(x, y); + if ((double) num3 < (double) num1 && ((double) num3 == 0.0 || (int) tilePtr2->liquid == 0 || (int) tilePtr2->active != 0 && Main.tileSolidNotSolidTop[(int) tilePtr2->type])) + { + if (dest.Height == 0) + dest.Y = 32 + (y << 4) - this.screenPosition.Y; + dest.Height += 16; + } + else if (dest.Height > 0) + { + SpriteSheet<_sheetTiles>.DrawStretchedY(7, ref dest, black); + dest.Height = 0; + } + if (++y <= num2) + ++tilePtr2; + else + break; + } + if (dest.Height > 0) + { + SpriteSheet<_sheetTiles>.DrawStretchedY(7, ref dest, black); + dest.Height = 0; + } + } + dest.X += 16; + } + } + + private unsafe void DrawWalls() + { + Vector2 pos = new Vector2(); + Color color = new Color(); + Rectangle s = new Rectangle(); + int num1 = (int) this.firstTileX; + Tile[,] tileArray; + // ISSUE: cast to a reference type + // ISSUE: explicit reference operation + fixed (Tile* tilePtr1 = &^((tileArray = Main.tile) == null || tileArray.Length == 0 ? (Tile&) IntPtr.Zero : tileArray.Address(0, 0))) + { + do + { + int num2 = (int) this.firstTileY; + Tile* tilePtr2 = tilePtr1 + (num1 * 1440 + num2); + do + { + int num3 = (int) tilePtr2->wall; + tilePtr2->flags |= Tile.Flags.VISITED; + if (num3 > 0 && !tilePtr2->isFullTile()) + { + Color colorUnsafe1 = this.lighting.GetColorUnsafe(num1, num2); + int id = 186 + num3; + s.X = (int) tilePtr2->wallFrameX << 1; + s.Y = (int) tilePtr2->wallFrameY << 1; + s.Width = 32; + s.Height = 32; + pos.X = (float) (num1 * 16 - this.screenPosition.X - 8 + 32); + pos.Y = (float) (num2 * 16 - this.screenPosition.Y - 8 + 32); + if (this.SMOOTH_LIGHT && num3 != 21 && !WorldGen.SolidTile(num1, num2)) + { + if ((int) colorUnsafe1.R > 216 || (double) colorUnsafe1.G > 237.6 || (double) colorUnsafe1.B > 259.2) + { + s.Width = 12; + s.Height = 12; + Color colorUnsafe2 = this.lighting.GetColorUnsafe(num1 - 1, num2 - 1); + colorUnsafe2.R = (byte) ((int) colorUnsafe1.R + (int) colorUnsafe2.R >> 1); + colorUnsafe2.G = (byte) ((int) colorUnsafe1.G + (int) colorUnsafe2.G >> 1); + colorUnsafe2.B = (byte) ((int) colorUnsafe1.B + (int) colorUnsafe2.B >> 1); + SpriteSheet<_sheetTiles>.Draw(id, ref pos, ref s, colorUnsafe2); + pos.X += 12f; + s.X += 12; + s.Width = 8; + colorUnsafe2 = this.lighting.GetColorUnsafe(num1, num2 - 1); + colorUnsafe2.R = (byte) ((int) colorUnsafe1.R + (int) colorUnsafe2.R >> 1); + colorUnsafe2.G = (byte) ((int) colorUnsafe1.G + (int) colorUnsafe2.G >> 1); + colorUnsafe2.B = (byte) ((int) colorUnsafe1.B + (int) colorUnsafe2.B >> 1); + SpriteSheet<_sheetTiles>.Draw(id, ref pos, ref s, colorUnsafe2); + pos.X += 8f; + s.X += 8; + s.Width = 12; + colorUnsafe2 = this.lighting.GetColorUnsafe(num1 + 1, num2 - 1); + colorUnsafe2.R = (byte) ((int) colorUnsafe1.R + (int) colorUnsafe2.R >> 1); + colorUnsafe2.G = (byte) ((int) colorUnsafe1.G + (int) colorUnsafe2.G >> 1); + colorUnsafe2.B = (byte) ((int) colorUnsafe1.B + (int) colorUnsafe2.B >> 1); + SpriteSheet<_sheetTiles>.Draw(id, ref pos, ref s, colorUnsafe2); + pos.Y += 12f; + s.Y += 12; + s.Height = 8; + colorUnsafe2 = this.lighting.GetColorUnsafe(num1 + 1, num2); + colorUnsafe2.R = (byte) ((int) colorUnsafe1.R + (int) colorUnsafe2.R >> 1); + colorUnsafe2.G = (byte) ((int) colorUnsafe1.G + (int) colorUnsafe2.G >> 1); + colorUnsafe2.B = (byte) ((int) colorUnsafe1.B + (int) colorUnsafe2.B >> 1); + SpriteSheet<_sheetTiles>.Draw(id, ref pos, ref s, colorUnsafe2); + pos.X -= 8f; + s.X -= 8; + s.Width = 8; + SpriteSheet<_sheetTiles>.Draw(id, ref pos, ref s, colorUnsafe2); + pos.X -= 12f; + s.X -= 12; + s.Width = 12; + colorUnsafe2 = this.lighting.GetColorUnsafe(num1 - 1, num2); + colorUnsafe2.R = (byte) ((int) colorUnsafe1.R + (int) colorUnsafe2.R >> 1); + colorUnsafe2.G = (byte) ((int) colorUnsafe1.G + (int) colorUnsafe2.G >> 1); + colorUnsafe2.B = (byte) ((int) colorUnsafe1.B + (int) colorUnsafe2.B >> 1); + SpriteSheet<_sheetTiles>.Draw(id, ref pos, ref s, colorUnsafe2); + pos.Y += 8f; + s.Y += 8; + s.Height = 12; + colorUnsafe2 = this.lighting.GetColorUnsafe(num1 - 1, num2 + 1); + colorUnsafe2.R = (byte) ((int) colorUnsafe1.R + (int) colorUnsafe2.R >> 1); + colorUnsafe2.G = (byte) ((int) colorUnsafe1.G + (int) colorUnsafe2.G >> 1); + colorUnsafe2.B = (byte) ((int) colorUnsafe1.B + (int) colorUnsafe2.B >> 1); + SpriteSheet<_sheetTiles>.Draw(id, ref pos, ref s, colorUnsafe2); + pos.X += 12f; + s.X += 12; + s.Width = 8; + colorUnsafe2 = this.lighting.GetColorUnsafe(num1, num2 + 1); + colorUnsafe2.R = (byte) ((int) colorUnsafe1.R + (int) colorUnsafe2.R >> 1); + colorUnsafe2.G = (byte) ((int) colorUnsafe1.G + (int) colorUnsafe2.G >> 1); + colorUnsafe2.B = (byte) ((int) colorUnsafe1.B + (int) colorUnsafe2.B >> 1); + SpriteSheet<_sheetTiles>.Draw(id, ref pos, ref s, colorUnsafe2); + pos.X += 8f; + s.X += 8; + s.Width = 12; + colorUnsafe2 = this.lighting.GetColorUnsafe(num1 + 1, num2 + 1); + colorUnsafe2.R = (byte) ((int) colorUnsafe1.R + (int) colorUnsafe2.R >> 1); + colorUnsafe2.G = (byte) ((int) colorUnsafe1.G + (int) colorUnsafe2.G >> 1); + colorUnsafe2.B = (byte) ((int) colorUnsafe1.B + (int) colorUnsafe2.B >> 1); + SpriteSheet<_sheetTiles>.Draw(id, ref pos, ref s, colorUnsafe2); + } + else if ((int) colorUnsafe1.R > 100 || (double) colorUnsafe1.G > 110 || (double) colorUnsafe1.B > 120.0) + { + s.Width = 16; + s.Height = 16; + Color c = this.lighting.Brighter(num1, num2 - 1, num1 - 1, num2) ? this.lighting.GetColorUnsafe(num1 - 1, num2) : this.lighting.GetColorUnsafe(num1, num2 - 1); + c.R = (byte) ((int) colorUnsafe1.R + (int) c.R >> 1); + c.G = (byte) ((int) colorUnsafe1.G + (int) c.G >> 1); + c.B = (byte) ((int) colorUnsafe1.B + (int) c.B >> 1); + SpriteSheet<_sheetTiles>.Draw(id, ref pos, ref s, c); + s.X += 16; + pos.X += 16f; + c = this.lighting.Brighter(num1, num2 - 1, num1 + 1, num2) ? this.lighting.GetColorUnsafe(num1 + 1, num2) : this.lighting.GetColorUnsafe(num1, num2 - 1); + c.R = (byte) ((int) colorUnsafe1.R + (int) c.R >> 1); + c.G = (byte) ((int) colorUnsafe1.G + (int) c.G >> 1); + c.B = (byte) ((int) colorUnsafe1.B + (int) c.B >> 1); + SpriteSheet<_sheetTiles>.Draw(id, ref pos, ref s, c); + s.Y += 16; + pos.Y += 16f; + c = this.lighting.Brighter(num1, num2 + 1, num1 + 1, num2) ? this.lighting.GetColorUnsafe(num1 + 1, num2) : this.lighting.GetColorUnsafe(num1, num2 + 1); + c.R = (byte) ((int) colorUnsafe1.R + (int) c.R >> 1); + c.G = (byte) ((int) colorUnsafe1.G + (int) c.G >> 1); + c.B = (byte) ((int) colorUnsafe1.B + (int) c.B >> 1); + SpriteSheet<_sheetTiles>.Draw(id, ref pos, ref s, c); + s.X -= 16; + pos.X -= 16f; + c = this.lighting.Brighter(num1, num2 + 1, num1 - 1, num2) ? this.lighting.GetColorUnsafe(num1 - 1, num2) : this.lighting.GetColorUnsafe(num1, num2 + 1); + c.R = (byte) ((int) colorUnsafe1.R + (int) c.R >> 1); + c.G = (byte) ((int) colorUnsafe1.G + (int) c.G >> 1); + c.B = (byte) ((int) colorUnsafe1.B + (int) c.B >> 1); + SpriteSheet<_sheetTiles>.Draw(id, ref pos, ref s, c); + } + else + SpriteSheet<_sheetTiles>.Draw(id, ref pos, ref s, colorUnsafe1); + } + else + SpriteSheet<_sheetTiles>.Draw(id, ref pos, ref s, colorUnsafe1); + } + ++tilePtr2; + } + while (++num2 < (int) this.lastTileY); + } + while (++num1 < (int) this.lastTileX); + } + } + + private unsafe void DrawWires() + { + Rectangle s1 = new Rectangle(); + s1.Width = 16; + s1.Height = 16; + Vector2 pos = new Vector2(); + Tile[,] tileArray; + // ISSUE: cast to a reference type + // ISSUE: explicit reference operation + fixed (Tile* tilePtr1 = &^((tileArray = Main.tile) == null || tileArray.Length == 0 ? (Tile&) IntPtr.Zero : tileArray.Address(0, 0))) + { + for (int x = (int) this.firstTileX; x < (int) this.lastTileX; ++x) + { + pos.X = (float) (32 + x * 16 - this.screenPosition.X); + Tile* tilePtr2 = tilePtr1 + (x * 1440 + (int) this.firstTileY); + int num1 = (int) this.firstTileY; + while (num1 < (int) this.lastTileY) + { + if (tilePtr2->wire != 0) + { + pos.Y = (float) (32 + num1 * 16 - this.screenPosition.Y); + if (this.lighting.IsNotBlackUnsafe(x, num1)) + { + Tile* tilePtr3 = tilePtr2 - 1; + int wire1 = tilePtr3->wire; + Tile* tilePtr4 = tilePtr3 + 2; + int wire2 = tilePtr4->wire; + Tile* tilePtr5 = tilePtr4 - 1441; + int wire3 = tilePtr5->wire; + Tile* tilePtr6 = tilePtr5 + 2880; + int wire4 = tilePtr6->wire; + tilePtr2 = tilePtr6 - 1440; + if (wire1 != 0) + { + if (wire2 != 0) + { + if (wire3 != 0) + { + if (wire4 != 0) + { + s1.X = 18; + s1.Y = 18; + } + else + { + s1.X = 54; + s1.Y = 0; + } + } + else if (wire4 != 0) + { + s1.X = 36; + s1.Y = 0; + } + else + { + s1.X = 0; + s1.Y = 0; + } + } + else if (wire3 != 0) + { + if (wire4 != 0) + { + s1.X = 0; + s1.Y = 18; + } + else + { + s1.X = 54; + s1.Y = 18; + } + } + else if (wire4 != 0) + { + s1.X = 36; + s1.Y = 18; + } + else + { + s1.X = 36; + s1.Y = 36; + } + } + else if (wire2 != 0) + { + if (wire3 != 0) + { + if (wire4 != 0) + { + s1.X = 72; + s1.Y = 0; + } + else + { + s1.X = 72; + s1.Y = 18; + } + } + else if (wire4 != 0) + { + s1.X = 0; + s1.Y = 36; + } + else + { + s1.X = 18; + s1.Y = 36; + } + } + else if (wire3 != 0) + { + if (wire4 != 0) + { + s1.X = 18; + s1.Y = 0; + } + else + { + s1.X = 54; + s1.Y = 36; + } + } + else if (wire4 != 0) + { + s1.X = 72; + s1.Y = 36; + } + else + { + s1.X = 0; + s1.Y = 54; + } + Color colorUnsafe = this.lighting.GetColorUnsafe(x, num1); + if (this.SMOOTH_LIGHT && ((int) colorUnsafe.R > 38 || (double) colorUnsafe.G > 41.8 || (double) colorUnsafe.B > 45.6)) + { + for (int index = 0; index < 4; ++index) + { + int num2 = 0; + int num3 = 0; + Color c = colorUnsafe; + Color color = colorUnsafe; + if (index == 0) + color = !this.lighting.Brighter(x, num1 - 1, x - 1, num1) ? this.lighting.GetColorUnsafe(x, num1 - 1) : this.lighting.GetColorUnsafe(x - 1, num1); + else if (index == 1) + { + color = !this.lighting.Brighter(x, num1 - 1, x + 1, num1) ? this.lighting.GetColorUnsafe(x, num1 - 1) : this.lighting.GetColorUnsafe(x + 1, num1); + num2 = 8; + } + else if (index == 2) + { + color = !this.lighting.Brighter(x, num1 + 1, x - 1, num1) ? this.lighting.GetColorUnsafe(x, num1 + 1) : this.lighting.GetColorUnsafe(x - 1, num1); + num3 = 8; + } + else + { + color = !this.lighting.Brighter(x, num1 + 1, x + 1, num1) ? this.lighting.GetColorUnsafe(x, num1 + 1) : this.lighting.GetColorUnsafe(x + 1, num1); + num2 = 8; + num3 = 8; + } + c.R = (byte) ((int) colorUnsafe.R + (int) color.R >> 1); + c.G = (byte) ((int) colorUnsafe.G + (int) color.G >> 1); + c.B = (byte) ((int) colorUnsafe.B + (int) color.B >> 1); + Rectangle s2 = s1; + s2.X += num2; + s2.Y += num3; + s2.Width = 8; + s2.Height = 8; + pos.X += (float) num2; + pos.Y += (float) num3; + SpriteSheet<_sheetTiles>.Draw(218, ref pos, ref s2, c); + pos.X -= (float) num2; + pos.Y -= (float) num3; + } + } + else + SpriteSheet<_sheetTiles>.Draw(218, ref pos, ref s1, colorUnsafe); + } + } + ++num1; + ++tilePtr2; + } + } + } + } + + public void DrawBg(UI ui) + { + // ISSUE: unable to decompile the method. + } + + public void DrawWorld() + { + Color white = Color.White; + Rectangle destinationRectangle = new Rectangle(); + destinationRectangle.Width = (int) this.viewWidth + 64; + destinationRectangle.Height = 636; + destinationRectangle.X = this.sceneWaterPos.X - this.screenPosition.X; + destinationRectangle.Y = this.sceneWaterPos.Y - this.screenPosition.Y; + Main.spriteBatch.Draw((Texture2D) this.backWaterTarget, destinationRectangle, white); + destinationRectangle.X = (int) ((double) (this.sceneBackgroundPos.X - this.screenPosition.X + 32) * 0.899999976158142) - 32; + destinationRectangle.Y = this.sceneBackgroundPos.Y - this.screenPosition.Y; + Main.spriteBatch.Draw((Texture2D) this.backgroundTarget, destinationRectangle, white); + if ((int) this.firstTileY <= Main.worldSurface) + { + destinationRectangle.X = this.sceneBlackPos.X - this.screenPosition.X; + destinationRectangle.Y = this.sceneBlackPos.Y - this.screenPosition.Y; + Main.spriteBatch.Draw((Texture2D) this.blackTarget, destinationRectangle, white); + } + destinationRectangle.X = this.sceneWallPos.X - this.screenPosition.X; + destinationRectangle.Y = this.sceneWallPos.Y - this.screenPosition.Y; + Main.spriteBatch.Draw((Texture2D) this.wallTarget, destinationRectangle, white); + this.DrawWoF(); + destinationRectangle.X = this.sceneTile2Pos.X - this.screenPosition.X; + destinationRectangle.Y = this.sceneTile2Pos.Y - this.screenPosition.Y; + Main.spriteBatch.Draw((Texture2D) this.tileNonSolidTarget, destinationRectangle, white); + destinationRectangle.X = this.sceneTilePos.X - this.screenPosition.X; + destinationRectangle.Y = this.sceneTilePos.Y - this.screenPosition.Y; + if (this.player.detectCreature) + { + Main.spriteBatch.Draw((Texture2D) this.tileSolidTarget, destinationRectangle, white); + this.DrawGore(); + this.DrawNPCs(true); + this.DrawNPCs(false); + } + else + { + this.DrawNPCs(true); + Main.spriteBatch.Draw((Texture2D) this.tileSolidTarget, destinationRectangle, white); + this.DrawGore(); + this.DrawNPCs(false); + } + this.DrawProjectiles(); + this.DrawPlayers(); + this.DrawItems(); + this.dustLocal.DrawDust(this); + Main.dust.DrawDust(this); + destinationRectangle.X = this.sceneWaterPos.X - this.screenPosition.X; + destinationRectangle.Y = this.sceneWaterPos.Y - this.screenPosition.Y; + Main.spriteBatch.Draw((Texture2D) this.waterTarget, destinationRectangle, white); + this.DrawCombatText(); + this.DrawItemText(); + } + + private unsafe void DrawBackground() + { + float num1 = 0.9f; + float num2 = 0.9f; + float num3 = 0.9f; + float num4 = 0.0f; + if (this.holyTiles > this.evilTiles) + num4 = (float) this.holyTiles * (1.0 / 800.0); + else if (this.evilTiles > this.holyTiles) + num4 = (float) this.evilTiles * (1.0 / 800.0); + if ((double) num4 > 1.0) + num4 = 1f; + float num5 = (float) (this.screenPosition.Y - (Main.worldSurface << 4)) * (1.0 / 300.0); + if ((double) num5 < 0.0) + num5 = 0.0f; + else if ((double) num5 > 1.0) + num5 = 1f; + float num6 = (float) (1.0 - (double) num5 + (double) num1 * (double) num5); + this.lighting.brightness = (float) ((double) this.lighting.defBrightness * (1.0 - (double) num5) + 1.0 * (double) num5); + float num7 = (float) (this.screenPosition.Y - 270 + 200 - (Main.rockLayer << 4)) * (1.0 / 300.0); + if ((double) num7 < 0.0) + num7 = 0.0f; + else if ((double) num7 > 1.0) + num7 = 1f; + if (this.evilTiles > 0) + { + num1 = (float) (0.800000011920929 * (double) num4 + (double) num1 * (1.0 - (double) num4)); + num2 = (float) (0.75 * (double) num4 + (double) num2 * (1.0 - (double) num4)); + num3 = (float) (1.10000002384186 * (double) num4 + (double) num3 * (1.0 - (double) num4)); + } + else if (this.holyTiles > 0) + { + num1 = (float) (1.0 * (double) num4 + (double) num1 * (1.0 - (double) num4)); + num2 = (float) (0.699999988079071 * (double) num4 + (double) num2 * (1.0 - (double) num4)); + num3 = (float) (0.899999976158142 * (double) num4 + (double) num3 * (1.0 - (double) num4)); + } + float num8 = (float) ((double) num6 - (double) num7 + (double) num1 * (double) num7); + float num9 = (float) ((double) num6 - (double) num7 + (double) num2 * (double) num7); + float num10 = (float) ((double) num6 - (double) num7 + (double) num3 * (double) num7); + this.lighting.defBrightness = (float) (1.20000004768372 * (1.0 - (double) num7)) + num7; + int num11 = (int) (-Math.IEEERemainder((double) this.screenPosition.X * 0.899999976158142, 96.0) - 48.0); + int num12 = (int) this.viewWidth / 96 + 2; + int num13 = Main.worldSurfacePixels - this.screenPosition.Y; + int num14 = num11; + int num15 = -(num11 + this.screenPosition.X + 8 & 15); + if (num15 == -8) + num15 = 8; + Vector2 pos1 = new Vector2((float) (num14 + num15 + 32), (float) (num13 + 32)); + Rectangle s1 = new Rectangle(); + s1.X = num15; + s1.Width = 16; + s1.Height = 16; + for (int index = 0; index < num12; ++index) + { + int num16 = 15; + while (num16 >= 0) + { + Color color = this.lighting.GetColor(num14 + 8 + this.screenPosition.X >> 4, this.screenPosition.Y + num13 >> 4); + color.R = (byte) ((double) color.R * (double) num8); + color.G = (byte) ((double) color.G * (double) num9); + color.B = (byte) ((double) color.B * (double) num10); + s1.X += 16; + SpriteSheet<_sheetTiles>.Draw(1, ref pos1, ref s1, color); + --num16; + num14 += 16; + } + } + bool flag1 = false; + if (Main.worldSurfacePixels <= this.screenPosition.Y + 540 + 32) + { + int num16 = (Main.worldSurface << 4) - this.screenPosition.Y + 16; + int num17 = (int) (-Math.IEEERemainder((double) this.screenPosition.X * 0.899999976158142, 96.0) - 48.0) - 32; + int num18 = ((int) this.viewWidth + 64) / 96 + 2; + int num19; + int num20; + if (Main.worldSurfacePixels < this.screenPosition.Y - 16) + { + num19 = num16 % 96 - 96; + num20 = (540 - num19 + 96) / 96 + 1; + } + else + { + num19 = num16; + num20 = (540 - num16 + 96) / 96 + 1; + } + if (Main.rockLayerPixels < this.screenPosition.Y + 540) + { + num20 = (Main.rockLayerPixels - this.screenPosition.Y + 540 - num19) / 96; + flag1 = true; + } + int num21 = -(num17 + this.screenPosition.X & 15); + if (num21 == -8) + num21 = 8; + Vector2 pos2 = new Vector2(); + Rectangle s2 = new Rectangle(); + s2.Width = 16; + s2.Height = 16; + int num22 = 0; + int num23 = num17 + 8 + this.screenPosition.X; + for (; num22 < num18; ++num22) + { + int index1 = num19 + 8 + this.screenPosition.Y >> 4; + int num24 = 32 + num19; + for (int index2 = 0; index2 < num20; ++index2) + { + int num25 = 0; + while (num25 < 96) + { + int num26 = 32 + num17 + 96 * num22 + num25 + num21; + s2.X = num25 + num21 + 16; + int x = num23 + num25 >> 4; + fixed (Tile* tilePtr1 = &Main.tile[x, index1]) + { + Tile* tilePtr2 = tilePtr1; + int num27 = 0; + while (num27 < 96) + { + Color colorUnsafe = this.lighting.GetColorUnsafe(x, index1); + pos2.X = (float) num26; + pos2.Y = (float) (num24 + num27); + s2.Y = num27; + if ((int) colorUnsafe.R > 0 || (int) colorUnsafe.G > 0 || (int) colorUnsafe.B > 0) + { + if (this.SMOOTH_LIGHT && ((int) colorUnsafe.R > 226 || (double) colorUnsafe.G > 248.600006103516 || (double) colorUnsafe.B > 271.200012207031) && ((int) tilePtr2->active == 0 && ((int) tilePtr2->wall == 0 || (int) tilePtr2->wall == 21))) + { + s2.Width = 4; + s2.Height = 4; + Color c; + if ((int) tilePtr2[-1441].active == 0) + { + c = this.lighting.GetColorUnsafe(x - 1, index1 - 1); + c.R = (byte) ((double) ((int) colorUnsafe.R + (int) c.R >> 1) * (double) num8); + c.G = (byte) ((double) ((int) colorUnsafe.G + (int) c.G >> 1) * (double) num9); + c.B = (byte) ((double) ((int) colorUnsafe.B + (int) c.B >> 1) * (double) num10); + } + else + c = colorUnsafe; + SpriteSheet<_sheetTiles>.Draw(2, ref pos2, ref s2, c); + s2.Height = 8; + s2.Y += 4; + pos2.Y += 4f; + if ((int) tilePtr2[-1440].active == 0) + { + c = this.lighting.GetColorUnsafe(x - 1, index1); + c.R = (byte) ((double) ((int) colorUnsafe.R + (int) c.R >> 1) * (double) num8); + c.G = (byte) ((double) ((int) colorUnsafe.G + (int) c.G >> 1) * (double) num9); + c.B = (byte) ((double) ((int) colorUnsafe.B + (int) c.B >> 1) * (double) num10); + } + else + c = colorUnsafe; + SpriteSheet<_sheetTiles>.Draw(2, ref pos2, ref s2, c); + s2.Height = 4; + s2.Y += 8; + pos2.Y += 8f; + if ((int) tilePtr2[-1439].active == 0) + { + c = this.lighting.GetColorUnsafe(x - 1, index1 + 1); + c.R = (byte) ((double) ((int) colorUnsafe.R + (int) c.R >> 1) * (double) num8); + c.G = (byte) ((double) ((int) colorUnsafe.G + (int) c.G >> 1) * (double) num9); + c.B = (byte) ((double) ((int) colorUnsafe.B + (int) c.B >> 1) * (double) num10); + } + else + c = colorUnsafe; + SpriteSheet<_sheetTiles>.Draw(2, ref pos2, ref s2, c); + s2.Width = 8; + s2.X += 4; + pos2.X += 4f; + if ((int) tilePtr2[1].active == 0) + { + c = this.lighting.GetColorUnsafe(x, index1 + 1); + c.R = (byte) ((double) ((int) colorUnsafe.R + (int) c.R >> 1) * (double) num8); + c.G = (byte) ((double) ((int) colorUnsafe.G + (int) c.G >> 1) * (double) num9); + c.B = (byte) ((double) ((int) colorUnsafe.B + (int) c.B >> 1) * (double) num10); + } + else + c = colorUnsafe; + SpriteSheet<_sheetTiles>.Draw(2, ref pos2, ref s2, c); + s2.Height = 8; + s2.Y -= 8; + pos2.Y -= 8f; + c.R = (byte) ((double) colorUnsafe.R * (double) num8); + c.G = (byte) ((double) colorUnsafe.G * (double) num9); + c.B = (byte) ((double) colorUnsafe.B * (double) num10); + SpriteSheet<_sheetTiles>.Draw(2, ref pos2, ref s2, c); + s2.Height = 4; + s2.Y -= 4; + pos2.Y -= 4f; + if ((int) tilePtr2[-1].active == 0) + { + c = this.lighting.GetColorUnsafe(x, index1 - 1); + c.R = (byte) ((double) ((int) colorUnsafe.R + (int) c.R >> 1) * (double) num8); + c.G = (byte) ((double) ((int) colorUnsafe.G + (int) c.G >> 1) * (double) num9); + c.B = (byte) ((double) ((int) colorUnsafe.B + (int) c.B >> 1) * (double) num10); + } + else + c = colorUnsafe; + SpriteSheet<_sheetTiles>.Draw(2, ref pos2, ref s2, c); + s2.Width = 4; + s2.X += 8; + pos2.X += 8f; + if ((int) tilePtr2[1439].active == 0) + { + c = this.lighting.GetColorUnsafe(x + 1, index1 - 1); + c.R = (byte) ((double) ((int) colorUnsafe.R + (int) c.R >> 1) * (double) num8); + c.G = (byte) ((double) ((int) colorUnsafe.G + (int) c.G >> 1) * (double) num9); + c.B = (byte) ((double) ((int) colorUnsafe.B + (int) c.B >> 1) * (double) num10); + } + else + c = colorUnsafe; + SpriteSheet<_sheetTiles>.Draw(2, ref pos2, ref s2, c); + s2.Height = 8; + s2.Y += 4; + pos2.Y += 4f; + if ((int) tilePtr2[1440].active == 0) + { + c = this.lighting.GetColorUnsafe(x + 1, index1); + c.R = (byte) ((double) ((int) colorUnsafe.R + (int) c.R >> 1) * (double) num8); + c.G = (byte) ((double) ((int) colorUnsafe.G + (int) c.G >> 1) * (double) num9); + c.B = (byte) ((double) ((int) colorUnsafe.B + (int) c.B >> 1) * (double) num10); + } + else + c = colorUnsafe; + SpriteSheet<_sheetTiles>.Draw(2, ref pos2, ref s2, c); + s2.Height = 4; + s2.Y += 8; + pos2.Y += 8f; + if ((int) tilePtr2[1441].active == 0) + { + c = this.lighting.GetColorUnsafe(x + 1, index1 + 1); + c.R = (byte) ((double) ((int) colorUnsafe.R + (int) c.R >> 1) * (double) num8); + c.G = (byte) ((double) ((int) colorUnsafe.G + (int) c.G >> 1) * (double) num9); + c.B = (byte) ((double) ((int) colorUnsafe.B + (int) c.B >> 1) * (double) num10); + } + else + c = colorUnsafe; + SpriteSheet<_sheetTiles>.Draw(2, ref pos2, ref s2, c); + s2.Width = s2.Height = 16; + s2.X -= 12; + } + else if (this.SMOOTH_LIGHT && ((int) colorUnsafe.R > 160 || (double) colorUnsafe.G > 176.0 || (double) colorUnsafe.B > 192.0)) + { + s2.Width = 8; + s2.Height = 8; + Color c = !this.lighting.Brighter(x, index1 - 1, x - 1, index1) ? this.lighting.GetColorUnsafe(x, index1 - 1) : this.lighting.GetColorUnsafe(x - 1, index1); + c.R = (byte) ((double) ((int) colorUnsafe.R + (int) c.R >> 1) * (double) num8); + c.G = (byte) ((double) ((int) colorUnsafe.G + (int) c.G >> 1) * (double) num9); + c.B = (byte) ((double) ((int) colorUnsafe.B + (int) c.B >> 1) * (double) num10); + SpriteSheet<_sheetTiles>.Draw(2, ref pos2, ref s2, c); + s2.Y += 8; + pos2.Y += 8f; + c = !this.lighting.Brighter(x, index1 + 1, x - 1, index1) ? this.lighting.GetColorUnsafe(x, index1 + 1) : this.lighting.GetColorUnsafe(x - 1, index1); + c.R = (byte) ((double) ((int) colorUnsafe.R + (int) c.R >> 1) * (double) num8); + c.G = (byte) ((double) ((int) colorUnsafe.G + (int) c.G >> 1) * (double) num9); + c.B = (byte) ((double) ((int) colorUnsafe.B + (int) c.B >> 1) * (double) num10); + SpriteSheet<_sheetTiles>.Draw(2, ref pos2, ref s2, c); + s2.X += 8; + pos2.X += 8f; + c = !this.lighting.Brighter(x, index1 + 1, x + 1, index1) ? this.lighting.GetColorUnsafe(x, index1 + 1) : this.lighting.GetColorUnsafe(x + 1, index1); + c.R = (byte) ((double) ((int) colorUnsafe.R + (int) c.R >> 1) * (double) num8); + c.G = (byte) ((double) ((int) colorUnsafe.G + (int) c.G >> 1) * (double) num9); + c.B = (byte) ((double) ((int) colorUnsafe.B + (int) c.B >> 1) * (double) num10); + SpriteSheet<_sheetTiles>.Draw(2, ref pos2, ref s2, c); + s2.Y -= 8; + pos2.Y -= 8f; + c = !this.lighting.Brighter(x, index1 - 1, x + 1, index1) ? this.lighting.GetColorUnsafe(x, index1 - 1) : this.lighting.GetColorUnsafe(x + 1, index1); + c.R = (byte) ((double) ((int) colorUnsafe.R + (int) c.R >> 1) * (double) num8); + c.G = (byte) ((double) ((int) colorUnsafe.G + (int) c.G >> 1) * (double) num9); + c.B = (byte) ((double) ((int) colorUnsafe.B + (int) c.B >> 1) * (double) num10); + SpriteSheet<_sheetTiles>.Draw(2, ref pos2, ref s2, c); + s2.Width = s2.Height = 16; + s2.X -= 8; + } + else + { + colorUnsafe.R = (byte) ((double) colorUnsafe.R * (double) num8); + colorUnsafe.G = (byte) ((double) colorUnsafe.G * (double) num9); + colorUnsafe.B = (byte) ((double) colorUnsafe.B * (double) num10); + SpriteSheet<_sheetTiles>.Draw(2, ref pos2, ref s2, colorUnsafe); + } + } + else + SpriteSheet<_sheetTiles>.Draw(2, ref pos2, ref s2, colorUnsafe); + ++index1; + ++tilePtr2; + num27 += 16; + } + index1 -= 6; + } + num25 += 16; + } + num24 += 96; + index1 += 6; + } + num23 += 96; + } + if (flag1) + { + int num24 = (int) (-Math.IEEERemainder((double) this.screenPosition.X * 0.899999976158142, 96.0) - 48.0); + int num25 = ((int) this.viewWidth + 64) / 96 + 2; + int num26 = num19 + num20 * 96; + if (num26 > -32) + { + Vector2 vector2 = new Vector2((float) (32 + num24 + num21), (float) (32 + num26)); + int num27 = num24 + 8; + for (int index = 0; index < num25; ++index) + { + int num28 = 0; + while (num28 < 96) + { + Color color = this.lighting.GetColor(num27 + this.screenPosition.X >> 4, this.screenPosition.Y + num26 >> 4); + num27 += 16; + color.R = (byte) ((double) color.R * (double) num8); + color.G = (byte) ((double) color.G * (double) num9); + color.B = (byte) ((double) color.B * (double) num10); + Main.spriteBatch.Draw(WorldView.backgroundTexture[4], vector2, new Rectangle?(new Rectangle(num28 + num21 + 16, 0, 16, 16)), color); + vector2.X += 16f; + num28 += 16; + } + } + } + } + } + bool flag2 = false; + int num29 = Main.magmaLayerPixels; + if (Main.rockLayerPixels <= this.screenPosition.Y + 540) + { + int num16 = Main.rockLayerPixels - this.screenPosition.Y + 540 - 28; + int num17 = (int) (-Math.IEEERemainder(96.0 + (double) this.screenPosition.X * 0.899999976158142, 96.0) - 48.0) - 32; + int num18 = ((int) this.viewWidth + 64) / 96 + 2; + int num19; + int num20; + if (Main.rockLayerPixels + 540 < this.screenPosition.Y - 16) + { + num19 = (int) (Math.IEEERemainder((double) num16, 96.0) - 96.0); + num20 = (540 - num19 + 96) / 96 + 1; + } + else + { + num19 = num16; + num20 = (540 - num16 + 96) / 96 + 1; + } + if (num29 < this.screenPosition.Y + 540) + { + num20 = (num29 - this.screenPosition.Y + 540 - num19) / 96; + flag2 = true; + } + int num21 = -(num17 + this.screenPosition.X & 15); + if (num21 == -8) + num21 = 8; + for (int index1 = 0; index1 < num18; ++index1) + { + for (int index2 = 0; index2 < num20; ++index2) + { + int num22 = 0; + while (num22 < 96) + { + int x = num17 + 96 * index1 + num22 + 8 + this.screenPosition.X >> 4; + int y = 0; + while (y < 96) + { + int index3 = num19 + index2 * 96 + y + 8 + this.screenPosition.Y >> 4; + Color colorUnsafe = this.lighting.GetColorUnsafe(x, index3); + bool flag3 = false; + switch (Main.tile[x, index3].wall) + { + case (byte) 0: + case (byte) 21: + flag3 = true; + break; + default: + if ((int) Main.tile[x - 1, index3].wall == 0 || (int) Main.tile[x - 1, index3].wall == 21 || ((int) Main.tile[x + 1, index3].wall == 0 || (int) Main.tile[x + 1, index3].wall == 21)) + goto case 0; + else + break; + } + if ((flag3 || (int) colorUnsafe.R == 0 || ((int) colorUnsafe.G == 0 || (int) colorUnsafe.B == 0)) && ((int) colorUnsafe.R > 0 || (int) colorUnsafe.G > 0 || (int) colorUnsafe.B > 0)) + { + if (this.SMOOTH_LIGHT && (int) colorUnsafe.R < 230 && ((int) colorUnsafe.G < 230 && (int) colorUnsafe.B < 230)) + { + if (((int) colorUnsafe.R > 226 || (double) colorUnsafe.G > 248.6 || (double) colorUnsafe.B > 271.2) && (int) Main.tile[x, index3].active == 0) + { + for (int index4 = 0; index4 < 9; ++index4) + { + int num23 = 0; + int num24 = 0; + int width = 4; + int height = 4; + Color color1 = colorUnsafe; + Color color2 = colorUnsafe; + if (index4 == 0) + { + if ((int) Main.tile[x - 1, index3 - 1].active == 0) + color2 = this.lighting.GetColorUnsafe(x - 1, index3 - 1); + } + else if (index4 == 1) + { + width = 8; + num23 = 4; + if ((int) Main.tile[x, index3 - 1].active == 0) + color2 = this.lighting.GetColorUnsafe(x, index3 - 1); + } + else if (index4 == 2) + { + if ((int) Main.tile[x + 1, index3 - 1].active == 0) + color2 = this.lighting.GetColorUnsafe(x + 1, index3 - 1); + num23 = 12; + } + else if (index4 == 3) + { + if ((int) Main.tile[x - 1, index3].active == 0) + color2 = this.lighting.GetColorUnsafe(x - 1, index3); + height = 8; + num24 = 4; + } + else if (index4 == 4) + { + width = 8; + height = 8; + num23 = 4; + num24 = 4; + } + else if (index4 == 5) + { + num23 = 12; + num24 = 4; + height = 8; + if ((int) Main.tile[x + 1, index3].active == 0) + color2 = this.lighting.GetColorUnsafe(x + 1, index3); + } + else if (index4 == 6) + { + if ((int) Main.tile[x - 1, index3 + 1].active == 0) + color2 = this.lighting.GetColorUnsafe(x - 1, index3 + 1); + num24 = 12; + } + else if (index4 == 7) + { + width = 8; + height = 4; + num23 = 4; + num24 = 12; + if ((int) Main.tile[x, index3 + 1].active == 0) + color2 = this.lighting.GetColorUnsafe(x, index3 + 1); + } + else + { + if ((int) Main.tile[x + 1, index3 + 1].active == 0) + color2 = this.lighting.GetColorUnsafe(x + 1, index3 + 1); + num23 = 12; + num24 = 12; + } + color1.R = (byte) ((double) ((int) colorUnsafe.R + (int) color2.R >> 1) * (double) num8); + color1.G = (byte) ((double) ((int) colorUnsafe.G + (int) color2.G >> 1) * (double) num9); + color1.B = (byte) ((double) ((int) colorUnsafe.B + (int) color2.B >> 1) * (double) num10); + Main.spriteBatch.Draw(WorldView.backgroundTexture[3], new Vector2((float) (32 + num17 + 96 * index1 + num22 + num23 + num21), (float) (32 + num19 + 96 * index2 + y + num24)), new Rectangle?(new Rectangle(num22 + num23 + num21 + 16, y + num24, width, height)), color1); + } + } + else if ((int) colorUnsafe.R > 160 || (double) colorUnsafe.G > 176.0 || (double) colorUnsafe.B > 192.0) + { + for (int index4 = 0; index4 < 4; ++index4) + { + int num23 = 0; + int num24 = 0; + Color color1 = colorUnsafe; + Color color2 = colorUnsafe; + if (index4 == 0) + color2 = !this.lighting.Brighter(x, index3 - 1, x - 1, index3) ? this.lighting.GetColorUnsafe(x, index3 - 1) : this.lighting.GetColorUnsafe(x - 1, index3); + else if (index4 == 1) + { + color2 = !this.lighting.Brighter(x, index3 - 1, x + 1, index3) ? this.lighting.GetColorUnsafe(x, index3 - 1) : this.lighting.GetColorUnsafe(x + 1, index3); + num23 = 8; + } + else if (index4 == 2) + { + color2 = !this.lighting.Brighter(x, index3 + 1, x - 1, index3) ? this.lighting.GetColorUnsafe(x, index3 + 1) : this.lighting.GetColorUnsafe(x - 1, index3); + num24 = 8; + } + else + { + color2 = !this.lighting.Brighter(x, index3 + 1, x + 1, index3) ? this.lighting.GetColorUnsafe(x, index3 + 1) : this.lighting.GetColorUnsafe(x + 1, index3); + num23 = 8; + num24 = 8; + } + color1.R = (byte) ((double) ((int) colorUnsafe.R + (int) color2.R >> 1) * (double) num8); + color1.G = (byte) ((double) ((int) colorUnsafe.G + (int) color2.G >> 1) * (double) num9); + color1.B = (byte) ((double) ((int) colorUnsafe.B + (int) color2.B >> 1) * (double) num10); + Main.spriteBatch.Draw(WorldView.backgroundTexture[3], new Vector2((float) (32 + num17 + 96 * index1 + num22 + num23 + num21), (float) (32 + num19 + 96 * index2 + y + num24)), new Rectangle?(new Rectangle(num22 + num23 + num21 + 16, y + num24, 8, 8)), color1); + } + } + else + { + colorUnsafe.R = (byte) ((double) colorUnsafe.R * (double) num8); + colorUnsafe.G = (byte) ((double) colorUnsafe.G * (double) num9); + colorUnsafe.B = (byte) ((double) colorUnsafe.B * (double) num10); + Main.spriteBatch.Draw(WorldView.backgroundTexture[3], new Vector2((float) (32 + num17 + 96 * index1 + num22 + num21), (float) (32 + num19 + 96 * index2 + y)), new Rectangle?(new Rectangle(num22 + num21 + 16, y, 16, 16)), colorUnsafe); + } + } + else + { + colorUnsafe.R = (byte) ((double) colorUnsafe.R * (double) num8); + colorUnsafe.G = (byte) ((double) colorUnsafe.G * (double) num9); + colorUnsafe.B = (byte) ((double) colorUnsafe.B * (double) num10); + Main.spriteBatch.Draw(WorldView.backgroundTexture[3], new Vector2((float) (32 + num17 + 96 * index1 + num22 + num21), (float) (32 + num19 + 96 * index2 + y)), new Rectangle?(new Rectangle(num22 + num21 + 16, y, 16, 16)), colorUnsafe); + } + } + y += 16; + } + num22 += 16; + } + } + } + if (flag2) + { + int num22 = (int) (-Math.IEEERemainder((double) this.screenPosition.X * 0.899999976158142, 96.0) - 48.0); + int num23 = (int) this.viewWidth / 96 + 2; + int num24 = num19 + num20 * 96; + Rectangle rectangle = new Rectangle(0, Main.magmaBGFrame << 4, 16, 16); + int num25 = num22 + 8; + for (int index = 0; index < num23; ++index) + { + int num26 = 0; + while (num26 < 96) + { + rectangle.X = num26 + num21 + 16; + Color color = this.lighting.GetColor(num25 + this.screenPosition.X >> 4, this.screenPosition.Y + num24 >> 4); + color.R = (byte) ((double) color.R * (double) num8); + color.G = (byte) ((double) color.G * (double) num9); + color.B = (byte) ((double) color.B * (double) num10); + Main.spriteBatch.Draw(WorldView.backgroundTexture[6], new Vector2((float) (32 + num22 + 96 * index + num26 + num21), (float) (32 + num24)), new Rectangle?(rectangle), color); + num25 += 16; + num26 += 16; + } + } + } + } + if (num29 <= this.screenPosition.Y + 540) + { + int num16 = num29 - this.screenPosition.Y + 540 - 28; + int num17 = (int) (-Math.IEEERemainder(96.0 + (double) this.screenPosition.X * 0.899999976158142, 96.0) - 48.0) - 32; + int num18 = ((int) this.viewWidth + 64) / 96 + 2; + int num19; + int num20; + if (num29 + 540 < this.screenPosition.Y - 16) + { + num19 = (int) (Math.IEEERemainder((double) num16, 96.0) - 96.0); + num20 = (540 - num19 + 96) / 96 + 1; + } + else + { + num19 = num16; + num20 = (540 - num16 + 96) / 96 + 1; + } + int num21 = (int) (float) Math.Round((double) -(float) Math.IEEERemainder((double) (num17 + this.screenPosition.X), 16.0)); + if (num21 == -8) + num21 = 8; + for (int index1 = 0; index1 < num18; ++index1) + { + for (int index2 = 0; index2 < num20; ++index2) + { + int num22 = 0; + while (num22 < 96) + { + int x = num17 + 96 * index1 + num22 + 8 + this.screenPosition.X >> 4; + int index3 = num19 + index2 * 96 + 8 + this.screenPosition.Y >> 4; + int num23 = 0; + while (num23 < 96) + { + Color colorUnsafe = this.lighting.GetColorUnsafe(x, index3); + bool flag3 = false; + switch (Main.tile[x, index3].wall) + { + case (byte) 0: + case (byte) 21: + flag3 = true; + break; + default: + if ((int) Main.tile[x - 1, index3].wall == 0 || (int) Main.tile[x - 1, index3].wall == 21 || ((int) Main.tile[x + 1, index3].wall == 0 || (int) Main.tile[x + 1, index3].wall == 21)) + goto case 0; + else + break; + } + if ((flag3 || (int) colorUnsafe.R == 0 || ((int) colorUnsafe.G == 0 || (int) colorUnsafe.B == 0)) && ((int) colorUnsafe.R > 0 || (int) colorUnsafe.G > 0 || (int) colorUnsafe.B > 0)) + { + if (this.SMOOTH_LIGHT && (int) colorUnsafe.R < 230 && ((int) colorUnsafe.G < 230 && (int) colorUnsafe.B < 230)) + { + if (((int) colorUnsafe.R > 339 || (double) colorUnsafe.G > 372.899993896484 || (double) colorUnsafe.B > 406.800018310547) && (int) Main.tile[x, index3].active == 0) + { + for (int index4 = 0; index4 < 9; ++index4) + { + int num24 = 0; + int num25 = 0; + int width = 4; + int height = 4; + Color color1 = colorUnsafe; + Color color2 = colorUnsafe; + if (index4 == 0) + { + if ((int) Main.tile[x - 1, index3 - 1].active == 0) + color2 = this.lighting.GetColorUnsafe(x - 1, index3 - 1); + } + else if (index4 == 1) + { + width = 8; + num24 = 4; + if ((int) Main.tile[x, index3 - 1].active == 0) + color2 = this.lighting.GetColorUnsafe(x, index3 - 1); + } + else if (index4 == 2) + { + if ((int) Main.tile[x + 1, index3 - 1].active == 0) + color2 = this.lighting.GetColorUnsafe(x + 1, index3 - 1); + num24 = 12; + } + else if (index4 == 3) + { + if ((int) Main.tile[x - 1, index3].active == 0) + color2 = this.lighting.GetColorUnsafe(x - 1, index3); + height = 8; + num25 = 4; + } + else if (index4 == 4) + { + width = 8; + height = 8; + num24 = 4; + num25 = 4; + } + else if (index4 == 5) + { + num24 = 12; + num25 = 4; + height = 8; + if ((int) Main.tile[x + 1, index3].active == 0) + color2 = this.lighting.GetColorUnsafe(x + 1, index3); + } + else if (index4 == 6) + { + if ((int) Main.tile[x - 1, index3 + 1].active == 0) + color2 = this.lighting.GetColorUnsafe(x - 1, index3 + 1); + num25 = 12; + } + else if (index4 == 7) + { + width = 8; + height = 4; + num24 = 4; + num25 = 12; + if ((int) Main.tile[x, index3 + 1].active == 0) + color2 = this.lighting.GetColorUnsafe(x, index3 + 1); + } + else + { + if ((int) Main.tile[x + 1, index3 + 1].active == 0) + color2 = this.lighting.GetColorUnsafe(x + 1, index3 + 1); + num24 = 12; + num25 = 12; + } + color1.R = (byte) ((double) ((int) colorUnsafe.R + (int) color2.R >> 1) * (double) num8); + color1.G = (byte) ((double) ((int) colorUnsafe.G + (int) color2.G >> 1) * (double) num9); + color1.B = (byte) ((double) ((int) colorUnsafe.B + (int) color2.B >> 1) * (double) num10); + Main.spriteBatch.Draw(WorldView.backgroundTexture[5], new Vector2((float) (32 + num17 + 96 * index1 + num22 + num24 + num21), (float) (32 + num19 + 96 * index2 + num23 + num25)), new Rectangle?(new Rectangle(num22 + num24 + num21 + 16, num23 + 96 * Main.magmaBGFrame + num25, width, height)), color1); + } + } + else if ((int) colorUnsafe.R > 240 || (double) colorUnsafe.G > 264.0 || (double) colorUnsafe.B > 288.0) + { + for (int index4 = 0; index4 < 4; ++index4) + { + int num24 = 0; + int num25 = 0; + Color color1 = colorUnsafe; + Color color2 = colorUnsafe; + if (index4 == 0) + color2 = !this.lighting.Brighter(x, index3 - 1, x - 1, index3) ? this.lighting.GetColorUnsafe(x, index3 - 1) : this.lighting.GetColorUnsafe(x - 1, index3); + else if (index4 == 1) + { + color2 = !this.lighting.Brighter(x, index3 - 1, x + 1, index3) ? this.lighting.GetColorUnsafe(x, index3 - 1) : this.lighting.GetColorUnsafe(x + 1, index3); + num24 = 8; + } + else if (index4 == 2) + { + color2 = !this.lighting.Brighter(x, index3 + 1, x - 1, index3) ? this.lighting.GetColorUnsafe(x, index3 + 1) : this.lighting.GetColorUnsafe(x - 1, index3); + num25 = 8; + } + else + { + color2 = !this.lighting.Brighter(x, index3 + 1, x + 1, index3) ? this.lighting.GetColorUnsafe(x, index3 + 1) : this.lighting.GetColorUnsafe(x + 1, index3); + num24 = 8; + num25 = 8; + } + color1.R = (byte) ((double) ((int) colorUnsafe.R + (int) color2.R >> 1) * (double) num8); + color1.G = (byte) ((double) ((int) colorUnsafe.G + (int) color2.G >> 1) * (double) num9); + color1.B = (byte) ((double) ((int) colorUnsafe.B + (int) color2.B >> 1) * (double) num10); + Main.spriteBatch.Draw(WorldView.backgroundTexture[5], new Vector2((float) (32 + num17 + 96 * index1 + num22 + num24 + num21), (float) (32 + num19 + 96 * index2 + num23 + num25)), new Rectangle?(new Rectangle(num22 + num24 + num21 + 16, num23 + 96 * Main.magmaBGFrame + num25, 8, 8)), color1); + } + } + else + { + colorUnsafe.R = (byte) ((double) colorUnsafe.R * (double) num8); + colorUnsafe.G = (byte) ((double) colorUnsafe.G * (double) num9); + colorUnsafe.B = (byte) ((double) colorUnsafe.B * (double) num10); + Main.spriteBatch.Draw(WorldView.backgroundTexture[5], new Vector2((float) (32 + num17 + 96 * index1 + num22 + num21), (float) (32 + num19 + 96 * index2 + num23)), new Rectangle?(new Rectangle(num22 + num21 + 16, num23 + 96 * Main.magmaBGFrame, 16, 16)), colorUnsafe); + } + } + else + { + colorUnsafe.R = (byte) ((double) colorUnsafe.R * (double) num8); + colorUnsafe.G = (byte) ((double) colorUnsafe.G * (double) num9); + colorUnsafe.B = (byte) ((double) colorUnsafe.B * (double) num10); + Main.spriteBatch.Draw(WorldView.backgroundTexture[5], new Vector2((float) (32 + num17 + 96 * index1 + num22 + num21), (float) (32 + num19 + 96 * index2 + num23)), new Rectangle?(new Rectangle(num22 + num21 + 16, num23 + 96 * Main.magmaBGFrame, 16, 16)), colorUnsafe); + } + } + ++index3; + num23 += 16; + } + num22 += 16; + } + } + } + } + this.lighting.brightness = this.player.blind ? 1f : this.lighting.defBrightness; + } + + private void RenderBlack() + { + WorldView.graphicsDevice.SetRenderTarget(this.blackTarget); + WorldView.graphicsDevice.Clear(new Color()); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, (BlendState) null, (SamplerState) null, (DepthStencilState) null, (RasterizerState) null, (Effect) this.renderTargetProjection); + this.DrawBlack(); + Main.spriteBatch.End(); + this.sceneBlackPos.X = this.screenPosition.X - 32; + this.sceneBlackPos.Y = this.screenPosition.Y - 32; + } + + private void RenderWalls() + { + WorldView.graphicsDevice.SetRenderTarget(this.wallTarget); + WorldView.graphicsDevice.Clear(new Color()); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, (BlendState) null, (SamplerState) null, (DepthStencilState) null, (RasterizerState) null, (Effect) this.renderTargetProjection); + this.DrawWalls(); + Main.spriteBatch.End(); + this.sceneWallPos.X = this.screenPosition.X - 32; + this.sceneWallPos.Y = this.screenPosition.Y - 32; + } + + private void RenderBackWater() + { + WorldView.graphicsDevice.SetRenderTarget(this.backWaterTarget); + WorldView.graphicsDevice.Clear(new Color()); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, (BlendState) null, (SamplerState) null, (DepthStencilState) null, (RasterizerState) null, (Effect) this.renderTargetProjection); + this.DrawWater(true); + Main.spriteBatch.End(); + } + + private void RenderBackground() + { + WorldView.graphicsDevice.SetRenderTarget(this.backgroundTarget); + WorldView.graphicsDevice.Clear(new Color()); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, (BlendState) null, (SamplerState) null, (DepthStencilState) null, (RasterizerState) null, (Effect) this.renderTargetProjection); + this.DrawBackground(); + Main.spriteBatch.End(); + this.sceneBackgroundPos.X = this.screenPosition.X - 32; + this.sceneBackgroundPos.Y = this.screenPosition.Y - 32; + } + + private void RenderSolidTiles() + { + WorldView.graphicsDevice.SetRenderTarget(this.tileSolidTarget); + WorldView.graphicsDevice.Clear(new Color()); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Opaque, (SamplerState) null, (DepthStencilState) null, (RasterizerState) null, (Effect) this.renderTargetProjection); + this.DrawSolidTiles(); + Main.spriteBatch.End(); + this.sceneTilePos.X = this.screenPosition.X - 32; + this.sceneTilePos.Y = this.screenPosition.Y - 32; + } + + private void RenderNonSolidTiles() + { + WorldView.graphicsDevice.SetRenderTarget(this.tileNonSolidTarget); + WorldView.graphicsDevice.Clear(new Color()); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, (BlendState) null, (SamplerState) null, (DepthStencilState) null, (RasterizerState) null, (Effect) this.renderTargetProjection); + this.DrawNonSolidTiles(); + Main.spriteBatch.End(); + this.sceneTile2Pos.X = this.screenPosition.X - 32; + this.sceneTile2Pos.Y = this.screenPosition.Y - 32; + } + + private void RenderWater() + { + WorldView.graphicsDevice.SetRenderTarget(this.waterTarget); + WorldView.graphicsDevice.Clear(new Color()); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, (BlendState) null, (SamplerState) null, (DepthStencilState) null, (RasterizerState) null, (Effect) this.renderTargetProjection); + this.DrawWater(false); + if (this.player.inventory[(int) this.player.selectedItem].mech) + this.DrawWires(); + Main.spriteBatch.End(); + this.sceneWaterPos.X = this.screenPosition.X - 32; + this.sceneWaterPos.Y = this.screenPosition.Y - 32; + } + + public static void shine(ref Color newColor, int type) + { + int num1; + int num2; + int num3; + if (type == 25) + { + num1 = (int) newColor.R * 243 >> 8; + num2 = (int) newColor.G * 217 >> 8; + num3 = (int) newColor.B * 281 >> 8; + } + else if (type == 117) + { + num1 = (int) newColor.R * 281 >> 8; + num2 = (int) newColor.G; + num3 = (int) newColor.B * 307 >> 8; + if (num1 > (int) byte.MaxValue) + num1 = (int) byte.MaxValue; + } + else + { + num1 = (int) newColor.R * 409 >> 8; + num2 = (int) newColor.G * 409 >> 8; + num3 = (int) newColor.B * 409 >> 8; + if (num1 > (int) byte.MaxValue) + num1 = (int) byte.MaxValue; + if (num2 > (int) byte.MaxValue) + num2 = (int) byte.MaxValue; + } + if (num3 > (int) byte.MaxValue) + num3 = (int) byte.MaxValue; + newColor.R = (byte) num1; + newColor.G = (byte) num2; + newColor.B = (byte) num3; + } + + private unsafe void Highlight2x1(Tile* pTile, Tile.Flags mask) + { + pTile->flags |= mask; + if ((int) pTile->frameX == 0) + pTile += 1440; + else + pTile -= 1440; + pTile->flags |= mask; + } + + private unsafe void Highlight2x2(Tile* pTile, Tile.Flags mask) + { + int num = (int) pTile->frameY == 0 ? 1 : -1; + pTile->flags |= mask; + pTile += num; + pTile->flags |= mask; + if (((int) pTile->frameX / 18 & 1) == 0) + pTile += 1440; + else + pTile -= 1440; + pTile->flags |= mask; + pTile -= num; + pTile->flags |= mask; + } + + private unsafe void Highlight1x3(Tile* pTile, Tile.Flags mask) + { + pTile->flags |= mask; + if ((int) pTile->frameY == 0) + { + ++pTile; + pTile->flags |= mask; + ++pTile; + } + else if ((int) pTile->frameY == 18) + { + ++pTile; + pTile->flags |= mask; + pTile -= 2; + } + else + { + --pTile; + pTile->flags |= mask; + --pTile; + } + pTile->flags |= mask; + } + + private unsafe void Highlight2x3(Tile* pTile, Tile.Flags mask) + { + pTile->flags |= mask; + if ((int) pTile->frameY == 0) + { + ++pTile; + pTile->flags |= mask; + ++pTile; + pTile->flags |= mask; + if (((int) pTile->frameX / 18 & 1) == 0) + { + pTile += 1438; + pTile->flags |= mask; + ++pTile; + pTile->flags |= mask; + ++pTile; + } + else + { + pTile -= 1440; + pTile->flags |= mask; + --pTile; + pTile->flags |= mask; + --pTile; + } + } + else if ((int) pTile->frameY == 18) + { + ++pTile; + pTile->flags |= mask; + pTile -= 2; + pTile->flags |= mask; + if (((int) pTile->frameX / 18 & 1) == 0) + { + pTile += 1440; + pTile->flags |= mask; + ++pTile; + pTile->flags |= mask; + ++pTile; + } + else + { + pTile -= 1440; + pTile->flags |= mask; + ++pTile; + pTile->flags |= mask; + ++pTile; + } + } + else + { + --pTile; + pTile->flags |= mask; + --pTile; + pTile->flags |= mask; + if (((int) pTile->frameX / 18 & 1) == 0) + { + pTile += 1440; + pTile->flags |= mask; + ++pTile; + pTile->flags |= mask; + ++pTile; + } + else + { + pTile -= 1440; + pTile->flags |= mask; + ++pTile; + pTile->flags |= mask; + ++pTile; + } + } + pTile->flags |= mask; + } + + private unsafe void Highlight4x2(Tile* pTile, Tile.Flags mask) + { + int num = (int) pTile->frameY == 0 ? 1 : -1; + pTile->flags |= mask; + pTile += num; + pTile->flags |= mask; + switch ((int) pTile->frameX / 18 & 3) + { + case 0: + pTile += 1440; + pTile->flags |= mask; + pTile -= num; + pTile->flags |= mask; + pTile += 1440; + pTile->flags |= mask; + pTile += num; + pTile->flags |= mask; + pTile += 1440; + break; + case 1: + pTile -= 1440; + pTile->flags |= mask; + pTile -= num; + pTile->flags |= mask; + pTile += 2880; + pTile->flags |= mask; + pTile += num; + pTile->flags |= mask; + pTile += 1440; + break; + case 2: + pTile += 1440; + pTile->flags |= mask; + pTile -= num; + pTile->flags |= mask; + pTile -= 2880; + pTile->flags |= mask; + pTile += num; + pTile->flags |= mask; + pTile -= 1440; + break; + default: + pTile -= 1440; + pTile->flags |= mask; + pTile -= num; + pTile->flags |= mask; + pTile -= 1440; + pTile->flags |= mask; + pTile += num; + pTile->flags |= mask; + pTile -= 1440; + break; + } + pTile->flags |= mask; + pTile -= num; + pTile->flags |= mask; + } + + private unsafe void Highlight2x5(Tile* pTile, Tile.Flags mask) + { + int num = (int) pTile->frameX == 0 ? 1440 : -1440; + pTile->flags |= mask; + pTile += num; + pTile->flags |= mask; + switch ((int) pTile->frameY / 18) + { + case 0: + ++pTile; + pTile->flags |= mask; + pTile -= num; + pTile->flags |= mask; + ++pTile; + pTile->flags |= mask; + pTile += num; + pTile->flags |= mask; + ++pTile; + pTile->flags |= mask; + pTile -= num; + pTile->flags |= mask; + ++pTile; + break; + case 1: + --pTile; + pTile->flags |= mask; + pTile -= num; + pTile->flags |= mask; + pTile += 2; + pTile->flags |= mask; + pTile += num; + pTile->flags |= mask; + ++pTile; + pTile->flags |= mask; + pTile -= num; + pTile->flags |= mask; + ++pTile; + break; + case 2: + --pTile; + pTile->flags |= mask; + pTile -= num; + pTile->flags |= mask; + --pTile; + pTile->flags |= mask; + pTile += num; + pTile->flags |= mask; + pTile += 3; + pTile->flags |= mask; + pTile -= num; + pTile->flags |= mask; + ++pTile; + break; + case 3: + ++pTile; + pTile->flags |= mask; + pTile -= num; + pTile->flags |= mask; + pTile -= 2; + pTile->flags |= mask; + pTile += num; + pTile->flags |= mask; + --pTile; + pTile->flags |= mask; + pTile -= num; + pTile->flags |= mask; + --pTile; + break; + default: + --pTile; + pTile->flags |= mask; + pTile -= num; + pTile->flags |= mask; + --pTile; + pTile->flags |= mask; + pTile += num; + pTile->flags |= mask; + --pTile; + pTile->flags |= mask; + pTile -= num; + pTile->flags |= mask; + --pTile; + break; + } + pTile->flags |= mask; + pTile += num; + pTile->flags |= mask; + } + + private unsafe void DrawNonSolidTiles() + { + int index1 = 0; + Rectangle s1 = new Rectangle(); + Vector2 pos1 = new Vector2(); + Main.tileSolid[10] = false; + Tile[,] tileArray; + // ISSUE: cast to a reference type + // ISSUE: explicit reference operation + fixed (Tile* tilePtr1 = &^((tileArray = Main.tile) == null || tileArray.Length == 0 ? (Tile&) IntPtr.Zero : tileArray.Address(0, 0))) + { + if (!this.player.dead) + { + Tile* tilePtr2 = ((int) Main.frameCounter & 32) == 0 ? (Tile*) null : tilePtr1 + ((int) this.player.tileInteractX * 1440 + (int) this.player.tileInteractY); + int num1 = (this.player.aabb.X + 10 >> 4) - 10; + int num2 = (this.player.aabb.Y + 21 >> 4) - 8; + for (int index2 = 0; index2 < 20; ++index2) + { + Tile* pTile = tilePtr1 + ((num1 + index2) * 1440 + num2); + for (int index3 = 0; index3 < 16; ++index3) + { + if ((int) pTile->active != 0) + { + Tile.Flags mask = pTile == tilePtr2 ? Tile.Flags.SELECTED : Tile.Flags.NEARBY; + if ((pTile->flags & mask) != mask) + { + byte num3 = pTile->type; + if ((uint) num3 <= 79U) + { + if ((uint) num3 <= 29U) + { + if ((uint) num3 <= 13U) + { + switch (num3) + { + case (byte) 4: + case (byte) 13: + break; + case (byte) 10: + this.Highlight1x3(pTile, mask); + goto label_33; + case (byte) 11: + goto label_27; + default: + goto label_33; + } + } + else if ((int) num3 != 21) + { + if ((int) num3 == 29) + { + this.Highlight2x1(pTile, mask); + goto label_33; + } + else + goto label_33; + } + else + goto label_29; + } + else if ((uint) num3 <= 50U) + { + switch (num3) + { + case (byte) 33: + case (byte) 49: + case (byte) 50: + break; + default: + goto label_33; + } + } + else if ((int) num3 != 55) + { + if ((int) num3 == 79) + { + this.Highlight4x2(pTile, mask); + goto label_33; + } + else + goto label_33; + } + else + goto label_29; + } + else if ((uint) num3 <= 125U) + { + if ((uint) num3 <= 97U) + { + if ((int) num3 == 85 || (int) num3 == 97) + goto label_29; + else + goto label_33; + } + else if ((int) num3 != 104) + { + if ((int) num3 == 125) + goto label_29; + else + goto label_33; + } + else + { + this.Highlight2x5(pTile, mask); + goto label_33; + } + } + else if ((uint) num3 <= 132U) + { + if ((int) num3 != 128) + { + if ((int) num3 == 132) + goto label_29; + else + goto label_33; + } + else + goto label_27; + } + else if ((int) num3 != 136) + { + if ((int) num3 != 139) + { + if ((int) num3 != 144) + goto label_33; + } + else + goto label_29; + } + pTile->flags |= mask; + goto label_33; +label_27: + this.Highlight2x3(pTile, mask); + goto label_33; +label_29: + this.Highlight2x2(pTile, mask); + } + } +label_33: + ++pTile; + } + } + } + int x = (int) this.firstTileX - 1; + int num4 = (int) this.lastTileX + 2; + int num5 = (int) this.lastTileY + 2; + do + { + int y = (int) this.firstTileY; + Tile* tilePtr2 = tilePtr1 + (x * 1440 + y - 1); + do + { + ++tilePtr2; + if ((int) tilePtr2->active != 0) + { + int type = (int) tilePtr2->type; + if (!Main.tileSolid[type]) + { + Color colorUnsafe1 = this.lighting.GetColorUnsafe(x, y); + int num1 = 0; + int num2 = 16; + int num3 = 16; + s1.X = (int) tilePtr2->frameX; + s1.Y = (int) tilePtr2->frameY; + switch (type) + { + case 113: + case 73: + case 74: + num1 = -12; + num2 = 32; + break; + case 124: + case 69: + case 72: + case 77: + case 80: + case 14: + case 15: + case 16: + case 17: + case 18: + case 20: + case 26: + case 27: + case 32: + num2 = 18; + break; + case 125: + case 97: + if ((tilePtr2->flags & Tile.Flags.SELECTED) != ~(Tile.Flags.WALLFRAME_MASK | Tile.Flags.HIGHLIGHT_MASK | Tile.Flags.VISITED | Tile.Flags.WIRE | Tile.Flags.CHECKING_LIQUID | Tile.Flags.SKIP_LIQUID)) + { + s1.Y += 68; + break; + } + else if ((tilePtr2->flags & Tile.Flags.NEARBY) != ~(Tile.Flags.WALLFRAME_MASK | Tile.Flags.HIGHLIGHT_MASK | Tile.Flags.VISITED | Tile.Flags.WIRE | Tile.Flags.CHECKING_LIQUID | Tile.Flags.SKIP_LIQUID)) + { + s1.Y += 34; + break; + } + else + break; + case 128: + if ((tilePtr2->flags & Tile.Flags.SELECTED) != ~(Tile.Flags.WALLFRAME_MASK | Tile.Flags.HIGHLIGHT_MASK | Tile.Flags.VISITED | Tile.Flags.WIRE | Tile.Flags.CHECKING_LIQUID | Tile.Flags.SKIP_LIQUID)) + { + s1.Y += 104; + break; + } + else if ((tilePtr2->flags & Tile.Flags.NEARBY) != ~(Tile.Flags.WALLFRAME_MASK | Tile.Flags.HIGHLIGHT_MASK | Tile.Flags.VISITED | Tile.Flags.WIRE | Tile.Flags.CHECKING_LIQUID | Tile.Flags.SKIP_LIQUID)) + { + s1.Y += 52; + break; + } + else + break; + case 132: + num1 = 2; + num2 = 18; + if ((tilePtr2->flags & Tile.Flags.SELECTED) != ~(Tile.Flags.WALLFRAME_MASK | Tile.Flags.HIGHLIGHT_MASK | Tile.Flags.VISITED | Tile.Flags.WIRE | Tile.Flags.CHECKING_LIQUID | Tile.Flags.SKIP_LIQUID)) + { + s1.Y += 72; + break; + } + else if ((tilePtr2->flags & Tile.Flags.NEARBY) != ~(Tile.Flags.WALLFRAME_MASK | Tile.Flags.HIGHLIGHT_MASK | Tile.Flags.VISITED | Tile.Flags.WIRE | Tile.Flags.CHECKING_LIQUID | Tile.Flags.SKIP_LIQUID)) + { + s1.Y += 36; + break; + } + else + break; + case 135: + num1 = 2; + num2 = 18; + break; + case 136: + case 144: + case 55: + case 79: + if ((tilePtr2->flags & Tile.Flags.SELECTED) != ~(Tile.Flags.WALLFRAME_MASK | Tile.Flags.HIGHLIGHT_MASK | Tile.Flags.VISITED | Tile.Flags.WIRE | Tile.Flags.CHECKING_LIQUID | Tile.Flags.SKIP_LIQUID)) + { + s1.Y += 72; + break; + } + else if ((tilePtr2->flags & Tile.Flags.NEARBY) != ~(Tile.Flags.WALLFRAME_MASK | Tile.Flags.HIGHLIGHT_MASK | Tile.Flags.VISITED | Tile.Flags.WIRE | Tile.Flags.CHECKING_LIQUID | Tile.Flags.SKIP_LIQUID)) + { + s1.Y += 36; + break; + } + else + break; + case 139: + num1 = 2; + if ((tilePtr2->flags & Tile.Flags.SELECTED) != ~(Tile.Flags.WALLFRAME_MASK | Tile.Flags.HIGHLIGHT_MASK | Tile.Flags.VISITED | Tile.Flags.WIRE | Tile.Flags.CHECKING_LIQUID | Tile.Flags.SKIP_LIQUID)) + { + s1.Y += 1512; + break; + } + else if ((tilePtr2->flags & Tile.Flags.NEARBY) != ~(Tile.Flags.WALLFRAME_MASK | Tile.Flags.HIGHLIGHT_MASK | Tile.Flags.VISITED | Tile.Flags.WIRE | Tile.Flags.CHECKING_LIQUID | Tile.Flags.SKIP_LIQUID)) + { + s1.Y += 756; + break; + } + else + break; + case 142: + case 143: + case 105: + case 78: + num1 = 2; + break; + case 104: + if ((tilePtr2->flags & Tile.Flags.SELECTED) != ~(Tile.Flags.WALLFRAME_MASK | Tile.Flags.HIGHLIGHT_MASK | Tile.Flags.VISITED | Tile.Flags.WIRE | Tile.Flags.CHECKING_LIQUID | Tile.Flags.SKIP_LIQUID)) + { + s1.Y += 176; + break; + } + else if ((tilePtr2->flags & Tile.Flags.NEARBY) != ~(Tile.Flags.WALLFRAME_MASK | Tile.Flags.HIGHLIGHT_MASK | Tile.Flags.VISITED | Tile.Flags.WIRE | Tile.Flags.CHECKING_LIQUID | Tile.Flags.SKIP_LIQUID)) + { + s1.Y += 88; + break; + } + else + break; + case 110: + case 61: + case 71: + case 3: + case 24: + num2 = 20; + break; + case 81: + num1 = -8; + num3 = 24; + num2 = 26; + break; + case 85: + num1 = 2; + if ((tilePtr2->flags & Tile.Flags.SELECTED) != ~(Tile.Flags.WALLFRAME_MASK | Tile.Flags.HIGHLIGHT_MASK | Tile.Flags.VISITED | Tile.Flags.WIRE | Tile.Flags.CHECKING_LIQUID | Tile.Flags.SKIP_LIQUID)) + { + s1.Y += 72; + break; + } + else if ((tilePtr2->flags & Tile.Flags.NEARBY) != ~(Tile.Flags.WALLFRAME_MASK | Tile.Flags.HIGHLIGHT_MASK | Tile.Flags.VISITED | Tile.Flags.WIRE | Tile.Flags.CHECKING_LIQUID | Tile.Flags.SKIP_LIQUID)) + { + s1.Y += 36; + break; + } + else + break; + case 4: + num3 = 20; + num2 = 20; + if ((tilePtr2->flags & Tile.Flags.SELECTED) != ~(Tile.Flags.WALLFRAME_MASK | Tile.Flags.HIGHLIGHT_MASK | Tile.Flags.VISITED | Tile.Flags.WIRE | Tile.Flags.CHECKING_LIQUID | Tile.Flags.SKIP_LIQUID)) + { + s1.Y += 396; + break; + } + else + break; + case 5: + num3 = 20; + num2 = 20; + break; + case 10: + case 11: + if ((tilePtr2->flags & Tile.Flags.SELECTED) != ~(Tile.Flags.WALLFRAME_MASK | Tile.Flags.HIGHLIGHT_MASK | Tile.Flags.VISITED | Tile.Flags.WIRE | Tile.Flags.CHECKING_LIQUID | Tile.Flags.SKIP_LIQUID)) + { + s1.Y += 108; + break; + } + else if ((tilePtr2->flags & Tile.Flags.NEARBY) != ~(Tile.Flags.WALLFRAME_MASK | Tile.Flags.HIGHLIGHT_MASK | Tile.Flags.VISITED | Tile.Flags.WIRE | Tile.Flags.CHECKING_LIQUID | Tile.Flags.SKIP_LIQUID)) + { + s1.Y += 54; + break; + } + else + break; + case 13: + if ((tilePtr2->flags & Tile.Flags.SELECTED) != ~(Tile.Flags.WALLFRAME_MASK | Tile.Flags.HIGHLIGHT_MASK | Tile.Flags.VISITED | Tile.Flags.WIRE | Tile.Flags.CHECKING_LIQUID | Tile.Flags.SKIP_LIQUID)) + { + s1.Y += 36; + break; + } + else + break; + case 21: + num2 = 18; + if ((tilePtr2->flags & Tile.Flags.SELECTED) != ~(Tile.Flags.WALLFRAME_MASK | Tile.Flags.HIGHLIGHT_MASK | Tile.Flags.VISITED | Tile.Flags.WIRE | Tile.Flags.CHECKING_LIQUID | Tile.Flags.SKIP_LIQUID)) + { + s1.Y += 76; + break; + } + else if ((tilePtr2->flags & Tile.Flags.NEARBY) != ~(Tile.Flags.WALLFRAME_MASK | Tile.Flags.HIGHLIGHT_MASK | Tile.Flags.VISITED | Tile.Flags.WIRE | Tile.Flags.CHECKING_LIQUID | Tile.Flags.SKIP_LIQUID)) + { + s1.Y += 38; + break; + } + else + break; + case 29: + if ((tilePtr2->flags & Tile.Flags.SELECTED) != ~(Tile.Flags.WALLFRAME_MASK | Tile.Flags.HIGHLIGHT_MASK | Tile.Flags.VISITED | Tile.Flags.WIRE | Tile.Flags.CHECKING_LIQUID | Tile.Flags.SKIP_LIQUID)) + { + s1.Y += 36; + break; + } + else if ((tilePtr2->flags & Tile.Flags.NEARBY) != ~(Tile.Flags.WALLFRAME_MASK | Tile.Flags.HIGHLIGHT_MASK | Tile.Flags.VISITED | Tile.Flags.WIRE | Tile.Flags.CHECKING_LIQUID | Tile.Flags.SKIP_LIQUID)) + { + s1.Y += 18; + break; + } + else + break; + case 33: + case 49: + num1 = -4; + num2 = 20; + if ((tilePtr2->flags & Tile.Flags.SELECTED) != ~(Tile.Flags.WALLFRAME_MASK | Tile.Flags.HIGHLIGHT_MASK | Tile.Flags.VISITED | Tile.Flags.WIRE | Tile.Flags.CHECKING_LIQUID | Tile.Flags.SKIP_LIQUID)) + { + s1.Y += 44; + break; + } + else + break; + case 50: + if ((tilePtr2->flags & Tile.Flags.SELECTED) != ~(Tile.Flags.WALLFRAME_MASK | Tile.Flags.HIGHLIGHT_MASK | Tile.Flags.VISITED | Tile.Flags.WIRE | Tile.Flags.CHECKING_LIQUID | Tile.Flags.SKIP_LIQUID)) + { + s1.Y += 32; + break; + } + else + break; + } + s1.Width = num3; + s1.Height = num2; + pos1.X = (float) ((x << 4) - this.screenPosition.X - (num3 - 16 >> 1) + 32); + pos1.Y = (float) ((y << 4) - this.screenPosition.Y + num1 + 32); + if (this.player.findTreasure && (type == 12 || type == 21 || type == 28 || type >= 82 && type <= 84)) + { + if ((int) colorUnsafe1.R < (int) UI.mouseTextBrightness >> 1) + colorUnsafe1.R = (byte) ((uint) UI.mouseTextBrightness >> 1); + if ((int) colorUnsafe1.G < 70) + colorUnsafe1.G = (byte) 70; + if ((int) colorUnsafe1.B < 210) + colorUnsafe1.B = (byte) 210; + colorUnsafe1.A = UI.mouseTextBrightness; + if (Main.rand.Next(150) == 0) + { + Dust* dustPtr = this.dustLocal.NewDust(x * 16, y * 16, 16, 16, 15, 0.0, 0.0, 150, new Color(), 0.800000011920929); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.X *= 0.1f; + dustPtr->velocity.Y *= 0.1f; + dustPtr->noLight = true; + } + } + } + switch (type) + { + case 93: + if ((int) tilePtr2->frameX == 0 && (int) tilePtr2->frameY == 0 && Main.rand.Next(40) == 0) + { + this.dustLocal.NewDust(x * 16 + 4, y * 16 + 2, 4, 4, 6, 0.0, 0.0, 100, new Color(), 1.0); + break; + } + else + break; + case 98: + if ((int) tilePtr2->frameX == 0 && (int) tilePtr2->frameY == 0 && Main.rand.Next(40) == 0) + { + this.dustLocal.NewDust(x * 16 + 12, y * 16 + 2, 4, 4, 6, 0.0, 0.0, 100, new Color(), 1.0); + break; + } + else + break; + case 100: + if ((int) tilePtr2->frameY == 0 && (int) tilePtr2->frameX < 36 && Main.rand.Next(40) == 0) + { + if ((int) tilePtr2->frameX == 0) + { + if (Main.rand.Next(3) == 0) + { + this.dustLocal.NewDust(x * 16 + 4, y * 16 + 2, 4, 4, 6, 0.0, 0.0, 100, new Color(), 1.0); + break; + } + else + { + this.dustLocal.NewDust(x * 16 + 14, y * 16 + 2, 4, 4, 6, 0.0, 0.0, 100, new Color(), 1.0); + break; + } + } + else if (Main.rand.Next(3) == 0) + { + this.dustLocal.NewDust(x * 16 + 6, y * 16 + 2, 4, 4, 6, 0.0, 0.0, 100, new Color(), 1.0); + break; + } + else + { + this.dustLocal.NewDust(x * 16, y * 16 + 2, 4, 4, 6, 0.0, 0.0, 100, new Color(), 1.0); + break; + } + } + else + break; + case 133: + case 77: + case 17: + if (Main.rand.Next(40) == 0 && (int) tilePtr2->frameX == 18 && (int) tilePtr2->frameY == 18) + { + this.dustLocal.NewDust(x * 16 + 2, y * 16, 8, 6, 6, 0.0, 0.0, 100, new Color(), 1.0); + break; + } + else + break; + case 71: + case 72: + if (Main.rand.Next(500) == 0) + { + this.dustLocal.NewDust(x * 16, y * 16, 16, 16, 41, 0.0, 0.0, 250, new Color(), 0.800000011920929); + break; + } + else + break; + case 24: + case 32: + if (Main.rand.Next(500) == 0) + { + this.dustLocal.NewDust(x * 16, y * 16, 16, 16, 14, 0.0, 0.0, 0, new Color(), 1.0); + break; + } + else + break; + case 26: + case 31: + if (Main.rand.Next(20) == 0) + { + this.dustLocal.NewDust(x * 16, y * 16, 16, 16, 14, 0.0, 0.0, 100, new Color(), 1.0); + break; + } + else + break; + case 33: + if ((int) tilePtr2->frameX == 0 && Main.rand.Next(40) == 0) + { + this.dustLocal.NewDust(x * 16 + 4, y * 16 - 4, 4, 4, 6, 0.0, 0.0, 100, new Color(), 1.0); + break; + } + else + break; + case 34: + case 35: + case 36: + if (((int) tilePtr2->frameX == 0 || (int) tilePtr2->frameX == 36) && ((int) tilePtr2->frameY == 18 && Main.rand.Next(40) == 0)) + { + this.dustLocal.NewDust(x * 16, y * 16 + 2, 14, 6, 6, 0.0, 0.0, 100, new Color(), 1.0); + break; + } + else + break; + case 49: + if (Main.rand.Next(20) == 0) + { + this.dustLocal.NewDust(x * 16 + 4, y * 16 - 4, 4, 4, 29, 0.0, 0.0, 100, new Color(), 1.0); + break; + } + else + break; + case 61: + if ((int) tilePtr2->frameX == 144) + { + if (Main.rand.Next(60) == 0) + { + Dust* dustPtr = this.dustLocal.NewDust(x * 16, y * 16, 16, 16, 44, 0.0, 0.0, 250, new Color(), 0.400000005960464); + if ((IntPtr) dustPtr != IntPtr.Zero) + dustPtr->fadeIn = 0.7f; + } + colorUnsafe1.A = colorUnsafe1.R = colorUnsafe1.B = colorUnsafe1.G = (byte) (245 - (int) UI.mouseTextBrightness + ((int) UI.mouseTextBrightness >> 1)); + break; + } + else + break; + case 4: + if ((int) tilePtr2->frameX < 66 && Main.rand.Next(40) == 0) + { + int num6 = (int) tilePtr2->frameY / 22; + int Type; + switch (num6) + { + case 0: + Type = 6; + break; + case 8: + Type = 75; + break; + default: + Type = 58 + num6; + break; + } + if ((int) tilePtr2->frameX == 22) + { + this.dustLocal.NewDust(x * 16 + 6, y * 16, 4, 4, Type, 0.0, 0.0, 100, new Color(), 1.0); + break; + } + else if ((int) tilePtr2->frameX == 44) + { + this.dustLocal.NewDust(x * 16 + 2, y * 16, 4, 4, Type, 0.0, 0.0, 100, new Color(), 1.0); + break; + } + else + { + this.dustLocal.NewDust(x * 16 + 4, y * 16, 4, 4, Type, 0.0, 0.0, 100, new Color(), 1.0); + break; + } + } + else + break; + default: + if ((int) Main.tileShine[type] > 0 && ((int) colorUnsafe1.R > 20 || (int) colorUnsafe1.B > 20 || (int) colorUnsafe1.G > 20)) + { + int num6 = (int) colorUnsafe1.R; + if ((int) colorUnsafe1.G > num6) + num6 = (int) colorUnsafe1.G; + if ((int) colorUnsafe1.B > num6) + num6 = (int) colorUnsafe1.B; + int num7 = num6 / 30; + if (Main.rand.Next((int) Main.tileShine[type]) < num7 && (type != 21 || (int) tilePtr2->frameX >= 36 && (int) tilePtr2->frameX < 180)) + { + Dust* dustPtr = this.dustLocal.NewDust(x * 16, y * 16, 16, 16, 43, 0.0, 0.0, 254, new Color(), 0.5); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.X = 0.0f; + dustPtr->velocity.Y = 0.0f; + break; + } + else + break; + } + else + break; + } + else + break; + } + if (type == 5 && (int) tilePtr2->frameY >= 198 && (int) tilePtr2->frameX >= 22 || type == 128 && (int) tilePtr2->frameX >= 100) + { + this.spec[index1].X = (short) x; + this.spec[index1].Y = (short) y; + this.spec[index1++].tileColor = colorUnsafe1; + if (type == 128) + { + s1.X %= 100; + SpriteSheet<_sheetTiles>.Draw(154, ref pos1, ref s1, colorUnsafe1); + } + } + else if (type == 129) + { + colorUnsafe1.R = (byte) 200; + colorUnsafe1.G = (byte) 200; + colorUnsafe1.B = (byte) 200; + colorUnsafe1.A = (byte) 0; + SpriteSheet<_sheetTiles>.Draw(26 + type, ref pos1, ref s1, colorUnsafe1); + } + else if ((int) colorUnsafe1.R > 1 || (int) colorUnsafe1.G > 1 || (int) colorUnsafe1.B > 1) + { + if (type == 72 && (int) tilePtr2->frameX >= 36) + { + int num6 = (int) tilePtr2->frameY / 18; + pos1.X = (float) (x * 16 - this.screenPosition.X - 22 + 32); + pos1.Y = (float) (y * 16 - this.screenPosition.Y - 26 + 32); + s1.X = num6 * 62; + s1.Y = 0; + s1.Width = 60; + s1.Height = 42; + SpriteSheet<_sheetTiles>.Draw(18, ref pos1, ref s1, colorUnsafe1); + } + else if (type == 51) + { + colorUnsafe1.R = (byte) ((uint) colorUnsafe1.R >> 1); + colorUnsafe1.G = (byte) ((uint) colorUnsafe1.G >> 1); + colorUnsafe1.B = (byte) ((uint) colorUnsafe1.B >> 1); + colorUnsafe1.A = (byte) ((uint) colorUnsafe1.A >> 1); + SpriteSheet<_sheetTiles>.Draw(26 + type, ref pos1, ref s1, colorUnsafe1); + } + else if (type >= 82 && type <= 84) + { + if (type > 82) + { + int num6 = (int) tilePtr2->frameX / 18; + if (num6 == 0 && this.time.dayTime) + type = 84; + else if (num6 == 1 && !this.time.dayTime) + type = 84; + else if (num6 == 3 && this.time.bloodMoon) + type = 84; + if (type == 84) + { + if (num6 == 0) + { + if (Main.rand.Next(100) == 0) + { + Dust* dustPtr = this.dustLocal.NewDust(x * 16, y * 16 - 4, 16, 16, 19, 0.0, 0.0, 160, new Color(), 0.100000001490116); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.X *= 0.5f; + dustPtr->velocity.Y *= 0.5f; + dustPtr->noGravity = true; + dustPtr->fadeIn = 1f; + } + } + } + else if (num6 == 1) + { + if (Main.rand.Next(100) == 0) + this.dustLocal.NewDust(x * 16, y * 16, 16, 16, 41, 0.0, 0.0, 250, new Color(), 0.800000011920929); + } + else if (num6 == 3) + { + if (Main.rand.Next(200) == 0) + { + Dust* dustPtr = this.dustLocal.NewDust(x * 16, y * 16, 16, 16, 14, 0.0, 0.0, 100, new Color(), 0.200000002980232); + if ((IntPtr) dustPtr != IntPtr.Zero) + dustPtr->fadeIn = 1.2f; + } + if (Main.rand.Next(75) == 0) + { + Dust* dustPtr = this.dustLocal.NewDust(x * 16, y * 16, 16, 16, 27, 0.0, 0.0, 100, new Color(), 1.0); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.X *= 0.5f; + dustPtr->velocity.Y *= 0.5f; + } + } + } + else if (num6 == 4) + { + if (Main.rand.Next(150) == 0) + { + Dust* dustPtr = this.dustLocal.NewDust(x * 16, y * 16, 16, 8, 16, 0.0, 0.0, 0, new Color(), 1.0); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.X *= 0.3333333f; + dustPtr->velocity.Y *= 0.3333333f; + dustPtr->velocity.Y -= 0.7f; + dustPtr->alpha = (short) 50; + dustPtr->scale *= 0.1f; + dustPtr->fadeIn = 0.9f; + dustPtr->noGravity = true; + } + } + } + else if (num6 == 5) + { + if (Main.rand.Next(40) == 0) + { + Dust* dustPtr = this.dustLocal.NewDust(x * 16, y * 16 - 6, 16, 16, 6, 0.0, 0.0, 0, new Color(), 1.5); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.Y -= 2f; + dustPtr->noGravity = true; + } + } + colorUnsafe1.A = (byte) ((uint) UI.mouseTextBrightness >> 1); + colorUnsafe1.G = UI.mouseTextBrightness; + colorUnsafe1.B = UI.mouseTextBrightness; + } + } + } + pos1.Y = (float) (y * 16 - this.screenPosition.Y - 1 + 32); + s1.Height = 20; + SpriteSheet<_sheetTiles>.Draw(26 + type, ref pos1, ref s1, colorUnsafe1); + } + else if (type == 80) + { + bool flag1 = false; + bool flag2 = false; + int index2 = x; + switch (tilePtr2->frameX) + { + case (short) 36: + --index2; + break; + case (short) 54: + ++index2; + break; + case (short) 108: + if ((int) tilePtr2->frameY == 16) + { + --index2; + break; + } + else + { + ++index2; + break; + } + } + int index3 = y; + bool flag3 = false; + if ((int) Main.tile[index2, index3].type == 80 && (int) Main.tile[index2, index3].active != 0) + flag3 = true; + while ((int) Main.tile[index2, index3].active == 0 || !Main.tileSolid[(int) Main.tile[index2, index3].type] || !flag3) + { + if ((int) Main.tile[index2, index3].type == 80 && (int) Main.tile[index2, index3].active != 0) + flag3 = true; + ++index3; + if (index3 > y + 20) + break; + } + if ((int) Main.tile[index2, index3].type == 112) + flag1 = true; + else if ((int) Main.tile[index2, index3].type == 116) + flag2 = true; + SpriteSheet<_sheetTiles>.Draw(!flag1 ? (!flag2 ? 26 + type : 13) : 12, ref pos1, ref s1, colorUnsafe1); + } + else + { + bool flag = Main.tileShine2[type]; + int id = 26 + type; + if (this.SMOOTH_LIGHT && Main.tileSolid[type] && type != 137) + { + if ((int) colorUnsafe1.R > 198 || (double) colorUnsafe1.G > 217.800003051758 || (double) colorUnsafe1.B > 237.600006103516) + { + s1.Width = 4; + s1.Height = 4; + Color colorUnsafe2 = this.lighting.GetColorUnsafe(x - 1, y - 1); + colorUnsafe2.R = (byte) ((int) colorUnsafe1.R + (int) colorUnsafe2.R >> 1); + colorUnsafe2.G = (byte) ((int) colorUnsafe1.G + (int) colorUnsafe2.G >> 1); + colorUnsafe2.B = (byte) ((int) colorUnsafe1.B + (int) colorUnsafe2.B >> 1); + if (flag) + WorldView.shine(ref colorUnsafe2, type); + SpriteSheet<_sheetTiles>.Draw(id, ref pos1, ref s1, colorUnsafe2); + pos1.X += 4f; + s1.X += 4; + s1.Width = 8; + colorUnsafe2 = this.lighting.GetColorUnsafe(x, y - 1); + colorUnsafe2.R = (byte) ((int) colorUnsafe1.R + (int) colorUnsafe2.R >> 1); + colorUnsafe2.G = (byte) ((int) colorUnsafe1.G + (int) colorUnsafe2.G >> 1); + colorUnsafe2.B = (byte) ((int) colorUnsafe1.B + (int) colorUnsafe2.B >> 1); + if (flag) + WorldView.shine(ref colorUnsafe2, type); + SpriteSheet<_sheetTiles>.Draw(id, ref pos1, ref s1, colorUnsafe2); + pos1.X += 8f; + s1.X += 8; + s1.Width = 4; + colorUnsafe2 = this.lighting.GetColorUnsafe(x + 1, y - 1); + colorUnsafe2.R = (byte) ((int) colorUnsafe1.R + (int) colorUnsafe2.R >> 1); + colorUnsafe2.G = (byte) ((int) colorUnsafe1.G + (int) colorUnsafe2.G >> 1); + colorUnsafe2.B = (byte) ((int) colorUnsafe1.B + (int) colorUnsafe2.B >> 1); + if (flag) + WorldView.shine(ref colorUnsafe2, type); + SpriteSheet<_sheetTiles>.Draw(id, ref pos1, ref s1, colorUnsafe2); + pos1.Y += 4f; + s1.Y += 4; + s1.Height = 8; + colorUnsafe2 = this.lighting.GetColorUnsafe(x + 1, y); + colorUnsafe2.R = (byte) ((int) colorUnsafe1.R + (int) colorUnsafe2.R >> 1); + colorUnsafe2.G = (byte) ((int) colorUnsafe1.G + (int) colorUnsafe2.G >> 1); + colorUnsafe2.B = (byte) ((int) colorUnsafe1.B + (int) colorUnsafe2.B >> 1); + if (flag) + WorldView.shine(ref colorUnsafe2, type); + SpriteSheet<_sheetTiles>.Draw(id, ref pos1, ref s1, colorUnsafe2); + pos1.X -= 12f; + s1.X -= 12; + colorUnsafe2 = this.lighting.GetColorUnsafe(x - 1, y); + colorUnsafe2.R = (byte) ((int) colorUnsafe1.R + (int) colorUnsafe2.R >> 1); + colorUnsafe2.G = (byte) ((int) colorUnsafe1.G + (int) colorUnsafe2.G >> 1); + colorUnsafe2.B = (byte) ((int) colorUnsafe1.B + (int) colorUnsafe2.B >> 1); + if (flag) + WorldView.shine(ref colorUnsafe2, type); + SpriteSheet<_sheetTiles>.Draw(id, ref pos1, ref s1, colorUnsafe2); + pos1.Y += 8f; + s1.Y += 8; + s1.Height = 4; + colorUnsafe2 = this.lighting.GetColorUnsafe(x - 1, y + 1); + colorUnsafe2.R = (byte) ((int) colorUnsafe1.R + (int) colorUnsafe2.R >> 1); + colorUnsafe2.G = (byte) ((int) colorUnsafe1.G + (int) colorUnsafe2.G >> 1); + colorUnsafe2.B = (byte) ((int) colorUnsafe1.B + (int) colorUnsafe2.B >> 1); + if (flag) + WorldView.shine(ref colorUnsafe2, type); + SpriteSheet<_sheetTiles>.Draw(id, ref pos1, ref s1, colorUnsafe2); + pos1.X += 4f; + s1.X += 4; + s1.Width = 8; + colorUnsafe2 = this.lighting.GetColorUnsafe(x, y + 1); + colorUnsafe2.R = (byte) ((int) colorUnsafe1.R + (int) colorUnsafe2.R >> 1); + colorUnsafe2.G = (byte) ((int) colorUnsafe1.G + (int) colorUnsafe2.G >> 1); + colorUnsafe2.B = (byte) ((int) colorUnsafe1.B + (int) colorUnsafe2.B >> 1); + if (flag) + WorldView.shine(ref colorUnsafe2, type); + SpriteSheet<_sheetTiles>.Draw(id, ref pos1, ref s1, colorUnsafe2); + pos1.X += 8f; + s1.X += 8; + s1.Width = 4; + colorUnsafe2 = this.lighting.GetColorUnsafe(x + 1, y + 1); + colorUnsafe2.R = (byte) ((int) colorUnsafe1.R + (int) colorUnsafe2.R >> 1); + colorUnsafe2.G = (byte) ((int) colorUnsafe1.G + (int) colorUnsafe2.G >> 1); + colorUnsafe2.B = (byte) ((int) colorUnsafe1.B + (int) colorUnsafe2.B >> 1); + if (flag) + WorldView.shine(ref colorUnsafe2, type); + SpriteSheet<_sheetTiles>.Draw(id, ref pos1, ref s1, colorUnsafe2); + pos1.X -= 8f; + pos1.Y -= 8f; + s1.X -= 8; + s1.Y -= 8; + s1.Width = 8; + s1.Height = 8; + if (flag) + WorldView.shine(ref colorUnsafe1, type); + SpriteSheet<_sheetTiles>.Draw(id, ref pos1, ref s1, colorUnsafe1); + } + else if ((int) colorUnsafe1.R > 38 || (double) colorUnsafe1.G > 41.7999992370605 || (double) colorUnsafe1.B > 45.6000022888184) + { + s1.Width = 8; + s1.Height = 8; + Color colorUnsafe2 = this.lighting.GetColorUnsafe(x - 1, y - 1); + colorUnsafe2.R = (byte) ((int) colorUnsafe1.R + (int) colorUnsafe2.R >> 1); + colorUnsafe2.G = (byte) ((int) colorUnsafe1.G + (int) colorUnsafe2.G >> 1); + colorUnsafe2.B = (byte) ((int) colorUnsafe1.B + (int) colorUnsafe2.B >> 1); + if (flag) + WorldView.shine(ref colorUnsafe2, type); + SpriteSheet<_sheetTiles>.Draw(id, ref pos1, ref s1, colorUnsafe2); + pos1.X += 8f; + s1.X += 8; + colorUnsafe2 = this.lighting.GetColorUnsafe(x + 1, y - 1); + colorUnsafe2.R = (byte) ((int) colorUnsafe1.R + (int) colorUnsafe2.R >> 1); + colorUnsafe2.G = (byte) ((int) colorUnsafe1.G + (int) colorUnsafe2.G >> 1); + colorUnsafe2.B = (byte) ((int) colorUnsafe1.B + (int) colorUnsafe2.B >> 1); + if (flag) + WorldView.shine(ref colorUnsafe2, type); + SpriteSheet<_sheetTiles>.Draw(id, ref pos1, ref s1, colorUnsafe2); + pos1.Y += 8f; + s1.Y += 8; + colorUnsafe2 = this.lighting.GetColorUnsafe(x + 1, y + 1); + colorUnsafe2.R = (byte) ((int) colorUnsafe1.R + (int) colorUnsafe2.R >> 1); + colorUnsafe2.G = (byte) ((int) colorUnsafe1.G + (int) colorUnsafe2.G >> 1); + colorUnsafe2.B = (byte) ((int) colorUnsafe1.B + (int) colorUnsafe2.B >> 1); + if (flag) + WorldView.shine(ref colorUnsafe2, type); + SpriteSheet<_sheetTiles>.Draw(id, ref pos1, ref s1, colorUnsafe2); + pos1.X -= 8f; + s1.X -= 8; + colorUnsafe2 = this.lighting.GetColorUnsafe(x - 1, y + 1); + colorUnsafe2.R = (byte) ((int) colorUnsafe1.R + (int) colorUnsafe2.R >> 1); + colorUnsafe2.G = (byte) ((int) colorUnsafe1.G + (int) colorUnsafe2.G >> 1); + colorUnsafe2.B = (byte) ((int) colorUnsafe1.B + (int) colorUnsafe2.B >> 1); + if (flag) + WorldView.shine(ref colorUnsafe2, type); + SpriteSheet<_sheetTiles>.Draw(id, ref pos1, ref s1, colorUnsafe2); + } + else + { + if (flag) + WorldView.shine(ref colorUnsafe1, type); + SpriteSheet<_sheetTiles>.Draw(id, ref pos1, ref s1, colorUnsafe1); + } + } + else + { + if (this.SMOOTH_LIGHT && flag) + { + if (type == 21) + { + if ((int) tilePtr2->frameX >= 36 && (int) tilePtr2->frameX < 178) + WorldView.shine(ref colorUnsafe1, type); + } + else + WorldView.shine(ref colorUnsafe1, type); + } + SpriteSheet<_sheetTiles>.Draw(id, ref pos1, ref s1, colorUnsafe1); + if (type == 139) + { + colorUnsafe1.R = (byte) 200; + colorUnsafe1.G = (byte) 200; + colorUnsafe1.B = (byte) 200; + colorUnsafe1.A = (byte) 0; + SpriteSheet<_sheetTiles>.Draw(17, ref pos1, ref s1, colorUnsafe1); + } + else if (type == 144) + { + colorUnsafe1.R = (byte) 200; + colorUnsafe1.G = (byte) 200; + colorUnsafe1.B = (byte) 200; + colorUnsafe1.A = (byte) 0; + SpriteSheet<_sheetTiles>.Draw(176, ref pos1, ref s1, colorUnsafe1); + } + } + } + } + } + } + } + while (++y < num5); + } + while (++x < num4); + if (!this.player.dead) + { + int num1 = (this.player.aabb.X + 10 >> 4) - 10; + int num2 = (this.player.aabb.Y + 21 >> 4) - 8; + for (int index2 = -3; index2 < 23; ++index2) + { + Tile* tilePtr2 = tilePtr1 + ((num1 + index2) * 1440 + num2 - 4); + for (int index3 = -4; index3 < 20; ++index3) + { + tilePtr2->flags &= Tile.Flags.WALLFRAME_MASK | Tile.Flags.VISITED | Tile.Flags.WIRE | Tile.Flags.CHECKING_LIQUID | Tile.Flags.SKIP_LIQUID; + ++tilePtr2; + } + } + } + } + Vector2 pos2 = new Vector2(); + for (int index2 = 0; index2 < index1; ++index2) + { + int index3 = (int) this.spec[index2].X; + int index4 = (int) this.spec[index2].Y; + Color c = this.spec[index2].tileColor; + pos2.X = (float) (32 + index3 * 16 - this.screenPosition.X); + pos2.Y = (float) (32 + index4 * 16 - this.screenPosition.Y); + fixed (Tile* tilePtr = &Main.tile[index3, index4]) + { + if ((int) tilePtr->type == 128) + { + int num1 = (int) tilePtr->frameY / 18; + int num2 = (int) tilePtr->frameX; + int num3 = num2 / 100; + int num4 = num2 % 100; + SpriteEffects se = SpriteEffects.FlipHorizontally; + if (num4 >= 36) + se = SpriteEffects.None; + pos2.X += -4f; + pos2.Y += (float) (-12 - (num1 << 4)); + int sh = 54; + int id; + if (num1 == 0) + { + id = num3 + 60; + sh = 36; + } + else + id = num1 != 1 ? num3 + 107 : num3 + 32; + SpriteSheet<_sheetSprites>.Draw(id, ref pos2, sh, c, se); + } + else + { + Rectangle s2 = new Rectangle(); + if ((int) tilePtr->frameX == 22) + { + int num1 = 0; + if ((int) tilePtr->frameY == 220) + num1 = 1; + else if ((int) tilePtr->frameY == 242) + num1 = 2; + int num2 = 0; + s2.Width = 80; + s2.Height = 80; + int num3 = 32; + int num4 = index4 + 100 >= (int) Main.maxTilesY ? (int) Main.maxTilesY - index4 : 100; + for (int index5 = 0; index5 < num4; ++index5) + { + switch (tilePtr[index5].type) + { + case (byte) 2: + num2 = 0; + goto label_292; + case (byte) 23: + num2 = 1; + goto label_292; + case (byte) 60: + num2 = 2; + s2.Width = 114; + s2.Height = 96; + num3 = 48; + goto label_292; + case (byte) 147: + num2 = 4; + goto label_292; + case (byte) 109: + num2 = 3; + num1 += index3 % 3 * 3; + s2.Height = 140; + goto label_292; + default: + goto default; + } + } +label_292: + s2.X = num1 * (s2.Width + 2); + pos2.X -= (float) num3; + pos2.Y -= (float) (s2.Height - 16); + SpriteSheet<_sheetTiles>.Draw(182 + num2, ref pos2, ref s2, c); + } + else if ((int) tilePtr->frameX == 44) + { + s2.Width = 40; + s2.Height = 40; + if ((int) tilePtr->frameY == 220) + s2.Y = 42; + else if ((int) tilePtr->frameY == 242) + s2.Y = 84; + int num1 = 0; + int num2 = index4 + 100 >= (int) Main.maxTilesY ? (int) Main.maxTilesY - index4 : 100; + for (int index5 = 0; index5 < num2; ++index5) + { + switch (tilePtr[index5 + 1440].type) + { + case (byte) 2: + num1 = 0; + goto label_307; + case (byte) 23: + num1 = 1; + goto label_307; + case (byte) 60: + num1 = 2; + goto label_307; + case (byte) 147: + num1 = 4; + goto label_307; + case (byte) 109: + num1 = 3; + s2.Y += index3 % 3 * 126; + goto label_307; + default: + goto default; + } + } +label_307: + pos2.X -= 24f; + pos2.Y -= 12f; + SpriteSheet<_sheetTiles>.Draw(177 + num1, ref pos2, ref s2, c); + } + else if ((int) tilePtr->frameX == 66) + { + s2.X = 42; + s2.Width = 40; + s2.Height = 40; + if ((int) tilePtr->frameY == 220) + s2.Y = 42; + else if ((int) tilePtr->frameY == 242) + s2.Y = 84; + int num1 = 0; + int num2 = index4 + 100 >= (int) Main.maxTilesY ? (int) Main.maxTilesY - index4 : 100; + for (int index5 = 0; index5 < num2; ++index5) + { + switch (tilePtr[index5 - 1440].type) + { + case (byte) 2: + num1 = 0; + goto label_322; + case (byte) 23: + num1 = 1; + goto label_322; + case (byte) 60: + num1 = 2; + goto label_322; + case (byte) 147: + num1 = 4; + goto label_322; + case (byte) 109: + num1 = 3; + s2.Y += index3 % 3 * 126; + goto label_322; + default: + goto default; + } + } +label_322: + pos2.Y -= 12f; + SpriteSheet<_sheetTiles>.Draw(177 + num1, ref pos2, ref s2, c); + } + } + } + } + Main.tileSolid[10] = true; + } + + private unsafe void DrawSolidTiles() + { + Main.tileSolid[10] = false; + Rectangle s1 = new Rectangle(); + Vector2 pos1 = new Vector2(); + int num1 = (int) this.lastTileX; + int num2 = (int) this.lastTileY; + int x = (int) this.firstTileX; + Tile[,] tileArray; + // ISSUE: cast to a reference type + // ISSUE: explicit reference operation + fixed (Tile* tilePtr1 = &^((tileArray = Main.tile) == null || tileArray.Length == 0 ? (Tile&) IntPtr.Zero : tileArray.Address(0, 0))) + { + do + { + int y = (int) this.firstTileY; + Tile* tilePtr2 = tilePtr1 + (x * 1440 + y - 1); + do + { + ++tilePtr2; + if ((int) tilePtr2->active != 0) + { + int type = (int) tilePtr2->type; + if (Main.tileSolid[type]) + { + s1.X = (int) tilePtr2->frameX; + s1.Y = (int) tilePtr2->frameY; + s1.Width = 16; + s1.Height = type == 137 || type == 138 ? 18 : 16; + pos1.X = (float) (x * 16 - this.screenPosition.X + 32); + pos1.Y = (float) (y * 16 - this.screenPosition.Y + 32); + Color colorUnsafe1 = this.lighting.GetColorUnsafe(x, y); + if (this.player.findTreasure && (type == 6 || type == 7 || (type == 8 || type == 9) || (type == 22 || type == 107 || (type == 108 || type == 111)) || type >= 63 && type <= 68)) + { + if ((int) colorUnsafe1.R < (int) UI.mouseTextBrightness >> 1) + colorUnsafe1.R = (byte) ((uint) UI.mouseTextBrightness >> 1); + if ((int) colorUnsafe1.G < 70) + colorUnsafe1.G = (byte) 70; + if ((int) colorUnsafe1.B < 210) + colorUnsafe1.B = (byte) 210; + colorUnsafe1.A = UI.mouseTextBrightness; + if (Main.rand.Next(150) == 0) + { + Dust* dustPtr = this.dustLocal.NewDust(x * 16, y * 16, 16, 16, 15, 0.0, 0.0, 150, new Color(), 0.800000011920929); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.X *= 0.1f; + dustPtr->velocity.Y *= 0.1f; + dustPtr->noLight = true; + } + } + } + switch (type) + { + case 58: + case 76: + if (Main.rand.Next(250) == 0) + { + Dust* dustPtr = this.dustLocal.NewDust(x * 16, y * 16, 16, 16, 6, 0.0, 0.0, 0, new Color(), (double) Main.rand.Next(3)); + if ((IntPtr) dustPtr != IntPtr.Zero && (double) dustPtr->scale > 1.0) + { + dustPtr->noGravity = true; + dustPtr->noLight = true; + break; + } + else + break; + } + else + break; + case 112: + if (Main.rand.Next(700) == 0) + { + this.dustLocal.NewDust(x * 16, y * 16, 16, 16, 14, 0.0, 0.0, 0, new Color(), 1.0); + break; + } + else + break; + case 22: + if (Main.rand.Next(400) == 0) + { + this.dustLocal.NewDust(x * 16, y * 16, 16, 16, 14, 0.0, 0.0, 0, new Color(), 1.0); + goto default; + } + else + goto default; + case 23: + if (Main.rand.Next(500) == 0) + { + this.dustLocal.NewDust(x * 16, y * 16, 16, 16, 14, 0.0, 0.0, 0, new Color(), 1.0); + break; + } + else + break; + case 25: + if (Main.rand.Next(700) == 0) + { + this.dustLocal.NewDust(x * 16, y * 16, 16, 16, 14, 0.0, 0.0, 0, new Color(), 1.0); + break; + } + else + break; + case 37: + if (Main.rand.Next(250) == 0) + { + Dust* dustPtr = this.dustLocal.NewDust(x * 16, y * 16, 16, 16, 6, 0.0, 0.0, 0, new Color(), (double) Main.rand.Next(3)); + if ((IntPtr) dustPtr != IntPtr.Zero && (double) dustPtr->scale > 1.0) + { + dustPtr->noGravity = true; + break; + } + else + break; + } + else + break; + default: + if ((int) Main.tileShine[type] > 0 && ((int) colorUnsafe1.R > 20 || (int) colorUnsafe1.B > 20 || (int) colorUnsafe1.G > 20)) + { + int num3 = (int) colorUnsafe1.R; + if ((int) colorUnsafe1.G > num3) + num3 = (int) colorUnsafe1.G; + if ((int) colorUnsafe1.B > num3) + num3 = (int) colorUnsafe1.B; + int num4 = num3 / 30; + if (Main.rand.Next((int) Main.tileShine[type]) < num4) + { + Dust* dustPtr = this.dustLocal.NewDust(x * 16, y * 16, 16, 16, 43, 0.0, 0.0, 254, new Color(), 0.5); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.X = 0.0f; + dustPtr->velocity.Y = 0.0f; + break; + } + else + break; + } + else + break; + } + else + break; + } + if ((int) colorUnsafe1.R > 1 || (int) colorUnsafe1.G > 1 || (int) colorUnsafe1.B > 1) + { + if (!Main.tileSolidTop[type] && ((int) tilePtr2[-1].liquid > 0 || (int) tilePtr2[1].liquid > 0 || ((int) tilePtr2[-1440].liquid > 0 || (int) tilePtr2[1440].liquid > 0))) + { + int num3 = 0; + bool flag1 = false; + bool flag2 = false; + bool flag3 = false; + bool flag4 = false; + int num4 = 0; + bool flag5 = false; + if ((int) tilePtr2[-1440].liquid > num3) + { + num3 = (int) tilePtr2[-1440].liquid; + flag1 = true; + } + else if ((int) tilePtr2[-1440].liquid > 0) + flag1 = true; + if ((int) tilePtr2[1440].liquid > num3) + { + num3 = (int) tilePtr2[1440].liquid; + flag2 = true; + } + else if ((int) tilePtr2[1440].liquid > 0) + { + num3 = (int) tilePtr2[1440].liquid; + flag2 = true; + } + if ((int) tilePtr2[-1].liquid > 0) + flag3 = true; + if ((int) tilePtr2[1].liquid > 240) + flag4 = true; + if ((int) tilePtr2[-1440].liquid > 0) + { + if ((int) tilePtr2[-1440].lava != 0) + num4 = 1; + else + flag5 = true; + } + if ((int) tilePtr2[1440].liquid > 0) + { + if ((int) tilePtr2[1440].lava != 0) + num4 = 1; + else + flag5 = true; + } + if ((int) tilePtr2[-1].liquid > 0) + { + if ((int) tilePtr2[-1].lava != 0) + num4 = 1; + else + flag5 = true; + } + if ((int) tilePtr2[1].liquid > 0) + { + if ((int) tilePtr2[1].lava != 0) + num4 = 1; + else + flag5 = true; + } + if (!flag5 || num4 != 1) + { + Vector2 pos2 = new Vector2((float) (x * 16), (float) (y * 16)); + Rectangle s2 = new Rectangle(0, 4, 16, 16); + if (flag4 && (flag1 || flag2)) + { + flag1 = true; + flag2 = true; + } + if ((!flag3 || !flag1 && !flag2) && (!flag4 || !flag3)) + { + if (flag3) + s2.Height = 4; + else if (flag4 && !flag1 && !flag2) + { + pos2.Y += 12f; + s2.Height = 4; + } + else + { + int num5 = (int) ((double) (256 - num3) * (1.0 / 32.0)) << 1; + pos2.Y += (float) num5; + s2.Height -= num5; + if (!flag1 || !flag2) + { + s2.Width = 4; + if (!flag1) + pos2.X += 12f; + } + } + } + Color c = colorUnsafe1; + if (y >= Main.worldSurface) + { + c.R = (byte) ((uint) c.R >> 1); + c.G = (byte) ((uint) c.G >> 1); + c.B = (byte) ((uint) c.B >> 1); + c.A = (byte) ((uint) c.A >> 1); + if (num4 == 1) + { + c.R += (byte) ((uint) c.R >> 1); + c.G += (byte) ((uint) c.G >> 1); + c.B += (byte) ((uint) c.B >> 1); + c.A += (byte) ((uint) c.A >> 1); + } + } + pos2.X -= (float) this.screenPosition.X; + pos2.X += 32f; + pos2.Y -= (float) this.screenPosition.Y; + pos2.Y += 32f; + SpriteSheet<_sheetTiles>.Draw(14 + num4, ref pos2, ref s2, c); + } + } + bool flag = Main.tileShine2[type]; + int id = 26 + type; + if (this.SMOOTH_LIGHT && type != 11 && type != 137) + { + if ((int) colorUnsafe1.R > 198 || (double) colorUnsafe1.G > 217.800003051758 || (double) colorUnsafe1.B > 237.600006103516) + { + s1.Width = 4; + s1.Height = 4; + Color colorUnsafe2 = this.lighting.GetColorUnsafe(x - 1, y - 1); + colorUnsafe2.R = (byte) ((int) colorUnsafe1.R + (int) colorUnsafe2.R >> 1); + colorUnsafe2.G = (byte) ((int) colorUnsafe1.G + (int) colorUnsafe2.G >> 1); + colorUnsafe2.B = (byte) ((int) colorUnsafe1.B + (int) colorUnsafe2.B >> 1); + if (flag) + WorldView.shine(ref colorUnsafe2, type); + SpriteSheet<_sheetTiles>.Draw(id, ref pos1, ref s1, colorUnsafe2); + pos1.X += 4f; + s1.X += 4; + s1.Width = 8; + colorUnsafe2 = this.lighting.GetColorUnsafe(x, y - 1); + colorUnsafe2.R = (byte) ((int) colorUnsafe1.R + (int) colorUnsafe2.R >> 1); + colorUnsafe2.G = (byte) ((int) colorUnsafe1.G + (int) colorUnsafe2.G >> 1); + colorUnsafe2.B = (byte) ((int) colorUnsafe1.B + (int) colorUnsafe2.B >> 1); + if (flag) + WorldView.shine(ref colorUnsafe2, type); + SpriteSheet<_sheetTiles>.Draw(id, ref pos1, ref s1, colorUnsafe2); + pos1.X += 8f; + s1.X += 8; + s1.Width = 4; + colorUnsafe2 = this.lighting.GetColorUnsafe(x + 1, y - 1); + colorUnsafe2.R = (byte) ((int) colorUnsafe1.R + (int) colorUnsafe2.R >> 1); + colorUnsafe2.G = (byte) ((int) colorUnsafe1.G + (int) colorUnsafe2.G >> 1); + colorUnsafe2.B = (byte) ((int) colorUnsafe1.B + (int) colorUnsafe2.B >> 1); + if (flag) + WorldView.shine(ref colorUnsafe2, type); + SpriteSheet<_sheetTiles>.Draw(id, ref pos1, ref s1, colorUnsafe2); + pos1.Y += 4f; + s1.Y += 4; + s1.Height = 8; + colorUnsafe2 = this.lighting.GetColorUnsafe(x + 1, y); + colorUnsafe2.R = (byte) ((int) colorUnsafe1.R + (int) colorUnsafe2.R >> 1); + colorUnsafe2.G = (byte) ((int) colorUnsafe1.G + (int) colorUnsafe2.G >> 1); + colorUnsafe2.B = (byte) ((int) colorUnsafe1.B + (int) colorUnsafe2.B >> 1); + if (flag) + WorldView.shine(ref colorUnsafe2, type); + SpriteSheet<_sheetTiles>.Draw(id, ref pos1, ref s1, colorUnsafe2); + pos1.X -= 12f; + s1.X -= 12; + colorUnsafe2 = this.lighting.GetColorUnsafe(x - 1, y); + colorUnsafe2.R = (byte) ((int) colorUnsafe1.R + (int) colorUnsafe2.R >> 1); + colorUnsafe2.G = (byte) ((int) colorUnsafe1.G + (int) colorUnsafe2.G >> 1); + colorUnsafe2.B = (byte) ((int) colorUnsafe1.B + (int) colorUnsafe2.B >> 1); + if (flag) + WorldView.shine(ref colorUnsafe2, type); + SpriteSheet<_sheetTiles>.Draw(id, ref pos1, ref s1, colorUnsafe2); + pos1.Y += 8f; + s1.Y += 8; + s1.Height = 4; + colorUnsafe2 = this.lighting.GetColorUnsafe(x - 1, y + 1); + colorUnsafe2.R = (byte) ((int) colorUnsafe1.R + (int) colorUnsafe2.R >> 1); + colorUnsafe2.G = (byte) ((int) colorUnsafe1.G + (int) colorUnsafe2.G >> 1); + colorUnsafe2.B = (byte) ((int) colorUnsafe1.B + (int) colorUnsafe2.B >> 1); + if (flag) + WorldView.shine(ref colorUnsafe2, type); + SpriteSheet<_sheetTiles>.Draw(id, ref pos1, ref s1, colorUnsafe2); + pos1.X += 4f; + s1.X += 4; + s1.Width = 8; + colorUnsafe2 = this.lighting.GetColorUnsafe(x, y + 1); + colorUnsafe2.R = (byte) ((int) colorUnsafe1.R + (int) colorUnsafe2.R >> 1); + colorUnsafe2.G = (byte) ((int) colorUnsafe1.G + (int) colorUnsafe2.G >> 1); + colorUnsafe2.B = (byte) ((int) colorUnsafe1.B + (int) colorUnsafe2.B >> 1); + if (flag) + WorldView.shine(ref colorUnsafe2, type); + SpriteSheet<_sheetTiles>.Draw(id, ref pos1, ref s1, colorUnsafe2); + pos1.X += 8f; + s1.X += 8; + s1.Width = 4; + colorUnsafe2 = this.lighting.GetColorUnsafe(x + 1, y + 1); + colorUnsafe2.R = (byte) ((int) colorUnsafe1.R + (int) colorUnsafe2.R >> 1); + colorUnsafe2.G = (byte) ((int) colorUnsafe1.G + (int) colorUnsafe2.G >> 1); + colorUnsafe2.B = (byte) ((int) colorUnsafe1.B + (int) colorUnsafe2.B >> 1); + if (flag) + WorldView.shine(ref colorUnsafe2, type); + SpriteSheet<_sheetTiles>.Draw(id, ref pos1, ref s1, colorUnsafe2); + pos1.X -= 8f; + pos1.Y -= 8f; + s1.X -= 8; + s1.Y -= 8; + s1.Width = 8; + s1.Height = 8; + if (flag) + WorldView.shine(ref colorUnsafe1, type); + SpriteSheet<_sheetTiles>.Draw(id, ref pos1, ref s1, colorUnsafe1); + } + else if ((int) colorUnsafe1.R > 38 || (double) colorUnsafe1.G > 41.7999992370605 || (double) colorUnsafe1.B > 45.6000022888184) + { + s1.Width = 8; + s1.Height = 8; + Color colorUnsafe2 = this.lighting.GetColorUnsafe(x - 1, y - 1); + colorUnsafe2.R = (byte) ((int) colorUnsafe1.R + (int) colorUnsafe2.R >> 1); + colorUnsafe2.G = (byte) ((int) colorUnsafe1.G + (int) colorUnsafe2.G >> 1); + colorUnsafe2.B = (byte) ((int) colorUnsafe1.B + (int) colorUnsafe2.B >> 1); + if (flag) + WorldView.shine(ref colorUnsafe2, type); + SpriteSheet<_sheetTiles>.Draw(id, ref pos1, ref s1, colorUnsafe2); + pos1.X += 8f; + s1.X += 8; + colorUnsafe2 = this.lighting.GetColorUnsafe(x + 1, y - 1); + colorUnsafe2.R = (byte) ((int) colorUnsafe1.R + (int) colorUnsafe2.R >> 1); + colorUnsafe2.G = (byte) ((int) colorUnsafe1.G + (int) colorUnsafe2.G >> 1); + colorUnsafe2.B = (byte) ((int) colorUnsafe1.B + (int) colorUnsafe2.B >> 1); + if (flag) + WorldView.shine(ref colorUnsafe2, type); + SpriteSheet<_sheetTiles>.Draw(id, ref pos1, ref s1, colorUnsafe2); + pos1.Y += 8f; + s1.Y += 8; + colorUnsafe2 = this.lighting.GetColorUnsafe(x + 1, y + 1); + colorUnsafe2.R = (byte) ((int) colorUnsafe1.R + (int) colorUnsafe2.R >> 1); + colorUnsafe2.G = (byte) ((int) colorUnsafe1.G + (int) colorUnsafe2.G >> 1); + colorUnsafe2.B = (byte) ((int) colorUnsafe1.B + (int) colorUnsafe2.B >> 1); + if (flag) + WorldView.shine(ref colorUnsafe2, type); + SpriteSheet<_sheetTiles>.Draw(id, ref pos1, ref s1, colorUnsafe2); + pos1.X -= 8f; + s1.X -= 8; + colorUnsafe2 = this.lighting.GetColorUnsafe(x - 1, y + 1); + colorUnsafe2.R = (byte) ((int) colorUnsafe1.R + (int) colorUnsafe2.R >> 1); + colorUnsafe2.G = (byte) ((int) colorUnsafe1.G + (int) colorUnsafe2.G >> 1); + colorUnsafe2.B = (byte) ((int) colorUnsafe1.B + (int) colorUnsafe2.B >> 1); + if (flag) + WorldView.shine(ref colorUnsafe2, type); + SpriteSheet<_sheetTiles>.Draw(id, ref pos1, ref s1, colorUnsafe2); + } + else + { + if (flag) + WorldView.shine(ref colorUnsafe1, type); + SpriteSheet<_sheetTiles>.Draw(id, ref pos1, ref s1, colorUnsafe1); + } + } + else + { + if (this.SMOOTH_LIGHT && flag) + WorldView.shine(ref colorUnsafe1, type); + SpriteSheet<_sheetTiles>.Draw(id, ref pos1, ref s1, colorUnsafe1); + } + } + } + } + } + while (++y < num2); + } + while (++x < num1); + } + Main.tileSolid[10] = true; + } + + private unsafe void DrawWater(bool bg = false) + { + int num1 = this.evilTiles / 7; + if (num1 > 50) + num1 = 50; + int num2 = 256 - num1; + int num3 = 256 - (num1 << 1); + int x = (int) this.firstTileX; + int num4 = (int) this.lastTileX; + int num5 = (int) this.firstTileY; + int num6 = (int) this.lastTileY; + if (x < 5) + x = 5; + if (num5 < 5) + num5 = 5; + if (num4 > (int) Main.maxTilesX - 5) + num4 = (int) Main.maxTilesX - 5; + if (num6 > (int) Main.maxTilesY - 5) + num6 = (int) Main.maxTilesY - 5; + Vector2 vector2_1 = new Vector2(); + Vector2 vector2_2 = new Vector2(); + Rectangle s1 = new Rectangle(); + Tile[,] tileArray; + // ISSUE: cast to a reference type + // ISSUE: explicit reference operation + fixed (Tile* tilePtr1 = &^((tileArray = Main.tile) == null || tileArray.Length == 0 ? (Tile&) IntPtr.Zero : tileArray.Address(0, 0))) + { + do + { + int num7 = num5; + Tile* tilePtr2 = tilePtr1 + (x * 1440 + num7); + vector2_2.X = (float) (x << 4); + do + { + int num8 = (int) tilePtr2->liquid; + if (num8 > 0 && (bg || (int) tilePtr2->active == 0 || !Main.tileSolidNotSolidTop[(int) tilePtr2->type]) && (bg || this.lighting.IsNotBlackUnsafe(x, num7))) + { + Color colorUnsafe1 = this.lighting.GetColorUnsafe(x, num7); + int id = (int) tilePtr2->lava == 0 ? 14 : 15; + int num9 = bg ? (int) byte.MaxValue : (id == 15 ? 230 : 128); + vector2_2.Y = (float) (num7 << 4); + s1.Width = 16; + Tile* tilePtr3 = tilePtr2 - 1; + if ((int) tilePtr3->liquid == 0) + { + s1.Y = 0; + s1.Height = Math.Max(1, num8 >> 4); + vector2_2.Y += (float) (16 - s1.Height); + } + else + { + s1.Y = 4; + s1.Height = 16; + } + tilePtr2 = tilePtr3 + 1; + if (id == 15 && (int) this.dustLocal.lavaBubbles < 128 && Main.hasFocus) + { + if (num8 > 200 && Main.rand.Next(700) == 0) + this.dustLocal.NewDust(x << 4, num7 << 4, 16, 16, 35, 0.0, 0.0, 0, new Color(), 1.0); + else if (s1.Y == 0 && Main.rand.Next(350) == 0) + { + Dust* dustPtr = this.dustLocal.NewDust(x << 4, (num7 << 4) + (num8 >> 4) - 8, 16, 8, 35, 0.0, 0.0, 50, new Color(), 1.5); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.X *= 1.6f; + dustPtr->velocity.Y *= 0.8f; + dustPtr->velocity.Y -= (float) Main.rand.Next(1, 7) * 0.1f; + if (Main.rand.Next(10) == 0) + dustPtr->velocity.Y *= (float) Main.rand.Next(2, 5); + dustPtr->noGravity = true; + } + } + } + colorUnsafe1.R = (byte) ((int) colorUnsafe1.R * num9 >> 8); + colorUnsafe1.G = (byte) ((int) colorUnsafe1.G * num9 >> 8); + colorUnsafe1.B = (byte) ((int) colorUnsafe1.B * num9 >> 8); + colorUnsafe1.A = (byte) num9; + if (id == 14) + colorUnsafe1.B = (byte) ((int) colorUnsafe1.B * num3 >> 8); + else + colorUnsafe1.R = (byte) ((int) colorUnsafe1.R * num2 >> 8); + Vector2 pos; + if (this.SMOOTH_LIGHT && !bg) + { + Color color = colorUnsafe1; + if (id == 14 && ((int) color.R > 201 || (double) color.G > 221.1 || (double) color.B > 241.2) || ((int) color.R > 226 || (double) color.G > 248.6 || (double) color.B > 271.2)) + { + for (int index = 0; index < 4; ++index) + { + int num10 = 0; + int num11 = 0; + int num12 = 8; + int num13 = 8; + Color colorUnsafe2 = this.lighting.GetColorUnsafe(x, num7); + if (index == 0) + { + if (this.lighting.Brighter(x, num7 - 1, x - 1, num7)) + { + Tile* tilePtr4 = tilePtr2 - 1440; + if ((int) tilePtr4->active == 0) + colorUnsafe2 = this.lighting.GetColorUnsafe(x - 1, num7); + tilePtr2 = tilePtr4 + 1440; + } + else + { + Tile* tilePtr4 = tilePtr2 - 1; + if ((int) tilePtr4->active == 0) + colorUnsafe2 = this.lighting.GetColorUnsafe(x, num7 - 1); + tilePtr2 = tilePtr4 + 1; + } + if (s1.Height < 8) + num13 = s1.Height; + } + else if (index == 1) + { + if (this.lighting.Brighter(x, num7 - 1, x + 1, num7)) + { + if ((int) tilePtr2[1440].active == 0) + colorUnsafe2 = this.lighting.GetColorUnsafe(x + 1, num7); + } + else + { + Tile* tilePtr4 = tilePtr2 - 1; + if ((int) tilePtr4->active == 0) + colorUnsafe2 = this.lighting.GetColorUnsafe(x, num7 - 1); + tilePtr2 = tilePtr4 + 1; + } + num10 = 8; + if (s1.Height < 8) + num13 = s1.Height; + } + else if (index == 2) + { + if (this.lighting.Brighter(x, num7 + 1, x - 1, num7)) + { + Tile* tilePtr4 = tilePtr2 - 1440; + if ((int) tilePtr4->active == 0) + colorUnsafe2 = this.lighting.GetColorUnsafe(x - 1, num7); + tilePtr2 = tilePtr4 + 1440; + } + else + { + Tile* tilePtr4 = tilePtr2 + 1; + if ((int) tilePtr4->active == 0) + colorUnsafe2 = this.lighting.GetColorUnsafe(x, num7 + 1); + tilePtr2 = tilePtr4 - 1; + } + num11 = 8; + num13 = 8 - (16 - s1.Height); + } + else + { + if (this.lighting.Brighter(x, num7 + 1, x + 1, num7)) + { + if ((int) tilePtr2[1440].active == 0) + colorUnsafe2 = this.lighting.GetColorUnsafe(x + 1, num7); + } + else + { + Tile* tilePtr4 = tilePtr2 + 1; + if ((int) tilePtr4->active == 0) + colorUnsafe2 = this.lighting.GetColorUnsafe(x, num7 + 1); + tilePtr2 = tilePtr4 - 1; + } + num10 = 8; + num11 = 8; + num13 = 8 - (16 - s1.Height); + } + colorUnsafe2.R = (byte) ((int) colorUnsafe2.R * num9 + (int) color.R >> 9); + colorUnsafe2.G = (byte) ((int) colorUnsafe2.G * num9 + (int) color.G >> 9); + colorUnsafe2.B = (byte) ((int) colorUnsafe2.B * num9 + (int) color.B >> 9); + colorUnsafe2.A = (byte) num9; + pos = vector2_2; + pos.X -= (float) (this.screenPosition.X - num10 - 32); + pos.Y -= (float) (this.screenPosition.Y - num11 - 32); + Rectangle s2 = s1; + s2.X += num10; + s2.Y += num11; + s2.Width = num12; + s2.Height = num13; + SpriteSheet<_sheetTiles>.Draw(id, ref pos, ref s2, colorUnsafe2); + } + } + else + { + pos = vector2_2; + pos.X -= (float) (this.screenPosition.X - 32); + pos.Y -= (float) (this.screenPosition.Y - 32); + SpriteSheet<_sheetTiles>.Draw(id, ref pos, ref s1, colorUnsafe1); + } + } + else + { + pos = vector2_2; + pos.X -= (float) (this.screenPosition.X - 32); + pos.Y -= (float) (this.screenPosition.Y - 32); + SpriteSheet<_sheetTiles>.Draw(id, ref pos, ref s1, colorUnsafe1); + } + } + ++tilePtr2; + } + while (++num7 < num6); + } + while (++x < num4); + } + } + + private void DrawGore() + { + Vector2 pivot = new Vector2(); + Vector2 pos = new Vector2(); + for (int index = 0; index < 128; ++index) + { + if ((int) Main.gore[index].active != 0) + { + int id = 256 + (int) Main.gore[index].type; + pivot.X = (float) (SpriteSheet<_sheetSprites>.src[id].Width >> 1); + pivot.Y = (float) (SpriteSheet<_sheetSprites>.src[id].Height >> 1); + pos.X = Main.gore[index].position.X + pivot.X; + pos.Y = Main.gore[index].position.Y + pivot.Y; + Color alpha = Main.gore[index].GetAlpha(this.lighting.GetColor((int) pos.X >> 4, (int) pos.Y >> 4)); + pos.X -= (float) this.screenPosition.X; + pos.Y -= (float) this.screenPosition.Y; + SpriteSheet<_sheetSprites>.Draw(id, ref pos, alpha, Main.gore[index].rotation, ref pivot, Main.gore[index].scale); + } + } + } + + private unsafe void DrawNPCs(bool behindTiles = false) + { + bool flag1 = false; + Rectangle rectangle = new Rectangle(); + rectangle.X = this.screenPosition.X - 300; + rectangle.Y = this.screenPosition.Y - 300; + rectangle.Width = (int) this.viewWidth + 600; + rectangle.Height = 1140; + Vector2 pos1 = new Vector2(); + Color c = new Color(); + for (int index1 = 195; index1 >= 0; --index1) + { + int num1 = (int) Main.npc[index1].type; + if (num1 > 0 && (int) Main.npc[index1].active != 0 && Main.npc[index1].behindTiles == behindTiles) + { + if ((num1 == 125 || num1 == 126) && !flag1) + { + flag1 = true; + for (int index2 = 0; index2 < 196; ++index2) + { + if ((int) Main.npc[index2].active != 0 && index1 != index2 && ((int) Main.npc[index2].type == 125 || (int) Main.npc[index2].type == 126)) + { + float num2 = Main.npc[index2].position.X + (float) ((int) Main.npc[index2].width >> 1); + float num3 = Main.npc[index2].position.Y + (float) ((int) Main.npc[index2].height >> 1); + Vector2 vector2 = new Vector2(Main.npc[index1].position.X + (float) ((int) Main.npc[index1].width >> 1), Main.npc[index1].position.Y + (float) ((int) Main.npc[index1].height >> 1)); + float num4 = num2 - vector2.X; + float num5 = num3 - vector2.Y; + float rotCenter = (float) Math.Atan2((double) num5, (double) num4) - 1.57f; + bool flag2 = true; + if ((double) num4 * (double) num4 + (double) num5 * (double) num5 > 4000000.0) + flag2 = false; + while (flag2) + { + float num6 = (float) ((double) num4 * (double) num4 + (double) num5 * (double) num5); + if ((double) num6 < 1600.0) + { + flag2 = false; + } + else + { + float num7 = (float) SpriteSheet<_sheetSprites>.src[197].Height / (float) Math.Sqrt((double) num6); + float num8 = num4 * num7; + float num9 = num5 * num7; + vector2.X += num8; + vector2.Y += num9; + num4 = num2 - vector2.X; + num5 = num3 - vector2.Y; + pos1 = vector2; + pos1.X -= (float) this.screenPosition.X; + pos1.Y -= (float) this.screenPosition.Y; + SpriteSheet<_sheetSprites>.DrawRotated(197, ref pos1, this.lighting.GetColor((int) vector2.X >> 4, (int) vector2.Y >> 4), rotCenter); + } + } + } + } + } + if (rectangle.Intersects(Main.npc[index1].aabb)) + { + if (num1 == 101) + { + bool flag2 = true; + Vector2 vector2 = new Vector2(Main.npc[index1].position.X + (float) ((int) Main.npc[index1].width >> 1), Main.npc[index1].position.Y + (float) ((int) Main.npc[index1].height >> 1)); + float num2 = (float) ((double) Main.npc[index1].ai0 * 16.0 + 8.0) - vector2.X; + float num3 = (float) ((double) Main.npc[index1].ai1 * 16.0 + 8.0) - vector2.Y; + float rot = (float) Math.Atan2((double) num3, (double) num2) - 1.57f; + bool flag3 = true; + do + { + float scale = 0.75f; + int sh = 28; + float num4 = (float) Math.Sqrt((double) num2 * (double) num2 + (double) num3 * (double) num3); + if ((double) num4 < 28.0 * (double) scale) + { + sh = (int) num4 - 40 + 28; + flag3 = false; + } + float num5 = 20f * scale / num4; + float num6 = num2 * num5; + float num7 = num3 * num5; + vector2.X += num6; + vector2.Y += num7; + num2 = (float) ((double) Main.npc[index1].ai0 * 16.0 + 8.0) - vector2.X; + num3 = (float) ((double) Main.npc[index1].ai1 * 16.0 + 8.0) - vector2.Y; + pos1 = vector2; + pos1.X -= (float) this.screenPosition.X; + pos1.Y -= (float) this.screenPosition.Y; + SpriteSheet<_sheetSprites>.Draw(flag2 ? 196 : 195, ref pos1, sh, this.lighting.GetColor((int) vector2.X >> 4, (int) vector2.Y >> 4), rot, scale); + flag2 = !flag2; + } + while (flag3); + } + else if ((int) Main.npc[index1].aiStyle == 13) + { + Vector2 vector2 = new Vector2(Main.npc[index1].position.X + (float) ((int) Main.npc[index1].width >> 1), Main.npc[index1].position.Y + (float) ((int) Main.npc[index1].height >> 1)); + float num2 = (float) ((double) Main.npc[index1].ai0 * 16.0 + 8.0) - vector2.X; + float num3 = (float) ((double) Main.npc[index1].ai1 * 16.0 + 8.0) - vector2.Y; + float rotCenter = (float) Math.Atan2((double) num3, (double) num2) - 1.57f; + bool flag2 = true; + do + { + float num4 = (float) Math.Sqrt((double) num2 * (double) num2 + (double) num3 * (double) num3); + if ((double) num4 < 40.0) + flag2 = false; + float num5 = 28f / num4; + float num6 = num2 * num5; + float num7 = num3 * num5; + vector2.X += num6; + vector2.Y += num7; + num2 = (float) ((double) Main.npc[index1].ai0 * 16.0 + 8.0) - vector2.X; + num3 = (float) ((double) Main.npc[index1].ai1 * 16.0 + 8.0) - vector2.Y; + pos1 = vector2; + pos1.X -= (float) this.screenPosition.X; + pos1.Y -= (float) this.screenPosition.Y; + SpriteSheet<_sheetSprites>.DrawRotated(num1 == 56 ? 190 : 189, ref pos1, this.lighting.GetColor((int) vector2.X >> 4, (int) vector2.Y >> 4), rotCenter); + } + while (flag2); + } + if (num1 == 36) + { + Vector2 vector2 = new Vector2((float) ((double) Main.npc[index1].position.X + (double) ((int) Main.npc[index1].width >> 1) - 5.0 * (double) Main.npc[index1].ai0), Main.npc[index1].position.Y + 20f); + for (int index2 = 0; index2 < 2; ++index2) + { + float num2 = Main.npc[(int) Main.npc[index1].ai1].position.X + (float) ((int) Main.npc[(int) Main.npc[index1].ai1].width >> 1) - vector2.X; + float num3 = Main.npc[(int) Main.npc[index1].ai1].position.Y + (float) ((int) Main.npc[(int) Main.npc[index1].ai1].height >> 1) - vector2.Y; + float num4; + float num5; + float num6; + if (index2 == 0) + { + num4 = num2 - 200f * Main.npc[index1].ai0; + num5 = num3 + 130f; + num6 = 92f / (float) Math.Sqrt((double) num4 * (double) num4 + (double) num5 * (double) num5); + } + else + { + num4 = num2 - 50f * Main.npc[index1].ai0; + num5 = num3 + 80f; + num6 = 60f / (float) Math.Sqrt((double) num4 * (double) num4 + (double) num5 * (double) num5); + } + vector2.X += num4 * num6; + vector2.Y += num5 * num6; + pos1.X = vector2.X - (float) this.screenPosition.X; + pos1.Y = vector2.Y - (float) this.screenPosition.Y; + SpriteSheet<_sheetSprites>.DrawRotated(3, ref pos1, this.lighting.GetColor((int) vector2.X >> 4, (int) vector2.Y >> 4), (float) Math.Atan2((double) num5, (double) num4) - 1.57f); + if (index2 == 0) + { + vector2.X += (float) ((double) num4 * (double) num6 * 0.5); + vector2.Y += (float) ((double) num5 * (double) num6 * 0.5); + } + else if (Main.hasFocus) + { + vector2.X += (float) ((double) num4 * (double) num6 - 16.0); + vector2.Y += (float) ((double) num5 * (double) num6 - 6.0); + Dust* dustPtr = this.dustLocal.NewDust((int) vector2.X, (int) vector2.Y, 30, 10, 5, (double) num4 * 0.0199999995529652, (double) num5 * 0.0199999995529652, 0, new Color(), 2.0); + if ((IntPtr) dustPtr != IntPtr.Zero) + dustPtr->noGravity = true; + } + } + } + if ((int) Main.npc[index1].aiStyle >= 33 && (int) Main.npc[index1].aiStyle <= 36) + { + Vector2 vector2 = new Vector2((float) ((double) Main.npc[index1].position.X + (double) ((int) Main.npc[index1].width >> 1) - 5.0 * (double) Main.npc[index1].ai0), Main.npc[index1].position.Y + 20f); + for (int index2 = 0; index2 < 2; ++index2) + { + float num2 = Main.npc[(int) Main.npc[index1].ai1].position.X + (float) ((int) Main.npc[(int) Main.npc[index1].ai1].width >> 1) - vector2.X; + float num3 = Main.npc[(int) Main.npc[index1].ai1].position.Y + (float) ((int) Main.npc[(int) Main.npc[index1].ai1].height >> 1) - vector2.Y; + float num4; + float num5; + float num6; + if (index2 == 0) + { + num4 = num2 - 200f * Main.npc[index1].ai0; + num5 = num3 + 130f; + num6 = 92f / (float) Math.Sqrt((double) num4 * (double) num4 + (double) num5 * (double) num5); + } + else + { + num4 = num2 - 50f * Main.npc[index1].ai0; + num5 = num3 + 80f; + num6 = 60f / (float) Math.Sqrt((double) num4 * (double) num4 + (double) num5 * (double) num5); + } + vector2.X += num4 * num6; + vector2.Y += num5 * num6; + pos1.X = vector2.X - (float) this.screenPosition.X; + pos1.Y = vector2.Y - (float) this.screenPosition.Y; + SpriteSheet<_sheetSprites>.DrawRotated(4, ref pos1, this.lighting.GetColor((int) vector2.X >> 4, (int) vector2.Y >> 4), (float) Math.Atan2((double) num5, (double) num4) - 1.57f); + if (index2 == 0) + { + vector2.X += (float) ((double) num4 * (double) num6 * 0.5); + vector2.Y += (float) ((double) num5 * (double) num6 * 0.5); + } + else if (Main.hasFocus) + { + vector2.X += (float) ((double) num4 * (double) num6 - 16.0); + vector2.Y += (float) ((double) num5 * (double) num6 - 6.0); + Dust* dustPtr = this.dustLocal.NewDust((int) vector2.X, (int) vector2.Y, 30, 10, 6, (double) num4 * 0.0199999995529652, (double) num5 * 0.0199999995529652, 0, new Color(), 2.5); + if ((IntPtr) dustPtr != IntPtr.Zero) + dustPtr->noGravity = true; + } + } + } + else if ((int) Main.npc[index1].aiStyle == 20) + { + Vector2 vector2 = new Vector2(Main.npc[index1].position.X + (float) ((int) Main.npc[index1].width >> 1), Main.npc[index1].position.Y + (float) ((int) Main.npc[index1].height >> 1)); + float num2 = Main.npc[index1].ai1 - vector2.X; + float num3 = Main.npc[index1].ai2 - vector2.Y; + float rot = (float) Math.Atan2((double) num3, (double) num2) - 1.57f; + Main.npc[index1].rotation = rot; + bool flag2 = true; + while (flag2) + { + int sh = 12; + float num4 = (float) Math.Sqrt((double) num2 * (double) num2 + (double) num3 * (double) num3); + if ((double) num4 < 20.0) + { + sh = (int) num4 - 20 + 12; + flag2 = false; + } + float num5 = 12f / num4; + float num6 = num2 * num5; + float num7 = num3 * num5; + vector2.X += num6; + vector2.Y += num7; + num2 = Main.npc[index1].ai1 - vector2.X; + num3 = Main.npc[index1].ai2 - vector2.Y; + pos1 = vector2; + pos1.X -= (float) this.screenPosition.X; + pos1.Y -= (float) this.screenPosition.Y; + SpriteSheet<_sheetSprites>.Draw(198, ref pos1, sh, this.lighting.GetColor((int) vector2.X >> 4, (int) vector2.Y >> 4), rot, 1f); + } + pos1.X = Main.npc[index1].ai1 - (float) this.screenPosition.X; + pos1.Y = Main.npc[index1].ai2 - (float) this.screenPosition.Y; + SpriteSheet<_sheetSprites>.DrawRotated(1474, ref pos1, this.lighting.GetColor((int) Main.npc[index1].ai1 >> 4, (int) Main.npc[index1].ai2 >> 4), rot - 0.75f); + } + Color newColor = this.lighting.GetColor(Main.npc[index1].aabb.X + ((int) Main.npc[index1].width >> 1) >> 4, Main.npc[index1].aabb.Y + ((int) Main.npc[index1].height >> 1) >> 4); + if (behindTiles && num1 != 113 && num1 != 114) + { + int num2 = Main.npc[index1].aabb.X - 8 >> 4; + int num3 = Main.npc[index1].aabb.X + (int) Main.npc[index1].width + 8 >> 4; + int num4 = Main.npc[index1].aabb.Y - 8 >> 4; + int num5 = Main.npc[index1].aabb.Y + (int) Main.npc[index1].height + 8 >> 4; + for (int x = num2; x <= num3; ++x) + { + for (int y = num4; y <= num5; ++y) + { + if ((double) this.lighting.Brightness(x, y) == 0.0) + { + newColor.PackedValue = 4278190080U; + goto label_64; + } + } + } + } +label_64: + if (Main.npc[index1].poisoned) + Player.buffColor(ref newColor, 0.65, 1.0, 0.75); + if (this.player.detectCreature && Main.npc[index1].lifeMax > 1) + { + if ((int) newColor.R < 150) + { + newColor.A = UI.mouseTextBrightness; + if ((int) newColor.R < 50) + newColor.R = (byte) 50; + } + if ((int) newColor.G < 200) + newColor.G = (byte) 200; + if ((int) newColor.B < 100) + newColor.B = (byte) 100; + if (Main.hasFocus && Main.rand.Next(52) == 0) + { + Dust* dustPtr = this.dustLocal.NewDust(Main.npc[index1].aabb.X, Main.npc[index1].aabb.Y, (int) Main.npc[index1].width, (int) Main.npc[index1].height, 15, 0.0, 0.0, 150, new Color(), 0.800000011920929); + if ((IntPtr) dustPtr != IntPtr.Zero) + { + dustPtr->velocity.X *= 0.1f; + dustPtr->velocity.Y *= 0.1f; + dustPtr->noLight = true; + } + } + } + if (num1 == 50) + { + Vector2 vector2 = new Vector2(); + vector2.Y = -Main.npc[index1].velocity.Y; + vector2.X = Main.npc[index1].velocity.X * -2f; + float rotCenter = Main.npc[index1].velocity.X * 0.05f; + if ((int) Main.npc[index1].frameY == 120) + vector2.Y += 2f; + else if ((int) Main.npc[index1].frameY == 360) + vector2.Y -= 2f; + else if ((int) Main.npc[index1].frameY == 480) + vector2.Y -= 6f; + pos1.X = Main.npc[index1].position.X - (float) this.screenPosition.X + (float) ((int) Main.npc[index1].width >> 1) + vector2.X; + pos1.Y = Main.npc[index1].position.Y - (float) this.screenPosition.Y + (float) ((int) Main.npc[index1].height >> 1) + vector2.Y; + SpriteSheet<_sheetSprites>.DrawRotated(1088, ref pos1, newColor, rotCenter); + } + else if (num1 == 71) + { + Vector2 vector2 = new Vector2(); + vector2.Y = Main.npc[index1].velocity.Y * -0.3f; + vector2.X = Main.npc[index1].velocity.X * -0.6f; + float rotCenter = Main.npc[index1].velocity.X * 0.09f; + if ((int) Main.npc[index1].frameY == 120) + vector2.Y += 2f; + else if ((int) Main.npc[index1].frameY == 360) + vector2.Y -= 2f; + else if ((int) Main.npc[index1].frameY == 480) + vector2.Y -= 6f; + pos1.X = Main.npc[index1].position.X - (float) this.screenPosition.X + (float) ((int) Main.npc[index1].width >> 1) + vector2.X; + pos1.Y = Main.npc[index1].position.Y - (float) this.screenPosition.Y + (float) ((int) Main.npc[index1].height >> 1) + vector2.Y; + SpriteSheet<_sheetSprites>.DrawRotated(778, ref pos1, newColor, rotCenter); + } + else if (num1 == 69 || num1 == 147) + { + pos1.X = Main.npc[index1].position.X - (float) this.screenPosition.X + (float) ((int) Main.npc[index1].width >> 1); + pos1.Y = (float) ((double) Main.npc[index1].position.Y - (double) this.screenPosition.Y + (double) Main.npc[index1].height + 14.0); + SpriteSheet<_sheetSprites>.DrawRotated(num1 == 69 ? 2 : 0, ref pos1, newColor, (float) (-(double) Main.npc[index1].rotation * 0.300000011920929)); + } + float num8 = 0.0f; + float num9 = 0.0f; + int num10 = SpriteSheet<_sheetSprites>.src[1088 + num1].Width; + Vector2 pivot = new Vector2(); + pivot.X = (float) (num10 >> 1); + pivot.Y = (float) ((int) Main.npc[index1].frameHeight >> 1); + switch (num1) + { + case 134: + case 135: + case 136: + num9 = 30f; + break; + case 159: + case 160: + case 161: + case 162: + case 163: + case 164: + case 87: + case 88: + case 89: + case 90: + case 91: + case 92: + num9 = 56f; + break; + case 166: + pivot.Y *= 0.5f; + break; + case 108: + case 124: + num8 = 2f; + break; + case 125: + case 126: + pivot = new Vector2(55f, 107f); + num9 = 30f; + break; + case 48: + num9 = 32f; + break; + case 49: + case 51: + num9 = 4f; + break; + case 60: + num9 = 10f; + break; + case 62: + case 65: + case 66: + num9 = 14f; + break; + case 63: + case 64: + case 103: + num9 = 4f; + pivot.Y += 4f; + break; + case 69: + num9 = 4f; + pivot.Y += 8f; + break; + case 70: + num9 = -4f; + break; + case 72: + num9 = -2f; + break; + case 83: + case 84: + num9 = 20f; + break; + case 94: + num9 = 14f; + break; + case 95: + case 96: + case 97: + case 98: + case 99: + case 100: + case 7: + case 8: + case 9: + num9 = 13f; + break; + case 4: + pivot.Y = 107f; + break; + case 6: + case 13: + case 14: + case 15: + case 39: + case 40: + case 41: + num9 = 26f; + break; + case 10: + case 11: + case 12: + num9 = 8f; + break; + } + float num11 = num9 * Main.npc[index1].scale; + pos1 = new Vector2((float) ((double) Main.npc[index1].position.X - (double) this.screenPosition.X + (double) ((int) Main.npc[index1].width >> 1) - (double) num10 * (double) Main.npc[index1].scale * 0.5 + (double) pivot.X * (double) Main.npc[index1].scale), (float) ((double) Main.npc[index1].position.Y - (double) this.screenPosition.Y + (double) Main.npc[index1].height - (double) Main.npc[index1].frameHeight * (double) Main.npc[index1].scale + 4.0 + (double) pivot.Y * (double) Main.npc[index1].scale) + num11 + num8); + if ((int) Main.npc[index1].aiStyle == 10 || num1 == 72) + newColor = Color.White; + SpriteEffects e = (int) Main.npc[index1].spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + if (num1 == 83 || num1 == 84 || num1 == 151) + SpriteSheet<_sheetSprites>.Draw(1088 + num1, ref pos1, (int) Main.npc[index1].frameY, (int) Main.npc[index1].frameHeight, Color.White, Main.npc[index1].rotation, ref pivot, Main.npc[index1].scale, e); + else if (num1 >= 87 && num1 <= 92 || num1 >= 159 && num1 <= 164) + { + c = Main.npc[index1].GetAlpha(newColor); + byte num2 = (byte) (((int) this.time.tileColor.R + (int) this.time.tileColor.G + (int) this.time.tileColor.B) / 3); + if ((int) c.R < (int) num2) + c.R = num2; + if ((int) c.G < (int) num2) + c.G = num2; + if ((int) c.B < (int) num2) + c.B = num2; + SpriteSheet<_sheetSprites>.Draw(1088 + num1, ref pos1, (int) Main.npc[index1].frameY, (int) Main.npc[index1].frameHeight, c, Main.npc[index1].rotation, ref pivot, Main.npc[index1].scale, e); + } + else + { + if (num1 == 94) + { + int index2 = 1; + while (index2 < 6) + { + c = Main.npc[index1].GetAlpha(newColor); + c.R = (byte) ((int) c.R * (10 - index2) / 15); + c.G = (byte) ((int) c.G * (10 - index2) / 15); + c.B = (byte) ((int) c.B * (10 - index2) / 15); + c.A = (byte) ((int) c.A * (10 - index2) / 15); + pos1 = new Vector2((float) ((double) Main.npc[index1].oldPos[index2].X - (double) this.screenPosition.X + (double) ((int) Main.npc[index1].width >> 1) - (double) num10 * (double) Main.npc[index1].scale * 0.5 + (double) pivot.X * (double) Main.npc[index1].scale), (float) ((double) Main.npc[index1].oldPos[index2].Y - (double) this.screenPosition.Y + (double) Main.npc[index1].height - (double) Main.npc[index1].frameHeight * (double) Main.npc[index1].scale + 4.0 + (double) pivot.Y * (double) Main.npc[index1].scale) + num11); + SpriteSheet<_sheetSprites>.Draw(1088 + num1, ref pos1, (int) Main.npc[index1].frameY, (int) Main.npc[index1].frameHeight, c, Main.npc[index1].rotation, ref pivot, Main.npc[index1].scale, e); + index2 += 2; + } + } + else if (num1 == 125 || num1 == 126 || (num1 == (int) sbyte.MaxValue || num1 == 128) || (num1 == 129 || num1 == 130 || (num1 == 131 || num1 == 139)) || num1 == 140) + { + int index2 = 9; + while (index2 >= 0) + { + c = Main.npc[index1].GetAlpha(newColor); + c.R = (byte) ((int) c.R * (10 - index2) / 20); + c.G = (byte) ((int) c.G * (10 - index2) / 20); + c.B = (byte) ((int) c.B * (10 - index2) / 20); + c.A = (byte) ((int) c.A * (10 - index2) / 20); + pos1 = new Vector2((float) ((double) Main.npc[index1].oldPos[index2].X - (double) this.screenPosition.X + (double) ((int) Main.npc[index1].width >> 1) - (double) num10 * (double) Main.npc[index1].scale * 0.5 + (double) pivot.X * (double) Main.npc[index1].scale), (float) ((double) Main.npc[index1].oldPos[index2].Y - (double) this.screenPosition.Y + (double) Main.npc[index1].height - (double) Main.npc[index1].frameHeight * (double) Main.npc[index1].scale + 4.0 + (double) pivot.Y * (double) Main.npc[index1].scale) + num11); + SpriteSheet<_sheetSprites>.Draw(1088 + num1, ref pos1, (int) Main.npc[index1].frameY, (int) Main.npc[index1].frameHeight, c, Main.npc[index1].rotation, ref pivot, Main.npc[index1].scale, e); + index2 -= 2; + } + } + SpriteSheet<_sheetSprites>.Draw(1088 + num1, ref pos1, (int) Main.npc[index1].frameY, (int) Main.npc[index1].frameHeight, Main.npc[index1].GetAlpha(newColor), Main.npc[index1].rotation, ref pivot, Main.npc[index1].scale, e); + if ((int) Main.npc[index1].color.PackedValue != 0) + SpriteSheet<_sheetSprites>.Draw(1088 + num1, ref pos1, (int) Main.npc[index1].frameY, (int) Main.npc[index1].frameHeight, Main.npc[index1].GetColor(newColor), Main.npc[index1].rotation, ref pivot, Main.npc[index1].scale, e); + if (Main.npc[index1].confused) + { + Vector2 pos2 = pos1; + pos2.Y -= (float) (SpriteSheet<_sheetSprites>.src[203].Height + 20); + c.PackedValue = 1190853370U; + SpriteSheet<_sheetSprites>.Draw(203, ref pos2, c, Main.npc[index1].velocity.X * -0.05f, UI.essScale + 0.2f); + } + if (num1 == 125) + { + c.PackedValue = 16777215U; + SpriteSheet<_sheetSprites>.Draw(220, ref pos1, (int) Main.npc[index1].frameY, (int) Main.npc[index1].frameHeight, c, Main.npc[index1].rotation, ref pivot, Main.npc[index1].scale, e); + } + else if (num1 == 139) + { + c.PackedValue = 16777215U; + SpriteSheet<_sheetSprites>.Draw(1349, ref pos1, (int) Main.npc[index1].frameY, (int) Main.npc[index1].frameHeight, c, Main.npc[index1].rotation, ref pivot, Main.npc[index1].scale, e); + } + else if (num1 == (int) sbyte.MaxValue) + { + c.PackedValue = 13158600U; + SpriteSheet<_sheetSprites>.Draw(137, ref pos1, (int) Main.npc[index1].frameY, (int) Main.npc[index1].frameHeight, c, Main.npc[index1].rotation, ref pivot, Main.npc[index1].scale, e); + } + else if (num1 == 131) + { + c.PackedValue = 13158600U; + SpriteSheet<_sheetSprites>.Draw(138, ref pos1, (int) Main.npc[index1].frameY, (int) Main.npc[index1].frameHeight, c, Main.npc[index1].rotation, ref pivot, Main.npc[index1].scale, e); + } + else if (num1 == 120 || num1 == 154) + { + for (int index2 = 1; index2 < Main.npc[index1].oldPos.Length; ++index2) + { + c.R = (byte) (150 * (10 - index2) / 15); + c.G = (byte) (100 * (10 - index2) / 15); + c.B = (byte) (150 * (10 - index2) / 15); + c.A = (byte) (50 * (10 - index2) / 15); + pos1 = new Vector2((float) ((double) Main.npc[index1].oldPos[index2].X - (double) this.screenPosition.X + (double) ((int) Main.npc[index1].width >> 1) - (double) num10 * (double) Main.npc[index1].scale * 0.5 + (double) pivot.X * (double) Main.npc[index1].scale), (float) ((double) Main.npc[index1].oldPos[index2].Y - (double) this.screenPosition.Y + (double) Main.npc[index1].height - (double) Main.npc[index1].frameHeight * (double) Main.npc[index1].scale + 4.0 + (double) pivot.Y * (double) Main.npc[index1].scale) + num11); + SpriteSheet<_sheetSprites>.Draw(199, ref pos1, (int) Main.npc[index1].frameY, (int) Main.npc[index1].frameHeight, c, Main.npc[index1].rotation, ref pivot, Main.npc[index1].scale, e); + } + } + else if (num1 >= 134 && num1 <= 136) + { + if ((int) newColor.PackedValue != -16777216) + { + c.PackedValue = 16777215U; + SpriteSheet<_sheetSprites>.Draw(214 + num1 - 134, ref pos1, (int) Main.npc[index1].frameY, (int) Main.npc[index1].frameHeight, c, Main.npc[index1].rotation, ref pivot, Main.npc[index1].scale, e); + } + } + else if (num1 == 137 || num1 == 138) + { + for (int index2 = 1; index2 < Main.npc[index1].oldPos.Length; ++index2) + { + c.R = (byte) (150 * (10 - index2) / 15); + c.G = (byte) (100 * (10 - index2) / 15); + c.B = (byte) (150 * (10 - index2) / 15); + c.A = (byte) (50 * (10 - index2) / 15); + pos1 = new Vector2((float) ((double) Main.npc[index1].oldPos[index2].X - (double) this.screenPosition.X + (double) ((int) Main.npc[index1].width >> 1) - (double) num10 * (double) Main.npc[index1].scale * 0.5 + (double) pivot.X * (double) Main.npc[index1].scale), (float) ((double) Main.npc[index1].oldPos[index2].Y - (double) this.screenPosition.Y + (double) Main.npc[index1].height - (double) Main.npc[index1].frameHeight * (double) Main.npc[index1].scale + 4.0 + (double) pivot.Y * (double) Main.npc[index1].scale) + num11); + SpriteSheet<_sheetSprites>.Draw(1088 + num1, ref pos1, (int) Main.npc[index1].frameY, (int) Main.npc[index1].frameHeight, c, Main.npc[index1].rotation, ref pivot, Main.npc[index1].scale, e); + } + } + else if (num1 == 82) + { + SpriteSheet<_sheetSprites>.Draw(1488, ref pos1, (int) Main.npc[index1].frameY, (int) Main.npc[index1].frameHeight, new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue), Main.npc[index1].rotation, ref pivot, Main.npc[index1].scale, e); + for (int index2 = 1; index2 < 10; ++index2) + { + Vector2 pos2 = pos1 - Main.npc[index1].velocity * ((float) index2 * 0.5f); + SpriteSheet<_sheetSprites>.Draw(1488, ref pos2, (int) Main.npc[index1].frameY, (int) Main.npc[index1].frameHeight, new Color(110 - index2 * 10, 110 - index2 * 10, 110 - index2 * 10, 110 - index2 * 10), Main.npc[index1].rotation, ref pivot, Main.npc[index1].scale, e); + } + } + } + } + } + } + } + + private void DrawWoF() + { + Vector2 pos = new Vector2(); + if (NPC.wof < 0 || !this.player.horrified) + return; + float num1 = Main.npc[NPC.wof].position.X + (float) ((int) Main.npc[NPC.wof].width >> 1); + float num2 = Main.npc[NPC.wof].position.Y + (float) ((int) Main.npc[NPC.wof].height >> 1); + for (int index = 0; index < 8; ++index) + { + if ((int) Main.player[index].active != 0 && Main.player[index].tongued && !Main.player[index].dead) + { + Vector2 vector2 = new Vector2(Main.player[index].position.X + 10f, Main.player[index].position.Y + 21f); + float num3 = num1 - vector2.X; + float num4 = num2 - vector2.Y; + float rotCenter = (float) Math.Atan2((double) num4, (double) num3) - 1.57f; + bool flag = true; + do + { + float num5 = (float) ((double) num3 * (double) num3 + (double) num4 * (double) num4); + if ((double) num5 < 1600.0) + { + flag = false; + } + else + { + float num6 = (float) SpriteSheet<_sheetSprites>.src[197].Height / (float) Math.Sqrt((double) num5); + float num7 = num3 * num6; + float num8 = num4 * num6; + vector2.X += num7; + vector2.Y += num8; + num3 = num1 - vector2.X; + num4 = num2 - vector2.Y; + pos = vector2; + pos.X -= (float) this.screenPosition.X; + pos.Y -= (float) this.screenPosition.Y; + SpriteSheet<_sheetSprites>.DrawRotated(197, ref pos, this.lighting.GetColor((int) vector2.X >> 4, (int) vector2.Y >> 4), rotCenter); + } + } + while (flag); + } + } + float num9 = (float) (NPC.wofB - NPC.wofT); + for (int index = 0; index < 196; ++index) + { + if ((int) Main.npc[index].active != 0 && (int) Main.npc[index].aiStyle == 29) + { + bool flag1 = (double) Main.npc[index].frameCounter > 7.0; + float num3 = (float) NPC.wofT + num9 * Main.npc[index].ai0; + Vector2 vector2 = new Vector2(Main.npc[index].position.X + (float) ((int) Main.npc[index].width >> 1), Main.npc[index].position.Y + (float) ((int) Main.npc[index].height >> 1)); + float num4 = num1 - vector2.X; + float num5 = num3 - vector2.Y; + float rotCenter = (float) Math.Atan2((double) num5, (double) num4) - 1.57f; + bool flag2 = true; + while (flag2) + { + SpriteEffects se = SpriteEffects.None; + if (flag1) + { + se = SpriteEffects.FlipHorizontally; + flag1 = false; + } + else + flag1 = true; + float num6 = (float) Math.Sqrt((double) num4 * (double) num4 + (double) num5 * (double) num5); + if ((double) num6 < 40.0) + flag2 = false; + float num7 = 28f / num6; + float num8 = num4 * num7; + float num10 = num5 * num7; + vector2.X += num8; + vector2.Y += num10; + num4 = num1 - vector2.X; + num5 = num3 - vector2.Y; + pos = vector2; + pos.X -= (float) this.screenPosition.X; + pos.Y -= (float) this.screenPosition.Y; + SpriteSheet<_sheetSprites>.Draw(197, ref pos, this.lighting.GetColor((int) vector2.X >> 4, (int) vector2.Y >> 4), rotCenter, se); + } + } + } + int num11 = 140; + float num12 = (float) NPC.wofT; + float num13 = (float) NPC.wofB; + float num14 = (float) (this.screenPosition.Y + 540); + float num15 = (float) ((int) (((double) num12 - (double) this.screenPosition.Y) / (double) num11) + 1) * (float) num11; + if ((double) num15 > 0.0) + num12 -= num15; + float num16 = num12; + float num17 = Main.npc[NPC.wof].position.X; + float num18 = num14 - num12; + SpriteEffects e = SpriteEffects.None; + if ((int) Main.npc[NPC.wof].spriteDirection == 1) + e = SpriteEffects.FlipHorizontally; + if ((int) Main.npc[NPC.wof].direction > 0) + num17 -= 80f; + int num19 = 0; + if (++NPC.wofF > 12) + { + num19 = 280; + if (NPC.wofF > 17) + NPC.wofF = 0; + } + else if (NPC.wofF > 6) + num19 = 140; + do + { + float num3 = num14 - num16; + if ((double) num3 > (double) num11) + num3 = (float) num11; + int num4 = 0; + int num5 = SpriteSheet<_sheetSprites>.src[1483].Width; + do + { + int x = (int) num17 + (num5 >> 1) >> 4; + int y = (int) num16 + num4 >> 4; + pos.X = num17 - (float) this.screenPosition.X; + pos.Y = num16 + (float) num4 - (float) this.screenPosition.Y; + SpriteSheet<_sheetSprites>.Draw(1483, ref pos, num19 + num4, 16, this.lighting.GetColor(x, y), e); + num4 += 16; + } + while ((double) num4 < (double) num3); + num16 += (float) num11; + } + while ((double) num16 < (double) num14); + } + + public void DrawNPCHouse() + { + for (int index1 = 0; index1 < 196; ++index1) + { + if ((int) Main.npc[index1].active != 0 && Main.npc[index1].townNPC && (!Main.npc[index1].homeless && (int) Main.npc[index1].homeTileX > 0) && ((int) Main.npc[index1].homeTileY > 0 && (int) Main.npc[index1].type != 37)) + { + int x = (int) Main.npc[index1].homeTileX; + int index2 = (int) Main.npc[index1].homeTileY - 1; + while ((int) Main.tile[x, index2].active == 0 || !Main.tileSolid[(int) Main.tile[x, index2].type]) + { + --index2; + if (index2 < 10) + break; + } + int num1 = 18; + if ((int) Main.tile[x, index2].type == 19) + num1 -= 8; + int y = index2 + 1; + Color color = this.lighting.GetColor(x, y); + SpriteSheet<_sheetSprites>.Draw(439, (x << 4) - this.screenPosition.X + 8 - 16, (y << 4) - this.screenPosition.Y + num1 - 20, color); + int id = Main.npc[index1].getHeadTextureId() + 1255; + float scaleCenter = 1f; + float num2 = (float) SpriteSheet<_sheetSprites>.src[id].Height; + if ((double) SpriteSheet<_sheetSprites>.src[id].Width > (double) num2) + num2 = (float) SpriteSheet<_sheetSprites>.src[id].Width; + if ((double) num2 > 24.0) + scaleCenter = 24f / num2; + SpriteSheet<_sheetSprites>.DrawScaled(id, (x << 4) - this.screenPosition.X + 8, (y << 4) - this.screenPosition.Y + num1 + 2, scaleCenter, color); + } + } + } + + public void DrawGrid() + { + int num1 = (this.screenPosition.X & -16) - this.screenPosition.X; + int num2 = (this.screenPosition.Y & -16) - this.screenPosition.Y; + int num3 = (int) this.viewWidth >> 5; + Color c = new Color(100, 100, 100, 15); + for (int index1 = 0; index1 <= num3; ++index1) + { + for (int index2 = 0; index2 <= 16; ++index2) + SpriteSheet<_sheetSprites>.Draw(431, (index1 << 6) + num1, (index2 << 6) + num2, c); + } + } + + public unsafe void spawnSnow() + { + if (this.snowTiles <= 1024 || this.player.aabb.Y >= Main.worldSurfacePixels || (int) this.dustLocal.snowDust >= 32) + return; + int upperBound = 4096 / this.snowTiles; + if (Main.rand.Next(upperBound) != 0) + return; + int num = Main.rand.Next((int) this.viewWidth + 32) - 16; + int Y = this.screenPosition.Y; + if (num < 0 || num > 960) + Y += Main.rand.Next(270) + 54; + Dust* dustPtr = this.dustLocal.NewDust(num + this.screenPosition.X, Y, 10, 10, 76, 0.0, 0.0, 0, new Color(), 1.0); + if ((IntPtr) dustPtr == IntPtr.Zero) + return; + dustPtr->velocity.X = Cloud.windSpeed + (float) Main.rand.Next(-10, 10) * 0.1f; + dustPtr->velocity.Y = (float) (3.0 + (double) Main.rand.Next(30) * 0.100000001490116 * (double) dustPtr->scale); + } + + public enum Type + { + FULLSCREEN, + TOP_LEFT, + TOP_RIGHT, + BOTTOM_LEFT, + BOTTOM_RIGHT, + TOP, + BOTTOM, + NONE, + } + + private struct Spec + { + public short X; + public short Y; + public Color tileColor; + } + } +} diff --git a/ToStringExtensions.cs b/ToStringExtensions.cs new file mode 100644 index 0000000..b00e805 --- /dev/null +++ b/ToStringExtensions.cs @@ -0,0 +1,562 @@ +// Type: ToStringExtensions +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using System; +using System.Globalization; + +internal static class ToStringExtensions +{ + private static readonly string[] _cache = new string[256] + { + "0", + "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" + }; + private static readonly string[] _cacheStack = new string[251] + { + null, + null, + " (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)" + }; + private const int _top = 255; + private const int _topStack = 250; + + static ToStringExtensions() + { + } + + public static string ToStringLookup(this int value) + { + if (value >= 0 && value <= (int) byte.MaxValue) + return ToStringExtensions._cache[value]; + else + return value.ToString((IFormatProvider) CultureInfo.InvariantCulture); + } + + public static string ToStringLookup(this short value) + { + if ((int) value >= 0 && (int) value <= (int) byte.MaxValue) + return ToStringExtensions._cache[(int) value]; + else + return value.ToString((IFormatProvider) CultureInfo.InvariantCulture); + } + + public static string ToStackString(this short value) + { + if ((int) value <= 250) + return ToStringExtensions._cacheStack[(int) value]; + else + return " (" + (object) value.ToString((IFormatProvider) CultureInfo.InvariantCulture) + (string) (object) ')'; + } + + public static string ToStackString(this int value) + { + if (value <= 250) + return ToStringExtensions._cacheStack[value]; + else + return " (" + (object) value.ToString((IFormatProvider) CultureInfo.InvariantCulture) + (string) (object) ')'; + } +} diff --git a/_sheetSprites.cs b/_sheetSprites.cs new file mode 100644 index 0000000..2cca91d --- /dev/null +++ b/_sheetSprites.cs @@ -0,0 +1,3006 @@ +// Type: _sheetSprites +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Content; +using Microsoft.Xna.Framework.Graphics; +using Terraria; + +public class _sheetSprites : SpriteSheet<_sheetSprites> +{ + static _sheetSprites() + { + SpriteSheet<_sheetSprites>.src = new Rectangle[1489] + { + new Rectangle(1695, 413, 32, 26), + new Rectangle(1282, 3833, 30, 30), + new Rectangle(488, 4067, 32, 26), + new Rectangle(1559, 3877, 26, 98), + new Rectangle(1528, 3906, 26, 98), + new Rectangle(1993, 614, 40, 1120), + new Rectangle(1694, 2530, 40, 1118), + new Rectangle(2786, 0, 40, 1120), + new Rectangle(2827, 0, 40, 1120), + new Rectangle(2868, 0, 40, 1120), + new Rectangle(2909, 0, 40, 1120), + new Rectangle(2950, 0, 40, 1120), + new Rectangle(2991, 0, 40, 1120), + new Rectangle(3032, 0, 40, 1120), + new Rectangle(1948, 672, 40, 1120), + new Rectangle(2048, 0, 40, 1120), + new Rectangle(2089, 0, 40, 1120), + new Rectangle(2130, 0, 40, 1120), + new Rectangle(2171, 0, 40, 1120), + new Rectangle(2212, 0, 40, 1120), + new Rectangle(2253, 0, 40, 1120), + new Rectangle(2294, 0, 40, 1120), + new Rectangle(2335, 0, 40, 1120), + new Rectangle(2376, 0, 40, 1120), + new Rectangle(2417, 0, 40, 1120), + new Rectangle(2458, 0, 40, 1120), + new Rectangle(2499, 0, 40, 1120), + new Rectangle(2540, 0, 40, 1120), + new Rectangle(2581, 0, 40, 1120), + new Rectangle(2622, 0, 40, 1120), + new Rectangle(2663, 0, 40, 1120), + new Rectangle(2704, 0, 40, 1120), + new Rectangle(2745, 0, 40, 1120), + new Rectangle(3073, 0, 40, 1120), + new Rectangle(3524, 0, 40, 1120), + new Rectangle(3934, 0, 40, 1120), + new Rectangle(3975, 0, 40, 1120), + new Rectangle(4016, 0, 40, 1120), + new Rectangle(0, 2047, 40, 1120), + new Rectangle(41, 2047, 40, 1120), + new Rectangle(82, 2036, 40, 1120), + new Rectangle(123, 2046, 40, 1120), + new Rectangle(3114, 0, 40, 1120), + new Rectangle(3155, 0, 40, 1120), + new Rectangle(3196, 0, 40, 1120), + new Rectangle(3237, 0, 40, 1120), + new Rectangle(3278, 0, 40, 1120), + new Rectangle(3319, 0, 40, 1120), + new Rectangle(3360, 0, 40, 1120), + new Rectangle(3401, 0, 40, 1120), + new Rectangle(3442, 0, 40, 1120), + new Rectangle(3483, 0, 40, 1120), + new Rectangle(3565, 0, 40, 1120), + new Rectangle(3606, 0, 40, 1120), + new Rectangle(3647, 0, 40, 1120), + new Rectangle(3688, 0, 40, 1120), + new Rectangle(3729, 0, 40, 1120), + new Rectangle(3770, 0, 40, 1120), + new Rectangle(3811, 0, 40, 1120), + new Rectangle(3852, 0, 40, 1120), + new Rectangle(3893, 0, 40, 1120), + new Rectangle(164, 2046, 40, 1120), + new Rectangle(3223, 1121, 40, 1118), + new Rectangle(328, 2048, 40, 1120), + new Rectangle(3428, 1121, 40, 1118), + new Rectangle(2317, 2242, 40, 1118), + new Rectangle(3469, 1121, 40, 1118), + new Rectangle(2358, 2242, 40, 1118), + new Rectangle(3510, 1121, 40, 1118), + new Rectangle(1102, 1552, 40, 1120), + new Rectangle(1834, 2393, 40, 1118), + new Rectangle(3141, 1121, 40, 1118), + new Rectangle(1875, 2393, 40, 1118), + new Rectangle(2030, 2242, 40, 1118), + new Rectangle(3182, 1121, 40, 1118), + new Rectangle(1735, 2562, 40, 1118), + new Rectangle(2071, 2242, 40, 1118), + new Rectangle(1784, 2542, 40, 1118), + new Rectangle(205, 2041, 40, 1120), + new Rectangle(246, 2041, 40, 1120), + new Rectangle(2112, 2242, 40, 1118), + new Rectangle(3264, 1121, 40, 1118), + new Rectangle(2153, 2242, 40, 1118), + new Rectangle(3305, 1121, 40, 1118), + new Rectangle(2194, 2242, 40, 1118), + new Rectangle(3346, 1121, 40, 1118), + new Rectangle(2235, 2242, 40, 1118), + new Rectangle(3387, 1121, 40, 1118), + new Rectangle(2276, 2242, 40, 1118), + new Rectangle(287, 2043, 40, 1120), + new Rectangle(369, 2048, 40, 1120), + new Rectangle(410, 2043, 40, 1120), + new Rectangle(451, 2043, 40, 1120), + new Rectangle(492, 2042, 40, 1120), + new Rectangle(533, 2039, 40, 1120), + new Rectangle(1199, 1406, 40, 1120), + new Rectangle(738, 1869, 40, 1120), + new Rectangle(574, 2022, 40, 1120), + new Rectangle(1432, 1179, 40, 1120), + new Rectangle(693, 1919, 40, 1120), + new Rectangle(965, 1647, 40, 1120), + new Rectangle(1242, 1381, 40, 1120), + new Rectangle(840, 1783, 40, 1120), + new Rectangle(787, 1833, 40, 1120), + new Rectangle(1154, 1475, 40, 1120), + new Rectangle(615, 2022, 40, 1120), + new Rectangle(1061, 1552, 40, 1120), + new Rectangle(1006, 1647, 40, 1120), + new Rectangle(1620, 1040, 40, 1120), + new Rectangle(1851, 1272, 40, 1120), + new Rectangle(2239, 1121, 40, 1120), + new Rectangle(2280, 1121, 40, 1120), + new Rectangle(2321, 1121, 40, 1120), + new Rectangle(2362, 1121, 40, 1120), + new Rectangle(2403, 1121, 40, 1120), + new Rectangle(2444, 1121, 40, 1120), + new Rectangle(2485, 1121, 40, 1120), + new Rectangle(1283, 1407, 40, 1120), + new Rectangle(1324, 1407, 40, 1120), + new Rectangle(1365, 1347, 40, 1120), + new Rectangle(1571, 1215, 40, 1120), + new Rectangle(881, 1882, 40, 1120), + new Rectangle(922, 1882, 40, 1120), + new Rectangle(1473, 1513, 40, 1120), + new Rectangle(1514, 1513, 40, 1120), + new Rectangle(1661, 1409, 40, 1120), + new Rectangle(1702, 1409, 40, 1120), + new Rectangle(1892, 1272, 40, 1120), + new Rectangle(2034, 1121, 40, 1120), + new Rectangle(1743, 1441, 40, 1120), + new Rectangle(2075, 1121, 40, 1120), + new Rectangle(1793, 1421, 40, 1120), + new Rectangle(2116, 1121, 40, 1120), + new Rectangle(2157, 1121, 40, 1120), + new Rectangle(2198, 1121, 40, 1120), + new Rectangle(453, 1350, 13, 7), + new Rectangle(556, 963, 7, 13), + new Rectangle(265, 452, 140, 470), + new Rectangle(492, 4004, 40, 62), + new Rectangle(57, 1978, 27, 36), + new Rectangle(1667, 881, 22, 22), + new Rectangle(1529, 2784, 22, 22), + new Rectangle(656, 2655, 32, 32), + new Rectangle(697, 3869, 32, 32), + new Rectangle(1129, 3754, 32, 32), + new Rectangle(902, 4018, 32, 32), + new Rectangle(1223, 3722, 32, 32), + new Rectangle(4057, 890, 32, 32), + new Rectangle(943, 4002, 32, 32), + new Rectangle(892, 4051, 32, 32), + new Rectangle(1363, 3589, 32, 32), + new Rectangle(656, 2688, 32, 32), + new Rectangle(656, 2721, 32, 32), + new Rectangle(656, 2754, 32, 32), + new Rectangle(656, 2787, 32, 32), + new Rectangle(656, 2820, 32, 32), + new Rectangle(656, 2853, 32, 32), + new Rectangle(656, 2886, 32, 32), + new Rectangle(656, 2919, 32, 32), + new Rectangle(656, 2952, 32, 32), + new Rectangle(656, 2985, 32, 32), + new Rectangle(697, 3902, 32, 32), + new Rectangle(697, 3935, 32, 32), + new Rectangle(697, 3968, 32, 32), + new Rectangle(613, 4061, 32, 32), + new Rectangle(736, 4062, 32, 32), + new Rectangle(1236, 3623, 32, 32), + new Rectangle(1084, 3794, 32, 32), + new Rectangle(990, 3889, 32, 32), + new Rectangle(820, 4062, 32, 32), + new Rectangle(869, 4013, 32, 32), + new Rectangle(951, 3936, 32, 32), + new Rectangle(1223, 3656, 32, 32), + new Rectangle(910, 3985, 32, 32), + new Rectangle(1084, 3827, 32, 32), + new Rectangle(1117, 3794, 32, 32), + new Rectangle(1223, 3689, 32, 32), + new Rectangle(1256, 3656, 32, 32), + new Rectangle(990, 3922, 32, 32), + new Rectangle(859, 4046, 32, 32), + new Rectangle(951, 3969, 32, 32), + new Rectangle(1150, 3787, 32, 32), + new Rectangle(1117, 3827, 32, 32), + new Rectangle(1084, 3860, 32, 32), + new Rectangle(984, 3955, 32, 32), + new Rectangle(1289, 3649, 32, 32), + new Rectangle(1256, 3689, 32, 32), + new Rectangle(2034, 796, 12, 12), + new Rectangle(1047, 1787, 12, 12), + new Rectangle(1834, 1547, 16, 28), + new Rectangle(1834, 1576, 16, 28), + new Rectangle(2034, 809, 12, 12), + new Rectangle(1681, 315, 10, 10), + new Rectangle(1473, 1370, 12, 12), + new Rectangle(1047, 1800, 12, 12), + new Rectangle(1283, 1379, 34, 24), + new Rectangle(656, 2607, 34, 24), + new Rectangle(1834, 1518, 16, 28), + new Rectangle(1473, 1357, 12, 12), + new Rectangle(4057, 0, 38, 720), + new Rectangle(1150, 3919, 32, 28), + new Rectangle(4057, 1022, 32, 26), + new Rectangle(1150, 3820, 32, 32), + new Rectangle(1834, 1748, 16, 24), + new Rectangle(1289, 3682, 32, 32), + new Rectangle(2003, 312, 44, 32), + new Rectangle(1440, 874, 45, 32), + new Rectangle(410, 4061, 38, 32), + new Rectangle(1432, 1125, 44, 32), + new Rectangle(588, 934, 35, 28), + new Rectangle(533, 4064, 32, 30), + new Rectangle(287, 4061, 39, 30), + new Rectangle(527, 1874, 48, 34), + new Rectangle(1244, 1314, 28, 36), + new Rectangle(863, 889, 50, 102), + new Rectangle(863, 471, 50, 208), + new Rectangle(863, 992, 50, 102), + new Rectangle(1163, 0, 112, 112), + new Rectangle(0, 0, 770, 30), + new Rectangle(1067, 1363, 31, 47), + new Rectangle(752, 471, 110, 1200), + new Rectangle(2526, 1121, 40, 1120), + new Rectangle(1240, 2502, 40, 1120), + new Rectangle(2731, 1121, 40, 1120), + new Rectangle(2772, 1121, 40, 1120), + new Rectangle(1555, 2336, 40, 1120), + new Rectangle(2813, 1121, 40, 1120), + new Rectangle(2854, 1121, 40, 1120), + new Rectangle(2895, 1121, 40, 1120), + new Rectangle(2936, 1121, 40, 1120), + new Rectangle(2567, 1121, 40, 1120), + new Rectangle(1195, 2527, 40, 1120), + new Rectangle(1989, 1735, 40, 1120), + new Rectangle(2608, 1121, 40, 1120), + new Rectangle(1406, 2300, 40, 1120), + new Rectangle(963, 2768, 40, 1120), + new Rectangle(1047, 2673, 40, 1120), + new Rectangle(779, 2954, 40, 1120), + new Rectangle(1933, 1793, 40, 1120), + new Rectangle(828, 2904, 40, 1120), + new Rectangle(1143, 2596, 40, 1120), + new Rectangle(1088, 2673, 40, 1120), + new Rectangle(2649, 1121, 40, 1120), + new Rectangle(1004, 2768, 40, 1120), + new Rectangle(1612, 2161, 40, 1120), + new Rectangle(2690, 1121, 40, 1120), + new Rectangle(1281, 2528, 40, 1120), + new Rectangle(1365, 2468, 40, 1120), + new Rectangle(1322, 2528, 40, 1120), + new Rectangle(2977, 1121, 40, 1120), + new Rectangle(2399, 2242, 40, 1118), + new Rectangle(1447, 2634, 40, 1120), + new Rectangle(1488, 2634, 40, 1120), + new Rectangle(3551, 1121, 40, 1118), + new Rectangle(3018, 1121, 40, 1120), + new Rectangle(1851, 423, 34, 176), + new Rectangle(863, 1274, 48, 36), + new Rectangle(1921, 3755, 18, 22), + new Rectangle(1834, 1823, 16, 22), + new Rectangle(1786, 3694, 26, 30), + new Rectangle(1554, 4043, 22, 14), + new Rectangle(1529, 3359, 22, 20), + new Rectangle(1881, 3770, 20, 14), + new Rectangle(2195, 3428, 20, 24), + new Rectangle(863, 1596, 46, 32), + new Rectangle(216, 1305, 48, 52), + new Rectangle(254, 1952, 52, 80), + new Rectangle(1851, 1082, 34, 36), + new Rectangle(656, 2089, 36, 32), + new Rectangle(820, 4025, 38, 36), + new Rectangle(736, 4015, 38, 46), + new Rectangle(574, 4027, 38, 52), + new Rectangle(1447, 2408, 22, 24), + new Rectangle(1447, 2433, 22, 24), + new Rectangle(1057, 4052, 30, 42), + new Rectangle(1464, 434, 20, 34), + new Rectangle(429, 1841, 22, 38), + new Rectangle(1874, 3785, 18, 26), + new Rectangle(1473, 1233, 12, 24), + new Rectangle(1933, 1565, 14, 26), + new Rectangle(693, 1749, 46, 54), + new Rectangle(523, 2000, 44, 38), + new Rectangle(1663, 949, 26, 56), + new Rectangle(1697, 3741, 26, 52), + new Rectangle(1661, 1077, 28, 36), + new Rectangle(1125, 900, 36, 60), + new Rectangle(1088, 4052, 30, 30), + new Rectangle(1527, 4079, 20, 14), + new Rectangle(2095, 3592, 18, 16), + new Rectangle(1280, 3864, 30, 30), + new Rectangle(2139, 3507, 20, 14), + new Rectangle(2114, 3571, 18, 16), + new Rectangle(1313, 3833, 30, 30), + new Rectangle(2241, 3407, 20, 14), + new Rectangle(1748, 3938, 18, 16), + new Rectangle(1148, 4004, 30, 30), + new Rectangle(2193, 3453, 20, 14), + new Rectangle(2158, 3529, 18, 16), + new Rectangle(1830, 3798, 20, 22), + new Rectangle(57, 2036, 16, 10), + new Rectangle(1677, 4011, 18, 16), + new Rectangle(1353, 3799, 30, 30), + new Rectangle(2160, 3483, 20, 14), + new Rectangle(2235, 3449, 18, 16), + new Rectangle(1386, 3767, 30, 30), + new Rectangle(1799, 3844, 20, 14), + new Rectangle(1698, 3986, 18, 16), + new Rectangle(1816, 3865, 18, 16), + new Rectangle(677, 2000, 14, 16), + new Rectangle(1834, 1938, 16, 20), + new Rectangle(1652, 0, 80, 76), + new Rectangle(1695, 440, 54, 38), + new Rectangle(863, 1629, 44, 76), + new Rectangle(762, 244, 10, 38), + new Rectangle(1560, 3595, 30, 30), + new Rectangle(1826, 3821, 20, 14), + new Rectangle(2331, 3361, 18, 16), + new Rectangle(1851, 1119, 34, 36), + new Rectangle(656, 2122, 36, 32), + new Rectangle(1129, 3717, 38, 36), + new Rectangle(1529, 3628, 30, 30), + new Rectangle(1658, 3994, 20, 14), + new Rectangle(1656, 4034, 18, 16), + new Rectangle(840, 1706, 42, 76), + new Rectangle(1199, 1381, 42, 24), + new Rectangle(1447, 2458, 22, 24), + new Rectangle(1527, 4062, 22, 16), + new Rectangle(2166, 3464, 20, 18), + new Rectangle(1948, 651, 42, 20), + new Rectangle(1181, 3976, 30, 30), + new Rectangle(2291, 3361, 20, 14), + new Rectangle(1637, 4055, 18, 16), + new Rectangle(1834, 1846, 16, 22), + new Rectangle(1834, 2161, 16, 16), + new Rectangle(1755, 3753, 26, 26), + new Rectangle(1365, 4073, 26, 18), + new Rectangle(863, 1257, 50, 16), + new Rectangle(701, 1421, 50, 16), + new Rectangle(411, 1995, 14, 12), + new Rectangle(1555, 2273, 14, 12), + new Rectangle(2176, 3386, 26, 14), + new Rectangle(1450, 526, 35, 25), + new Rectangle(1893, 3785, 18, 22), + new Rectangle(656, 2054, 36, 34), + new Rectangle(1047, 1772, 12, 14), + new Rectangle(246, 4059, 40, 22), + new Rectangle(409, 2008, 46, 34), + new Rectangle(1362, 1271, 24, 24), + new Rectangle(4057, 1098, 30, 22), + new Rectangle(85, 1887, 24, 26), + new Rectangle(1948, 501, 46, 34), + new Rectangle(1047, 1755, 12, 16), + new Rectangle(1450, 4076, 26, 18), + new Rectangle(1047, 1669, 12, 24), + new Rectangle(1406, 1622, 24, 22), + new Rectangle(656, 2155, 36, 32), + new Rectangle(103, 4081, 18, 12), + new Rectangle(2005, 109, 42, 34), + new Rectangle(142, 2019, 54, 26), + new Rectangle(1834, 1487, 16, 30), + new Rectangle(411, 1950, 16, 44), + new Rectangle(1244, 1362, 40, 16), + new Rectangle(1090, 4021, 26, 22), + new Rectangle(1406, 1949, 24, 18), + new Rectangle(1695, 368, 32, 44), + new Rectangle(711, 1066, 40, 28), + new Rectangle(1669, 791, 20, 20), + new Rectangle(1216, 3904, 30, 40), + new Rectangle(510, 1754, 18, 36), + new Rectangle(510, 1672, 18, 40), + new Rectangle(1797, 3859, 18, 30), + new Rectangle(1423, 4077, 26, 14), + new Rectangle(1125, 961, 36, 24), + new Rectangle(656, 2541, 34, 32), + new Rectangle(752, 457, 20, 12), + new Rectangle(1881, 3747, 20, 22), + new Rectangle(574, 3984, 40, 42), + new Rectangle(883, 1743, 32, 34), + new Rectangle(1529, 3556, 32, 22), + new Rectangle(1057, 4029, 32, 22), + new Rectangle(1529, 2807, 22, 22), + new Rectangle(1679, 666, 10, 22), + new Rectangle(1933, 1761, 14, 14), + new Rectangle(656, 2331, 34, 34), + new Rectangle(1673, 748, 16, 14), + new Rectangle(1023, 3943, 20, 18), + new Rectangle(1464, 500, 20, 24), + new Rectangle(517, 963, 38, 12), + new Rectangle(693, 1896, 42, 22), + new Rectangle(1750, 485, 42, 24), + new Rectangle(2241, 3422, 18, 26), + new Rectangle(251, 1870, 12, 24), + new Rectangle(1555, 1919, 14, 26), + new Rectangle(111, 1385, 84, 64), + new Rectangle(564, 963, 58, 48), + new Rectangle(196, 1385, 56, 52), + new Rectangle(2001, 350, 46, 52), + new Rectangle(1661, 1040, 28, 36), + new Rectangle(1065, 1456, 32, 38), + new Rectangle(1997, 452, 46, 32), + new Rectangle(742, 1707, 46, 32), + new Rectangle(644, 1418, 56, 70), + new Rectangle(1794, 157, 62, 86), + new Rectangle(449, 4061, 38, 32), + new Rectangle(1834, 1605, 16, 28), + new Rectangle(1571, 103, 80, 66), + new Rectangle(863, 1198, 50, 58), + new Rectangle(1447, 2383, 22, 24), + new Rectangle(576, 1889, 10, 18), + new Rectangle(828, 1833, 10, 16), + new Rectangle(1658, 4009, 18, 24), + new Rectangle(1432, 1158, 42, 20), + new Rectangle(951, 3889, 38, 46), + new Rectangle(1637, 3803, 26, 36), + new Rectangle(1679, 689, 10, 22), + new Rectangle(1834, 2085, 16, 18), + new Rectangle(1362, 1246, 24, 24), + new Rectangle(2034, 670, 12, 24), + new Rectangle(123, 4064, 40, 24), + new Rectangle(1387, 927, 52, 48), + new Rectangle(1834, 1773, 16, 24), + new Rectangle(216, 1358, 48, 16), + new Rectangle(1683, 3938, 20, 24), + new Rectangle(510, 1874, 16, 12), + new Rectangle(1704, 3938, 20, 16), + new Rectangle(1665, 931, 24, 16), + new Rectangle(2220, 3407, 20, 20), + new Rectangle(85, 1800, 24, 28), + new Rectangle(1637, 3992, 20, 22), + new Rectangle(1119, 4068, 30, 26), + new Rectangle(1367, 4048, 28, 24), + new Rectangle(1322, 3649, 32, 32), + new Rectangle(1529, 2876, 22, 22), + new Rectangle(1529, 2899, 22, 22), + new Rectangle(1529, 2922, 22, 22), + new Rectangle(1529, 2830, 22, 22), + new Rectangle(1529, 2853, 22, 22), + new Rectangle(2122, 3361, 26, 28), + new Rectangle(2095, 3394, 26, 28), + new Rectangle(1065, 1415, 32, 40), + new Rectangle(693, 4064, 32, 30), + new Rectangle(644, 1626, 52, 52), + new Rectangle(1626, 641, 52, 52), + new Rectangle(916, 1366, 52, 52), + new Rectangle(307, 1973, 52, 52), + new Rectangle(969, 1313, 52, 52), + new Rectangle(863, 1422, 52, 52), + new Rectangle(699, 1598, 52, 52), + new Rectangle(309, 1920, 52, 52), + new Rectangle(1387, 874, 52, 52), + new Rectangle(1571, 697, 52, 52), + new Rectangle(916, 1313, 52, 52), + new Rectangle(984, 3988, 32, 32), + new Rectangle(1916, 2716, 16, 16), + new Rectangle(1916, 2818, 16, 16), + new Rectangle(1256, 3755, 32, 32), + new Rectangle(1447, 2608, 22, 24), + new Rectangle(1322, 3715, 32, 32), + new Rectangle(1117, 3926, 32, 32), + new Rectangle(1555, 2136, 14, 16), + new Rectangle(1406, 1691, 24, 22), + new Rectangle(925, 4051, 32, 32), + new Rectangle(1834, 2178, 16, 16), + new Rectangle(1834, 2212, 16, 16), + new Rectangle(1834, 2246, 16, 16), + new Rectangle(1916, 2427, 16, 16), + new Rectangle(1214, 3945, 30, 30), + new Rectangle(1119, 4037, 30, 30), + new Rectangle(1280, 3895, 30, 30), + new Rectangle(1406, 1760, 24, 20), + new Rectangle(1305, 4015, 30, 24), + new Rectangle(1541, 3779, 30, 24), + new Rectangle(1336, 3984, 30, 24), + new Rectangle(1404, 3917, 30, 24), + new Rectangle(595, 4080, 16, 14), + new Rectangle(976, 4021, 32, 32), + new Rectangle(1729, 3924, 18, 32), + new Rectangle(1916, 2767, 16, 16), + new Rectangle(1575, 4058, 20, 20), + new Rectangle(2199, 3401, 20, 26), + new Rectangle(1529, 2991, 22, 22), + new Rectangle(1916, 2835, 16, 16), + new Rectangle(2139, 3480, 20, 26), + new Rectangle(1274, 4071, 30, 22), + new Rectangle(1274, 4044, 30, 26), + new Rectangle(1673, 715, 16, 32), + new Rectangle(1285, 1362, 32, 16), + new Rectangle(769, 4075, 32, 18), + new Rectangle(1305, 3986, 30, 28), + new Rectangle(1834, 1915, 16, 22), + new Rectangle(1834, 1421, 16, 32), + new Rectangle(1555, 1556, 14, 32), + new Rectangle(1555, 1589, 14, 32), + new Rectangle(1529, 3014, 22, 22), + new Rectangle(1435, 3929, 30, 20), + new Rectangle(433, 1766, 18, 40), + new Rectangle(1529, 3457, 32, 32), + new Rectangle(1050, 3963, 32, 32), + new Rectangle(1555, 1622, 14, 32), + new Rectangle(1083, 3992, 32, 28), + new Rectangle(1856, 3533, 28, 28), + new Rectangle(1406, 1572, 24, 24), + new Rectangle(1933, 1272, 14, 32), + new Rectangle(1460, 4014, 26, 32), + new Rectangle(2118, 3507, 20, 26), + new Rectangle(1117, 3959, 32, 28), + new Rectangle(1851, 3801, 18, 32), + new Rectangle(1957, 3169, 16, 16), + new Rectangle(1305, 4040, 30, 24), + new Rectangle(1769, 3911, 18, 18), + new Rectangle(2122, 3461, 22, 18), + new Rectangle(1529, 2634, 22, 24), + new Rectangle(1957, 3390, 16, 16), + new Rectangle(1691, 3892, 22, 18), + new Rectangle(1468, 3846, 30, 28), + new Rectangle(1289, 3748, 32, 32), + new Rectangle(1355, 3688, 32, 32), + new Rectangle(1447, 2329, 22, 26), + new Rectangle(1447, 2356, 22, 26), + new Rectangle(1529, 3244, 22, 22), + new Rectangle(1473, 1258, 12, 22), + new Rectangle(1084, 3959, 32, 32), + new Rectangle(1555, 2102, 14, 16), + new Rectangle(1933, 1727, 14, 16), + new Rectangle(1555, 2119, 14, 16), + new Rectangle(1933, 1744, 14, 16), + new Rectangle(1529, 2659, 22, 24), + new Rectangle(2203, 3380, 22, 18), + new Rectangle(2095, 3492, 22, 18), + new Rectangle(1660, 3927, 22, 18), + new Rectangle(2226, 3361, 22, 18), + new Rectangle(1856, 3512, 30, 20), + new Rectangle(1336, 4032, 30, 20), + new Rectangle(1668, 3701, 30, 18), + new Rectangle(1305, 4065, 30, 18), + new Rectangle(1755, 3720, 26, 32), + new Rectangle(1902, 3755, 18, 24), + new Rectangle(568, 2000, 18, 20), + new Rectangle(1406, 1968, 24, 16), + new Rectangle(1755, 3841, 22, 16), + new Rectangle(1406, 1985, 24, 16), + new Rectangle(1572, 3746, 22, 20), + new Rectangle(1406, 1714, 24, 22), + new Rectangle(2095, 3450, 26, 22), + new Rectangle(1957, 3407, 16, 16), + new Rectangle(1406, 2002, 24, 14), + new Rectangle(1289, 3810, 32, 22), + new Rectangle(307, 2026, 48, 16), + new Rectangle(1473, 1396, 12, 12), + new Rectangle(142, 1943, 56, 20), + new Rectangle(1834, 1454, 16, 32), + new Rectangle(1421, 3698, 22, 18), + new Rectangle(1664, 3885, 26, 18), + new Rectangle(85, 1914, 24, 26), + new Rectangle(1117, 3860, 32, 32), + new Rectangle(1084, 3893, 32, 32), + new Rectangle(1047, 1694, 12, 20), + new Rectangle(1150, 4066, 30, 28), + new Rectangle(1406, 3830, 30, 28), + new Rectangle(1311, 3926, 30, 28), + new Rectangle(1447, 2483, 22, 24), + new Rectangle(1669, 764, 20, 26), + new Rectangle(1499, 3888, 28, 28), + new Rectangle(1342, 3895, 30, 28), + new Rectangle(1881, 3628, 26, 26), + new Rectangle(1699, 3689, 28, 28), + new Rectangle(2149, 3361, 26, 26), + new Rectangle(1834, 2195, 16, 16), + new Rectangle(1181, 4069, 30, 24), + new Rectangle(1529, 2945, 22, 22), + new Rectangle(433, 1807, 18, 32), + new Rectangle(2116, 3534, 18, 36), + new Rectangle(701, 1438, 48, 48), + new Rectangle(1256, 3722, 32, 32), + new Rectangle(1447, 2508, 22, 24), + new Rectangle(1468, 3900, 30, 18), + new Rectangle(1572, 3788, 22, 18), + new Rectangle(456, 2008, 20, 26), + new Rectangle(164, 4064, 40, 24), + new Rectangle(1280, 3957, 30, 28), + new Rectangle(1834, 2229, 16, 16), + new Rectangle(1834, 2263, 16, 16), + new Rectangle(1834, 2280, 16, 16), + new Rectangle(1834, 2297, 16, 16), + new Rectangle(1834, 2314, 16, 16), + new Rectangle(1834, 2331, 16, 16), + new Rectangle(1834, 2348, 16, 16), + new Rectangle(546, 1226, 16, 34), + new Rectangle(1834, 2365, 16, 16), + new Rectangle(1916, 2393, 16, 16), + new Rectangle(1916, 2410, 16, 16), + new Rectangle(1916, 2444, 16, 16), + new Rectangle(1916, 2461, 16, 16), + new Rectangle(1916, 2478, 16, 16), + new Rectangle(1916, 2495, 16, 16), + new Rectangle(1916, 2512, 16, 16), + new Rectangle(1916, 2529, 16, 16), + new Rectangle(1916, 2546, 16, 16), + new Rectangle(1916, 2563, 16, 16), + new Rectangle(1473, 1281, 12, 20), + new Rectangle(1661, 1225, 28, 32), + new Rectangle(1693, 3794, 26, 28), + new Rectangle(1560, 3688, 30, 28), + new Rectangle(1212, 4038, 30, 28), + new Rectangle(1529, 3721, 30, 28), + new Rectangle(1916, 2580, 16, 16), + new Rectangle(362, 1950, 48, 48), + new Rectangle(1668, 3720, 28, 28), + new Rectangle(406, 621, 44, 10), + new Rectangle(1362, 1296, 24, 24), + new Rectangle(510, 1791, 18, 32), + new Rectangle(366, 4066, 38, 14), + new Rectangle(1555, 2153, 14, 14), + new Rectangle(1223, 3755, 32, 32), + new Rectangle(4057, 923, 32, 32), + new Rectangle(0, 4065, 40, 26), + new Rectangle(1661, 1258, 28, 32), + new Rectangle(1364, 1201, 22, 30), + new Rectangle(762, 283, 10, 32), + new Rectangle(1933, 1617, 14, 20), + new Rectangle(1916, 2597, 16, 16), + new Rectangle(1916, 2614, 16, 16), + new Rectangle(1363, 3622, 32, 32), + new Rectangle(1916, 2631, 16, 16), + new Rectangle(1916, 2648, 16, 16), + new Rectangle(1916, 2665, 16, 16), + new Rectangle(1668, 3651, 30, 24), + new Rectangle(1916, 2682, 16, 16), + new Rectangle(453, 1387, 12, 18), + new Rectangle(2034, 741, 12, 18), + new Rectangle(1473, 1302, 12, 18), + new Rectangle(1047, 1736, 12, 18), + new Rectangle(1473, 1321, 12, 18), + new Rectangle(2034, 760, 12, 18), + new Rectangle(1447, 2533, 22, 24), + new Rectangle(1845, 3836, 18, 18), + new Rectangle(1663, 1006, 26, 32), + new Rectangle(1624, 715, 48, 48), + new Rectangle(1311, 3864, 30, 30), + new Rectangle(1023, 3889, 20, 26), + new Rectangle(1162, 3754, 20, 26), + new Rectangle(697, 1651, 48, 48), + new Rectangle(1851, 1156, 34, 34), + new Rectangle(1916, 2699, 16, 16), + new Rectangle(2270, 3361, 20, 22), + new Rectangle(1572, 3807, 22, 18), + new Rectangle(1572, 3826, 22, 18), + new Rectangle(1183, 3805, 32, 32), + new Rectangle(1948, 109, 56, 20), + new Rectangle(1948, 403, 48, 48), + new Rectangle(510, 1825, 48, 48), + new Rectangle(1022, 1314, 48, 48), + new Rectangle(360, 1999, 48, 48), + new Rectangle(1387, 976, 48, 48), + new Rectangle(478, 1887, 48, 48), + new Rectangle(1396, 3590, 32, 32), + new Rectangle(1362, 1321, 24, 24), + new Rectangle(1406, 1347, 24, 24), + new Rectangle(1406, 1372, 24, 24), + new Rectangle(1406, 1397, 24, 24), + new Rectangle(1834, 2104, 16, 18), + new Rectangle(1637, 4030, 18, 24), + new Rectangle(1447, 2558, 22, 24), + new Rectangle(1404, 3984, 28, 28), + new Rectangle(1150, 3853, 32, 32), + new Rectangle(1916, 2733, 16, 16), + new Rectangle(1406, 1422, 24, 24), + new Rectangle(1406, 1447, 24, 24), + new Rectangle(1289, 3715, 32, 32), + new Rectangle(1637, 3873, 26, 26), + new Rectangle(41, 4065, 40, 26), + new Rectangle(1322, 3682, 32, 32), + new Rectangle(1212, 4067, 30, 26), + new Rectangle(1916, 2750, 16, 16), + new Rectangle(1406, 1472, 24, 24), + new Rectangle(1183, 3904, 32, 22), + new Rectangle(1637, 3751, 28, 28), + new Rectangle(1023, 3916, 20, 26), + new Rectangle(1809, 3790, 20, 26), + new Rectangle(1477, 4074, 26, 18), + new Rectangle(1504, 4043, 26, 18), + new Rectangle(1881, 3682, 22, 18), + new Rectangle(1853, 3782, 20, 18), + new Rectangle(1541, 4005, 26, 18), + new Rectangle(2203, 3361, 22, 18), + new Rectangle(1473, 1383, 12, 12), + new Rectangle(1406, 2030, 22, 30), + new Rectangle(1834, 1869, 16, 22), + new Rectangle(1243, 4007, 30, 28), + new Rectangle(656, 2632, 34, 22), + new Rectangle(1637, 4015, 20, 14), + new Rectangle(1541, 3804, 30, 22), + new Rectangle(2122, 3442, 22, 18), + new Rectangle(2019, 91, 28, 16), + new Rectangle(1406, 2272, 22, 26), + new Rectangle(1406, 2017, 24, 12), + new Rectangle(656, 3018, 32, 20), + new Rectangle(1406, 1781, 24, 20), + new Rectangle(1666, 3751, 28, 20), + new Rectangle(1322, 3777, 32, 20), + new Rectangle(1406, 1802, 24, 20), + new Rectangle(1396, 4015, 28, 26), + new Rectangle(566, 4080, 28, 14), + new Rectangle(1637, 3709, 30, 20), + new Rectangle(2149, 3415, 22, 18), + new Rectangle(1834, 1892, 16, 22), + new Rectangle(1834, 1798, 16, 24), + new Rectangle(1529, 3380, 22, 20), + new Rectangle(1404, 3965, 30, 18), + new Rectangle(1691, 3873, 22, 18), + new Rectangle(1510, 3755, 30, 28), + new Rectangle(853, 4079, 28, 14), + new Rectangle(1755, 3807, 26, 14), + new Rectangle(1446, 3817, 30, 28), + new Rectangle(1782, 3817, 22, 14), + new Rectangle(82, 4081, 20, 12), + new Rectangle(1147, 464, 14, 32), + new Rectangle(693, 1871, 44, 24), + new Rectangle(1834, 1634, 16, 28), + new Rectangle(1529, 2968, 22, 22), + new Rectangle(1479, 3786, 30, 28), + new Rectangle(1406, 3859, 30, 28), + new Rectangle(1342, 3924, 30, 28), + new Rectangle(1661, 1291, 28, 32), + new Rectangle(1018, 1366, 48, 48), + new Rectangle(1948, 350, 52, 52), + new Rectangle(1665, 904, 24, 26), + new Rectangle(2034, 779, 12, 16), + new Rectangle(1319, 1201, 44, 44), + new Rectangle(2034, 822, 12, 12), + new Rectangle(762, 407, 10, 24), + new Rectangle(654, 4050, 38, 38), + new Rectangle(216, 1375, 38, 8), + new Rectangle(1916, 2784, 16, 16), + new Rectangle(530, 1407, 12, 10), + new Rectangle(1776, 3878, 18, 32), + new Rectangle(376, 964, 28, 10), + new Rectangle(1916, 2801, 16, 16), + new Rectangle(762, 432, 10, 24), + new Rectangle(1881, 3720, 20, 26), + new Rectangle(1473, 1179, 12, 26), + new Rectangle(2034, 643, 12, 26), + new Rectangle(1473, 1206, 12, 26), + new Rectangle(1047, 1642, 12, 26), + new Rectangle(2145, 3453, 20, 26), + new Rectangle(1687, 3911, 20, 26), + new Rectangle(2118, 3480, 20, 26), + new Rectangle(1637, 3965, 20, 26), + new Rectangle(1832, 3771, 20, 26), + new Rectangle(2226, 3380, 20, 26), + new Rectangle(2095, 3511, 20, 26), + new Rectangle(1660, 3946, 20, 26), + new Rectangle(2172, 3437, 20, 26), + new Rectangle(2249, 3361, 20, 26), + new Rectangle(1554, 4058, 20, 26), + new Rectangle(1755, 3858, 20, 26), + new Rectangle(1778, 3832, 20, 26), + new Rectangle(1249, 3821, 32, 28), + new Rectangle(1637, 3927, 22, 18), + new Rectangle(1541, 4024, 22, 18), + new Rectangle(1504, 4062, 22, 18), + new Rectangle(2095, 3473, 22, 18), + new Rectangle(1664, 3904, 22, 18), + new Rectangle(1568, 4003, 22, 18), + new Rectangle(1473, 1340, 12, 16), + new Rectangle(2034, 720, 12, 20), + new Rectangle(1834, 1959, 16, 20), + new Rectangle(1834, 2123, 16, 18), + new Rectangle(1916, 2852, 16, 16), + new Rectangle(1047, 1715, 12, 20), + new Rectangle(2172, 3420, 22, 16), + new Rectangle(1406, 1497, 24, 24), + new Rectangle(1664, 3829, 26, 28), + new Rectangle(2260, 3422, 18, 18), + new Rectangle(2034, 695, 12, 24), + new Rectangle(1336, 4009, 30, 22), + new Rectangle(1699, 3670, 30, 18), + new Rectangle(1531, 4043, 22, 18), + new Rectangle(1555, 1946, 14, 24), + new Rectangle(1216, 3854, 32, 28), + new Rectangle(1933, 1592, 14, 24), + new Rectangle(1916, 2869, 16, 16), + new Rectangle(2247, 3388, 20, 18), + new Rectangle(1150, 3948, 32, 22), + new Rectangle(1499, 3844, 30, 22), + new Rectangle(1510, 3813, 30, 24), + new Rectangle(1730, 3681, 28, 22), + new Rectangle(1404, 3942, 30, 22), + new Rectangle(453, 1358, 12, 28), + new Rectangle(362, 1920, 12, 28), + new Rectangle(574, 1909, 12, 28), + new Rectangle(574, 1938, 12, 28), + new Rectangle(574, 1967, 12, 28), + new Rectangle(762, 349, 10, 28), + new Rectangle(1274, 3986, 30, 28), + new Rectangle(1311, 3955, 30, 28), + new Rectangle(1373, 3892, 30, 28), + new Rectangle(1560, 3717, 30, 28), + new Rectangle(1243, 4036, 30, 28), + new Rectangle(1661, 1324, 28, 32), + new Rectangle(1406, 2185, 22, 28), + new Rectangle(1555, 1996, 14, 20), + new Rectangle(1870, 3812, 18, 18), + new Rectangle(1322, 3748, 32, 28), + new Rectangle(2179, 3499, 18, 18), + new Rectangle(1826, 3836, 18, 28), + new Rectangle(1487, 4014, 26, 28), + new Rectangle(1857, 235, 22, 8), + new Rectangle(1364, 1232, 22, 12), + new Rectangle(1834, 1663, 16, 28), + new Rectangle(1834, 1692, 16, 28), + new Rectangle(1419, 3718, 26, 38), + new Rectangle(1017, 3963, 32, 32), + new Rectangle(1406, 1522, 24, 24), + new Rectangle(1274, 4015, 30, 28), + new Rectangle(1916, 2886, 16, 16), + new Rectangle(1957, 2914, 16, 16), + new Rectangle(802, 4075, 16, 16), + new Rectangle(1084, 3926, 32, 32), + new Rectangle(1620, 764, 48, 48), + new Rectangle(1755, 3822, 22, 18), + new Rectangle(1957, 2931, 16, 16), + new Rectangle(935, 4035, 28, 14), + new Rectangle(1406, 1823, 24, 20), + new Rectangle(2095, 3538, 20, 20), + new Rectangle(1825, 3512, 30, 20), + new Rectangle(2176, 3401, 22, 18), + new Rectangle(1529, 3401, 22, 20), + new Rectangle(1782, 3779, 26, 18), + new Rectangle(1661, 1390, 28, 18), + new Rectangle(1373, 3975, 30, 20), + new Rectangle(1809, 3771, 22, 18), + new Rectangle(1373, 3950, 30, 24), + new Rectangle(1437, 3904, 30, 24), + new Rectangle(254, 1937, 54, 14), + new Rectangle(197, 2005, 54, 14), + new Rectangle(700, 1364, 50, 18), + new Rectangle(700, 1383, 50, 18), + new Rectangle(564, 1089, 56, 14), + new Rectangle(701, 1402, 50, 18), + new Rectangle(1117, 3893, 32, 32), + new Rectangle(1018, 1506, 44, 44), + new Rectangle(1468, 3875, 30, 24), + new Rectangle(1957, 2948, 16, 16), + new Rectangle(1223, 3788, 32, 32), + new Rectangle(1437, 3846, 30, 28), + new Rectangle(1373, 3921, 30, 28), + new Rectangle(1406, 1547, 24, 24), + new Rectangle(1336, 4053, 28, 28), + new Rectangle(1479, 3815, 30, 28), + new Rectangle(1406, 3888, 30, 28), + new Rectangle(2176, 3361, 26, 24), + new Rectangle(1024, 4058, 32, 26), + new Rectangle(1699, 3649, 30, 20), + new Rectangle(1825, 3533, 30, 20), + new Rectangle(1782, 3798, 22, 18), + new Rectangle(1289, 3781, 32, 28), + new Rectangle(1620, 904, 44, 44), + new Rectangle(1668, 3676, 30, 24), + new Rectangle(1957, 2965, 16, 16), + new Rectangle(1957, 2982, 16, 16), + new Rectangle(1499, 3867, 30, 20), + new Rectangle(1881, 3701, 22, 18), + new Rectangle(1957, 2999, 16, 16), + new Rectangle(1957, 3016, 16, 16), + new Rectangle(1957, 3033, 16, 16), + new Rectangle(1957, 3050, 16, 16), + new Rectangle(1429, 3590, 16, 16), + new Rectangle(1957, 3067, 16, 16), + new Rectangle(1429, 3607, 16, 16), + new Rectangle(1957, 3084, 16, 16), + new Rectangle(1429, 3624, 16, 16), + new Rectangle(1957, 3101, 16, 16), + new Rectangle(1782, 3725, 26, 26), + new Rectangle(2122, 3390, 26, 26), + new Rectangle(1957, 3118, 16, 16), + new Rectangle(1510, 3784, 30, 28), + new Rectangle(1648, 234, 70, 80), + new Rectangle(1555, 2017, 14, 16), + new Rectangle(1555, 2034, 14, 16), + new Rectangle(1933, 1659, 14, 16), + new Rectangle(1555, 2051, 14, 16), + new Rectangle(1933, 1676, 14, 16), + new Rectangle(1555, 2068, 14, 16), + new Rectangle(1933, 1693, 14, 16), + new Rectangle(1948, 130, 56, 20), + new Rectangle(0, 1978, 56, 24), + new Rectangle(0, 2003, 56, 24), + new Rectangle(656, 2017, 36, 36), + new Rectangle(1693, 3823, 26, 26), + new Rectangle(2095, 3361, 26, 32), + new Rectangle(2095, 3423, 26, 26), + new Rectangle(1433, 4005, 26, 38), + new Rectangle(1786, 3661, 26, 32), + new Rectangle(1664, 3858, 26, 26), + new Rectangle(1691, 3850, 26, 22), + new Rectangle(1813, 3661, 26, 32), + new Rectangle(559, 1825, 26, 40), + new Rectangle(1396, 4042, 26, 38), + new Rectangle(85, 1526, 24, 36), + new Rectangle(1464, 3977, 26, 36), + new Rectangle(85, 1703, 24, 32), + new Rectangle(1491, 3979, 26, 32), + new Rectangle(1497, 3944, 26, 34), + new Rectangle(85, 1563, 24, 34), + new Rectangle(1477, 4047, 26, 26), + new Rectangle(1881, 3597, 26, 30), + new Rectangle(1667, 813, 22, 34), + new Rectangle(1637, 3840, 26, 32), + new Rectangle(85, 1736, 24, 32), + new Rectangle(1514, 4012, 26, 26), + new Rectangle(85, 1598, 24, 34), + new Rectangle(840, 1672, 22, 32), + new Rectangle(85, 1769, 24, 30), + new Rectangle(1450, 4047, 26, 28), + new Rectangle(1782, 3752, 26, 26), + new Rectangle(1344, 3831, 30, 30), + new Rectangle(1423, 4044, 26, 32), + new Rectangle(376, 923, 28, 40), + new Rectangle(1447, 2583, 22, 24), + new Rectangle(1406, 2214, 22, 28), + new Rectangle(85, 1633, 24, 34), + new Rectangle(85, 1668, 24, 34), + new Rectangle(1667, 848, 22, 32), + new Rectangle(1406, 2243, 22, 28), + new Rectangle(1464, 469, 20, 30), + new Rectangle(1071, 1314, 26, 40), + new Rectangle(1825, 3614, 26, 38), + new Rectangle(1759, 3681, 26, 38), + new Rectangle(1809, 3725, 26, 26), + new Rectangle(1957, 3135, 16, 16), + new Rectangle(1834, 2142, 16, 18), + new Rectangle(197, 2020, 52, 20), + new Rectangle(693, 1700, 48, 48), + new Rectangle(1948, 452, 48, 48), + new Rectangle(1997, 403, 48, 48), + new Rectangle(85, 1829, 24, 28), + new Rectangle(2034, 614, 12, 28), + new Rectangle(1755, 3780, 26, 26), + new Rectangle(1883, 3562, 26, 34), + new Rectangle(1530, 3848, 28, 28), + new Rectangle(1887, 3512, 28, 28), + new Rectangle(1530, 3877, 28, 28), + new Rectangle(1342, 3953, 30, 28), + new Rectangle(1541, 3750, 30, 28), + new Rectangle(1857, 157, 28, 38), + new Rectangle(1017, 3996, 32, 32), + new Rectangle(4057, 956, 32, 32), + new Rectangle(1637, 3651, 30, 28), + new Rectangle(1243, 4065, 30, 28), + new Rectangle(1708, 3911, 20, 26), + new Rectangle(1805, 3817, 20, 26), + new Rectangle(1809, 3752, 26, 18), + new Rectangle(1825, 3587, 28, 26), + new Rectangle(1406, 1645, 24, 22), + new Rectangle(1637, 3730, 30, 20), + new Rectangle(1637, 3946, 22, 18), + new Rectangle(254, 1920, 54, 16), + new Rectangle(1437, 3875, 30, 28), + new Rectangle(1857, 196, 28, 38), + new Rectangle(1468, 3919, 28, 30), + new Rectangle(1464, 3950, 28, 26), + new Rectangle(1529, 3037, 22, 22), + new Rectangle(1529, 3060, 22, 22), + new Rectangle(1562, 3523, 32, 26), + new Rectangle(205, 4059, 40, 24), + new Rectangle(1957, 3152, 16, 16), + new Rectangle(1555, 1655, 14, 32), + new Rectangle(253, 1384, 10, 24), + new Rectangle(1661, 1357, 28, 32), + new Rectangle(1825, 3554, 28, 32), + new Rectangle(1529, 3083, 22, 22), + new Rectangle(1529, 3106, 22, 22), + new Rectangle(1555, 2085, 14, 16), + new Rectangle(1933, 1710, 14, 16), + new Rectangle(746, 1672, 48, 34), + new Rectangle(1367, 3996, 30, 18), + new Rectangle(1933, 1776, 14, 14), + new Rectangle(1834, 1980, 16, 20), + new Rectangle(1834, 2001, 16, 20), + new Rectangle(196, 1438, 32, 8), + new Rectangle(1406, 1844, 24, 20), + new Rectangle(1367, 4015, 28, 32), + new Rectangle(85, 1858, 24, 28), + new Rectangle(517, 934, 70, 28), + new Rectangle(636, 2000, 40, 16), + new Rectangle(1555, 3976, 26, 26), + new Rectangle(1447, 2300, 22, 28), + new Rectangle(1750, 440, 42, 44), + new Rectangle(1658, 3973, 20, 20), + new Rectangle(1723, 3957, 18, 18), + new Rectangle(1406, 1597, 24, 24), + new Rectangle(229, 1438, 32, 8), + new Rectangle(1648, 315, 32, 8), + new Rectangle(1442, 863, 32, 8), + new Rectangle(1541, 3827, 30, 20), + new Rectangle(1933, 1305, 14, 32), + new Rectangle(1047, 1813, 12, 12), + new Rectangle(1529, 3129, 22, 22), + new Rectangle(1529, 3152, 22, 22), + new Rectangle(1529, 3175, 22, 22), + new Rectangle(142, 1964, 54, 54), + new Rectangle(327, 4066, 38, 20), + new Rectangle(2149, 3434, 22, 18), + new Rectangle(1776, 3859, 20, 18), + new Rectangle(1529, 3422, 22, 20), + new Rectangle(729, 803, 22, 44), + new Rectangle(1854, 3562, 28, 18), + new Rectangle(1729, 3905, 20, 18), + new Rectangle(1421, 3656, 22, 20), + new Rectangle(1421, 3677, 22, 20), + new Rectangle(1406, 1668, 24, 22), + new Rectangle(1355, 3655, 32, 32), + new Rectangle(1384, 3799, 30, 30), + new Rectangle(1417, 3767, 30, 30), + new Rectangle(1560, 3626, 30, 30), + new Rectangle(1150, 4035, 30, 30), + new Rectangle(1529, 3659, 30, 30), + new Rectangle(1212, 3976, 30, 30), + new Rectangle(1181, 4007, 30, 30), + new Rectangle(1280, 3926, 30, 30), + new Rectangle(1342, 3864, 30, 30), + new Rectangle(1311, 3895, 30, 30), + new Rectangle(1375, 3830, 30, 30), + new Rectangle(1415, 3798, 30, 30), + new Rectangle(1448, 3755, 30, 30), + new Rectangle(1529, 3198, 22, 22), + new Rectangle(1560, 3657, 30, 30), + new Rectangle(1957, 3186, 16, 16), + new Rectangle(1626, 694, 52, 20), + new Rectangle(0, 2028, 56, 18), + new Rectangle(1957, 3203, 16, 16), + new Rectangle(1355, 3721, 32, 28), + new Rectangle(1388, 3689, 32, 28), + new Rectangle(1957, 3220, 16, 16), + new Rectangle(1957, 3237, 16, 16), + new Rectangle(1957, 3254, 16, 16), + new Rectangle(1957, 3271, 16, 16), + new Rectangle(1957, 3288, 16, 16), + new Rectangle(1396, 3623, 32, 32), + new Rectangle(1562, 3457, 32, 32), + new Rectangle(1529, 3490, 32, 32), + new Rectangle(1957, 3305, 16, 16), + new Rectangle(1957, 3322, 16, 16), + new Rectangle(1957, 3339, 16, 16), + new Rectangle(1957, 3356, 16, 16), + new Rectangle(1957, 3373, 16, 16), + new Rectangle(1183, 3838, 32, 32), + new Rectangle(958, 4054, 32, 32), + new Rectangle(1150, 3886, 32, 32), + new Rectangle(1834, 2022, 16, 20), + new Rectangle(1834, 2043, 16, 20), + new Rectangle(1834, 2064, 16, 20), + new Rectangle(1881, 3655, 26, 26), + new Rectangle(1813, 3694, 26, 28), + new Rectangle(1697, 3720, 28, 20), + new Rectangle(1497, 3919, 28, 24), + new Rectangle(1406, 1865, 24, 20), + new Rectangle(1433, 3984, 28, 20), + new Rectangle(1216, 3883, 32, 20), + new Rectangle(1024, 4029, 32, 28), + new Rectangle(1406, 1886, 24, 20), + new Rectangle(1406, 1907, 24, 20), + new Rectangle(1406, 1928, 24, 20), + new Rectangle(1387, 1025, 48, 48), + new Rectangle(199, 1895, 54, 54), + new Rectangle(510, 1713, 18, 40), + new Rectangle(1555, 1688, 14, 32), + new Rectangle(194, 1870, 56, 24), + new Rectangle(1933, 1338, 14, 32), + new Rectangle(1755, 3885, 20, 18), + new Rectangle(1529, 3221, 22, 22), + new Rectangle(1559, 3848, 28, 28), + new Rectangle(1435, 3950, 28, 32), + new Rectangle(1933, 1536, 14, 28), + new Rectangle(1834, 1721, 16, 26), + new Rectangle(2122, 3417, 26, 24), + new Rectangle(1212, 4007, 30, 30), + new Rectangle(1181, 4038, 30, 30), + new Rectangle(1529, 3690, 30, 30), + new Rectangle(1243, 3976, 30, 30), + new Rectangle(1448, 3786, 30, 30), + new Rectangle(1479, 3755, 30, 30), + new Rectangle(1375, 3861, 30, 30), + new Rectangle(1216, 3821, 32, 32), + new Rectangle(1661, 1114, 28, 36), + new Rectangle(1529, 2684, 22, 24), + new Rectangle(1529, 2709, 22, 24), + new Rectangle(1562, 3550, 30, 44), + new Rectangle(718, 1095, 32, 52), + new Rectangle(697, 4015, 38, 48), + new Rectangle(1851, 890, 34, 142), + new Rectangle(265, 923, 110, 996), + new Rectangle(1464, 369, 20, 64), + new Rectangle(1319, 1246, 42, 160), + new Rectangle(1355, 3750, 30, 48), + new Rectangle(1117, 3988, 30, 48), + new Rectangle(4057, 1049, 30, 48), + new Rectangle(2160, 3498, 18, 30), + new Rectangle(1704, 3955, 18, 30), + new Rectangle(1679, 3980, 18, 30), + new Rectangle(1620, 813, 46, 90), + new Rectangle(1018, 1415, 46, 90), + new Rectangle(527, 1909, 46, 90), + new Rectangle(1436, 1058, 44, 66), + new Rectangle(123, 3167, 40, 896), + new Rectangle(3797, 1121, 40, 784), + new Rectangle(164, 3167, 40, 896), + new Rectangle(2686, 2242, 40, 784), + new Rectangle(615, 3143, 40, 840), + new Rectangle(205, 3162, 40, 896), + new Rectangle(1666, 3772, 26, 56), + new Rectangle(1099, 991, 54, 560), + new Rectangle(1957, 3441, 16, 16), + new Rectangle(246, 3162, 40, 896), + new Rectangle(287, 3164, 40, 896), + new Rectangle(328, 3169, 40, 896), + new Rectangle(656, 3881, 40, 168), + new Rectangle(1957, 3458, 16, 16), + new Rectangle(869, 3003, 40, 840), + new Rectangle(869, 3844, 40, 168), + new Rectangle(1957, 3475, 16, 16), + new Rectangle(2019, 0, 28, 90), + new Rectangle(1571, 0, 80, 102), + new Rectangle(564, 1012, 56, 76), + new Rectangle(369, 3169, 40, 896), + new Rectangle(1691, 512, 52, 896), + new Rectangle(1442, 737, 42, 90), + new Rectangle(1620, 949, 42, 90), + new Rectangle(1018, 1551, 42, 90), + new Rectangle(863, 1475, 48, 120), + new Rectangle(376, 1841, 52, 108), + new Rectangle(910, 3003, 40, 840), + new Rectangle(711, 855, 40, 210), + new Rectangle(587, 1741, 48, 280), + new Rectangle(969, 1366, 48, 280), + new Rectangle(1387, 0, 98, 368), + new Rectangle(2003, 151, 44, 160), + new Rectangle(456, 31, 174, 600), + new Rectangle(795, 1672, 44, 160), + new Rectangle(1450, 552, 34, 178), + new Rectangle(1851, 244, 34, 178), + new Rectangle(1744, 512, 48, 928), + new Rectangle(4057, 721, 38, 168), + new Rectangle(863, 1313, 52, 108), + new Rectangle(1406, 3421, 38, 168), + new Rectangle(1045, 3794, 38, 168), + new Rectangle(718, 1201, 32, 52), + new Rectangle(1274, 1201, 44, 160), + new Rectangle(467, 1226, 78, 180), + new Rectangle(111, 1184, 104, 200), + new Rectangle(453, 1564, 56, 322), + new Rectangle(1042, 991, 56, 322), + new Rectangle(631, 457, 120, 296), + new Rectangle(1042, 297, 104, 200), + new Rectangle(1387, 1074, 44, 272), + new Rectangle(376, 1247, 80, 102), + new Rectangle(1125, 699, 36, 200), + new Rectangle(656, 2366, 34, 34), + new Rectangle(693, 1804, 44, 66), + new Rectangle(1851, 745, 34, 144), + new Rectangle(410, 3164, 40, 896), + new Rectangle(1249, 3850, 30, 120), + new Rectangle(1387, 737, 54, 136), + new Rectangle(1636, 327, 58, 176), + new Rectangle(2604, 2242, 40, 840), + new Rectangle(1916, 2914, 40, 840), + new Rectangle(3756, 1121, 40, 840), + new Rectangle(2645, 2242, 40, 840), + new Rectangle(1199, 1314, 44, 66), + new Rectangle(1728, 3704, 26, 200), + new Rectangle(1042, 498, 82, 492), + new Rectangle(111, 1450, 82, 492), + new Rectangle(697, 3040, 32, 828), + new Rectangle(915, 0, 126, 1312), + new Rectangle(1387, 369, 76, 156), + new Rectangle(1810, 0, 76, 156), + new Rectangle(546, 1261, 76, 156), + new Rectangle(453, 1407, 76, 156), + new Rectangle(376, 1507, 76, 156), + new Rectangle(623, 1261, 76, 156), + new Rectangle(1997, 485, 44, 128), + new Rectangle(1729, 157, 64, 282), + new Rectangle(1388, 3718, 30, 48), + new Rectangle(1529, 3579, 30, 48), + new Rectangle(1183, 3927, 30, 48), + new Rectangle(881, 1832, 34, 48), + new Rectangle(1851, 1033, 34, 48), + new Rectangle(881, 1783, 34, 48), + new Rectangle(1387, 526, 62, 210), + new Rectangle(406, 452, 48, 168), + new Rectangle(587, 1418, 56, 322), + new Rectangle(0, 3168, 40, 896), + new Rectangle(883, 1706, 32, 36), + new Rectangle(478, 1985, 44, 56), + new Rectangle(41, 3168, 40, 896), + new Rectangle(734, 2990, 40, 1024), + new Rectangle(1486, 0, 84, 1512), + new Rectangle(1887, 71, 60, 1200), + new Rectangle(1794, 244, 56, 1176), + new Rectangle(1957, 3424, 16, 16), + new Rectangle(631, 31, 142, 212), + new Rectangle(631, 244, 130, 212), + new Rectangle(1948, 536, 44, 114), + new Rectangle(0, 1184, 110, 300), + new Rectangle(2216, 3445, 18, 30), + new Rectangle(2187, 3468, 18, 30), + new Rectangle(2139, 3522, 18, 30), + new Rectangle(2056, 3361, 38, 720), + new Rectangle(376, 1078, 90, 168), + new Rectangle(916, 1419, 48, 462), + new Rectangle(1442, 828, 42, 34), + new Rectangle(1596, 3282, 40, 812), + new Rectangle(1163, 113, 110, 1200), + new Rectangle(1276, 0, 110, 1200), + new Rectangle(774, 0, 140, 470), + new Rectangle(615, 3984, 38, 76), + new Rectangle(1184, 3648, 38, 156), + new Rectangle(910, 3844, 40, 140), + new Rectangle(533, 4001, 40, 62), + new Rectangle(1851, 600, 34, 144), + new Rectangle(376, 1664, 56, 176), + new Rectangle(863, 1095, 50, 102), + new Rectangle(863, 680, 50, 208), + new Rectangle(700, 1261, 50, 102), + new Rectangle(742, 1740, 44, 128), + new Rectangle(718, 1148, 32, 52), + new Rectangle(1256, 3788, 32, 32), + new Rectangle(492, 3163, 40, 840), + new Rectangle(1958, 0, 60, 108), + new Rectangle(82, 3157, 40, 896), + new Rectangle(1571, 327, 64, 232), + new Rectangle(194, 1450, 70, 290), + new Rectangle(530, 1418, 56, 406), + new Rectangle(1948, 151, 54, 198), + new Rectangle(1125, 498, 36, 200), + new Rectangle(1042, 0, 120, 296), + new Rectangle(533, 3160, 40, 840), + new Rectangle(1440, 907, 44, 68), + new Rectangle(0, 1485, 84, 492), + new Rectangle(574, 3143, 40, 840), + new Rectangle(1571, 750, 48, 464), + new Rectangle(2015, 3361, 40, 720), + new Rectangle(656, 3040, 40, 840), + new Rectangle(699, 1489, 52, 108), + new Rectangle(216, 1184, 48, 120), + new Rectangle(85, 1943, 56, 92), + new Rectangle(376, 1350, 76, 156), + new Rectangle(564, 1104, 76, 156), + new Rectangle(1652, 77, 76, 156), + new Rectangle(1733, 0, 76, 156), + new Rectangle(1571, 170, 76, 156), + new Rectangle(641, 1104, 76, 156), + new Rectangle(523, 632, 104, 200), + new Rectangle(0, 31, 264, 1152), + new Rectangle(194, 1741, 62, 128), + new Rectangle(1406, 1737, 24, 22), + new Rectangle(1637, 3680, 30, 28), + new Rectangle(1637, 3780, 28, 22), + new Rectangle(2291, 3376, 18, 26), + new Rectangle(57, 2015, 26, 20), + new Rectangle(1529, 3267, 22, 22), + new Rectangle(1661, 1151, 28, 36), + new Rectangle(1572, 3767, 22, 20), + new Rectangle(1564, 4024, 22, 18), + new Rectangle(1063, 1506, 34, 42), + new Rectangle(85, 1485, 24, 40), + new Rectangle(2440, 2242, 40, 1118), + new Rectangle(3592, 1121, 40, 1118), + new Rectangle(3838, 1121, 40, 784), + new Rectangle(2891, 2242, 40, 784), + new Rectangle(4043, 1121, 40, 784), + new Rectangle(2932, 2242, 40, 784), + new Rectangle(2973, 2242, 40, 784), + new Rectangle(3014, 2242, 40, 784), + new Rectangle(3055, 2242, 40, 784), + new Rectangle(3096, 2242, 40, 784), + new Rectangle(3137, 2242, 40, 784), + new Rectangle(2727, 2242, 40, 784), + new Rectangle(3879, 1121, 40, 784), + new Rectangle(2768, 2242, 40, 784), + new Rectangle(3920, 1121, 40, 784), + new Rectangle(2809, 2242, 40, 784), + new Rectangle(3961, 1121, 40, 784), + new Rectangle(2850, 2242, 40, 784), + new Rectangle(4002, 1121, 40, 784), + new Rectangle(3178, 3025, 40, 782), + new Rectangle(3219, 3025, 40, 782), + new Rectangle(3260, 3025, 40, 782), + new Rectangle(3301, 3025, 40, 782), + new Rectangle(3342, 3025, 40, 782), + new Rectangle(3383, 3025, 40, 782), + new Rectangle(3424, 3025, 40, 782), + new Rectangle(3797, 2691, 40, 782), + new Rectangle(3465, 3025, 40, 782), + new Rectangle(3752, 2747, 40, 782), + new Rectangle(3838, 2691, 40, 782), + new Rectangle(3506, 3025, 40, 782), + new Rectangle(3879, 2691, 40, 782), + new Rectangle(3547, 3025, 40, 782), + new Rectangle(3920, 2691, 40, 782), + new Rectangle(3588, 3025, 40, 782), + new Rectangle(3961, 2691, 40, 782), + new Rectangle(3629, 3025, 40, 782), + new Rectangle(4002, 2691, 40, 782), + new Rectangle(3178, 2240, 40, 784), + new Rectangle(3756, 1962, 40, 784), + new Rectangle(3961, 1906, 40, 784), + new Rectangle(2932, 3027, 40, 784), + new Rectangle(2973, 3027, 40, 784), + new Rectangle(3014, 3027, 40, 784), + new Rectangle(3055, 3027, 40, 784), + new Rectangle(3096, 3027, 40, 784), + new Rectangle(3137, 3027, 40, 784), + new Rectangle(3219, 2240, 40, 784), + new Rectangle(3260, 2240, 40, 784), + new Rectangle(3301, 2240, 40, 784), + new Rectangle(3342, 2240, 40, 784), + new Rectangle(3383, 2240, 40, 784), + new Rectangle(3424, 2240, 40, 784), + new Rectangle(2604, 3083, 40, 784), + new Rectangle(3797, 1906, 40, 784), + new Rectangle(3465, 2240, 40, 784), + new Rectangle(2686, 3027, 40, 784), + new Rectangle(2645, 3083, 40, 784), + new Rectangle(3838, 1906, 40, 784), + new Rectangle(3506, 2240, 40, 784), + new Rectangle(2727, 3027, 40, 784), + new Rectangle(3879, 1906, 40, 784), + new Rectangle(3547, 2240, 40, 784), + new Rectangle(2768, 3027, 40, 784), + new Rectangle(3920, 1906, 40, 784), + new Rectangle(3588, 2240, 40, 784), + new Rectangle(2809, 3027, 40, 784), + new Rectangle(3629, 2240, 40, 784), + new Rectangle(2850, 3027, 40, 784), + new Rectangle(4002, 1906, 40, 784), + new Rectangle(3670, 2240, 40, 784), + new Rectangle(2891, 3027, 40, 784), + new Rectangle(4043, 1906, 40, 784), + new Rectangle(3711, 2240, 40, 784), + new Rectangle(3633, 1121, 40, 1118), + new Rectangle(2481, 2242, 40, 1118), + new Rectangle(2522, 2242, 40, 1118), + new Rectangle(3059, 1121, 40, 1120), + new Rectangle(3674, 1121, 40, 1118), + new Rectangle(2563, 2242, 40, 1118), + new Rectangle(1974, 2856, 40, 1118), + new Rectangle(3715, 1121, 40, 1118), + new Rectangle(991, 4054, 32, 32), + new Rectangle(1555, 1721, 14, 32), + new Rectangle(1555, 1787, 14, 32), + new Rectangle(1529, 3313, 22, 22), + new Rectangle(1933, 1437, 14, 32), + new Rectangle(1933, 1470, 14, 32), + new Rectangle(1750, 3905, 18, 32), + new Rectangle(1322, 3798, 30, 32), + new Rectangle(1150, 3971, 30, 32), + new Rectangle(1562, 3490, 32, 32), + new Rectangle(771, 29, 1, 1), + new Rectangle(454, 621, 1, 1), + new Rectangle(1529, 2734, 22, 24), + new Rectangle(1795, 3890, 18, 18), + new Rectangle(470, 1115, 2, 20), + new Rectangle(1957, 3509, 16, 16), + new Rectangle(1529, 3290, 22, 22), + new Rectangle(1555, 2183, 14, 14), + new Rectangle(1050, 3996, 32, 32), + new Rectangle(2095, 3559, 18, 32), + new Rectangle(520, 866, 2, 42), + new Rectangle(1957, 3526, 16, 16), + new Rectangle(2034, 835, 12, 12), + new Rectangle(1555, 1513, 14, 42), + new Rectangle(1555, 2198, 14, 14), + new Rectangle(1851, 1191, 34, 34), + new Rectangle(656, 2401, 34, 34), + new Rectangle(1957, 3543, 16, 16), + new Rectangle(1406, 2061, 22, 30), + new Rectangle(762, 316, 10, 32), + new Rectangle(1933, 1638, 14, 20), + new Rectangle(1974, 1793, 14, 14), + new Rectangle(2216, 3428, 20, 16), + new Rectangle(1851, 1226, 34, 34), + new Rectangle(1957, 3560, 16, 16), + new Rectangle(656, 2436, 34, 34), + new Rectangle(771, 0, 2, 28), + new Rectangle(1406, 2092, 22, 30), + new Rectangle(1555, 1971, 14, 24), + new Rectangle(1555, 2213, 14, 14), + new Rectangle(1974, 1808, 14, 14), + new Rectangle(1555, 1820, 14, 32), + new Rectangle(1555, 2228, 14, 14), + new Rectangle(656, 2574, 34, 32), + new Rectangle(1436, 976, 48, 48), + new Rectangle(478, 1936, 48, 48), + new Rectangle(523, 833, 100, 100), + new Rectangle(1887, 0, 70, 70), + new Rectangle(253, 1409, 10, 24), + new Rectangle(199, 1950, 54, 54), + new Rectangle(729, 848, 22, 6), + new Rectangle(467, 1078, 8, 8), + new Rectangle(2270, 3384, 18, 32), + new Rectangle(718, 1254, 22, 6), + new Rectangle(254, 1895, 10, 24), + new Rectangle(1475, 1158, 10, 18), + new Rectangle(1974, 1823, 14, 14), + new Rectangle(1147, 354, 14, 54), + new Rectangle(1147, 409, 14, 54), + new Rectangle(433, 1664, 18, 50), + new Rectangle(510, 1621, 18, 50), + new Rectangle(1147, 297, 14, 56), + new Rectangle(433, 1715, 18, 50), + new Rectangle(656, 2471, 34, 34), + new Rectangle(376, 977, 100, 100), + new Rectangle(1555, 2243, 14, 14), + new Rectangle(406, 866, 110, 110), + new Rectangle(1974, 1838, 14, 14), + new Rectangle(1555, 2258, 14, 14), + new Rectangle(2149, 3388, 26, 26), + new Rectangle(1637, 3900, 26, 26), + new Rectangle(1974, 1853, 14, 14), + new Rectangle(1571, 560, 54, 136), + new Rectangle(1681, 3963, 20, 16), + new Rectangle(1885, 3541, 28, 18), + new Rectangle(1406, 2123, 22, 30), + new Rectangle(576, 1866, 10, 22), + new Rectangle(2312, 3361, 18, 24), + new Rectangle(1529, 2759, 22, 24), + new Rectangle(1529, 3336, 22, 22), + new Rectangle(1957, 3577, 16, 16), + new Rectangle(1555, 1853, 14, 32), + new Rectangle(1933, 1503, 14, 32), + new Rectangle(628, 693, 2, 60), + new Rectangle(474, 1087, 2, 42), + new Rectangle(1957, 3594, 16, 16), + new Rectangle(644, 1489, 54, 136), + new Rectangle(1636, 504, 54, 136), + new Rectangle(517, 866, 2, 60), + new Rectangle(467, 1115, 2, 28), + new Rectangle(467, 1087, 6, 6), + new Rectangle(1555, 1886, 14, 32), + new Rectangle(1388, 3656, 32, 32), + new Rectangle(1679, 641, 10, 24), + new Rectangle(467, 1094, 6, 6), + new Rectangle(1836, 3723, 16, 16), + new Rectangle(1957, 3611, 16, 16), + new Rectangle(628, 754, 100, 100), + new Rectangle(762, 378, 10, 28), + new Rectangle(1529, 3523, 32, 32), + new Rectangle(628, 632, 2, 60), + new Rectangle(1957, 3492, 16, 16), + new Rectangle(729, 754, 22, 48), + new Rectangle(1933, 1371, 14, 32), + new Rectangle(520, 909, 2, 20), + new Rectangle(406, 632, 116, 116), + new Rectangle(4057, 989, 32, 32), + new Rectangle(510, 1564, 18, 56), + new Rectangle(451, 624, 1, 1), + new Rectangle(1555, 2168, 14, 14), + new Rectangle(624, 833, 2, 20), + new Rectangle(644, 1679, 48, 320), + new Rectangle(406, 749, 116, 116), + new Rectangle(1555, 1754, 14, 32), + new Rectangle(1933, 1404, 14, 32), + new Rectangle(1695, 315, 32, 52), + new Rectangle(429, 1887, 48, 120), + new Rectangle(1154, 1314, 44, 160), + new Rectangle(451, 3164, 40, 896), + new Rectangle(656, 2188, 34, 142), + new Rectangle(1661, 1188, 28, 36), + new Rectangle(82, 4054, 40, 26), + new Rectangle(656, 2506, 34, 34), + new Rectangle(1653, 2530, 40, 1120), + new Rectangle(3100, 1121, 40, 1120), + new Rectangle(1836, 3740, 16, 16), + new Rectangle(1047, 1826, 12, 12), + new Rectangle(451, 621, 2, 2), + new Rectangle(467, 1101, 6, 6), + new Rectangle(467, 1108, 6, 6), + new Rectangle(1473, 1409, 12, 12), + new Rectangle(1436, 1025, 46, 32), + new Rectangle(1957, 3628, 16, 16), + new Rectangle(1183, 3871, 32, 32), + new Rectangle(265, 31, 190, 420), + new Rectangle(1406, 2154, 22, 30), + new Rectangle(477, 977, 86, 248), + new Rectangle(624, 855, 86, 248), + new Rectangle(1695, 479, 54, 32), + new Rectangle(1854, 3581, 26, 200) + }; + } + + public static void LoadContent(ContentManager Content) + { + SpriteSheet<_sheetSprites>.tex = Content.Load("Images/_sheetSprites"); + } + + public enum ID + { + ALBINOANTLIONBODY, + ALCHEMYSTATION, + ANTLIONBODY, + ARM_BONE, + ARM_BONE_2, + ARMOR_ARM_1, + ARMOR_ARM_2, + ARMOR_ARM_3, + ARMOR_ARM_4, + ARMOR_ARM_5, + ARMOR_ARM_6, + ARMOR_ARM_7, + ARMOR_ARM_8, + ARMOR_ARM_9, + ARMOR_ARM_10, + ARMOR_ARM_11, + ARMOR_ARM_12, + ARMOR_ARM_13, + ARMOR_ARM_14, + ARMOR_ARM_15, + ARMOR_ARM_16, + ARMOR_ARM_17, + ARMOR_ARM_18, + ARMOR_ARM_19, + ARMOR_ARM_20, + ARMOR_ARM_21, + ARMOR_ARM_22, + ARMOR_ARM_23, + ARMOR_ARM_24, + ARMOR_ARM_25, + ARMOR_ARM_26, + ARMOR_ARM_27, + ARMOR_ARM_28, + ARMOR_BODY_1, + ARMOR_BODY_2, + ARMOR_BODY_3, + ARMOR_BODY_4, + ARMOR_BODY_5, + ARMOR_BODY_6, + ARMOR_BODY_7, + ARMOR_BODY_8, + ARMOR_BODY_9, + ARMOR_BODY_10, + ARMOR_BODY_11, + ARMOR_BODY_12, + ARMOR_BODY_13, + ARMOR_BODY_14, + ARMOR_BODY_15, + ARMOR_BODY_16, + ARMOR_BODY_17, + ARMOR_BODY_18, + ARMOR_BODY_19, + ARMOR_BODY_20, + ARMOR_BODY_21, + ARMOR_BODY_22, + ARMOR_BODY_23, + ARMOR_BODY_24, + ARMOR_BODY_25, + ARMOR_BODY_26, + ARMOR_BODY_27, + ARMOR_BODY_28, + ARMOR_HEAD_1, + ARMOR_HEAD_2, + ARMOR_HEAD_3, + ARMOR_HEAD_4, + ARMOR_HEAD_5, + ARMOR_HEAD_6, + ARMOR_HEAD_7, + ARMOR_HEAD_8, + ARMOR_HEAD_9, + ARMOR_HEAD_10, + ARMOR_HEAD_11, + ARMOR_HEAD_12, + ARMOR_HEAD_13, + ARMOR_HEAD_14, + ARMOR_HEAD_15, + ARMOR_HEAD_16, + ARMOR_HEAD_17, + ARMOR_HEAD_18, + ARMOR_HEAD_19, + ARMOR_HEAD_20, + ARMOR_HEAD_21, + ARMOR_HEAD_22, + ARMOR_HEAD_23, + ARMOR_HEAD_24, + ARMOR_HEAD_25, + ARMOR_HEAD_26, + ARMOR_HEAD_27, + ARMOR_HEAD_28, + ARMOR_HEAD_29, + ARMOR_HEAD_30, + ARMOR_HEAD_31, + ARMOR_HEAD_32, + ARMOR_HEAD_33, + ARMOR_HEAD_34, + ARMOR_HEAD_35, + ARMOR_HEAD_36, + ARMOR_HEAD_37, + ARMOR_HEAD_38, + ARMOR_HEAD_39, + ARMOR_HEAD_40, + ARMOR_HEAD_41, + ARMOR_HEAD_42, + ARMOR_HEAD_43, + ARMOR_HEAD_44, + ARMOR_HEAD_45, + ARMOR_HEAD_46, + ARMOR_HEAD_47, + ARMOR_LEGS_1, + ARMOR_LEGS_2, + ARMOR_LEGS_3, + ARMOR_LEGS_4, + ARMOR_LEGS_5, + ARMOR_LEGS_6, + ARMOR_LEGS_7, + ARMOR_LEGS_8, + ARMOR_LEGS_9, + ARMOR_LEGS_10, + ARMOR_LEGS_11, + ARMOR_LEGS_12, + ARMOR_LEGS_13, + ARMOR_LEGS_14, + ARMOR_LEGS_15, + ARMOR_LEGS_16, + ARMOR_LEGS_17, + ARMOR_LEGS_18, + ARMOR_LEGS_19, + ARMOR_LEGS_20, + ARMOR_LEGS_21, + ARMOR_LEGS_22, + ARMOR_LEGS_23, + ARMOR_LEGS_24, + ARMOR_LEGS_25, + ARMOR_LEGS_26, + ARMOR_LEGS_27, + ARROWD, + ARROWR, + BONE_EYES, + BONE_LASER, + BOOKCASE, + BUBBLE, + BUBBLE_EMPTY, + BUFF_1, + BUFF_2, + BUFF_3, + BUFF_4, + BUFF_5, + BUFF_6, + BUFF_7, + BUFF_8, + BUFF_9, + BUFF_10, + BUFF_11, + BUFF_12, + BUFF_13, + BUFF_14, + BUFF_15, + BUFF_16, + BUFF_17, + BUFF_18, + BUFF_19, + BUFF_20, + BUFF_21, + BUFF_22, + BUFF_23, + BUFF_24, + BUFF_25, + BUFF_26, + BUFF_27, + BUFF_28, + BUFF_29, + BUFF_30, + BUFF_31, + BUFF_32, + BUFF_33, + BUFF_34, + BUFF_35, + BUFF_36, + BUFF_37, + BUFF_38, + BUFF_39, + BUFF_40_1, + BUFF_40_2, + BUFF_40_3, + BUFF_40_4, + BUFF_40_5, + BUFF_40_6, + CHAIN2, + CHAIN3, + CHAIN4, + CHAIN5, + CHAIN6, + CHAIN7, + CHAIN8, + CHAIN9, + CHAIN10, + CHAIN11, + CHAIN12, + CHAIN, + CHAOS, + CHAT2, + CHAT, + CHECK, + CONFUSE, + COOLDOWN, + CRAFT, + CRAFTCATEGORY_1, + CRAFTCATEGORY_2, + CRAFTCATEGORY_3, + CRAFTCATEGORY_4, + CRAFTCATEGORY_5, + CRAFTCATEGORY_6, + DEMONALTAR, + DEPOSIT, + DEST1, + DEST2, + DEST3, + DPAD, + DUST, + EQUIP, + EYE_LASER, + FEMALE_BODY_1, + FEMALE_BODY_2, + FEMALE_BODY_3, + FEMALE_BODY_4, + FEMALE_BODY_5, + FEMALE_BODY_6, + FEMALE_BODY_7, + FEMALE_BODY_8, + FEMALE_BODY_9, + FEMALE_BODY_10, + FEMALE_BODY_11, + FEMALE_BODY_12, + FEMALE_BODY_13, + FEMALE_BODY_14, + FEMALE_BODY_15, + FEMALE_BODY_16, + FEMALE_BODY_17, + FEMALE_BODY_18, + FEMALE_BODY_19, + FEMALE_BODY_20, + FEMALE_BODY_21, + FEMALE_BODY_22, + FEMALE_BODY_23, + FEMALE_BODY_24, + FEMALE_BODY_25, + FEMALE_BODY_26, + FEMALE_BODY_27, + FEMALE_BODY_28, + FEMALE_PANTS, + FEMALE_SHIRT2, + FEMALE_SHIRT, + FEMALE_SHOES, + FEMALE_UNDERSHIRT2, + FEMALE_UNDERSHIRT, + GHOST, + GORE_0, + GORE_1, + GORE_2, + GORE_3, + GORE_4, + GORE_5, + GORE_6, + GORE_7, + GORE_8, + GORE_9, + GORE_10, + GORE_11, + GORE_12, + GORE_13, + GORE_14, + GORE_15, + GORE_16, + GORE_17, + GORE_18, + GORE_19, + GORE_20, + GORE_21, + GORE_22, + GORE_23, + GORE_24, + GORE_25, + GORE_26, + GORE_27, + GORE_28, + GORE_29, + GORE_30, + GORE_31, + GORE_32, + GORE_33, + GORE_34, + GORE_35, + GORE_36, + GORE_37, + GORE_38, + GORE_39, + GORE_40, + GORE_41, + GORE_42, + GORE_43, + GORE_44, + GORE_45, + GORE_46, + GORE_47, + GORE_48, + GORE_49, + GORE_50, + GORE_51, + GORE_52, + GORE_53, + GORE_54, + GORE_55, + GORE_56, + GORE_57, + GORE_58, + GORE_59, + GORE_60, + GORE_61, + GORE_62, + GORE_63, + GORE_64, + GORE_65, + GORE_66, + GORE_67, + GORE_68, + GORE_69, + GORE_70, + GORE_71, + GORE_72, + GORE_73, + GORE_74, + GORE_75, + GORE_76, + GORE_77, + GORE_78, + GORE_79, + GORE_80, + GORE_81, + GORE_82, + GORE_83, + GORE_84, + GORE_85, + GORE_86, + GORE_87, + GORE_88, + GORE_89, + GORE_90, + GORE_91, + GORE_92, + GORE_93, + GORE_94, + GORE_95, + GORE_96, + GORE_97, + GORE_98, + GORE_99, + GORE_100, + GORE_101, + GORE_102, + GORE_103, + GORE_104, + GORE_105, + GORE_106, + GORE_107, + GORE_108, + GORE_109, + GORE_110, + GORE_111, + GORE_112, + GORE_113, + GORE_114, + GORE_115, + GORE_116, + GORE_117, + GORE_118, + GORE_119, + GORE_120, + GORE_121, + GORE_122, + GORE_123, + GORE_124, + GORE_125, + GORE_126, + GORE_127, + GORE_128, + GORE_129, + GORE_130, + GORE_131, + GORE_132, + GORE_133, + GORE_134, + GORE_135, + GORE_136, + GORE_137, + GORE_138, + GORE_139, + GORE_140, + GORE_141, + GORE_142, + GORE_143, + GORE_144, + GORE_145, + GORE_146, + GORE_147, + GORE_148, + GORE_149, + GORE_150, + GORE_151, + GORE_152, + GORE_153, + GORE_154, + GORE_155, + GORE_156, + GORE_157, + GORE_158, + GORE_159, + GORE_160, + GORE_161, + GORE_162, + GORE_163, + GORE_164, + GORE_165, + GORE_166, + GORE_167, + GORE_168, + GORE_169, + GORE_170, + GORE_171, + GORE_172, + GORE_173, + GORE_174, + GRID, + HEART1, + HEART2, + HEART3, + HEART, + HEART_EMPTY, + HOUSE_1, + HOUSE_2, + HOUSE_BANNER_1, + INVENTORY, + INVENTORY_BACK2, + INVENTORY_BACK3, + INVENTORY_BACK4, + INVENTORY_BACK5, + INVENTORY_BACK6, + INVENTORY_BACK7, + INVENTORY_BACK9, + INVENTORY_BACK10, + INVENTORY_BACK11, + INVENTORY_BACK12, + INVENTORY_BACK, + ITEM_1, + ITEM_2, + ITEM_3, + ITEM_4, + ITEM_5, + ITEM_6, + ITEM_7, + ITEM_8, + ITEM_9, + ITEM_10, + ITEM_11, + ITEM_12, + ITEM_13, + ITEM_14, + ITEM_15, + ITEM_16, + ITEM_17, + ITEM_18, + ITEM_19, + ITEM_20, + ITEM_21, + ITEM_22, + ITEM_23, + ITEM_24, + ITEM_25, + ITEM_26, + ITEM_27, + ITEM_28, + ITEM_29, + ITEM_30, + ITEM_31, + ITEM_32, + ITEM_33, + ITEM_34, + ITEM_35, + ITEM_36, + ITEM_37, + ITEM_38, + ITEM_39, + ITEM_40, + ITEM_41, + ITEM_42, + ITEM_43, + ITEM_44, + ITEM_45, + ITEM_46, + ITEM_47, + ITEM_48, + ITEM_49, + ITEM_50, + ITEM_51, + ITEM_52, + ITEM_53, + ITEM_54, + ITEM_55, + ITEM_56, + ITEM_57, + ITEM_58, + ITEM_59, + ITEM_60, + ITEM_61, + ITEM_62, + ITEM_63, + ITEM_64, + ITEM_65, + ITEM_66, + ITEM_67, + ITEM_68, + ITEM_69, + ITEM_70, + ITEM_71, + ITEM_72, + ITEM_73, + ITEM_74, + ITEM_75, + ITEM_76, + ITEM_77, + ITEM_78, + ITEM_79, + ITEM_80, + ITEM_81, + ITEM_82, + ITEM_83, + ITEM_84, + ITEM_85, + ITEM_86, + ITEM_87, + ITEM_88, + ITEM_89, + ITEM_90, + ITEM_91, + ITEM_92, + ITEM_93, + ITEM_94, + ITEM_95, + ITEM_96, + ITEM_97, + ITEM_98, + ITEM_99, + ITEM_100, + ITEM_101, + ITEM_102, + ITEM_103, + ITEM_104, + ITEM_105, + ITEM_106, + ITEM_107, + ITEM_108, + ITEM_109, + ITEM_110, + ITEM_111, + ITEM_112, + ITEM_113, + ITEM_114, + ITEM_115, + ITEM_116, + ITEM_117, + ITEM_118, + ITEM_119, + ITEM_120, + ITEM_121, + ITEM_122, + ITEM_123, + ITEM_124, + ITEM_125, + ITEM_126, + ITEM_127, + ITEM_128, + ITEM_129, + ITEM_130, + ITEM_131, + ITEM_132, + ITEM_133, + ITEM_134, + ITEM_135, + ITEM_136, + ITEM_137, + ITEM_138, + ITEM_139, + ITEM_140, + ITEM_141, + ITEM_142, + ITEM_143, + ITEM_144, + ITEM_145, + ITEM_146, + ITEM_147, + ITEM_148, + ITEM_149, + ITEM_150, + ITEM_151, + ITEM_152, + ITEM_153, + ITEM_154, + ITEM_155, + ITEM_156, + ITEM_157, + ITEM_158, + ITEM_159, + ITEM_160, + ITEM_161, + ITEM_162, + ITEM_163, + ITEM_164, + ITEM_165, + ITEM_166, + ITEM_167, + ITEM_168, + ITEM_169, + ITEM_170, + ITEM_171, + ITEM_172, + ITEM_173, + ITEM_174, + ITEM_175, + ITEM_176, + ITEM_177, + ITEM_178, + ITEM_179, + ITEM_180, + ITEM_181, + ITEM_182, + ITEM_183, + ITEM_184, + ITEM_185, + ITEM_186, + ITEM_187, + ITEM_188, + ITEM_189, + ITEM_190, + ITEM_191, + ITEM_192, + ITEM_193, + ITEM_194, + ITEM_195, + ITEM_196, + ITEM_197, + ITEM_198, + ITEM_199, + ITEM_200, + ITEM_201, + ITEM_202, + ITEM_203, + ITEM_204, + ITEM_205, + ITEM_206, + ITEM_207, + ITEM_208, + ITEM_209, + ITEM_210, + ITEM_211, + ITEM_212, + ITEM_213, + ITEM_214, + ITEM_215, + ITEM_216, + ITEM_217, + ITEM_218, + ITEM_219, + ITEM_220, + ITEM_221, + ITEM_222, + ITEM_223, + ITEM_224, + ITEM_225, + ITEM_226, + ITEM_227, + ITEM_228, + ITEM_229, + ITEM_230, + ITEM_231, + ITEM_232, + ITEM_233, + ITEM_234, + ITEM_235, + ITEM_236, + ITEM_237, + ITEM_238, + ITEM_239, + ITEM_240, + ITEM_241, + ITEM_242, + ITEM_243, + ITEM_244, + ITEM_245, + ITEM_246, + ITEM_247, + ITEM_248, + ITEM_249, + ITEM_250, + ITEM_251, + ITEM_252, + ITEM_253, + ITEM_254, + ITEM_255, + ITEM_256, + ITEM_257, + ITEM_258, + ITEM_259, + ITEM_260, + ITEM_261, + ITEM_262, + ITEM_263, + ITEM_264, + ITEM_265, + ITEM_266, + ITEM_267, + ITEM_268, + ITEM_269, + ITEM_270, + ITEM_271, + ITEM_272, + ITEM_273, + ITEM_274, + ITEM_275, + ITEM_276, + ITEM_277, + ITEM_278, + ITEM_279, + ITEM_280, + ITEM_281, + ITEM_282, + ITEM_283, + ITEM_284, + ITEM_285, + ITEM_286, + ITEM_287, + ITEM_288, + ITEM_289, + ITEM_290, + ITEM_291, + ITEM_292, + ITEM_293, + ITEM_294, + ITEM_295, + ITEM_296, + ITEM_297, + ITEM_298, + ITEM_299, + ITEM_300, + ITEM_301, + ITEM_302, + ITEM_303, + ITEM_304, + ITEM_305, + ITEM_306, + ITEM_307, + ITEM_308, + ITEM_309, + ITEM_310, + ITEM_311, + ITEM_312, + ITEM_313, + ITEM_314, + ITEM_315, + ITEM_316, + ITEM_317, + ITEM_318, + ITEM_319, + ITEM_320, + ITEM_321, + ITEM_322, + ITEM_323, + ITEM_324, + ITEM_325, + ITEM_326, + ITEM_327, + ITEM_328, + ITEM_329, + ITEM_330, + ITEM_331, + ITEM_332, + ITEM_333, + ITEM_334, + ITEM_335, + ITEM_336, + ITEM_337, + ITEM_338, + ITEM_339, + ITEM_340, + ITEM_341, + ITEM_342, + ITEM_343, + ITEM_344, + ITEM_345, + ITEM_346, + ITEM_347, + ITEM_348, + ITEM_349, + ITEM_350, + ITEM_351, + ITEM_352, + ITEM_353, + ITEM_354, + ITEM_355, + ITEM_356, + ITEM_357, + ITEM_358, + ITEM_359, + ITEM_360, + ITEM_361, + ITEM_362, + ITEM_363, + ITEM_364, + ITEM_365, + ITEM_366, + ITEM_367, + ITEM_368, + ITEM_369, + ITEM_370, + ITEM_371, + ITEM_372, + ITEM_373, + ITEM_374, + ITEM_375, + ITEM_376, + ITEM_377, + ITEM_378, + ITEM_379, + ITEM_380, + ITEM_381, + ITEM_382, + ITEM_383, + ITEM_384, + ITEM_385, + ITEM_386, + ITEM_387, + ITEM_388, + ITEM_389, + ITEM_390, + ITEM_391, + ITEM_392, + ITEM_393, + ITEM_394, + ITEM_395, + ITEM_396, + ITEM_397, + ITEM_398, + ITEM_399, + ITEM_400, + ITEM_401, + ITEM_402, + ITEM_403, + ITEM_404, + ITEM_405, + ITEM_406, + ITEM_407, + ITEM_408, + ITEM_409, + ITEM_410, + ITEM_411, + ITEM_412, + ITEM_413, + ITEM_414, + ITEM_415, + ITEM_416, + ITEM_417, + ITEM_418, + ITEM_419, + ITEM_420, + ITEM_421, + ITEM_422, + ITEM_423, + ITEM_424, + ITEM_425, + ITEM_426, + ITEM_427, + ITEM_428, + ITEM_429, + ITEM_430, + ITEM_431, + ITEM_432, + ITEM_433, + ITEM_434, + ITEM_435, + ITEM_436, + ITEM_437, + ITEM_438, + ITEM_439, + ITEM_440, + ITEM_441, + ITEM_442, + ITEM_443, + ITEM_444, + ITEM_445, + ITEM_446, + ITEM_447, + ITEM_448, + ITEM_449, + ITEM_450, + ITEM_451, + ITEM_452, + ITEM_453, + ITEM_454, + ITEM_455, + ITEM_456, + ITEM_457, + ITEM_458, + ITEM_459, + ITEM_460, + ITEM_461, + ITEM_462, + ITEM_463, + ITEM_464, + ITEM_465, + ITEM_466, + ITEM_467, + ITEM_468, + ITEM_469, + ITEM_470, + ITEM_471, + ITEM_472, + ITEM_473, + ITEM_474, + ITEM_475, + ITEM_476, + ITEM_477, + ITEM_478, + ITEM_479, + ITEM_480, + ITEM_481, + ITEM_482, + ITEM_483, + ITEM_484, + ITEM_485, + ITEM_486, + ITEM_487, + ITEM_488, + ITEM_489, + ITEM_490, + ITEM_491, + ITEM_492, + ITEM_493, + ITEM_494, + ITEM_495, + ITEM_496, + ITEM_497, + ITEM_498, + ITEM_499, + ITEM_500, + ITEM_501, + ITEM_502, + ITEM_503, + ITEM_504, + ITEM_505, + ITEM_506, + ITEM_507, + ITEM_508, + ITEM_509, + ITEM_510, + ITEM_511, + ITEM_512, + ITEM_513, + ITEM_514, + ITEM_515, + ITEM_516, + ITEM_517, + ITEM_518, + ITEM_519, + ITEM_520, + ITEM_521, + ITEM_522, + ITEM_523, + ITEM_524, + ITEM_525, + ITEM_526, + ITEM_527, + ITEM_528, + ITEM_529, + ITEM_530, + ITEM_531, + ITEM_532, + ITEM_533, + ITEM_534, + ITEM_535, + ITEM_536, + ITEM_537, + ITEM_538, + ITEM_539, + ITEM_540, + ITEM_541, + ITEM_542, + ITEM_543, + ITEM_544, + ITEM_545, + ITEM_546, + ITEM_547, + ITEM_548, + ITEM_549, + ITEM_550, + ITEM_551, + ITEM_552, + ITEM_553, + ITEM_554, + ITEM_555, + ITEM_556, + ITEM_557, + ITEM_558, + ITEM_559, + ITEM_560, + ITEM_561, + ITEM_562, + ITEM_563, + ITEM_564, + ITEM_565, + ITEM_566, + ITEM_567, + ITEM_568, + ITEM_569, + ITEM_570, + ITEM_571, + ITEM_572, + ITEM_573, + ITEM_574, + ITEM_575, + ITEM_576, + ITEM_577, + ITEM_578, + ITEM_579, + ITEM_580, + ITEM_581, + ITEM_582, + ITEM_583, + ITEM_584, + ITEM_585, + ITEM_586, + ITEM_587, + ITEM_588, + ITEM_589, + ITEM_590, + ITEM_591, + ITEM_592, + ITEM_593, + ITEM_594, + ITEM_595, + ITEM_596, + ITEM_597, + ITEM_598, + ITEM_599, + ITEM_600, + ITEM_601, + ITEM_602, + ITEM_603, + ITEM_604, + ITEM_605, + ITEM_606, + ITEM_607, + ITEM_608, + ITEM_609, + ITEM_610, + ITEM_611, + ITEM_612, + ITEM_613, + ITEM_614, + ITEM_615, + ITEM_616, + ITEM_617, + ITEM_618, + ITEM_619, + ITEM_620, + ITEM_621, + ITEM_622, + ITEM_623, + ITEM_624, + ITEM_625, + ITEM_626, + ITEM_627, + ITEM_628, + ITEM_629, + ITEM_630, + ITEM_631, + ITEM_632, + LIGHT_DISC, + LOOT, + MANA, + MANA_EMPTY, + NINJA, + NPC_1, + NPC_2, + NPC_3, + NPC_4, + NPC_5, + NPC_6, + NPC_7, + NPC_8, + NPC_9, + NPC_10, + NPC_11, + NPC_12, + NPC_13, + NPC_14, + NPC_15, + NPC_16, + NPC_17, + NPC_18, + NPC_19, + NPC_20, + NPC_21, + NPC_22, + NPC_23, + NPC_24, + NPC_25, + NPC_26, + NPC_27, + NPC_28, + NPC_29, + NPC_30, + NPC_31, + NPC_32, + NPC_33, + NPC_34, + NPC_35, + NPC_36, + NPC_37, + NPC_38, + NPC_39, + NPC_40, + NPC_41, + NPC_42, + NPC_43, + NPC_44, + NPC_45, + NPC_46, + NPC_47, + NPC_48, + NPC_49, + NPC_50, + NPC_51, + NPC_52, + NPC_53, + NPC_54, + NPC_55, + NPC_56, + NPC_57, + NPC_58, + NPC_59, + NPC_60, + NPC_61, + NPC_62, + NPC_63, + NPC_64, + NPC_65, + NPC_66, + NPC_67, + NPC_68, + NPC_69, + NPC_70, + NPC_71, + NPC_72, + NPC_73, + NPC_74, + NPC_75, + NPC_76, + NPC_77, + NPC_78, + NPC_79, + NPC_80, + NPC_81, + NPC_82, + NPC_83, + NPC_84, + NPC_85, + NPC_86, + NPC_87, + NPC_88, + NPC_89, + NPC_90, + NPC_91, + NPC_92, + NPC_93, + NPC_94, + NPC_95, + NPC_96, + NPC_97, + NPC_98, + NPC_99, + NPC_100, + NPC_101, + NPC_102, + NPC_103, + NPC_104, + NPC_105, + NPC_106, + NPC_107, + NPC_108, + NPC_109, + NPC_110, + NPC_111, + NPC_112, + NPC_113, + NPC_114, + NPC_115, + NPC_116, + NPC_117, + NPC_118, + NPC_119, + NPC_120, + NPC_121, + NPC_122, + NPC_123, + NPC_124, + NPC_125, + NPC_126, + NPC_127, + NPC_128, + NPC_129, + NPC_130, + NPC_131, + NPC_132, + NPC_133, + NPC_134, + NPC_135, + NPC_136, + NPC_137, + NPC_138, + NPC_139, + NPC_140, + NPC_141, + NPC_142, + NPC_143, + NPC_144, + NPC_145, + NPC_146, + NPC_147, + NPC_148, + NPC_149, + NPC_150, + NPC_151, + NPC_152, + NPC_153, + NPC_154, + NPC_155, + NPC_156, + NPC_157, + NPC_158, + NPC_159, + NPC_160, + NPC_161, + NPC_162, + NPC_163, + NPC_164, + NPC_165, + NPC_166, + NPC_167, + NPC_HEAD_1, + NPC_HEAD_2, + NPC_HEAD_3, + NPC_HEAD_4, + NPC_HEAD_5, + NPC_HEAD_6, + NPC_HEAD_7, + NPC_HEAD_8, + NPC_HEAD_9, + NPC_HEAD_10, + NPC_HEAD_11, + PLAYER_EYE_WHITES, + PLAYER_EYES, + PLAYER_HAIR_1, + PLAYER_HAIR_2, + PLAYER_HAIR_3, + PLAYER_HAIR_4, + PLAYER_HAIR_5, + PLAYER_HAIR_6, + PLAYER_HAIR_7, + PLAYER_HAIR_8, + PLAYER_HAIR_9, + PLAYER_HAIR_10, + PLAYER_HAIR_11, + PLAYER_HAIR_12, + PLAYER_HAIR_13, + PLAYER_HAIR_14, + PLAYER_HAIR_15, + PLAYER_HAIR_16, + PLAYER_HAIR_17, + PLAYER_HAIR_18, + PLAYER_HAIR_19, + PLAYER_HAIR_20, + PLAYER_HAIR_21, + PLAYER_HAIR_22, + PLAYER_HAIR_23, + PLAYER_HAIR_24, + PLAYER_HAIR_25, + PLAYER_HAIR_26, + PLAYER_HAIR_27, + PLAYER_HAIR_28, + PLAYER_HAIR_29, + PLAYER_HAIR_30, + PLAYER_HAIR_31, + PLAYER_HAIR_32, + PLAYER_HAIR_33, + PLAYER_HAIR_34, + PLAYER_HAIR_35, + PLAYER_HAIR_36, + PLAYER_HAIRALT_1, + PLAYER_HAIRALT_2, + PLAYER_HAIRALT_3, + PLAYER_HAIRALT_4, + PLAYER_HAIRALT_5, + PLAYER_HAIRALT_6, + PLAYER_HAIRALT_7, + PLAYER_HAIRALT_8, + PLAYER_HAIRALT_9, + PLAYER_HAIRALT_10, + PLAYER_HAIRALT_11, + PLAYER_HAIRALT_12, + PLAYER_HAIRALT_13, + PLAYER_HAIRALT_14, + PLAYER_HAIRALT_15, + PLAYER_HAIRALT_16, + PLAYER_HAIRALT_17, + PLAYER_HAIRALT_18, + PLAYER_HAIRALT_19, + PLAYER_HAIRALT_20, + PLAYER_HAIRALT_21, + PLAYER_HAIRALT_22, + PLAYER_HAIRALT_23, + PLAYER_HAIRALT_24, + PLAYER_HAIRALT_25, + PLAYER_HAIRALT_26, + PLAYER_HAIRALT_27, + PLAYER_HAIRALT_28, + PLAYER_HAIRALT_29, + PLAYER_HAIRALT_30, + PLAYER_HAIRALT_31, + PLAYER_HAIRALT_32, + PLAYER_HAIRALT_33, + PLAYER_HAIRALT_34, + PLAYER_HAIRALT_35, + PLAYER_HAIRALT_36, + PLAYER_HANDS2, + PLAYER_HANDS, + PLAYER_HEAD, + PLAYER_PANTS, + PLAYER_SHIRT, + PLAYER_SHOES, + PLAYER_UNDERSHIRT2, + PLAYER_UNDERSHIRT, + PROBE, + PROJECTILE_1, + PROJECTILE_2, + PROJECTILE_3, + PROJECTILE_4, + PROJECTILE_5, + PROJECTILE_6, + PROJECTILE_7, + PROJECTILE_8, + PROJECTILE_9, + PROJECTILE_10, + PROJECTILE_11, + PROJECTILE_12, + PROJECTILE_13, + PROJECTILE_14, + PROJECTILE_15, + PROJECTILE_16, + PROJECTILE_17, + PROJECTILE_18, + PROJECTILE_19, + PROJECTILE_20, + PROJECTILE_21, + PROJECTILE_22, + PROJECTILE_23, + PROJECTILE_24, + PROJECTILE_25, + PROJECTILE_26, + PROJECTILE_27, + PROJECTILE_28, + PROJECTILE_29, + PROJECTILE_30, + PROJECTILE_31, + PROJECTILE_32, + PROJECTILE_33, + PROJECTILE_34, + PROJECTILE_35, + PROJECTILE_36, + PROJECTILE_37, + PROJECTILE_38, + PROJECTILE_39, + PROJECTILE_40, + PROJECTILE_41, + PROJECTILE_42, + PROJECTILE_43, + PROJECTILE_44, + PROJECTILE_45, + PROJECTILE_46, + PROJECTILE_47, + PROJECTILE_48, + PROJECTILE_49, + PROJECTILE_50, + PROJECTILE_51, + PROJECTILE_52, + PROJECTILE_53, + PROJECTILE_54, + PROJECTILE_55, + PROJECTILE_56, + PROJECTILE_57, + PROJECTILE_58, + PROJECTILE_59, + PROJECTILE_60, + PROJECTILE_61, + PROJECTILE_62, + PROJECTILE_63, + PROJECTILE_64, + PROJECTILE_65, + PROJECTILE_66, + PROJECTILE_67, + PROJECTILE_68, + PROJECTILE_69, + PROJECTILE_70, + PROJECTILE_71, + PROJECTILE_72, + PROJECTILE_73, + PROJECTILE_74, + PROJECTILE_75, + PROJECTILE_76, + PROJECTILE_77, + PROJECTILE_78, + PROJECTILE_79, + PROJECTILE_80, + PROJECTILE_81, + PROJECTILE_82, + PROJECTILE_83, + PROJECTILE_84, + PROJECTILE_85, + PROJECTILE_86, + PROJECTILE_87, + PROJECTILE_88, + PROJECTILE_89, + PROJECTILE_90, + PROJECTILE_91, + PROJECTILE_92, + PROJECTILE_93, + PROJECTILE_94, + PROJECTILE_95, + PROJECTILE_96, + PROJECTILE_97, + PROJECTILE_98, + PROJECTILE_99, + PROJECTILE_100, + PROJECTILE_101, + PROJECTILE_102, + PROJECTILE_103, + PROJECTILE_104, + PROJECTILE_105, + PROJECTILE_106, + PROJECTILE_107, + PROJECTILE_108, + PROJECTILE_109, + PROJECTILE_110, + PROJECTILE_111, + PROJECTILE_112, + PROJECTILE_113, + PROJECTILE_114, + PROJECTILE_115, + PROJECTILE_116, + PROJECTILE_117, + PROJECTILE_118, + PROJECTILE_119, + QUICKSTACK, + REFORGE, + SAVING, + SKIN_BODY, + SKIN_LEGS, + SPIKE_BASE, + STAR_0, + STAR_1, + STAR_2, + STAR_3, + STAR_4, + TABLECHAIR, + TEAM, + TRASH, + WALLOFFLESH, + WATER, + WINGS_1, + WINGS_2, + WORKBENCHCHAIR, + WRAITH_EYES, + } +} diff --git a/_sheetTiles.cs b/_sheetTiles.cs new file mode 100644 index 0000000..43091ec --- /dev/null +++ b/_sheetTiles.cs @@ -0,0 +1,466 @@ +// Type: _sheetTiles +// Assembly: game, Version=1.0.4.1, Culture=neutral, PublicKeyToken=null +// MVID: D0F84B30-D7A0-41D8-8306-C72BB0D9D9CF +// Assembly location: C:\Users\DartPower\Downloads\Terraria.Xbox.360.Edition.XBLA.XBOX360-MoNGoLS\5841128F\000D0000\Terraria\Terraria.exe\ASSEMBLY.exe + +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Content; +using Microsoft.Xna.Framework.Graphics; +using Terraria; + +public class _sheetTiles : SpriteSheet<_sheetTiles> +{ + static _sheetTiles() + { + SpriteSheet<_sheetTiles>.src = new Rectangle[219] + { + new Rectangle(1393, 1927, 48, 1300), + new Rectangle(1549, 29, 128, 16), + new Rectangle(177, 2837, 128, 96), + new Rectangle(420, 2596, 128, 96), + new Rectangle(289, 2073, 128, 16), + new Rectangle(993, 2019, 128, 288), + new Rectangle(524, 2488, 128, 48), + new Rectangle(1678, 29, 16, 16), + new Rectangle(0, 2550, 256, 104), + new Rectangle(289, 2008, 178, 64), + new Rectangle(257, 2561, 162, 78), + new Rectangle(910, 2235, 74, 52), + new Rectangle(1138, 1909, 126, 54), + new Rectangle(1240, 1818, 126, 54), + new Rectangle(920, 100, 16, 20), + new Rectangle(920, 121, 16, 20), + new Rectangle(1122, 2187, 50, 400), + new Rectangle(471, 2693, 72, 468), + new Rectangle(739, 55, 186, 44), + new Rectangle(902, 183, 12, 12), + new Rectangle(739, 192, 2, 2), + new Rectangle(926, 55, 6, 6), + new Rectangle(926, 62, 6, 6), + new Rectangle(915, 183, 12, 12), + new Rectangle(910, 2323, 64, 64), + new Rectangle(549, 2664, 64, 64), + new Rectangle(1516, 1754, 288, 270), + new Rectangle(1876, 0, 288, 270), + new Rectangle(1407, 960, 288, 396), + new Rectangle(739, 169, 162, 22), + new Rectangle(777, 2235, 132, 594), + new Rectangle(0, 2837, 176, 264), + new Rectangle(3430, 813, 288, 270), + new Rectangle(3539, 1355, 288, 270), + new Rectangle(0, 2279, 288, 270), + new Rectangle(469, 1827, 288, 270), + new Rectangle(411, 2783, 54, 162), + new Rectangle(1265, 1873, 72, 162), + new Rectangle(380, 2640, 36, 36), + new Rectangle(380, 2693, 90, 54), + new Rectangle(1122, 2146, 54, 40), + new Rectangle(724, 2588, 36, 80), + new Rectangle(418, 2073, 36, 20), + new Rectangle(544, 2729, 54, 38), + new Rectangle(524, 2537, 36, 20), + new Rectangle(1706, 0, 144, 54), + new Rectangle(0, 3282, 54, 38), + new Rectangle(289, 2098, 252, 114), + new Rectangle(2563, 813, 288, 270), + new Rectangle(1227, 1421, 288, 396), + new Rectangle(739, 146, 162, 22), + new Rectangle(1805, 1628, 288, 270), + new Rectangle(176, 3110, 54, 38), + new Rectangle(669, 2371, 106, 72), + new Rectangle(1876, 813, 108, 36), + new Rectangle(0, 3321, 36, 54), + new Rectangle(2094, 1355, 288, 270), + new Rectangle(1262, 2071, 36, 36), + new Rectangle(289, 2379, 234, 90), + new Rectangle(544, 2768, 36, 66), + new Rectangle(1396, 1357, 106, 52), + new Rectangle(1876, 896, 106, 52), + new Rectangle(0, 3102, 106, 52), + new Rectangle(3032, 542, 288, 270), + new Rectangle(3321, 271, 288, 270), + new Rectangle(3610, 0, 288, 270), + new Rectangle(2563, 1084, 288, 270), + new Rectangle(2852, 813, 288, 270), + new Rectangle(902, 146, 34, 36), + new Rectangle(2094, 1626, 288, 270), + new Rectangle(2383, 1355, 288, 270), + new Rectangle(3321, 542, 288, 270), + new Rectangle(3610, 271, 288, 270), + new Rectangle(2852, 1084, 288, 270), + new Rectangle(542, 2189, 234, 90), + new Rectangle(306, 2822, 18, 66), + new Rectangle(177, 2934, 106, 48), + new Rectangle(0, 2746, 234, 90), + new Rectangle(289, 2470, 234, 90), + new Rectangle(3141, 813, 288, 270), + new Rectangle(758, 2001, 234, 90), + new Rectangle(235, 2655, 144, 108), + new Rectangle(2383, 1626, 288, 270), + new Rectangle(2672, 1355, 288, 270), + new Rectangle(3610, 542, 288, 270), + new Rectangle(3141, 1084, 288, 270), + new Rectangle(1696, 960, 288, 396), + new Rectangle(739, 123, 180, 22), + new Rectangle(536, 2280, 234, 90), + new Rectangle(2672, 1626, 288, 270), + new Rectangle(2961, 1355, 288, 270), + new Rectangle(3430, 1084, 288, 270), + new Rectangle(2961, 1626, 288, 270), + new Rectangle(3250, 1355, 288, 270), + new Rectangle(3250, 1626, 288, 270), + new Rectangle(1005, 1818, 234, 90), + new Rectangle(1516, 1357, 288, 396), + new Rectangle(235, 2799, 90, 22), + new Rectangle(262, 2983, 54, 54), + new Rectangle(777, 2200, 144, 34), + new Rectangle(420, 2561, 144, 34), + new Rectangle(3539, 1626, 288, 270), + new Rectangle(0, 2008, 288, 270), + new Rectangle(1338, 1927, 54, 38), + new Rectangle(1851, 37, 16, 16), + new Rectangle(524, 2379, 144, 108), + new Rectangle(1138, 1964, 126, 54), + new Rectangle(1549, 0, 156, 28), + new Rectangle(1287, 1395, 108, 22), + new Rectangle(1876, 850, 108, 22), + new Rectangle(1876, 873, 108, 22), + new Rectangle(993, 1910, 144, 108), + new Rectangle(1440, 1859, 52, 34), + new Rectangle(262, 3038, 52, 34), + new Rectangle(1262, 2036, 52, 34), + new Rectangle(1338, 1966, 52, 34), + new Rectangle(235, 2764, 142, 34), + new Rectangle(922, 2165, 70, 50), + new Rectangle(614, 2664, 36, 106), + new Rectangle(1177, 2146, 36, 52), + new Rectangle(1338, 2001, 34, 34), + new Rectangle(107, 3102, 68, 34), + new Rectangle(195, 3149, 34, 34), + new Rectangle(55, 3282, 34, 102), + new Rectangle(1028, 2308, 34, 34), + new Rectangle(910, 2441, 34, 34), + new Rectangle(380, 2748, 70, 34), + new Rectangle(940, 2092, 52, 70), + new Rectangle(724, 2517, 52, 70), + new Rectangle(959, 2216, 32, 16), + new Rectangle(262, 3073, 34, 264), + new Rectangle(0, 0, 1548, 54), + new Rectangle(910, 2388, 52, 52), + new Rectangle(1876, 271, 288, 270), + new Rectangle(2165, 0, 288, 270), + new Rectangle(938, 1421, 288, 396), + new Rectangle(739, 100, 180, 22), + new Rectangle(1876, 542, 288, 270), + new Rectangle(2165, 271, 288, 270), + new Rectangle(777, 2165, 144, 34), + new Rectangle(1440, 1818, 54, 40), + new Rectangle(542, 2098, 234, 90), + new Rectangle(2454, 0, 288, 270), + new Rectangle(2165, 542, 288, 270), + new Rectangle(2454, 271, 288, 270), + new Rectangle(2743, 0, 288, 270), + new Rectangle(1985, 813, 288, 270), + new Rectangle(2454, 542, 288, 270), + new Rectangle(2743, 271, 288, 270), + new Rectangle(3032, 0, 288, 270), + new Rectangle(0, 2655, 234, 90), + new Rectangle(975, 2360, 34, 102), + new Rectangle(910, 2288, 68, 34), + new Rectangle(758, 1910, 234, 90), + new Rectangle(653, 2517, 70, 156), + new Rectangle(777, 2092, 162, 72), + new Rectangle(1985, 1084, 288, 270), + new Rectangle(2274, 813, 288, 270), + new Rectangle(1367, 1818, 72, 108), + new Rectangle(975, 2323, 52, 36), + new Rectangle(922, 2216, 36, 18), + new Rectangle(760, 2444, 16, 72), + new Rectangle(1207, 2019, 54, 108), + new Rectangle(1440, 1894, 34, 18), + new Rectangle(284, 2934, 36, 36), + new Rectangle(3828, 813, 72, 2268), + new Rectangle(1805, 1357, 288, 270), + new Rectangle(1851, 0, 18, 36), + new Rectangle(140, 3186, 36, 36), + new Rectangle(651, 2674, 36, 36), + new Rectangle(85, 3155, 54, 108), + new Rectangle(2743, 542, 288, 270), + new Rectangle(3032, 271, 288, 270), + new Rectangle(3321, 0, 288, 270), + new Rectangle(2274, 1084, 288, 270), + new Rectangle(1287, 1322, 108, 72), + new Rectangle(140, 3149, 54, 36), + new Rectangle(565, 2537, 84, 126), + new Rectangle(1122, 2019, 84, 126), + new Rectangle(0, 3155, 84, 126), + new Rectangle(326, 2799, 84, 378), + new Rectangle(177, 2983, 84, 126), + new Rectangle(289, 2213, 246, 82), + new Rectangle(289, 2296, 246, 82), + new Rectangle(938, 1322, 348, 98), + new Rectangle(0, 55, 738, 142), + new Rectangle(758, 1827, 246, 82), + new Rectangle(0, 198, 468, 180), + new Rectangle(1407, 55, 468, 180), + new Rectangle(0, 1465, 468, 180), + new Rectangle(469, 1284, 468, 180), + new Rectangle(0, 1827, 468, 180), + new Rectangle(938, 960, 468, 180), + new Rectangle(469, 1465, 468, 180), + new Rectangle(938, 1141, 468, 180), + new Rectangle(469, 1646, 468, 180), + new Rectangle(0, 379, 468, 180), + new Rectangle(0, 560, 468, 180), + new Rectangle(469, 198, 468, 180), + new Rectangle(0, 741, 468, 180), + new Rectangle(469, 379, 468, 180), + new Rectangle(469, 560, 468, 180), + new Rectangle(938, 55, 468, 180), + new Rectangle(938, 236, 468, 180), + new Rectangle(469, 741, 468, 180), + new Rectangle(938, 417, 468, 180), + new Rectangle(938, 598, 468, 180), + new Rectangle(1407, 236, 468, 180), + new Rectangle(938, 779, 468, 180), + new Rectangle(1407, 417, 468, 180), + new Rectangle(1407, 598, 468, 180), + new Rectangle(1407, 779, 468, 180), + new Rectangle(0, 922, 468, 180), + new Rectangle(0, 1103, 468, 180), + new Rectangle(0, 1284, 468, 180), + new Rectangle(469, 922, 468, 180), + new Rectangle(469, 1103, 468, 180), + new Rectangle(0, 1646, 468, 180), + new Rectangle(669, 2444, 90, 72) + }; + } + + public static void LoadContent(ContentManager Content) + { + SpriteSheet<_sheetTiles>.tex = Content.Load("Images/_sheetTiles"); + } + + public enum ID + { + BACKGROUND_0, + BACKGROUND_1, + BACKGROUND_2, + BACKGROUND_3, + BACKGROUND_4, + BACKGROUND_5, + BACKGROUND_6, + BLACK_TILE, + CLOUD_0, + CLOUD_1, + CLOUD_2, + CLOUD_3, + EVIL_CACTUS, + GOOD_CACTUS, + LIQUID_0, + LIQUID_1, + MOON, + MUSIC_BOX, + SHROOM_TOPS, + STAR_0, + STAR_1, + STAR_2, + STAR_3, + STAR_4, + SUN2, + SUN, + TILES_0, + TILES_1, + TILES_2, + TILES_3, + TILES_4, + TILES_5, + TILES_6, + TILES_7, + TILES_8, + TILES_9, + TILES_10, + TILES_11, + TILES_12, + TILES_13, + TILES_14, + TILES_15, + TILES_16, + TILES_17, + TILES_18, + TILES_19, + TILES_20, + TILES_21, + TILES_22, + TILES_23, + TILES_24, + TILES_25, + TILES_26, + TILES_27, + TILES_28, + TILES_29, + TILES_30, + TILES_31, + TILES_32, + TILES_33, + TILES_34, + TILES_35, + TILES_36, + TILES_37, + TILES_38, + TILES_39, + TILES_40, + TILES_41, + TILES_42, + TILES_43, + TILES_44, + TILES_45, + TILES_46, + TILES_47, + TILES_48, + TILES_49, + TILES_50, + TILES_51, + TILES_52, + TILES_53, + TILES_54, + TILES_55, + TILES_56, + TILES_57, + TILES_58, + TILES_59, + TILES_60, + TILES_61, + TILES_62, + TILES_63, + TILES_64, + TILES_65, + TILES_66, + TILES_67, + TILES_68, + TILES_69, + TILES_70, + TILES_71, + TILES_72, + TILES_73, + TILES_74, + TILES_75, + TILES_76, + TILES_77, + TILES_78, + TILES_79, + TILES_80, + TILES_81, + TILES_82, + TILES_83, + TILES_84, + TILES_85, + TILES_86, + TILES_87, + TILES_88, + TILES_89, + TILES_90, + TILES_91, + TILES_92, + TILES_93, + TILES_94, + TILES_95, + TILES_96, + TILES_97, + TILES_98, + TILES_99, + TILES_100, + TILES_101, + TILES_102, + TILES_103, + TILES_104, + TILES_105, + TILES_106, + TILES_107, + TILES_108, + TILES_109, + TILES_110, + TILES_111, + TILES_112, + TILES_113, + TILES_114, + TILES_115, + TILES_116, + TILES_117, + TILES_118, + TILES_119, + TILES_120, + TILES_121, + TILES_122, + TILES_123, + TILES_124, + TILES_125, + TILES_126, + TILES_127, + TILES_128, + TILES_129, + TILES_130, + TILES_131, + TILES_132, + TILES_133, + TILES_134, + TILES_135, + TILES_136, + TILES_137, + TILES_138, + TILES_139, + TILES_140, + TILES_141, + TILES_142, + TILES_143, + TILES_144, + TILES_145, + TILES_146, + TILES_147, + TILES_148, + TILES_149, + TIMER, + TREE_BRANCHES_0, + TREE_BRANCHES_1, + TREE_BRANCHES_2, + TREE_BRANCHES_3, + TREE_BRANCHES_4, + TREE_TOPS_0, + TREE_TOPS_1, + TREE_TOPS_2, + TREE_TOPS_3, + TREE_TOPS_4, + WALL_1, + WALL_2, + WALL_3, + WALL_4, + WALL_5, + WALL_6, + WALL_7, + WALL_8, + WALL_9, + WALL_10, + WALL_11, + WALL_12, + WALL_13, + WALL_14, + WALL_15, + WALL_16, + WALL_17, + WALL_18, + WALL_19, + WALL_20, + WALL_21, + WALL_22, + WALL_23, + WALL_24, + WALL_25, + WALL_26, + WALL_27, + WALL_28, + WALL_29, + WALL_30, + WALL_31, + WIRES, + } +}