Skip to content

Commit

Permalink
0.1.5 released, updated to tModLoader 0.10
Browse files Browse the repository at this point in the history
  • Loading branch information
JavidPack committed Jun 6, 2017
1 parent abc8fd2 commit 49a982b
Show file tree
Hide file tree
Showing 23 changed files with 160 additions and 116 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ script:
- echo "Mod Browser version is $version"
- export gitVersion=`git describe --abbrev=0 --tags`
- echo "git version is $gitVersion"
- 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 "[email protected]"; git config --global user.name "Travis CI"; git tag $version -a -m "TravisCI Autogenerated Release"; git push --quiet https://[email protected]/JavidPack/BossChecklist $version > /dev/null 2>&1; Deploy=yes; fi
- 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 "[email protected]"; git config --global user.name "Travis CI"; git tag $version -a -m "TravisCI Autogenerated Release"; Deploy=yes; fi
- echo $Deploy

before_deploy:
Expand Down
3 changes: 3 additions & 0 deletions HEROsMod.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@
<Reference Include="Newtonsoft.Json">
<HintPath>..\..\..\Modding\tModLoader\references\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="ReLogic">
<HintPath>..\..\..\Modding\tModLoader\references\ReLogic.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.XML" />
Expand Down
11 changes: 6 additions & 5 deletions HEROsModNetwork/GeneralMessages.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

using Terraria;
using Terraria.ID;
using Terraria.Localization;

namespace HEROsMod.HEROsModNetwork
{
Expand Down Expand Up @@ -171,7 +172,7 @@ private static void ProcessRequestTeleport(ref BinaryReader reader, int playerNu
Vector2 destination = reader.ReadVector2();
Main.player[playerNumber].Teleport(destination, 1, 0);
RemoteClient.CheckSection(playerNumber, destination, 1);
NetMessage.SendData(65, -1, -1, "", 0, playerNumber, destination.X, destination.Y, 1, 0, 0);
NetMessage.SendData(65, -1, -1, null, 0, playerNumber, destination.X, destination.Y, 1, 0, 0);
//int num169 = -1;
//float num170 = 9999f;
//for (int num171 = 0; num171 < 255; num171++)
Expand Down Expand Up @@ -217,7 +218,7 @@ private static void ProcessRequestKickPlayer(ref BinaryReader reader, int player
{
if (Main.player[j].active && Main.player[j].name.ToLower() == playerToKick)
{
NetMessage.SendData(2, j, -1, "Kicked from server.", 0, 0f, 0f, 0f, 0, 0, 0);
NetMessage.SendData(2, j, -1, NetworkText.FromKey("CLI.KickMessage", new object[0]), 0, 0f, 0f, 0f, 0, 0, 0);
}
}
}
Expand All @@ -234,7 +235,7 @@ private static void ProcessRequestBanPlayer(ref BinaryReader reader, int playerN
if (Main.player[k].active && Main.player[k].name.ToLower() == playertoban)
{
Netplay.AddBan(k);
NetMessage.SendData(2, k, -1, "Banned from server.", 0, 0f, 0f, 0f, 0, 0, 0);
NetMessage.SendData(2, k, -1, NetworkText.FromKey("CLI.BanMessage", new object[0]), 0, 0f, 0f, 0f, 0, 0, 0);
}
}
}
Expand Down Expand Up @@ -332,7 +333,7 @@ private static void ProcessTimeChangeRequest(ref BinaryReader reader, int player
TimePausedOrResumed();
break;
}
NetMessage.SendData(7, -1, -1, "", 0, 0f, 0f, 0f, 0);
NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0);
}
}

