It's amazing what talking to Rylan can do to an integer datatype.

This commit is contained in:
Michael 2017-05-29 20:08:30 -04:00
parent ff47625d25
commit 37ac4c684c
20 changed files with 50 additions and 50 deletions

View file

@ -10,7 +10,7 @@ namespace ShiftOS.Objects
{
public string Name { get; set; }
public string Description { get; set; }
public int CostPerMonth { get; set; }
public uint CostPerMonth { get; set; }
public int DownloadSpeed { get; set; }
public string Company { get; set; }
}

View file

@ -41,9 +41,9 @@ namespace ShiftOS.Objects
[Obsolete("This save variable is no longer used in Beta 2.4 and above of ShiftOS. Please use ShiftOS.Engine.SaveSystem.CurrentUser.Username to access the current user's username.")]
public string Username { get; set; }
private long _cp = 0;
private ulong _cp = 0;
public long Codepoints
public ulong Codepoints
{
get
{

View file

@ -42,7 +42,7 @@ namespace ShiftOS.Objects
{
public string Name { get; set; }
public string Description { get; set; }
public int Cost { get; set; }
public ulong Cost { get; set; }
public int FileType { get; set; }
public byte[] MUDFile { get; set; }
}

View file

@ -83,9 +83,9 @@ namespace ShiftOS.Unite
/// Get the Pong codepoint highscore for the current user.
/// </summary>
/// <returns>The amount of Codepoints returned by the server</returns>
public int GetPongCP()
public ulong GetPongCP()
{
return Convert.ToInt32(MakeCall("/API/GetPongCP"));
return Convert.ToUInt64(MakeCall("/API/GetPongCP"));
}
/// <summary>
@ -110,7 +110,7 @@ namespace ShiftOS.Unite
/// Set the pong Codepoints record for the user
/// </summary>
/// <param name="value">The amount of Codepoints to set the record to</param>
public void SetPongCP(int value)
public void SetPongCP(ulong value)
{
MakeCall("/API/SetPongCP/" + value.ToString());
}
@ -182,16 +182,16 @@ namespace ShiftOS.Unite
/// Get the user's codepoints.
/// </summary>
/// <returns>The amount of codepoints stored on the server for this user.</returns>
public long GetCodepoints()
public ulong GetCodepoints()
{
return Convert.ToInt64(MakeCall("/API/GetCodepoints"));
return Convert.ToUInt64(MakeCall("/API/GetCodepoints"));
}
/// <summary>
/// Set the user's codepoints.
/// </summary>
/// <param name="value">The amount of codepoints to set the user's codepoints value to.</param>
public void SetCodepoints(long value)
public void SetCodepoints(ulong value)
{
MakeCall("/API/SetCodepoints/" + value.ToString());
}

View file

@ -58,10 +58,10 @@ namespace ShiftOS.WinForms.Applications
double incrementy = 0.2;
int levelxspeed = 3;
int levelyspeed = 3;
int beatairewardtotal;
int beataireward = 1;
int[] levelrewards = new int[50];
int totalreward;
ulong beatairewardtotal;
ulong beataireward = 1;
ulong[] levelrewards = new ulong[50];
ulong totalreward;
int countdown = 3;
bool aiShouldIsbeEnabled = true;
@ -297,11 +297,11 @@ namespace ShiftOS.WinForms.Applications
lblmissedout.Text = Localization.Parse("{YOU_MISSED_OUT_ON}:") + Environment.NewLine + lblstatscodepoints.Text.Replace(Localization.Parse("{CODEPOINTS}: "), "") + Localization.Parse(" {CODEPOINTS}");
if (ShiftoriumFrontend.UpgradeInstalled("pong_upgrade_2"))
{
totalreward = levelrewards[level - 1] + beatairewardtotal;
totalreward = (ulong)(levelrewards[level - 1] + beatairewardtotal);
double onePercent = (totalreward / 100);
lblbutyougained.Show();
lblbutyougained.Text = Localization.Parse("{BUT_YOU_GAINED}:") + Environment.NewLine + onePercent.ToString("") + (Localization.Parse(" {CODEPOINTS}"));
SaveSystem.TransferCodepointsFrom("pong", (totalreward / 100));
SaveSystem.TransferCodepointsFrom("pong", (ulong)(totalreward / 100));
}
else
{
@ -715,10 +715,10 @@ namespace ShiftOS.WinForms.Applications
{
if (ShiftoriumFrontend.UpgradeInstalled("pong_upgrade"))
{
beataireward = level * 10;
beataireward = (ulong)(level * 10);
} else
{
beataireward = level * 5;
beataireward = (ulong)(level * 5);
}
}
else
@ -726,11 +726,11 @@ namespace ShiftOS.WinForms.Applications
if (ShiftoriumFrontend.UpgradeInstalled("pong_upgrade"))
{
double br = levelrewards[level - 1] / 10;
beataireward = (int)Math.Round(br) * 10;
beataireward = (ulong)Math.Round(br) * 10;
} else
{
double br = levelrewards[level - 1] / 10;
beataireward = (int)Math.Round(br) * 5;
beataireward = (ulong)Math.Round(br) * 5;
}
}

View file

@ -217,7 +217,7 @@ namespace ShiftOS.WinForms.Applications
if (!lblword.Text.Contains("_"))
{
int oldlives = lives;
int cp = (word.Length * oldlives) * 2; //drunky michael made this 5x...
ulong cp = (ulong)(word.Length * oldlives) * 2; //drunky michael made this 5x...
SaveSystem.TransferCodepointsFrom("shiftletters", cp);
StartGame();
}

View file

@ -88,7 +88,7 @@ namespace ShiftOS.WinForms.Applications
}
else
{
if (SaveSystem.CurrentSave.Codepoints - (codePoints * difficulty) <= 0)
if (SaveSystem.CurrentSave.Codepoints - (ulong)(codePoints * difficulty) <= 0)
{
Infobox.Show("Not enough Codepoints", "You do not have enough Codepoints to gamble this amount!");
}
@ -102,7 +102,7 @@ namespace ShiftOS.WinForms.Applications
int winningNumber = rnd.Next(0, difficulty);
// Multiply CodePoints * Difficulty
int jackpot = codePoints * difficulty;
ulong jackpot = (ulong)(codePoints * difficulty);
// Test the random ints
if (guessedNumber == winningNumber)

View file

@ -300,12 +300,12 @@ namespace ShiftOS.WinForms.Applications {
}
public void winGame() {
int cp = 0;
int origminecount = gameBombCount * 10;
ulong cp = 0;
ulong origminecount = (ulong)(gameBombCount * 10);
if (minetimer < 31) cp = (origminecount * 3);
else if (minetimer < 61) cp = (Int32)(origminecount * 2.5);
else if (minetimer < 61) cp = (ulong)(origminecount * 2.5);
else if (minetimer < 91) cp = (origminecount * 2);
else if (minetimer < 121) cp = (Int32)(origminecount * 1.5);
else if (minetimer < 121) cp = (ulong)(origminecount * 1.5);
else if (minetimer > 120) cp = (origminecount * 1);
SaveSystem.TransferCodepointsFrom("shiftsweeper", cp);
panelGameStatus.Image = Properties.Resources.SweeperWinFace;

View file

@ -391,7 +391,7 @@ namespace ShiftOS.WinForms.Applications
}
public int CodepointValue = 0;
public uint CodepointValue = 0;
public List<ShifterSetting> settings = new List<ShifterSetting>();
public Skin LoadedSkin = null;

View file

@ -213,9 +213,9 @@ namespace ShiftOS.WinForms.Applications
private void btnbuy_Click(object sender, EventArgs e)
{
long cpCost = 0;
ulong cpCost = 0;
backend.Silent = true;
Dictionary<string, long> UpgradesToBuy = new Dictionary<string, long>();
Dictionary<string, ulong> UpgradesToBuy = new Dictionary<string, ulong>();
foreach (var itm in lbupgrades.SelectedItems)
{
cpCost += upgrades[itm.ToString()].Cost;

View file

@ -73,7 +73,7 @@ namespace ShiftOS.WinForms.Applications
Infobox.Show("No file chosen.", "Please select a file to sell.");
return;
}
Item.Cost = Convert.ToInt32(txtcost.Text);
Item.Cost = Convert.ToUInt64(txtcost.Text);
Item.Description = txtdescription.Text;
Item.Name = txtitemname.Text;
Callback?.Invoke(Item);
@ -101,7 +101,7 @@ namespace ShiftOS.WinForms.Applications
{
try
{
Item.Cost = Convert.ToInt32(txtcost.Text);
Item.Cost = Convert.ToUInt64(txtcost.Text);
}
catch
{

View file

@ -504,7 +504,7 @@ namespace ShiftOS.WinForms
string usr = args["user"].ToString();
string sys = args["sys"].ToString();
string pass = args["pass"].ToString();
long amount = (long)args["amount"];
ulong amount = (ulong)args["amount"];
if(amount < 0)
{
Console.WriteLine("--invalid codepoint amount - halting...");

View file

@ -35,12 +35,12 @@ namespace ShiftOS.WinForms
{
public class AcquireCodepointsJobTask : JobTask
{
public AcquireCodepointsJobTask(int amount)
public AcquireCodepointsJobTask(uint amount)
{
CodepointsRequired = SaveSystem.CurrentSave.Codepoints + amount;
}
public long CodepointsRequired { get; private set; }
public ulong CodepointsRequired { get; private set; }
public override bool IsComplete
{

View file

@ -372,7 +372,7 @@ namespace ShiftOS.WinForms
/// </summary>
public class AppscapeEntryAttribute : RequiresUpgradeAttribute
{
public AppscapeEntryAttribute(string name, string description, int downloadSize, long cost, string dependencies = "", string category = "Misc") : base(name.ToLower().Replace(' ', '_'))
public AppscapeEntryAttribute(string name, string description, int downloadSize, ulong cost, string dependencies = "", string category = "Misc") : base(name.ToLower().Replace(' ', '_'))
{
Name = name;
Description = description;
@ -385,7 +385,7 @@ namespace ShiftOS.WinForms
public string Name { get; private set; }
public string Description { get; private set; }
public string Category { get; private set; }
public long Cost { get; private set; }
public ulong Cost { get; private set; }
public string DependencyString { get; private set; }
public int DownloadSize { get; private set; }
}

View file

@ -192,7 +192,7 @@ namespace ShiftOS.WinForms
SetupDesktop();
};
long lastcp = 0;
ulong lastcp = 0;
var storythread = new Thread(() =>
{

View file

@ -311,7 +311,7 @@ namespace ShiftOS.Engine
if (args.ContainsKey("amount"))
try
{
long codepointsToAdd = Convert.ToInt64(args["amount"].ToString());
ulong codepointsToAdd = Convert.ToUInt64(args["amount"].ToString());
SaveSystem.CurrentSave.Codepoints += codepointsToAdd;
return true;
}
@ -639,7 +639,7 @@ shiftorium.buy{{upgrade:""{upg.ID}""}}");
cat = args["cat"].ToString();
}
Dictionary<string, long> upgrades = new Dictionary<string, long>();
Dictionary<string, ulong> upgrades = new Dictionary<string, ulong>();
int maxLength = 5;
IEnumerable<ShiftoriumUpgrade> upglist = Shiftorium.GetAvailable();

View file

@ -480,7 +480,7 @@ namespace ShiftOS.Engine
/// Deducts a set amount of Codepoints from the save file... and sends them to a place where they'll never be seen again.
/// </summary>
/// <param name="amount">The amount of Codepoints to deduct.</param>
public static void TransferCodepointsToVoid(long amount)
public static void TransferCodepointsToVoid(ulong amount)
{
if (amount < 0)
throw new ArgumentOutOfRangeException("We see what you did there. Trying to pull Codepoints from the void? That won't work.");
@ -584,7 +584,7 @@ namespace ShiftOS.Engine
/// </summary>
/// <param name="who">The character name</param>
/// <param name="amount">The amount of Codepoints.</param>
public static void TransferCodepointsFrom(string who, long amount)
public static void TransferCodepointsFrom(string who, ulong amount)
{
if (amount < 0)
throw new ArgumentOutOfRangeException("We see what you did there... You can't just give a fake character Codepoints like that. It's better if you transfer them to the void.");

View file

@ -444,7 +444,7 @@ end");
/// Retrieves the user's Codepoints from the save file.
/// </summary>
/// <returns>The user's Codepoints.</returns>
public long getCodepoints() { return SaveSystem.CurrentSave.Codepoints; }
public ulong getCodepoints() { return SaveSystem.CurrentSave.Codepoints; }
/// <summary>
/// Run a command in the Terminal.
@ -462,7 +462,7 @@ end");
/// Adds the specified amount of Codepoints to the save flie.
/// </summary>
/// <param name="cp">The codepoints to add.</param>
public void addCodepoints(int cp)
public void addCodepoints(uint cp)
{
if (cp > 100 || cp <= 0)
{

View file

@ -246,7 +246,7 @@ Ping: {ServerManager.DigitalSocietyPing} ms
var args = JsonConvert.DeserializeObject<Dictionary<string, object>>(msg.Contents);
if(args["username"] as string == SaveSystem.CurrentUser.Username)
{
SaveSystem.CurrentSave.Codepoints += (long)args["amount"];
SaveSystem.CurrentSave.Codepoints += (ulong)args["amount"];
Desktop.InvokeOnWorkerThread(new Action(() =>
{
Infobox.Show($"MUD Control Centre", $"Someone bought an item in your shop, and they have paid {args["amount"]}, and as such, you have been granted these Codepoints.");

View file

@ -112,7 +112,7 @@ namespace ShiftOS.Engine
/// <param name="id">The upgrade ID to buy</param>
/// <param name="cost">The amount of Codepoints to deduct</param>
/// <returns>True if the upgrade was installed successfully, false if the user didn't have enough Codepoints or the upgrade wasn' found.</returns>
public static bool Buy(string id, long cost)
public static bool Buy(string id, ulong cost)
{
if (SaveSystem.CurrentSave.Codepoints >= cost)
{
@ -365,7 +365,7 @@ namespace ShiftOS.Engine
/// </summary>
/// <param name="id">The upgrade ID to search</param>
/// <returns>The codepoint value.</returns>
public static long GetCPValue(string id)
public static ulong GetCPValue(string id)
{
foreach (var upg in GetDefaults())
{
@ -520,7 +520,7 @@ namespace ShiftOS.Engine
{
public string Name { get; set; }
public string Description { get; set; }
public long Cost { get; set; }
public ulong Cost { get; set; }
public string ID { get { return (this.Id != null ? this.Id : (Name.ToLower().Replace(" ", "_"))); } }
public string Id { get; set; }
public string Category { get; set; }
@ -536,7 +536,7 @@ namespace ShiftOS.Engine
public class ShiftoriumUpgradeAttribute : RequiresUpgradeAttribute
{
public ShiftoriumUpgradeAttribute(string name, long cost, string desc, string dependencies, string category) : base(name.ToLower().Replace(" ", "_"))
public ShiftoriumUpgradeAttribute(string name, ulong cost, string desc, string dependencies, string category) : base(name.ToLower().Replace(" ", "_"))
{
Name = name;
Description = desc;
@ -547,7 +547,7 @@ namespace ShiftOS.Engine
public string Name { get; private set; }
public string Description { get; private set; }
public long Cost { get; private set; }
public ulong Cost { get; private set; }
public string Dependencies { get; private set; }
public string Category { get; private set; }
}