Skip to content

Commit

Permalink
Stats can be personal/global based on playercount
Browse files Browse the repository at this point in the history
  • Loading branch information
Frustrated-Programmer committed Jul 10, 2024
1 parent 15edad7 commit 5b27bfa
Show file tree
Hide file tree
Showing 14 changed files with 156 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@ execute if score $dungeon do2.run.active matches 0 run function do2:dungeon_setu
execute if score $dungeon do2.run.active matches 0 run function do2:dungeon_setup/test_for_wardens
execute if score $dungeon do2.run.active matches 0 run function do2:dungeon_setup/test_for_other_killers
execute if score $dungeon do2.run.active matches 0 run function do2:dungeon_setup/test_for_markers

# Count players on the server.
scoreboard players set $dungeon do2.utility.playerCount 0
execute as @a[name=!tangocam,name=!TangoCam] run scoreboard players add $dungeon do2.utility.playerCount 1
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,9 @@ tag @s remove exitedLogTarget
# - End Log -

kill @e[type=vex]

scoreboard players operation @s do2.lifetime.escaped.embers += @s do2.run.items.embers
scoreboard players operation $dungeon do2.lifetime.escaped.embers += @s do2.run.items.embers
scoreboard players operation @s do2.lifetime.escaped.crowns += @s do2.run.items.crowns
scoreboard players operation $dungeon do2.lifetime.escaped.crowns += @s do2.run.items.crowns

Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
scoreboard objectives add do2.utility.deathCount deathCount "Check whether player has died."
scoreboard objectives add do2.utility.playerCount dummy "How many players are in the server"
scoreboard objectives add do2.utility.randomNum dummy "Random Number Generator"
scoreboard objectives add do2.utility.currentTick dummy "The current tick number."
scoreboard objectives add do2.utility.checkTick dummy "Used for checking ticks."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ execute unless score $dungeon do2.lifetime.coinsconverted matches 0.. run scoreb
execute unless score $dungeon do2.lifetime.pickedup.crowns matches 0.. run scoreboard players set $dungeon do2.lifetime.pickedup.crowns 0
execute unless score $dungeon do2.lifetime.pickedup.coins matches 0.. run scoreboard players set $dungeon do2.lifetime.pickedup.coins 0
execute unless score $dungeon do2.lifetime.pickedup.embers matches 0.. run scoreboard players set $dungeon do2.lifetime.pickedup.embers 0
execute unless score $dungeon do2.run.active matches 0.. run scoreboard players set $dungeon do2.run.active 0
execute unless score $dungeon do2.lifetime.escaped.embers matches 0.. run scoreboard players set $dungeon do2.lifetime.escaped.embers 0
execute unless score $dungeon do2.lifetime.escaped.crowns matches 0.. run scoreboard players set $dungeon do2.lifetime.escaped.crowns 0

