Skip to content

Commit 49a982b

Browse files
committed
0.1.5 released, updated to tModLoader 0.10
1 parent abc8fd2 commit 49a982b

23 files changed

+160
-116
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ script:
2323
- echo "Mod Browser version is $version"
2424
- export gitVersion=`git describe --abbrev=0 --tags`
2525
- echo "git version is $gitVersion"
26-
- if [[ "$version" = "$gitVersion" ]]; then echo "Version does match, no need to push release"; Deploy=no; else echo "Version does not match, need to push release"; git config --global user.email "builds@travis-ci.com"; git config --global user.name "Travis CI"; git tag $version -a -m "TravisCI Autogenerated Release"; git push --quiet https://$GH_REPO_TOKEN@github.com/JavidPack/BossChecklist $version > /dev/null 2>&1; Deploy=yes; fi
26+
- if [[ "$version" = "$gitVersion" ]]; then echo "Version does match, no need to push release"; Deploy=no; else echo "Version does not match, need to push release"; git config --global user.email "builds@travis-ci.com"; git config --global user.name "Travis CI"; git tag $version -a -m "TravisCI Autogenerated Release"; Deploy=yes; fi
2727
- echo $Deploy
2828

2929
before_deploy:

HEROsMod.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@
4949
<Reference Include="Newtonsoft.Json">
5050
<HintPath>..\..\..\Modding\tModLoader\references\Newtonsoft.Json.dll</HintPath>
5151
</Reference>
52+
<Reference Include="ReLogic">
53+
<HintPath>..\..\..\Modding\tModLoader\references\ReLogic.dll</HintPath>
54+
</Reference>
5255
<Reference Include="System" />
5356
<Reference Include="System.Runtime.Serialization" />
5457
<Reference Include="System.XML" />

HEROsModNetwork/GeneralMessages.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
using Terraria;
99
using Terraria.ID;
10+
using Terraria.Localization;
1011

1112
namespace HEROsMod.HEROsModNetwork
1213
{
@@ -171,7 +172,7 @@ private static void ProcessRequestTeleport(ref BinaryReader reader, int playerNu
171172
Vector2 destination = reader.ReadVector2();
172173
Main.player[playerNumber].Teleport(destination, 1, 0);
173174
RemoteClient.CheckSection(playerNumber, destination, 1);
174-
NetMessage.SendData(65, -1, -1, "", 0, playerNumber, destination.X, destination.Y, 1, 0, 0);
175+
NetMessage.SendData(65, -1, -1, null, 0, playerNumber, destination.X, destination.Y, 1, 0, 0);
175176
//int num169 = -1;
176177
//float num170 = 9999f;
177178
//for (int num171 = 0; num171 < 255; num171++)
@@ -217,7 +218,7 @@ private static void ProcessRequestKickPlayer(ref BinaryReader reader, int player
217218
{
218219
if (Main.player[j].active && Main.player[j].name.ToLower() == playerToKick)
219220
{
220-
NetMessage.SendData(2, j, -1, "Kicked from server.", 0, 0f, 0f, 0f, 0, 0, 0);
221+
NetMessage.SendData(2, j, -1, NetworkText.FromKey("CLI.KickMessage", new object[0]), 0, 0f, 0f, 0f, 0, 0, 0);
221222
}
222223
}
223224
}
@@ -234,7 +235,7 @@ private static void ProcessRequestBanPlayer(ref BinaryReader reader, int playerN
234235
if (Main.player[k].active && Main.player[k].name.ToLower() == playertoban)
235236
{
236237
Netplay.AddBan(k);
237-
NetMessage.SendData(2, k, -1, "Banned from server.", 0, 0f, 0f, 0f, 0, 0, 0);
238+
NetMessage.SendData(2, k, -1, NetworkText.FromKey("CLI.BanMessage", new object[0]), 0, 0f, 0f, 0f, 0, 0, 0);
238239
}
239240
}
240241
}
@@ -332,7 +333,7 @@ private static void ProcessTimeChangeRequest(ref BinaryReader reader, int player
332333
TimePausedOrResumed();
333334
break;
334335
}
335-
NetMessage.SendData(7, -1, -1, "", 0, 0f, 0f, 0f, 0);
336+
NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0);
336337
}
337338
}
338339

@@ -490,7 +491,7 @@ private static void ProcessForcedSundialRequest(int playerNumber)
490491
{
491492
Main.fastForwardTime = true;
492493
Main.sundialCooldown = 0;
493-
NetMessage.SendData(7, -1, -1, "", 0, 0f, 0f, 0f, 0, 0, 0);
494+
NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0);
494495
Network.SendTextToAllPlayers("Forced Enchanted Sundial initiated by " + Main.player[playerNumber].name);
495496
}
496497
}

