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


C# Player.setTemporaryAttribute方法代码示例

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


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

示例1: useAnimator

	    public static bool useAnimator(Player p, int itemId, int objectId, int objectX, int objectY) {
		    if (objectId != ANIMATOR_ID) {
			    return false;
		    }
		    int animatorIndex = -1;
		    for (int i = 0; i < ANIMATOR_LOCATIONS.Length; i++) {
			    if (objectX == ANIMATOR_LOCATIONS[i][0] && objectY == ANIMATOR_LOCATIONS[i][1]) {
				    animatorIndex = i;
				    break;
			    }
		    }
		    if (animatorIndex == -1) {
			    return false;
		    }
		    p.setTemporaryAttribute("warriorGuildAnimator", animatorIndex);
            CoordinateEvent createAnimatedArmorCoordinateEvent = new CoordinateEvent(p, new Location(ANIMATOR_LOCATIONS[animatorIndex][0], (ANIMATOR_LOCATIONS[animatorIndex][1] + 1), 0));
            createAnimatedArmorCoordinateEvent.setAction(() => {
				int armourIndex = hasArmour(p, itemId);
				if (armourIndex != -1) {
					createdAnimatedArmour(p, armourIndex);
				}
		    });
            Server.registerCoordinateEvent(createAnimatedArmorCoordinateEvent);
		    return true;
	    }
开发者ID:slapglif,项目名称:runescape-server-csharp,代码行数:25,代码来源:WarriorGuild.cs

示例2: displayWildernessLeverOptions

	    public static void displayWildernessLeverOptions(Player p, int leverIndex) {
		    int dialogueIndex = 140 + leverIndex;
		    p.setTemporaryAttribute("dialogue", dialogueIndex);
		    string option1 = leverIndex == 0 ? "Edgeville" : "Home";
		    p.getPackets().modifyText(option1, 230, 2);
		    p.getPackets().modifyText("Mage bank", 230, 3);
		    p.getPackets().modifyText("Nowhere", 230, 4);
		    p.getPackets().sendChatboxInterface2(230);
	    }
开发者ID:slapglif,项目名称:runescape-server-csharp,代码行数:9,代码来源:Wilderness.cs

示例3: createdAnimatedArmour

	    protected static void createdAnimatedArmour(Player p, int index) {
		    if (p.getTemporaryAttribute("warriorGuildAnimator") == null) {
			    return;
		    }
		    p.setLastAnimation(new Animation(827));
		    p.setTemporaryAttribute("unmovable", true);
		    for (int i = 0; i < ARMOUR_SETS[index].Length; i++) {
			    p.getInventory().deleteItem(ARMOUR_SETS[index][i]);
		    }
		    p.getPackets().sendChatboxInterface(211);
		    p.getPackets().modifyText("You place the armour onto the platform where it", 211, 1);
		    p.getPackets().modifyText("dissapears...", 211, 2);
		    int animatorIndex = (int) p.getTemporaryAttribute("warriorGuildAnimator");
            Event createAnimatedArmourEvent = new Event(1500);
            int createAnimatedArmourCounter = 0;
            Npc npc = null;
            createAnimatedArmourEvent.setAction(() => {
                if (createAnimatedArmourCounter == 0)
                {
					p.getPackets().sendChatboxInterface(211);
					p.getPackets().modifyText("The animator hums, something appears to be working.", 211, 1);
					p.getPackets().modifyText("You stand back.", 211, 2);
					createAnimatedArmourEvent.setTick(500);
                }
                else if (createAnimatedArmourCounter == 1)
                {
					p.getWalkingQueue().forceWalk(0, + 3);
					createAnimatedArmourEvent.setTick(2000);
                }
                else if (createAnimatedArmourCounter == 2)
                {
					createAnimatedArmourEvent.setTick(500);
					Location minCoords = new Location(2849, 3534, 0);
					Location maxCoords = new Location(2861, 3545, 0);
					npc = new Npc(ANIMATED_ARMOUR[index]);
					npc.setMinimumCoords(minCoords);
					npc.setMaximumCoords(maxCoords);
					npc.setLocation(new Location(ANIMATOR_LOCATIONS[animatorIndex][0], ANIMATOR_LOCATIONS[animatorIndex][1], 0));
					npc.setWalkType(WalkType.STATIC);
					npc.setForceText("I'm ALIVE!");
					npc.setLastAnimation(new Animation(4166));
					npc.setEntityFocus(p.getClientIndex());
					npc.setOwner(p);
					npc.setTarget(p);
					p.getPackets().setArrowOnEntity(1, npc.getClientIndex());
					Server.getNpcList().Add(npc);
				} else {
					p.setEntityFocus(npc.getClientIndex());
					p.getPackets().softCloseInterfaces();
					createAnimatedArmourEvent.stop();
					p.removeTemporaryAttribute("unmovable");
					npc.getFollow().setFollowing(p);
				}
                createAnimatedArmourCounter++;
		    });
            Server.registerEvent(createAnimatedArmourEvent);
	    }
