Commit 43a9267e authored by Adam Leyshon's avatar Adam Leyshon
Browse files

Merge branch 'aleyshon_compat_fixes' into 'develop'

Completely re-worked order system.

See merge request GWP/Release!3
parents 8e85ed84 42e4eced
<?xml version="1.0"?>
<!-- Generated by NAntBuilder v2.0 -->
<project default="A17">
<property name="ModName" value="GlitterWorldPrime [A17]" />
<property name="ModPath" value="F:\Games\RimWorld1557Win\Mods\Glitterworld Prime A17\" />
<!-- Name: 'ModOutput' Value: 'C:\Users\aleyshon\Desktop\Mod\GlitterWorldPrime [A17] Debug\' -->
<property name="ModOutput" value="C:\Users\aleyshon\Desktop\Mod\GlitterWorldPrime [A17] Debug\" />
<property name="ModBinary" value="${ModPath}\Assemblies\GlitterWorld Prime.dll" />
<property name="MSBuildPath" value="C:\Program Files (x86)\MSBuild\14.0\Bin\Msbuild.exe" />
<property name="SteamModFolder" value="E:\Games\Steam\steamapps\common\RimWorld\Mods" />
<target name="A17">
<echo message="Building default target " />
<!-- Build Debug -->
<exec program="${MSBuildPath}">
<arg value="${ModPath}\Glitterworld Prime.sln" />
<arg value="/t:Clean,Build" />
<arg value="/p:Configuration=Debug" />
</exec>
<!-- Set Git Output File -->
<property name="git.output.file" value="${path::get-temp-path()}\sha1.txt" />
<!-- Get Git SHA -->
<exec program="git.exe" commandline="rev-parse --short HEAD" workingdir="${ModPath}" output="${git.output.file}" />
<!-- Get SHA from File -->
<loadfile file="${git.output.file}" property="git.output" />
<!-- Cleanup Git Output -->
<property name="ModSHA" value="${string::trim(git.output)}" />
<!-- Copy About Folder -->
<copy todir="${ModOutput}\About" overwrite="True">
<fileset basedir="${ModPath}\About" />
</copy>
<!-- Load About.xml -->
<loadfile file="${ModOutput}\About\About.xml" property="ModAbout">
<filterchain>
<replacetokens>
<token key="SHAHASH" value="${ModSHA}" />
</replacetokens>
</filterchain>
</loadfile>
<!-- Save About.xml -->
<echo message="${ModAbout}" file="${ModOutput}\About\About.xml" />
<!-- Get Version Info -->
<property name="ModBinaryVersion" value="${assemblyname::get-version(assemblyname::get-assembly-name(ModBinary))}" />
<!-- Load Version.xml -->
<loadfile file="${ModOutput}\About\Version.xml" property="ModVersion">
<filterchain>
<replacetokens>
<token key="Version" value="${ModBinaryVersion}" />
</replacetokens>
</filterchain>
</loadfile>
<!-- Save Version.xml -->
<echo message="${ModVersion}" file="${ModOutput}\About\Version.xml" />
<!-- Copy Assemblies -->
<copy todir="${ModOutput}\Assemblies" overwrite="True">
<fileset basedir="${ModPath}\Assemblies">
<include name="*.dll" />
</fileset>
</copy>
<!-- Copy Defs -->
<copy todir="${ModOutput}\Defs" overwrite="True">
<fileset basedir="${ModPath}\Defs" />
</copy>
<!-- Copy Textures -->
<copy todir="${ModOutput}\Textures" overwrite="True">
<fileset basedir="${ModPath}\Textures" />
</copy>
<zip zipfile="${ModOutput}\..\..\${ModName} Build ${ModSHA}.zip" if="False">
<fileset prefix="${ModName}" basedir="${ModOutput}">
<include name="**/*" />
</fileset>
</zip>
<delete dir="${SteamModFolder}\${ModName}" />
<!-- Copy Mod to Steam -->
<copy todir="${SteamModFolder}\${ModName}\" overwrite="True">
<fileset basedir="${ModOutput}" />
</copy>
</target>
</project>
<?xml version="1.0"?>
<!-- Generated by NAntBuilder v2.0 -->
<project default="A17">
<property name="ModName" value="GlitterWorldPrime [A17]" />
<property name="ModPath" value="F:\Games\RimWorld1557Win\Mods\Glitterworld Prime A17\" />
<property name="ModOutput" value="C:\Users\aleyshon\Desktop\Mod\GlitterWorldPrime [A17]\" />
<property name="ModBinary" value="${ModPath}\Assemblies\GlitterWorld Prime.dll" />
<property name="MSBuildPath" value="C:\Program Files (x86)\MSBuild\14.0\Bin\Msbuild.exe" />
<property name="SteamModFolder" value="E:\Games\Steam\steamapps\common\RimWorld\Mods" />
<target name="A17">
<echo message="Building default target " />
<!-- Build Release -->
<exec program="${MSBuildPath}">
<arg value="${ModPath}\Glitterworld Prime.sln" />
<arg value="/t:Clean,Build" />
<arg value="/p:Configuration=Release" />
</exec>
<!-- Set Git Output File -->
<property name="git.output.file" value="${path::get-temp-path()}\sha1.txt" />
<!-- Get Git SHA -->
<exec program="git.exe" commandline="rev-parse --short HEAD" workingdir="${ModPath}" output="${git.output.file}" />
<!-- Get SHA from File -->
<loadfile file="${git.output.file}" property="git.output" />
<!-- Cleanup Git Output -->
<property name="ModSHA" value="${string::trim(git.output)}" />
<!-- Copy About Folder -->
<copy todir="${ModOutput}\About" overwrite="True">
<fileset basedir="${ModPath}\About" />
</copy>
<!-- Load About.xml -->
<loadfile file="${ModOutput}\About\About.xml" property="ModAbout">
<filterchain>
<replacetokens>
<token key="SHAHASH" value="${ModSHA}" />
</replacetokens>
</filterchain>
</loadfile>
<!-- Save About.xml -->
<echo message="${ModAbout}" file="${ModOutput}\About\About.xml" />
<!-- Get Version Info -->
<property name="ModBinaryVersion" value="${assemblyname::get-version(assemblyname::get-assembly-name(ModBinary))}" />
<!-- Load Version.xml -->
<loadfile file="${ModOutput}\About\Version.xml" property="ModVersion">
<filterchain>
<replacetokens>
<token key="Version" value="${ModBinaryVersion}" />
</replacetokens>
</filterchain>
</loadfile>
<!-- Save Version.xml -->
<echo message="${ModVersion}" file="${ModOutput}\About\Version.xml" />
<!-- Copy Assemblies -->
<copy todir="${ModOutput}\Assemblies" overwrite="True">
<fileset basedir="${ModPath}\Assemblies">
<include name="*.dll" />
</fileset>
</copy>
<!-- Copy Defs -->
<copy todir="${ModOutput}\Defs" overwrite="True">
<fileset basedir="${ModPath}\Defs" />
</copy>
<!-- Copy Textures -->
<copy todir="${ModOutput}\Textures" overwrite="True">
<fileset basedir="${ModPath}\Textures" />
</copy>
<zip zipfile="${ModOutput}\..\..\${ModName} Build ${ModSHA}.zip">
<fileset prefix="${ModName}" basedir="${ModOutput}">
<include name="**/*" />
</fileset>
</zip>
<delete dir="${SteamModFolder}\${ModName}" />
<!-- Copy Mod to Steam -->
<copy todir="${SteamModFolder}\${ModName}\" overwrite="True">
<fileset basedir="${ModOutput}" />
</copy>
</target>
</project>
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<ModMetaData> <ModMetaData>
<name>GlitterWorld Prime [B18]</name> <name>GlitterWorld Prime [Unstable]</name>
<author>TwistedSoul / TheCodeCache.NET</author> <author>TwistedSoul / TheCodeCache.NET</author>
<targetVersion>0.18.0</targetVersion> <targetVersion>0.19.0</targetVersion>
<url>https://www.thecodecache.net</url> <url>https://www.thecodecache.net</url>
<description> <description>
Build: @SHAHASH@ \n Build: @SHAHASH@ \n
&lt;color=orange&gt;&lt;b&gt;Warning: &lt;/b&gt; \n &lt;color=orange&gt;&lt;b&gt;Warning: &lt;/b&gt; \n
While care has been taken to make sure stuff works, \n Anything you want, delivered anywhere in the universe in under 24 earth hours!
Your items can be lost if the trade with the server fails.&lt;/color&gt;\n
By using this mod you acknowledge this and accept the risk.
</description> </description>
</ModMetaData> </ModMetaData>
1206654786
\ No newline at end of file
...@@ -7,14 +7,14 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Glitterworld Prime", "Glitt ...@@ -7,14 +7,14 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Glitterworld Prime", "Glitt
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug B18|Any CPU = Debug B18|Any CPU Debug|Any CPU = Debug|Any CPU
Release B18|Any CPU = Release B18|Any CPU Release|Any CPU = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{1976D016-8918-48C9-A54E-4D9EF7F200B7}.Debug B18|Any CPU.ActiveCfg = Debug B18|Any CPU {1976D016-8918-48C9-A54E-4D9EF7F200B7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1976D016-8918-48C9-A54E-4D9EF7F200B7}.Debug B18|Any CPU.Build.0 = Debug B18|Any CPU {1976D016-8918-48C9-A54E-4D9EF7F200B7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1976D016-8918-48C9-A54E-4D9EF7F200B7}.Release B18|Any CPU.ActiveCfg = Release B18|Any CPU {1976D016-8918-48C9-A54E-4D9EF7F200B7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1976D016-8918-48C9-A54E-4D9EF7F200B7}.Release B18|Any CPU.Build.0 = Release B18|Any CPU {1976D016-8918-48C9-A54E-4D9EF7F200B7}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// This file was created by TwistedSoul @ TheCodeCache.net // This file was created by TwistedSoul @ TheCodeCache.net
// You are free to inspect the mod but may not modify or redistribute without my express permission. // You are free to inspect the mod but may not modify or redistribute without my express permission.
// However! If you would like to contribute to GWP please feel free to drop me a message. // However! If you would like to contribute to GWP please feel free to drop me a message.
// Glitterworld Prime, Building_TradeWithPrime.cs, Created 2017-11-18 // Glitterworld Prime, Building_TradeWithPrime.cs, Created 2018-07-22
#endregion #endregion
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// This file was created by TwistedSoul @ TheCodeCache.net // This file was created by TwistedSoul @ TheCodeCache.net
// You are free to inspect the mod but may not modify or redistribute without my express permission. // You are free to inspect the mod but may not modify or redistribute without my express permission.
// However! If you would like to contribute to GWP please feel free to drop me a message. // However! If you would like to contribute to GWP please feel free to drop me a message.
// Glitterworld Prime, DialogPrimeCheckSubscription.cs, Created 2018-01-16 // Glitterworld Prime, DialogPrimeCheckSubscription.cs, Created 2018-07-22
#endregion #endregion
...@@ -157,17 +157,34 @@ namespace Glitterworld_Prime ...@@ -157,17 +157,34 @@ namespace Glitterworld_Prime
_isDownloadComplete = DownloadStatus.Failed; _isDownloadComplete = DownloadStatus.Failed;
return; return;
} }
#if DEBUG
// Get Unique Colony ID if one isn't set. LogWriter.WriteMessage($"User type is {Utilities.GetUserType()}");
if (_mapComponent.ColonyId.NullOrEmpty()) LogWriter.WriteMessage($"User ID is {Utilities.GetUserId()}");
if (!GlitterWorldApi.CreateNewColonyId(_player.Map)) #endif
if (Utilities.GetUserType() == "Normal" && Utilities.GetUserId().NullOrEmpty())
{
var result = GlitterWorldApi.CreateUserId();
if (result == null)
{ {
_isDownloadComplete = DownloadStatus.Failed; _isDownloadComplete = DownloadStatus.Failed;
return; return;
} }
Utilities.StoreUserId(result);
}
else
{
#if DEBUG
LogWriter.WriteMessage($"Not creating new ID");
#endif
}
// Update Colony MetaData // Update Colony MetaData
GlitterWorldApi.UploadColonyMetadata(_player.Map); if (!GlitterWorldApi.SendColonyMeta(_player.Map))
{
_isDownloadComplete = DownloadStatus.Failed;
return;
}
// Check if the user has a subscription and how long is left. // Check if the user has a subscription and how long is left.
_subscriptionMeta = GlitterWorldApi.GetSubscriptionData(_player.Map); _subscriptionMeta = GlitterWorldApi.GetSubscriptionData(_player.Map);
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// This file was created by TwistedSoul @ TheCodeCache.net // This file was created by TwistedSoul @ TheCodeCache.net
// You are free to inspect the mod but may not modify or redistribute without my express permission. // You are free to inspect the mod but may not modify or redistribute without my express permission.
// However! If you would like to contribute to GWP please feel free to drop me a message. // However! If you would like to contribute to GWP please feel free to drop me a message.
// Glitterworld Prime, DialogPrimeGetData.cs, Created 2017-11-18 // Glitterworld Prime, DialogPrimeGetData.cs, Created 2018-07-22
#endregion #endregion
......
...@@ -251,15 +251,25 @@ namespace Glitterworld_Prime ...@@ -251,15 +251,25 @@ namespace Glitterworld_Prime
_cachedCurrencyTradeable = (from x in TradeSession.deal.AllTradeables _cachedCurrencyTradeable = (from x in TradeSession.deal.AllTradeables
where x.IsCurrency where x.IsCurrency
select x).FirstOrDefault(); select x).FirstOrDefault();
#if DEBUG
foreach (var tr in TradeSession.deal.AllTradeables)
LogWriter.WriteMessage(
$"Item {tr.AnyThing.GetInnerIfMinified().def} is minified: {tr.AnyThing.def.Minifiable}, " +
$"Belongs in Categories {string.Join(", ", tr.AnyThing.GetInnerIfMinified().def.thingCategories.Select(t => t.ToString()).ToArray())} ");
#endif
_cachedTradeables = (from tr in TradeSession.deal.AllTradeables _cachedTradeables = (from tr in TradeSession.deal.AllTradeables
where !tr.IsCurrency where !tr.IsCurrency
where !tr.Label.NullOrEmpty() && where !tr.Label.NullOrEmpty() &&
tr.Label.ToLowerInvariant().Contains(_textFilter.ToLowerInvariant()) tr.Label.ToLowerInvariant().Contains(_textFilter.ToLowerInvariant())
where _filter.DescendantThingDefs.Contains(tr.FirstThingColony?.GetInnerIfMinified().def) || !_filterOnlyColonyItems && where _filter.DescendantThingDefs.Contains(tr.FirstThingColony?.GetInnerIfMinified().def) ||
!_filterOnlyColonyItems &&
_filter.DescendantThingDefs.Contains(tr.FirstThingTrader?.GetInnerIfMinified().def) _filter.DescendantThingDefs.Contains(tr.FirstThingTrader?.GetInnerIfMinified().def)
orderby tr.ThingDef.defName descending orderby tr.ThingDef.defName descending
select tr).ThenBy(tr => tr, _sorter1.Comparer).ThenBy(tr => tr, _sorter2.Comparer) select tr).ThenBy(tr => tr, _sorter1.Comparer).ThenBy(tr => tr, _sorter2.Comparer)
.ThenBy(tr => TransferableUIUtility.DefaultListOrderPriority(tr)).ThenBy(tr => tr.ThingDef.label) .ThenBy(TransferableUIUtility.DefaultListOrderPriority).ThenBy(tr => tr.ThingDef.label)
.ThenBy( .ThenBy(
delegate(Tradeable tr) delegate(Tradeable tr)
{ {
...@@ -413,4 +423,4 @@ namespace Glitterworld_Prime ...@@ -413,4 +423,4 @@ namespace Glitterworld_Prime
#endregion #endregion
} }
} }
\ No newline at end of file
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// This file was created by TwistedSoul @ TheCodeCache.net // This file was created by TwistedSoul @ TheCodeCache.net
// You are free to inspect the mod but may not modify or redistribute without my express permission. // You are free to inspect the mod but may not modify or redistribute without my express permission.
// However! If you would like to contribute to GWP please feel free to drop me a message. // However! If you would like to contribute to GWP please feel free to drop me a message.
// Glitterworld Prime, DialogPrimeUpdateSubscription.cs, Created 2018-01-17 // Glitterworld Prime, DialogPrimeUpdateSubscription.cs, Created 2018-07-22
#endregion #endregion
......
...@@ -3,13 +3,14 @@ ...@@ -3,13 +3,14 @@
// This file was created by TwistedSoul @ TheCodeCache.net // This file was created by TwistedSoul @ TheCodeCache.net
// You are free to inspect the mod but may not modify or redistribute without my express permission. // You are free to inspect the mod but may not modify or redistribute without my express permission.
// However! If you would like to contribute to GWP please feel free to drop me a message. // However! If you would like to contribute to GWP please feel free to drop me a message.
// Glitterworld Prime, GlitterWorldApi.cs, Created 2017-11-18 // Glitterworld Prime, GlitterWorldApi.cs, Created 2018-07-22
#endregion #endregion
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.Globalization;
using System.IO; using System.IO;
using System.IO.Compression; using System.IO.Compression;
using System.Net; using System.Net;
...@@ -17,7 +18,6 @@ using System.Text; ...@@ -17,7 +18,6 @@ using System.Text;
using Glitterworld_Prime.ApiStructs; using Glitterworld_Prime.ApiStructs;
using RestSharp; using RestSharp;
using Verse; using Verse;
using Steamworks;
namespace Glitterworld_Prime namespace Glitterworld_Prime
{ {
...@@ -25,9 +25,13 @@ namespace Glitterworld_Prime ...@@ -25,9 +25,13 @@ namespace Glitterworld_Prime
{ {
#region Fields #region Fields
private static readonly float ClientVersion = 2.5f; private static readonly float ClientVersion = 3.0f;
private static readonly string BaseUrl = "https://prime.thecodecache.net"; #if LOCALSERVER
private static readonly string BaseUrl = "http://127.0.0.1:5000/v3";
#else
private static readonly string BaseUrl = "https://prime.thecodecache.net/v3";
#endif
#endregion #endregion
...@@ -38,7 +42,7 @@ namespace Glitterworld_Prime ...@@ -38,7 +42,7 @@ namespace Glitterworld_Prime
LogWriter.WriteMessage("Getting API Version"); LogWriter.WriteMessage("Getting API Version");
var client = CreateRestClient(); var client = CreateRestClient();
var request = new RestRequest("/server/version/api", Method.GET); var request = new RestRequest("/application/version", Method.GET);
var response = var response =
ExecuteRequestExpectData<GlitterWorldApiVersionResponse>(client, request); ExecuteRequestExpectData<GlitterWorldApiVersionResponse>(client, request);
...@@ -72,7 +76,7 @@ namespace Glitterworld_Prime ...@@ -72,7 +76,7 @@ namespace Glitterworld_Prime
LogWriter.WriteMessage("Getting Server Status"); LogWriter.WriteMessage("Getting Server Status");
var client = CreateRestClient(); var client = CreateRestClient();
var request = new RestRequest("/server/maintenance/mode", Method.GET); var request = new RestRequest("/application/maintenance/mode", Method.GET);
var response = ExecuteRequestNoDataExpected(client, request); var response = ExecuteRequestNoDataExpected(client, request);
...@@ -100,7 +104,7 @@ namespace Glitterworld_Prime ...@@ -100,7 +104,7 @@ namespace Glitterworld_Prime
{ {
LogWriter.WriteMessage("Getting Server Status Async"); LogWriter.WriteMessage("Getting Server Status Async");
var client = CreateRestClient(); var client = CreateRestClient();
var request = new RestRequest("/server/maintenance/mode", Method.GET); var request = new RestRequest("/application/maintenance/mode", Method.GET);
client.ExecuteAsyncGet(request, callback, "GET"); client.ExecuteAsyncGet(request, callback, "GET");
} }
...@@ -109,7 +113,7 @@ namespace Glitterworld_Prime ...@@ -109,7 +113,7 @@ namespace Glitterworld_Prime
LogWriter.WriteMessage("Getting Maintenance Window"); LogWriter.WriteMessage("Getting Maintenance Window");
var client = CreateRestClient(); var client = CreateRestClient();
var request = new RestRequest("/server/maintenance/window", Method.GET); var request = new RestRequest("/application/maintenance/window", Method.GET);
var response = var response =
ExecuteRequestExpectData<GlitterWorldApiServerMaintenanceWindow>(client, request); ExecuteRequestExpectData<GlitterWorldApiServerMaintenanceWindow>(client, request);
...@@ -119,7 +123,7 @@ namespace Glitterworld_Prime ...@@ -119,7 +123,7 @@ namespace Glitterworld_Prime
if (response.Data.IsSet() && response.Data.IsSoon()) if (response.Data.IsSet() && response.Data.IsSoon())
{ {
var d = new Dialog_MessageBox( var d = new Dialog_MessageBox(
$"The server will be starting maintenance at {response.Data.StartTime().ToString()} and will last {response.Data.DurationInHours()} hour(s).", $"The server will be starting maintenance at {response.Data.StartTime().ToString(CultureInfo.CurrentCulture)} and will last {response.Data.DurationInHours()} hour(s).",
title: "GlitterWorldPrime"); title: "GlitterWorldPrime");
Find.WindowStack.Add(d); Find.WindowStack.Add(d);
} }
...@@ -145,39 +149,14 @@ namespace Glitterworld_Prime ...@@ -145,39 +149,14 @@ namespace Glitterworld_Prime
LogWriter.DumpObjectToLog(response); LogWriter.DumpObjectToLog(response);
} }
public static bool CreateNewColonyId(Map map)
{
LogWriter.WriteMessage("Getting Colony ID");
var client = CreateRestClient();
var request = new RestRequest("/colony/generate_id", Method.GET);
var response =
ExecuteRequestExpectData<GlitterWorldColonyIdResponse>(client, request);
if (response.StatusCode == HttpStatusCode.OK)
{
Utilities.GetMapComponent(map).ColonyId = response.Data.UUID;
LogWriter.WriteMessage("This colony is now known as " +
Utilities.GetMapComponent(map).ColonyId);
return true;
}
LogWriter.WriteErrorMessage("Failed to get Colony identifier, Trades will fail.");
return false;
}
public static void GetServerGoodsAsync(GlitterWorld_MapComponent mapComponent, public static void GetServerGoodsAsync(GlitterWorld_MapComponent mapComponent,
Action<IRestResponse<List<GlitterWorldItem>>, RestRequestAsyncHandle> callback) Action<IRestResponse<List<GlitterWorldItem>>, RestRequestAsyncHandle> callback)
{ {
LogWriter.WriteMessage("Getting Market Data"); LogWriter.WriteMessage("Getting Market Data");
var client = CreateRestClient(); var client = CreateRestClient();
var request = new RestRequest("/market/get_items", Method.POST); var request = new RestRequest("/market/process_item_list_request", Method.POST);
#if B18
// Compress the list of things to request and send it as a file. // Compress the list of things to request and send it as a file.
var jsonString = request.JsonSerializer.Serialize(mapComponent.ThingsToRequestFromMarket); var jsonString = request.JsonSerializer.Serialize(mapComponent.ThingsToRequestFromMarket);
byte[] compressed; byte[] compressed;
...@@ -197,9 +176,7 @@ namespace Glitterworld_Prime ...@@ -197,9 +176,7 @@ namespace Glitterworld_Prime
} }
request.AddFileBytes("things", compressed, "things"); request.AddFileBytes("things", compressed, "things");
#else
request.AddJsonBody(mapComponent.ThingsToRequestFromMarket);
#endif
client.ExecuteAsyncPost(request, client.ExecuteAsyncPost(request,
callback, "POST"); callback, "POST");
...@@ -227,8 +204,8 @@ namespace Glitterworld_Prime ...@@ -227,8 +204,8 @@ namespace Glitterworld_Prime
return response.Data; return response.Data;
} }
public static bool PlaceOrder(string colonyId, int currentTick, List<GlitterWorldItem> thingsSold, public static bool PlaceOrder(string colonyId, int currentTick, List<GlitterWorldOrderItem> thingsSold,
List<GlitterWorldItem> thingsOnOrder) List<GlitterWorldOrderItem> thingsOnOrder)
{ {
LogWriter.WriteMessage("Placing Order"); LogWriter.WriteMessage("Placing Order");
...@@ -288,6 +265,26 @@ namespace Glitterworld_Prime ...@@ -288,6 +265,26 @@ namespace Glitterworld_Prime
return false; return false;
} }
public static RestRequestAsyncHandle UpdateOrderStatusAsync(string colonyId, string orderId, string status,
Action<IRestResponse, RestRequestAsyncHandle> callback)
{
LogWriter.WriteMessage($"Marking order {orderId} as {status}.");
var client = CreateRestClient();
var request = new RestRequest($"/orders/{colonyId}/{orderId}", Method.POST);
var statusBody = new GlitterWorldOrderStatus
{
Status = status
};
request.AddJsonBody(statusBody);
// Make request.
return client.ExecuteAsyncPost(request, callback, "POST");
}
public static GlitterWorldDeliveryMetaData GetDeliveryMetaData(string colonyId, string orderId) public static GlitterWorldDeliveryMetaData GetDeliveryMetaData(string colonyId, string orderId)
{ {
...@@ -338,50 +335,91 @@ namespace Glitterworld_Prime ...@@ -338,50 +335,91 @@ namespace Glitterworld_Prime
return true; return true;
} }