Skip to content

Commit

Permalink
Update PacketTypes.cs and fix the Tweak Item Packet
Browse files Browse the repository at this point in the history
  • Loading branch information
AxisKriel committed Jul 7, 2015
1 parent 02625ef commit c9252be
Show file tree
Hide file tree
Showing 3 changed files with 157 additions and 80 deletions.
17 changes: 12 additions & 5 deletions Terraria/MessageBuffer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,10 @@ public void GetData(int start, int length)
NetMessage.SendData(27, this.whoAmI, -1, "", k1, 0f, 0f, 0f, 0, 0, 0);
}
}
for (int l1 = 0; l1 < 251; l1++)
{
NetMessage.SendData(83, this.whoAmI, -1, "", l1, 0f, 0f, 0f, 0, 0, 0);
}
NetMessage.SendData(49, this.whoAmI, -1, "", 0, 0f, 0f, 0f, 0, 0, 0);
NetMessage.SendData(57, this.whoAmI, -1, "", 0, 0f, 0f, 0f, 0, 0, 0);
NetMessage.SendData(7, this.whoAmI, -1, "", 0, 0f, 0f, 0f, 0, 0, 0);
Expand Down Expand Up @@ -843,14 +847,13 @@ public void GetData(int start, int length)
byte num25 = this.reader.ReadByte();
int num26 = this.reader.ReadInt16();
int num27 = this.reader.ReadInt16();

// Check for invalid coordinates
if (num26 < 0 || num26 >= Main.maxTilesX || num27 < 0 || num27 >= Main.maxTilesY)
return;

