vmangos / core

Progressive Vanilla Core aimed at all versions from 1.2 to 1.12
GNU General Public License v2.0
692 stars 492 forks source link

Store world save variables at characters db #2825

Open schell244 opened 3 weeks ago

schell244 commented 3 weeks ago

🍰 Pullrequest

Store world save variables at characters db, as they are related to player actions and make world database read only. This will allow to apply a fresh world db without wiping any saved states. Also removed LoadVariable function, as it was unused. (Changes have been tested on raspywow server)

How2Test

Todo / Checklist

ratkosrb commented 3 weeks ago

World states is already a term that exists, and it's something that's sent to client. We should not have confusing naming like this, because it implies that those are the same world states blizzard sends if you name the table like this, and that is not what it contains. Variables is our own custom indexes and values, not using blizzard's ids for stuff.

0blu commented 3 weeks ago

variables is too generic, especially in a database like characters. Maybe something like this:

or another permutation of these words?

schell244 commented 3 weeks ago

maybe world_persistent_variables?

shudza commented 3 weeks ago

... and make world database read only.

game_events is written to as well, or am I wrong?

schell244 commented 3 weeks ago

... and make world database read only.

game_events is written to as well, or am I wrong?

Oh yes, you're right, there are querys on game_event_creatureand game_event_creature_data. Would probably make sense to move those tables to charcter db as well at some point.

shudza commented 3 weeks ago

I don't think it makes sense to change only variables then. For example, variables stores stuff like resources for war effort, but the stage it self is stored in game_events. So if the point was to make world db ephemeral/read-only, this would probably cause issues.

schell244 commented 1 week ago

Did not experience any issues with that change, but I agree that it makes sense to move the other tables as well, together with the variables. Will add some more changes when I have time.