开发者ID:slapglif,项目名称:runescape-server-csharp,代码行数:57,代码来源:WarriorGuild.cs

示例4: display

	    public static void display(Player player, int buttonId) {
		    int j = 0;

		    for (int i = 125; i < 149; i++) {
			    if (buttonId == i) {
                    int skillFlashFlags = (int)(player.getTemporaryAttribute("skillFlashFlags") == null ? 0 : (int)player.getTemporaryAttribute("skillFlashFlags"));

                    if ((skillFlashFlags & getSkillFlashingIcon(j)) == getSkillFlashingIcon(j))
                    {
                        skillFlashFlags &= ~getSkillFlashingIcon(j); //turn off this skill icon flashing animation bit.
                        player.getPackets().sendConfig(1179, skillFlashFlags); //stop flashing the skill you clicked on, if it was flashing.
                        player.setTemporaryAttribute("skillFlashFlags", skillFlashFlags); //update the variable for remaining flashing skill icons.
                    }
				    player.getPackets().displayInterface(499);
                    player.getPackets().sendConfig(965, MENU_ID[j]);
				    player.setTemporaryAttribute("SkillMenu", (int) MENU_ID[j]);
				    break;
			    }
			    j++;
		    }
	    }
开发者ID:slapglif,项目名称:runescape-server-csharp,代码行数:21,代码来源:SkillMenu.cs

示例5: exitCave

	    public static void exitCave(Player p, int objectX, int objectY) {
            AreaEvent exitCaveAreaEvent = new AreaEvent(p, objectX, objectY - 1, objectX + 2, objectY - 1);
            exitCaveAreaEvent.setAction(() => {
				p.setTemporaryAttribute("unmovable", true);
                Event teleFromCaveEvent = new Event(600);
                teleFromCaveEvent.setAction(() => {
					teleFromCaveEvent.stop();
					p.getFightCave().teleFromCave(true);
				});
                Server.registerEvent(teleFromCaveEvent);
		    });
            Server.registerCoordinateEvent(exitCaveAreaEvent);
	    }
开发者ID:slapglif,项目名称:runescape-server-csharp,代码行数:13,代码来源:FightCave.cs

示例6: talkToBob

	    public static void talkToBob(Player p, Npc npc, int item, int option) {
		    p.setEntityFocus(npc.getClientIndex());
            AreaEvent talkToBobAreaEvent = new AreaEvent(p, npc.getLocation().getX() - 1, npc.getLocation().getY() - 1, npc.getLocation().getX() + 1, npc.getLocation().getY() + 1);
            talkToBobAreaEvent.setAction(() => {
				npc.setFaceLocation(p.getLocation());
				p.setFaceLocation(npc.getLocation());
				p.setEntityFocus(65535);
				if (option == 0) { // use item on bob
					if (item > 0) {
						p.setTemporaryAttribute("bobsAxesBarrowItem", item);
						showBobDialogue(p, 101);
					}
				} else if (option == 1) { // talk
					showBobDialogue(p, 107);
				} else if (option == 2) { // trade
					p.setShopSession(new ShopSession(p, 4));
				}
		    });
            Server.registerCoordinateEvent(talkToBobAreaEvent);
	    }
开发者ID:slapglif,项目名称:runescape-server-csharp,代码行数:20,代码来源:BrokenBarrows.cs

