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


C# Player.getDuel方法代码示例

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


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

			    case 305: // What would you like to make? - 4 options
开发者ID:slapglif,项目名称:runescape-server-csharp,代码行数:67,代码来源:InterfaceOptions.cs

示例3: handleClickFive

	    private void handleClickFive(Player player, Packet packet) {
		    int interfaceId = packet.readUShort();
		    int child = packet.readUShort();
		    int slot = packet.readUShort();
		    Console.WriteLine("InterfaceOption 5: interfaceId: " + interfaceId);
		    switch(interfaceId) {
			    case 763: // Bank inventory - X.
				    player.getPackets().displayEnterAmount();
				    player.setTemporaryAttribute("interfaceVariable", new EnterVariable(interfaceId, slot));
				    break;
				
			    case 762: // Bank - X.
				    player.getPackets().displayEnterAmount();
				    player.setTemporaryAttribute("interfaceVariable", new EnterVariable(interfaceId, slot));
				    break;
				
			    case 336: // Trade inventory - trade X.
				    player.getPackets().displayEnterAmount();
				    player.setTemporaryAttribute("interfaceVariable", new EnterVariable(interfaceId, slot));
				    break;
				
			    case 335: // Trade interface - remove X.
				    player.getPackets().displayEnterAmount();
				    player.setTemporaryAttribute("interfaceVariable", new EnterVariable(interfaceId, slot));
				    break;
				
 			    case 631: // Duel interface - remove All
 				    if (player.getDuel() != null) {
 					    player.getPackets().displayEnterAmount();
 					    player.setTemporaryAttribute("interfaceVariable", new EnterVariable(interfaceId, slot));
					    break;
 				    }
 				    break;
			
			    case 620: // Shop - buy X/buy 50.
				    if (player.getShopSession().isInMainStock()) {
					    player.getPackets().displayEnterAmount();
					    player.setTemporaryAttribute("interfaceVariable", new EnterVariable(interfaceId, slot));
				    } else {
					    player.getShopSession().buyItem(slot, 50);
				    }
				    break;
				
 			    case 621: // Shop - Sell 50.
 				    player.getShopSession().sellItem(slot, 50);
 				    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" - sergeant.
                            clan.setEnterRights(Clan.ClanRank.SERGEANT);
	 					    player.getPackets().modifyText(clan.getRankString(clan.getEnterRights()), 590, 23);
	 					    break;
	 					
	 				    case 24: // "Who can talk in chat" - sergeant.
                            clan.setTalkRights(Clan.ClanRank.SERGEANT);
	 					    player.getPackets().modifyText(clan.getRankString(clan.getTalkRights()), 590, 24);
	 					    break;
	 					
	 				    case 25: // // "Who can kick in chat" - sergeant.
                            clan.setKickRights(Clan.ClanRank.SERGEANT);
	 					    player.getPackets().modifyText(clan.getRankString(clan.getKickRights()), 590, 25);
	 					    break;
	 					
	 				    case 26: // "Who can share loot" - sergeant.
                            clan.setLootRights(Clan.ClanRank.SERGEANT);
	 					    player.getPackets().modifyText(clan.getRankString(clan.getLootRights()), 590, 26);
	 					    break;
 				    }
 				    break;
		    }	
	    }
开发者ID:slapglif,项目名称:runescape-server-csharp,代码行数:77,代码来源: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: 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

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

示例7: canTeleport

	    private static bool canTeleport(Player p, JewellerySlot js) {
		    if (p.getTemporaryAttribute("teleporting") != null) {
			    return false;
		    }
		    if (p.getDuel() != null) {
			    if (p.getDuel().getStatus() < 4) {
				    p.getDuel().declineDuel();
			    } else if (p.getDuel().getStatus() == 5 || p.getDuel().getStatus() == 6) {
				    p.getPackets().sendMessage("You cannot teleport whilst in a duel.");
				    return false;
			    } else if (p.getDuel().getStatus() == 8) {
				    p.getDuel().recieveWinnings(p);
			    }
		    }
		    int wildLvl = js.index == 1 || js.index == 2 ? 30 : 20;
            if (Location.inWilderness(p.getLocation()) && p.getLocation().wildernessLevel() >= wildLvl)
            {
                p.getPackets().sendMessage("You cannot teleport above level " + wildLvl + " wilderness!");
			    return false;
		    }
		    if (Location.inFightCave(p.getLocation())) {
			    FightCave.antiTeleportMessage(p);
			    return false;
		    }
		    if (p.getTemporaryAttribute("teleblocked") != null) {
			    p.getPackets().sendMessage("A magical force prevents you from teleporting!");
			    return false;
		    }
		    if (Location.inFightPits(p.getLocation())) {
                p.getPackets().sendMessage("You are unable to teleport from the fight pits.");
			    return false;
		    }
		    if (p.getTemporaryAttribute("unmovable") != null) {
			    return false;
		    }
		    return true;
	    }
开发者ID:slapglif,项目名称:runescape-server-csharp,代码行数:37,代码来源:JewelleryTeleport.cs

示例8: handleAttackPlayer

	    private void handleAttackPlayer(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());
		    player.getPackets().closeInterfaces();
		    if (Location.atDuelArena(player.getLocation())) {
			    if(player.getDuel() != null) {
				    if (player.getDuel().getStatus() < 4) {
					    player.getDuel().declineDuel();
					    return;
				    } else if (player.getDuel().getStatus() == 5 && player.getDuel().getPlayer2().Equals(p2)) {
					    player.getPackets().sendMessage("The duel has not yet started!");
					    return;
				    } else if ((player.getDuel().getStatus() == 5 || player.getDuel().getStatus() == 6) && !player.getDuel().getPlayer2().Equals(p2)) {
					    return;
				    } else if (player.getDuel().getStatus() == 6) {
					    Combat.newAttack(player, p2);
					    return;
				    }
			    }
			    if (!player.getLocation().withinDistance(p2.getLocation(), 1)) {
				    int x = p2.getLocation().getX();
				    int y = p2.getLocation().getY();
                    AreaEvent attackAreaEvent = new AreaEvent(player, x-1, y-1, x+1, y+1);
				    attackAreaEvent.setAction(() => {
                        player.getWalkingQueue().resetWalkingQueue();
						player.getPackets().clearMapFlag();
						if (p2.getGESession() != null || (p2.getDuel() != null && !p2.getDuel().getPlayer2().Equals(player)) || p2.getTrade() != null || p2.getShopSession() != null || p2.getBank().isBanking()) {
                            player.getPackets().sendMessage("That player is busy at the moment.");
							return;
						}
						if (p2.wantsToDuel(player)) {
							p2.setFaceLocation(player.getLocation());
							player.getPackets().closeInterfaces();
							p2.getPackets().closeInterfaces();
							player.setDuelSession(new DuelSession(player, p2));
							p2.setDuelSession(new DuelSession(p2, player));
							return;
						}
						player.setFaceLocation(p2.getLocation());
						p2.getPackets().sendMessage(player.getLoginDetails().getUsername() + ":duelstake:");
						player.getPackets().sendMessage("Sending duel request...");
						player.newDuelRequest(p2);
				    });
                    Server.registerCoordinateEvent(attackAreaEvent);
				    return;
			    }
			    if (p2.getGESession() != null || (p2.getDuel() != null && !p2.getDuel().getPlayer2().Equals(player)) || p2.getTrade() != null || p2.getShopSession() != null || p2.getBank().isBanking()) {
				    player.getPackets().sendMessage("That player is busy at the moment.");
				    return;
			    }
			    if (p2.wantsToDuel(player)) {
				    player.getPackets().closeInterfaces();
				    p2.getPackets().closeInterfaces();
				    p2.setFaceLocation(player.getLocation());
				    player.setDuelSession(new DuelSession(player, p2));
				    p2.setDuelSession(new DuelSession(p2, player));
				    return;
			    }
			    player.newDuelRequest(p2);
			    p2.getPackets().sendMessage(player.getLoginDetails().getUsername() + ":duelstake:");
			    player.getPackets().sendMessage("Sending duel request...");
			    return;
		    }
		    Combat.newAttack(player, p2);
	    }
开发者ID:slapglif,项目名称:runescape-server-csharp,代码行数:73,代码来源:PlayerInteract.cs

示例9: handleActionButton


//.........这里部分代码省略.........
						
					    case 37: // second bank tab
						    player.getBank().setCurrentTab(3);
						    break;
						
					    case 35: // third bank tab
						    player.getBank().setCurrentTab(4);
						    break;
						
					    case 33: // fourth bank tab
						    player.getBank().setCurrentTab(5);
						    break;
						
					    case 31: // fifth bank tab
						    player.getBank().setCurrentTab(6);
						    break;
						
					    case 29: // sixth bank tab
						    player.getBank().setCurrentTab(7);
						    break;
						
					    case 27: // seventh bank tab
						    player.getBank().setCurrentTab(8);
						    break;
						
					    case 25: // eighth bank tab
						    player.getBank().setCurrentTab(9);
						    break;
				    }
				    break;
				
			    case 626: // Stake duel confirmation interface.
				    if (buttonId == 53) {
					    if (player.getDuel() != null) {
						    player.getDuel().acceptDuel();
						    break;
					    }
				    }
				    break;
				
			    case 631: // Stake duel first interface.
				    if (player.getDuel() != null) {
					    if (buttonId == 103) {
						    player.getDuel().removeItem(buttonId2, 1);
						    break;
					    } else {
						    player.getDuel().toggleDuelRules(buttonId);
						    break;
					    }
				    }
				    break;
				
			    case 387: // Equipment tab. 
				    switch(buttonId) {
					    case 55: // Character display.
						    player.getEquipment().displayEquipmentScreen();
						    break;
						
					    case 52: // Items kept on death.
						    ProtectedItems.displayItemsInterface(player);
						    break;
				    }
				    break;
				
			    case 274: // Quest tab.
				    switch(buttonId) {
开发者ID:slapglif,项目名称:runescape-server-csharp,代码行数:67,代码来源:ActionButton.cs

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

示例11: handleActionButton3

	    private void handleActionButton3(Player player, Packet packet) {
		    int id = packet.readUShort();
		    int interfaceId = packet.readUShort();
		    int junk = packet.readLEShort();
		
		    int logType = (int) (player.getTemporaryAttribute("fletchType") == null ? -1 : (int) player.getTemporaryAttribute("fletchType")); // Bows (Fletching).
		    int ammoType = (int) (player.getTemporaryAttribute("ammoType") == null ? -1 : (int) player.getTemporaryAttribute("ammoType")); // Arrows (Fletching).
		    int boltType = (int) (player.getTemporaryAttribute("ammoType2") == null ? -1 : (int) player.getTemporaryAttribute("ammoType2")); // Bolts (Fletching).
		    int xbowType = (int) (player.getTemporaryAttribute("bowType2") == null ? -1 : (int) player.getTemporaryAttribute("bowType2")); // Xbows (Fletching).
		    int bowType = (int)  (player.getTemporaryAttribute("bowType") == null ? -1 : (int) player.getTemporaryAttribute("bowType")); // Longbow/Shortbow stringing (Fletching).
		    int grindItem = (int) (player.getTemporaryAttribute("herbloreGrindItem") == null ? -1 : (int) player.getTemporaryAttribute("herbloreGrindItem")); // item to be grinded (Herblore)
		    bool stringingBow = (bool) (player.getTemporaryAttribute("stringingBow") == null ? false : (bool) player.getTemporaryAttribute("stringingBow")); // Stringing bow/xbow (Fletching)
		    int unfinishedPotion = (int) (player.getTemporaryAttribute("unfinishedPotion") == null ? -1 : (int) player.getTemporaryAttribute("unfinishedPotion")); // unfinished potion to make (Herblore)
		    int completePotion = (int) (player.getTemporaryAttribute("completePotion") == null ? -1 : (int) player.getTemporaryAttribute("completePotion")); // unfinished potion to make (Herblore)
		    int cookItem = (int) (player.getTemporaryAttribute("meatItem") == null ? -1 : (int) player.getTemporaryAttribute("meatItem")); // item to cook (Cooking)
		    int dialogueStatus = (int) (player.getTemporaryAttribute("dialogue") == null ? -1 : (int) player.getTemporaryAttribute("dialogue")); // Dialogue status
		    int craftType = (int) (player.getTemporaryAttribute("craftType") == null ? -1 : (int) player.getTemporaryAttribute("craftType")); // 'Category' of item to craft
		    int leatherCraft = (int) (player.getTemporaryAttribute("leatherCraft") == null ? -1 : (int) player.getTemporaryAttribute("leatherCraft")); // Type of leather item to craft (high lvl hides)
		    int boltTips = (int) (player.getTemporaryAttribute("boltTips") == null ? -1 : (int) player.getTemporaryAttribute("boltTips")); // Type of bolt tips to cut
            JewelleryTeleport.JewellerySlot js = (JewelleryTeleport.JewellerySlot)player.getTemporaryAttribute("jewelleryTeleport") == null ? null : (JewelleryTeleport.JewellerySlot)player.getTemporaryAttribute("jewelleryTeleport");
		    Console.WriteLine("ACTIONBUTTON-3 "+ id);
		    if (JewelleryTeleport.teleport(player, id, js)) {
			    return;
		    }
		    switch(id) {
			    case 2:
				    if (player.getDuel() != null) {
					    if (player.getDuel().getStatus() == 6) {
						    player.getDuel().finishDuel(true, true);
						    player.getPackets().sendMessage("You climb through the trapdoor and forfeit the duel.");
						    break;
					    }
					    break;
				    } else
				    if (player.getTemporaryAttribute("barrowTunnel") != null) {
					    Barrows.verifyEnterTunnel(player);
					    return;
				    } else if (dialogueStatus == 1005) {
					    Slayer.doDialogue(player, 1006);
					    break;
				    } else if (dialogueStatus == 1009) {
					    Slayer.doDialogue(player, 1010);
					    break;
				    } else if (dialogueStatus == 1002) {
					    Slayer.doDialogue(player, 1013);
					    break;
				    } else if (dialogueStatus == 1017) {
					    Slayer.doDialogue(player, 1019);
					    break;
				    } else if (dialogueStatus == 1029) {
					    Slayer.doDialogue(player, 1029);
					    break;
				    } else if (dialogueStatus == 1053) {
					    Slayer.doDialogue(player, 1055);
					    break;
				    } else if (dialogueStatus > 1000) {
					    Slayer.doDialogue(player, 1006);
					    break;
				    } else if (dialogueStatus == 7) {
					    AgilityArena.doDialogue(player, 7);
					    break;
				    }  else if (dialogueStatus == 29) {
					    AgilityArena.doDialogue(player, 29);
					    break;
				    }  else if (dialogueStatus == 37) {
					    AgilityArena.doDialogue(player, 37);
					    break;
				    }  else if (dialogueStatus == 46) {
					    AgilityArena.doDialogue(player, 46);
					    break;
				    } else if (dialogueStatus == 79) {
					    WarriorGuild.talkToKamfreena(player, 79);
					    break;
				    } else if (dialogueStatus == 103) {
					    BrokenBarrows.showBobDialogue(player, 103);
					    break;
				    } else if (dialogueStatus == 109) {
					    BrokenBarrows.showBobDialogue(player, 109);
					    break;
				    } else if(dialogueStatus == 159) {
					    HomeArea.showAliDialogue(player, 159);
					    break;
				    } else if(dialogueStatus == 207) {
					    AlKharid.showAliDialogue(player, 207);
					    break;
				    } else if(dialogueStatus == 242) {
					    BoatOptions.showBentleyDialogue(player, 242);
					    break;
				    } else if (dialogueStatus == 450) {
					    FarmingAmulet.displayAllotmentOptions(player);
					    break;
				    } else if (dialogueStatus == 451) {
					    FarmingAmulet.teleportToPatch(player, 0);
					    break;
				    } else if (dialogueStatus == 452) {
					    FarmingAmulet.teleportToPatch(player, 4);
					    break;
				    } else if (dialogueStatus == 453) {
					    FarmingAmulet.teleportToPatch(player, 8);
					    break;
//.........这里部分代码省略.........
开发者ID:slapglif,项目名称:runescape-server-csharp,代码行数:101,代码来源:ActionButton.cs

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

示例13: drinkPotion

	    private static void drinkPotion(Player p, int i, int j, int slot) {
		    //TODO antipoisons/antifire
		    int lastPotion = -1;
		    int delay = 500;
		    long lastDrink = 0;
		    if (p.isDead() || p.getTemporaryAttribute("willDie") != null) {
			    return;
		    }
		    if (p.getDuel() != null) {
			    if (p.getDuel().ruleEnabled(DuelSession.RULE.NO_DRINKS))  {
				    p.getPackets().sendMessage("Drinks have been disabled for this duel!");
				    return;
			    }
		    }
		    if (p.getTemporaryAttribute("lastDrankPotion") != null) {
			    lastPotion = (int) p.getTemporaryAttribute("lastDrankPotion");
		    }
		    if (p.getTemporaryAttribute("drinkPotionTimer") != null) {
			    lastDrink = (int) p.getTemporaryAttribute("drinkPotionTimer");
		    }
		    int time = (j == lastPotion) ? 1000 : 500;
		    if (Environment.TickCount - lastDrink < time) {
			    return;
		    }
		    p.getPackets().closeInterfaces();
		    p.setTemporaryAttribute("drinkPotionTimer", Environment.TickCount);
		    p.setTemporaryAttribute("lastDrankPotion", j);
		    p.setTarget(null);
		    p.resetCombatTurns();
		    p.setEntityFocus(65535);
		    p.removeTemporaryAttribute("autoCasting");

            Event drinkPotionEvent = new Event(delay);
            drinkPotionEvent.setAction(() => {		
				drinkPotionEvent.stop();
				if (p.isDead() || p.getSkills().getCurLevel(Skills.SKILL.HITPOINTS) <= 0) {
					return;
				}
                int item = i != 0 && POTIONS[i - 1][j] != -1 ? POTIONS[i - 1][j] : 229;
				if (!p.getInventory().replaceItemSlot(POTIONS[i][j],  item, slot)) {
					return;
				}
                string drinkPotion = ItemData.forId(POTIONS[0][j]).getName().Replace("(", "").Replace(")", "").Replace("3", "").Replace("2", "").Replace("1", "").ToLower();
                p.getPackets().sendMessage("You drink some of your " + drinkPotion + ".");
                p.getPackets().sendMessage("You have " + (i == 0 ? "no" : i.ToString()) + " doses of potion left.");
				switch(j) {
					case 0: //Attack potion [+3 and 10% of max attack]
						statBoost(p, Skills.SKILL.ATTACK, 0.10, 3, false); 
                        break;
					case 1: //Antipoison potion
						p.setPoisonAmount(0);
						break;
						
					case 2: //Strength potion [+3 and 10% of max strength]
						statBoost(p, Skills.SKILL.STRENGTH, 0.10, 3, false);
						break;
						
					case 3: //Restore potion [restores randomly between 10-39 points]
                        restorePotion(p, Skills.SKILL.DEFENCE, 10, 39);
                        restorePotion(p, Skills.SKILL.ATTACK, 10, 39);
                        restorePotion(p, Skills.SKILL.STRENGTH, 10, 39);
                        restorePotion(p, Skills.SKILL.RANGE, 10, 39);
                        restorePotion(p, Skills.SKILL.HITPOINTS, 10, 39);
						break;
						
					case 4: //Energy potion [restores 20% energy]
                        double newEnergy = p.getRunEnergy() * 0.20;
                        p.setRunEnergy(((p.getRunEnergy() + (int)newEnergy >= 100) ? 100 : (p.getRunEnergy() + (int)newEnergy)));
						break;
						
					case 5: //Defence potion [Should be +3 and 10% of max defence]
                        statBoost(p, Skills.SKILL.DEFENCE, 0.10, 3, false);
						break;
						
					case 6: //Agility potion [restores 2 or 3 agility points]
                        int newAgility = misc.random(2, 3) + p.getSkills().getCurLevel(Skills.SKILL.AGILITY);
                        if (newAgility < p.getSkills().getMaxLevel(Skills.SKILL.AGILITY))
                            p.getSkills().setCurLevel(Skills.SKILL.AGILITY, newAgility);
						break;
						
					case 7: //Combat potion [Should be 10% of attack+strength and +3 to each].
                        statBoost(p, Skills.SKILL.ATTACK, 0.10, 3, false);
                        statBoost(p, Skills.SKILL.STRENGTH, 0.10, 3, false);
						break;
						
					case 8: //Prayer potion, [heals 7-31, formula = 7+floor(prayerlevel/4)]
                        int newPrayer = 7 + (int)Math.Floor((double)(p.getSkills().getMaxLevel(Skills.SKILL.PRAYER) / 4)) + p.getSkills().getCurLevel(Skills.SKILL.PRAYER);
                        if (newPrayer < p.getSkills().getCurLevel(Skills.SKILL.PRAYER))
                            p.getSkills().setCurLevel(Skills.SKILL.PRAYER, newPrayer);
                        checkOverdose(p, Skills.SKILL.PRAYER);
						break;
						
					case 9: //Summoning potion [25% of players summoning + 7]
                        int newSummoning = (7 + (int)((double)p.getSkills().getMaxLevel(Skills.SKILL.SUMMONING) * 0.25)) + p.getSkills().getCurLevel(Skills.SKILL.SUMMONING);
                        if (newSummoning < p.getSkills().getCurLevel(Skills.SKILL.SUMMONING))
                            p.getSkills().setCurLevel(Skills.SKILL.SUMMONING, newSummoning);

                        statBoost(p, Skills.SKILL.STRENGTH, 0.10, 3, false);
						break;
						
//.........这里部分代码省略.........
开发者ID:slapglif,项目名称:runescape-server-csharp,代码行数:101,代码来源:Consumables.cs

示例14: eatFood

	    private static void eatFood(Player p, int i, int j, int slot) {
            //delay at which you eat food 0.5 seconds (half a second per eat).
		    int delay = 500;
            //If you are dead or yourHp is zero (this should be enough), also if variable is set to die from next attack
            if (p.isDead() || p.getHp() <= 0 || p.getTemporaryAttribute("willDie") != null)
			    return;

            //Last time you ate timer was previously set.
		    if (p.getTemporaryAttribute("eatFoodTimer") != null) {
                //Check if the timer has passed the time of 1.2 seconds
			    if (Environment.TickCount - (int) p.getTemporaryAttribute("eatFoodTimer") < 1200) {
				    return;
			    }
		    }
            //if you are in a duel
		    if (p.getDuel() != null) {
                //dueling with No Food rule enabled
			    if (p.getDuel().ruleEnabled(DuelSession.RULE.NO_FOOD))  {
				    p.getPackets().sendMessage("Food has been disabled for this duel!");
				    return;
			    }
		    }
            //Set timer right now because you are eating some food.
		    p.setTemporaryAttribute("eatFoodTimer", Environment.TickCount);
            //while you are eating the target you are attacking gets reset.
		    p.setTarget(null);
		    p.resetCombatTurns();
		    p.setEntityFocus(65535);
		    p.getPackets().closeInterfaces();
		    p.removeTemporaryAttribute("autoCasting");

            //start eating the food at delay which is 0.5 of a second / half a second.
            Event eatFoodEvent = new Event(delay);
            eatFoodEvent.setAction(() => {
                //make the food eating event stop after this time.
				eatFoodEvent.stop();
                //if you are dead or your hp is zero aka dead.
				if (p.isDead() || p.getHp() <= 0) {
					return;
				}
				int newHealth = p.getSkills().getCurLevel(Skills.SKILL.HITPOINTS) + FOOD_HEAL[j];
                int item = i != 2 && FOOD[i + 1][j] != -1 ? FOOD[i + 1][j] : -1;
                if (!p.getInventory().replaceItemSlot(FOOD[i][j], item, slot))
                {
					return;
				}
                p.getPackets().sendMessage("You eat the " + ItemData.forId(FOOD[i][j]).getName().ToLower() + ".");
				p.getSkills().setCurLevel(Skills.SKILL.HITPOINTS, newHealth > p.getSkills().getMaxLevel(Skills.SKILL.HITPOINTS) ? p.getSkills().getMaxLevel(Skills.SKILL.HITPOINTS) : newHealth);
				p.setLastAnimation(new Animation(829));
				p.getPackets().sendSkillLevel(Skills.SKILL.HITPOINTS);
		    });
            Server.registerEvent(eatFoodEvent);
	    }
开发者ID:slapglif,项目名称:runescape-server-csharp,代码行数:53,代码来源:Consumables.cs

示例15: updateVariables

        /*
         * NOTE: Anything that goes in here and varies between HD and LD, 
         * reset the variable in ActionSender.configureGameScreen
         */
        public void updateVariables(Player p)
        {
            int currentLevel = p.getLocation().wildernessLevel();
            if (currentLevel != -1)
            { //Is in wilderness.
                int lastWildLevel = (p.getTemporaryAttribute("wildLvl") == null) ? -1 : (int)p.getTemporaryAttribute("wildLvl");

                if (currentLevel != lastWildLevel)
                {
                    if (currentLevel > 0)
                    {
                        p.setTemporaryAttribute("wildLvl", currentLevel);
                        if (p.getTemporaryAttribute("inWild") == null)
                        {
                            p.getPackets().sendPlayerOption("Attack", 1, 1);
                            p.getPackets().sendOverlay(381);
                            p.setTemporaryAttribute("inWild", true);
                        }
                    }
                    else
                    {
                        if (p.getTemporaryAttribute("inWild") != null)
                        {
                            p.getPackets().sendPlayerOption("null", 1, 1);
                            p.getPackets().sendRemoveOverlay();
                            p.removeTemporaryAttribute("wildLvl");
                            p.removeTemporaryAttribute("inWild");
                        }
                    }
                }
            }
            if (Location.inMultiCombat(p.getLocation()))
            {
                if (p.getTemporaryAttribute("inMulti") == null)
                {
                    p.getPackets().displayMultiIcon();
                    p.setTemporaryAttribute("inMulti", true);
                }
            }
            else
            {
                if (p.getTemporaryAttribute("inMulti") != null)
                {
                    p.getPackets().removeMultiIcon();
                    p.removeTemporaryAttribute("inMulti");
                }
            }
            if (Location.atDuelArena(p.getLocation()))
            {
                if (p.getDuel() != null)
                {
                    if (p.getDuel().getStatus() == 5 || p.getDuel().getStatus() == 6)
                    {
                        p.getPackets().sendPlayerOption("Fight", 1, 1);
                    }
                }
                if (p.getTemporaryAttribute("challengeUpdate") != null)
                {
                    p.getPackets().sendPlayerOption("Challenge", 1, 0);
                    p.removeTemporaryAttribute("challengeUpdate");
                }
                if (p.getTemporaryAttribute("atDuelArea") == null)
                {
                    p.getPackets().sendPlayerOption("Challenge", 1, 0);
                    p.getPackets().sendOverlay(638);
                    p.setTemporaryAttribute("atDuelArea", true);
                }
            }
            else
            {
                if (p.getTemporaryAttribute("atDuelArea") != null)
                {
                    p.getPackets().sendPlayerOption("null", 1, 0);
                    p.getPackets().sendRemoveOverlay();
                    p.removeTemporaryAttribute("atDuelArea");
                }
            }
            if (Location.atBarrows(p.getLocation()))
            {
                if (p.getTemporaryAttribute("atBarrows") == null)
                {
                    p.getPackets().sendOverlay(24);
                    p.getPackets().setMinimapStatus(2);
                    p.getPackets().sendConfig(452, 2652256); // doors
                    if (p.getTemporaryAttribute("betweenDoors") == null)
                    {
                        if (Barrows.betweenDoors(p))
                        {
                            p.setTemporaryAttribute("betweenDoors", true);
                            p.getPackets().sendConfig(1270, 1);
                        }
                    }
                    p.getPackets().modifyText("Kill Count: " + p.getBarrowKillCount(), 24, 0);
                    p.setTemporaryAttribute("atBarrows", true);
                    Barrows.prayerDrainEvent(p);
                    bool allBrothersKilled = true;
//.........这里部分代码省略.........
开发者ID:slapglif,项目名称:runescape-server-csharp,代码行数:101,代码来源:AreaVariables.cs


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