Previously the duplication was done on the device, which had two main issues:
There is a limit for document reads used in security rules (20) - since every compendium character item checks whether the item in compendium exists, this would only work for small NPCs. By moving this to cloud functions, security rules are not used and this is no longer a problem (there is still a limit of 500 writes in a single batch, but I guess this should be enough for vast majority of NPCs)
The new NPC has the same avatar URL, so if the user changes the original NPC's avatar, the new NPC gets that avatar as well - now it's copied, so this file is not shared anymore.
Fixes https://github.com/fmasa/wfrp-master/issues/253
Previously the duplication was done on the device, which had two main issues:
This also makes the NPC duplication way faster!