Пример #1
0
 public int getStandWalkAnimation()
 {
     if (player.getAppearance().getWalkAnimation() > 0)
     {
         return(player.getAppearance().getWalkAnimation());
     }
     if (slots[3].getItemId() == -1)
     {
         return(1426);
     }
     return(ItemData.forId(slots[3].getItemId()).getAnimation());
 }
Пример #2
0
 public static void openInterface(Player p)
 {
     p.getPackets().displayInterface(771);
     p.getPackets().sendPlayerHead(771, 79);
     p.getPackets().animateInterface(9804, 771, 79);
     p.getPackets().sendConfig(1262, p.getAppearance().getGender() == 2 ? 1 : 8);
     p.getAppearance().setTemporaryAppearance(new Appearance());
     p.getAppearance().getTemporaryAppearance().setColoursArray(p.getAppearance().getColoursArray());
     p.getAppearance().getTemporaryAppearance().setLookArray(p.getAppearance().getLookArray());
     p.getAppearance().getTemporaryAppearance().setGender(p.getAppearance().getGender());
     p.removeTemporaryAttribute("hairToggle");
 }
Пример #3
0
 public static void openInterface(Player p)
 {
     p.getPackets().displayInterface(771);
     p.getPackets().sendPlayerHead(771, 79);
     p.getPackets().animateInterface(9804, 771, 79);
     p.getPackets().sendConfig(1262, p.getAppearance().getGender() == 2 ? 1 : 8);
     p.getAppearance().setTemporaryAppearance(new Appearance());
     p.getAppearance().getTemporaryAppearance().setColoursArray(p.getAppearance().getColoursArray());
     p.getAppearance().getTemporaryAppearance().setLookArray(p.getAppearance().getLookArray());
     p.getAppearance().getTemporaryAppearance().setGender(p.getAppearance().getGender());
     p.removeTemporaryAttribute("hairToggle");
 }
Пример #4
0
 private static int getTorsoColour(Player p, int button)
 {
     int[] buttons = { 189, 190, 191, 192, 193, 194, 195, 196 };
     int[] colours = { 10, 1, 2, 3, 4, 5, 6, 7 };
     for (int i = 0; i < buttons.Length; i++)
     {
         if (button == buttons[i])
         {
             return(colours[i]);
         }
     }
     return(p.getAppearance().getColour(2));
 }
Пример #5
0
 private static int getSkinColour(Player p, int button)
 {
     int[] buttons = { 151, 152, 153, 154, 155, 156, 157, 158 };
     int[] skins   = { 10, 1, 2, 3, 4, 5, 6, 7 };
     for (int i = 0; i < buttons.Length; i++)
     {
         if (button == buttons[i])
         {
             return(skins[i]);
         }
     }
     return(p.getAppearance().getColour(4));
 }
Пример #6
0
        public static void sortButton(Player p, int button)
        {
            Appearance temp = p.getAppearance().getTemporaryAppearance();

            if (button == 362)
            {
                p.setAppearance(p.getAppearance().getTemporaryAppearance());
                p.getPackets().closeInterfaces();
                return;
            }
            if ((button == 52 && temp.getGender() == 1) || (button == 49 && temp.getGender() == 0))
            {
                p.getPackets().sendConfig(1262, temp.getGender() == 0 ? 1 : 8);
                temp.setGender(temp.getGender() == 0 ? 1 : 0);
                return;
            }
            if (button == 93)
            {
                temp.setLook(0, getHairStyle(p, false));
                return;
            }
            if (button == 93)
            {
                temp.setLook(0, getHairStyle(p, true));
                return;
            }
            if (button >= 151 && button <= 158)
            {
                temp.setColour(4, getSkinColour(p, button));
                return;
            }
            if (button >= 189 && button <= 217)
            {
                temp.setColour(2, getTorsoColour(p, button));
                return;
            }
        }
Пример #7
0
 public static void sortButton(Player p, int button)
 {
     Appearance temp = p.getAppearance().getTemporaryAppearance();
     if (button == 362)
     {
         p.setAppearance(p.getAppearance().getTemporaryAppearance());
         p.getPackets().closeInterfaces();
         return;
     }
     if ((button == 52 && temp.getGender() == 1) || (button == 49 && temp.getGender() == 0))
     {
         p.getPackets().sendConfig(1262, temp.getGender() == 0 ? 1 : 8);
         temp.setGender(temp.getGender() == 0 ? 1 : 0);
         return;
     }
     if (button == 93)
     {
         temp.setLook(0, getHairStyle(p, false));
         return;
     }
     if (button == 93)
     {
         temp.setLook(0, getHairStyle(p, true));
         return;
     }
     if (button >= 151 && button <= 158)
     {
         temp.setColour(4, getSkinColour(p, button));
         return;
     }
     if (button >= 189 && button <= 217)
     {
         temp.setColour(2, getTorsoColour(p, button));
         return;
     }
 }
Пример #8
0
        public void execute(Player player, string[] arguments)
        {
            if (arguments.Length == 0)
            {
                player.getPackets().sendMessage("[PlayerAsNpc command]: ::pnpc npcId");
                return;
            }

            int npcId = 0;
            if (!int.TryParse(arguments[0], out npcId))
            {
                player.getPackets().sendMessage("[PlayerAsNpc command]: ::pnpc npcId [npcId is not a number error]");
                return;
            }

            player.getAppearance().setNpcId(npcId);
            player.getUpdateFlags().setAppearanceUpdateRequired(true);
        }
Пример #9
0
        private static int getHairStyle(Player p, bool decrease)
        {
            int oldHair = p.getAppearance().getLook(0);
            int newHair = oldHair;

            if (p.getTemporaryAttribute("hairToggle") == null)
            {
                p.setTemporaryAttribute("hairToggle", 0);
                return(0);
            }
            newHair = (int)p.getTemporaryAttribute("hairToggle");
            newHair = decrease ? -1 : +1;
            if (newHair == 11)
            {
                newHair = 186;//
            }
            else if (newHair == 12)
            {
                newHair = 188;//
            }
            else if (newHair == 13)
            {
                newHair = 190;//
            }
            else if (newHair == 14)
            {
                newHair = 192;//
            }
            else if (newHair == 15)
            {
                newHair = 194;//
            }
            else if (newHair == 16)
            {
                newHair = 196; //
            }
            else if (newHair == 17)
            {
                //17 to 25 dump from rs
            }

            p.setTemporaryAttribute("hairToggle", newHair);
            return(newHair);
        }
Пример #10
0
        private static int getHairStyle(Player p, bool decrease)
        {
            int oldHair = p.getAppearance().getLook(0);
            int newHair = oldHair;
            if (p.getTemporaryAttribute("hairToggle") == null)
            {
                p.setTemporaryAttribute("hairToggle", 0);
                return 0;
            }
            newHair = (int)p.getTemporaryAttribute("hairToggle");
            newHair = decrease ? -1 : +1;
            if (newHair == 11)
            {
                newHair = 186;//
            }
            else if (newHair == 12)
            {
                newHair = 188;//
            }
            else if (newHair == 13)
            {
                newHair = 190;//
            }
            else if (newHair == 14)
            {
                newHair = 192;//
            }
            else if (newHair == 15)
            {
                newHair = 194;//
            }
            else if (newHair == 16)
            {
                newHair = 196; //
            }
            else if (newHair == 17)
            {
                //17 to 25 dump from rs
            }

            p.setTemporaryAttribute("hairToggle", newHair);
            return newHair;
        }
