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


C# Player.getUpdateFlags方法代码示例

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


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

示例1: execute

        public void execute(Player player, string[] arguments)
        {
            if (arguments.Length == 0)
            {
                player.getPackets().sendMessage("[PlayerAsNpc command]: ::pnpc npcId");
                return;
            }

            int npcId = 0;
            if (!int.TryParse(arguments[0], out npcId))
            {
                player.getPackets().sendMessage("[PlayerAsNpc command]: ::pnpc npcId [npcId is not a number error]");
                return;
            }

            player.getAppearance().setNpcId(npcId);
            player.getUpdateFlags().setAppearanceUpdateRequired(true);
        }
开发者ID:Krill156,项目名称:SharpEMU,代码行数:18,代码来源:PlayerAsNpc.cs

示例2: levelUp

        public static void levelUp(Player player, SKILL skill)
        {
            int skillIndex = Convert.ToInt32(skill);
            String s = "<br><br><br>";
            String s1 = "<br><br><br><br>";
            if (player.getTemporaryAttribute("teleporting") == null)
            {
                player.setLastGraphics(new Graphics(199, 0, 100));
            }

            int skillFlashFlags = (int)(player.getTemporaryAttribute("skillFlashFlags") == null ? 0 : (int)player.getTemporaryAttribute("skillFlashFlags"));
            skillFlashFlags |= SKILL_FLASH_BITMASKS[skillIndex];
            player.setTemporaryAttribute("skillFlashFlags", skillFlashFlags);

            player.getPackets().sendMessage("You've just advanced a " + SKILL_NAME[skillIndex] + " level! You have reached level " + player.getSkills().getMaxLevel(skillIndex) + ".");
            player.getPackets().modifyText(s + "Congratulations, you have just advanced a " + SKILL_NAME[skillIndex] + " level!", 740, 0);
            player.getPackets().modifyText(s1 + "You have now reached level " + player.getSkills().getMaxLevel(skillIndex) + ".", 740, 1);
            player.getPackets().modifyText("", 740, 2);
            player.getPackets().sendConfig(1179, SKILL_ICON_BITMASKS[skillIndex] | skillFlashFlags); //start flashing appropriate skill icons
            player.getPackets().sendChatboxInterface2(740);
            player.getUpdateFlags().setAppearanceUpdateRequired(true);
        }
开发者ID:Krill156,项目名称:SharpEMU,代码行数:22,代码来源:Skills.cs

示例3: appendUpdateBlock

        private static void appendUpdateBlock(Player p, PacketBuilder updateBlock, bool forceAppearance)
        {
            int mask = 0x0;

            AppearanceUpdateFlags flags = p.getUpdateFlags();
            if (flags.isChatTextUpdateRequired())
            {
                mask |= 0x80;
            }
            if (flags.isHitUpdateRequired())
            {
                mask |= 0x1;
            }
            if (flags.isEntityFocusUpdateRequired())
            {
                mask |= 0x2;
            }
            if (flags.isAppearanceUpdateRequired() || forceAppearance)
            {
                mask |= 0x4;
            }
            if (flags.isAnimationUpdateRequired())
            {
                mask |= 0x8;
            }
            if (flags.isForceTextUpdateRequired())
            {
                mask |= 0x20;
            }
            if (flags.isFaceLocationUpdateRequired())
            {
                mask |= 0x40;
            }
            if (flags.isGraphicsUpdateRequired())
            {
                mask |= 0x100;
            }
            if (flags.isHit2UpdateRequired())
            {
                mask |= 0x200;
            }
            if (flags.isForceMovementRequired())
            {
                mask |= 0x400; //mask |= 0x800;
            }

            if (mask >= 0x100) //0x100=256 [full byte], so use two bytes.
            {
                mask |= 0x10;
                updateBlock.addLEShort(mask);

                //updateBlock.addByte((byte)(mask & 0xFF));
                //updateBlock.addByte((byte)(mask >> 8));
            }
            else
            {
                updateBlock.addByte((byte)(mask & 0xFF));
            }

            if (flags.isChatTextUpdateRequired())
            {
                appendChatTextUpdate(p, updateBlock);
            }
            if (flags.isHitUpdateRequired())
            {
                appendHitUpdate(p, updateBlock);
            }
            if (flags.isAnimationUpdateRequired())
            {
                appendAnimationUpdate(p, updateBlock);
            }
            if (flags.isAppearanceUpdateRequired() || forceAppearance)
            {
                appendAppearanceUpdate(p, updateBlock);
            }
            if (flags.isEntityFocusUpdateRequired())
            {
                appendFaceEntityUpdate(p, updateBlock);
            }
            if (flags.isForceMovementRequired())
            {
                appendForceMovement(p, updateBlock);
            }
            if (flags.isForceTextUpdateRequired())
            {
                appendForceTextUpdate(p, updateBlock);
            }
            if (flags.isHit2UpdateRequired())
            {
                appendHit2Update(p, updateBlock);
            }
            if (flags.isGraphicsUpdateRequired())
            {
                appendGraphicsUpdate(p, updateBlock);
            }
            if (flags.isFaceLocationUpdateRequired())
            {
                appendFaceLocationUpdate(p, updateBlock);
            }
        }
