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


C# IPlayer.SetMetadata方法代码示例

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


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

示例1: Get

        public static HousePlayer Get(IPlayer player)
        {
            if (player.HasMetadata("HousePlayer"))
                return player.GetMetadata("HousePlayer") as HousePlayer;

            HousePlayer housePlayer = new HousePlayer(player);
            player.SetMetadata("HousePlayer", housePlayer);

            return housePlayer;
        }
开发者ID:CheeseSoftware,项目名称:MasterBot,代码行数:10,代码来源:HousePlayer.cs

示例2: makeZombie

        /***************************************************
         * private functions:
         *
         ********************************************************/
        private void makeZombie(IPlayer human)
        {
            human.SetMetadata("isZombie", "true");

            bot.Say(human.Name + " has turned into a zombie! Run!!!");
            forceToZombie(human);
        }
开发者ID:CheeseSoftware,项目名称:MasterBot,代码行数:11,代码来源:ZombiePlugin.cs

示例3: forceToZombie

        private void forceToZombie(IPlayer human)
        {
            human.SetMetadata("zombieForcing", "true");

            System.Threading.Tasks.Task task = new System.Threading.Tasks.Task(delegate
            {
                double oldX = human.X;
                double oldY = human.Y;

                if (this.cake != null)
                    bot.Say("/teleport " + human.Name + " " + this.cakeX + " " + this.cakeY);

                System.Threading.Thread.Sleep(500);
                bot.Say("/kill " + human.Name);
                bot.Say("/teleport " + human.Name + " " + oldX + " " + oldY);
                System.Threading.Thread.Sleep(500);
                bot.Say("/teleport " + human.Name + " " + oldX + " " + oldY);

                human.SetMetadata("zombieForcing", "false");
            });
            task.Start();
        }
开发者ID:CheeseSoftware,项目名称:MasterBot,代码行数:22,代码来源:ZombiePlugin.cs

