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


C# Player.getTarget方法代码示例

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


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

示例1: handlePacket

        public void handlePacket(Player player, Packet packet) {
		    int size = packet.getLength();
		    if(packet.getPacketId() == PacketHandlers.PacketId.WALK_2) {
			    size -= 14;
		    }
            player.getWalkingQueue().resetWalkingQueue();
		    int steps = (size - 5) / 2;

            if (steps > WalkingQueue.MAX_WALKING_WAYPOINTS)
            {
                misc.WriteError("Warning: Walk command contains too many steps (" + steps + ") currently set to 50 [maybe need increase?]");
                return;
            }

            player.getWalkingQueue().setIsRunning(packet.readByteA() == 1);
		    bool following = false;
            if (!canWalk(player, packet, following))
            {
                player.getPackets().clearMapFlag();
                player.getWalkingQueue().resetWalkingQueue();
                return;
            }

            int firstX = packet.readUShort() - (player.getLocation().getRegionX() - 6) * 8;
            int firstY = packet.readShortA() - (player.getLocation().getRegionY() - 6) * 8;
		    player.getWalkingQueue().addToWalkingQueue(firstX, firstY);

            for (int i = 0; i < steps; i++) //all the waypoints.
                player.getWalkingQueue().addToWalkingQueue((packet.readByteA() + firstX), (packet.readByteS() + firstY));

            if (player.getTeleportTo() != null) //is teleporting?
                player.getWalkingQueue().resetWalkingQueue();


		    if (player.getTemporaryAttribute("homeTeleporting") != null) {
			    player.removeTemporaryAttribute("homeTeleporting");
		    }
		    SkillHandler.resetAllSkills(player);
		    if (player.getTrade() != null)
			    player.getTrade().decline();
            if (player.getDuel() != null) {
                if (player.getDuel().getStatus() < 4)
                    player.getDuel().declineDuel();
                else if (player.getDuel().getStatus() == 8)
                    player.getDuel().recieveWinnings(player);
            }
			if (player.getTarget() != null) {
				if (!following && player.getTarget().getAttacker() != null && player.getTarget().getAttacker().Equals(player))
					player.getTarget().setAttacker(null);
			}		    
            
            if (!following) {
			    player.getFollow().setFollowing(null);
				player.setTarget(null);
				player.removeTemporaryAttribute("autoCasting");
			    if (player.getEntityFocus() != 65535)
				    player.setEntityFocus(65535);
		    }
		    player.getPackets().closeInterfaces();
	    }
开发者ID:slapglif,项目名称:runescape-server-csharp,代码行数:60,代码来源:Walk.cs

示例2: canWalk

 private bool canWalk(Player player, Packet packet, bool following)
 {
     if (player.getTemporaryAttribute("smeltingBar") != null) {
         Smelting.setAmountToZero(player);
         return false;
     } else if (player.getTemporaryAttribute("teleporting") != null && player.getTemporaryAttribute("homeTeleporting") == null) {
         return false;
     } else if (player.isFrozen()) {
         player.getPackets().sendMessage("A magic force prevents you from moving!");
         return false;
     } else if (player.getDuel() != null) {
         if (player.getDuel().ruleEnabled(DuelSession.RULE.NO_MOVEMENT)) {
             if (player.getDuel().getStatus() == 5 || player.getDuel().getStatus() == 6) {
                 if(player.getTarget() == null)
                     player.getPackets().sendMessage("Movement is disabled for this duel.");
                 return false;
             }
         }
     } else if (player.getTemporaryAttribute("unmovable") != null || player.getTemporaryAttribute("cantDoAnything") != null) {
         return false;
     } else if (player.isDead()) {
         return false;
     }
     else if (player.getTeleportTo() != null)
     {
         return false;
     }
     return true;
 }
开发者ID:slapglif,项目名称:runescape-server-csharp,代码行数:29,代码来源:Walk.cs


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