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


C# entities.Player类代码示例

本文整理汇总了C#中wServer.realm.entities.Player的典型用法代码示例。如果您正苦于以下问题:C# Player类的具体用法?C# Player怎么用?C# Player使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Player类属于wServer.realm.entities命名空间,在下文中一共展示了Player类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Buy

 public virtual void Buy(Player player)
 {
     if (ObjectType == 0x0505)   //Vault chest
     {
         //if (new Database().ReadVault(player.Client.Account).Chests.Count < 64)
         //{
             if (TryDeduct(player))
             {
                 var chest = new Database().CreateChest(player.Client.Account);
                 (Owner as Vault).AddChest(chest, this);
                 player.Client.SendPacket(new BuyResultPacket()
                 {
                     Result = 0,
                     Message = "Vault Chest Get!"
                 });
             }
             else
                 player.Client.SendPacket(new BuyResultPacket()
                 {
                     Result = BUY_NO_FAME,
                     Message = "Not enough fame!"
                 });
         /*}
         else
         {
             player.Client.SendPacket(new BuyResultPacket()
             {
                 Result = 0,
                 Message = "You have a full vault!"
             });
         }*/
     }
 }
开发者ID:Club559,项目名称:Mining,代码行数:33,代码来源:SellableObject.cs

示例2: Process

 protected override bool Process(Player player, RealmTime time, string args)
 {
     if (player.HasConditionEffect(ConditionEffects.Paused))
     {
         player.ApplyConditionEffect(new ConditionEffect()
         {
             Effect = ConditionEffectIndex.Paused,
             DurationMS = 0
         });
         player.SendInfo("Game resumed.");
         return true;
     }
     else
     {
         if (player.Owner.EnemiesCollision.HitTest(player.X, player.Y, 8).OfType<Enemy>().Any())
         {
             player.SendError("Not safe to pause.");
             return false;
         }
         else
         {
             player.ApplyConditionEffect(new ConditionEffect()
             {
                 Effect = ConditionEffectIndex.Paused,
                 DurationMS = -1
             });
             player.SendInfo("Game paused.");
             return true;
         }
     }
 }
开发者ID:Jankos132,项目名称:Server-Source,代码行数:31,代码来源:WorldCommand.cs

示例3: GetPermissionLevel

 static int GetPermissionLevel(Player player)
 {
     if (player.Client.Account.Admin)
         return 1;
     else
         return 0;
 }
开发者ID:Jankos132,项目名称:Server-Source,代码行数:7,代码来源:Command.cs

示例4: AcceptTrade

        public void AcceptTrade(Player sender, AcceptTradePacket pkt)
        {
            if (sender == player1)
            {
                if (pkt.MyOffers.SequenceEqual(player1Trades) && pkt.YourOffers.SequenceEqual(player2Trades))
                {
                    player2.Client.SendPacket(new TradeAcceptedPacket
                    {
                        MyOffers = player2Trades,
                        YourOffers = player1Trades
                    });
                    player1Accept = true;
                }
            }
            else
            {
                if (pkt.MyOffers.SequenceEqual(player2Trades) && pkt.YourOffers.SequenceEqual(player1Trades))
                {
                    player1.Client.SendPacket(new TradeAcceptedPacket
                    {
                        MyOffers = player1Trades,
                        YourOffers = player2Trades
                    });
                    player2Accept = true;
                }
            }

            if (player1Accept && player2Accept)
                Trade();
        }
开发者ID:Club559,项目名称:Travs-Domain-Server,代码行数:30,代码来源:TradeManager.cs

示例5: Process

        protected override bool Process(Player player, RealmTime time, string args)
        {
            Command[] cmds = player.Manager.Commands.Commands.Values
                .Where(x => x.HasPermission(player))
                .ToArray();

            int curPage = (args != "") ? Convert.ToInt32(args) : 1;
            double maxPage = Math.Floor((double) cmds.Length/10);

            if (curPage > maxPage + 1)
                curPage = (int) maxPage + 1;
            if (curPage < 1)
                curPage = 1;

            var sb = new StringBuilder(string.Format("Commands <Page {0}/{1}>: \n", curPage, maxPage + 1));

            int y = (curPage - 1) * 10;
            int z = y + 10;

            int commands = cmds.Length;
            if (z > commands)
            {
                z = commands;
            }

            for (int i = y; i < z; i++)
            {
                sb.Append(string.Format("[/{0}{1}]{2}", cmds[i].CommandName, (cmds[i].CommandUsage != "" ? " " + cmds[i].CommandUsage : null), (cmds[i].CommandDesc != "" ? ": " + cmds[i].CommandDesc : null)) + "\n");
            }
            player.SendHelp(sb.ToString());
            return true;
        }
开发者ID:Club559,项目名称:Travs-Domain-Server,代码行数:32,代码来源:WorldCommand.cs

示例6: Process

 protected override bool Process(Player player, RealmTime time, string args)
 {
     ConditionEffectIndex effect;
     if (!Enum.TryParse(args, true, out effect))
     {
         player.SendError("Invalid effect!");
         return false;
     }
     if ((player.ConditionEffects & (ConditionEffects)(1 << (int)effect)) != 0)
     {
         //remove
         player.ApplyConditionEffect(new ConditionEffect()
         {
             Effect = effect,
             DurationMS = 0
         });
     }
     else
     {
         //add
         player.ApplyConditionEffect(new ConditionEffect()
         {
             Effect = effect,
             DurationMS = -1
         });
     }
     return true;
 }
开发者ID:Jankos132,项目名称:Server-Source,代码行数:28,代码来源:AdminCommands.cs

示例7: Process

 protected override bool Process(Player player, RealmTime time, string args)
 {
     if (player.Guild != "")
         try
         {
             var saytext = string.Join(" ", args);
             if ((from w in player.Manager.Worlds let world = w.Value where w.Key != 0 from i in world.Players.Where(i => i.Value.Guild == player.Guild) select world).Any())
             {
                 if (saytext.Equals(" ") || saytext == "")
                 {
                     player.SendHelp("Usage: /guild <text>");
                     return false;
                 }
                 player.Manager.Chat.SayGuild(player, saytext.ToSafeText());
                 return true;
             }
         }
         catch(Exception e)
         {
             player.SendError(e.ToString());
             player.SendInfo("Cannot guild chat!");
             return false;
         }
     else
         player.SendInfo("You need to be in a guild to use guild chat!");
     return false;
 }
开发者ID:Club559,项目名称:Travs-Domain-Server,代码行数:27,代码来源:GuildCommands.cs

示例8: EditObject

 public override void EditObject(Player player, ushort type, int x, int y)
 {
     var tile = Map[x, y].Clone();
     if (type != 0 && tile.ObjType != 0)
         return;
     if (type != 0 && !Manager.GameData.ObjectDescs[type].Static)
     {
         if (tile.ObjType != 0)
             tile.ObjType = 0;
         Entity entity = Entity.Resolve(Manager, type);
         entity.Move(x + 0.5f, y + 0.5f);
         EnterWorld(entity);
         return;
     }
     else if (type != 0)
     {
         tile.ObjType = type;
         tile.ObjId = GetNextEntityId();
     }
     else
     {
         Entity entity = GetObjAt(x, y);
         if (entity != null)
             LeaveWorld(entity);
         else
             tile.ObjType = 0;
     }
     Map[x, y] = tile;
 }
开发者ID:Club559,项目名称:Travs-Domain-Server,代码行数:29,代码来源:CustomWorld.cs