HEROsModNetwork/LoginService.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@ public static void ProcessData(ref BinaryReader reader, int playerNumber)
7575
case MessageType.RequestSetOfflinePlayerGroup:
7676
ProcessSetOfflinePlayerGroupRequest(ref reader, playerNumber);
7777
break;
78+
case MessageType.ServerToClientHandshake:
79+
Network.ServerUsingHEROsMod = true;
80+
HEROsMod.ServiceHotbar.Visible = true;
81+
GeneralMessages.TellSereverImUsingHEROsMod();
82+
break;
7883
}
7984
}
8085

@@ -552,7 +557,8 @@ public enum MessageType
552557
RequestPlayerInfo,
553558
PlayerInfo,
554559
RequestSetPlayerGroup,
555-
RequestSetOfflinePlayerGroup
560+
RequestSetOfflinePlayerGroup,
561+
ServerToClientHandshake
556562
}
557563
}
558564
}

HEROsModNetwork/Network.cs

Lines changed: 48 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using Terraria;
1010
using Terraria.ModLoader;
1111
using Terraria.ID;
12+
using Terraria.Localization;
1213

1314
namespace HEROsMod.HEROsModNetwork
1415
{
@@ -174,7 +175,7 @@ public static void Update()
174175
if (sendTimeTimer <= 0)
175176
{
176177
sendTimeTimer = 1f;
177-
NetMessage.SendData(7, -1, -1, "", 0, 0f, 0f, 0f, 0);
178+
NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0);
178179
}
179180
}
180181
}
@@ -340,7 +341,7 @@ public static bool CheckIncomingDataForHEROsModMessage(ref byte msgType, ref Bin
340341
{
341342
LastTileKilledBy = player;
342343
WorldGen.KillTile(x, y, fail, false, false);
343-
NetMessage.SendData(17, -1, playerNumber, "", (int)tileModifyType, (float)x, (float)y, (float)placeType, style);
344+
NetMessage.SendData(17, -1, playerNumber, null, (int)tileModifyType, (float)x, (float)y, (float)placeType, style);
344345
LastTileKilledBy = null;
345346
return true;
346347
}
@@ -358,55 +359,55 @@ public static bool CheckIncomingDataForHEROsModMessage(ref byte msgType, ref Bin
358359
switch (tileModifyType)
359360
{
360361
case TileModifyType.KillTile:
361-
NetMessage.SendData(17, playerNumber, -1, "", (int)TileModifyType.PlaceTile, (float)x, (float)y, (float)tile.type, tile.slope());
362+
NetMessage.SendData(17, playerNumber, -1, null, (int)TileModifyType.PlaceTile, (float)x, (float)y, (float)tile.type, tile.slope());
362363
break;
363364
case TileModifyType.PlaceTile:
364-
NetMessage.SendData(17, playerNumber, -1, "", (int)TileModifyType.KillTile, (float)x, (float)y, (float)placeType, style);
365+
NetMessage.SendData(17, playerNumber, -1, null, (int)TileModifyType.KillTile, (float)x, (float)y, (float)placeType, style);
365366
break;
366367
case TileModifyType.KillWall:
367-
NetMessage.SendData(17, playerNumber, -1, "", (int)TileModifyType.PlaceWall, (float)x, (float)y, (float)tile.wall, style);
368+
NetMessage.SendData(17, playerNumber, -1, null, (int)TileModifyType.PlaceWall, (float)x, (float)y, (float)tile.wall, style);
368369
break;
369370
case TileModifyType.PlaceWall:
370-
NetMessage.SendData(17, playerNumber, -1, "", (int)TileModifyType.KillWall, (float)x, (float)y, (float)placeType, style);
371+
NetMessage.SendData(17, playerNumber, -1, null, (int)TileModifyType.KillWall, (float)x, (float)y, (float)placeType, style);
371372
break;
372373
case TileModifyType.KillTileNoItem:
373-
NetMessage.SendData(17, playerNumber, -1, "", (int)TileModifyType.PlaceTile, (float)x, (float)y, (float)tile.type, tile.slope());
374+
NetMessage.SendData(17, playerNumber, -1, null, (int)TileModifyType.PlaceTile, (float)x, (float)y, (float)tile.type, tile.slope());
374375
break;
375376
case TileModifyType.PlaceWire:
376-
NetMessage.SendData(17, playerNumber, -1, "", (int)TileModifyType.KillWire, (float)x, (float)y, (float)placeType, style);
377+
NetMessage.SendData(17, playerNumber, -1, null, (int)TileModifyType.KillWire, (float)x, (float)y, (float)placeType, style);
377378
break;
378379
case TileModifyType.PlaceWire2:
379-
NetMessage.SendData(17, playerNumber, -1, "", (int)TileModifyType.KillWire2, (float)x, (float)y, (float)placeType, style);
380+
NetMessage.SendData(17, playerNumber, -1, null, (int)TileModifyType.KillWire2, (float)x, (float)y, (float)placeType, style);
380381
break;
381382
case TileModifyType.PlaceWire3:
382-
NetMessage.SendData(17, playerNumber, -1, "", (int)TileModifyType.KillWire3, (float)x, (float)y, (float)placeType, style);
383+
NetMessage.SendData(17, playerNumber, -1, null, (int)TileModifyType.KillWire3, (float)x, (float)y, (float)placeType, style);
383384
break;
384385
case TileModifyType.KillWire:
385-
NetMessage.SendData(17, playerNumber, -1, "", (int)TileModifyType.PlaceWire, (float)x, (float)y, (float)placeType, style);
386+
NetMessage.SendData(17, playerNumber, -1, null, (int)TileModifyType.PlaceWire, (float)x, (float)y, (float)placeType, style);
386387
break;
387388
case TileModifyType.KillWire2:
388-
NetMessage.SendData(17, playerNumber, -1, "", (int)TileModifyType.PlaceWire2, (float)x, (float)y, (float)placeType, style);
389+
NetMessage.SendData(17, playerNumber, -1, null, (int)TileModifyType.PlaceWire2, (float)x, (float)y, (float)placeType, style);
389390
break;
390391
case TileModifyType.KillWire3:
391-
NetMessage.SendData(17, playerNumber, -1, "", (int)TileModifyType.PlaceWire3, (float)x, (float)y, (float)placeType, style);
392+
NetMessage.SendData(17, playerNumber, -1, null, (int)TileModifyType.PlaceWire3, (float)x, (float)y, (float)placeType, style);
392393
break;
393394
case TileModifyType.KillActuator:
394-
NetMessage.SendData(17, playerNumber, -1, "", (int)TileModifyType.PlaceActuator, (float)x, (float)y, (float)placeType, style);
395+
NetMessage.SendData(17, playerNumber, -1, null, (int)TileModifyType.PlaceActuator, (float)x, (float)y, (float)placeType, style);
395396
break;
396397
case TileModifyType.PlaceActuator:
397-
NetMessage.SendData(17, playerNumber, -1, "", (int)TileModifyType.KillActuator, (float)x, (float)y, (float)placeType, style);
398+
NetMessage.SendData(17, playerNumber, -1, null, (int)TileModifyType.KillActuator, (float)x, (float)y, (float)placeType, style);
398399
break;
399400
case TileModifyType.PoundTile:
400-
NetMessage.SendData(17, playerNumber, -1, "", (int)TileModifyType.PoundTile, (float)x, (float)y, (float)placeType, tile.slope());
401+
NetMessage.SendData(17, playerNumber, -1, null, (int)TileModifyType.PoundTile, (float)x, (float)y, (float)placeType, tile.slope());
401402
break;
402403
case TileModifyType.SlopeTile:
403-
NetMessage.SendData(17, playerNumber, -1, "", (int)TileModifyType.SlopeTile, (float)x, (float)y, (float)placeType, tile.slope());
404+
NetMessage.SendData(17, playerNumber, -1, null, (int)TileModifyType.SlopeTile, (float)x, (float)y, (float)placeType, tile.slope());
404405
break;
405406
}
406407
return true;
407408
}
408409
break;
409-
case 25: //revieved a chat message
410+
/* case 25: //received a chat message
410411
411412
binaryReader.ReadByte();
412413
Color color = binaryReader.ReadRGB();
@@ -556,26 +557,26 @@ public static bool CheckIncomingDataForHEROsModMessage(ref byte msgType, ref Bin
556557
}
557558
else
558559
{
559-
NetMessage.SendData(25, playerNumber, -1, Lang.mp[10], 255, 255f, 240f, 20f, 0);
560+
NetMessage.SendData(25, playerNumber, -1, Lang.mp[10].ToNetworkText(), 255, 255f, 240f, 20f, 0);
560561
}
561562
}
562563
else
563564
{
564565
return false;
565566
// why are chat messages randomized?
566-
/*color = chatColor[chatColorIndex];
567-
chatColorIndex++;
568-
if (chatColorIndex >= chatColor.Length) chatColorIndex = 0;
569-
NetMessage.SendData(25, -1, -1, text, 255, (float)color.R, (float)color.G, (float)color.B, 0);
570-
if (Main.dedServ)
571-
{
572-
Console.WriteLine("<" + Main.player[playerNumber].name + "> " + text);
573-
}*/
567+
//color = chatColor[chatColorIndex];
568+
//chatColorIndex++;
569+
//if (chatColorIndex >= chatColor.Length) chatColorIndex = 0;
570+
//NetMessage.SendData(25, -1, -1, text, 255, (float)color.R, (float)color.G, (float)color.B, 0);
571+
//if (Main.dedServ)
572+
//{
573+
// Console.WriteLine("<" + Main.player[playerNumber].name + "> " + text);
574+
//}
574575
}
575576
}
576577
return true;
577578
}
578-
break;
579+
break;*/
579580
//case 27:
580581
// if (ItemBanner.ItemsBanned && !Players[playerNumber].Group.IsAdmin)
581582
// {
@@ -654,7 +655,7 @@ public static bool CheckIncomingDataForHEROsModMessage(ref byte msgType, ref Bin
654655
}
655656
else
656657
{
657-
NetMessage.SendData(63, playerNumber, -1, "", x, (float)y, (float)Main.tile[x, y].color());
658+
NetMessage.SendData(63, playerNumber, -1, null, x, (float)y, (float)Main.tile[x, y].color());
658659
SendTextToPlayer("You do not have permission to build here", playerNumber, Color.Red);
659660
return true;
660661
}
@@ -676,7 +677,7 @@ public static bool CheckIncomingDataForHEROsModMessage(ref byte msgType, ref Bin
676677
}
677678
else
678679
{
679-
NetMessage.SendData(64, playerNumber, -1, "", x, (float)y, (float)Main.tile[x, y].wallColor());
680+
NetMessage.SendData(64, playerNumber, -1, null, x, (float)y, (float)Main.tile[x, y].wallColor());
680681
SendTextToPlayer("You do not have permission to build here", playerNumber, Color.Red);
681682
return true;
682683
}
@@ -752,7 +753,13 @@ public static void HEROsModMessaged(BinaryReader binaryReader, int playerNumber)
752753
private static void PlayerJoined(int playerNumber)
753754
{
754755
Players[playerNumber] = new HEROsModPlayer(playerNumber);
755-
SendTextToPlayer(HEROsModCheckMessage, playerNumber, Color.Red);
756+
// chat message hack: SendTextToPlayer(HEROsModCheckMessage, playerNumber, Color.Red);
757+
758+
var packet = HEROsMod.instance.GetPacket();
759+
packet.Write((byte)MessageType.LoginMessage);
760+
packet.Write((byte)LoginService.MessageType.ServerToClientHandshake);
761+
packet.Send(playerNumber);
762+
756763
GeneralMessages.TellClientsPlayerJoined(playerNumber);
757764
}
758765

