Example #1
0
        public void Transform(TransformationDefinition definition)
        {
            for (int i = 0; i < ActiveTransformations.Count; i++)
            {
                if (ActiveTransformations[i] == definition)
                {
                    return;
                }
            }

            ActiveTransformations.Add(definition);
            player.AddBuff(mod.GetBuff(definition.BuffType.Name).Type, definition.Duration);

            if (player.whoAmI == Main.myPlayer)
            {
                new PlayerTransformedPacket(definition).Send();
            }
        }
        public void Transform(TransformationDefinition definition)
        {
            for (int i = 0; i < ActiveTransformations.Count; i++)
            {
                if (ActiveTransformations[i] == definition)
                {
                    return;
                }
            }

            ActiveTransformations.Add(definition);
            player.AddBuff(mod.GetBuff(definition.BuffType.Name).Type, definition.Duration);

            if (Main.netMode == NetmodeID.MultiplayerClient && player.whoAmI == Main.myPlayer)
            {
                NetworkPacketManager.Instance.PlayerTransformedPacket.SendPacketToServer(player.whoAmI, (byte)player.whoAmI, definition.UnlocalizedName);
            }
        }
Example #3
0
        public void AddTransformation(TransformationDefinition transformation, int duration)
        {
            player.AddBuff(transformation.GetBuffId(), duration, false);
            ActiveTransformations.Add(transformation);

            transformation.OnPlayerTransformed(this);

            if (!string.IsNullOrWhiteSpace(transformation.Text))
            {
                CombatText.NewText(player.Hitbox, transformation.TextColor, transformation.Text, false, false);
            }

            if (!Main.dedServ && Main.netMode == NetmodeID.MultiplayerClient && player.whoAmI == Main.myPlayer)
            {
                NetworkHelper.formSync.SendFormChanges(256, player.whoAmI, player.whoAmI, transformation.UnlocalizedName, duration);
            }

            isTransformationAnimationPlaying = true;
        }