Expand Down Expand Up @@ -490,7 +491,7 @@ private static void ProcessForcedSundialRequest(int playerNumber)
{
Main.fastForwardTime = true;
Main.sundialCooldown = 0;
NetMessage.SendData(7, -1, -1, "", 0, 0f, 0f, 0f, 0, 0, 0);
NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0);
Network.SendTextToAllPlayers("Forced Enchanted Sundial initiated by " + Main.player[playerNumber].name);
}
}
Expand Down
8 changes: 7 additions & 1 deletion HEROsModNetwork/LoginService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ public static void ProcessData(ref BinaryReader reader, int playerNumber)
case MessageType.RequestSetOfflinePlayerGroup:
ProcessSetOfflinePlayerGroupRequest(ref reader, playerNumber);
break;
case MessageType.ServerToClientHandshake:
Network.ServerUsingHEROsMod = true;
HEROsMod.ServiceHotbar.Visible = true;
GeneralMessages.TellSereverImUsingHEROsMod();
break;
}
}

Expand Down Expand Up @@ -552,7 +557,8 @@ public enum MessageType
RequestPlayerInfo,
PlayerInfo,
RequestSetPlayerGroup,
RequestSetOfflinePlayerGroup
RequestSetOfflinePlayerGroup,
ServerToClientHandshake
}
}
}
87 changes: 48 additions & 39 deletions HEROsModNetwork/Network.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using Terraria;
using Terraria.ModLoader;
using Terraria.ID;
using Terraria.Localization;