Пример #11
0
        private static void appendAppearanceUpdate(Player p, PacketBuilder updateBlock)
        {
            PacketBuilder playerProps = new PacketBuilder().setSize(Packet.Size.Bare);

            Appearance app = p.getAppearance();
            playerProps.addByte((byte)(app.getGender() & 0xFF));
            if ((app.getGender() & 0x2) == 2)
            {
                playerProps.addByte((byte)0);
                playerProps.addByte((byte)0);
            }
            playerProps.addByte((byte)p.getPrayers().getPkIcon());
            playerProps.addByte((byte)p.getPrayers().getHeadIcon());
            if (!app.isInvisible())
            {
                if (!app.isNpc())
                {
                    for (int i = 0; i < 4; i++)
                    {
                        if (p.getEquipment().getItemInSlot((ItemData.EQUIP)i) != -1)
                        {
                            playerProps.addUShort(32768 + p.getEquipment().getSlot((ItemData.EQUIP)i).getDefinition().getEquipId());
                        }
                        else
                        {
                            playerProps.addByte((byte)0);
                        }
                    }
                    if (p.getEquipment().getItemInSlot(ItemData.EQUIP.CHEST) != -1)
                    {
                        playerProps.addUShort(32768 + p.getEquipment().getSlot(ItemData.EQUIP.CHEST).getDefinition().getEquipId());
                    }
                    else
                    {
                        playerProps.addUShort(0x100 + app.getLook(ItemData.EQUIP.AMULET));
                    }
                    if (p.getEquipment().getItemInSlot(ItemData.EQUIP.SHIELD) != -1)
                    {
                        playerProps.addUShort(32768 + p.getEquipment().getSlot(ItemData.EQUIP.SHIELD).getDefinition().getEquipId());
                    }
                    else
                    {
                        playerProps.addByte((byte)0);
                    }
                    Item chest = p.getEquipment().getSlot(ItemData.EQUIP.CHEST);
                    if (chest != null && chest.getDefinition() != null)
                    {
                        if (!ItemData.isFullBody(chest.getDefinition()))
                        {
                            playerProps.addUShort(0x100 + app.getLook(ItemData.EQUIP.WEAPON));
                        }
                        else
                        {
                            playerProps.addByte((byte)0);
                        }
                    }
                    else
                    {
                        playerProps.addUShort(0x100 + app.getLook(ItemData.EQUIP.WEAPON));
                    }
                    if (p.getEquipment().getItemInSlot(ItemData.EQUIP.LEGS) != -1)
                    {
                        playerProps.addUShort(32768 + p.getEquipment().getSlot(ItemData.EQUIP.LEGS).getDefinition().getEquipId());
                    }
                    else
                    {
                        playerProps.addUShort(0x100 + app.getLook(ItemData.EQUIP.SHIELD));
                    }
                    Item hat = p.getEquipment().getSlot(ItemData.EQUIP.HAT);
                    if (hat != null && hat.getDefinition() != null)
                    {
                        if (!ItemData.isFullHat(hat.getDefinition()) && !ItemData.isFullMask(hat.getDefinition()))
                        {
                            playerProps.addUShort(0x100 + app.getLook(ItemData.EQUIP.HAT));
                        }
                        else
                        {
                            playerProps.addByte((byte)0);
                        }
                    }
                    else
                    {
                        playerProps.addUShort(0x100 + app.getLook(ItemData.EQUIP.HAT));
                    }
                    if (p.getEquipment().getItemInSlot(ItemData.EQUIP.HANDS) != -1)
                    {
                        playerProps.addUShort(32768 + p.getEquipment().getSlot(ItemData.EQUIP.HANDS).getDefinition().getEquipId());
                    }
                    else
                    {
                        playerProps.addUShort(0x100 + app.getLook(ItemData.EQUIP.CHEST));
                    }
                    if (p.getEquipment().getItemInSlot(ItemData.EQUIP.FEET) != -1)
                    {
                        playerProps.addUShort(32768 + p.getEquipment().getSlot(ItemData.EQUIP.FEET).getDefinition().getEquipId());
                    }
                    else
                    {
                        playerProps.addUShort(0x100 + app.getLook(6));
                    }
                    if (hat != null && hat.getDefinition() != null)
                    {
                        if (!ItemData.isFullMask(hat.getDefinition()))
                        {
                            playerProps.addUShort(0x100 + app.getLook(ItemData.EQUIP.CAPE));
                        }
                        else
                        {
                            playerProps.addByte((byte)0);
                        }
                    }
                    else
                    {
                        playerProps.addUShort(0x100 + app.getLook(ItemData.EQUIP.CAPE));
                    }
                }
                else
                {
                    playerProps.addUShort(-1);
                    playerProps.addUShort(app.getNpcId());
                    playerProps.addByte((byte)255);
                }
            }
            else
            {
                for (int i = 0; i < 12; i++)
                {
                    playerProps.addByte((byte)0);
                }
            }
            foreach (int colour in app.getColoursArray())
            {
                playerProps.addByte((byte)colour);
            }
            playerProps.addUShort(p.getEquipment().getStandWalkAnimation());
            playerProps.addLong(p.getLoginDetails().getLongName());
            playerProps.addByte((byte)p.getSkills().getCombatLevel());
            playerProps.addUShort(0);
            playerProps.addByte((byte)0);
            updateBlock.addByteA((byte)(playerProps.getLength() & 0xFF));
            updateBlock.addBytes(playerProps.toPacket().getData(), 0, playerProps.getLength());
        }
Пример #12
0
        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;
            }
        }