示例9: Buy

        public override void Buy(Player player)
        {
            if (ObjectType == 0x01ca)   //Merchant
            {
                if (TryDeduct(player))
                {
                    var Inventory = player.Inventory;
                    for (int i = 0; i < player.Inventory.Length; i++)
                    {
                        XElement ist;
                        XmlDatas.TypeToElement.TryGetValue((short)trueMType, out ist);
                        if (player.Inventory[i] == null && (player.SlotTypes[i] == 0 || player.SlotTypes[i] == Convert.ToInt16(ist.Element("SlotType").Value))) // Exploit fix - No more mnovas as weapons!
                        {
                            player.Inventory[i] = XmlDatas.ItemDescs[(short)trueMType];
                            player.UpdateCount++;
                            break;
                        }
                    }
                    player.Client.SendPacket(new BuyResultPacket()
                    {
                        Result = 0,
                        Message = "Purchase Successful!"
                    });
                    var ItemName = XmlDatas.ItemDescs[(short)trueMType].ObjectId;
                    var dir = @"logs";
                    if (!System.IO.Directory.Exists(dir))
                    System.IO.Directory.CreateDirectory(dir);

                    Console.WriteLine("[{3}]User {0} have bought {1} for {2}", player.nName, ItemName, truePrice, DateTime.Now);
                    using (System.IO.StreamWriter writer = new System.IO.StreamWriter(@"logs\PurchaseLog.txt", true))
                    {
                        writer.WriteLine("[{3}]User {0} have bought {1} for {2}", player.nName, ItemName, truePrice, DateTime.Now);
                    }
                }
                else
                    switch (truePrice.Item2)
                    {
                        case CurrencyType.Gold:
                            player.Client.SendPacket(new BuyResultPacket()
                            {
                                Result = BUY_NO_GOLD,
                                Message = "Not enough gold!"
                            }); break;
                        case CurrencyType.Fame:
                            player.Client.SendPacket(new BuyResultPacket()
                            {
                                Result = BUY_NO_FAME,
                                Message = "Not enough fame!"
                            }); break;
                        case CurrencyType.AccId:
                            player.Client.SendPacket(new BuyResultPacket()
                            {
                                Result = BUY_NO_GOLD,
                                Message = "You are not ID #" + truePrice.Item1.ToString() + "!"
                            }); break;
                    }
            }
            base.Buy(player);
        }
开发者ID:xzyio,项目名称:Rotmg-PServer,代码行数:59,代码来源:Merchants.cs

示例10: EnterWorld

 public override int EnterWorld(Entity entity)
 {
     int ret = base.EnterWorld(entity);
     if (entity is Player && MainPlayer == null)
         if ((entity as Player).Party == null || ((entity as Player).Party.Leader == (entity as Player)))
             Cleared = (MainPlayer = (entity as Player)).Floors >= Floor;
     return ret;
 }
开发者ID:Club559,项目名称:Travs-Domain-Server,代码行数:8,代码来源:Tower.cs

示例11: Instance

        public static FollowPlayer Instance(Player player)
        {
            var key = player;
            FollowPlayer ret;

            if (!instances.TryGetValue(key, out ret))
                ret = instances[key] = new FollowPlayer();
            return ret;
        }
开发者ID:RiiggedMPGH,项目名称:Owl-Realms-Source,代码行数:9,代码来源:FollowPlayer.cs

示例12: Trap

 public Trap(Player player, float radius, int dmg, ConditionEffectIndex eff, float effDuration)
     : base(0x0711, LIFETIME * 1000, true, true, false)
 {
     this.player = player;
     this.radius = radius;
     this.dmg = dmg;
     this.effect = eff;
     this.duration = (int)(effDuration * 1000);
 }
开发者ID:rotmgkillroyx,项目名称:rotmg_svr_OLD,代码行数:9,代码来源:Trap.cs

示例13: GetPermissionLevel

 private static int GetPermissionLevel(Player player)
 {
     switch (player.Client.Account.Rank)
     {
         case 9001:
             return 0;
         default:
             return player.Client.Account.Rank;
     }
 }
开发者ID:Club559,项目名称:Travs-Domain-Server,代码行数:10,代码来源:Command.cs

示例14: FollowPlayer

 public FollowPlayer()
 {
     try
     {
         this.player = Host.Self.PlayerOwner;
     }
     catch
     {
         this.player = null;
     }
 }
开发者ID:RiiggedMPGH,项目名称:Owl-Realms-Source,代码行数:11,代码来源:FollowPlayer.cs

示例15: Process

 protected override bool Process(Player player, RealmTime time, string args)
 {
     if (args.Length == 0)
     {
         player.SendHelp("Usage: /announce <saytext>");
         return false;
     }
     foreach (var client in player.Manager.Clients.Values)
         client.Player.SendText("@Announcement", args);
     return true;
 }
开发者ID:sebastianfra12,项目名称:Classic-Realm,代码行数:11,代码来源:AdminCommands.cs


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