示例4: DigBlock

        private void DigBlock(int x, int y, IPlayer player, float digStrength, bool mining, bool explosion = false)
        {
            if (digHardness == null)
                resetDigHardness();

            if (!(x > 0 && y > 0 && x < bot.Room.Width && y < bot.Room.Height))
                return;

            if (digHardness[x, y] <= 0)
                return;

            IBlock block = bot.Room.getBlock(0, x, y);
            int blockId = -1;
            float blockXp = 0;

            DigPlayer digPlayer = null;
            if (player != null)
            {
                if (!player.HasMetadata("digplayer"))
                    player.SetMetadata("digplayer", new DigPlayer(player));

                 digPlayer = (DigPlayer)player.GetMetadata("digplayer");
            }

            if (mining)
            {
                InventoryItem temp = ItemManager.GetItemFromOreId(block.Id);
                if (temp != null)
                {
                    Ore ore = ItemManager.GetOreByName(temp.Name);
                    blockId = 414;

                    if (digPlayer.digLevel >= Convert.ToInt32(ore.LevelRequired))
                    {
                        if (digHardness[x, y] <= digStrength)
                        {
                            digHardness[x, y] = 0F;

                            InventoryItem newsak = new InventoryItem(temp);

                            digPlayer.Inventory.AddItem(newsak, 1);
                            int oldLevel = digPlayer.digLevel;
                            digPlayer.digXp += Convert.ToInt32(ore.XPGain);
                            int newLevel = digPlayer.digLevel;
                            if (newLevel > oldLevel)
                                player.Reply("You have leveled up to level " + newLevel + "!");
                        }
                    }
                    else
                    {
                        return;
                    }

                }
            }

            if (explosion)
                blockId = 414;

            switch (block.Id)
            {
                case BlockIds.Blocks.Sand.BROWN:
                    blockId = 414;
                    blockXp = 0.08f;
                    break;

                case BlockIds.Blocks.Sand.GRAY:
                    blockId = 414;
                    blockXp = 0.1f;
                    break;

                case 1022: // gray bricks
                    blockId = 414;
                    blockXp = 0.2f;
                    break;

                case BlockIds.Blocks.JungleRuins.BLUE:
                    blockId = BlockIds.Action.Liquids.WATER;
                    blockXp = 0.1f;
                    break;

                case 21:
                    blockId = 369; //BlockIds.Action.Liquids.MUD;
                    blockXp = 0.1f;
                    break;

                default:
                    if (blockId == -1)
                        return;
                    else
                        break;
            }

            digHardness[x, y] -= digStrength;

            if (digHardness[x, y] <= 0)
            {
                digHardness[x, y] = 0f;

                bot.Room.setBlock(x, y, new NormalBlock(blockId));
//.........这里部分代码省略.........
开发者ID:CheeseSoftware,项目名称:MasterDig,代码行数:101,代码来源:MasterDig.cs

示例5: EndRecord

 private void EndRecord(IPlayer player)
 {
     List<IEditChange> record = (List<IEditChange>)recordingPlayer.GetMetadata("worldeditrecord");
     if (record.Count > 0)
     {
         if (!player.HasMetadata("worldedithistory"))
             player.SetMetadata("worldedithistory", new List<IEditChange>());
         List<IEditChange> history = (List<IEditChange>)player.GetMetadata("worldedithistory");
         history.Add(new EditChangeList((List<IEditChange>)record));
         if (!player.HasMetadata("worldedithistoryindex"))
             player.SetMetadata("worldedithistoryindex", 0);
         else
             player.SetMetadata("worldedithistoryindex", ((int)player.GetMetadata("worldedithistoryindex")) + 1);
     }
     player.RemoveMetadata("worldeditrecord");
     recordingPlayer = null;
 }
开发者ID:CheeseSoftware,项目名称:MasterBot,代码行数:17,代码来源:WorldEdit.cs

示例6: BeginRecord

 private void BeginRecord(IPlayer player)
 {
     player.SetMetadata("worldeditrecord", new List<IEditChange>());
     recordingPlayer = player;
 }
开发者ID:CheeseSoftware,项目名称:MasterBot,代码行数:5,代码来源:WorldEdit.cs

示例7: MakeZombie

 private void MakeZombie(IPlayer human)
 {
     human.SetMetadata("ost.zombieCreationTime", DateTime.Now);
     bot.ChatSayer.Say(human.Name + " has turned into a zombie! Run!!!");
     ForceToZombie(human);
 }
开发者ID:CheeseSoftware,项目名称:MasterBot,代码行数:6,代码来源:Zombies.cs

示例8: ForceToZombie

        private void ForceToZombie(IPlayer human)
        {
            human.SetMetadata("forcing", true);
            human.SetMetadata("zombieForcing", true);

            human.SetMetadata("ost.isZombie", true);
            human.SetMetadata("ost.health", (float)100);

            System.Threading.Tasks.Task task = new System.Threading.Tasks.Task(delegate
            {
                double oldX = human.BlockX;
                double oldY = human.BlockY;

                if (this.hologram != null)
                    bot.ChatSayer.Command("/teleport " + human.Name + " " + (int)(hologram.X + 1) + " " + (int)(hologram.Y - 1));

                System.Threading.Thread.Sleep(1000);
                bot.ChatSayer.Command("/kill " + human.Name);
                //bot.ChatSayer.Command("/teleport " + human.Name + " " + oldX + " " + oldY);
                System.Threading.Thread.Sleep(1000);
                bot.ChatSayer.Command("/teleport " + human.Name + " " + oldX + " " + oldY);

                System.Threading.Thread.Sleep(1000);
                human.RemoveMetadata("zombieForcing");
                human.RemoveMetadata("forcing");
            });
            task.Start();
        }
开发者ID:CheeseSoftware,项目名称:MasterBot,代码行数:28,代码来源:Zombies.cs

示例9: ForceToNormal

        private void ForceToNormal(IPlayer zombie)
        {
            zombie.SetMetadata("forcing", true);
            zombie.SetMetadata("humanForcing", true);

            zombie.RemoveMetadata("ost.isZombie");
            zombie.RemoveMetadata("ost.zombieCreationTime");
            zombie.SetMetadata("ost.health", (float)100);

            System.Threading.Tasks.Task task = new System.Threading.Tasks.Task(delegate
            {
                double oldX = zombie.X;
                double oldY = zombie.Y;

                if (this.cake != null)
                    bot.ChatSayer.Command("/teleport " + zombie.Name + " " + (int)(cake.X + 1) + " " + (int)(cake.Y - 1));

                System.Threading.Thread.Sleep(500);
                bot.ChatSayer.Command("/kill " + zombie.Name);
                //bot.ChatSayer.Command("/teleport " + zombie.Name + " " + oldX + " " + oldY);
                System.Threading.Thread.Sleep(500);
                bot.ChatSayer.Command("/teleport " + zombie.Name + " " + oldX + " " + oldY);

                System.Threading.Thread.Sleep(1000);
                zombie.RemoveMetadata("humanForcing");
                zombie.RemoveMetadata("forcing");
            });
            task.Start();
        }
开发者ID:CheeseSoftware,项目名称:MasterBot,代码行数:29,代码来源:Zombies.cs

示例10: FromPlayer

 public static DigPlayer FromPlayer(IPlayer player)
 {
     if (!player.HasMetadata("digplayer"))
         player.SetMetadata("digplayer", new DigPlayer(player));
     return (DigPlayer)player.GetMetadata("digplayer");
 }
开发者ID:CheeseSoftware,项目名称:MasterDig,代码行数:6,代码来源:DigPlayer.cs

示例11: getPlayerData

        private GodRunPlayer getPlayerData(IPlayer player)
        {
            if (!player.HasMetadata("GodRunPlayer"))
                player.SetMetadata("GodRunPlayer", new GodRunPlayer(player));

            return player.GetMetadata("GodRunPlayer") as GodRunPlayer;
        }
开发者ID:CheeseSoftware,项目名称:MasterBot,代码行数:7,代码来源:RunFromGods.cs


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