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


C# Player.setFaceLocation方法代码示例

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


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

示例1: interactWithAliMorissaae

 public static void interactWithAliMorissaae(Player p, Npc n)
 {
     p.setEntityFocus(n.getClientIndex());
     AreaEvent interactWithAliMorissaaeAreaEvent = new AreaEvent(p, n.getLocation().getX() - 1, n.getLocation().getY() - 1, n.getLocation().getX() + 1, n.getLocation().getY() + 1);
     interactWithAliMorissaaeAreaEvent.setAction(() => {
         n.setFaceLocation(p.getLocation());
         p.setFaceLocation(n.getLocation());
         p.setEntityFocus(65535);
         showAliDialogue(p, 205);
     });
     Server.registerCoordinateEvent(interactWithAliMorissaaeAreaEvent);
 }
开发者ID:Krill156,项目名称:SharpEMU,代码行数:12,代码来源:AlKharid.cs

示例2: interactWithBoatNPC

        public static bool interactWithBoatNPC(Player p, Npc n)
        {
            int id = n.getId();
            if (id != 4540 && id != 1304 && id != 2436 && id != 3781 && id != 1361 && id != 4962) {
                return false;
            }
            p.setEntityFocus(n.getClientIndex());
            AreaEvent interactWithBoatNPCAreaEvent = new AreaEvent(p, n.getLocation().getX() - 1, n.getLocation().getY() - 1, n.getLocation().getX() + 1, n.getLocation().getY() + 1);
            interactWithBoatNPCAreaEvent.setAction(() => {
                n.setFaceLocation(p.getLocation());
                p.setFaceLocation(n.getLocation());
                p.setEntityFocus(65535);
                switch(n.getId()) {
                    case 4540: // Home boat
                        showBentleyDialogue(p, 240);
                        break;

                    case 1304: // Canifis sailor
                        showCanifisSailorDialogue(p, 280);
                        break;

                    case 2436: // Waterbirth isle
                        showJarvaldDialogue(p, 300);
                        break;

                    case 3781: // Pest control squire
                        showSquireDialogue(p, 340);
                        break;

                    case 1361: // Warrior guild
                        showArnorDialogue(p, 370);
                        break;

                    case 4962: // fremmenik shore
                        showCaptainBarnabyDialogue(p, 410);
                        break;
                }
            });
            Server.registerCoordinateEvent(interactWithBoatNPCAreaEvent);
            return true;
        }
开发者ID:Krill156,项目名称:SharpEMU,代码行数:41,代码来源:BoatOptions.cs

示例3: handleItemOnObject

        private void handleItemOnObject(Player player, Packet packet)
        {
            int objectX = packet.readShortA();
            int item = packet.readUShort();
            int objectY = packet.readLEShort();
            int slot = packet.readUShort();
            int interfaceId = packet.readLEShort();
            int child = packet.readUShort();
            int objectId = packet.readShortA();
            if (slot > 28 || slot < 0 || player.isDead() || player.getTemporaryAttribute("cantDoAnything") != null) {
                return;
            }
            Console.WriteLine("Item on object = " + objectId + " " + objectX + " " + objectY);
            SkillHandler.resetAllSkills(player);
            player.getPackets().closeInterfaces();
            player.setFaceLocation(new Location(objectX, objectY, player.getLocation().getZ()));
            if (player.getInventory().getItemInSlot(slot) == item) {
                if (Crafting.wantsToCraftOnObject(player, player.getInventory().getItemInSlot(slot), objectId)) {
                    return;
                } else if (Farming.interactWithPatch(player, objectId, objectX, objectY, player.getInventory().getItemInSlot(slot))) {
                    return;
                } else if (WarriorGuild.useAnimator(player, player.getInventory().getItemInSlot(slot), objectId, objectX, objectY)) {
                    return;
                }
                if (player.getInventory().getItemInSlot(slot) == 7936) {
                    if (RuneCraft.wantToRunecraft(player, objectId, objectX, objectY)) {
                        return;
                    }
                    if (RuneCraft.useTalisman(player, objectId, objectX, objectY)) {
                        return;
                    }
                }
                switch(objectId) {
                    case 6: // Cannon:
                        DwarfCannon cannon = player.getCannon();
                        Location l = new Location(objectX, objectY, player.getLocation().getZ());
                        if (cannon == null || (cannon != null & !l.withinDistance(cannon.getLocation(), 2))) {
                            player.getPackets().sendMessage("This isn't your cannon!");
                            break;
                        }
                        cannon.loadCannon();
                        break;

                    case 36781: // Lumbridge fountain.
                    case 24214:	// Fountain in east Varrock.
                    case 24265:	// Varrock main fountain.
                    case 11661:	// Falador waterpump.
                    case 11759:	// Falador south fountain.
                    case 879:	// Camelot fountains.
                    case 29529:	// Sink.
                    case 874:	// Sink.
                        if (FillVial.fillingVial(player, new Location(objectX, objectY, player.getLocation().getZ())) && player.getInventory().getItemInSlot(slot) == 229) {
                            break;
                        }
                        break;

                    case 2728: // Range in Catherby
                        if (Cooking.isCooking(player, player.getInventory().getItemInSlot(slot), false, -1, -1)) {
                            break;
                        }
                        break;

                    case 2732: // Fire
                        if (Cooking.isCooking(player, player.getInventory().getItemInSlot(slot), true, objectX, objectY)) {
                            break;
                        }
                        break;

                    case 36956: // Lumbridge furnace
                    case 11666: // Falador furnace
                        if (Smelting.wantToSmelt(player, player.getInventory().getItemInSlot(slot))) {
                            break;
                        } else if (Crafting.wantsToCraftOnObject(player, player.getInventory().getItemInSlot(slot), objectId)) {
                            break;
                        }
                        break;

                    case 2783: // Anvil
                        if (Smithing.wantToSmithOnAnvil(player, player.getInventory().getItemInSlot(slot), new Location(objectX, objectY, player.getLocation().getZ()))) {
                            break;
                        }
                        break;

                    default:
                        player.getPackets().sendMessage("Nothing interesting happens.");
                        break;
                }
            }
        }