@@ -780,7 +787,7 @@ private static void FreezeNonLoggedInPlayers()
780787
{
781788
//player.GameInstance.AddBuff(47, 7200);
782789
// Console.WriteLine("Freeze " + i);
783-
NetMessage.SendData(55, player.Index, -1, "", player.Index, 47, 120, 0f, 0);
790+
NetMessage.SendData(55, player.Index, -1, null, player.Index, 47, 120, 0f, 0);
784791
}
785792
}
786793
}
@@ -793,21 +800,23 @@ public static void SendPlayerToPosition(HEROsModPlayer player, Vector2 position)
793800
int prevSpawnY = player.GameInstance.SpawnY;
794801
player.GameInstance.SpawnX = (int)position.X;
795802
player.GameInstance.SpawnY = (int)position.Y;
796-
NetMessage.SendData(12, -1, -1, "", player.Index, 0f, 0f, 0f, 0);
803+
NetMessage.SendData(12, -1, -1, null, player.Index, 0f, 0f, 0f, 0);
797804
player.GameInstance.SpawnX = prevSpawnX;
798805
player.GameInstance.SpawnY = prevSpawnY;
799806
}
800807

801808
public static void SendTextToPlayer(string msg, int playerIndex, Color? color = null)
802809
{
803810
Color c = color.GetValueOrDefault(Color.White);
804-
NetMessage.SendData(25, playerIndex, -1, msg, 255, c.R, c.G, c.B, 0);
811+
//NetMessage.SendData(25, playerIndex, -1, msg, 255, c.R, c.G, c.B, 0);
812+
NetMessage.SendChatMessageToClient(NetworkText.FromLiteral(msg), c, playerIndex);
805813
}
806814

807815
public static void SendTextToAllPlayers(string msg, Color? color = null)
808816
{
809817
Color c = color.GetValueOrDefault(Color.White);
810-
NetMessage.SendData(25, -1, -1, msg, 255, c.R, c.G, c.B, 0);
818+
//NetMessage.SendData(25, -1, -1, msg, 255, c.R, c.G, c.B, 0);
819+
NetMessage.BroadcastChatMessage(NetworkText.FromLiteral(msg), c, -1);
811820
}
812821

813822
public static void SendDataToServer()
@@ -904,7 +913,7 @@ public static void ClearGroundItems()
904913
if (Main.item[i].active)
905914
{
906915
Main.item[i].SetDefaults(0);
907-
NetMessage.SendData(21, -1, -1, "", i, 0f, 0f, 0f, 0);
916+
NetMessage.SendData(21, -1, -1, null, i, 0f, 0f, 0f, 0);
908917
}
909918
}
910919
}
@@ -919,7 +928,7 @@ public static void SpawnNPC(int type, Vector2 position)
919928
{
920929
n.position = position;
921930
npcFound = true;
922-
if (Main.netMode == 2) NetMessage.SendData(23, -1, -1, "", i, 0f, 0f, 0f, 0);
931+
if (Main.netMode == 2) NetMessage.SendData(23, -1, -1, null, i, 0f, 0f, 0f, 0);
923932
break;
924933
}
925934
}
@@ -951,7 +960,7 @@ public static void ResendPlayerTileData(HEROsModPlayer player)
951960
}
952961
}
953962
int num2 = num;
954-
NetMessage.SendData(9, player.Index, -1, Lang.inter[44], num2, 0f, 0f, 0f, 0);
963+
NetMessage.SendData(9, player.Index, -1, Lang.inter[44].ToNetworkText(), num2, 0f, 0f, 0f, 0);
955964
Netplay.Clients[player.Index].StatusText2 = "is receiving tile data";
956965
Netplay.Clients[player.Index].StatusMax += num2;
957966
for (int k = sectionX - 1; k < sectionX + 2; k++)
@@ -961,7 +970,7 @@ public static void ResendPlayerTileData(HEROsModPlayer player)
961970
if (k >= 0 && k < Main.maxSectionsX && l >= 0 && l < Main.maxSectionsY)
962971
{
963972
NetMessage.SendSection(player.Index, k, l, false);
964-
NetMessage.SendData(11, player.Index, -1, "", k, (float)l, (float)k, (float)l, 0);
973+
NetMessage.SendData(11, player.Index, -1, null, k, (float)l, (float)k, (float)l, 0);
965974
}
966975
}
967976
}