示例7: leverTeleport

	    public static void leverTeleport(Player p, int option) {
		    p.getPackets().closeInterfaces();
		    Location teleLocation = new Location(LEVER_COORDINATES[option][0], LEVER_COORDINATES[option][1], LEVER_COORDINATES[option][2]);
		    
            Event leverTeleportEvent = new Event(200);
            leverTeleportEvent.setAction(() => {
				leverTeleportEvent.stop();
				if (p.getTemporaryAttribute("teleblocked") != null) {
					p.getPackets().sendMessage("A magical force prevents you from teleporting!");
					return;
				} else if ((p.getTemporaryAttribute("teleporting") != null )) {
					return;
				}
				p.setLastAnimation(new Animation(2140));
				p.getPackets().closeInterfaces();
				p.setTemporaryAttribute("teleporting", true);
                p.getWalkingQueue().resetWalkingQueue();
				p.getPackets().clearMapFlag();
				SkillHandler.resetAllSkills(p);
                Event levelTeleportStartEvent = new Event(700);
                levelTeleportStartEvent.setAction(() => {
					levelTeleportStartEvent.stop();
					p.setLastAnimation(new Animation(8939, 0));
					p.setLastGraphics(new Graphics(1576, 0));
                    Event levelTeleportFinishEvent = new Event(1800);
                    levelTeleportFinishEvent.setAction(() => {
                        levelTeleportFinishEvent.stop();
						p.teleport(teleLocation);
						p.setLastAnimation(new Animation(8941, 0));
						p.setLastGraphics(new Graphics(1577, 0));
						Teleport.resetTeleport(p);
					});
                    Server.registerEvent(levelTeleportFinishEvent);
				});
                Server.registerEvent(levelTeleportStartEvent);
		    });
            Server.registerEvent(leverTeleportEvent);
	    }
开发者ID:slapglif,项目名称:runescape-server-csharp,代码行数:38,代码来源:Wilderness.cs

示例8: showBentleyDialogue

	    public static void showBentleyDialogue(Player p, int status) {
		    int newStatus = -1;
		    p.getPackets().softCloseInterfaces();
		    if (p.getTemporaryAttribute("unmovable") != null) {
			    return;
		    }
		    switch(status) {
			    case 240:
				    p.getPackets().sendNPCHead(4540, 241, 2);
				    p.getPackets().modifyText("Captain Bentley", 241, 3);
				    p.getPackets().modifyText("Well, hello there " + p.getLoginDetails().getUsername() + ", ready to set sail?", 241, 4);
				    p.getPackets().animateInterface(9827, 241, 2);
				    p.getPackets().sendChatboxInterface2(241);
				    newStatus = 241;
				    break;
				
			    case 241:
				    p.getPackets().modifyText("I'd like to travel to..", 235, 1);
				    p.getPackets().modifyText("Canifis", 235, 2);
				    p.getPackets().modifyText("Waterbirth Isle", 235, 3);
				    p.getPackets().modifyText("Pest Control", 235, 4);
				    p.getPackets().modifyText("Warrior Guild", 235, 5);
				    p.getPackets().modifyText("Fremmenik Shore", 235, 6);
				    p.getPackets().sendChatboxInterface2(235);
				    newStatus = 242;
				    break;
				
			    case 242: // Canifis
				    travel(p, 0, false);
				    break;
				
			    case 243: // Waterbirth isle
				    travel(p, 1, false);
				    break;
				
			    case 244: // Pest control
				    travel(p, 2, false);
				    break;
				
			    case 245: // Warrior guild
				    int attackLevel = p.getSkills().getMaxLevel(Skills.SKILL.ATTACK);
				    int strengthLevel = p.getSkills().getMaxLevel(Skills.SKILL.STRENGTH);
				    bool hasA99 = attackLevel == 99 || strengthLevel == 99;
				    if (((attackLevel + strengthLevel) >= 130) || hasA99) {
					    travel(p, 3, false);
				    } else {
					    p.getPackets().sendNPCHead(4540, 243, 2);
					    p.getPackets().modifyText("Captain Bentley", 243, 3);
					    p.getPackets().modifyText("I'm sorry " + p.getLoginDetails().getUsername() + ", I cannot take you there.", 243, 4);
					    p.getPackets().modifyText("A combined Attack & Strength level of 130 is ", 243, 5);
					    p.getPackets().modifyText("required to use The Warrior Guild.", 243, 6);
					    p.getPackets().animateInterface(9827, 243, 2);
					    p.getPackets().sendChatboxInterface2(243);
				    }
				    break;
				
			    case 246: // Fremmenik shore
				    travel(p, 4, false);
				    break;
				
		    }
		    if (newStatus != -1) {
			    p.setTemporaryAttribute("dialogue", newStatus);
		    }
	    }
开发者ID:slapglif,项目名称:runescape-server-csharp,代码行数:65,代码来源:BoatOptions.cs

