execute store result score .player.XpPoint sgrave run xp query @s points

execute store result score .player.XpLevel sgrave run xp query @s levels
execute store result score .player.XpLevel^2 sgrave run xp query @s levels
scoreboard players operation .player.XpLevel^2 sgrave *= .player.XpLevel^2 sgrave


execute if score .player.XpLevel sgrave matches 0..16 run function snapgrave:store/xp/0_16
execute if score .player.XpLevel sgrave matches 17..31 run function snapgrave:store/xp/17_31
execute if score .player.XpLevel sgrave matches 32.. run function snapgrave:store/xp/32up

execute store result score .player.XpLevelPoint sgrave run data get storage sgrave:temp XpLevel
scoreboard players operation .player.XpPoint sgrave += .player.XpLevelPoint sgrave


execute store result entity @n[type=marker,tag=sgrave,tag=sgrave.marker] data.XpPoint int 1 run scoreboard players get .player.XpPoint sgrave

scoreboard players reset .player.XpLevelPoint sgrave
scoreboard players reset .player.XpPoint sgrave

data remove storage sgrave:temp XpLevel