Пример #1
0
 public static void PluginStatusVerbose(User user)
 {
     CallWithErrorHandling <object>((lUser, args) =>
     {
         EcoUtil.SendAnnouncementMessage("DiscordLink Status Verbose", MessageBuilder.Shared.GetDisplayString(verbose: true));
     }, user);
 }
Пример #2
0
        public static string SendAnnouncement(string title, string message, string senderName, string recipientUserName)
        {
            if (string.IsNullOrWhiteSpace(title))
            {
                return("Title cannot be empty.");
            }

            if (string.IsNullOrWhiteSpace(message))
            {
                return("Message cannot be empty.");
            }

            User recipient = null;

            if (!string.IsNullOrWhiteSpace(recipientUserName))
            {
                recipient = UserManager.OnlineUsers.FirstOrDefault(x => x.Name.ToLower() == recipientUserName);
                if (recipient == null)
                {
                    return("No online user with the name \"" + recipientUserName + "\" could be found.");
                }
            }

            EcoUtil.SendAnnouncementMessage(title, message + "\n\n[" + senderName + "]", recipient);
            return("Message delivered.");
        }
Пример #3
0
        public static void ListTrackedTrades(User user)
        {
            LinkedUser linkedUser = LinkedUserManager.LinkedUserByEcoUser(user);

            if (linkedUser == null)
            {
                ChatManager.ServerMessageToPlayer(new LocString($"You have not linked your Discord Account to DiscordLink on this Eco Server.\nLog into the game and use the `\\dl-link` command to initialize account linking."), user);
                return;
            }

            EcoUtil.SendAnnouncementMessage("Tracked Trades", DLStorage.WorldData.ListTrackedTrades(ulong.Parse(linkedUser.DiscordId)), user);
        }
Пример #4
0
        public static void Trades(User user, string userOrItemName)
        {
            CallWithErrorHandling <object>((lUser, args) =>
            {
                // Fetch trade data
                string result = SharedCommands.Trades(userOrItemName, out string title, out bool isItem, out StoreOfferList groupedBuyOffers, out StoreOfferList groupedSellOffers);
                if (!string.IsNullOrEmpty(result))
                {
                    // Report commmand error
                    ChatManager.ServerMessageToPlayer(new LocString(result), user);
                    return;
                }

                MessageBuilder.Eco.FormatTrades(isItem, groupedBuyOffers, groupedSellOffers, out string message);
                EcoUtil.SendAnnouncementMessage(title, message, user);
            }, user);
        }
Пример #5
0
        public static string SendServerMessage(string message, string senderName, string recipientUserName, string persistanceType)
        {
            if (string.IsNullOrWhiteSpace(message))
            {
                return("Message cannot be empty.");
            }

            bool   permanent;
            string persistanceTypeLower = persistanceType.ToLower();

            if (persistanceTypeLower == "temporary")
            {
                permanent = true;
            }
            else if (persistanceTypeLower == "permanent")
            {
                permanent = false;
            }
            else
            {
                return("Persistance type must either be \"Temporary\" or \"Permanent\".");
            }

            User recipient = null;

            if (!string.IsNullOrWhiteSpace(recipientUserName))
            {
                recipient = UserManager.OnlineUsers.FirstOrDefault(x => x.Name.ToLower() == recipientUserName);
                if (recipient == null)
                {
                    return("No online user with the name \"" + recipientUserName + "\" could be found.");
                }
            }

            EcoUtil.SendServerMessage("[" + senderName + "] " + message, permanent, recipient);
            return("Message delivered.");
        }