Ejemplo n.º 1
0
        static void SetupPaypalInterface()
        {
            PayPalInterface        = new PayPalInterface();
            PayPalInterface.Error +=
                (e) => {
                Server.GhostSay(new Say()
                {
                    IsEmote = true,
                    Target  = "zkdev",
                    User    = GlobalConst.NightwatchName,
                    Text    = "PAYMENT ERROR: " + e.ToString()
                });
            };

            PayPalInterface.NewContribution += (c) => {
                var message = string.Format("WOOHOO! {0:d} New contribution of {1:F2}€ - for the jar {2}", c.Time, c.Euros,
                                            c.ContributionJar.Name);

                Server.GhostSay(new Say()
                {
                    IsEmote = true, Target = "zk", User = GlobalConst.NightwatchName, Text = message
                });

                if (c.AccountByAccountID != null)
                {
                    Server.GhostSay(new Say()
                    {
                        IsEmote = true,
                        Target  = "zk",
                        User    = GlobalConst.NightwatchName,
                        Text    = string.Format("It is {0} {2}/Users/Detail/{1}", c.AccountByAccountID.Name, c.AccountID, GlobalConst.BaseSiteUrl)
                    });
                }
            };
        }
        public ActionResult ResendEmail(int contributionID)
        {
            var db      = new ZkDataContext();
            var contrib = db.Contributions.First(x => x.ContributionID == contributionID);

            PayPalInterface.SendEmail(contrib);
            return(Content(string.Format("Email with code has been sent to {0}", contrib.Email)));
        }
Ejemplo n.º 3
0
        public void CheckConversion()
        {
            //var teststr=  JsonSerializer.SerializeToString(new ProtocolExtension.JugglerConfig() { Active = true });
            //var acc = Account.AccountByName(new ZkDataContext(), "Clogger");
            //Console.WriteLine(AuthTools.GetSiteAuthToken(acc.Name, acc.Password, DateTime.Now.AddDays(-1)));

            Console.WriteLine("100 CZK in EUR = " + PayPalInterface.ConvertToEuros("CZK", 100));
        }
Ejemplo n.º 4
0
        public bool Start()
        {
            tas.Connected     += tas_Connected;
            tas.LoginDenied   += tas_LoginDenied;
            tas.LoginAccepted += tas_LoginAccepted;

            using (var db = new ZkDataContext()) {
                var acc = db.Accounts.FirstOrDefault(x => x.Name == GlobalConst.NightwatchName);
                if (acc != null)
                {
                    acc.SetPasswordPlain(config.AccountPassword);
                    acc.IsBot        = true;
                    acc.IsZeroKAdmin = true;
                    db.SaveChanges();
                }
            }

            Auth            = new AuthService(tas);
            adminCommands   = new AdminCommands(tas);
            offlineMessages = new OfflineMessages(tas);
            playerMover     = new PlayerMover(tas);
            SteamHandler    = new NwSteamHandler(tas, new Secrets().GetSteamWebApiKey());
            chatRelay       = new ChatRelay(tas, new Secrets().GetNightwatchPassword(), new List <string>()
            {
                "zkdev", "sy", "moddev"
            });

            PayPalInterface        = new PayPalInterface();
            PayPalInterface.Error += (e) =>
            { tas.Say(SayPlace.Channel, "zkdev", "PAYMENT ERROR: " + e.ToString(), true); };

            PayPalInterface.NewContribution += (c) =>
            {
                tas.Say(SayPlace.Channel,
                        "zkdev",
                        string.Format("WOOHOO! {0:d} New contribution of {1:F2}€ by {2} - for the jar {3}", c.Time, c.Euros, c.Name.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).FirstOrDefault(), c.ContributionJar.Name),
                        true);
                if (c.AccountByAccountID == null)
                {
                    tas.Say(SayPlace.Channel,
                            "zkdev",
                            string.Format("Warning, user account unknown yet, payment remains unassigned. If you know user name, please assign it manually {0}/Contributions", GlobalConst.BaseSiteUrl),
                            true);
                }
                else
                {
                    tas.Say(SayPlace.Channel,
                            "zkdev",
                            string.Format("It is {0} {2}/Users/Detail/{1}", c.AccountByAccountID.Name, c.AccountID, GlobalConst.BaseSiteUrl),
                            true);
                }
            };


            tas.Connect(config.ServerHost, config.ServerPort);

            return(true);
        }
Ejemplo n.º 5
0
        public bool Start()
        {
            if (config.AttemptToRecconnect)
            {
                recon           = new Timer(config.AttemptReconnectInterval * 1000);
                recon.AutoReset = true;
                recon.Elapsed  += recon_Elapsed;
            }

            recon.Enabled = false;


            tas.ConnectionLost += tas_ConnectionLost;
            tas.Connected      += tas_Connected;
            tas.LoginDenied    += tas_LoginDenied;
            tas.LoginAccepted  += tas_LoginAccepted;

            Auth            = new AuthService(tas);
            adminCommands   = new AdminCommands(tas);
            offlineMessages = new OfflineMessages(tas);
            playerMover     = new PlayerMover(tas);
            MumbleMover     = new MumbleMover(tas);

            PayPalInterface        = new PayPalInterface();
            PayPalInterface.Error += (e) =>
            { tas.Say(TasClient.SayPlace.Channel, "zkdev", "PAYMENT ERROR: " + e.ToString(), true); };

            PayPalInterface.NewContribution += (c) =>
            {
                tas.Say(TasClient.SayPlace.Channel,
                        "zkdev",
                        string.Format("WOOHOO! {0:d} New contribution of {1:F2}€ by {2} - for the jar {3}", c.Time, c.Euros, c.Name.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).FirstOrDefault(), c.ContributionJar.Name),
                        true);
                if (c.AccountByAccountID == null)
                {
                    tas.Say(TasClient.SayPlace.Channel,
                            "zkdev",
                            "Warning, user account unknown yet, payment remains unassigned. If you know user name, please assign it manually http://zero-k.info/Contributions",
                            true);
                }
                else
                {
                    tas.Say(TasClient.SayPlace.Channel,
                            "zkdev",
                            string.Format("It is {0} http://zero-k.info/Users/Detail/{1}", c.AccountByAccountID.Name, c.AccountID),
                            true);
                }
            };


            try
            {
                tas.Connect(config.ServerHost, config.ServerPort);
            }
            catch
            {
                recon.Start();
            }


            return(true);
        }