当前位置: 首页>>代码示例>>C#>>正文


C# TSPlayer.Heal方法代码示例

本文整理汇总了C#中TShockAPI.TSPlayer.Heal方法的典型用法代码示例。如果您正苦于以下问题:C# TSPlayer.Heal方法的具体用法?C# TSPlayer.Heal怎么用?C# TSPlayer.Heal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TShockAPI.TSPlayer的用法示例。


在下文中一共展示了TSPlayer.Heal方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Update

        public void Update(TSPlayer player)
        {
            if ((DateTime.Now - lastDisabled).TotalSeconds > 10)
            {
                disabled = false;
                lastDisabled = DateTime.Now;
            }

            bool bypassFlag = BypassFlag(player);

            bool warning = ((DateTime.Now - lastWarned).TotalSeconds > 1);
            if (regionStorage.flags.Contains("HEAL"))
            {
                if (regionStorage.healinterval < 0 || regionStorage.healamount < 0)
                    return;
                if ((DateTime.Now - lastHealUpdate).TotalSeconds >= regionStorage.healinterval)
                {
                    lastHealUpdate = DateTime.Now;
                    player.Heal(regionStorage.healamount);
                }
            }
            if (regionStorage.flags.Contains("MANA"))
            {
                if (regionStorage.manainterval < 0 || regionStorage.healamount < 0)
                    return;
                if ((DateTime.Now - lastManaUpdate).TotalSeconds >= regionStorage.manainterval)
                {
                    lastManaUpdate = DateTime.Now;
                    var matches = TShock.Utils.GetItemByIdOrName("184");
                    Item star = matches[0];
                    player.GiveItem(star.netID, star.name, star.width, star.height, regionStorage.healamount);
                }
            }
            if (regionStorage.flags.Contains("PRIVATE") && !bypassFlag)
            {
                if (!gotWarnMessage)
                {
                    player.Teleport(lastPos.X, lastPos.Y, 1);
                    player.SendErrorMessage("No permission to enter private region!");
                    gotWarnMessage = true;
                }
            }
            if (regionStorage.flags.Contains("PVP") && !bypassFlag)
            {
                if (!player.TPlayer.hostile)
                {
                    player.SendSuccessMessage("PVP arena entered, pvp enabled.");
                    player.TPlayer.hostile = true;
                    NetMessage.SendData((int)PacketTypes.TogglePvp, -1, -1, "", player.Index);
                }
            }
            if (regionStorage.flags.Contains("NOPVP") && !bypassFlag)
            {
                if (player.TPlayer.hostile)
                {
                    player.SendSuccessMessage("PVP arena entered, pvp disabled.");
                    player.TPlayer.hostile = false;
                    NetMessage.SendData((int)PacketTypes.TogglePvp, -1, -1, "", player.Index);
                }
            }
            if (regionStorage.flags.Contains("TEMPGROUP") && !bypassFlag)
            {
                if (!groupset)
                {
                    player.tempGroup = regionStorage.tempgroup;
                    player.SendSuccessMessage("Your group has been temporarily set to \"{0}\"!", regionStorage.tempgroup.Name);
                    groupset = true;
                }
            }
            if (regionStorage.flags.Contains("DEATH") && !bypassFlag)
            {
                if (!killed)
                {
                    player.DamagePlayer(1200);
                    player.SendErrorMessage("You entered a death zone! RIP");
                    killed = true;
                }
            }
            if (regionStorage.flags.Contains("HURT") && !bypassFlag)
            {
                if (regionStorage.damageinterval < 0 || regionStorage.damageamount< 0)
                    return;
                if ((DateTime.Now - lastDamageUpdate).TotalSeconds >= regionStorage.damageinterval)
                {
                    lastDamageUpdate = DateTime.Now;
                    player.DamagePlayer(regionStorage.damageamount);
                }
            }
            if (regionStorage.flags.Contains("COMMAND") && !bypassFlag)
            {
                if (!executedcommand)
                {
                    if (regionStorage.command != null && regionStorage.command != "")
                    {
                        Commands.HandleCommand(TSPlayer.Server, "/" + regionStorage.command);
                        executedcommand = true;
                    }
                }
            }
            if (regionStorage.flags.Contains("PROMOTE") && !bypassFlag)
//.........这里部分代码省略.........
开发者ID:loohney,项目名称:RegionEvent,代码行数:101,代码来源:PlayerStorage.cs

示例2: Event

 // Event for the effect. Parameter function vary based on the type. Who is 0 (User) and 1 (target)
 public static void Event(VSPlayer User, TSPlayer Target, EffectTypes type, int Parameter, int Parameter2 = 0,
     int Who = 1, States setstate = States.NONE)
 {
     if (type.Equals(EffectTypes.BUFF))
     {
         try
         {
             if (Who == 0)
                 User.TSPlayer.SetBuff(Parameter, Parameter2 * 60, false);
             else
                 Target.SetBuff(Parameter, Parameter2 * 60, false);
         }
         catch (Exception)
         {
             Log.ConsoleError("[VSSystem] A command has returned an error at Effect parameter: Invalid buff ID");
         }
     }
     else if (type.Equals(EffectTypes.HEALSELF))
     {
         if (Who == 0)
             User.TSPlayer.Heal(Parameter);
         else
             Target.Heal(Parameter);
     }
     else if (type.Equals(EffectTypes.TICKLE))
     {
         if (Who == 0)
         {
             if (VSSystem.ItemCheck(TShock.Utils.GetItemByName("Hand Warmer")[0].netID, User.TSPlayer))
             {
                 User.TSPlayer.DamagePlayer(10000);
                 User.TSPlayer.TPlayer.KillMe(10000, 0, true, " was tickled to death for having Hand Warmer.");
             }
             else
                 User.TSPlayer.SetBuff(47, Parameter * 60, false);
         }
         else
         {
             if (VSSystem.ItemCheck(TShock.Utils.GetItemByName("Hand Warmer")[0].netID, Target))
             {
                 Target.DamagePlayer(10000);
                 Target.TPlayer.KillMe(10000, 0, true, " was tickled to death for having Hand Warmer.");
             }
             else
                 Target.SetBuff(47, Parameter * 60, false);
         }
     }
     else if (type.Equals(EffectTypes.STATE) && setstate != States.NONE)
     {
         if (Who == 0)
             User.SetState(setstate, Parameter);
         else
             VSSystem.VSPlayers[Target.UserID].SetState(setstate, Parameter);
     }
 }
开发者ID:UB1AFU,项目名称:VSSystem,代码行数:56,代码来源:VSTypes.cs


注:本文中的TShockAPI.TSPlayer.Heal方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。