namespace HEROsMod.HEROsModNetwork
{
Expand Down Expand Up @@ -174,7 +175,7 @@ public static void Update()
if (sendTimeTimer <= 0)
{
sendTimeTimer = 1f;
NetMessage.SendData(7, -1, -1, "", 0, 0f, 0f, 0f, 0);
NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0);
}
}
}
Expand Down Expand Up @@ -340,7 +341,7 @@ public static bool CheckIncomingDataForHEROsModMessage(ref byte msgType, ref Bin
{
LastTileKilledBy = player;
WorldGen.KillTile(x, y, fail, false, false);
NetMessage.SendData(17, -1, playerNumber, "", (int)tileModifyType, (float)x, (float)y, (float)placeType, style);
NetMessage.SendData(17, -1, playerNumber, null, (int)tileModifyType, (float)x, (float)y, (float)placeType, style);
LastTileKilledBy = null;
return true;
}
Expand All @@ -358,55 +359,55 @@ public static bool CheckIncomingDataForHEROsModMessage(ref byte msgType, ref Bin
switch (tileModifyType)
{
case TileModifyType.KillTile:
NetMessage.SendData(17, playerNumber, -1, "", (int)TileModifyType.PlaceTile, (float)x, (float)y, (float)tile.type, tile.slope());
NetMessage.SendData(17, playerNumber, -1, null, (int)TileModifyType.PlaceTile, (float)x, (float)y, (float)tile.type, tile.slope());
break;
case TileModifyType.PlaceTile:
NetMessage.SendData(17, playerNumber, -1, "", (int)TileModifyType.KillTile, (float)x, (float)y, (float)placeType, style);
NetMessage.SendData(17, playerNumber, -1, null, (int)TileModifyType.KillTile, (float)x, (float)y, (float)placeType, style);
break;
case TileModifyType.KillWall:
NetMessage.SendData(17, playerNumber, -1, "", (int)TileModifyType.PlaceWall, (float)x, (float)y, (float)tile.wall, style);
NetMessage.SendData(17, playerNumber, -1, null, (int)TileModifyType.PlaceWall, (float)x, (float)y, (float)tile.wall, style);
break;
case TileModifyType.PlaceWall:
NetMessage.SendData(17, playerNumber, -1, "", (int)TileModifyType.KillWall, (float)x, (float)y, (float)placeType, style);
NetMessage.SendData(17, playerNumber, -1, null, (int)TileModifyType.KillWall, (float)x, (float)y, (float)placeType, style);
break;
case TileModifyType.KillTileNoItem:
NetMessage.SendData(17, playerNumber, -1, "", (int)TileModifyType.PlaceTile, (float)x, (float)y, (float)tile.type, tile.slope());
NetMessage.SendData(17, playerNumber, -1, null, (int)TileModifyType.PlaceTile, (float)x, (float)y, (float)tile.type, tile.slope());
break;
case TileModifyType.PlaceWire:
NetMessage.SendData(17, playerNumber, -1, "", (int)TileModifyType.KillWire, (float)x, (float)y, (float)placeType, style);
NetMessage.SendData(17, playerNumber, -1, null, (int)TileModifyType.KillWire, (float)x, (float)y, (float)placeType, style);
break;
case TileModifyType.PlaceWire2:
NetMessage.SendData(17, playerNumber, -1, "", (int)TileModifyType.KillWire2, (float)x, (float)y, (float)placeType, style);
NetMessage.SendData(17, playerNumber, -1, null, (int)TileModifyType.KillWire2, (float)x, (float)y, (float)placeType, style);
break;
case TileModifyType.PlaceWire3:
NetMessage.SendData(17, playerNumber, -1, "", (int)TileModifyType.KillWire3, (float)x, (float)y, (float)placeType, style);
NetMessage.SendData(17, playerNumber, -1, null, (int)TileModifyType.KillWire3, (float)x, (float)y, (float)placeType, style);
break;
case TileModifyType.KillWire:
NetMessage.SendData(17, playerNumber, -1, "", (int)TileModifyType.PlaceWire, (float)x, (float)y, (float)placeType, style);
NetMessage.SendData(17, playerNumber, -1, null, (int)TileModifyType.PlaceWire, (float)x, (float)y, (float)placeType, style);
break;
case TileModifyType.KillWire2:
NetMessage.SendData(17, playerNumber, -1, "", (int)TileModifyType.PlaceWire2, (float)x, (float)y, (float)placeType, style);
NetMessage.SendData(17, playerNumber, -1, null, (int)TileModifyType.PlaceWire2, (float)x, (float)y, (float)placeType, style);
break;
case TileModifyType.KillWire3:
NetMessage.SendData(17, playerNumber, -1, "", (int)TileModifyType.PlaceWire3, (float)x, (float)y, (float)placeType, style);
NetMessage.SendData(17, playerNumber, -1, null, (int)TileModifyType.PlaceWire3, (float)x, (float)y, (float)placeType, style);
break;
case TileModifyType.KillActuator:
NetMessage.SendData(17, playerNumber, -1, "", (int)TileModifyType.PlaceActuator, (float)x, (float)y, (float)placeType, style);
NetMessage.SendData(17, playerNumber, -1, null, (int)TileModifyType.PlaceActuator, (float)x, (float)y, (float)placeType, style);
break;
case TileModifyType.PlaceActuator:
NetMessage.SendData(17, playerNumber, -1, "", (int)TileModifyType.KillActuator, (float)x, (float)y, (float)placeType, style);
NetMessage.SendData(17, playerNumber, -1, null, (int)TileModifyType.KillActuator, (float)x, (float)y, (float)placeType, style);
break;
case TileModifyType.PoundTile:
NetMessage.SendData(17, playerNumber, -1, "", (int)TileModifyType.PoundTile, (float)x, (float)y, (float)placeType, tile.slope());
NetMessage.SendData(17, playerNumber, -1, null, (int)TileModifyType.PoundTile, (float)x, (float)y, (float)placeType, tile.slope());
break;
case TileModifyType.SlopeTile:
NetMessage.SendData(17, playerNumber, -1, "", (int)TileModifyType.SlopeTile, (float)x, (float)y, (float)placeType, tile.slope());
NetMessage.SendData(17, playerNumber, -1, null, (int)TileModifyType.SlopeTile, (float)x, (float)y, (float)placeType, tile.slope());
break;
}
return true;
}
break;
case 25: //revieved a chat message
/* case 25: //received a chat message
binaryReader.ReadByte();
Color color = binaryReader.ReadRGB();
Expand Down Expand Up @@ -556,26 +557,26 @@ public static bool CheckIncomingDataForHEROsModMessage(ref byte msgType, ref Bin
}
else
{
NetMessage.SendData(25, playerNumber, -1, Lang.mp[10], 255, 255f, 240f, 20f, 0);
NetMessage.SendData(25, playerNumber, -1, Lang.mp[10].ToNetworkText(), 255, 255f, 240f, 20f, 0);
}
}
else
{
return false;
// why are chat messages randomized?
/*color = chatColor[chatColorIndex];
chatColorIndex++;
if (chatColorIndex >= chatColor.Length) chatColorIndex = 0;
NetMessage.SendData(25, -1, -1, text, 255, (float)color.R, (float)color.G, (float)color.B, 0);
if (Main.dedServ)
{
Console.WriteLine("<" + Main.player[playerNumber].name + "> " + text);
}*/
//color = chatColor[chatColorIndex];
//chatColorIndex++;
//if (chatColorIndex >= chatColor.Length) chatColorIndex = 0;
//NetMessage.SendData(25, -1, -1, text, 255, (float)color.R, (float)color.G, (float)color.B, 0);
//if (Main.dedServ)
//{
// Console.WriteLine("<" + Main.player[playerNumber].name + "> " + text);
//}
}
}
return true;
}
break;
break;*/
//case 27:
// if (ItemBanner.ItemsBanned && !Players[playerNumber].Group.IsAdmin)
// {
Expand Down Expand Up @@ -654,7 +655,7 @@ public static bool CheckIncomingDataForHEROsModMessage(ref byte msgType, ref Bin
}
else
{
NetMessage.SendData(63, playerNumber, -1, "", x, (float)y, (float)Main.tile[x, y].color());
NetMessage.SendData(63, playerNumber, -1, null, x, (float)y, (float)Main.tile[x, y].color());
SendTextToPlayer("You do not have permission to build here", playerNumber, Color.Red);
return true;
}
Expand All @@ -676,7 +677,7 @@ public static bool CheckIncomingDataForHEROsModMessage(ref byte msgType, ref Bin
}
else
{
NetMessage.SendData(64, playerNumber, -1, "", x, (float)y, (float)Main.tile[x, y].wallColor());
NetMessage.SendData(64, playerNumber, -1, null, x, (float)y, (float)Main.tile[x, y].wallColor());
SendTextToPlayer("You do not have permission to build here", playerNumber, Color.Red);
return true;
}
Expand Down Expand Up @@ -752,7 +753,13 @@ public static void HEROsModMessaged(BinaryReader binaryReader, int playerNumber)
private static void PlayerJoined(int playerNumber)
{
Players[playerNumber] = new HEROsModPlayer(playerNumber);
SendTextToPlayer(HEROsModCheckMessage, playerNumber, Color.Red);
// chat message hack: SendTextToPlayer(HEROsModCheckMessage, playerNumber, Color.Red);

var packet = HEROsMod.instance.GetPacket();
packet.Write((byte)MessageType.LoginMessage);
packet.Write((byte)LoginService.MessageType.ServerToClientHandshake);
packet.Send(playerNumber);

GeneralMessages.TellClientsPlayerJoined(playerNumber);
}

