-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'hotfix/722-eddn-commodities' into develop
- Loading branch information
Showing
11 changed files
with
171 additions
and
3,415 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,43 @@ | ||
using System.Collections.Generic; | ||
using EddiDataDefinitions; | ||
using Newtonsoft.Json; | ||
using System.Collections.Generic; | ||
|
||
namespace EDDNResponder | ||
{ | ||
class EDDNCommodity | ||
public class EDDNCommodity | ||
{ | ||
// Schema reference: https://github.com/EDSM-NET/EDDN/blob/master/schemas/commodity-v3.0.json | ||
public string name; | ||
[JsonIgnore] // do not send until #731 is fixed https://github.com/EDCD/EDDI/issues/731 | ||
public int meanPrice; | ||
public int buyPrice; | ||
public int stock; | ||
public dynamic stockBracket; // Possible values are 0, 1, 2, 3, or "" | ||
public int sellPrice; | ||
public int demand; | ||
public dynamic demandBracket; // Possible values are 0, 1, 2, 3, or "" | ||
public List<string> statusFlags; | ||
public List<string> statusFlags = new List<string>(); | ||
|
||
public bool ShouldSerializestatusFlags() | ||
{ | ||
// Don't serialize status flags if they are empty as the schema requires that if present they contain at least 1 element | ||
return (statusFlags != null && statusFlags.Count > 0); | ||
} | ||
|
||
public EDDNCommodity(CommodityMarketQuote quote) | ||
{ | ||
name = quote.definition.edname; | ||
meanPrice = quote.definition.avgprice; | ||
buyPrice = quote.buyprice; | ||
stock = quote.stock; | ||
stockBracket = quote.stockbracket; | ||
sellPrice = quote.sellprice; | ||
demand = quote.demand; | ||
demandBracket = quote.demandbracket; | ||
if (quote.StatusFlags.Count > 0) | ||
{ | ||
statusFlags = quote.StatusFlags; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,16 @@ | ||
namespace EDDNResponder | ||
using EddiDataDefinitions; | ||
|
||
namespace EDDNResponder | ||
{ | ||
class EDDNEconomy | ||
{ | ||
public string name; | ||
public decimal proportion; | ||
public decimal proportion = 0M; | ||
|
||
public EDDNEconomy(CompanionAppEconomy companionAppEconomy) | ||
{ | ||
name = companionAppEconomy.name; | ||
proportion = companionAppEconomy.proportion; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.