mirror of
https://github.com/islehorse/HISP.git
synced 2025-04-07 13:45:42 +12:00
Add remove buddy
This commit is contained in:
parent
1772ceb037
commit
80be845824
7 changed files with 44 additions and 6 deletions
|
@ -232,7 +232,8 @@
|
|||
"add_buddy":{
|
||||
"add_pending":"Attempting to Add Buddy. The other player must click ADD BUDDY as well. (Many players reserve this for just a couple players so don't feel insulted if they do not).",
|
||||
"other_pending":"%PLAYERNAME% is trying to add you as a buddy, click ADD BUDDY to make them a buddy.",
|
||||
"add_confirmed":"You and %PLAYERNAME% are now buddies."
|
||||
"add_confirmed":"You and %PLAYERNAME% are now buddies.",
|
||||
"deleted":"Removed Buddy: %PLAYERNAME%."
|
||||
},
|
||||
"socials":{
|
||||
"socials_button":"^B5%ID%%SOCIALNAME%",
|
||||
|
@ -1142,7 +1143,10 @@
|
|||
{"word":"lmfao","new_word":"*laughing my horse's rump off*"},
|
||||
{"word":"rofl","new_word":"*rolling on floor laughing*"},
|
||||
{"word":"ppp","new_word":"*petting a pretty pony*"},
|
||||
{"word":"afk","new_word":"*away from game for a bit*"},
|
||||
{"word":"wtf","new_word":"what the horse poo!"},
|
||||
{"word":"gtg","new_word":"got to gallop"},
|
||||
{"word":"idk","new_word":"i dont know"},
|
||||
{"word":"wtg","new_word":"!!- Way To Go -!!"},
|
||||
{"word":"ty","new_word":"thank you"},
|
||||
{"word":"asl","new_word":"how are you"},
|
||||
|
|
|
@ -17,6 +17,7 @@ namespace HISP.Game
|
|||
public static string AddBuddyPending;
|
||||
public static string AddBuddyOtherPendingFormat;
|
||||
public static string AddBuddyYourNowBuddiesFormat;
|
||||
public static string AddBuddyDeleteBuddyFormat;
|
||||
|
||||
// Tag
|
||||
public static string TagYourItFormat;
|
||||
|
@ -1030,6 +1031,10 @@ namespace HISP.Game
|
|||
// Click
|
||||
public static string NothingInterestingHere;
|
||||
|
||||
public static string FormatAddBuddyRemoveBuddy(string buddyName)
|
||||
{
|
||||
return AddBuddyDeleteBuddyFormat.Replace("%PLAYERNAME%", buddyName);
|
||||
}
|
||||
public static string FormatTagTotalBuddies(int count)
|
||||
{
|
||||
return TagOtherBuddiesOnlineFormat.Replace("%TOTALBUDDIESON%", count.ToString("N0", CultureInfo.InvariantCulture));
|
||||
|
|
|
@ -1210,14 +1210,14 @@ namespace HISP.Game
|
|||
}
|
||||
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 = Convert.ToInt32(Math.Round((Converters.UnixTimeStampToDateTime(Database.GetPlayerLastLogin(id)) - DateTime.UtcNow).TotalMinutes));
|
||||
int minutes = Convert.ToInt32(Math.Round(DateTime.UtcNow.Subtract(Converters.UnixTimeStampToDateTime(Database.GetPlayerLastLogin(id))).TotalMinutes));
|
||||
|
||||
message += Messages.FormatOfflineBuddyEntry(username, id, minutes);
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ namespace HISP.Server
|
|||
{
|
||||
// Unix timestamp is seconds past epoch
|
||||
System.DateTime dtDateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
|
||||
dtDateTime = dtDateTime.AddSeconds(unixTimeStamp).ToLocalTime();
|
||||
dtDateTime = dtDateTime.AddSeconds(unixTimeStamp).ToUniversalTime();
|
||||
return dtDateTime;
|
||||
}
|
||||
|
||||
|
|
|
@ -856,7 +856,7 @@ namespace HISP.Server
|
|||
Messages.AddBuddyPending = gameData.messages.meta.player_interaction.add_buddy.add_pending;
|
||||
Messages.AddBuddyOtherPendingFormat = gameData.messages.meta.player_interaction.add_buddy.other_pending;
|
||||
Messages.AddBuddyYourNowBuddiesFormat = gameData.messages.meta.player_interaction.add_buddy.add_confirmed;
|
||||
|
||||
Messages.AddBuddyDeleteBuddyFormat = gameData.messages.meta.player_interaction.add_buddy.deleted;
|
||||
|
||||
// Socials
|
||||
Messages.SocialButton = gameData.messages.meta.player_interaction.socials.socials_button;
|
||||
|
|
|
@ -250,7 +250,7 @@ namespace HISP.Server
|
|||
}
|
||||
catch (FormatException)
|
||||
{
|
||||
Logger.ErrorPrint(sender.LoggedinUser.Username + " tried to trade with User ID NaN.");
|
||||
Logger.ErrorPrint(sender.LoggedinUser.Username + " tried to view profile of User ID NaN.");
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -262,6 +262,34 @@ namespace HISP.Server
|
|||
byte[] metaTag = PacketBuilder.CreateMetaPacket(Meta.BuildStatsMenu(user, true));
|
||||
sender.SendPacket(metaTag);
|
||||
}
|
||||
break;
|
||||
case PacketBuilder.PLAYER_INTERACTION_REMOVE_BUDDY:
|
||||
packetStr = Encoding.UTF8.GetString(packet);
|
||||
playerIdStr = packetStr.Substring(2, packetStr.Length - 4);
|
||||
playerId = -1;
|
||||
try
|
||||
{
|
||||
playerId = int.Parse(playerIdStr);
|
||||
}
|
||||
catch (FormatException)
|
||||
{
|
||||
Logger.ErrorPrint(sender.LoggedinUser.Username + " tried to remove User ID NaN as a buddy.");
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if(sender.LoggedinUser.Friends.IsFriend(playerId))
|
||||
{
|
||||
sender.LoggedinUser.Friends.RemoveFriend(playerId);
|
||||
|
||||
byte[] friendRemoved = PacketBuilder.CreateChat(Messages.FormatAddBuddyRemoveBuddy(Database.GetUsername(playerId)), PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
sender.SendPacket(friendRemoved);
|
||||
|
||||
sender.LoggedinUser.MetaPriority = true;
|
||||
byte[] metaPacket = PacketBuilder.CreateMetaPacket(Meta.BuildPlayerList(sender.LoggedinUser));
|
||||
sender.SendPacket(metaPacket);
|
||||
}
|
||||
|
||||
break;
|
||||
case PacketBuilder.PLAYER_INTERACTION_TAG:
|
||||
packetStr = Encoding.UTF8.GetString(packet);
|
||||
|
|
|
@ -63,6 +63,7 @@ namespace HISP.Server
|
|||
public const byte PLAYER_INTERACTION_ACCEPT = 0x2A;
|
||||
public const byte PLAYER_INTERACTION_TRADE_REJECT = 0x2B;
|
||||
public const byte PLAYER_INTERACTION_ADD_BUDDY = 0x1E;
|
||||
public const byte PLAYER_INTERACTION_REMOVE_BUDDY = 0x1F;
|
||||
|
||||
public const byte AUCTION_BID_100 = 0x29;
|
||||
public const byte AUCTION_BID_1K = 0x2A;
|
||||
|
|
Loading…
Add table
Reference in a new issue