Ejemplo n.º 1
0
        public static ServerPlayer CreateNewPlayer(Player p)
        {
            var instance = new ServerPlayer(p);

            PlayerHooks.SetStartInventory(p);
            var player = new PlayerInfo
            {
                Name        = p.name,
                ID          = ServerSideCharacter2.PlayerCollection.GetNextID(),
                HasPassword = false,
                Group       = "default",
                Password    = "",
                LifeMax     = 100,
                StatLife    = 100,
                ManaMax     = 20,
                StatMana    = 20,
                KillCount   = 0,
                Rank        = 1500,
                EloRank     = 1500,
            };
            var i = 0;

            foreach (var item in ServerSideCharacter2.Config.startUpInventory)
            {
                player.inventory[i++] = item;
            }
            instance._info = player;
            instance.LoadFromInfo();
            OnPlayerNewAccount?.Invoke(instance, new EventArgs());
            return(instance);
        }
Ejemplo n.º 2
0
        ////

        public static void FullVanillaReset(Player player)
        {
            for (int i = 0; i < player.inventory.Length; i++)
            {
                player.inventory[i] = new Item();
            }
            for (int i = 0; i < player.armor.Length; i++)
            {
                player.armor[i] = new Item();
            }
            for (int i = 0; i < player.bank.item.Length; i++)
            {
                player.bank.item[i] = new Item();
            }
            for (int i = 0; i < player.bank2.item.Length; i++)
            {
                player.bank2.item[i] = new Item();
            }
            for (int i = 0; i < player.bank3.item.Length; i++)
            {
                player.bank3.item[i] = new Item();
            }
            for (int i = 0; i < player.dye.Length; i++)
            {
                player.dye[i] = new Item();
            }
            for (int i = 0; i < player.miscDyes.Length; i++)
            {
                player.miscDyes[i] = new Item();
            }
            for (int i = 0; i < player.miscEquips.Length; i++)
            {
                player.miscEquips[i] = new Item();
            }

            for (int i = 0; i < player.buffType.Length; i++)
            {
                player.buffType[i] = 0;
                player.buffTime[i] = 0;
            }

            player.trashItem = new Item();
            if (player.whoAmI == Main.myPlayer)
            {
                Main.mouseItem = new Item();
            }

            player.statLifeMax = 100;
            player.statManaMax = 20;

            player.extraAccessory              = false;
            player.anglerQuestsFinished        = 0;
            player.bartenderQuestLog           = 0;
            player.downedDD2EventAnyDifficulty = false;
            player.taxMoney = 0;

            PlayerHooks.SetStartInventory(player);
        }