Expand Down Expand Up @@ -780,7 +787,7 @@ private static void FreezeNonLoggedInPlayers()
{
//player.GameInstance.AddBuff(47, 7200);
// Console.WriteLine("Freeze " + i);
NetMessage.SendData(55, player.Index, -1, "", player.Index, 47, 120, 0f, 0);
NetMessage.SendData(55, player.Index, -1, null, player.Index, 47, 120, 0f, 0);
}
}
}
Expand All @@ -793,21 +800,23 @@ public static void SendPlayerToPosition(HEROsModPlayer player, Vector2 position)
int prevSpawnY = player.GameInstance.SpawnY;
player.GameInstance.SpawnX = (int)position.X;
player.GameInstance.SpawnY = (int)position.Y;
NetMessage.SendData(12, -1, -1, "", player.Index, 0f, 0f, 0f, 0);
NetMessage.SendData(12, -1, -1, null, player.Index, 0f, 0f, 0f, 0);
player.GameInstance.SpawnX = prevSpawnX;
player.GameInstance.SpawnY = prevSpawnY;
}

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

public static void SendTextToAllPlayers(string msg, Color? color = null)
{
Color c = color.GetValueOrDefault(Color.White);
NetMessage.SendData(25, -1, -1, msg, 255, c.R, c.G, c.B, 0);
//NetMessage.SendData(25, -1, -1, msg, 255, c.R, c.G, c.B, 0);
NetMessage.BroadcastChatMessage(NetworkText.FromLiteral(msg), c, -1);
}

public static void SendDataToServer()
Expand Down Expand Up @@ -904,7 +913,7 @@ public static void ClearGroundItems()
if (Main.item[i].active)
{
Main.item[i].SetDefaults(0);
NetMessage.SendData(21, -1, -1, "", i, 0f, 0f, 0f, 0);
NetMessage.SendData(21, -1, -1, null, i, 0f, 0f, 0f, 0);
}
}
}
Expand All @@ -919,7 +928,7 @@ public static void SpawnNPC(int type, Vector2 position)
{
n.position = position;
npcFound = true;
if (Main.netMode == 2) NetMessage.SendData(23, -1, -1, "", i, 0f, 0f, 0f, 0);
if (Main.netMode == 2) NetMessage.SendData(23, -1, -1, null, i, 0f, 0f, 0f, 0);
break;
}
}
Expand Down Expand Up @@ -951,7 +960,7 @@ public static void ResendPlayerTileData(HEROsModPlayer player)
}
}
int num2 = num;
NetMessage.SendData(9, player.Index, -1, Lang.inter[44], num2, 0f, 0f, 0f, 0);
NetMessage.SendData(9, player.Index, -1, Lang.inter[44].ToNetworkText(), num2, 0f, 0f, 0f, 0);
Netplay.Clients[player.Index].StatusText2 = "is receiving tile data";
Netplay.Clients[player.Index].StatusMax += num2;
for (int k = sectionX - 1; k < sectionX + 2; k++)
Expand All @@ -961,7 +970,7 @@ public static void ResendPlayerTileData(HEROsModPlayer player)
if (k >= 0 && k < Main.maxSectionsX && l >= 0 && l < Main.maxSectionsY)
{
NetMessage.SendSection(player.Index, k, l, false);
NetMessage.SendData(11, player.Index, -1, "", k, (float)l, (float)k, (float)l, 0);
NetMessage.SendData(11, player.Index, -1, null, k, (float)l, (float)k, (float)l, 0);
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions HEROsModServices/BuffService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ public BuffWindow()
bg.Y = yPos;
bg.Width = scrollView.Width - 20 - Spacing * 2;
bg.Tag = buffType;
bg.Tooltip = (Main.buffTip[buffType] == null ? "" : Main.buffTip[buffType]);
string buffDescription = Lang.GetBuffDescription(buffType);
bg.Tooltip = (buffDescription == null ? "" : buffDescription);
bg.onLeftClick += bg_onLeftClick;

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

UILabel label = new UILabel(Main.buffName[buffType]);
UILabel label = new UILabel(Lang.GetBuffName(buffType));
label.Scale = .4f;
label.Anchor = AnchorPosition.Left;
label.X = buffImage.X + buffImage.Width + Spacing;
Expand Down
2 changes: 1 addition & 1 deletion HEROsModServices/EnemyToggler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public static void ClearNPCs()
if (Main.npc[i] != null && !Main.npc[i].townNPC)
{
Main.npc[i].life = 0;
if (Main.netMode == 2) NetMessage.SendData(23, -1, -1, "", i, 0f, 0f, 0f, 0);
if (Main.netMode == 2) NetMessage.SendData(23, -1, -1, null, i, 0f, 0f, 0f, 0);
}
}
}
Expand Down
1 change: 1 addition & 0 deletions HEROsModServices/FlyCam.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using Terraria.GameInput;
using Terraria.ModLoader;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Graphics;

namespace HEROsMod.HEROsModServices
{
Expand Down
Loading

0 comments on commit 49a982b

Please sign in to comment.