mirror of
https://github.com/islehorse/HISP.git
synced 2025-04-19 19:29:15 +12:00
archive fourms
This commit is contained in:
parent
0c7d802f9d
commit
f84db853fe
391 changed files with 49471 additions and 5 deletions
|
@ -231,7 +231,20 @@ namespace HISP.Game
|
|||
public static string PlayerListMapAllBuddiesForamt;
|
||||
public static string PlayerListMapAllPlayersFormat;
|
||||
public static string PlayerListAbuseReport;
|
||||
|
||||
|
||||
public static int ThreeMonthSubscripitionIcon;
|
||||
public static int YearSubscriptionIcon;
|
||||
public static int NewUserIcon;
|
||||
public static int MonthSubscriptionIcon;
|
||||
public static int AdminIcon;
|
||||
public static int ModeratorIcon;
|
||||
|
||||
public static string BuddyListHeader;
|
||||
public static string BuddyListOnlineBuddyEntryFormat;
|
||||
public static string BuddyListOfflineBuddys;
|
||||
public static string BuddyListOfflineBuddyEntryFormat;
|
||||
|
||||
public static string PlayerListIconInformation;
|
||||
|
||||
// Meta
|
||||
public static string IsleFormat;
|
||||
|
@ -267,6 +280,15 @@ namespace HISP.Game
|
|||
// Click
|
||||
public static string NothingInterestingHere;
|
||||
|
||||
public static string FormatOnlineBuddyEntry(int iconId, string username, int userId, int time, int x, int y)
|
||||
{
|
||||
string xy = FormatMapLocation(x, y);
|
||||
return BuddyListOnlineBuddyEntryFormat.Replace("%ICON%", iconId.ToString()).Replace("%USERNAME%", username).Replace("%TIME%", time.ToString("N0")).Replace("%PLAYERID%", userId.ToString()).Replace("%MAPXY%", xy);
|
||||
}
|
||||
public static string FormatOfflineBuddyEntry(string username, int userId, int time)
|
||||
{
|
||||
return BuddyListOfflineBuddyEntryFormat.Replace("%USERNAME%", username).Replace("%TIME%", time.ToString("N0")).Replace("%PLAYERID%", userId.ToString());
|
||||
}
|
||||
public static string FormatConsumeItemMessaege(string itemName)
|
||||
{
|
||||
return ConsumeItemFormat.Replace("%ITEM%", itemName);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using HISP.Player;
|
||||
using HISP.Server;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace HISP.Game
|
||||
{
|
||||
|
@ -407,6 +408,21 @@ namespace HISP.Game
|
|||
return message;
|
||||
}
|
||||
|
||||
|
||||
public static string BuildBuddyList(User user)
|
||||
{
|
||||
string message = Messages.BuddyListHeader;
|
||||
foreach(int id in user.Friends.List.ToArray())
|
||||
{
|
||||
try
|
||||
{
|
||||
User friend = GameServer.GetUserById(id);
|
||||
message += Messages.FormatOnlineBuddyEntry()
|
||||
}
|
||||
catch (KeyNotFoundException) { };
|
||||
}
|
||||
}
|
||||
|
||||
public static string BuildSpecialTileInfo(User user, World.SpecialTile specialTile)
|
||||
{
|
||||
string message = "";
|
||||
|
|
|
@ -29,7 +29,22 @@ namespace HISP.Player
|
|||
|
||||
}
|
||||
|
||||
|
||||
public void RemoveFriend(int userid)
|
||||
{
|
||||
Database.RemoveBuddy(baseUser.Id, userid);
|
||||
|
||||
// Remove buddy from there list if they are logged in
|
||||
try
|
||||
{
|
||||
|
||||
User removeFrom = GameServer.GetUserById(userid);
|
||||
removeFrom.Friends.List.Remove(baseUser.Id);
|
||||
}
|
||||
catch (KeyNotFoundException) { /* User is ofline, remove from database is sufficent */ };
|
||||
|
||||
|
||||
baseUser.Friends.List.Remove(userid);
|
||||
}
|
||||
public void AddFriend(User userToFriend)
|
||||
{
|
||||
bool pendingRequest = Database.IsPendingBuddyRequestExist(baseUser.Id, userToFriend.Id);
|
||||
|
|
|
@ -41,6 +41,7 @@ namespace HISP.Player
|
|||
public PlayerQuests Quests;
|
||||
public Highscore Highscores;
|
||||
public Award Awards;
|
||||
public DateTime LoginTime;
|
||||
public int FreeMinutes
|
||||
{
|
||||
get
|
||||
|
@ -387,11 +388,9 @@ namespace HISP.Player
|
|||
|
||||
|
||||
Friends = new Friends(this);
|
||||
|
||||
LoginTime = DateTime.UtcNow;
|
||||
LoggedinClient = baseClient;
|
||||
|
||||
Inventory = new PlayerInventory(this);
|
||||
|
||||
Quests = new PlayerQuests(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -562,7 +562,19 @@ namespace HISP.Server
|
|||
Messages.PlayerListMapAllPlayersFormat = gameData.messages.meta.player_list.map_all_players_format;
|
||||
Messages.PlayerListAbuseReport = gameData.messages.meta.player_list.abuse_report;
|
||||
|
||||
Messages.ThreeMonthSubscripitionIcon = gameData.messages.meta.player_list.icon_subbed_3month;
|
||||
Messages.YearSubscriptionIcon = gameData.messages.meta.player_list.icon_subbed_year;
|
||||
Messages.NewUserIcon = gameData.messages.meta.player_list.icon_new;
|
||||
Messages.MonthSubscriptionIcon = gameData.messages.meta.player_list.icon_subbed_month;
|
||||
Messages.AdminIcon = gameData.messages.meta.player_list.icon_admin;
|
||||
Messages.ModeratorIcon = gameData.messages.meta.player_list.icon_mod;
|
||||
|
||||
Messages.BuddyListHeader = gameData.messages.meta.player_list.online_buddy_header;
|
||||
Messages.BuddyListOnlineBuddyEntryFormat = gameData.messages.meta.player_list.online_buddy_format;
|
||||
Messages.BuddyListOfflineBuddys = gameData.messages.meta.offline_buddys;
|
||||
Messages.BuddyListOfflineBuddyEntryFormat = gameData.messages.player_list.offline_buddy_format;
|
||||
|
||||
Messages.PlayerListIconInformation = gameData.messages.player_list.icon_info;
|
||||
// Consume
|
||||
|
||||
Messages.ConsumeItemFormat = gameData.messages.consume.consumed_item_format;
|
||||
|
|
|
@ -1972,6 +1972,18 @@ namespace HISP.Server
|
|||
}
|
||||
throw new KeyNotFoundException("User was not found.");
|
||||
}
|
||||
|
||||
public static User GetUserById(int id)
|
||||
{
|
||||
foreach(GameClient client in ConnectedClients)
|
||||
{
|
||||
if (client.LoggedIn)
|
||||
if (client.LoggedinUser.Id == id)
|
||||
return client.LoggedinUser;
|
||||
}
|
||||
|
||||
throw new KeyNotFoundException("User not found (not online?)");
|
||||
}
|
||||
public static User[] GetNearbyUsers(int x, int y, bool includeStealth=false, bool includeMuted=false)
|
||||
{
|
||||
int startX = x - 15;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue