Add/Fix wagon tp.

This commit is contained in:
SilicaAndPina 2021-02-11 12:34:20 +13:00
parent a20656a9aa
commit 9e7743e24d
5 changed files with 58 additions and 13 deletions

View file

@ -134,7 +134,9 @@
"location_format":" <I>You are%META% </I><BR>",
"tile_format":"<B>%TILENAME%</B><BR>",
"private_notes_format":"^ATMy Private Game Notes^H^PB160|%PRIVATENOTES%^PS7|SAVE NOTES",
"transport_format":"^LTransport via %METHOD% to %PLACE%^R1^I%ICON%^T4Trip Costs $%COST% one way. ^B1M%XY%^BY%ID%^R1",
"transport_format":"^LTransport via %METHOD% to %PLACE%^R1^I%ICON%%COSTFORMAT%^B1M%XY%^BY%ID%^R1",
"transport_cost":"^T4Trip Costs $%COST% one way. ",
"transport_free":"^T4Trip is FREE(wagon owner). ",
"exit_this_place":"^X",
"end_of_meta":"^Z",
"back_to_map":"^M",

View file

@ -204,6 +204,9 @@ namespace HISP.Game
public static string CantAffordTransport;
public static string WelcomeToAreaFormat;
public static string TransportFormat;
public static string TransportCostFormat;
public static string TransportWagonFree;
//Dropped Items
@ -584,7 +587,6 @@ namespace HISP.Game
public static string TownFormat;
public static string AreaFormat;
public static string LocationFormat;
public static string TransportFormat;
public static string NearbyPlayers;
public static string North;
public static string East;
@ -1630,14 +1632,18 @@ namespace HISP.Game
return xy;
}
public static string FormatTransportMessage(string method, string place, int cost, int id, int x, int y)
public static string FormatTransportCost(int cost)
{
return TransportCostFormat.Replace("%COST%", cost.ToString("N0"));
}
public static string FormatTransportMessage(string method, string place, string costFormat, int id, int x, int y)
{
string xy = FormatMapLocation(x, y);
int iconId = 253;
if(method == "WAGON")
iconId = 254;
return TransportFormat.Replace("%METHOD%", method).Replace("%PLACE%", place).Replace("%COST%", cost.ToString()).Replace("%ID%", id.ToString()).Replace("%ICON%",iconId.ToString()).Replace("%XY%", xy);
return TransportFormat.Replace("%METHOD%", method).Replace("%PLACE%", place).Replace("%COSTFORMAT%", costFormat).Replace("%ID%", id.ToString()).Replace("%ICON%",iconId.ToString()).Replace("%XY%", xy);
}
// For all
public static string FormatGlobalChatMessage(string username, string message)

View file

@ -581,7 +581,7 @@ namespace HISP.Game
message += Messages.MetaTerminator;
return message;
}
public static string BuildTransportInfo(Transport.TransportPoint transportPoint)
public static string BuildTransportInfo(User user, Transport.TransportPoint transportPoint)
{
string message = "";
// Build list of locations
@ -589,7 +589,20 @@ namespace HISP.Game
{
int transportLocationId = transportPoint.Locations[i];
Transport.TransportLocation transportLocation = Transport.GetTransportLocation(transportLocationId);
message += Messages.FormatTransportMessage(transportLocation.Type, transportLocation.LocationTitle, transportLocation.Cost, transportLocation.Id, transportLocation.GotoX, transportLocation.GotoY);
string costFormat = Messages.FormatTransportCost(transportLocation.Cost);
if(transportLocation.Type == "WAGON")
{
if (user.OwnedRanch != null)
{
if (user.OwnedRanch.GetBuildingCount(7) > 0) // Wagon
{
costFormat = Messages.TransportWagonFree;
}
}
}
message += Messages.FormatTransportMessage(transportLocation.Type, transportLocation.LocationTitle, costFormat, transportLocation.Id, transportLocation.GotoX, transportLocation.GotoY);
}
message += Messages.ExitThisPlace;
message += Messages.MetaTerminator;
@ -1271,7 +1284,7 @@ namespace HISP.Game
if (TileCode == "TRANSPORT")
{
Transport.TransportPoint point = Transport.GetTransportPoint(specialTile.X, specialTile.Y);
message += Meta.BuildTransportInfo(point);
message += Meta.BuildTransportInfo(user, point);
}
if (TileCode == "STRAWPILE")

View file

@ -881,6 +881,9 @@ namespace HISP.Server
Messages.CantAffordTransport = gameData.messages.transport.not_enough_money;
Messages.WelcomeToAreaFormat = gameData.messages.transport.welcome_to_format;
Messages.TransportFormat = gameData.messages.meta.transport_format;
Messages.TransportCostFormat = gameData.messages.meta.transport_cost;
Messages.TransportWagonFree = gameData.messages.meta.transport_free;
// Abuse Reports
Messages.AbuseReportMetaFormat = gameData.messages.meta.abuse_report.options_format;
@ -1187,7 +1190,6 @@ namespace HISP.Server
Messages.AreaFormat = gameData.messages.meta.area_format;
Messages.Seperator = gameData.messages.meta.seperator;
Messages.TileFormat = gameData.messages.meta.tile_format;
Messages.TransportFormat = gameData.messages.meta.transport_format;
Messages.ExitThisPlace = gameData.messages.meta.exit_this_place;
Messages.BackToMap = gameData.messages.meta.back_to_map;
Messages.BackToMapHorse = gameData.messages.meta.back_to_map_horse;

View file

@ -1375,9 +1375,21 @@ namespace HISP.Server
}
Transport.TransportPoint newPoint = Transport.TransportPoints[smalestTransportPointId];
int newX = newPoint.X;
int newY = newPoint.Y;
if (World.InSpecialTile(newX, newY))
{
World.SpecialTile tile = World.GetSpecialTile(newX, newY);
if (tile.ExitX != 0)
newX = tile.ExitX;
if (tile.ExitY != 0)
newY = tile.ExitY;
}
byte[] transported = PacketBuilder.CreateChat(Messages.RanchWagonDroppedYouOff, PacketBuilder.CHAT_BOTTOM_RIGHT);
sender.SendPacket(transported);
sender.LoggedinUser.Teleport(newPoint.X, newPoint.Y);
sender.LoggedinUser.Teleport(newX, newY);
}
}
break;
@ -2912,12 +2924,21 @@ namespace HISP.Server
}
Transport.TransportLocation transportLocation = Transport.GetTransportLocation(transportid);
int cost = transportLocation.Cost;
if (sender.LoggedinUser.Money >= transportLocation.Cost)
if (transportLocation.Type == "WAGON")
{
if(sender.LoggedinUser.OwnedRanch != null)
{
if(sender.LoggedinUser.OwnedRanch.GetBuildingCount(7) > 0) // Wagon
{
cost = 0;
}
}
}
if (sender.LoggedinUser.Money >= cost)
{
string swfToLoad = Messages.BoatCutscene;
if (transportLocation.Type == "WAGON")
swfToLoad = Messages.WagonCutscene;
@ -2940,7 +2961,8 @@ namespace HISP.Server
byte[] welcomeToIslePacket = PacketBuilder.CreateChat(Messages.FormatWelcomeToAreaMessage(transportLocation.LocationTitle), PacketBuilder.CHAT_BOTTOM_RIGHT);
sender.SendPacket(welcomeToIslePacket);
sender.LoggedinUser.Money -= transportLocation.Cost;
if(cost > 0)
sender.LoggedinUser.Money -= cost;
}
else
{