diff --git a/src/Settings.hx b/src/Settings.hx index 99d6f88b..2ae89b30 100644 --- a/src/Settings.hx +++ b/src/Settings.hx @@ -106,6 +106,7 @@ typedef PlayStatistics = { var oobs:Int; var respawns:Int; var totalTime:Float; + var totalMPScore:Int; } class Settings { @@ -194,6 +195,7 @@ class Settings { oobs: 0, respawns: 0, totalTime: 0, + totalMPScore: 0 } public static var levelStatistics:Map = []; @@ -437,6 +439,10 @@ class Settings { optionsSettings.rewindTimescale = 1; if (json.stats != null) { playStatistics = json.stats; + #if js + if (playStatistics.totalMPScore == null) + playStatistics.totalMPScore = 0; + #end } achievementProgression = json.achievementProgression; if (json.levelStatistics != null) { diff --git a/src/gui/AchievementsGui.hx b/src/gui/AchievementsGui.hx index d18c109d..9d3c5da7 100644 --- a/src/gui/AchievementsGui.hx +++ b/src/gui/AchievementsGui.hx @@ -72,7 +72,13 @@ class AchievementsGui extends GuiImage { "Marble-fu Master", "Marble-fu Transcendent", "Egg Seeker", - "Egg Basket" + "Egg Basket", + "First Place", + "Gem Collector", + "Veteran Battler", + "Blue Gem Hunt", + "Map Pack Dominator", + "Master of the Spires", ]; if (Settings.achievementProgression & 1 == 1) achNameDisplays[0] = "Timely Marble"; @@ -92,6 +98,18 @@ class AchievementsGui extends GuiImage { achNameDisplays[7] = "Egg Seeker"; if (Settings.achievementProgression & 256 == 256) achNameDisplays[8] = "Egg Basket"; + if (Settings.achievementProgression & 512 == 512) + achNameDisplays[9] = "First Place"; + if (Settings.achievementProgression & 1024 == 1024) + achNameDisplays[10] = "Gem Collector"; + if (Settings.achievementProgression & 2048 == 2048) + achNameDisplays[11] = "Veteran Battler"; + if (Settings.achievementProgression & 4096 == 4096) + achNameDisplays[12] = "Blue Gem Hunt"; + if (Settings.achievementProgression & 8192 == 8192) + achNameDisplays[13] = "Map Pack Dominator"; + if (Settings.achievementProgression & 16384 == 16384) + achNameDisplays[14] = "Master of the Spires"; var achievementsList = new GuiMLTextListCtrl(arial14, achNameDisplays, imgLoader); @@ -149,14 +167,21 @@ class AchievementsGui extends GuiImage { case 9: desc = "Get first place in a multiplayer match."; case 10: desc = "Get 75 points in a multiplayer match."; case 11: desc = "Collect 2,000 total points in multiplayer."; - case 12: desc = "Complete all Bonus levels."; - case 13: desc = "Finish all Bonus levels under par time."; + case 12: desc = "Collect a blue gem in a Marble It Up! multiplayer match."; + case 13: desc = "Get 40 gems in any 3 of the Playground, Bowl, Concentric, Vortex Effect, Blast Club (Marble Fu Pack)."; + case 14: desc = "Collect 50 gems in Spires (Agoraphobia pack)."; } MarbleGame.canvas.pushDialog(new MessageBoxOkDlg(desc)); }; bottomBar.addChild(nextButton); } + public static function queueMPAchievement(mpAchFlag:Int) { + mpAchs |= mpAchFlag; + } + + static var mpAchs:Int = 0; + public static function check() { // Now do the actual achievement check logic var completions:Map 0) { diff --git a/src/gui/PlayGui.hx b/src/gui/PlayGui.hx index 3a25fa34..df8c1882 100644 --- a/src/gui/PlayGui.hx +++ b/src/gui/PlayGui.hx @@ -1,5 +1,6 @@ package gui; +import net.Net; import h3d.Matrix; import src.ProfilerUI; import hxd.App; @@ -709,6 +710,33 @@ class PlayGui { MarbleGame.instance.world.displayAlert('${p1.name} won with 1 point!'); else MarbleGame.instance.world.displayAlert('${p1.name} won with ${p1.score} points!'); + + if (p1.id == Net.clientId) { // This us + AchievementsGui.queueMPAchievement(512); + } + } + + var ourScore = playerList.filter(x -> x.id == Net.clientId); + if (ourScore.length != 0) { + var ourScoreReal = ourScore[0].score; + if (ourScoreReal >= 75) { + AchievementsGui.queueMPAchievement(1024); + } + var ourLevel = MarbleGame.instance.world.mission; + if (ourScoreReal >= 40) { + if (ourLevel.path.indexOf("playground.mis") != -1 + || ourLevel.path.indexOf("bowl.mis") != -1 + || ourLevel.path.indexOf("concentric.mis") != -1 + || ourLevel.path.indexOf("vortexeffect.mis") != -1 + || ourLevel.path.indexOf("blastclub.mis") != -1) { + AchievementsGui.queueMPAchievement(8192); + } + } + if (ourScoreReal >= 50 && ourLevel.path.indexOf("spires.mis") != -1) { + AchievementsGui.queueMPAchievement(16384); + } + if (Settings.playStatistics.totalMPScore >= 2000) + AchievementsGui.queueMPAchievement(2048); } } } @@ -739,6 +767,13 @@ class PlayGui { if (f.length != 0) f[0].score += score; + if (id == Net.clientId) { + Settings.playStatistics.totalMPScore += score; + if (score == 5 && MarbleGame.instance.world.mission.title == "Marble It Up!") { + AchievementsGui.queueMPAchievement(4096); + } + } + redrawPlayerList(); } diff --git a/src/modes/HuntMode.hx b/src/modes/HuntMode.hx index 62bb3d34..879f1eb0 100644 --- a/src/modes/HuntMode.hx +++ b/src/modes/HuntMode.hx @@ -367,6 +367,8 @@ class HuntMode extends NullMode { packet.serialize(os); Net.sendPacketToIngame(os); + Settings.playStatistics.totalMPScore += incr; + @:privateAccess level.playGui.incrementPlayerScore(packet.clientId, packet.scoreIncr); } if (this.level.isMultiplayer && Net.isClient) {