开发者ID:Krill156,项目名称:SharpEMU,代码行数:100,代码来源:PlayerUpdate.cs

示例4: update

        /**
         * Update the specified player.
         * @param p
         */
        public static void update(Player player)
        {
            //Creates a list of new players in area. [This only happens once.. no rebuilding like all World 2 servers.]
            player.getLocalEnvironment().updatePlayersInArea();

            //Attempt to skip a pointless update if possible.
            //Any current users on screen got a update for me.
            bool hasAppearanceUpdate = player.getLocalEnvironment().getSeenPlayers().Exists(new Predicate<Player>(delegate(Player p) { return p.getUpdateFlags().hasAnyUpdate(); }));
            //No new pending players and no players pending to get removed from screen.
            bool hasAddRemoveUpdate = (player.getLocalEnvironment().getNewPlayers().Count > 0 || player.getLocalEnvironment().getRemovedPlayers().Count > 0);
            //no updates.. exit.

            if (!hasAppearanceUpdate && !hasAddRemoveUpdate && !player.getUpdateFlags().hasAnyUpdate() && !player.getUpdateFlags().didMapRegionChange() && player.getConnection().getPingCount() < 7) return;

            player.getConnection().resetPingCount();

            if(player.getUpdateFlags().didMapRegionChange())
                player.getPackets().sendMapRegion();

            PacketBuilder mainPacket = new PacketBuilder().setId(225).setSize(Packet.Size.VariableShort).initBitAccess();
            PacketBuilder updateBlock = new PacketBuilder().setSize(Packet.Size.Bare);

            if (player.getUpdateFlags().isTeleporting()) { //teleport
                mainPacket.addBits(1, 1);
                mainPacket.addBits(2, 3);
                mainPacket.addBits(7, player.getLocation().getLocalY(player.getUpdateFlags().getLastRegion())); //currentX
                mainPacket.addBits(1, 1);
                mainPacket.addBits(2, player.getLocation().getZ()); //heightLevel
                mainPacket.addBits(1, player.getUpdateFlags().isUpdateRequired() ? 1 : 0);
                mainPacket.addBits(7, player.getLocation().getLocalX(player.getUpdateFlags().getLastRegion())); //currentY
            } else {
                if (player.getSprites().getPrimarySprite() == -1) { //no movement
                    mainPacket.addBits(1, player.getUpdateFlags().isUpdateRequired() ? 1 : 0);
                    if (player.getUpdateFlags().isUpdateRequired())
                        mainPacket.addBits(2, 0);
                } else { //movement.
                    mainPacket.addBits(1, 1);
                    if (player.getSprites().getSecondarySprite() == -1) { //not running
                        mainPacket.addBits(2, 1);
                        mainPacket.addBits(3, player.getSprites().getPrimarySprite()); //walk
                        mainPacket.addBits(1, player.getUpdateFlags().isUpdateRequired() ? 1 : 0);
                    } else {
                        mainPacket.addBits(2, 2);
                        mainPacket.addBits(1, 1);
                        mainPacket.addBits(3, player.getSprites().getPrimarySprite()); //walk
                        mainPacket.addBits(3, player.getSprites().getSecondarySprite()); //run
                        mainPacket.addBits(1, player.getUpdateFlags().isUpdateRequired() ? 1 : 0);
                    }
                }
            }
            if(player.getUpdateFlags().isUpdateRequired())
                appendUpdateBlock(player, updateBlock, false); //update my own updates.

            mainPacket.addBits(8, player.getLocalEnvironment().getSeenPlayers().Count); //All players I've seen already (not new players)

            //Send information of all the players in our own location.
            foreach (Player p in player.getLocalEnvironment().getSeenPlayers())
            {
                if (player.getLocalEnvironment().getRemovedPlayers().Contains(p)) {
                    mainPacket.addBits(1, 1); //update required.
                    mainPacket.addBits(2, 3); //delete player.
                    continue;
                } else if (p.getSprites().getPrimarySprite() == -1) {
                    if(p.getUpdateFlags().isUpdateRequired()) {
                        mainPacket.addBits(1, 1); //update required.
                        mainPacket.addBits(2, 0); //finish
                    } else {
                        mainPacket.addBits(1, 0); //no update required, either region changed or no movement change.
                    }
                } else if (p.getSprites().getPrimarySprite() != -1 && p.getSprites().getSecondarySprite() == -1) {
                    mainPacket.addBits(1, 1); //update required.
                    mainPacket.addBits(2, 1); //update just walk direction sprite
                    mainPacket.addBits(3, p.getSprites().getPrimarySprite());
                    mainPacket.addBits(1, p.getUpdateFlags().isUpdateRequired() ? 1 : 0);
                } else if (p.getSprites().getPrimarySprite() != -1 && p.getSprites().getSecondarySprite() != -1) { //Bit 2 = 2, updates both sprites.
                    mainPacket.addBits(1, 1); //update required.
                    mainPacket.addBits(2, 2); //update both walk & run sprites.
                    mainPacket.addBits(1, 1);
                    mainPacket.addBits(3, p.getSprites().getPrimarySprite());
                    mainPacket.addBits(3, p.getSprites().getSecondarySprite());
                    mainPacket.addBits(1, p.getUpdateFlags().isUpdateRequired() ? 1 : 0);
                }
                if (p.getUpdateFlags().isUpdateRequired())
                    appendUpdateBlock(p, updateBlock, false);
             }

            //Send information of all the new players in our own location.
            foreach (Player p in player.getLocalEnvironment().getNewPlayers())
            {
                mainPacket.addBits(11, p.getIndex()); //playerId of new player.

                int yPos = p.getLocation().getY() - player.getLocation().getY();
                int xPos = p.getLocation().getX() - player.getLocation().getX();

                mainPacket.addBits(1, 1);
                mainPacket.addBits(5, xPos < 0 ? xPos + 32 : xPos);
//.........这里部分代码省略.........
开发者ID:Krill156,项目名称:SharpEMU,代码行数:101,代码来源:PlayerUpdate.cs

示例5: appendForceMovement

 private static void appendForceMovement(Player p, PacketBuilder updateBlock)
 {
     Location myLocation = p.getUpdateFlags().getLastRegion();
     ForceMovement fm = p.getForceMovement();
     updateBlock.addByteC(fm.getX1());
     updateBlock.addByte((byte)(fm.getY1()));
     updateBlock.addByteA(fm.getX2());
     updateBlock.addByte((byte)fm.getY2());
     updateBlock.addLEShort(fm.getSpeed1());
     updateBlock.addLEShort(fm.getSpeed2());
     updateBlock.addByteC(fm.getDirection());
 }
开发者ID:Krill156,项目名称:SharpEMU,代码行数:12,代码来源:PlayerUpdate.cs


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