Skip to content

Commit 1ed60b6

Browse files
committed
Merge branch 'add-dodec-station-model' into develop
2 parents 120c69b + 9769a77 commit 1ed60b6

7 files changed

Lines changed: 73 additions & 38 deletions

File tree

DataDefinitions/CommunityGoal.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public class CommunityGoal
3131
[JsonProperty("CurrentTotal")]
3232
public long total { get; set; }
3333

34-
[JsonProperty("PlayerContribution")]
34+
[JsonProperty("PlayerContribution")] // Player's total contribution to date
3535
public long contribution { get; set; }
3636

3737
[JsonProperty("NumContributors")]

DataDefinitions/Mission.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,8 @@ private static string FallbackGetDestinationStation ( string localisedName )
344344

345345
public int communalTier { get; set; }
346346

347+
public long communalContribution { get; set; }
348+
347349
#endregion
348350

349351
#region Passenger Data

DataDefinitions/Properties/StationModels.de.resx

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -59,46 +59,46 @@
5959
: using a System.ComponentModel.TypeConverter
6060
: and then encoded with base64 encoding.
6161
-->
62-
<xsd:schema xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" id="root">
63-
<xsd:import namespace="http://www.w3.org/XML/1998/namespace"/>
62+
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
63+
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
6464
<xsd:element name="root" msdata:IsDataSet="true">
6565
<xsd:complexType>
6666
<xsd:choice maxOccurs="unbounded">
6767
<xsd:element name="metadata">
6868
<xsd:complexType>
6969
<xsd:sequence>
70-
<xsd:element name="value" type="xsd:string" minOccurs="0"/>
70+
<xsd:element name="value" type="xsd:string" minOccurs="0" />
7171
</xsd:sequence>
72-
<xsd:attribute name="name" use="required" type="xsd:string"/>
73-
<xsd:attribute name="type" type="xsd:string"/>
74-
<xsd:attribute name="mimetype" type="xsd:string"/>
75-
<xsd:attribute ref="xml:space"/>
72+
<xsd:attribute name="name" use="required" type="xsd:string" />
73+
<xsd:attribute name="type" type="xsd:string" />
74+
<xsd:attribute name="mimetype" type="xsd:string" />
75+
<xsd:attribute ref="xml:space" />
7676
</xsd:complexType>
7777
</xsd:element>
7878
<xsd:element name="assembly">
7979
<xsd:complexType>
80-
<xsd:attribute name="alias" type="xsd:string"/>
81-
<xsd:attribute name="name" type="xsd:string"/>
80+
<xsd:attribute name="alias" type="xsd:string" />
81+
<xsd:attribute name="name" type="xsd:string" />
8282
</xsd:complexType>
8383
</xsd:element>
8484
<xsd:element name="data">
8585
<xsd:complexType>
8686
<xsd:sequence>
87-
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1"/>
88-
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2"/>
87+
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
88+
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
8989
</xsd:sequence>
90-
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1"/>
91-
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3"/>
92-
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4"/>
93-
<xsd:attribute ref="xml:space"/>
90+
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
91+
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
92+
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
93+
<xsd:attribute ref="xml:space" />
9494
</xsd:complexType>
9595
</xsd:element>
9696
<xsd:element name="resheader">
9797
<xsd:complexType>
9898
<xsd:sequence>
99-
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1"/>
99+
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
100100
</xsd:sequence>
101-
<xsd:attribute name="name" type="xsd:string" use="required"/>
101+
<xsd:attribute name="name" type="xsd:string" use="required" />
102102
</xsd:complexType>
103103
</xsd:element>
104104
</xsd:choice>
@@ -189,4 +189,7 @@
189189
<value>Squadron Carrier</value>
190190
<comment>A Squadron Carrier</comment>
191191
</data>
192+
<data name="Dodec" xml:space="preserve">
193+
<value>Dodec-Sternenhafen</value>
194+
</data>
192195
</root>

DataDefinitions/Properties/StationModels.resx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,4 +189,8 @@
189189
<value>Squadron Carrier</value>
190190
<comment>A Squadron Carrier</comment>
191191
</data>
192+
<data name="Dodec" xml:space="preserve">
193+
<value>Dodec Starport</value>
194+
<comment>A Dodec Starport</comment>
195+
</data>
192196
</root>

DataDefinitions/StationModel.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ static StationModel()
2121
public static readonly StationModel MegaShipCivilian = new StationModel("MegaShipCivilian");
2222
public static readonly StationModel Ocellus = new StationModel("Ocellus");
2323
public static readonly StationModel Orbis = new StationModel("Orbis");
24+
public static readonly StationModel Dodec = new StationModel("Dodec");
2425
public static readonly StationModel Outpost = new StationModel("Outpost");
2526
public static readonly StationModel SurfaceStation = new StationModel("SurfaceStation"); // No longer used in the player journal
2627
public static readonly StationModel CraterOutpost = new StationModel("CraterOutpost");

