Skip to content

maxcount queries set the items to unique(200) limit, restore script will not work as intended. #2

@DingoPD

Description

@DingoPD

Setting all max stack sizes to 200 can be done with single query, you do not need 32 queries to do it.

UPDATE acore_world.item_template SET stackable=200 WHERE stackable > 1 and stackable < 200;

it translates to:
Update stack size to 200 on all items in acore_world schema if the items have existing stack size greater than one and less than 200.

Also you probably don't want to mess with maxcount, that variable limits on how many items with that id the player can have, it defaults to zero (no limit) any maxcount value greater than zero limits the user to that many items. (Reference from AC docs)

If you try to use the restore script later, only the first two lines will do anything, they will set all max stacks that are currently 200 to 60 and set all unique(200) items to unique(60), all the other lines will have no effect because you changed all max stacks (200) to 60 with the first line, and all maxcount lines that were 200 to 60 with the second line.

if you wish to have restore capability, you could create new table called item_template_backup before you change any stack sizes:

CREATE TABLE item_template_backup (
entry int unsigned NOT NULL DEFAULT '0',
stackable int DEFAULT '1',
PRIMARY KEY (entry)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Item Stack size backup';

Then use something like this query (saves only values of already stackable items - 5k items vs 40k-ish) to populate the backup table:

INSERT INTO acore_world.item_template_backup (entry,stackable) SELECT entry,stackable FROM acore_world.item_template WHERE acore_world.item_template.stackable > 1;

after that you can run the update query from the top.

To restore the old values, you just pull them from the backup and save them in the original item_template:

UPDATE acore_world.item_template JOIN acore_world.item_template_backup
ON acore_world.item_template_backup.entry = acore_world.item_template.entry
SET acore_world.item_template.stackable = acore_world.item_template_backup.stackable;

That should restore all the 'stackable' values in the item_template from item_template_backup.

after that if it finishes successfully, you can drop the item_template_backup table as it is not needed anymore.


Fell free to use any of the queries. I did write them on the fly without testing, so you might want to test them first on a dummy schema. :)

You could also export the backup table into .sql file and include it in the project as a backup for the backup table, that would help the folks who used the existing scripts and don't have a backup, mostly fixing something is still better than not being able to fix it at all, and have to drop the whole item_template table and re-import it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions