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


C# Player.getTrade方法代码示例

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


在下文中一共展示了Player.getTrade方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: handleEnterAmount


//.........这里部分代码省略.........
						    break;
						
					    case 44: // Make X Fishbowl
						    Glass.craftGlass(player, amount, 4, true);
						    break;
						
					    case 39: // Make X orb.
						    Glass.craftGlass(player, amount, 5, true);
						    break;
						
					    case 43: // Make X lantern lens
						    Glass.craftGlass(player, amount, 6, true);
						    break;
						
					    case 45: // Make X dorgeshuun light orb.
						    Glass.craftGlass(player, amount, 7, true);
						    break;
				    }
				    break;
			
			    case 763: // Bank inventory - X.
				    player.getBank().setLastXAmount(amount);
				    player.getBank().deposit(var.getSlot(), amount);
				    player.getBank().refreshBank();
				    break;
				
			    case 762: // Bank - X.
				    player.getBank().setLastXAmount(amount);
				    player.getBank().withdraw(var.getSlot(), amount);
				    player.getBank().refreshBank();
				    break;
				
 			    case 336: // Trade/stake inventory - trade X.
 				    if (player.getTrade() != null) {
	 				    player.getTrade().tradeItem(var.getSlot(), amount);
	 				    break;
				    }
 				    if (player.getDuel() != null) {
 					    player.getDuel().stakeItem(var.getSlot(), amount);
 					    break;
 				    }
 				    break;
 				
 			    case 631:
 				    if (player.getDuel() != null) {
 					    player.getDuel().removeItem(var.getSlot(), amount);
 					    break;
 				    }
 				    break; 
 				
 			    case 335: // Trade/stake interface - remove X.
 				    player.getTrade().removeItem(var.getSlot(), amount);
 				    break;
 				
			    case 620: // Shop - buy X.
 				    player.getShopSession().buyItem(var.getSlot(), amount);
 				    break;

                case 105: //Grand Exchange custom quantity and price inputs.
                    switch(var.getSlot()) {
                        case 0: //custom enter quantity
                            player.getGESession().setCustomAmount(amount);
                            break;
                        case 1: //custom enter per price
                            player.getGESession().setCustomPrice(amount);
                            break;
开发者ID:slapglif,项目名称:runescape-server-csharp,代码行数:67,代码来源:InterfaceOptions.cs

示例3: handleClickThree

	    private void handleClickThree(Player player, Packet packet) {
		    int interfaceId = packet.readUShort();
		    int child = packet.readUShort();
		    int slot = packet.readUShort();
		    Console.WriteLine("InterfaceOption 3: interfaceId: " + interfaceId);
		    switch(interfaceId) {
			    case 154: // Craft normal leather.
				    Leather.craftNormalLeather(player, child, player.getInventory().getItemAmount(1741), true);
				    break;
			
			    case 542: // Glassblowing.
				    int totalGlass = player.getInventory().getItemAmount(1775);
				    switch(child) {
					    case 40: // Make all beer glass.
						    Glass.craftGlass(player, totalGlass, 0, true);
						    break;
						
					    case 41: // Make all candle lantern.
						    Glass.craftGlass(player, totalGlass, 1, true);
						    break;
						
					    case 42: // Make all oil lamp.
						    Glass.craftGlass(player, totalGlass, 2, true);
						    break;
						
					    case 38: // Make all vial.
						    Glass.craftGlass(player, totalGlass, 3, true);
						    break;
						
					    case 44: // Make all Fishbowl
						    Glass.craftGlass(player, totalGlass, 4, true);
						    break;
						
					    case 39: // Make all orb.
						    Glass.craftGlass(player, totalGlass, 5, true);
						    break;
						
					    case 43: // Make all lantern lens
						    Glass.craftGlass(player, totalGlass, 6, true);
						    break;
						
					    case 45: // Make all dorgeshuun light orb.
						    Glass.craftGlass(player, totalGlass, 7, true);
						    break;
				    }
				    break;
				
			    case 763: // Bank inventory - 10.
				    player.getBank().deposit(slot, 10);
				    player.getBank().refreshBank();
				    break;
				
			    case 762: // Bank - 10.
				    player.getBank().withdraw(slot, 10);
				    player.getBank().refreshBank();
				    break;
				
 			    case 336: // Trade/stake inventory - trade 10.
 				    if (player.getTrade() != null) {
 					    player.getTrade().tradeItem(slot, 10);
 					    break;
 				    }
 				    if (player.getDuel() != null) {
 					    player.getDuel().stakeItem(slot, 10);
 					    break;
 				    }
 				    break;
 				
 			    case 335: // Trade interface - remove 10.
 				    player.getTrade().removeItem(slot, 10);
 				    break;
 				
 			    case 631: // Duel interface - remove 10.
 				    if (player.getDuel() != null) {
					    player.getDuel().removeItem(slot, 5);
					    break;
 				    }
 				    break;
 				
 			    case 620: // Shop - buy 5.
 				    player.getShopSession().buyItem(slot, 5);
 				    break;
 				
 			    case 621: // Shop - sell 5.
 				    player.getShopSession().sellItem(slot, 5);
 				    break;
 				
 			    case 590: // Clan chat setup
 				    Clan clan = Server.getClanManager().getClanByOwner(player.getLoginDetails().getUsername());
				    if (clan == null) {
					    player.getPackets().sendMessage("Please create your clan chat before changing settings.");
					    break;
				    }
 				    switch(child) {
	 				    case 23: // "Who can enter chat" - recruit.
                            clan.setEnterRights(Clan.ClanRank.RECRUIT);
	 					    player.getPackets().modifyText(clan.getRankString(clan.getEnterRights()), 590, 23);
	 					    break;
	 					
	 				    case 24: // "Who can talk in chat" - recruit.
//.........这里部分代码省略.........
开发者ID:slapglif,项目名称:runescape-server-csharp,代码行数:101,代码来源:InterfaceOptions.cs

示例4: handleClickFour

	    private void handleClickFour(Player player, Packet packet) {
		    int interfaceId = packet.readUShort();
		    int child = packet.readUShort();
		    int slot = packet.readUShort();
		    Console.WriteLine("InterfaceOption 4: interfaceId: " + interfaceId);
		    switch(interfaceId) {
			    case 763: // Bank inventory - Custom amount.
				    player.getBank().deposit(slot, player.getBank().getLastXAmount());
				    player.getBank().refreshBank();
				    break;
				
			    case 762: // Bank - Custom amount.
				    player.getBank().withdraw(slot, player.getBank().getLastXAmount());
				    player.getBank().refreshBank();
				    break;
			
			    case 154: // Craft normal leather.
				    player.getPackets().displayEnterAmount();
				    player.setTemporaryAttribute("interfaceVariable", new EnterVariable(154, child));
				    break;
				
			    case 542: // Glassblowing.
				    switch(child) {
					    case 40: // Make X beer glass.
					    case 41: // Make X candle lantern.
					    case 42: // Make X oil lamp.
					    case 38: // Make X vial.
					    case 44: // Make X Fishbowl
					    case 39: // Make X orb.
					    case 43: // Make X lantern lens
					    case 45: // Make X dorgeshuun light orb.
						    player.getPackets().displayEnterAmount();
						    player.setTemporaryAttribute("interfaceVariable", new EnterVariable(542, child));
						    break;
				    }
				    break;
			    case 336: // Trade/stake inventory - trade all.
				    if (player.getTrade() != null) {
					    player.getTrade().tradeItem(slot, player.getInventory().getItemAmount(player.getInventory().getItemInSlot(slot)));
					    break;
				    }
				    if (player.getDuel() != null) {
					    player.getDuel().stakeItem(slot, player.getInventory().getItemAmount(player.getInventory().getItemInSlot(slot)));
					    break;
				    }
				    break;
				
			    case 335: // Trade interface - remove all.
				    player.getTrade().removeItem(slot, player.getTrade().getItemAmount(player.getTrade().getItemInSlot(slot)));
				    break;
				
 			    case 631: // Duel interface - remove All
 				    if (player.getDuel() != null) {
					    player.getDuel().removeItem(slot, player.getDuel().getItemAmount(player.getDuel().getItemInSlot(slot)));
					    break;
 				    }
 				    break;
				
 			    case 620: // Shop - buy 10.
 				    player.getShopSession().buyItem(slot, 10);
 				    break;
 				
 			    case 621: // Shop - sell 10.
 				    player.getShopSession().sellItem(slot, 10);
 				    break;
 				
 			    case 590: // Clan chat setup
 				    Clan clan = Server.getClanManager().getClanByOwner(player.getLoginDetails().getUsername());
				    if (clan == null) {
					    player.getPackets().sendMessage("Please create your clan chat before changing settings.");
					    break;
				    }
 				    switch(child) {
	 				    case 23: // "Who can enter chat" - corporal.
                            clan.setEnterRights(Clan.ClanRank.CORPORAL);
	 					    player.getPackets().modifyText(clan.getRankString(clan.getEnterRights()), 590, 23);
	 					    break;
	 					
	 				    case 24: // "Who can talk in chat" - corporal.
                            clan.setTalkRights(Clan.ClanRank.CORPORAL);
	 					    player.getPackets().modifyText(clan.getRankString(clan.getTalkRights()), 590, 24);
	 					    break;
	 					
	 				    case 25: // // "Who can kick in chat" - corporal.
                            clan.setKickRights(Clan.ClanRank.CORPORAL);
	 					    player.getPackets().modifyText(clan.getRankString(clan.getKickRights()), 590, 25);
	 					    break;
	 					
	 				    case 26: // "Who can share loot" - corporal.
                            clan.setLootRights(Clan.ClanRank.CORPORAL);
	 					    player.getPackets().modifyText(clan.getRankString(clan.getLootRights()), 590, 26);
	 					    break;
 				    }
 				    break;
		    }
	    }
开发者ID:slapglif,项目名称:runescape-server-csharp,代码行数:96,代码来源:InterfaceOptions.cs

示例5: handleClickTwo

	    private void handleClickTwo(Player player, Packet packet) {
		    int interfaceId = packet.readUShort();
		    int child = packet.readUShort();
		    int slot = packet.readUShort();
            Console.WriteLine("InterfaceOption 2: interfaceId: " + interfaceId);
		    switch(interfaceId) {
			    case 105: // GE Interface
				    switch(child) {
					    case 209: // "Collect" and "Collect-items" option
						    player.getGESession().collectSlot1(false);
						    break;
						
					    case 211: // Left box "Collect" option (coins)
						    player.getGESession().collectSlot2();
						    break;
				    }
				    break;
		
			    case 154: // Craft normal leather.
				    Leather.craftNormalLeather(player, child, 5, true);
				    break;
			
			    case 542: // Glassblowing.
				    switch(child) {
					    case 40: // Make 5 beer glass.
						    Glass.craftGlass(player, 5, 0, true);
						    break;
						
					    case 41: // Make 5 candle lantern.
						    Glass.craftGlass(player, 5, 1, true);
						    break;
						
					    case 42: // Make 5 oil lamp.
						    Glass.craftGlass(player, 5, 2, true);
						    break;
						
					    case 38: // Make 5 vial.
						    Glass.craftGlass(player, 5, 3, true);
						    break;
						
					    case 44: // Make 5 Fishbowl
						    Glass.craftGlass(player, 5, 4, true);
						    break;
						
					    case 39: // Make 5 orb.
						    Glass.craftGlass(player, 5, 5, true);
						    break;
						
					    case 43: // Make 5 lantern lens
						    Glass.craftGlass(player, 5, 6, true);
						    break;
						
					    case 45: // Make 5 dorgeshuun light orb.
						    Glass.craftGlass(player, 5, 7, true);
						    break;
				    }
				    break;
			
			    case 763: // Bank inventory - 5.
				    player.getBank().deposit(slot, 5);
				    player.getBank().refreshBank();
				    break;
				
			    case 762: // Bank - 5.
				    player.getBank().withdraw(slot, 5);
				    player.getBank().refreshBank();
				    break;
				
 			    case 336: // Trade/stake inventory - trade 5.
 				    if (player.getTrade() != null) {
 					    player.getTrade().tradeItem(slot, 5);
 					    break;
 				    }
 				    if (player.getDuel() != null) {
 					    player.getDuel().stakeItem(slot, 5);
 					    break;
 				    }
 				    break;
 				
 			    case 631: // Duel interface - remove 5
 				    if (player.getDuel() != null) {
					    player.getDuel().removeItem(slot, 5);
					    break;
 				    }
 				    break;
 				
 			    case 335: // Trade interface - remove 5.
 				    player.getTrade().removeItem(slot, 5);
 				    break;
 				
 			    case 620: // Shop - buy 1.
 				    player.getShopSession().buyItem(slot, 1);
 				    break;
 				
 			    case 621: // Shop - sell 1.
 				    player.getShopSession().sellItem(slot, 1);
 				    break;
 				
 			    case 590: // Clan chat setup
 				    Clan clan = Server.getClanManager().getClanByOwner(player.getLoginDetails().getUsername());
//.........这里部分代码省略.........
开发者ID:slapglif,项目名称:runescape-server-csharp,代码行数:101,代码来源:InterfaceOptions.cs

示例6: handleActionButton


//.........这里部分代码省略.........
							    player.getBank().verifyPin(true);
							    break;
						    }
						    player.getBank().openEnterPin();
						    break;
						
					    case 65: // Cancel pin that's pending.
						    player.getBank().openPinSettings(4);
						    break;
						
					    case 62: // Change pin.
						    player.getBank().changePin();
						    break;
						
					    case 63: // Delete pin.
						    player.getBank().deletePin();
						    break;
				    }
				    break;
				
			    case 464: // Emote tab.
				    Emotes.emote(player, buttonId);
				    break;
				
 			    case 320: // Skills Tab.
				    SkillMenu.display(player, buttonId);
				    break;
				
 			    case 499: // Skill menu side menu.
 				    SkillMenu.subMenu(player, buttonId);
 				    break;

 			    case 336: // Trade/duel inventory - trade 1.
 				    if (player.getTrade() != null) {
 					    player.getTrade().tradeItem(buttonId2, 1);
 					    break;
 				    }
 				    if (player.getDuel() != null) {
 					    player.getDuel().stakeItem(buttonId2, 1);
 					    break;
 				    }
 				    break;
 				
 			    case 335: // Trade interface.
 				    if (player.getTrade() == null) {
 					    break;
 				    }
				    switch(buttonId) {
					    case 16: // Accept trade.
						    player.getTrade().accept();
						    break;
						
					    case 18: // Decline trade.
						    player.getTrade().decline();
						    break;
						
					    case 30: // Offer 1
						    player.getTrade().removeItem(buttonId2, 1);
						    break;
				    }
 				    break;
 				
 			    case 334: // Trade confirmation.
 				    if (player.getTrade() == null) {
 					    break;
 				    }
开发者ID:slapglif,项目名称:runescape-server-csharp,代码行数:67,代码来源:ActionButton.cs

示例7: handleCloseButton

	    private void handleCloseButton(Player player, Packet packet) {
            if (player.getTrade() != null)
                player.getTrade().decline();
            if (player.getDuel() != null)
            {
                if (player.getDuel().getStatus() < 4)
                {
                    player.getDuel().declineDuel();
                    return;
                }
                else if (player.getDuel().getStatus() == 8 && player.getDuel().getWinner().Equals(player))
                        player.getDuel().recieveWinnings(player);
            }
            player.getPackets().closeInterfaces();
	    }
开发者ID:slapglif,项目名称:runescape-server-csharp,代码行数:15,代码来源:ActionButton.cs

示例8: 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

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