Add BBCODE to Horse Descriptions, Player Descriptions and Ranch Descriptions.

This commit is contained in:
SilicaAndPina 2021-02-13 17:47:28 +13:00
parent bdebe4d84a
commit 72bc81d900
14 changed files with 142 additions and 40 deletions

View file

@ -348,7 +348,7 @@ namespace HISP.Game.Chat
foreach(Correction correct in CorrectedWords)
message = message.Replace(correct.FilteredWord, correct.ReplacedWord);
return message;
return message.Trim();
}
public static string EscapeMessage(string message)
{

View file

@ -98,7 +98,7 @@ namespace HISP.Game.Horse
}
set
{
name = value;
name = value.Trim();
Database.SetHorseName(this.RandomId, name);
}
}
@ -110,8 +110,8 @@ namespace HISP.Game.Horse
}
set
{
description = value;
Database.SetHorseDescription(this.RandomId, value);
description = value.Trim();
Database.SetHorseDescription(this.RandomId, description);
}
}
public string Sex;

View file

@ -61,11 +61,6 @@ namespace HISP.Game.Items
foreach (DroppedItem droppedItem in items)
droppedItemsList.Add(droppedItem);
}
public static void Update()
{
DespawnItems();
GenerateItems(false);
}
public static void RemoveDroppedItem(DroppedItem item)
{
int randomId = item.Instance.RandomId;
@ -110,12 +105,12 @@ namespace HISP.Game.Items
{
Database.DecrementDroppedItemDespawnTimer();
for(int i = 0; i < droppedItemsList.Count; i++)
for (int i = 0; i < droppedItemsList.Count; i++)
{
if (droppedItemsList[i] == null) // Item removed in another thread.
continue;
droppedItemsList[i].DespawnTimer--;
droppedItemsList[i].DespawnTimer-=5;
if(droppedItemsList[i].DespawnTimer <= 0)
{
if (GameServer.GetUsersAt(droppedItemsList[i].X, droppedItemsList[i].Y, true, true).Length > 0) // Dont despawn items players are standing on

View file

@ -32,7 +32,9 @@ namespace HISP.Game
{
int pos = ((x * Height) + y);
if (pos >= oMapData.Length && overlay)
if ((pos <= 0 || pos >= oMapData.Length) && overlay)
return 1;
else if ((pos <= 0 || pos >= MapData.Length) && !overlay)
return 1;
else if (overlay && Treasure.IsTileBuiredTreasure(x, y))
return 193; // Burried Treasure tile.

View file

@ -1,4 +1,5 @@
using HISP.Server;
using HISP.Security;
using HISP.Server;
using System;
using System.Drawing;
using System.Globalization;
@ -70,7 +71,8 @@ namespace HISP.Game
public static string RanchTrainAllAttempt;
public static string RanchTrainSuccessFormat;
public static string RanchTrainCantTrain;
public static string RanchTrainBadMoodFormat;
public static string RanchTrainCantTrainFormat;
public static string RanchHorsesFullyRested;
public static string RanchWagonDroppedYouOff;
@ -756,7 +758,11 @@ namespace HISP.Game
public static string FormatRanchTrainFail(string horseName, int timeout)
{
return RanchTrainCantTrain.Replace("%HORSENAME%", horseName).Replace("%TIME%", timeout.ToString());
return RanchTrainCantTrainFormat.Replace("%HORSENAME%", horseName).Replace("%TIME%", timeout.ToString());
}
public static string FormatRanchTrainBadMood(string horseName)
{
return RanchTrainBadMoodFormat.Replace("%HORSENAME%", horseName);
}
public static string FormatRanchTrain(string horseName, int speed, int strength, int conformation, int agility, int endurance, int exp)
{
@ -764,7 +770,7 @@ namespace HISP.Game
}
public static string FormatRanchDescOthers(string description)
{
return RanchDescriptionOthersFormat.Replace("%DESCRIPTION%", description);
return RanchDescriptionOthersFormat.Replace("%DESCRIPTION%", BBCode.EncodeBBCodeToMeta(description));
}
public static string FormatRanchSoldMessage(int price)
{
@ -792,7 +798,7 @@ namespace HISP.Game
}
public static string FormatRanchYoursDescription(string description)
{
return RanchYourDescriptionFormat.Replace("%DESCRIPTION%", description);
return RanchYourDescriptionFormat.Replace("%DESCRIPTION%", BBCode.EncodeBBCodeToMeta(description));
}
public static string FormatBuildingEntry(string name, int price, int buildingId)
{
@ -848,7 +854,7 @@ namespace HISP.Game
}
public static string FormatCantTrain(string horseName)
{
return RanchTrainCantTrain.Replace("%HORSENAME%", horseName);
return RanchTrainCantTrainFormat.Replace("%HORSENAME%", horseName);
}
public static string FormatRiddlerRiddle(string riddle)
{
@ -1160,7 +1166,7 @@ namespace HISP.Game
}
public static string FormatHorseDescription(string Description)
{
return HorseDescriptionFormat.Replace("%DESCRIPTION%", Description);
return HorseDescriptionFormat.Replace("%DESCRIPTION%", BBCode.EncodeBBCodeToMeta(Description));
}
public static string FormatHorseHandsHigh(string color, string breed,string sex, double handsHigh)
{
@ -1515,7 +1521,7 @@ namespace HISP.Game
}
public static string FormatPlayerDescriptionForStatsMenu(string description)
{
return StatsDescriptionFormat.Replace("%PLAYERDESC%", description);
return StatsDescriptionFormat.Replace("%PLAYERDESC%", BBCode.EncodeBBCodeToMeta(description));
}
public static string FormatExperience(int expPoints)

View file

@ -646,6 +646,10 @@ namespace HISP.Game
message += Messages.RanchTrainAllAttempt;
foreach(HorseInstance horse in user.HorseInventory.HorseList)
{
if(horse.BasicStats.Mood < 200)
{
message += Messages.FormatRanchTrainBadMood(horse.Name);
}
if(horse.TrainTimer == 0)
{
horse.AdvancedStats.Speed += 1;

View file

@ -192,8 +192,8 @@ namespace HISP.Game
}
set
{
title = value;
Database.SetRanchTitle(Id, value);
title = value.Trim();
Database.SetRanchTitle(Id, title);
}
}
public string Description
@ -204,7 +204,7 @@ namespace HISP.Game
}
set
{
description = value;
description = value.Trim();
Database.SetRanchDescription(Id, value);
}
}