Example #1
0
        public static void interactWithAubury(Player p, Npc n, int option)
        {
            p.setEntityFocus(n.getClientIndex());
            AreaEvent interactWithAuburyAreaEvent = new AreaEvent(p, n.getLocation().getX() - 1, n.getLocation().getY() - 1, n.getLocation().getX() + 1, n.getLocation().getY() + 1);
            interactWithAuburyAreaEvent.setAction(() =>
            {
                n.setFaceLocation(p.getLocation());
                p.setFaceLocation(n.getLocation());
                p.setEntityFocus(65535);
                switch (option)
                {
                    case 1: // talk to

                        break;

                    case 2: // trade
                        p.setShopSession(new ShopSession(p, 3));
                        break;

                    case 3: // teleport
                        RuneCraft.teleportToEssMine(p, n);
                        break;
                }
            });
            Server.registerCoordinateEvent(interactWithAuburyAreaEvent);
        }
Example #2
0
 public static bool dialogue(Player p, Npc npc, bool rightClickPay)
 {
     if ((npc.getId() != 1055 && npc.getId() != 437) || (rightClickPay && npc.getId() != 437))
     {
         return false;
     }
     p.setEntityFocus(npc.getClientIndex());
     AreaEvent dialogueAreaEvent = new AreaEvent(p, npc.getLocation().getX() - 1, npc.getLocation().getY() - 1, npc.getLocation().getX() + 1, npc.getLocation().getY() + 1);
     dialogueAreaEvent.setAction(() =>
     {
         npc.setFaceLocation(p.getLocation());
         int status = npc.getId() == 1055 ? 43 : 1;
         if (rightClickPay)
         {
             if (!p.getInventory().hasItemAmount(995, AGILITY_ARENA_PRICE))
             {
                 p.getPackets().sendMessage("You don't have enough money to pay the entrance fee.");
                 return;
             }
             status = 29;
         }
         doDialogue(p, status);
     });
     Server.registerCoordinateEvent(dialogueAreaEvent);
     return true;
 }
Example #3
0
 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);
 }
Example #4
0
        public static bool interactTzhaarNPC(Player p, Npc n, int option)
        {
            if (n.getId() != 2622 && n.getId() != 2620 && n.getId() != 2623 && n.getId() != 2619 && n.getId() != 2617 && n.getId() != 2618)
            {
                return false;
            }
            p.setEntityFocus(n.getClientIndex());
            int npcX = n.getLocation().getX();
            int npcY = n.getLocation().getY();
            AreaEvent interactTzhaarNpcAreaEvent = new AreaEvent(p, npcX - 1, npcY - 1, npcX + 1, npcY + 1);
            interactTzhaarNpcAreaEvent.setAction(() =>
            {
                p.setFaceLocation(n.getLocation());
                p.setEntityFocus(65535);
                switch (n.getId())
                {
                    case 2619: // Bankers
                        if (option == 1)
                        { // Talk
                        }
                        else if (option == 2)
                        { // Bank
                            p.getBank().openBank();
                        }
                        else if (option == 3)
                        { // Collect
                        }
                        break;

                    //TODO tzhaar stores
                    case 2622: // Ore shop
                        if (option == 1)
                        { // Speak
                        }
                        else if (option == 2)
                        { // Trade
                            p.setShopSession(new ShopSession(p, 3));
                        }
                        break;
                }
            });
            Server.registerCoordinateEvent(interactTzhaarNpcAreaEvent);
            return true;
        }
Example #5
0
        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;
        }
Example #6
0
        private static void summonJadHealers(Player p, Npc jad)
        {
            for (int i = 0; i < 4; i++)
            {
                Npc npc = new Npc(2746);
                Location minCoords = new Location((20000 + 2363) + (200 * p.getIndex()), 25502, 0);
                Location maxCoords = new Location((20000 + 2430) + (200 * p.getIndex()), 25123, 0);
                npc.setMinimumCoords(minCoords);
                npc.setMaximumCoords(maxCoords);
                npc.setLocation(new Location((20000 + 2387) + (200 * p.getIndex()) + Misc.random(22), 20000 + 5069 + Misc.random(33), 0));
                npc.setEntityFocus(jad.getClientIndex());
                npc.setOwner(p);
                npc.getFollow().setFollowing(jad);
                npc.setTarget(null);
                Server.getNpcList().Add(npc);

                Event jadHealerEvent = new Event(2000);
                jadHealerEvent.setAction(() =>
                {
                    if (npc.isDead() || npc.isHidden() || npc.isDestroyed())
                    {
                        jadHealerEvent.stop();
                        return;
                    }
                    if (npc.getLocation().withinDistance(jad.getLocation(), 2) && !npc.inCombat())
                    {
                        if (Misc.random(7) == 0)
                        {
                            jad.setLastGraphics(new Graphics(444));
                            npc.setLastAnimation(new Animation(9254));
                            int jadMaxHp = jad.getMaxHp();
                            jad.heal((int)(jadMaxHp * 0.5));
                        }
                    }
                });
                Server.registerEvent(jadHealerEvent);
            }
        }
Example #7
0
 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);
 }
Example #8
0
 public static bool talkToWarriorGuildNPC(Player p, Npc n, int slot)
 {
     if (n.getId() != 4289)
     {
         return false;
     }
     p.setEntityFocus(n.getClientIndex());
     int npcX = n.getLocation().getX();
     int npcY = n.getLocation().getY();
     AreaEvent talkToWarriorGuildNPCAreaEvent = new AreaEvent(p, npcX - 1, npcY - 1, npcX + 1, npcY + 1);
     talkToWarriorGuildNPCAreaEvent.setAction(() =>
     {
         p.setFaceLocation(n.getLocation());
         p.setEntityFocus(65535);
         switch (n.getId())
         {
             case 4289: // Kamfreena
                 Dialogue.doDialogue(p, 77);
                 break;
         }
     });
     Server.registerCoordinateEvent(talkToWarriorGuildNPCAreaEvent);
     return true;
 }
Example #9
0
 public static bool openCoffin(Player p, int objectId)
 {
     if (objectId != 6823 && objectId != 6771 && objectId != 6821 && objectId != 6773 && objectId != 6822 && objectId != 6772)
     {
         return false;
     }
     int cryptIndex = getCryptIndex(p);
     if (cryptIndex == -1)
     {
         return false;
     }
     if (p.getBarrowBrothersKilled(cryptIndex))
     {
         p.getPackets().sendMessage("You don't find anything.");
         return true;
     }
     if (p.getBarrowTunnel() == cryptIndex)
     {
         p.getPackets().modifyText("You find a hidden tunnel, do you want to enter?", 210, 1);
         p.getPackets().sendChatboxInterface(210);
         p.setTemporaryAttribute("barrowTunnel", 1);
         return true;
     }
     foreach (Npc n in Server.getNpcList())
     {
         if (n.getId() == BROTHER_ID[cryptIndex])
         {
             if (n.getOwner().Equals(p))
             {
                 p.getPackets().sendMessage("You don't find anything.");
                 return true;
             }
         }
     }
     Npc npc = new Npc(BROTHER_ID[cryptIndex]);
     npc.setLocation(p.getLocation());
     npc.setEntityFocus(p.getClientIndex());
     npc.setOwner(p);
     npc.setTarget(p);
     npc.setCombatTurns(npc.getAttackSpeed());
     Server.getNpcList().Add(npc);
     p.getPackets().setArrowOnEntity(1, npc.getClientIndex());
     return true;
 }
