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


C# Player.setLastAnimation方法代码示例

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


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

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

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

示例3: execute

        public void execute(Player player, string[] arguments)
        {
            if (arguments.Length == 0)
            {
                player.getPackets().sendMessage("[Animation command]: ::emote emote_number");
                return;
            }

            int animation = 0;
            if (!int.TryParse(arguments[0], out animation))
            {
                player.getPackets().sendMessage("[Animation command]: ::emote emote_number");
                return;
            }

            player.setLastAnimation(new model.Animation(animation));
        }
开发者ID:slapglif,项目名称:runescape-server-csharp,代码行数:17,代码来源:Animation.cs

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

示例5: enterArena

	    public static void enterArena(Player p, int objectX, int objectY) {
            CoordinateEvent enterArenaCoordinateEvent = new CoordinateEvent(p, new Location(2809, 3193, 0));
            enterArenaCoordinateEvent.setAction(() => {
				if (!p.hasPaidAgilityArena()) {
					p.getPackets().sendMessage("You must pay Cap'n Izzy the entrance fee before you can enter the Agility Arena.");
					return;
				}
				p.setLastAnimation(new Animation(827));
                Event teleportArenaEvent = new Event(1000);
                teleportArenaEvent.setAction(() => {
					p.setPaidAgilityArena(false);
					p.teleport(new Location(2805, 9589, 3));
					teleportArenaEvent.stop();
				});
                Server.registerEvent(teleportArenaEvent);
		    });
            Server.registerCoordinateEvent(enterArenaCoordinateEvent);
	    }
开发者ID:slapglif,项目名称:runescape-server-csharp,代码行数:18,代码来源:AgilityArena.cs

示例6: exitArena

	    public static void exitArena(Player p, int objectX, int objectY) {
            CoordinateEvent exitArenaCoordinateEvent = new CoordinateEvent(p, new Location(2805, 9589, 3));
            exitArenaCoordinateEvent.setAction(() => {
				p.setLastAnimation(new Animation(828));
                Event exitArenaEvent = new Event(1000);
                exitArenaEvent.setAction(() => {
					p.teleport(new Location(2809, 3193, 0));
					exitArenaEvent.stop();
				});
                Server.registerEvent(exitArenaEvent);
		    });
            Server.registerCoordinateEvent(exitArenaCoordinateEvent);
	    }
开发者ID:slapglif,项目名称:runescape-server-csharp,代码行数:13,代码来源:AgilityArena.cs

示例7: emote


//.........这里部分代码省略.........
                    skill = Skills.SKILL.HERBLORE;
                    skillcapeAnimation = 4969;
                    skillcapeGraphic = 835;
                    break;
                /*
                 * Agility cape.
                 */
                case 9771:
                case 9772:
                    skill = Skills.SKILL.AGILITY;
                    skillcapeAnimation = 4977;
                    skillcapeGraphic = 830;
                    break;
                /*
                 * Thieving cape.
                 */
                case 9777:
                case 9778:
                    skill = Skills.SKILL.THIEVING;
                    skillcapeAnimation = 4965;
                    skillcapeGraphic = 826;
                    break;
                /*
                 * Slayer cape.
                 */
                case 9786:
                case 9787:
                    skill = Skills.SKILL.SLAYER;
                    skillcapeAnimation = 4937;//need animation
                    skillcapeGraphic = 812;//need graphic
                    break;
                /*
                 * Farming cape.
                 */
                case 9810:
                case 9811:
                    skill = Skills.SKILL.FARMING;
                    skillcapeAnimation = 4963;
                    skillcapeGraphic = 825;
                    break;
                /*
                 * Runecraft cape.
                 */
                case 9765:
                case 9766:
                    skill = Skills.SKILL.RUNECRAFTING;
                    skillcapeAnimation = 4947;
                    skillcapeGraphic = 817;
                    break;
                /*
                 * Hunter's cape
                 */
                case 9948:
                case 9949:
                    skill = Skills.SKILL.HUNTER;
                    skillcapeAnimation = 5158;
                    skillcapeGraphic = 907;
                    break;
                /*
                 * Construct. cape.
                 */
                case 9789:
                case 9790:
                    skill = Skills.SKILL.CONSTRUCTION;
                    skillcapeAnimation = 4953;
                    skillcapeGraphic = 820;
                    break;
                /*
                 * Summoning cape.
                 */
                case 12169:
                case 12170:
                    skill = Skills.SKILL.SUMMONING;
                    skillcapeAnimation = 8525;
                    skillcapeGraphic = 1515;
                    break;
                /*
                 * Quest cape.
                 */
                case 9813:
                    skillcapeAnimation = 4945;
                    skillcapeGraphic = 816;
                    player.setLastAnimation(new Animation(skillcapeAnimation));
                    player.setLastGraphics(new Graphics(skillcapeGraphic));
                    return true;
                default:
                    didEmote = false;
                    break;
            }
            if (player.getSkills().getMaxLevel(skill) == 99)
            {
                player.setLastAnimation(new Animation(skillcapeAnimation));
                player.setLastGraphics(new Graphics(skillcapeGraphic));
            }
            else
            {
                didEmote = false;
            }
            return didEmote;
        }
