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


C# Player.getRights方法代码示例

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


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

示例1: execute

 public static void execute(Player player, string command)
 {
     string name = "";
     string[] arguments = new string[0];
     int hasCommand = command.IndexOf(' ');
     if (hasCommand > -1) {
         name = command.Substring(0, hasCommand);
         arguments = command.Substring(hasCommand + 1).Split(' ');
     } else {
         name = command;
     }
     name = name.ToLower();
     Command handleCommand;
     if(commands.TryGetValue(name, out handleCommand)) {
         if (player.getRights() >= handleCommand.minimumRightsNeeded())
         {
             handleCommand.execute(player, arguments);
         }
     }
 }
开发者ID:Krill156,项目名称:SharpEMU,代码行数:20,代码来源:CommandManager.cs

示例2: appendChatTextUpdate

 private static void appendChatTextUpdate(Player p, PacketBuilder updateBlock)
 {
     updateBlock.addLEShort((p.getLastChatMessage().getColour() << 8) + p.getLastChatMessage().getEffect());
     updateBlock.addByte((byte)p.getRights());
     byte[] chatStr = p.getLastChatMessage().getPacked();
     updateBlock.addByte((byte)(chatStr.Length));
     updateBlock.addBytesReverse(chatStr, chatStr.Length, 0);
     //}
 }
开发者ID:Krill156,项目名称:SharpEMU,代码行数:9,代码来源:PlayerUpdate.cs

示例3: savePlayer

        public bool savePlayer(Player p)
        {
            if (p == null) return false;
            try
            {
                string username = p.getLoginDetails().getUsername().ToLower();

                /* Character saving code goes here */
                XmlTextWriter writer = new XmlTextWriter(misc.getServerPath() + @"\accounts\" + username + ".xml", null);
                writer.Formatting = Formatting.Indented;
                writer.WriteStartElement("Player");
                    writer.WriteStartElement("Login");
                        writer.WriteElementString("Password", p.getLoginDetails().getPassword());
                        writer.WriteElementString("Rights", p.getRights().ToString());
                        writer.WriteElementString("BankPin", p.getBank().getBankPin());
                    writer.WriteEndElement();

                    writer.WriteStartElement("Position");
                        writer.WriteElementString("X", p.getLocation().getX().ToString());
                        writer.WriteElementString("Y", p.getLocation().getY().ToString());
                        writer.WriteElementString("Z", p.getLocation().getZ().ToString());
                    writer.WriteEndElement();

                    writer.WriteStartElement("Settings");
                        writer.WriteElementString("RunEnergy", p.getRunEnergy().ToString());
                        writer.WriteStartElement("PrivacySettings");
                            writer.WriteElementString("Public", p.getFriends().getPrivacyOption(0).ToString());
                            writer.WriteElementString("Private", p.getFriends().getPrivacyOption(1).ToString());
                            writer.WriteElementString("Trade", p.getFriends().getPrivacyOption(2).ToString());
                        writer.WriteEndElement();
                    writer.WriteEndElement();

                    writer.WriteStartElement("Friends");
                        foreach(long friend in p.getFriends().getFriendsList())
                            writer.WriteElementString("Friend", friend.ToString());
                    writer.WriteEndElement();

                    writer.WriteStartElement("Ignores");
                        foreach (long ignore in p.getFriends().getIgnoresList())
                            writer.WriteElementString("Ignore", ignore.ToString());
                    writer.WriteEndElement();

                    writer.WriteStartElement("Stats");
                        foreach (Skills.SKILL skill in Enum.GetValues(typeof(Skills.SKILL))) {
                             writer.WriteStartElement(skill.ToString()); //skill name.
                                writer.WriteElementString("CurrentLevel", p.getSkills().getCurLevel(skill).ToString());
                                writer.WriteElementString("XP", p.getSkills().getXp(skill).ToString());
                            writer.WriteEndElement();
                        }
                    writer.WriteEndElement();

                    Item item;
                    writer.WriteStartElement("EquipmentItems");
                    foreach (ItemData.EQUIP equip in Enum.GetValues(typeof(ItemData.EQUIP))) {
                        if (equip == ItemData.EQUIP.NOTHING) continue;
                        item = p.getEquipment().getSlot(equip);
                        if (item.getItemId() == -1) continue; //empty slot.

                        writer.WriteStartElement(equip.ToString());
                            writer.WriteElementString("Id", item.getItemId().ToString());
                            writer.WriteElementString("Amount", item.getItemAmount().ToString());
                        writer.WriteEndElement();
                    }
                    writer.WriteEndElement();

                    writer.WriteStartElement("InventoryItems");
                        for (int i = 0; i < Inventory.MAX_INVENTORY_SLOTS; i++) {
                            item = p.getInventory().getSlot(i);
                            if (item.getItemId() == -1) continue; //empty slot.

                            writer.WriteStartElement("Item");
                                writer.WriteElementString("Slot", i.ToString());
                                writer.WriteElementString("Id", item.getItemId().ToString());
                                writer.WriteElementString("Amount", item.getItemAmount().ToString());
                            writer.WriteEndElement();
                        }
                    writer.WriteEndElement();

                    writer.WriteStartElement("BankItems");
                    for (int i = 0; i < Bank.MAX_BANK_SLOTS; i++)
                    {
                        item = p.getBank().getSlot(i);
                        if (item.getItemId() == -1) continue; //empty slot.

                        writer.WriteStartElement("Item");
                            writer.WriteElementString("Slot", i.ToString());
                            writer.WriteElementString("Id", item.getItemId().ToString());
                            writer.WriteElementString("Amount", item.getItemAmount().ToString());
                        writer.WriteEndElement();
                    }
                    writer.WriteEndElement();
                writer.WriteEndElement();
                //Write the XML to file and close the writer
                writer.Close();
            }
            catch (Exception)
            {
                return false;
            }

//.........这里部分代码省略.........
开发者ID:Krill156,项目名称:SharpEMU,代码行数:101,代码来源:LoginHandler.cs


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