Events/CommunityGoalEvent.cs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public class CommunityGoalEvent : Event
1010
{
1111
public const string NAME = "Community goal";
1212
public const string DESCRIPTION = "Triggered when the status of a community goal changes";
13-
public static Event SAMPLE = new CommunityGoalEvent(DateTime.UtcNow, new List<CGUpdate>() { new CGUpdate("Tier", "Increase"), new CGUpdate("Percentile", "Increase") }, new CommunityGoal()
13+
public static Event SAMPLE = new CommunityGoalEvent(DateTime.UtcNow, new List<CGUpdate> { new CGUpdate("Tier", "Increase", 4, 5), new CGUpdate("Percentile", "Increase", 25, 10) }, new CommunityGoal()
1414
{
1515
cgid = 641,
1616
name = "Defence of the Galactic Summit",
@@ -93,16 +93,28 @@ public CommunityGoalEvent(DateTime timestamp, List<CGUpdate> cgupdates, Communit
9393

9494
public class CGUpdate
9595
{
96-
[PublicAPI]
96+
[PublicAPI("Update Type")]
9797
public string type { get; private set; }
9898

99-
[PublicAPI]
99+
[PublicAPI( "Update Direction" )]
100100
public string direction { get; private set; }
101101

102-
public CGUpdate(string updateType, string updateDirection)
102+
[PublicAPI( "The old value" )]
103+
public long? oldvalue { get; private set; }
104+
105+
[PublicAPI( "The new value" )]
106+
public long? newvalue { get; private set; }
107+
108+
[PublicAPI( "The difference between the old and new values" )]
109+
public long? change { get; private set; }
110+
111+
public CGUpdate ( string updateType, string updateDirection, long oldVal, long newVal )
103112
{
104113
type = updateType;
105114
direction = updateDirection;
115+
oldvalue = oldVal;
116+
newvalue = newVal;
117+
change = newVal - oldVal;
106118
}
107119
}
108120
}

MissionMonitor/MissionMonitor.cs

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -580,28 +580,39 @@ public void _handleCommunityGoalsEvent(CommunityGoalsEvent @event)
580580
{
581581
// Raise events for the notable changes in community goal status.
582582
var cgUpdates = new List<CGUpdate>();
583-
if (mission.communalTier < goal.tier)
583+
584+
// Check for community goal tier changes
585+
if ( mission.communalTier < goal.tier )
584586
{
585-
// Did the goal's current tier change?
586-
cgUpdates.Add(new CGUpdate("Tier", "Increase"));
587+
cgUpdates.Add( new CGUpdate( "Tier", "Increase",
588+
mission.communalTier, goal.tier ) );
587589
}
588-
if (goal.contribution > 0)
590+
591+
// Check for player contribution changes
592+
if ( goal.contribution > mission.communalContribution )
589593
{
590-
// Smaller percentile bands are better, larger percentile bands are worse
591-
if (mission.communalPercentileBand > goal.percentileband)
594+
cgUpdates.Add( new CGUpdate( "Contribution", "Increase",
595+
mission.communalContribution, goal.contribution ) );
596+
}
597+
598+
// Check for player percentile band changes
599+
if ( goal.contribution > 0 )
600+
{
601+
if ( mission.communalPercentileBand > goal.percentileband )
592602
{
593-
// Did the player's percentile band increase (reach a smaller value)?
594-
cgUpdates.Add(new CGUpdate("Percentile", "Increase"));
603+
cgUpdates.Add( new CGUpdate( "Percentile", "Increase",
604+
mission.communalPercentileBand, goal.percentileband ) );
595605
}
596-
if (mission.communalPercentileBand < goal.percentileband)
606+
if ( mission.communalPercentileBand < goal.percentileband )
597607
{
598-
// Did the player's percentile band decrease (reach a larger value)?
599-
cgUpdates.Add(new CGUpdate("Percentile", "Decrease"));
608+
cgUpdates.Add( new CGUpdate( "Percentile", "Decrease",
609+
mission.communalPercentileBand, goal.percentileband ) );
600610
}
601611
}
602-
if (cgUpdates.Any())
612+
613+
if ( cgUpdates.Any() )
603614
{
604-
EDDI.Instance.enqueueEvent(new CommunityGoalEvent(DateTime.UtcNow, cgUpdates, goal));
615+
EDDI.Instance.enqueueEvent( new CommunityGoalEvent( DateTime.UtcNow, cgUpdates, goal ) );
605616
}
606617

607618
// Update our mission records
@@ -614,16 +625,18 @@ public void _handleCommunityGoalsEvent(CommunityGoalsEvent @event)
614625
mission.communal = true;
615626
mission.communalPercentileBand = goal.percentileband;
616627
mission.communalTier = goal.tier;
628+
mission.communalContribution = goal.contribution;
617629
mission.expiry = goal.expiryDateTime;
618-
if (goal.iscomplete)
630+
631+
if ( goal.iscomplete )
619632
{
620-
if (goal.contribution > 0)
633+
if ( goal.contribution > 0 )
621634
{
622635
mission.statusDef = MissionStatus.Claim;
623636
}
624637
else
625638
{
626-
RemoveMissionWithMissionId(mission.missionid);
639+
RemoveMissionWithMissionId( mission.missionid );
627640
}
628641
}
629642
}

0 commit comments

Comments
 (0)