Example #10
0
        public static void openChest(Player player)
        {
            Player p = player;
            if (p.getLocation().getZ() != 0 || p.getTemporaryAttribute("lootedBarrowChest") != null)
            {
                return;
            }
            if (!p.getLocation().inArea(3551, 9694, 3552, 9694))
            {
                AreaEvent openChestAreaEvent = new AreaEvent(p, 3551, 9694, 3552, 9694);
                openChestAreaEvent.setAction(() =>
                {
                    openChest(p);
                });
                Server.registerCoordinateEvent(openChestAreaEvent);
                return;
            }
            for (int i = 0; i < 6; i++)
            {
                if (!p.getBarrowBrothersKilled(i))
                {
                    foreach (Npc n in Server.getNpcList())
                    {
                        if (n != null)
                        {
                            if (n.getId() == BROTHER_ID[i])
                            {
                                if (n.getOwner().Equals(p))
                                {
                                    return;
                                }
                            }
                        }
                    }
                    Npc npc = new Npc(BROTHER_ID[i]);
                    npc.setLocation(p.getLocation());
                    npc.setEntityFocus(p.getClientIndex());
                    npc.setOwner(p);
                    npc.setTarget(p);
                    npc.setCombatTurns(npc.getAttackSpeed());
                    Server.getNpcList().Add(npc);
                    p.getPackets().setArrowOnEntity(1, npc.getClientIndex());
                    return;
                }
            }
            p.getPackets().sendMessage("You begin to lift open the massive chest...");
            p.setLastAnimation(new Animation(833));

            Event rewardEarthQuakeEvent = new Event(1000);
            rewardEarthQuakeEvent.setAction(() =>
            {
                rewardEarthQuakeEvent.stop();
                p.getPackets().sendMessage("..You loot the chest and the tomb begins to shake!");
                p.getPackets().createObject(6775, new Location(3551, 9695, 0), 0, 10);
                getBarrowReward(p);
                startEarthQuake(p);
            });
            Server.registerEvent(rewardEarthQuakeEvent);
        }
Example #11
0
 public static bool talkToMaster(Player p, Npc npc)
 {
     for (int i = 0; i < SLAYER_MASTERS.Length; i++)
     {
         if (npc.getId() == (int)SLAYER_MASTERS[i][0])
         {
             int j = i;
             p.setEntityFocus(npc.getClientIndex());
             AreaEvent talkToMasterAreaEvent = new AreaEvent(p, npc.getLocation().getX() - 1, npc.getLocation().getY() - 1, npc.getLocation().getX() + 1, npc.getLocation().getY() + 1);
             talkToMasterAreaEvent.setAction(() =>
             {
                 p.setTemporaryAttribute("slayerMaster", j);
                 npc.setFaceLocation(p.getLocation());
                 p.setFaceLocation(npc.getLocation());
                 p.setEntityFocus(65535);
                 doDialogue(p, 1000);
             });
             Server.registerCoordinateEvent(talkToMasterAreaEvent);
             return true;
         }
     }
     return false;
 }
Example #12
0
 public static bool openSlayerShop(Player p, Npc npc)
 {
     int id = npc.getId();
     if (id != 8273 && id != 1597 && id != 8274 && id != 1598 && id != 8275 || p.isDead())
     {
         return false;
     }
     p.setEntityFocus(npc.getClientIndex());
     AreaEvent openSlayerShopAreaEvent = new AreaEvent(p, npc.getLocation().getX() - 1, npc.getLocation().getY() - 1, npc.getLocation().getX() + 1, npc.getLocation().getY() + 1);
     openSlayerShopAreaEvent.setAction(() =>
     {
         p.setFaceLocation(npc.getLocation());
         npc.setFaceLocation(p.getLocation());
         p.setShopSession(new ShopSession(p, 2));
     });
     Server.registerCoordinateEvent(openSlayerShopAreaEvent);
     return true;
 }
Example #13
0
 public static bool openPointsInterface(Player p, Npc npc)
 {
     int id = npc.getId();
     if (id != 8273 && id != 1597 && id != 8274 && id != 1598 && id != 8275 || p.isDead())
     {
         return false;
     }
     p.setEntityFocus(npc.getClientIndex());
     AreaEvent openPointsInterfaceAreaEvent = new AreaEvent(p, npc.getLocation().getX() - 1, npc.getLocation().getY() - 1, npc.getLocation().getX() + 1, npc.getLocation().getY() + 1);
     openPointsInterfaceAreaEvent.setAction(() =>
     {
         p.setEntityFocus(65535);
         npc.setFaceLocation(p.getLocation());
         displayPoints(p, 1);
     });
     Server.registerCoordinateEvent(openPointsInterfaceAreaEvent);
     return true;
 }
Example #14
0
 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);
 }