using System;
using System.Collections.Generic;
using System.Text;

namespace LFS_External_Client
{
    class cmdManager
    {
        public static void userWon(int amount, string reason, clsConnection C)
        {
            C.money += amount;
            if (amount > 0)
            {
                Form1.InSim.Send_MST_Message("/msg ^3» ^7" + C.PlayerName + " ^L^7won ^2" + globalVars.moneySign + amount + "^7.");
                if (reason != null && reason != "null" && reason != "none" && reason != "" && reason != string.Empty)
                {
                    Form1.InSim.Send_MST_Message("/msg ^3» ^7Reason: " + reason);
                }
            }
            else if (amount < 0)
            {
                Form1.InSim.Send_MST_Message("/msg ^3» ^7" + C.PlayerName + " ^L^7lost ^1" + globalVars.moneySign + amount + "^L^7.");
                if (reason != null && reason != "null" && reason != "none" && reason != "" && reason != string.Empty)
                {
                    Form1.InSim.Send_MST_Message("/msg ^3» ^7Reason: " + reason);
                }
            }
            else if (amount == 0)
            {
                throw new Exception("Amount can not be equal to zero.");
            }
        }
        public static void userWon(int amount, string reason, clsPlayer P)
        {
            clsConnection C = misc.convertToConnection(P);
            C.money += amount;
            if (amount > 0)
            {
                Form1.InSim.Send_MST_Message("/msg ^3» ^7" + C.PlayerName + " ^L^7won ^2" + globalVars.moneySign + amount + "^7.");
                if (reason != null && reason != "null" && reason != "none" && reason != "" && reason != string.Empty)
                {
                    Form1.InSim.Send_MST_Message("/msg ^3» ^7Reason: " + reason);
                }
            }
            else if (amount < 0)
            {
                Form1.InSim.Send_MST_Message("/msg ^3» ^7" + C.PlayerName + " ^L^7lost ^1" + globalVars.moneySign + amount + "^L^7.");
                if (reason != null && reason != "null" && reason != "none" && reason != "" && reason != string.Empty)
                {
                    Form1.InSim.Send_MST_Message("/msg ^3» ^7Reason: " + reason);
                }
            }
            else if (amount == 0)
            {
                throw new Exception("cmdManager.userWon - Amount can not be equal to zero.");
            }
        }
    }
}