Пример #13
0
 private void resetVariables(Player p)
 {
     p.setSkullCycles(0);
     p.getSpecialAttack().resetSpecial();
     p.setLastkiller(null);
     p.setDead(false);
     p.setEntityFocus(65535);
     p.setPoisonAmount(0);
     p.clearKillersHits();
     p.setLastVengeanceTime(0);
     p.setVengeance(false);
     p.removeTemporaryAttribute("willDie");
     p.setFrozen(false);
     p.removeTemporaryAttribute("unmovable");
     p.setAntifireCycles(0);
     p.setSuperAntipoisonCycles(0);
     p.setTeleblockTime(0);
     p.removeTemporaryAttribute("teleblocked");
     p.setTarget(null);
     p.setAttacker(null);
     foreach (Skills.SKILL skill in Enum.GetValues(typeof(Skills.SKILL)))
         p.getSkills().setCurLevel(skill, p.getSkills().getMaxLevel(skill));
     p.getPackets().sendSkillLevels();
     Prayer.deactivateAllPrayers(p);
     if (p.getTemporaryAttribute("cantDoAnything") != null)
     {
         p.getAppearance().setInvisible(false);
         p.getUpdateFlags().setAppearanceUpdateRequired(true);
         p.removeTemporaryAttribute("cantDoAnything");
         p.removeTemporaryAttribute("unmovable");
         teleportToWaitingRoom(p, false);
         p.getPackets().closeInterfaces();
         p.getPackets().setMinimapStatus(0);
         p.getPackets().clearMapFlag();
     }
 }
Пример #14
0
 public void useOrb(Player p, int button)
 {
     if (p.getTemporaryAttribute("teleporting") != null)
     {
         return;
     }
     if (button == -1)
     {
         AreaEvent useOrbAreaEvent = new AreaEvent(p, 2398, 5171, 2400, 5173);
         useOrbAreaEvent.setAction(() =>
         {
             p.getPackets().displayInventoryInterface(374);
             p.getAppearance().setInvisible(true);
             p.getUpdateFlags().setAppearanceUpdateRequired(true);
             p.setTemporaryAttribute("cantDoAnything", true);
             p.setTemporaryAttribute("unmovable", true);
             p.getPackets().setMinimapStatus(2);
             Event useOrbEvent = new Event(500);
             useOrbEvent.setAction(() =>
             {
                 useOrbEvent.stop();
                 int random = Misc.random(4);
                 p.teleport(new Location(ORB_COORDINATES[1][random], ORB_COORDINATES[2][random], 0));
             });
             Server.registerEvent(useOrbEvent);
         });
         Server.registerCoordinateEvent(useOrbAreaEvent);
     }
     else
     {
         if (p.getTemporaryAttribute("cantDoAnything") != null)
         {
             if (button == 5)
             {
                 Event useOrbTwoEvent = new Event(500);
                 useOrbTwoEvent.setAction(() =>
                 {
                     useOrbTwoEvent.stop();
                     p.getAppearance().setInvisible(false);
                     p.getUpdateFlags().setAppearanceUpdateRequired(true);
                     p.removeTemporaryAttribute("cantDoAnything");
                     p.removeTemporaryAttribute("unmovable");
                     teleportToWaitingRoom(p, false);
                     p.getPackets().closeInterfaces();
                     p.getPackets().setMinimapStatus(0);
                     p.getPackets().clearMapFlag();
                 });
                 Server.registerEvent(useOrbTwoEvent);
                 return;
             }
             for (int i = 0; i < ORB_COORDINATES[0].Length; i++)
             {
                 if (button == ORB_COORDINATES[0][i])
                 {
                     int j = i;
                     p.setTemporaryAttribute("teleporting", true);
                     Event teleportToOrbEvent = new Event(500);
                     teleportToOrbEvent.setAction(() =>
                     {
                         teleportToOrbEvent.stop();
                         p.teleport(new Location(ORB_COORDINATES[1][j], ORB_COORDINATES[2][j], 0));
                         Teleport.resetTeleport(p);
                     });
                     Server.registerEvent(teleportToOrbEvent);
                     return;
                 }
             }
         }
     }
 }
Пример #15
0
 private static int getTorsoColour(Player p, int button)
 {
     int[] buttons = { 189, 190, 191, 192, 193, 194, 195, 196 };
     int[] colours = { 10, 1, 2, 3, 4, 5, 6, 7 };
     for (int i = 0; i < buttons.Length; i++)
     {
         if (button == buttons[i])
         {
             return colours[i];
         }
     }
     return p.getAppearance().getColour(2);
 }
Пример #16
0
 private static int getSkinColour(Player p, int button)
 {
     int[] buttons = { 151, 152, 153, 154, 155, 156, 157, 158 };
     int[] skins = { 10, 1, 2, 3, 4, 5, 6, 7 };
     for (int i = 0; i < buttons.Length; i++)
     {
         if (button == buttons[i])
         {
             return skins[i];
         }
     }
     return p.getAppearance().getColour(4);
 }