开发者ID:Krill156,项目名称:SharpEMU,代码行数:89,代码来源:ItemInteract.cs

示例4: newMagicAttack


//.........这里部分代码省略.........
                p.getWalkingQueue().resetWalkingQueue();
                p.getPackets().clearMapFlag();
                p.setLastCombatType(Combat.CombatType.MAGE);
                return;
            }
            if (fakeNPC && !monsterInArea(p, target)) {
                p.removeTemporaryAttribute("autoCasting");
                Combat.resetCombat(p, 1);
                return;
            }
            int endGfx = END_GFX[index];
            double damage = misc.random(CombatFormula.getMagicHit(p, target, getSpellMaxHit(p, index)));
            bool mp = false;
            bool magicProtect = mp;
            if (target is Player) {
                mp = ((Player) target).getPrayers().getHeadIcon() == PrayerData.MAGIC;
            }
            if (magicProtect) {
                damage *= 0.60;
            }
            if (p.getEquipment().getItemInSlot(ItemData.EQUIP.WEAPON) == 8841) {
                damage *= 1.10; // void mace 10% hit increase.
            }
            if (damage == 0 && index != 41 && index != 42 && index != 43 && index != 44 && index != 45 && index != 46 && index != 47) {
                endGfx = 85;
            }
            if (!deleteRunes(p, RUNES[index], RUNE_AMOUNTS[index])) {
                p.setTarget(null);
                return;
            }
            p.getFollow().setFollowing(null);
            p.getWalkingQueue().resetWalkingQueue();
            p.getPackets().clearMapFlag();
            p.setFaceLocation(target.getLocation());
            if (HANDS_GFX[index] != -1) {
                p.setLastGraphics(new Graphics(HANDS_GFX[index], 0 , getStartingGraphicHeight(index)));
            }
            p.setLastAnimation(new Animation(SPELL_ANIM[index]));
            p.getPackets().closeInterfaces();
            if (target is Player) {
                ((Player) target).getPackets().closeInterfaces();
            }
            target.setAttacker(p);
            p.setTarget(target);
            target.setLastAttacked(Environment.TickCount);
            p.setLastAttack(Environment.TickCount);
            p.setLastMagicAttack(Environment.TickCount);
            p.setCombatTurns(p.getAttackSpeed());
            Combat.setSkull(p, target);
            if (damage > 0) {
                frozen = freezeTarget(index, target);
                if (!frozen && index == 31) {
                    endGfx = 1677;
                }
            }
            if (AIR_GFX[index] != -1 || ((index == 31 || index == 27) && target is Player && ((Player)target).getWalkingQueue().isRunning())) {
                sendProjectile(index, target, p);
            }
            if (damage > target.getHp()) {
                damage = target.getHp();
            }
            if (index == 47 && misc.random(2) == 0) {
                endGfx = 85;
            }
            Combat.checkIfWillDie(target, damage);
            Event doMagicAttackEvent = new Event(getSpellHitDelay(index));
开发者ID:Krill156,项目名称:SharpEMU,代码行数:67,代码来源:MagicCombat.cs

