Pryaxis / TShock

☕️⚡️TShock provides Terraria servers with server-side characters, anti-cheat, and community management tools.
GNU General Public License v3.0
2.41k stars 377 forks source link

[Feature Request] Command to adjust player luck #1822

Closed QuiCM closed 4 years ago

QuiCM commented 4 years ago

We can now modify luck on clients. We should have a command for this

hakusaro commented 4 years ago

This is currently a really controversial topic, making it to the top of r/Games today with developer response. Probably a very high priority feature request.

Olink commented 4 years ago

Looking at the packets, while we can send updated metrics to affect luck, I am concerned the client recalculates luck on the fly resulting in us flooding packets to resync. OnUpdate() calles UpdateBiome() which checks for a gnome on screen.

Player player19 = Main.player[index37];
player19.ladyBugLuckTimeLeft = num134;
player19.torchLuck = num135;
player19.luckPotion = num136;
player19.HasGardenGnomeNearby = flag10;
player19.RecalculateLuck();
if (this.HasGardenGnomeNearby != Main.SceneMetrics.HasGardenGnome)
{
    this.luckNeedsSync = true;
    this.HasGardenGnomeNearby = Main.SceneMetrics.HasGardenGnome;
}
QuiCM commented 4 years ago

This may be better suited to a plugin then perhaps. I imagine you could simply hook retain a list of players with modified luck and reset their luckNeedsSync value every update, but I'd rather not bake that into TShock's spaghetti