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


C# Player.setTrade方法代码示例

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


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

示例1: unregister

        /**
         * Unregister a player.
         * @param p as Player
         */
        public static void unregister(Player p)
        {
            if (p.getTrade() != null)
            {
                p.getTrade().decline();
                p.setTrade(null);
            }
            minigames.getFightPits().removeWaitingPlayer(p);
            minigames.getFightPits().removePlayingPlayer(p);
            if (p.getTemporaryAttribute("cantDoAnything") != null && Location.inFightPits(p.getLocation()))
            {
                minigames.getFightPits().useOrb(p, 5);
                return;
            }
            if (Location.inFightPits(p.getLocation()))
            {
                Server.getMinigames().getFightPits().teleportToWaitingRoom(p, false);
                return;
            }
            if (p.getFightCave() != null)
            {
                if (!p.getFightCave().isGamePaused())
                {
                    p.getFightCave().teleFromCave(true);
                    return;
                }
                else
                {
                    p.setLocation(new Location(2439, 5169, 0));
                }
            }
            if (!Combat.isXSecondsSinceCombat(p, p.getLastAttacked(), 10000) || p.isDead() || p.getTemporaryAttribute("unmovable") != null)
            {
                return;
            }
            if (p.getDuel() != null)
            {
                if (p.getDuel().getStatus() == 8)
                {
                    if (p.getDuel().getWinner().Equals(p))
                    {
                        p.getDuel().recieveWinnings(p);
                    }
                }
                else
                {
                    if (p.getDuel().getStatus() == 5 || p.getDuel().getStatus() == 6)
                    {
                        p.getDuel().finishDuel(true, true);
                    }
                }
            }
            removeAllPlayersNPCs(p);

           
            foreach(Player p2 in players) {
                if(p == p2) continue;
                //Remove me from anyone who has Seen me.. or attempting to see me (new players).
                if (p2.getLocalEnvironment().getSeenPlayers().Contains(p) || p2.getLocalEnvironment().getNewPlayers().Contains(p))
                    p2.getLocalEnvironment().getRemovedPlayers().Add(p);
            }

            clanManager.leaveChannel(p);
            loginHandler.addSavePlayer(p);
            players.Remove(p);
            p.getFriends().unregistered();
            Console.WriteLine("Unregistered " + p.getLoginDetails().getUsername() + " [online = " + players.Count + "]");
        }
开发者ID:slapglif,项目名称:runescape-server-csharp,代码行数:72,代码来源:Server.cs

示例2: handleTradePlayer

	    private void handleTradePlayer(Player player, Packet packet) {
		    int index = packet.readLEShortA();
		    if(index < 0 || index >= Constants.MAX_PLAYERS || player.isDead() || player.getTemporaryAttribute("cantDoAnything") != null) {
			    return;
		    }
		    SkillHandler.resetAllSkills(player);
		    Player p2 = Server.getPlayerList()[index];
		    if (p2 == null) {
			    return;
		    }
		    player.setFaceLocation(p2.getLocation());
		    if(player.getTrade() != null) {
			    player.getTrade().decline();
			    return;
		    }
		    player.getPackets().closeInterfaces();
		    if (!player.getLocation().withinDistance(p2.getLocation(), 1)) {
			    int x = p2.getLocation().getX();
			    int y = p2.getLocation().getY();
                AreaEvent tradePlayerAreaEvent = new AreaEvent(player, x-1, y-1, x+1, y+1);
                tradePlayerAreaEvent.setAction(() => {
                    player.getWalkingQueue().resetWalkingQueue();
                    player.getPackets().clearMapFlag();
				    if (p2.getGESession() != null || p2.getTrade() != null || p2.getDuel() != null || p2.getShopSession() != null || p2.getBank().isBanking()) {
                        player.getPackets().sendMessage("That player is busy at the moment.");
					    return;
				    }
				    if (p2.wantsToTrade(player)) {
                        player.getPackets().closeInterfaces();
                        p2.getPackets().closeInterfaces();
					    p2.setFaceLocation(player.getLocation());
					    player.setTrade(new TradeSession(player, p2));
					    p2.setTrade(new TradeSession(p2, player));
					    return;
				    }
				    player.setFaceLocation(p2.getLocation());
                    p2.getPackets().sendMessage(player.getLoginDetails().getUsername() + ":tradereq:");
                    player.getPackets().sendMessage("Sending trade offer...");
				    player.newTradeRequest(p2);
			    });
                Server.registerCoordinateEvent(tradePlayerAreaEvent);
			    return;
		    }
		    if (p2.getGESession() != null || p2.getTrade() != null || p2.getDuel() != null || p2.getShopSession() != null || p2.getBank().isBanking()) {
			    player.getPackets().sendMessage("That player is busy at the moment.");
			    return;
		    }
		    if (p2.wantsToTrade(player)) {
                player.getPackets().closeInterfaces();
                p2.getPackets().closeInterfaces();
			    p2.setFaceLocation(player.getLocation());
			    player.setTrade(new TradeSession(player, p2));
			    p2.setTrade(new TradeSession(p2, player));
			    return;
		    }
		    player.newTradeRequest(p2);
            p2.getPackets().sendMessage(player.getLoginDetails().getUsername() + ":tradereq:");
            player.getPackets().sendMessage("Sending trade offer...");
	    }
开发者ID:slapglif,项目名称:runescape-server-csharp,代码行数:59,代码来源:PlayerInteract.cs


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