示例9: showCaptainBarnabyDialogue

	    public static void showCaptainBarnabyDialogue(Player p, int status) {
		    int newStatus = -1;
		    p.getPackets().softCloseInterfaces();
		    if (p.getTemporaryAttribute("unmovable") != null) {
			    return;
		    }
		    switch(status) {
			    case 410:
				    p.getPackets().sendPlayerHead(64, 2);
				    p.getPackets().modifyText(p.getLoginDetails().getUsername(), 64, 3);
				    p.getPackets().modifyText("Could you take me back to Oo'glog please?", 64, 4);
				    p.getPackets().animateInterface(9827, 64, 2);
				    p.getPackets().sendChatboxInterface2(64);
				    newStatus = 411;
				    break;
				
			    case 411:
				    p.getPackets().sendNPCHead(4962, 241, 2);
				    p.getPackets().modifyText("Captain Barnaby", 241, 3);
				    p.getPackets().modifyText("Yes! it's freezing here, let's go!", 241, 4);
				    p.getPackets().animateInterface(9827, 241, 2);
				    p.getPackets().sendChatboxInterface2(241);
				    newStatus = 412;
				    break;
				
			    case 412:
				    travel(p, 4, true);
				    break;
		    }
		    if (newStatus != -1) {
			    p.setTemporaryAttribute("dialogue", newStatus);
		    }
	    }
开发者ID:slapglif,项目名称:runescape-server-csharp,代码行数:33,代码来源:BoatOptions.cs

示例10: showArnorDialogue

	    public static void showArnorDialogue(Player p, int status) {
		    int newStatus = -1;
		    p.getPackets().softCloseInterfaces();
		    if (p.getTemporaryAttribute("unmovable") != null) {
			    return;
		    }
		    switch(status) {
			    case 370:
				    p.getPackets().sendPlayerHead(64, 2);
				    p.getPackets().modifyText(p.getLoginDetails().getUsername(), 64, 3);
				    p.getPackets().modifyText("Could you take me back to Oo'glog please?", 64, 4);
				    p.getPackets().animateInterface(9827, 64, 2);
				    p.getPackets().sendChatboxInterface2(64);
				    newStatus = 371;
				    break;
				
			    case 371:
				    p.getPackets().sendNPCHead(1361, 241, 2);
				    p.getPackets().modifyText("Arnor", 241, 3);
				    p.getPackets().modifyText("Of course, follow me.", 241, 4);
				    p.getPackets().animateInterface(9827, 241, 2);
				    p.getPackets().sendChatboxInterface2(241);
				    newStatus = 372;
				    break;
				
			    case 372:
				    travel(p, 3, true);
				    break;
		    }
		    if (newStatus != -1) {
			    p.setTemporaryAttribute("dialogue", newStatus);
		    }
	    }
开发者ID:slapglif,项目名称:runescape-server-csharp,代码行数:33,代码来源:BoatOptions.cs

示例11: showSquireDialogue

	    public static void showSquireDialogue(Player p, int status) {
		    int newStatus = -1;
		    p.getPackets().softCloseInterfaces();
		    if (p.getTemporaryAttribute("unmovable") != null) {
			    return;
		    }
		    switch(status) {
			    case 340:
				    p.getPackets().sendPlayerHead(64, 2);
				    p.getPackets().modifyText(p.getLoginDetails().getUsername(), 64, 3);
				    p.getPackets().modifyText("Could you take me back to Oo'glog please?", 64, 4);
				    p.getPackets().animateInterface(9827, 64, 2);
				    p.getPackets().sendChatboxInterface2(64);
				    newStatus = 341;
				    break;
				
			    case 341:
				    p.getPackets().sendNPCHead(3781, 241, 2);
				    p.getPackets().modifyText("Squire", 241, 3);
				    p.getPackets().modifyText("Certainly! Please visit Pest Control again soon.", 241, 4);
				    p.getPackets().animateInterface(9827, 241, 2);
				    p.getPackets().sendChatboxInterface2(241);
				    newStatus = 342;
				    break;
				
			    case 342:
				    travel(p, 2, true);
				    break;
		    }
		    if (newStatus != -1) {
			    p.setTemporaryAttribute("dialogue", newStatus);
		    }
	    }
开发者ID:slapglif,项目名称:runescape-server-csharp,代码行数:33,代码来源:BoatOptions.cs

示例12: showJarvaldDialogue

	    public static void showJarvaldDialogue(Player p, int status) {
		    int newStatus = -1;
		    p.getPackets().softCloseInterfaces();
		    if (p.getTemporaryAttribute("unmovable") != null) {
			    return;
		    }
		    switch(status) {
			    case 300:
				    p.getPackets().sendPlayerHead(64, 2);
				    p.getPackets().modifyText(p.getLoginDetails().getUsername(), 64, 3);
				    p.getPackets().modifyText("Could you take me back to Oo'glog please?", 64, 4);
				    p.getPackets().animateInterface(9827, 64, 2);
				    p.getPackets().sendChatboxInterface2(64);
				    newStatus = 301;
				    break;
				
			    case 301:
				    p.getPackets().sendNPCHead(2436, 241, 2);
				    p.getPackets().modifyText("Jarvald", 241, 3);
				    p.getPackets().modifyText("No problem. Off we go!", 241, 4);
				    p.getPackets().animateInterface(9827, 241, 2);
				    p.getPackets().sendChatboxInterface2(241);
				    newStatus = 302;
				    break;
				
			    case 302:
				    travel(p, 1, true);
				    break;
		    }
		    if (newStatus != -1) {
			    p.setTemporaryAttribute("dialogue", newStatus);
		    }
	    }
开发者ID:slapglif,项目名称:runescape-server-csharp,代码行数:33,代码来源:BoatOptions.cs

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

示例14: crossDitch

	    public static void crossDitch(Player p, int x, int y) {
		    if (p.getTemporaryAttribute("unmovable") != null) {
			    return;
		    }
                AreaEvent crossDitchAreaEvent = new AreaEvent(p, x, y - 1, x, y + 2);
                crossDitchAreaEvent.setAction(() => {
				    p.getPackets().closeInterfaces();
				    p.getWalkingQueue().resetWalkingQueue();
				    p.setTemporaryAttribute("unmovable", true);
				    int newY = p.getLocation().getY() >= 3523 ? p.getLocation().getY()-3 : p.getLocation().getY()+3;
				    int dir = newY == 3 ? 0 : 4;
				    Location faceLocation = new Location(p.getLocation().getX(), dir == 3 ? 3523 : 3520, 0);
				    p.setFaceLocation(faceLocation);
                    Event crossDitchMoveEvent = new Event(500);
                    crossDitchMoveEvent.setAction(() => {
					    crossDitchMoveEvent.stop();
					    p.setLastAnimation(new Animation(6132));
					    int regionX = p.getUpdateFlags().getLastRegion().getRegionX();
					    int regionY = p.getUpdateFlags().getLastRegion().getRegionY();
					    int lX = (p.getLocation().getX() - ((regionX - 6) * 8));
					    int lY = (p.getLocation().getY() - ((regionY - 6) * 8));
					    ForceMovement movement = new ForceMovement(lX, lY, lX, newY, 33, 60, dir);
					    p.setForceMovement(movement);		
					    p.setFaceLocation(new Location(x, y, 0));
                        Event crossDitchTeleportEvent = new Event(1250);
                        crossDitchTeleportEvent.setAction(() => {
						    crossDitchTeleportEvent.stop();
						    int playerY = p.getLocation().getY();
						    int nY = playerY >= 3523 ? 3520 : 3523;
						    p.teleport(new Location(p.getLocation().getX(), nY, 0));
						    p.removeTemporaryAttribute("unmovable");
				        });
                        Server.registerEvent(crossDitchTeleportEvent);
			    });
                Server.registerEvent(crossDitchMoveEvent);
		    });
            Server.registerCoordinateEvent(crossDitchAreaEvent);
	    }
开发者ID:slapglif,项目名称:runescape-server-csharp,代码行数:38,代码来源:Wilderness.cs

