protected void btnAction_Click(object sender, EventArgs e)
        {
            ReferralManager refManager = new ReferralManager();

            if (InstanceManager.Game.Users.UserExists(txtUsername.Text))
            {
                UserInfo user = InstanceManager.Game.Users.GetUser(txtUsername.Text);

                if (InstanceManager.Game.Users.UserExists(txtReferred.Text))
                {
                    UserInfo referred = InstanceManager.Game.Users.GetUser(txtReferred.Text);

                    if (referred.LastIP != user.LastIP)
                    {
                        if (referred.sEmail != user.sEmail)
                        {
                            if (!refManager.HasBeenReferred(referred.userId))
                            {
                                user.iCredits     += int.Parse(UserSettings.ReferralReward);
                                referred.iCredits += int.Parse(UserSettings.ReferredReward);
                                InstanceManager.Game.Users.UpdateUser(user);
                                InstanceManager.Game.Users.UpdateUser(referred);
                                refManager.AddReferral(user.userId, referred.userId);
                                InstanceManager.Game.Moderation.LogCommand(mUser.userId, user.userId, "referral", "Referrer: " + txtUsername.Text + "; Referred: " + txtReferred.Text, "Housekeeping");
                                ServerCommunicator servComm = new ServerCommunicator();
                                servComm.SendModCommandToServer("updatecredits", mUser.userId, user.userId, "None");
                                servComm.SendModCommandToServer("updatecredits", mUser.userId, referred.userId, "None");
                                lblInfo.Text = "Reward Granted.";
                            }
                            else
                            {
                                lblInfo.Text = "Whoops. User has been referred before!";
                            }
                        }
                        else
                        {
                            lblInfo.Text = "Whoops. Email Addresses match!";
                        }
                    }
                    else
                    {
                        lblInfo.Text = "Whoops. IP Addresses match!";
                    }
                }
                else
                {
                    lblInfo.Text = "Referred user does not exist!";
                }
            }
            else
            {
                lblInfo.Text = "Invalid user!";
            }
        }
예제 #2
0
        protected void btnAction_Click(object sender, EventArgs e)
        {
            ReferralManager refManager = new ReferralManager();
            if (InstanceManager.Game.Users.UserExists(txtUsername.Text))
            {
                UserInfo user = InstanceManager.Game.Users.GetUser(txtUsername.Text);

                if (InstanceManager.Game.Users.UserExists(txtReferred.Text))
                {
                    UserInfo referred = InstanceManager.Game.Users.GetUser(txtReferred.Text);

                    if (referred.LastIP != user.LastIP)
                    {
                        if (referred.sEmail != user.sEmail)
                        {
                            if (!refManager.HasBeenReferred(referred.userId))
                            {
                                user.iCredits += int.Parse(UserSettings.ReferralReward);
                                referred.iCredits += int.Parse(UserSettings.ReferredReward);
                                InstanceManager.Game.Users.UpdateUser(user);
                                InstanceManager.Game.Users.UpdateUser(referred);
                                refManager.AddReferral(user.userId, referred.userId);
                                InstanceManager.Game.Moderation.LogCommand(mUser.userId, user.userId, "referral", "Referrer: " + txtUsername.Text + "; Referred: " + txtReferred.Text, "Housekeeping");
                                ServerCommunicator servComm = new ServerCommunicator();
                                servComm.SendModCommandToServer("updatecredits", mUser.userId, user.userId, "None");
                                servComm.SendModCommandToServer("updatecredits", mUser.userId, referred.userId, "None");
                                lblInfo.Text = "Reward Granted.";
                            }
                            else
                            {
                                lblInfo.Text = "Whoops. User has been referred before!";
                            }
                        }
                        else
                        {
                            lblInfo.Text = "Whoops. Email Addresses match!";
                        }
                    }
                    else
                    {
                        lblInfo.Text = "Whoops. IP Addresses match!";
                    }
                }
                else
                {
                    lblInfo.Text = "Referred user does not exist!";
                }
            }
            else
            {
                lblInfo.Text = "Invalid user!";
            }
        }