mirror of
https://github.com/islehorse/HISP.git
synced 2025-04-06 21:25:42 +12:00
Allow searching for NPCS.
This commit is contained in:
parent
0c42d02359
commit
cb497ef7d2
5 changed files with 125 additions and 1 deletions
|
@ -130,6 +130,14 @@
|
|||
"venus_flytrap_format":"The Giant Venus Flytrap chomped at you!<BR><B>OUCH!!</B><BR>It chomped your pocket, taking $%MONEY% with it!!",
|
||||
"password_input":"<BR>^PLReply:|^PS14|ANSWER^R1",
|
||||
"last_poet":"^R1^LLast Player Poet:%USERNAME% ^R1",
|
||||
"libary":{
|
||||
"main_menu":"Welcome to the Library! You can research different subjects.<BR>^T2Search Residents: ^D30|SEARCH NPC^R1^T2Search Ranches: ^D31|SEARCH RANCH^R1^T2Research Horses: ^D4|VIEW BREEDS^R1^T2Research Tack: ^D9|VIEW TACK^R1^T2Research Companions: ^D10|VIEW COMPANIONS^R1^T2Research Mini-Games: ^D12|VIEW MINIGAMES^R1^T2Research Locations: ^D22|VIEW LOCATIONS^R1^T2Research Awards: ^D23|VIEW AWARDS^R1^T2Read Books: ^D38|READ BOOKS^R1",
|
||||
"find_npc":"<B>SEARCH FOR A RESIDENT:</B><BR>Enter a resident's name below(not players). It will match on partial names.<BR>^PLResident Locator(NPC):|NPC name^PS4|FIND RESIDENTS^R3",
|
||||
"find_npc_results_header":"The following residents match closely:<BR>",
|
||||
"find_npc_results_format":"^T7%NPCNAME%^B1M%MAPXY%^R1",
|
||||
"find_npc_no_results":"The following residents match closely:<BR>None were found by that name, try looking for a partial name.",
|
||||
"find_npc_limit5":"^L- Limited to 5 results. Try narrowing the search.^R1"
|
||||
},
|
||||
"multiroom":{
|
||||
"other_players_participating":"<BR>^LThe following other players are participating:",
|
||||
"partcipent_format":"^R1^T3%USERNAME%"
|
||||
|
|
|
@ -75,7 +75,16 @@ namespace HISP.Game
|
|||
public static string LoginMessageFormat;
|
||||
public static string LogoutMessageFormat;
|
||||
|
||||
// Libary
|
||||
public static string LibaryMainMenu;
|
||||
public static string LibaryFindNpc;
|
||||
public static string LibaryFindNpcSearchResultsHeader;
|
||||
public static string LibaryFindNpcSearchResultFormat;
|
||||
public static string LibaryFindNpcSearchNoResults;
|
||||
public static string LibaryFindNpcLimit5;
|
||||
|
||||
// Records
|
||||
|
||||
public static string ProfileSavedMessage;
|
||||
public static string PrivateNotesSavedMessage;
|
||||
public static string PrivateNotesMetaFormat;
|
||||
|
@ -338,6 +347,11 @@ namespace HISP.Game
|
|||
// Click
|
||||
public static string NothingInterestingHere;
|
||||
|
||||
public static string FormatNpcSearchResult(string name, int x, int y)
|
||||
{
|
||||
string mapXy = FormatMapLocation(x, y);
|
||||
return LibaryFindNpcSearchResultFormat.Replace("%NPCNAME%", name).Replace("%MAPXY%", mapXy);
|
||||
}
|
||||
public static string FormatLastPoet(string name)
|
||||
{
|
||||
return LastPoetFormat.Replace("%USERNAME%", name);
|
||||
|
|
|
@ -247,7 +247,10 @@ namespace HISP.Game
|
|||
return message;
|
||||
|
||||
}
|
||||
|
||||
public static string buildLibary()
|
||||
{
|
||||
return Messages.LibaryMainMenu + Messages.ExitThisPlace + Messages.MetaTerminator;
|
||||
}
|
||||
private static string buildNpc(User user, int x, int y)
|
||||
{
|
||||
string message = "";
|
||||
|
@ -617,6 +620,57 @@ namespace HISP.Game
|
|||
return message;
|
||||
}
|
||||
|
||||
public static string BuildNpcSearch(string search)
|
||||
{
|
||||
List<Npc.NpcEntry> foundNpcs = new List<Npc.NpcEntry>();
|
||||
foreach(Npc.NpcEntry npc in Npc.NpcList)
|
||||
{
|
||||
if(npc.Name.ToLower().Contains(search.ToLower()))
|
||||
{
|
||||
if(npc.LibarySearchable)
|
||||
{
|
||||
if (foundNpcs.Count >= 5)
|
||||
break;
|
||||
foundNpcs.Add(npc);
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
string message = Messages.LibaryFindNpcSearchNoResults;
|
||||
if(foundNpcs.Count >= 1)
|
||||
{
|
||||
message = Messages.LibaryFindNpcSearchResultsHeader;
|
||||
foreach(Npc.NpcEntry npc in foundNpcs)
|
||||
{
|
||||
string searchResult = Messages.FormatNpcSearchResult(npc.Name, npc.X, npc.Y);
|
||||
Logger.DebugPrint(searchResult);
|
||||
message += searchResult;
|
||||
}
|
||||
}
|
||||
if(foundNpcs.Count >= 5)
|
||||
{
|
||||
message += Messages.LibaryFindNpcLimit5;
|
||||
}
|
||||
|
||||
message += Messages.BackToMap;
|
||||
message += Messages.MetaTerminator;
|
||||
return message;
|
||||
|
||||
}
|
||||
public static string BuildFindNpcMenu()
|
||||
{
|
||||
string message = Messages.LibaryFindNpc;
|
||||
message += Messages.BackToMap;
|
||||
message += Messages.MetaTerminator;
|
||||
return message;
|
||||
}
|
||||
private static string buildFountain()
|
||||
{
|
||||
return Messages.FountainMeta;
|
||||
|
@ -721,6 +775,10 @@ namespace HISP.Game
|
|||
{
|
||||
message += buildVenusFlyTrap(user);
|
||||
}
|
||||
if(TileCode == "LIBRARY")
|
||||
{
|
||||
message += buildLibary();
|
||||
}
|
||||
if(TileCode == "MULTIROOM")
|
||||
{
|
||||
user.MetaPriority = false; // acturally want to track updates here >-<
|
||||
|
|
|
@ -554,6 +554,15 @@ namespace HISP.Server
|
|||
Messages.BankDepositedMoneyFormat = gameData.messages.bank.deposit_format;
|
||||
Messages.BankWithdrewMoneyFormat = gameData.messages.bank.withdraw_format;
|
||||
|
||||
|
||||
// Libary
|
||||
Messages.LibaryMainMenu = gameData.messages.meta.libary.main_menu;
|
||||
Messages.LibaryFindNpc = gameData.messages.meta.libary.find_npc;
|
||||
Messages.LibaryFindNpcSearchResultsHeader = gameData.messages.meta.libary.find_npc_results_header;
|
||||
Messages.LibaryFindNpcSearchResultFormat = gameData.messages.meta.libary.find_npc_results_format;
|
||||
Messages.LibaryFindNpcSearchNoResults = gameData.messages.meta.libary.find_npc_no_results;
|
||||
Messages.LibaryFindNpcLimit5 = gameData.messages.meta.libary.find_npc_limit5;
|
||||
|
||||
// Chat
|
||||
|
||||
Messages.ChatViolationMessageFormat = gameData.messages.chat.violation_format;
|
||||
|
|
|
@ -148,6 +148,20 @@ namespace HISP.Server
|
|||
Logger.ErrorPrint(sender.LoggedinUser.Username + " Tried to send a invalid dynamic input (private notes, wrong size)");
|
||||
break;
|
||||
}
|
||||
case 4: // NPC Search
|
||||
if(dynamicInput.Length >= 2)
|
||||
{
|
||||
sender.LoggedinUser.MetaPriority = true;
|
||||
string metaWindow = Meta.BuildNpcSearch(dynamicInput[1]);
|
||||
byte[] metaPacket = PacketBuilder.CreateMetaPacket(metaWindow);
|
||||
sender.SendPacket(metaPacket);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.ErrorPrint(sender.LoggedinUser.Username + " Tried to send a invalid dynamic input (NPC Search, wrong size)");
|
||||
break;
|
||||
}
|
||||
case 7: // Private Notes
|
||||
if (dynamicInput.Length >= 2)
|
||||
{
|
||||
|
@ -335,6 +349,27 @@ namespace HISP.Server
|
|||
metaPacket = PacketBuilder.CreateMetaPacket(Meta.BuildPlayerListAlphabetical());
|
||||
sender.SendPacket(metaPacket);
|
||||
break;
|
||||
case "30": // Find NPC
|
||||
sender.LoggedinUser.MetaPriority = true;
|
||||
metaPacket = PacketBuilder.CreateMetaPacket(Meta.BuildFindNpcMenu());
|
||||
sender.SendPacket(metaPacket);
|
||||
break;
|
||||
case "31": // Find Ranch
|
||||
break;
|
||||
case "4": // View Horse Breed
|
||||
break;
|
||||
case "9": // View Tack
|
||||
break;
|
||||
case "10": // View Competitions
|
||||
break;
|
||||
case "12": // View Miigames
|
||||
break;
|
||||
case "22": // View Locations
|
||||
break;
|
||||
case "23": // View Awards
|
||||
break;
|
||||
case "38": // Read Books
|
||||
break;
|
||||
case "28c1":
|
||||
sender.LoggedinUser.MetaPriority = true;
|
||||
metaPacket = PacketBuilder.CreateMetaPacket(Meta.BuildAbuseReportPage());
|
||||
|
|
Loading…
Add table
Reference in a new issue