开发者ID:slapglif,项目名称:runescape-server-csharp,代码行数:101,代码来源:Skillcape.cs

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

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

示例10: handleInvenClickItem

	    private void handleInvenClickItem(Player player, Packet packet) {
		    int slot = packet.readLEShortA();
		    int item = packet.readShortA();
		    int childId = packet.readLEShort();
		    int interfaceId = packet.readLEShort();
		    if (slot > 28 || slot < 0 || player.isDead() || player.getTemporaryAttribute("cantDoAnything") != null) {
			    return;
		    }
		    SkillHandler.resetAllSkills(player);
		    if (player.getInventory().getItemInSlot(slot) == item) {
			    player.getPackets().closeInterfaces();
			    if (Consumables.isEating(player, player.getInventory().getItemInSlot(slot), slot))
				    return;
			    else if (Herblore.idHerb(player, player.getInventory().getItemInSlot(slot)))
				    return;
			    else if (RuneCraft.fillPouch(player, (RuneCraftData.POUCHES)player.getInventory().getItemInSlot(slot)))
				    return;
			    else if (Prayer.wantToBury(player,  player.getInventory().getItemInSlot(slot), slot))
				    return;
			    else if (Teleport.useTeletab(player, player.getInventory().getItemInSlot(slot), slot))
				    return;
			    else if (FarmingAmulet.showOptions(player, player.getInventory().getItemInSlot(slot)))
				    return;

			    switch(item) {
				    case 4155: // Slayer gem
					    Slayer.doDialogue(player, 1051);
					    break;
					
				    case 6: // Dwarf multicannon
					    if (player.getCannon() != null) {
						    player.getPackets().sendMessage("You already have a cannon set up!");
						    break;
					    }
					    player.setCannon(new DwarfCannon(player));
					    break;
			
				    case 5073: // Nest with seeds.
				    case 5074: // Nest with jewellery.
					    Woodcutting.randomNestItem(player, item);
					    break;
					
				    case 952: // Spade
					    player.setLastAnimation(new Animation(830));
					    if (Barrows.enterCrypt(player)) {
						    player.getPackets().sendMessage("You've broken into a crypt!");
						    break;
					    }
					    player.getPackets().sendMessage("You find nothing.");
					    break;
			    }
		    }
	    }
开发者ID:slapglif,项目名称:runescape-server-csharp,代码行数:53,代码来源:ItemInteract.cs

示例11: useLever

 public static void useLever(Player p, int id, Location leverLocation)
 {
     if (p.getTemporaryAttribute("teleporting") != null)
     {
         return;
     }
     foreach (LoadedLaddersAndStairs.Lever lever in LoadedLaddersAndStairs.levers)
     {
         if (lever.getId() == id)
         {
             if (lever.getLeverLocation().Equals(leverLocation))
             {
                 LoadedLaddersAndStairs.Lever l = lever;
                 //TODO when in use it cant be used (in use = lever is facing down)
                 CoordinateEvent useLeverCoordinateEvent = new CoordinateEvent(p, l.getLeverLocation());
                 useLeverCoordinateEvent.setAction(() =>
                 {
                     p.setFaceLocation(l.getFaceLocation());
                     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);
                     l.setInUse(true);
                     Event useLeverEvent = new Event(700);
                     useLeverEvent.setAction(() =>
                     {
                         useLeverEvent.stop();
                         p.setLastAnimation(new Animation(8939, 0));
                         p.setLastGraphics(new Graphics(1576, 0));
                         l.setInUse(false);
                         Event setLeverTeleportEvent = new Event(1800);
                         setLeverTeleportEvent.setAction(() =>
                         {
                             setLeverTeleportEvent.stop();
                             p.teleport(l.getTeleLocation());
                             p.setLastAnimation(new Animation(8941, 0));
                             p.setLastGraphics(new Graphics(1577, 0));
                             Teleport.resetTeleport(p);
                         });
                         Server.registerEvent(setLeverTeleportEvent);
                     });
                     Server.registerEvent(useLeverEvent);
                 });
                 Server.registerCoordinateEvent(useLeverCoordinateEvent);
                 break;
             }
         }
     }
 }