示例15: doObstacle

	    public static void doObstacle(Player p, int index) {
		    if (p.getTemporaryAttribute("unmovable") != null) {
			    return;
		    }
            switch (index)
            {
                case 0: // 3 planks, northern (east side)
                case 1: // 3 planks, middle (east side)
                case 2: // 3 planks, southern (east side)
                case 3: // 3 planks, northern (west side)
                case 4: // 3 planks, middle (west side)
                case 5: // 3 planks, southern (west side)
                    int logXCoord = index <= 2 ? (int)AGILITY_ARENA_OBJECTS[index][1] + 1 : (int)AGILITY_ARENA_OBJECTS[index][1] - 1;
                    int logDirectionX = index <= 2 ? -7 : +7;
                    CoordinateEvent plankObstaclesCoordinateEvent = new CoordinateEvent(p, new Location(logXCoord, (int)AGILITY_ARENA_OBJECTS[index][2], 3));
                    plankObstaclesCoordinateEvent.setAction(() =>
                    {
                        bool running = p.getWalkingQueue().isRunToggled();
                        p.getWalkingQueue().setRunToggled(false);
                        p.getWalkingQueue().resetWalkingQueue();
                        p.getPackets().clearMapFlag();
                        p.setTemporaryAttribute("unmovable", true);
                        p.getAppearance().setWalkAnimation(155);
                        p.getUpdateFlags().setAppearanceUpdateRequired(true);
                        p.getWalkingQueue().forceWalk(logDirectionX, 0);
                        Event plankObstaclesEvent = new Event(4300);
                        plankObstaclesEvent.setAction(() =>
                        {
                            plankObstaclesEvent.stop();
                            p.removeTemporaryAttribute("unmovable");
                            p.getAppearance().setWalkAnimation(-1);
                            p.getUpdateFlags().setAppearanceUpdateRequired(true);
                            p.getSkills().addXp(Skills.SKILL.AGILITY, (double)AGILITY_ARENA_OBJECTS[index][3]);
                            p.getWalkingQueue().setRunToggled(running);
                        });
                        Server.registerEvent(plankObstaclesEvent);
                    });
                    Server.registerCoordinateEvent(plankObstaclesCoordinateEvent);
                    break;

                case 6: //Handholds obstacle east of planks.
                case 7: //Handholds obstacle west of planks.
                    int handHoldsDirectionX = 1;
                    int handHoldsDirectionY = 1;
                    if (index == 6) {
                        handHoldsDirectionX = -1;
                        handHoldsDirectionY = +1;
                    } else if (index == 7) {
                        handHoldsDirectionX = +1;
                        handHoldsDirectionY = -1;
                    }
                    CoordinateEvent handholdsObstacleCoordinateEvent = new CoordinateEvent(p, new Location((int)AGILITY_ARENA_OBJECTS[index][1], (int)AGILITY_ARENA_OBJECTS[index][2], 3));
                    handholdsObstacleCoordinateEvent.setAction(() =>
                    {
                        bool running = p.getWalkingQueue().isRunToggled();
                        p.getWalkingQueue().setRunToggled(false);
                        p.getWalkingQueue().resetWalkingQueue();
                        p.getPackets().clearMapFlag();
                        p.setTemporaryAttribute("unmovable", true);
                        p.setLastAnimation(new Animation(1121));
                        p.setFaceLocation(new Location(p.getLocation().getX(), p.getLocation().getY() + handHoldsDirectionY, 3));
                        Event handholdsObstaclesEvent = new Event(700);
                        int handholdsObstaclesCounter = 0;
                        handholdsObstaclesEvent.setAction(() =>
                        {
                            p.setLastAnimation(new Animation(1122));
                            int regionX = p.getUpdateFlags().getLastRegion().getRegionX();
                            int regionY = p.getUpdateFlags().getLastRegion().getRegionY();
                            int lX = (p.getLocation().getX() - ((regionX - 6) * 8));
                            int lY = (p.getLocation().getY() - ((regionY - 6) * 8));
                            p.setForceMovement(new ForceMovement(lX, lY, lX + handHoldsDirectionX, lY, 0, 5, 0));
                            if (handholdsObstaclesCounter++ >= 7)
                            {
                                p.setLastAnimation(new Animation(65535));
                                handholdsObstaclesEvent.stop();
                                p.removeTemporaryAttribute("unmovable");
                                p.getSkills().addXp(Skills.SKILL.AGILITY, (double)AGILITY_ARENA_OBJECTS[index][3]);
                                p.getWalkingQueue().setRunToggled(running);
                                return;
                            }
                            Event teleportEvent = new Event(500);
                            teleportEvent.setAction(() =>
                            {
                                teleportEvent.stop();
                                p.teleport(new Location(p.getLocation().getX() + handHoldsDirectionX, p.getLocation().getY(), 3));
                            });
                            Server.registerEvent(teleportEvent);
                        });
                        Server.registerEvent(handholdsObstaclesEvent);
                    });
                    Server.registerCoordinateEvent(handholdsObstacleCoordinateEvent);
                    break;
            }
	    }
开发者ID:slapglif,项目名称:runescape-server-csharp,代码行数:94,代码来源:Obstacles.cs


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