Add abilty to give all blueprints to playersNo Thanks

Hello, My Servers devs an I have added the abilty to give all blueprints to players. we think this would be an nice addition to your plugin. :D

The Devs that worked on this are, Disowned, and I DeXr0.


        [ConsoleCommand(CUnlockAllUserBPCmd)]
        private void PlayerAdministrationUnlockAllUserBlueprintsCallback(ConsoleSystem.Arg aArg)
        {
            LogDebug("PlayerAdministrationUnlockAllUserBlueprintsCallback was called");
            BasePlayer player = aArg.Player();
            ulong targetId;

            if (!VerifyPermission(ref player, CPermUnlockBP, true) || !GetTargetFromArg(ref aArg, out targetId))
                return;
            ProtoBuf.PersistantPlayer playerInfo = SingletonComponent<ServerMgr>.Instance.persistance.GetPlayerInfo(targetId);
            foreach (ItemBlueprint itemBlueprint in ItemManager.bpList)
            {
                if (itemBlueprint.userCraftable && !itemBlueprint.defaultBlueprint)
                {
                    if (!playerInfo.unlockedItems.Contains(itemBlueprint.targetItem.itemid))
                        playerInfo.unlockedItems.Add(itemBlueprint.targetItem.itemid);
                }
            }
            SingletonComponent<ServerMgr>.Instance.persistance.SetPlayerInfo(targetId, playerInfo);
            (BasePlayer.FindByID(targetId) ?? BasePlayer.FindSleeping(targetId))?.SendNetworkUpdateImmediate(false);
            (BasePlayer.FindByID(targetId) ?? BasePlayer.FindSleeping(targetId))?.ClientRPCPlayer<int>(null, player, "UnlockedBlueprint", 0);
            LogInfo($"{player.displayName}: Unlock the blueprints of user ID {targetId}");
            BuildUI(player, UiPage.PlayerPage, targetId.ToString());
        }​
r

Hello,

Sorry but this does not fit in with what I had envisioned for the panel so I will not add it.
I also highly doubt this implementation is optimal, as we, the modders, should not have to touch networking methods.
There should be an easier and safer way to unlock all the BPs.

In fact, this should do the trick:

BasePlayer target = (BasePlayer.FindByID(targetId) ?? BasePlayer.FindSleeping(targetId));
target.blueprints.UnlockAll();
yea we tryed that method, All players get Disconnected: packet flooding: player tick

O.o Orly?
Your code is pretty much a copy-paste of the "retrieved source" from the PlayerBlueprints class in "that one DLL" with minor adjustments.
I don't see how that would cause the server to kick everyone. If it does I would report it as a bug to the developers of RUST.

Or maybe @Wulf has an idea on how to fix this challenge.
What I can still think of is:

BasePlayer target = (BasePlayer.FindByID(targetId) ?? BasePlayer.FindSleeping(targetId));

foreach (ItemBlueprint item in ItemManager.bpList) {
    if (item.userCraftable && !item.defaultBlueprint) {
        target.blueprints.Unlock(item.targetItem);
    }
}


Merged post

Small addition, what I see is that they burst all the unlocks one-by-one in an immediate update, rather then using the network queue... Makes sense that the server flips the table.

Also `bool justCreated` is never used, so dono why we would need to pass that variable (It also defaults to False).

Locked automatically