开发者ID:slapglif,项目名称:runescape-server-csharp,代码行数:60,代码来源:LaddersAndStairs.cs

示例12: teleport

 public static void teleport(Player p, LoadedLaddersAndStairs.HeightObject obj)
 {
     p.getWalkingQueue().resetWalkingQueue();
     p.setTemporaryAttribute("unmovable", true);
     p.setFaceLocation(obj.getLocation());
     if (obj.getAnimation() != -1)
     {
         p.setLastAnimation(new Animation(obj.getAnimation()));
     }
     Event teleportEvent = new Event(obj.getAnimation() != -1 ? obj.getTeleDelay() : 500);
     teleportEvent.setAction(() =>
     {
         teleportEvent.stop();
         p.teleport(obj.getTeleLocation());
         p.removeTemporaryAttribute("unmovable");
     });
     Server.registerEvent(teleportEvent);
 }
开发者ID:slapglif,项目名称:runescape-server-csharp,代码行数:18,代码来源:LaddersAndStairs.cs

示例13: emote

        /**
         * Handles a player emote: does the appropriate animation.
         * @param player
         * @param buttonId
         * @return
         */
        public static bool emote(Player player, int buttonId)
        {
            if (buttonId == 2)
            {
                player.setLastAnimation(new Animation(855, 0));
            }
            else if (buttonId == 3)
            {
                player.setLastAnimation(new Animation(856, 0));
            }
            else if (buttonId == 4)
            {
                player.setLastAnimation(new Animation(858, 0));
            }
            else if (buttonId == 5)
            {
                player.setLastAnimation(new Animation(859, 0));
            }
            else if (buttonId == 6)
            {
                player.setLastAnimation(new Animation(857, 0));
            }
            else if (buttonId == 7)
            {
                player.setLastAnimation(new Animation(863, 0));
            }
            else if (buttonId == 8)
            {
                player.setLastAnimation(new Animation(2113, 0));
            }
            else if (buttonId == 9)
            {
                player.setLastAnimation(new Animation(862, 0));
            }
            else if (buttonId == 10)
            {
                player.setLastAnimation(new Animation(864, 0));
            }
            else if (buttonId == 11)
            {
                player.setLastAnimation(new Animation(861, 0));
            }
            else if (buttonId == 12)
            {
                player.setLastAnimation(new Animation(2109, 0));
            }
            else if (buttonId == 13)
            {
                player.setLastAnimation(new Animation(2111, 0));
            }
            else if (buttonId == 14)
            {
                player.setLastAnimation(new Animation(866, 0));
            }
            else if (buttonId == 15)
            {
                player.setLastAnimation(new Animation(2106, 0));
            }
            else if (buttonId == 16)
            {
                player.setLastAnimation(new Animation(2107, 0));
            }
            else if (buttonId == 17)
            {
                player.setLastAnimation(new Animation(2108, 0));
            }
            else if (buttonId == 18)
            {
                player.setLastAnimation(new Animation(860, 0));
            }
            else if (buttonId == 19)
            {
                player.setLastAnimation(new Animation(0x558, 0));
                player.setLastGraphics(new Graphics(574, 0));
            }
            else if (buttonId == 20)
            {
                player.setLastAnimation(new Animation(2105, 0));
            }
            else if (buttonId == 21)
            {
                player.setLastAnimation(new Animation(2110, 0));
            }
            else if (buttonId == 22)
            {
                player.setLastAnimation(new Animation(865, 0));
            }
            else if (buttonId == 23)
            {
                player.setLastAnimation(new Animation(2112, 0));
            }
            else if (buttonId == 24)
            {
                player.setLastAnimation(new Animation(0x84F, 0));
//.........这里部分代码省略.........
开发者ID:slapglif,项目名称:runescape-server-csharp,代码行数:101,代码来源:Emotes.cs

示例14: fightCaveAttacks

	    public static void fightCaveAttacks(Npc npc, Player p) {
		    if (npc.isDead() || npc.isDestroyed() || p.isDead() || p.isDestroyed() || p.isDead() || !Location.inFightCave(p.getLocation()) || p.getTeleportTo() != null) {
			    return;
		    }
		    double damage = misc.randomDouble(npc.getMaxHit());
            PrayerData.PrayerHeadIcon prayerHeadIcon = p.getPrayers().getHeadIcon();
		    int hitDelay = npc.getHitDelay();
		    int animation = npc.getAttackAnimation();
		    switch(npc.getId()) {
			    case 2734: // Tz-Kih (lvl 22)
			    case 2735:
                    if (prayerHeadIcon == PrayerData.PrayerHeadIcon.MELEE)
                    {
					    damage = 0;
				    }
				    break;
				
			    case 2739: // Tz-Xil (lvl 90)
			    case 2740:
                    if (prayerHeadIcon == PrayerData.PrayerHeadIcon.RANGE)
                    {
					    damage = 0;
				    }
				    p.getPackets().sendProjectile(npc.getLocation(), p.getLocation(), 32, 1616, 50, 40, 34, 50, p);
				    break;
				
			    case 2741: // Yt-MejKot (lvl 180)
			    case 2742:
                    if (prayerHeadIcon == PrayerData.PrayerHeadIcon.MELEE)
                    {
					    damage = 0;
				    }
				    // TODO healing
				    break;
				
			    case 2743: // Ket-Zek (lvl 360)
			    case 2744:
				    if (!p.getLocation().withinDistance(npc.getLocation(), 2)) {
					    hitDelay = 1600;
					    animation = 9266;
					    npc.setLastGraphics(new Graphics(1622));
					    damage = misc.randomDouble(49);
                        if (prayerHeadIcon == PrayerData.PrayerHeadIcon.MAGIC)
                        {
						    damage = 0;
					    }
                        Event sendProjectileToNpc = new Event(300);
                        sendProjectileToNpc.setAction(() => {
							sendProjectileToNpc.stop();
							p.getPackets().sendProjectile(npc.getLocation(), p.getLocation(), 32, 1623, 50, 40, 34, 80, p);
					    });
                        Server.registerEvent(sendProjectileToNpc);
				    } else {
					    damage = misc.randomDouble(64);
                        if (prayerHeadIcon == PrayerData.PrayerHeadIcon.MELEE)
                        {
						    damage = 0;
					    }
				    }
				    break;
				
			    case 2745: // TzTok Jad (lvl 702)
				    doJadAttacks(p, npc);
				    break;
		    }
		    if (npc.getId() == 2745){
			    return;
		    }
		    if (animation != 65535) {
			    npc.setLastAnimation(new Animation(animation));
		    }
            p.setLastAttacked(Environment.TickCount);
            npc.setLastAttack(Environment.TickCount);
		    p.setAttacker(npc);
		    npc.resetCombatTurns();
		    if (damage > p.getHp()) {
			    damage = p.getHp();
		    }
		    int npcId = npc.getId();

            Event losePrayerFightingEvent = new Event(hitDelay);
            losePrayerFightingEvent.setAction(() => {
				losePrayerFightingEvent.stop();
				if (!Location.inFightCave(p.getLocation()) || p.getTeleportTo() != null) {
					return;
				}
				if (npcId == 2734 || npcId == 2735) {
                    int prayerLevel = p.getSkills().getCurLevel(Skills.SKILL.PRAYER);
                    int newPrayerLevel = prayerLevel -= (int)(damage + 1);
					if (newPrayerLevel <= 0) {
						newPrayerLevel = 0;
					}
					p.getSkills().setCurLevel(Skills.SKILL.PRAYER, newPrayerLevel);
                    p.getPackets().sendSkillLevel(Skills.SKILL.PRAYER);
				} else if (npcId == 2743 || npcId == 2744) {
					if (misc.random(1) == 0) {
						p.setLastGraphics(new Graphics(1624, 0));
					}
				}
				if ((p.getCombatTurns() > 2 || p.getCombatTurns() < 0)) {
//.........这里部分代码省略.........
开发者ID:slapglif,项目名称:runescape-server-csharp,代码行数:101,代码来源:FightCave.cs

示例15: doJadAttacks

	    private static void doJadAttacks(Player p, Npc npc) {
		    if (npc.getHp() <= (npc.getMaxHp() * 0.50)) {
			    if (p.getFightCave() != null) {
                    if (!p.getFightCave().isHealersSpawned())
                    {
					    summonJadHealers(p, npc);
					    p.getFightCave().setHealersSpawned(true);
				    }
			    }
		    }
		    npc.resetCombatTurns();
		    npc.setEntityFocus(p.getClientIndex());
		    switch(misc.random(1)) {
			    case 0: // Range
				    npc.setLastAnimation(new Animation(9276));
				    npc.setLastGraphics(new Graphics(1625));
                    Event jadRangeAttackEvent = new Event(1600);
                    int jadRangeAttackStatus = 0;
                    jadRangeAttackEvent.setAction(() => {
					    double hit = 0;
                        PrayerData.PrayerHeadIcon prayerHeadIcon = p.getPrayers().getHeadIcon();
                        if (jadRangeAttackStatus == 0)
                        {
                            jadRangeAttackStatus++;
							jadRangeAttackEvent.setTick(1500);
							p.setLastGraphics(new Graphics(451));
                            if (prayerHeadIcon == PrayerData.PrayerHeadIcon.RANGE)
								hit = 0;
							else
								hit = misc.randomDouble(96);
						} else {
                            if (prayerHeadIcon != PrayerData.PrayerHeadIcon.RANGE)
								hit = misc.randomDouble(96);
							jadRangeAttackEvent.stop();
                            p.setLastAttacked(Environment.TickCount);
                            npc.setLastAttack(Environment.TickCount);
							p.setAttacker(npc);
							if (hit > p.getHp()) {
								hit = p.getHp();
							}
							if (!Location.inFightCave(p.getLocation()) || p.getTeleportTo() != null) {
								return;
							}
							if ((p.getCombatTurns() > 2 || p.getCombatTurns() < 0)) {
								p.setLastAnimation(new Animation(p.getDefenceAnimation()));
							}
							p.hit(hit);
                            Event animationEvent = new Event(100);
                            animationEvent.setAction(() => {
								animationEvent.stop();
								p.setLastGraphics(new Graphics(157, 0, 100));
							});
                            Server.registerEvent(animationEvent);
						}
				    });
                    Server.registerEvent(jadRangeAttackEvent);
				    break;
	
			    case 1: // Magic
				    npc.setLastGraphics(new Graphics(1626));
                    Event jadMagicAttackEvent = new Event(300);
                    int jadMagicAttackStatus = 0;
                    jadMagicAttackEvent.setAction(() => {
					    double hit = 0;
						PrayerData.PrayerHeadIcon prayerHeadIcon = p.getPrayers().getHeadIcon();
						npc.setLastAnimation(new Animation(9278));
                        if (jadMagicAttackStatus == 0)
                        {
                            jadMagicAttackStatus++;
							jadMagicAttackEvent.setTick(1600);
							p.getPackets().sendProjectile(npc.getLocation(), p.getLocation(), 32, 1627, 50, 40, 34, 90, p);
						} else {
							jadMagicAttackEvent.stop();
                            if (prayerHeadIcon == PrayerData.PrayerHeadIcon.MAGIC)
                            {
								hit = 0;
							} else {
								hit = misc.randomDouble(96);
							}
                            p.setLastAttacked(Environment.TickCount);
                            npc.setLastAttack(Environment.TickCount);
							p.setAttacker(npc);
							if (hit > p.getHp()) {
								hit = p.getHp();
							}
							if (!Location.inFightCave(p.getLocation()) || p.getTeleportTo() != null) {
								return;
							}
							if ((p.getCombatTurns() > 2 || p.getCombatTurns() < 0)) {
								p.setLastAnimation(new Animation(p.getDefenceAnimation()));
							}
							p.hit(hit);
                            Event animationEvent = new Event(100);
                            animationEvent.setAction(() => {
								animationEvent.stop();
								p.setLastGraphics(new Graphics(157, 0, 100));
							});
                            Server.registerEvent(animationEvent);
						}
				    });
//.........这里部分代码省略.........
开发者ID:slapglif,项目名称:runescape-server-csharp,代码行数:101,代码来源:FightCave.cs


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