상속: MonoBehaviour
예제 #1
0
        public static void tagPillar(Player p, int pillarIndex)
        {
            AreaEvent tagPillarAreaEvent = new AreaEvent(p, AGILITY_ARENA_PILLARS[pillarIndex][1] - 1, AGILITY_ARENA_PILLARS[pillarIndex][2] - 1, AGILITY_ARENA_PILLARS[pillarIndex][1] + 1, AGILITY_ARENA_PILLARS[pillarIndex][2] + 1);

            tagPillarAreaEvent.setAction(() => {
                if (p.getLocation().getZ() == 3)
                {
                    p.setFaceLocation(new Location(AGILITY_ARENA_PILLARS[pillarIndex][1], AGILITY_ARENA_PILLARS[pillarIndex][2], 3));
                    if (pillarIndex != currentPillar)
                    {
                        p.getPackets().sendMessage("You can only get a ticket when the flashing arrow is above the pillar!");
                        return;
                    }
                    if (p.isTaggedLastAgilityPillar())
                    {
                        p.getPackets().sendMessage("You have already tagged this pillar, wait until the arrow moves again.");
                        return;
                    }
                    int currentStatus = p.getAgilityArenaStatus();
                    if (currentStatus == 0)
                    {
                        p.getPackets().sendConfig(309, 4);
                        p.getPackets().sendMessage("You get tickets by tagging more than one pillar in a row. Tag the next pillar!");
                    }
                    else
                    {
                        p.getInventory().addItem(2996);
                        p.getPackets().sendMessage("You recieve an Agility Arena ticket!");
                    }
                    p.setAgilityArenaStatus(currentStatus == 0 ? 1 : 1);
                    p.setTaggedLastAgilityPillar(true);
                }
            });
            Server.registerCoordinateEvent(tagPillarAreaEvent);
        }
        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:     //1st click on desk [Use]
                    break;

                case 2:     //2nd click on desk [Exchange]
                    p.getPackets().closeInterfaces();
                    p.setGESession(new GESession(p, true));
                    break;

                case 3:     //3rd click on desk [Collect]
                    p.getPackets().closeInterfaces();
                    p.setGESession(new GESession(p, false));
                    break;

                case 4:                                   //4th click on desk [History]
                    //TODO: combine this with GESession, this is just interface test.
                    p.getPackets().displayInterface(643); //opens Grand Exchange History Box.
                    break;

                case 5:                                   //5th click on desk [Sets]
                    //TODO: combine this with GESession, this is just interface test.
                    p.getPackets().displayInterface(645); //opens Grand Exchange Sets Box.
                    break;
                }
            });
            Server.registerCoordinateEvent(clickDeskAreaEvent);
        }
예제 #3
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);
        }
예제 #4
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);
        }
예제 #5
0
 public static bool enterViaTiara(Player p, int Object, int x, int y)
 {
     if (Object < 7104 || Object > 7124)
     {
         return(false);
     }
     for (int i = 0; i < RUINS2.Length; i++)
     {
         if (Object == RUINS2[i])
         {
             int       j = i;
             AreaEvent enterViaTiaraAreaEvent = new AreaEvent(p, x - 1, y - 1, x + 4, y + 4);
             enterViaTiaraAreaEvent.setAction(() =>
             {
                 if (wearingTiara(p))
                 {
                     enterAltar(p, j);
                 }
             });
             Server.registerCoordinateEvent(enterViaTiaraAreaEvent);
             return(true);
         }
     }
     return(false);
 }
예제 #6
0
파일: Server.cs 프로젝트: Rut0/RSPS-CSharp
        public static void registerCoordinateEvent(AreaEvent areaEvent)
        {
            Event newCoordinateEvent = new Event(0);

            newCoordinateEvent.setAction(() =>
            {
                bool standingStill = areaEvent.getPlayer().getSprites().getPrimarySprite() == -1 && areaEvent.getPlayer().getSprites().getSecondarySprite() == -1;
                if (areaEvent.getPlayer().getDistanceEvent() == null || !areaEvent.getPlayer().getDistanceEvent().Equals(areaEvent))
                {
                    newCoordinateEvent.stop();
                    return;
                }
                if (standingStill)
                {
                    if (areaEvent.inArea())
                    {
                        areaEvent.run();
                        newCoordinateEvent.stop();
                        areaEvent.setDistanceEventNull();
                        return;
                    }
                }
                newCoordinateEvent.setTick(500);
            });
            registerEvent(newCoordinateEvent);
        }
예제 #7
0
        public static void enterCave(Player p)
        {
            AreaEvent enterCaveAreaEvent = new AreaEvent(p, 2438, 5168, 2439, 5168);

            enterCaveAreaEvent.setAction(() =>
            {
                /*
                 * Fight cave is 20k squares from the original place, then another (200 * playerIndex) squares west.
                 */
                Location instanceLocation = new Location((20000 + 2413) + (200 * p.getIndex()), 20000 + 5116, 0);
                p.teleport(instanceLocation);
                p.setFightCave(new FightCaveSession(p));

                Event caveNpcEvent = new Event(600);
                caveNpcEvent.setAction(() =>
                {
                    caveNpcEvent.stop();
                    p.getPackets().sendNPCHead(2617, 242, 1);
                    p.getPackets().modifyText("TzHaar-Mej-Jal", 242, 3);
                    p.getPackets().modifyText("You're on your own now, JalYt.", 242, 4);
                    p.getPackets().modifyText("Pepare to fight for your life!", 242, 5);
                    p.getPackets().animateInterface(9827, 242, 1);
                    p.getPackets().sendChatboxInterface2(242);
                });
                Server.registerEvent(caveNpcEvent);
            });
            Server.registerCoordinateEvent(enterCaveAreaEvent);
        }
예제 #8
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);
        }
예제 #9
0
 public static bool useObject(Player p, int id, Location location, int option)
 {
     foreach (LoadedLaddersAndStairs.HeightObject heightObject in LoadedLaddersAndStairs.objects)
     {
         if (heightObject.getId() == id)
         {
             if (heightObject.getLocation().Equals(location) && heightObject.getOption() == option)
             {
                 LoadedLaddersAndStairs.HeightObject obj = heightObject;
                 if (heightObject.getType() == LoadedLaddersAndStairs.Event_Type.COORDINATE_POSITION)
                 {
                     CoordinateEvent useObjectCoordinateEvent = new CoordinateEvent(p, heightObject.getStandLocation());
                     useObjectCoordinateEvent.setAction(() =>
                     {
                         LaddersAndStairs.teleport(p, obj);
                     });
                     Server.registerCoordinateEvent(useObjectCoordinateEvent);
                 }
                 else if (heightObject.getType() == LoadedLaddersAndStairs.Event_Type.AREA_POSITION)
                 {
                     AreaEvent useObjectAreaEvent = new AreaEvent(p, heightObject.getMinCoords().getX(), heightObject.getMinCoords().getY(), heightObject.getMaxCoords().getX(), heightObject.getMaxCoords().getY());
                     useObjectAreaEvent.setAction(() =>
                     {
                         LaddersAndStairs.teleport(p, obj);
                     });
                     Server.registerCoordinateEvent(useObjectAreaEvent);
                 }
                 return(true);
             }
         }
     }
     return(false);
 }
예제 #10
0
        private void ZoneSpecial(System.Windows.Forms.MouseEventArgs me)
        {
            int blockSize = (int)NudBlockSize.Value;
            int xVal      = (int)(me.Location.X / blockSize);
            int yVal      = (int)(me.Location.Y / blockSize);

            FrmPlaceSpecialBlock frmPlaceSpecialBlock = new FrmPlaceSpecialBlock(xVal, yVal);

            frmPlaceSpecialBlock.ShowDialog();
            AreaEvent res = frmPlaceSpecialBlock.res;

            if (res.AType == GameEnums.AreaEvent_Type.NONE)
            {
                return;
            }

            List <AreaEvent> oldOnes = listEventBlock.GetAreaEvent(res.AType, GameEnums.Direction.NONE, "", res.XVal, res.YVal);

            if (oldOnes.Count() > 0)
            {
                listEventBlock.eventsSource.Remove(oldOnes.First());
            }
            listEventBlock.eventsSource.Add(res);

            Pen mypen = new Pen(Color.Orange, 2f);

            g = Graphics.FromImage(DrawArea);
            g.DrawLine(mypen, xVal * blockSize, yVal * blockSize, xVal * blockSize + blockSize, yVal * blockSize + blockSize);
            g.DrawLine(mypen, xVal * blockSize + blockSize, yVal * blockSize, xVal * blockSize, yVal * blockSize + blockSize);
            PbPic.Image = DrawArea;
            g.Dispose();
        }
        public bool useDoor(Player p, int doorId, int doorX, int doorY, int doorHeight)
        {
            Location doorLocation = new Location(doorX, doorY, doorHeight);

            foreach (Door door in doors)
            {
                int id = door.isDoorOpen() ? door.getOpenDoorId() : door.getClosedDoorId();
                if (id == doorId)
                {
                    if (door.getDoorLocation().Equals(doorLocation))
                    {
                        if (door.isDoorOpen() && (Environment.TickCount - door.getLastChangeTime() <= PLAYER_CHANGE_DELAY))
                        {
                            // door was opened in the last PLAYER_CHANGE_DELAY ms..cant be instantly closed
                            return(true);
                        }
                        else if (!door.isClosable() && door.isDoorOpen())
                        {
                            // door cannot be closed by a player
                            return(true);
                        }
                        Door      d = door;
                        AreaEvent useDoorAreaEvent = new AreaEvent(p, doorLocation.getX() - 1, doorLocation.getY() - 1, doorLocation.getX() + 1, doorLocation.getY() + 1);
                        useDoorAreaEvent.setAction(() => {
                            changeDoor(p, d);
                        });
                        Server.registerCoordinateEvent(useDoorAreaEvent);
                        return(true);
                    }
                }
            }
            return(false);
        }
예제 #12
0
 public static bool leaveAltar(Player p, int Object, int x, int y)
 {
     if (Object < 2465 || Object > 2475)
     {
         return(false);
     }
     for (int i = 0; i < PORTALS.Length; i++)
     {
         if (Object == PORTALS[i])
         {
             if (i != 6)
             {
                 if (x != PORTAL_COORDS[i][0] && y != PORTAL_COORDS[i][1])
                 {
                     return(false);
                 }
             }
             else
             {
                 if (i == 6 && (x != 2163 && y != 4833) && (x != 2142 && y != 4854) && (x != 2121 && y != 4833) && (x != 2142 && y != 4812))
                 {
                     return(false);
                 }
             }
             int       j = i;
             AreaEvent leaveAltarAreaEvent = new AreaEvent(p, x - 1, y - 1, x + 1, y + 1);
             leaveAltarAreaEvent.setAction(() => {
                 teleportOutOfAltar(p, j);
             });
             Server.registerCoordinateEvent(leaveAltarAreaEvent);
             return(true);
         }
     }
     return(false);
 }
예제 #13
0
 public static bool useTalisman(Player p, int Object, int x, int y)
 {
     if (Object < 2452 || Object > 2461)
     {
         return(false);
     }
     for (int i = 0; i < RUINS.Length; i++)
     {
         if (Object == RUINS[i])
         {
             int       j = i;
             AreaEvent useTalismanAreaEvent = new AreaEvent(p, x - 1, y - 1, x + 4, y + 4);
             useTalismanAreaEvent.setAction(() =>
             {
                 if (hasTalisman(p, j))
                 {
                     enterAltar(p, j);
                 }
             });
             Server.registerCoordinateEvent(useTalismanAreaEvent);
             return(true);
         }
     }
     return(false);
 }
예제 #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);
        }
예제 #15
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);
        }
예제 #16
0
        public static void displayEmptyRockMessage(Player player, Location rockLocation)
        {
            AreaEvent displayEmptyRockMessageAreaEvent = new AreaEvent(player, rockLocation.getX() - 1, rockLocation.getY() - 1, rockLocation.getX() + 1, rockLocation.getY() + 1);

            displayEmptyRockMessageAreaEvent.setAction(() => {
                player.getPackets().sendMessage("There is currently no ore available from this rock.");
            });
        }
예제 #17
0
        public static void enterTzhaar(Player p)
        {
            AreaEvent enterTzhaarAreaEvent = new AreaEvent(p, 2866, 9570, 2866, 9572);

            enterTzhaarAreaEvent.setAction(() => {
                p.teleport(new Location(2480, 5175, 0));
            });
            Server.registerCoordinateEvent(enterTzhaarAreaEvent);
        }
예제 #18
0
        public static void exitTzhaar(Player p)
        {
            AreaEvent exitTzhaarAreaEvent = new AreaEvent(p, 2479, 5175, 2481, 5175);

            exitTzhaarAreaEvent.setAction(() => {
                p.teleport(new Location(2866, 9571, 0));
            });
            Server.registerCoordinateEvent(exitTzhaarAreaEvent);
        }
예제 #19
0
파일: Cooking.cs 프로젝트: Rut0/RSPS-CSharp
 public static bool isCooking(Player p, int item, bool fire, int fireX, int fireY)
 {
     for (int i = 0; i < MEAT_RAW.Length; i++)
     {
         if (item == MEAT_RAW[i])
         {
             if (fire)
             {
                 int       j = i;
                 AreaEvent setCookingAreaEvent = new AreaEvent(p, fireX - 1, fireY - 1, fireX + 1, fireY + 1);
                 setCookingAreaEvent.setAction(() =>
                 {
                     p.setFaceLocation(new Location(fireX, fireY, p.getLocation().getZ()));
                     if (Server.getGlobalObjects().fireExists(new Location(fireX, fireY, 0)))
                     {
                         setCookingItem(p, null);
                         p.setTemporaryAttribute("cookingFireLocation", new Location(fireX, fireY, p.getLocation().getZ()));
                         displayCookOption(p, j);
                     }
                 });
                 Server.registerCoordinateEvent(setCookingAreaEvent);
                 return(true);
             }
             setCookingItem(p, null);
             displayCookOption(p, i);
             return(true);
         }
     }
     for (int i = 0; i < MEAT_COOKED.Length; i++)
     {
         if (item == MEAT_COOKED[i])
         {
             if (fire)
             {
                 AreaEvent cookMeatAreaEvent = new AreaEvent(p, fireX - 1, fireY - 1, fireX + 1, fireY + 1);
                 cookMeatAreaEvent.setAction(() =>
                 {
                     p.setFaceLocation(new Location(fireX, fireY, p.getLocation().getZ()));
                     if (Server.getGlobalObjects().fireExists(new Location(fireX, fireY, 0)))
                     {
                         p.getInventory().replaceSingleItem(MEAT_COOKED[i], MEAT_BURNT[i]);
                         p.getPackets().sendMessage("You deliberately burn the " + ItemData.forId(MEAT_COOKED[i]).getName() + ".");
                         p.setLastAnimation(new Animation(883));
                     }
                 });
                 Server.registerCoordinateEvent(cookMeatAreaEvent);
                 return(true);
             }
             setCookingItem(p, null);
             p.getInventory().replaceSingleItem(MEAT_COOKED[i], MEAT_BURNT[i]);
             p.getPackets().sendMessage("You deliberately burn the " + ItemData.forId(MEAT_COOKED[i]).getName() + ".");
             p.setLastAnimation(new Animation(883));
             return(true);
         }
     }
     return(false);
 }