execute unless entity @e[tag=do2.statistics_room,tag=do2.stats.treasures] run summon minecraft:text_display -492 124.3 1990 {Rotation:[90f,0f], billboard:"fixed",background:26,Tags:["do2.statistics_room","do2.stats.treasures"]}
execute as @e[tag=do2.statistics_room,tag=do2.stats.treasures] if entity @s run data merge entity @s {text:'[{"text":"§l§eTreasure §fStatistics!§r\\n\\n§fCrowns Picked Up: §o§c"},{"score":{"name":"$dungeon","objective":"do2.lifetime.pickedup.crowns"},"color":"aqua","italic":"true"},{"text":"\\n§fCrowns Escaped With: §o§c"},{"score":{"name":"$dungeon","objective":"do2.run.active"},"color":"red","italic":"true"},{"text":"\\n§fCoins Picked Up: §o§c"},{"score":{"name":"$dungeon","objective":"do2.lifetime.pickedup.coins"},"color":"aqua","italic":"true"},{"text":"\\n§fCoins Converted: §o§c"},{"score":{"name":"$dungeon","objective":"do2.lifetime.coinsconverted"},"color":"aqua","italic":"true"},{"text":"\\n§fCrowns Spent: §o§b"},{"score":{"name":"$dungeon","objective":"do2.lifetime.spent.crowns"},"color":"aqua","italic":"true"},{"text":"\\n\\n§l§bFrost Embers §fStatistics!§r\\n\\nFrost Embers Picked Up: "},{"score":{"name":"$dungeon","objective":"do2.lifetime.pickedup.embers"},"color":"aqua","italic":"true"},{"text":"\\n§fFrost Embers Escaped With: §o§c"},{"score":{"name":"$dungeon","objective":"do2.run.active"},"color":"red","italic":"true"},{"text":"\\n§fFrost Embers Spent: §o§b"},{"score":{"name":"$dungeon","objective":"do2.lifetime.spent.embers"},"color":"aqua","italic":"true"}]'}
execute as @e[tag=do2.statistics_room,tag=do2.stats.treasures] if entity @s run data merge entity @s {text:'[{"text":"§l§eTreasure §fStatistics!§r\\n\\n§fCrowns Picked Up: §o§c"},{"score":{"name":"$dungeon","objective":"do2.lifetime.pickedup.crowns"},"color":"aqua","italic":"true"},{"text":"\\n§fCrowns Escaped With: §o§c"},{"score":{"name":"$dungeon","objective":"do2.lifetime.escaped.crowns"},"color":"aqua","italic":"true"},{"text":"\\n§fCoins Picked Up: §o§c"},{"score":{"name":"$dungeon","objective":"do2.lifetime.pickedup.coins"},"color":"aqua","italic":"true"},{"text":"\\n§fCoins Converted: §o§c"},{"score":{"name":"$dungeon","objective":"do2.lifetime.coinsconverted"},"color":"aqua","italic":"true"},{"text":"\\n§fCrowns Spent: §o§b"},{"score":{"name":"$dungeon","objective":"do2.lifetime.spent.crowns"},"color":"aqua","italic":"true"},{"text":"\\n\\n§l§bFrost Embers §fStatistics!§r\\n\\nFrost Embers Picked Up: "},{"score":{"name":"$dungeon","objective":"do2.lifetime.pickedup.embers"},"color":"aqua","italic":"true"},{"text":"\\n§fFrost Embers Escaped With: §o§c"},{"score":{"name":"$dungeon","objective":"do2.lifetime.escaped.embers"},"color":"aqua","italic":"true"},{"text":"\\n§fFrost Embers Spent: §o§b"},{"score":{"name":"$dungeon","objective":"do2.lifetime.spent.embers"},"color":"aqua","italic":"true"}]'}
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,18 @@ execute unless entity @a[tag=do2.inStatsRoom] run kill @e[tag=do2.statistics_roo
# Don't allow spawning stats display unless player nearby
execute unless entity @a[tag=do2.inStatsRoom] run return 0



# Eventually able to swap tabs of stats
execute if score $dungeon do2.utility.statsScreen matches 0 run function do2:statistics_room/summon_general
execute if score $dungeon do2.utility.statsScreen matches 1 run function do2:statistics_room/summon_treasures
execute if score $dungeon do2.utility.statsScreen matches 2 run function do2:statistics_room/summon_runs
execute if score $dungeon do2.utility.statsScreen matches 3 run function do2:statistics_room/summon_last_run
execute if score $dungeon do2.utility.statsScreen matches 5 run function do2:statistics_room/summon_spoilers
# For cases with more than one player online, show GLOBAL stats
execute unless score $dungeon do2.utility.playerCount matches 1 if score $dungeon do2.utility.statsScreen matches 0 run function do2:statistics_room/global/summon_general
execute unless score $dungeon do2.utility.playerCount matches 1 if score $dungeon do2.utility.statsScreen matches 1 run function do2:statistics_room/global/summon_treasures
execute unless score $dungeon do2.utility.playerCount matches 1 if score $dungeon do2.utility.statsScreen matches 2 run function do2:statistics_room/global/summon_runs
execute unless score $dungeon do2.utility.playerCount matches 1 if score $dungeon do2.utility.statsScreen matches 3 run function do2:statistics_room/global/summon_last_run
execute unless score $dungeon do2.utility.playerCount matches 1 if score $dungeon do2.utility.statsScreen matches 5 run function do2:statistics_room/global/summon_spoilers
# For cases with exactly one player online, show PERSONAL stats
execute if score $dungeon do2.utility.playerCount matches 1 if score $dungeon do2.utility.statsScreen matches 0 run function do2:statistics_room/personal/summon_general
execute if score $dungeon do2.utility.playerCount matches 1 if score $dungeon do2.utility.statsScreen matches 1 run function do2:statistics_room/personal/summon_treasures
execute if score $dungeon do2.utility.playerCount matches 1 if score $dungeon do2.utility.statsScreen matches 2 run function do2:statistics_room/personal/summon_runs
execute if score $dungeon do2.utility.playerCount matches 1 if score $dungeon do2.utility.statsScreen matches 3 run function do2:statistics_room/personal/summon_last_run
execute if score $dungeon do2.utility.playerCount matches 1 if score $dungeon do2.utility.statsScreen matches 5 run function do2:statistics_room/personal/summon_spoilers
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
kill @e[tag=do2.statistics_room,tag=!do2.stats.general]

execute unless score @p do2.runs matches 0.. run scoreboard players set @p do2.runs 0
execute unless score @p do2.wins matches 0.. run scoreboard players set @p do2.wins 0
execute unless score @p do2.losses matches 0.. run scoreboard players set @p do2.losses 0
execute unless score @p do2.eggs.total matches 0.. run scoreboard players set @p do2.eggs.total 0
execute unless score @p do2.highest_win_streak matches 0.. run scoreboard players set @p do2.highest_win_streak 0
execute unless score @p do2.win_streak matches 0.. run scoreboard players set @p do2.win_streak 0


execute unless entity @e[tag=do2.statistics_room,tag=do2.stats.general] run summon minecraft:text_display -492 125 1990 {Rotation:[90f,0f], billboard:"fixed",background:26,Tags:["do2.statistics_room","do2.stats.general"]}
execute as @e[tag=do2.statistics_room,tag=do2.stats.general] if entity @s run data merge entity @s {text:'[{"text":"§lStatistics!§r\\n\\n§fTotal Runs: §o§b"},{"score":{"name":"@p","objective":"do2.runs"},"color":"aqua","italic":"true"},{"text":"\\n§fTotal Wins: §o§b"},{"score":{"name":"@p","objective":"do2.wins"},"color":"aqua","italic":"true"},{"text":"\\n§fTotal Losses: §o§b"},{"score":{"name":"@p","objective":"do2.losses"},"color":"aqua","italic":"true"},{"text":"\\n§fHighest Win Streak: §o§b"},{"score":{"name":"@p","objective":"do2.highest_win_streak"},"color":"aqua","italic":"true"},{"text":"\\n§fCurrent Win Streak: §o§b"},{"score":{"name":"@p","objective":"do2.win_streak"},"color":"aqua","italic":"true"},{"text":"\\n§fEggs Found: §o§b"},{"score":{"name":"@p","objective":"do2.eggs.total"},"color":"aqua","italic":"true"},{"text":"§f/§o§b20"}]'}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
kill @e[tag=do2.statistics_room,tag=!do2.stats.lastRun]

execute unless entity @e[tag=do2.statistics_room,tag=do2.stats.lastRun] run summon minecraft:text_display -492 124.3 1990 {Rotation:[90f,0f], billboard:"fixed",background:26,Tags:["do2.statistics_room","do2.stats.lastRun"]}

# Empty Storages
data modify storage stats_display win_result set value "§c???§r§f"
data modify storage stats_display player_count set value "§c???§r§f"
data modify storage stats_display artifact_symbol set value "§c???§r§f"
data modify storage stats_display floor_embers set value "§c???§r§f"
data modify storage stats_display difficulty set value "§c???§r§f"
# Store WIN/LOSS
execute if score @p do2.run.has_won matches 1 run data modify storage stats_display win_result set value "§aWIN"
execute unless score @p do2.run.has_won matches 1 run data modify storage stats_display win_result set value "§cLOSS"
# Store Player/s
execute if score @p do2.run.players matches 1 run data modify storage stats_display player_count set value " player"
execute unless score @p do2.run.players matches 1 run data modify storage stats_display player_count set value " players"
# Store Artifact
execute if score @p do2.run.has_won matches 1 if score @p do2.run.foundArtifact matches 10 run data modify storage stats_display artifact_symbol set value ""
execute if score @p do2.run.has_won matches 1 if score @p do2.run.foundArtifact matches 11 run data modify storage stats_display artifact_symbol set value ""
execute if score @p do2.run.has_won matches 1 if score @p do2.run.foundArtifact matches 12 run data modify storage stats_display artifact_symbol set value ""
execute if score @p do2.run.has_won matches 1 if score @p do2.run.foundArtifact matches 13 run data modify storage stats_display artifact_symbol set value ""
execute if score @p do2.run.has_won matches 1 if score @p do2.run.foundArtifact matches 14 run data modify storage stats_display artifact_symbol set value ""
execute if score @p do2.run.has_won matches 1 if score @p do2.run.foundArtifact matches 15 run data modify storage stats_display artifact_symbol set value ""
execute if score @p do2.run.has_won matches 1 if score @p do2.run.foundArtifact matches 16 run data modify storage stats_display artifact_symbol set value ""
execute if score @p do2.run.has_won matches 1 if score @p do2.run.foundArtifact matches 17 run data modify storage stats_display artifact_symbol set value ""
execute if score @p do2.run.has_won matches 1 if score @p do2.run.foundArtifact matches 18 run data modify storage stats_display artifact_symbol set value ""
execute if score @p do2.run.has_won matches 1 if score @p do2.run.foundArtifact matches 19 run data modify storage stats_display artifact_symbol set value ""
execute if score @p do2.run.has_won matches 1 if score @p do2.run.foundArtifact matches 20 run data modify storage stats_display artifact_symbol set value ""
execute if score @p do2.run.has_won matches 1 if score @p do2.run.foundArtifact matches 28 run data modify storage stats_display artifact_symbol set value ""
execute if score @p do2.run.has_won matches 1 if score @p do2.run.foundArtifact matches 29 run data modify storage stats_display artifact_symbol set value ""
execute if score @p do2.run.has_won matches 1 if score @p do2.run.foundArtifact matches 30 run data modify storage stats_display artifact_symbol set value ""
execute if score @p do2.run.has_won matches 1 if score @p do2.run.foundArtifact matches 31 run data modify storage stats_display artifact_symbol set value ""
execute if score @p do2.run.has_won matches 1 if score @p do2.run.foundArtifact matches 32 run data modify storage stats_display artifact_symbol set value ""
execute if score @p do2.run.has_won matches 1 if score @p do2.run.foundArtifact matches 33 run data modify storage stats_display artifact_symbol set value ""
execute if score @p do2.run.has_won matches 1 if score @p do2.run.foundArtifact matches 34 run data modify storage stats_display artifact_symbol set value ""
execute if score @p do2.run.has_won matches 1 if score @p do2.run.foundArtifact matches 35 run data modify storage stats_display artifact_symbol set value ""
execute if score @p do2.run.has_won matches 1 if score @p do2.run.foundArtifact matches 36 run data modify storage stats_display artifact_symbol set value ""
execute if score @p do2.run.has_won matches 1 if score @p do2.run.foundArtifact matches 37 run data modify storage stats_display artifact_symbol set value ""
execute if score @p do2.run.has_won matches 1 if score @p do2.run.foundArtifact matches 38 run data modify storage stats_display artifact_symbol set value ""
execute if score @p do2.run.has_won matches 1 if score @p do2.run.foundArtifact matches 39 run data modify storage stats_display artifact_symbol set value ""
execute if score @p do2.run.has_won matches 1 if score @p do2.run.foundArtifact matches 40 run data modify storage stats_display artifact_symbol set value ""
execute if score @p do2.run.has_won matches 1 if score @p do2.run.foundArtifact matches 41 run data modify storage stats_display artifact_symbol set value ""
execute if score @p do2.run.has_won matches 1 if score @p do2.run.foundArtifact matches 42 run data modify storage stats_display artifact_symbol set value ""
execute if score @p do2.run.has_won matches 1 if score @p do2.run.foundArtifact matches 43 run data modify storage stats_display artifact_symbol set value ""
execute if score @p do2.run.has_won matches 1 if score @p do2.run.foundArtifact matches 44 run data modify storage stats_display artifact_symbol set value ""
execute unless score @p do2.run.has_won matches 1 run data modify storage stats_display artifact_symbol set value "§cN/A§r§f"
# Store Floor Embers
scoreboard players operation @p do2.utility.floorEmbers = @p do2.run.items.embers
scoreboard players operation @p do2.utility.floorEmbers -= @p do2.run.artifactValue
# Store Difficulty
execute if score @p do2.run.difficulty matches 1 run data modify storage stats_display difficulty set value "§1Easy§r§f"
execute if score @p do2.run.difficulty matches 2 run data modify storage stats_display difficulty set value "§aMedium§r§f"
execute if score @p do2.run.difficulty matches 3 run data modify storage stats_display difficulty set value "§6Hard§r§f"
execute if score @p do2.run.difficulty matches 4 run data modify storage stats_display difficulty set value "§4Deadly§r§f"
execute if score @p do2.run.difficulty matches 5 run data modify storage stats_display difficulty set value "§5Deepfrost§r§f"


execute as @e[tag=do2.statistics_room,tag=do2.stats.lastRun] if entity @s run data merge entity @s {text:'[{"text": "§l§5Last Run Stats!§r\\n\\n§fRun #§o§b"},{"score": {"name": "@p","objective": "do2.runs"},"color": "aqua"},{"text": " §fResult: "},{"storage": "stats_display","nbt": "win_result"},{"text": "\\n"},{"score": {"name": "@p","objective": "do2.run.players"},"color": "aqua"},{"storage": "stats_display","nbt": "player_count"},{"text": " played for "},{"score": {"name": "@p","objective": "do2.run.seconds"},"color": "aqua"},{"text": " seconds."},{"text": "\\nDeck Size: "},{"score": {"name": "@p","objective": "do2.run.cards.deck.total"},"color": "aqua"},{"text": "/§b40"},{"text": " | Difficulty: "},{"storage": "stats_display","nbt": "difficulty"},{"text": "\\n§lGenerated:\\n"},{"score": {"name": "@p","objective": "do2.run.systems.embers.released"},"color": "aqua"},{"text": "\\uE0A3 | "},{"score": {"name": "@p","objective": "do2.run.systems.treasure.released"},"color": "aqua"},{"text": "\\uE0CA | "},{"score": {"name": "@p","objective": "do2.run.systems.hazard.generated"},"color": "aqua"},{"text": "\\uE0CB | "},{"score": {"name": "@p","objective": "do2.run.systems.clank.generated"},"color": "aqua"},{"text": "\\uE0C3"},{"text": "\\n§lPicked Up:\\n"},{"score": {"name": "@p","objective": "do2.utility.floorEmbers"},"color": "aqua"},{"text": "\\uE0A3 | "},{"score": {"name": "@p","objective": "do2.run.items.crowns"},"color": "aqua"},{"text": "\\uE0A2 | "},{"score": {"name": "@p","objective": "do2.run.items.coins"},"color": "aqua"},{"text": "\\uE0A1"},{"text": "\\n§lBlocked:\\n"},{"score": {"name": "@p","objective": "do2.run.systems.hazard.blocked"},"color": "aqua"},{"text": "\\uE0CB | "},{"score": {"name": "@p","objective": "do2.run.systems.clank.blocked"},"color": "aqua"},{"text": "\\uE0C3"},{"text": "\\n§lArtifact:\\n§r§fFound "},{"storage": "stats_display","nbt": "artifact_symbol"},{"text": " valued at "},{"score": {"name": "@p","objective": "do2.run.artifactValue"},"color": "aqua"},{"text": "\\uE0A3"}]'}
Loading

0 comments on commit 5b27bfa

Please sign in to comment.