2018-05-10 05:23:42 +08:00
|
|
|
using System.Collections.Generic;
|
2018-12-30 18:00:05 +08:00
|
|
|
using StardewValley;
|
2018-05-10 05:23:42 +08:00
|
|
|
|
|
|
|
namespace Omegasis.HappyBirthday.Framework
|
|
|
|
{
|
|
|
|
public class MultiplayerSupport
|
|
|
|
{
|
|
|
|
public static string FSTRING_SendBirthdayMessageToOthers = "Omegasis.HappyBirthday.Framework.Messages.SendBirthdayMessageToOtherPlayers";
|
2018-12-10 11:57:12 +08:00
|
|
|
public static string FSTRING_SendBirthdayInfoToOthers = "Omegasis.HappyBirthday.Framework.Messages.SendBirthdayInfoToOtherPlayers";
|
2018-05-10 05:23:42 +08:00
|
|
|
|
2018-12-10 11:57:12 +08:00
|
|
|
public static void SendBirthdayMessageToOtherPlayers()
|
2018-05-10 05:23:42 +08:00
|
|
|
{
|
2019-01-15 04:26:36 +08:00
|
|
|
string str = BirthdayMessages.GetTranslatedString("Happy Birthday: Farmhand Birthday Message");
|
|
|
|
str.Replace("@", Game1.player.name);
|
|
|
|
HUDMessage message = new HUDMessage(str, 1);
|
2018-05-10 05:23:42 +08:00
|
|
|
|
2019-04-12 08:25:54 +08:00
|
|
|
|
|
|
|
|
2018-12-30 18:00:05 +08:00
|
|
|
foreach (KeyValuePair<long, Farmer> f in Game1.otherFarmers)
|
2018-05-10 05:23:42 +08:00
|
|
|
{
|
2018-12-30 18:00:05 +08:00
|
|
|
HappyBirthday.ModHelper.Multiplayer.SendMessage<string>(message.message, FSTRING_SendBirthdayMessageToOthers, new string[] { HappyBirthday.ModHelper.Multiplayer.ModID }, new long[] { f.Key });
|
2018-05-10 05:23:42 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-10 11:57:12 +08:00
|
|
|
public static void SendBirthdayInfoToOtherPlayers()
|
2018-05-10 05:23:42 +08:00
|
|
|
{
|
2018-12-10 11:57:12 +08:00
|
|
|
foreach (KeyValuePair<long, Farmer> f in Game1.otherFarmers)
|
2018-05-10 05:23:42 +08:00
|
|
|
{
|
2018-12-30 18:00:05 +08:00
|
|
|
HappyBirthday.ModHelper.Multiplayer.SendMessage<KeyValuePair<long, PlayerData>>(new KeyValuePair<long, PlayerData>(Game1.player.uniqueMultiplayerID, HappyBirthday.PlayerBirthdayData), FSTRING_SendBirthdayInfoToOthers, new string[] { HappyBirthday.ModHelper.Multiplayer.ModID }, new long[] { f.Key });
|
2018-05-10 05:23:42 +08:00
|
|
|
}
|
2018-12-10 13:04:41 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
public static void SendBirthdayInfoToConnectingPlayer(long id)
|
|
|
|
{
|
|
|
|
HappyBirthday.ModHelper.Multiplayer.SendMessage<KeyValuePair<long, PlayerData>>(new KeyValuePair<long, PlayerData>(Game1.player.uniqueMultiplayerID, HappyBirthday.PlayerBirthdayData), FSTRING_SendBirthdayInfoToOthers, new string[] { HappyBirthday.ModHelper.Multiplayer.ModID }, new long[] { id });
|
2018-05-10 05:23:42 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|