HEROsModServices/BuffService.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,8 @@ public BuffWindow()
119119
bg.Y = yPos;
120120
bg.Width = scrollView.Width - 20 - Spacing * 2;
121121
bg.Tag = buffType;
122-
bg.Tooltip = (Main.buffTip[buffType] == null ? "" : Main.buffTip[buffType]);
122+
string buffDescription = Lang.GetBuffDescription(buffType);
123+
bg.Tooltip = (buffDescription == null ? "" : buffDescription);
123124
bg.onLeftClick += bg_onLeftClick;
124125

125126
UIImage buffImage = new UIImage(Main.buffTexture[buffType]);
@@ -130,7 +131,7 @@ public BuffWindow()
130131
bg.Height = buffImage.Height + SmallSpacing;
131132
yPos += bg.Height;
132133

133-
UILabel label = new UILabel(Main.buffName[buffType]);
134+
UILabel label = new UILabel(Lang.GetBuffName(buffType));
134135
label.Scale = .4f;
135136
label.Anchor = AnchorPosition.Left;
136137
label.X = buffImage.X + buffImage.Width + Spacing;

HEROsModServices/EnemyToggler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public static void ClearNPCs()
5656
if (Main.npc[i] != null && !Main.npc[i].townNPC)
5757
{
5858
Main.npc[i].life = 0;
59-
if (Main.netMode == 2) NetMessage.SendData(23, -1, -1, "", i, 0f, 0f, 0f, 0);
59+
if (Main.netMode == 2) NetMessage.SendData(23, -1, -1, null, i, 0f, 0f, 0f, 0);
6060
}
6161
}
6262
}

HEROsModServices/FlyCam.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
using Terraria.GameInput;
1212
using Terraria.ModLoader;
1313
using Microsoft.Xna.Framework.Graphics;
14+
using ReLogic.Graphics;
1415

1516
namespace HEROsMod.HEROsModServices
1617
{

0 commit comments

Comments
 (0)