short num28 = this.reader.ReadInt16();
int num29 = this.reader.ReadByte();
bool flag3 = num28 == 1;
if (!WorldGen.InWorld(num26, num27, 3))
{
return;
}
if (Main.tile[num26, num27] == null)
{
Main.tile[num26, num27] = new Tile();
Expand Down Expand Up @@ -1015,6 +1018,10 @@ public void GetData(int start, int length)
short num36 = this.reader.ReadInt16();
int num37 = this.reader.ReadInt16();
int num38 = this.reader.ReadInt16();
if (!WorldGen.InWorld(num37, num38, 3))
{
return;
}
BitsByte bitsByte9 = 0;
BitsByte bitsByte10 = 0;
Tile tile = null;
Expand Down
41 changes: 41 additions & 0 deletions Terraria/NetMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -958,13 +958,54 @@ public class NetMessage
case 88:
{
BitsByte bb16 = (byte)number2;
BitsByte bb17 = (byte)number3;
writer.Write((short)number);
writer.Write(bb16);
Item item4 = Main.item[number];
if (bb16[0])
{
writer.Write(item4.color.PackedValue);
}
if (bb16[1])
{
writer.Write((ushort)item4.damage);
}
if (bb16[2])
{
writer.Write(item4.knockBack);
}
if (bb16[3])
{
writer.Write((ushort)item4.useAnimation);
}
if (bb16[4])
{
writer.Write((ushort)item4.useTime);
}
if (bb16[5])
{
writer.Write((short)item4.shoot);
}
if (bb16[6])
{
writer.Write(item4.shootSpeed);
}
if (bb16[7])
{
writer.Write(bb17);
if (bb17[0])
{
writer.Write((ushort)item4.width);
}
if (bb17[1])
{
writer.Write((ushort)item4.height);
}
if (bb17[2])
{
writer.Write(item4.scale);
}
}
break;
}
case 89:
Expand Down
179 changes: 104 additions & 75 deletions TerrariaApi.Server/PacketTypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,79 +3,108 @@
public enum PacketTypes
{
ConnectRequest = 1,
Disconnect,
ContinueConnecting,
PlayerInfo,
PlayerSlot,
ContinueConnecting2,
WorldInfo,
TileGetSection,
Status,
TileSendSection,
TileFrameSection,
PlayerSpawn,
PlayerUpdate,
PlayerActive,
SyncPlayers,
PlayerHp,
Tile,
TimeSet,
DoorUse,
TileSendSquare,
ItemDrop,
ItemOwner,
NpcUpdate,
NpcItemStrike,
ChatText,
PlayerDamage,
ProjectileNew,
NpcStrike,
ProjectileDestroy,
TogglePvp,
ChestGetContents,
ChestItem,
ChestOpen,
TileKill,
EffectHeal,
Zones,
PasswordRequired,
PasswordSend,
ItemUnknown,
NpcTalk,
PlayerAnimation,
PlayerMana,
EffectMana,
PlayerKillMe,
PlayerTeam,
SignRead,
SignNew,
LiquidSet,
PlayerSpawnSelf,
PlayerBuff,
NpcSpecial,
ChestUnlock,
NpcAddBuff,
NpcUpdateBuff,
PlayerAddBuff,
UpdateNPCName,
UpdateGoodEvil,
PlayHarp,
HitSwitch,
UpdateNPCHome,
SpawnBossorInvasion,
PlayerDodge,
PaintTile,
PaintWall,
Teleport,
PlayerHealOther,
Placeholder,
ClientUUID,
ChestName,
CatchNPC,
ReleaseNPC,
SetShop,
TeleportationPotion,
AnglerQuest,
CompleteAnglerQuest,
NumberOfAnglerQuestsCompleted
Disconnect = 2,
ContinueConnecting = 3,
PlayerInfo = 4,
PlayerSlot = 5,
ContinueConnecting2 = 6,
WorldInfo = 7,
TileGetSection = 8,
Status = 9,
TileSendSection = 10,
TileFrameSection = 11,
PlayerSpawn = 12,
PlayerUpdate = 13,
PlayerActive = 14,
[Obsolete]
SyncPlayers = 15,
PlayerHp = 16,
Tile = 17,
TimeSet = 18,
DoorUse = 19,
TileSendSquare = 20,
ItemDrop = 21,
ItemOwner = 22,
NpcUpdate = 23,
NpcItemStrike = 24,
ChatText = 25,
PlayerDamage = 26,
ProjectileNew = 27,
NpcStrike = 28,
ProjectileDestroy = 29,
TogglePvp = 30,
ChestGetContents = 31,
ChestItem = 32,
ChestOpen = 33,
TileKill = 34,
EffectHeal = 35,
Zones = 36,
PasswordRequired = 37,
PasswordSend = 38,
RemoveItemOwner = 39,
NpcTalk = 40,
PlayerAnimation = 41,
PlayerMana = 42,
EffectMana = 43,
PlayerKillMe = 44,
PlayerTeam = 45,
SignRead = 46,
SignNew = 47,
LiquidSet = 48,
PlayerSpawnSelf = 49,
PlayerBuff = 50,
NpcSpecial = 51,
ChestUnlock = 52,
NpcAddBuff = 53,
NpcUpdateBuff = 54,
PlayerAddBuff = 55,
UpdateNPCName = 56,
UpdateGoodEvil = 57,
PlayHarp = 58,
HitSwitch = 59,
UpdateNPCHome = 60,
SpawnBossorInvasion = 61,
PlayerDodge = 62,
PaintTile = 63,
PaintWall = 64,
Teleport = 65,
PlayerHealOther = 66,
Placeholder = 67,
ClientUUID = 68,
ChestName = 69,
CatchNPC = 70,
ReleaseNPC = 71,
TravellingMerchantInventory = 72,
TeleportationPotion = 73,
AnglerQuest = 74,
CompleteAnglerQuest = 75,
NumberOfAnglerQuestsCompleted = 76,
CreateTemporaryAnimation = 77,
ReportInvasionProgress = 78,
PlaceObject = 79,
SyncPlayerChestIndex = 80,
CreateCombatText = 81,
LoadNetModule = 82,
NpcKillCount = 83,
PlayerStealth = 84,
ForceItemIntoNearestChest = 85,
UpdateTileEntity = 86,
PlaceTileEntity = 87,
TweakItem = 88,
PlaceItemFrame = 89,
UpdateItemDrop = 90,
EmoteBubble = 91,
SyncExtraValue = 92,
SocialHandshake = 93,
Deprecated = 94,
KillPortal = 95,
PlayerTeleportPortal = 96,
NotifyPlayerNpcKilled = 97,
NotifyPlayerOfEvent = 98,
UpdateMinionTarget = 99,
NpcTeleportPortal = 100,
UpdateShieldStrengths = 101,
NebulaLevelUp = 102,
MoonLordCountdown = 103,
NpcShopItem = 104
}

0 comments on commit c9252be

Please sign in to comment.