示例5: openTunnelDoor

        public static bool openTunnelDoor(Player player, int doorId, int x, int y)
        {
            if (doorId < 6716 || (doorId > 6731 && doorId < 6735) || doorId > 6750) {
                return false;
            }
            int index = getDoorIndex(doorId, x, y);
            int index2 = getOtherDoor(x, y); // index of the door next to the one you clicked.
            if (index == -1 || index2 == -1) {
                return false;
            }
            bool betweenDoors = player.getTemporaryAttribute("betweenDoors") != null;
            Location clickedDoor = new Location(DOOR_LOCATION[index][0], DOOR_LOCATION[index][1], 0);
            Location otherDoor = new Location(DOOR_LOCATION[index2][0], DOOR_LOCATION[index2][1], 0);
            int openDoorId = DOOR_OPEN_DIRECTION[index][0];
            int openDoorId2 = DOOR_OPEN_DIRECTION[index2][0];
            int openDirection = DOOR_OPEN_DIRECTION[index][2];
            int newX = openDirection == 1 ? x+1 : openDirection == 2 ? x : openDirection == 3 ? x-1 : openDirection == 4 ? x : x;
            int newY = openDirection == 1 ? y : openDirection == 2 ? y+1 : openDirection == 3 ? y : openDirection == 4 ? y-1 : y;
            int newX2 = openDirection == 1 ? DOOR_LOCATION[index2][0] + 1 : openDirection == 2 ? DOOR_LOCATION[index2][0] : openDirection == 3 ? DOOR_LOCATION[index2][0] - 1 : openDirection == 4 ? DOOR_LOCATION[index2][0] : DOOR_LOCATION[index2][0];
            int newY2 = openDirection == 1 ? DOOR_LOCATION[index2][1] : openDirection == 2 ? DOOR_LOCATION[index2][1] + 1 : openDirection == 3 ? DOOR_LOCATION[index2][1] : openDirection == 4 ? DOOR_LOCATION[index2][1] - 1 : DOOR_LOCATION[index2][1];
            int[] doorStandCoordinates = getDoorCoordinates(player, index, index2, betweenDoors);
            int[] walkDirections = getWalkDirections(player, index, index2, betweenDoors);
            player.setFaceLocation(clickedDoor);
            AreaEvent doorsWalkAreaEvent = new AreaEvent(player, doorStandCoordinates[0], doorStandCoordinates[1], doorStandCoordinates[2] + 1, doorStandCoordinates[3] + 1);
            doorsWalkAreaEvent.setAction(() => {
                player.setTemporaryAttribute("unmovable", true);

                Event forceWalkDoorEvent = new Event(800);
                forceWalkDoorEvent.setAction(() => {
                    player.getWalkingQueue().resetWalkingQueue();
                    foreach(Player p in Server.getPlayerList()) { //change door for all logged in players? uhh what?
                        p.getPackets().removeObject(clickedDoor, openDoorId == 6713 ? 4 : 3, 0);
                        p.getPackets().removeObject(otherDoor, openDoorId2 == 6732 ? 3 : 4, 0);
                        p.getPackets().createObject(openDoorId, new Location(newX, newY, 0), DOOR_OPEN_DIRECTION[index][1], 0);
                        p.getPackets().createObject(openDoorId2, new Location(newX2, newY2, 0), DOOR_OPEN_DIRECTION[index2][1], 0);
                    }
                    player.getWalkingQueue().forceWalk(walkDirections[0], walkDirections[1]);
                    forceWalkDoorEvent.stop();
                });
                Server.registerEvent(forceWalkDoorEvent);
                Event betweenDoorsEvent = new Event(betweenDoors ? 2200 : 1900);
                betweenDoorsEvent.setAction(() => {
                    int face = openDirection == 3 ? 0 : openDirection == 4 ? 3 : openDirection == 2 ? 1 : 2;
                    foreach(Player p in Server.getPlayerList()) {
                        p.getPackets().removeObject(new Location(newX, newY, 0), openDoorId == 6713 ? 4 : 3, 0);
                        p.getPackets().removeObject(new Location(newX2, newY2, 0), openDoorId2 == 6732 ? 3 : 4, 0);
                        p.getPackets().createObject(DOORS[index], clickedDoor, face, 0);
                        p.getPackets().createObject(DOORS[index2], otherDoor, face, 0);
                    }
                    player.removeTemporaryAttribute("unmovable");
                    if (!betweenDoors) {
                        player.getPackets().sendConfig(1270, 1);
                        player.setTemporaryAttribute("betweenDoors", true);
                    } else {
                        player.getPackets().sendConfig(1270, 0);
                        player.removeTemporaryAttribute("betweenDoors");
                    }
                    betweenDoorsEvent.stop();
                });
                Server.registerEvent(betweenDoorsEvent);
            });
            Server.registerCoordinateEvent(doorsWalkAreaEvent);
            return true;
        }
开发者ID:Krill156,项目名称:SharpEMU,代码行数:64,代码来源:Barrows.cs

示例6: clickDesk

        public void clickDesk(Player p, int x, int y, int option)
        {
            AreaEvent clickDeskAreaEvent = new AreaEvent(p, x - 1, y - 1, x + 1, y + 1);
            clickDeskAreaEvent.setAction(() =>
            {
                p.setFaceLocation(new Location(x, y, 0));
                switch (option)
                {
                    case 1:
                        break;

                    case 2:
                        p.getPackets().closeInterfaces();
                        p.setGESession(new GESession(p));
                        break;
                }
            });
            Server.registerCoordinateEvent(clickDeskAreaEvent);
        }
开发者ID:Krill156,项目名称:SharpEMU,代码行数:19,代码来源:GrandExchange.cs

示例7: 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:Krill156,项目名称:SharpEMU,代码行数:21,代码来源:BrokenBarrows.cs

示例8: 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:Krill156,项目名称:SharpEMU,代码行数:60,代码来源:LaddersAndStairs.cs

示例9: 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:Krill156,项目名称:SharpEMU,代码行数:18,代码来源:LaddersAndStairs.cs


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