예제 #20
0
        private static void craftRunes(Player p, int i, int x, int y)
        {
            AreaEvent craftRunesAreaEvent = new AreaEvent(p, x - 3, y - 3, x + 3, y + 3);

            craftRunesAreaEvent.setAction(() =>
            {
                if (p.getTemporaryAttribute("lastRunecraftTime") != null)
                {
                    if (Environment.TickCount - (int)p.getTemporaryAttribute("lastRunecraftTime") < 500)
                    {
                        return;
                    }
                }
                if (!p.getInventory().hasItem(ESSENCE))
                {
                    p.getPackets().sendMessage("You have no Pure essence.");
                    return;
                }
                if (p.getSkills().getGreaterLevel(Skills.SKILL.RUNECRAFTING) < CRAFT_LEVEL[i])
                {
                    p.getPackets().sendMessage("You need a Runecrafting level of " + CRAFT_LEVEL[i] + " to craft " + ItemData.forId(RUNES[i]).getName() + "s.");
                    return;
                }
                p.setLastAnimation(new Animation(791));
                Event craftRunesEvent = new Event(250);
                craftRunesEvent.setAction(() =>
                {
                    craftRunesEvent.stop();
                    int amount = p.getInventory().getItemAmount(ESSENCE);
                    for (int j = 0; j < amount; j++)
                    {
                        if (!p.getInventory().deleteItem(ESSENCE))
                        {
                            p.getPackets().sendMessage("An error occured whilst deleting essence from your inventory.");
                            return;
                        }
                    }
                    int multiply = 1;
                    for (int j = 0; j < MULTIPLY_LEVELS[i].Length; j++)
                    {
                        if (p.getSkills().getGreaterLevel(Skills.SKILL.RUNECRAFTING) >= MULTIPLY_LEVELS[i][j])
                        {
                            multiply++;
                        }
                    }
                    string s  = amount > 1 || (amount == 1 && multiply > 1) ? "s." : ".";
                    string s1 = amount > 1 || (amount == 1 && multiply > 1) ? "" : "a ";
                    if (p.getInventory().addItem(RUNES[i], amount * multiply))
                    {
                        p.getSkills().addXp(Skills.SKILL.RUNECRAFTING, (CRAFT_XP[i] * amount));
                        p.getPackets().sendMessage("You craft the essence into " + s1 + ItemData.forId(RUNES[i]).getName() + s);
                    }
                    p.setTemporaryAttribute("lastRunecraftTime", Environment.TickCount);
                });
            });
            Server.registerCoordinateEvent(craftRunesAreaEvent);
        }
예제 #21
0
        public static void leaveEssMine(Player p, Location loc)
        {
            AreaEvent leaveEssMineAreaEvent = new AreaEvent(p, loc.getX() - 1, loc.getY() - 1, loc.getX() + 1, loc.getY() + 1);

            leaveEssMineAreaEvent.setAction(() => {
                p.teleport(new Location(2340 + misc.random(1), 3155 + misc.random(1), 0));
            });
            Server.registerCoordinateEvent(leaveEssMineAreaEvent);
        }
예제 #22
0
        internal void setState(int _swState, bool logEvent = false)
        {
            swState = _swState;
            AreaEventType aet = swState > 0 ? AreaEventType.SwitchOn : AreaEventType.SwitchOff;
            AreaEvent     evt = new AreaEvent(area, deviceName, aet, mcu.ipAddress, AreaEventStatus.Complete);

            Events.Add(evt);
            EventLogger.logEvent(evt);
        }
 private void BtnOK_Click(object sender, EventArgs e)
 {
     try
     {
         res = new AreaEvent(cboType.SelectedItem.ToString().ToUpper(), CboDir.SelectedItem.ToString().ToUpper(), txtName.Text.Trim(' '), x, y);
         Close();
     }
     catch (Exception)
     {
     }
 }
예제 #24
0
        private PlayerState GetStartPointOfArea(string name)
        {
            AreaEvent   areaSp = myArea.listAreaEvents.GetAreaEvent(AreaEvent_Type.StartPoint, name);
            PlayerState myPs;

            myPs = new PlayerState
            {
                pos = new Vector2(areaSp.XVal, areaSp.YVal),
                dir = Direction.DOWN
            };
            return(areaSp.AType == AreaEvent_Type.NONE ? ps : myPs);
        }
예제 #25
0
        public override void Reset()
        {
            base.Reset();

            AllowMultiple = false;

            OnAreaEnter = new AreaEvent();
            OnAreaStay  = new AreaEvent();
            OnAreaExit  = new AreaEvent();

            AreaEnterSound = AreaLoopSound = AreaExitSound = null;
        }
