mirror of
https://github.com/islehorse/HISP.git
synced 2025-04-23 05:05:53 +12:00
Add buddy list ..
This commit is contained in:
parent
f84db853fe
commit
df44358ad7
9 changed files with 279 additions and 18 deletions
|
@ -244,6 +244,7 @@ namespace HISP.Game
|
|||
public static string BuddyListOfflineBuddys;
|
||||
public static string BuddyListOfflineBuddyEntryFormat;
|
||||
|
||||
public static string PlayerListIconFormat;
|
||||
public static string PlayerListIconInformation;
|
||||
|
||||
// Meta
|
||||
|
@ -280,10 +281,14 @@ namespace HISP.Game
|
|||
// Click
|
||||
public static string NothingInterestingHere;
|
||||
|
||||
public static string FormatOnlineBuddyEntry(int iconId, string username, int userId, int time, int x, int y)
|
||||
public static string FormatIconFormat(int iconId)
|
||||
{
|
||||
return PlayerListIconFormat.Replace("%ICON%", iconId.ToString());
|
||||
}
|
||||
public static string FormatOnlineBuddyEntry(string iconFormat, 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);
|
||||
return BuddyListOnlineBuddyEntryFormat.Replace("%ICONFORMAT%", iconFormat).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)
|
||||
{
|
||||
|
|
|
@ -417,10 +417,52 @@ namespace HISP.Game
|
|||
try
|
||||
{
|
||||
User friend = GameServer.GetUserById(id);
|
||||
message += Messages.FormatOnlineBuddyEntry()
|
||||
int icon = -1;
|
||||
if (friend.NewPlayer)
|
||||
icon = Messages.NewUserIcon;
|
||||
if (friend.Subscribed)
|
||||
{
|
||||
int months = (DateTime.UtcNow.Month - friend.SubscribedUntil.Month) + 12 * (DateTime.UtcNow.Year - friend.SubscribedUntil.Year);
|
||||
if (months <= 1)
|
||||
icon = Messages.MonthSubscriptionIcon;
|
||||
else if (months <= 3)
|
||||
icon = Messages.ThreeMonthSubscripitionIcon;
|
||||
else
|
||||
icon = Messages.YearSubscriptionIcon;
|
||||
}
|
||||
if (friend.Moderator)
|
||||
icon = Messages.ModeratorIcon;
|
||||
if (friend.Administrator)
|
||||
icon = Messages.AdminIcon;
|
||||
|
||||
string iconFormat = "";
|
||||
if (icon != -1)
|
||||
iconFormat = Messages.FormatIconFormat(icon);
|
||||
message += Messages.FormatOnlineBuddyEntry(iconFormat, friend.Username, friend.Id, (DateTime.UtcNow - friend.LoginTime).Minutes, friend.X, friend.Y);
|
||||
|
||||
}
|
||||
catch (KeyNotFoundException) { };
|
||||
catch (KeyNotFoundException) { }
|
||||
|
||||
}
|
||||
message += Messages.BuddyListOfflineBuddys;
|
||||
|
||||
foreach(int id in user.Friends.List.ToArray())
|
||||
{
|
||||
if (GameServer.IsUserOnline(id))
|
||||
continue;
|
||||
|
||||
message += Messages.BuddyListOfflineBuddys;
|
||||
string username = Database.GetUsername(id);
|
||||
int minutes = (DateTime.UtcNow - Converters.UnixTimeStampToDateTime(Database.GetPlayerLastLogin(id))).Minutes;
|
||||
|
||||
message += Messages.FormatOfflineBuddyEntry(username, id, minutes);
|
||||
}
|
||||
|
||||
message += Messages.PlayerListIconInformation;
|
||||
message += Messages.BackToMap;
|
||||
message += Messages.MetaTerminator;
|
||||
|
||||
return message;
|
||||
}
|
||||
|
||||
public static string BuildSpecialTileInfo(User user, World.SpecialTile specialTile)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue