Ejemplo n.º 1
0
 public void HeraldMessage(int message, string args)
 {
     if (Herald != null)
     {
         Herald.Say(message, args);
     }
 }
Ejemplo n.º 2
0
 public void HeraldMessage(string message)
 {
     if (Herald != null)
     {
         Herald.Say(message);
     }
 }
Ejemplo n.º 3
0
        private async Task <IActionResult> DoHeartbeat(HeartbeatArgs args)
        {
            var heart = args.Heart ?? "General";

            var t = await Db.GetTopic(args.Topic);

            if (t == null)
            {
                return(new NotFoundResult());
            }
            else if (!t.WriteToken.Equals(args.WriteToken, StringComparison.Ordinal))
            {
                return(StatusCode(403));
            }

            if (Timeouts.IsTimedOut(t.TopicId))
            {
                return(StatusCode(StatusCodes.Status429TooManyRequests));
            }

            var affected = await Db.ReportHeartbeat(t.TopicId, heart, args.ExpiryTimeout);

            if (affected == 1)
            {
                await Herald.HeartbeatSent(t, heart);
            }

            Timeouts.ApplyCost(t.TopicId, Config.HeartbeatCost);

            return(new OkResult());
        }
Ejemplo n.º 4
0
 public void HeraldMessage(Mobile to, int message)
 {
     if (Herald != null)
     {
         Herald.SayTo(to, message);
     }
     else
     {
         to.SendLocalizedMessage(message);
     }
 }
Ejemplo n.º 5
0
            public override void OnClick()
            {
                if (Player.Prompt != null)
                {
                    Player.SendLocalizedMessage(1079166); // You already have a text entry request pending.
                }
                else
                {
                    Player.SendLocalizedMessage(1155865); // Enter amount to deposit:
                    Player.BeginPrompt(
                        (from, text) =>
                    {
                        int amount = Utility.ToInt32(text);

                        if (amount > 0)
                        {
                            if (Banker.Withdraw(from, amount, true))
                            {
                                CityLoyaltySystem.GetCityInstance(Herald.City).AddToTreasury(from, amount, true);

                                Herald.SayTo(from, 1152926);     // The City thanks you for your generosity!
                            }
                            else
                            {
                                from.SendLocalizedMessage(1155867);     // The amount entered is invalid. Verify that there are sufficient funds to complete this transaction.
                            }
                        }
                        else
                        {
                            from.SendLocalizedMessage(1155867);     // The amount entered is invalid. Verify that there are sufficient funds to complete this transaction.
                        }
                    },
                        (from, text) =>
                    {
                        from.SendLocalizedMessage(1155867);     // The amount entered is invalid. Verify that there are sufficient funds to complete this transaction.
                    });
                }
            }
Ejemplo n.º 6
0
        private async Task <IActionResult> DoReport(ReportArgs args)
        {
            var t = await Db.GetTopic(args.Topic);

            if (t == null)
            {
                return(new NotFoundResult());
            }
            else if (!t.WriteToken.Equals(args.WriteToken, StringComparison.OrdinalIgnoreCase))
            {
                return(StatusCode(403));
            }

            if (Timeouts.IsTimedOut(t.TopicId))
            {
                return(StatusCode(StatusCodes.Status429TooManyRequests));
            }

            await Herald.PublishMessage(t, args.Message);

            Timeouts.ApplyCost(t.TopicId, Config.ReportCost);

            return(new OkResult());
        }