예제 #26
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);
        }
예제 #27
0
        public static void chopTendrils(Player p, int x, int y)
        {
            int       var = x == 3057 ? x + 2 : x - 1;
            AreaEvent chopTendrilsAreaEvent = new AreaEvent(p, var, y, var, y + 2);

            chopTendrilsAreaEvent.setAction(() =>
            {
                if (!Woodcutting.hasAxe(p))
                {
                    p.getPackets().sendMessage("You need an axe to get past this obstacle.");
                    return;
                }
                p.getWalkingQueue().resetWalkingQueue();
                p.setFaceLocation(new Location(x + 1, y, 0));
                p.setLastAnimation(new Animation(Woodcutting.getAxeAnimation(p)));
                p.setTemporaryAttribute("unmovable", true);
                Event chopTendrilsEvent = new Event(1900);
                chopTendrilsEvent.setAction(() =>
                {
                    int status     = 0;
                    int[] TENDRILS = { 7161, 7162, 7163 };
                    if (status < 3)
                    {
                        p.getPackets().createObject(TENDRILS[status], new Location(x, y, 0), x == 3057 ? 3 : 1, 10);
                    }
                    status++;
                    if (status == 1)
                    {
                        p.setLastAnimation(new Animation(Woodcutting.getAxeAnimation(p)));
                        chopTendrilsEvent.setTick(1300);
                    }
                    if (status == 3)
                    {
                        p.getPackets().sendMessage("You clear your way through the tendrils.");
                        p.setLastAnimation(new Animation(65535));
                        chopTendrilsEvent.setTick(800);
                    }
                    if (status == 4)
                    {
                        chopTendrilsEvent.stop();
                        teleportPastObstacle(p);
                        p.removeTemporaryAttribute("unmovable");
                    }
                });
                Server.registerEvent(chopTendrilsEvent);
                return;
            });
            Server.registerCoordinateEvent(chopTendrilsAreaEvent);
        }
예제 #28
0
        public static void exitCave(Player p, int objectX, int objectY)
        {
            AreaEvent exitCaveAreaEvent = new AreaEvent(p, objectX, objectY - 1, objectX + 2, objectY - 1);

            exitCaveAreaEvent.setAction(() => {
                p.setTemporaryAttribute("unmovable", true);
                Event teleFromCaveEvent = new Event(600);
                teleFromCaveEvent.setAction(() => {
                    teleFromCaveEvent.stop();
                    p.getFightCave().teleFromCave(true);
                });
                Server.registerEvent(teleFromCaveEvent);
            });
            Server.registerCoordinateEvent(exitCaveAreaEvent);
        }
예제 #29
0
        //20 * 1024^0 + 3 * 1024^1 + 4 * 1024^2
        public void openBank(bool dialogue, int x, int y)
        {
            openStatus  = 0;
            changingPin = false;
            AreaEvent openBankAreaEvent = new AreaEvent(player, x - 1, y - 1, x + 1, y + 1);

            openBankAreaEvent.setAction(() => {
                if (dialogue)
                {
                    //Dialogue.doDialogue(player, 1); //TODO: Make bank Dialogue for  clicking on booths.
                    return;
                }
                openBank();
            });
            Server.registerCoordinateEvent(openBankAreaEvent);
        }
예제 #30
0
 public static bool wantToSmithOnAnvil(Player p, int item, Location anvilLoc)
 {
     for (int i = 0; i < BARS.Length; i++)
     {
         if (item == BARS[i])
         {
             AreaEvent displaySmithOptionsAreaEvent = new AreaEvent(p, anvilLoc.getX() - 1, anvilLoc.getY() - 1, anvilLoc.getX() + 1, anvilLoc.getY() + 1);
             displaySmithOptionsAreaEvent.setAction(() => {
                 displaySmithOptions(p, i);
             });
             Server.registerCoordinateEvent(displaySmithOptionsAreaEvent);
             return(true);
         }
     }
     return(false);
 }