Fully implement libarys!

This commit is contained in:
SilicaAndPina 2021-02-12 11:18:55 +13:00
parent e9cee36b24
commit 2c77957434
5 changed files with 80 additions and 4 deletions

View file

@ -151,6 +151,12 @@ namespace HISP.Game
public static string LibaryFindNpcSearchNoResults;
public static string LibaryFindNpcLimit5;
public static string LibaryFindRanch;
public static string LibaryFindRanchResultsHeader;
public static string LibaryFindRanchResultFormat;
public static string LibaryFindRanchResultsNoResults;
public static string HorseBreedFormat;
public static string HorseRelativeFormat;
public static string BreedViewerFormat;
@ -1184,6 +1190,11 @@ namespace HISP.Game
{
return HorseBreedFormat.Replace("%NAME%", name).Replace("%ID%", id.ToString());
}
public static string FormatRanchSearchResult(string name, int x, int y)
{
string mapXy = FormatMapLocation(x, y);
return LibaryFindRanchResultFormat.Replace("%USERNAME%", name).Replace("%MAPXY%", mapXy);
}
public static string FormatNpcSearchResult(string name, string desc,int x, int y)
{
string mapXy = FormatMapLocation(x, y);

View file

@ -489,6 +489,40 @@ namespace HISP.Game
message += Messages.MetaTerminator;
return message;
}
public static string BuildRanchSearchResults(string search)
{
string message = "";
message += Messages.LibaryFindRanchResultsHeader;
int totalResults = 0;
foreach(Ranch ranch in Ranch.Ranches)
{
if(ranch.OwnerId != -1)
{
string ranchOwnerName = Database.GetUsername(ranch.OwnerId);
if(ranchOwnerName.ToLower().Contains(search.ToLower()))
{
message += Messages.FormatRanchSearchResult(ranchOwnerName, ranch.X, ranch.Y);
totalResults++;
}
}
if (totalResults >= 10)
break;
}
if (totalResults == 0)
message += Messages.LibaryFindRanchResultsNoResults;
message += Messages.BackToMap;
message += Messages.MetaTerminator;
return message;
}
public static string BuildRanchSearchLibary()
{
string message = "";
message += Messages.LibaryFindRanch;
message += Messages.BackToMap;
message += Messages.MetaTerminator;
return message;
}
public static string BuildAwardsLibary()
{
string message = "";