當前位置: 首頁>>代碼示例>>C#>>正文


C# Player.getBank方法代碼示例

本文整理匯總了C#中RS2.Server.player.Player.getBank方法的典型用法代碼示例。如果您正苦於以下問題:C# Player.getBank方法的具體用法?C# Player.getBank怎麽用?C# Player.getBank使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在RS2.Server.player.Player的用法示例。


在下文中一共展示了Player.getBank方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: interactTzhaarNPC

        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;
        }
開發者ID:ramatronics,項目名稱:rsps,代碼行數:44,代碼來源:TzHaar.cs

示例2: handleFirstClickObject


//.........這裏部分代碼省略.........
                    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.fireCannon();
                    break;

                case 7: //Cannon base only
                case 8: //Cannon stand
                case 9: //Cannon barrels
                    DwarfCannon cannonPickup = player.getCannon();
                    Location cannonLocation = new Location(objectX, objectY, player.getLocation().getZ());
                    if (cannonPickup == null || (cannonPickup != null & !cannonLocation.withinDistance(cannonPickup.getLocation(), 2)))
                    {
                        player.getPackets().sendMessage("This isn't your cannon!");
                        break;
                    }
                    cannonPickup.pickupCannon();
                    break;

                case 11601: // Clay oven
                    player.getPackets().modifyText("Please use the item on the oven.", 210, 1);
                    player.getPackets().sendChatboxInterface(210);
                    break;

                case 10284: // Barrows chest
                    Barrows.openChest(player);
                    break;

                case 4483: // Castle wars bank chest.
                case 21301: // Neitiznot bank chest
                    player.getBank().openBank(false, objectX, objectY);
                    break;

                case 1276: // Normal tree
                case 1278: // Normal tree
                case 2409: // Normal tree
                case 1277: // Normal tree with but different coloured stump
                case 3034: // Normal tree with dark stump
                case 3033: // Normal tree with dark stump
                case 10041: // Normal tree
                case 1282: // Dead tree
                case 1283: // Dead tree
                case 1284: // Dead tree
                case 1285: // Dead tree
                case 1286: // Dead tree
                case 1289: // Dead tree
                case 1290: // Dead tree
                case 1365: // Dead tree
                case 1383: // Dead tree
                case 1384: // Dead tree
                case 1291: // Dead tree
                case 3035: // Dead tree
                case 3036: // Dead tree
                case 1315: // Evergreen
                case 1316: // Evergreen
                case 1318: // Snowy Evergreen
                case 1319: // Snowy Evergreen
                case 1330: // Snow covered tree
                case 1331: // Snow covered tree
                case 1332: // Snow covered tree
                case 3879: // Evergreen from elf land
                case 3881: // Evergreen from elf land (slightly bigger than one above)
                case 3882: // Evergreen from elf land (slightly bigger than one above)
開發者ID:ramatronics,項目名稱:rsps,代碼行數:67,代碼來源:ObjectInteract.cs

示例3: handleEnterAmount


//.........這裏部分代碼省略.........
                            break;

                        case 41: // Make X candle lantern.
                            Glass.craftGlass(player, amount, 1, true);
                            break;

                        case 42: // Make X oil lamp.
                            Glass.craftGlass(player, amount, 2, true);
                            break;

                        case 38: // Make X vial.
                            Glass.craftGlass(player, amount, 3, true);
                            break;

                        case 44: // Make X Fishbowl
                            Glass.craftGlass(player, amount, 4, true);
                            break;

                        case 39: // Make X orb.
                            Glass.craftGlass(player, amount, 5, true);
                            break;

                        case 43: // Make X lantern lens
                            Glass.craftGlass(player, amount, 6, true);
                            break;

                        case 45: // Make X dorgeshuun light orb.
                            Glass.craftGlass(player, amount, 7, true);
                            break;
                    }
                    break;

                case 763: // Bank inventory - X.
                    player.getBank().setLastXAmount(amount);
                    player.getBank().deposit(var.getSlot(), amount);
                    player.getBank().refreshBank();
                    break;

                case 762: // Bank - X.
                    player.getBank().setLastXAmount(amount);
                    player.getBank().withdraw(var.getSlot(), amount);
                    player.getBank().refreshBank();
                    break;

                case 336: // Trade/stake inventory - trade X.
                    if (player.getTrade() != null)
                    {
                        player.getTrade().tradeItem(var.getSlot(), amount);
                        break;
                    }
                    if (player.getDuel() != null)
                    {
                        player.getDuel().stakeItem(var.getSlot(), amount);
                        break;
                    }
                    break;

                case 631:
                    if (player.getDuel() != null)
                    {
                        player.getDuel().removeItem(var.getSlot(), amount);
                        break;
                    }
                    break;

                case 335: // Trade/stake interface - remove X.
開發者ID:ramatronics,項目名稱:rsps,代碼行數:67,代碼來源:InterfaceOptions.cs

示例4: handleSecondClickObject


//.........這裏部分代碼省略.........
                case 32439:
                case 32440:
                    Mining.prospectRock(player, objectX, objectY, "mithril");
                    break;

                case 11954: // Iron rocks
                case 11955:
                case 11956:
                case 14856:
                case 14857:
                case 14858:
                case 31071:
                case 31072:
                case 31073:
                case 32441:
                case 32442:
                case 32443:
                    Mining.prospectRock(player, objectX, objectY, "iron");
                    break;

                case 14859: // Rune rocks
                case 14860:
                case 14861:
                    Mining.prospectRock(player, objectX, objectY, "runite");
                    break;

                case 11951: // Gold rocks
                case 11952:
                case 11953:
                case 11183:
                case 11184:
                case 11185:
                case 31065:
                case 31066:
                case 31067:
                case 32432:
                case 32433:
                case 32434:
                case 15576:
                case 15577:
                case 15578:
                    Mining.prospectRock(player, objectX, objectY, "gold");
                    break;

                case 11963: // Adamant rocks
                case 11964:
                case 11965:
                case 11939:
                case 11940:
                case 11941:
                case 14862:
                case 14863:
                case 14864:
                case 31083:
                case 31084:
                case 31085:
                case 32435:
                case 32436:
                case 32437:
                    Mining.prospectRock(player, objectX, objectY, "adamantite");
                    break;

                case 11552: // Empty rocks
                case 11553:
                case 11554:
                case 11555:
                case 11556:
                case 31059:
                case 31060:
                case 31061:
                case 14832:
                case 14833:
                case 14834:
                case 33400:
                case 33401:
                case 33402:
                case 15582:
                case 15583:
                case 15584:
                    Mining.displayEmptyRockMessage(player, new Location(objectX, objectY, player.getLocation().getZ()));
                    break;

                case 2491: // Rune essence
                    Mining.prospectRock(player, objectX, objectY, "Rune essence");
                    break;

                case 27663: // Duel arena bank chest.
                case 2213:  // Catherby bank booth.
                case 11402: // Varrock bank booth.
                case 11758: // Falador bank booth.
                case 36786: // Lumbridge bank booth.
                case 35647: // Al-Kharid bank booth.
                case 25808: // Seers bank booth.
                case 34752: // Ardougne bank booth.
                case 26972: // Edgeville bank booth.
                case 29085: // Ooglog bank booth.
                    player.getBank().openBank(false, objectX, objectY);
                    break;
            }
        }
開發者ID:ramatronics,項目名稱:rsps,代碼行數:101,代碼來源:ObjectInteract.cs

示例5: handleClickThree

        private void handleClickThree(Player player, Packet packet)
        {
            int interfaceId = packet.readUShort();
            int child = packet.readUShort();
            int slot = packet.readUShort();
            Console.WriteLine("InterfaceOption 3: interfaceId: " + interfaceId);
            switch (interfaceId)
            {
                case 154: // Craft normal leather.
                    Leather.craftNormalLeather(player, child, player.getInventory().getItemAmount(1741), true);
                    break;

                case 542: // Glassblowing.
                    int totalGlass = player.getInventory().getItemAmount(1775);
                    switch (child)
                    {
                        case 40: // Make all beer glass.
                            Glass.craftGlass(player, totalGlass, 0, true);
                            break;

                        case 41: // Make all candle lantern.
                            Glass.craftGlass(player, totalGlass, 1, true);
                            break;

                        case 42: // Make all oil lamp.
                            Glass.craftGlass(player, totalGlass, 2, true);
                            break;

                        case 38: // Make all vial.
                            Glass.craftGlass(player, totalGlass, 3, true);
                            break;

                        case 44: // Make all Fishbowl
                            Glass.craftGlass(player, totalGlass, 4, true);
                            break;

                        case 39: // Make all orb.
                            Glass.craftGlass(player, totalGlass, 5, true);
                            break;

                        case 43: // Make all lantern lens
                            Glass.craftGlass(player, totalGlass, 6, true);
                            break;

                        case 45: // Make all dorgeshuun light orb.
                            Glass.craftGlass(player, totalGlass, 7, true);
                            break;
                    }
                    break;

                case 763: // Bank inventory - 10.
                    player.getBank().deposit(slot, 10);
                    player.getBank().refreshBank();
                    break;

                case 762: // Bank - 10.
                    player.getBank().withdraw(slot, 10);
                    player.getBank().refreshBank();
                    break;

                case 336: // Trade/stake inventory - trade 10.
                    if (player.getTrade() != null)
                    {
                        player.getTrade().tradeItem(slot, 10);
                        break;
                    }
                    if (player.getDuel() != null)
                    {
                        player.getDuel().stakeItem(slot, 10);
                        break;
                    }
                    break;

                case 335: // Trade interface - remove 10.
                    player.getTrade().removeItem(slot, 10);
                    break;

                case 631: // Duel interface - remove 10.
                    if (player.getDuel() != null)
                    {
                        player.getDuel().removeItem(slot, 5);
                        break;
                    }
                    break;

                case 620: // Shop - buy 5.
                    player.getShopSession().buyItem(slot, 5);
                    break;

                case 621: // Shop - sell 5.
                    player.getShopSession().sellItem(slot, 5);
                    break;

                case 590: // Clan chat setup
                    Clan clan = Server.getClanManager().getClanByOwner(player.getLoginDetails().getUsername());
                    if (clan == null)
                    {
                        player.getPackets().sendMessage("Please create your clan chat before changing settings.");
                        break;
                    }
//.........這裏部分代碼省略.........
開發者ID:ramatronics,項目名稱:rsps,代碼行數:101,代碼來源:InterfaceOptions.cs

示例6: handleClickTwo

        private void handleClickTwo(Player player, Packet packet)
        {
            int interfaceId = packet.readUShort();
            int child = packet.readUShort();
            int slot = packet.readUShort();
            Console.WriteLine("InterfaceOption 2: interfaceId: " + interfaceId);
            switch (interfaceId)
            {
                case 105: // GE Interface
                    switch (child)
                    {
                        case 209: // "Collect" and "Collect-items" option
                            player.getGESession().collectSlot1(false);
                            break;

                        case 211: // Left box "Collect" option (coins)
                            player.getGESession().collectSlot2();
                            break;
                    }
                    break;

                case 154: // Craft normal leather.
                    Leather.craftNormalLeather(player, child, 5, true);
                    break;

                case 542: // Glassblowing.
                    switch (child)
                    {
                        case 40: // Make 5 beer glass.
                            Glass.craftGlass(player, 5, 0, true);
                            break;

                        case 41: // Make 5 candle lantern.
                            Glass.craftGlass(player, 5, 1, true);
                            break;

                        case 42: // Make 5 oil lamp.
                            Glass.craftGlass(player, 5, 2, true);
                            break;

                        case 38: // Make 5 vial.
                            Glass.craftGlass(player, 5, 3, true);
                            break;

                        case 44: // Make 5 Fishbowl
                            Glass.craftGlass(player, 5, 4, true);
                            break;

                        case 39: // Make 5 orb.
                            Glass.craftGlass(player, 5, 5, true);
                            break;

                        case 43: // Make 5 lantern lens
                            Glass.craftGlass(player, 5, 6, true);
                            break;

                        case 45: // Make 5 dorgeshuun light orb.
                            Glass.craftGlass(player, 5, 7, true);
                            break;
                    }
                    break;

                case 763: // Bank inventory - 5.
                    player.getBank().deposit(slot, 5);
                    player.getBank().refreshBank();
                    break;

                case 762: // Bank - 5.
                    player.getBank().withdraw(slot, 5);
                    player.getBank().refreshBank();
                    break;

                case 336: // Trade/stake inventory - trade 5.
                    if (player.getTrade() != null)
                    {
                        player.getTrade().tradeItem(slot, 5);
                        break;
                    }
                    if (player.getDuel() != null)
                    {
                        player.getDuel().stakeItem(slot, 5);
                        break;
                    }
                    break;

                case 631: // Duel interface - remove 5
                    if (player.getDuel() != null)
                    {
                        player.getDuel().removeItem(slot, 5);
                        break;
                    }
                    break;

                case 335: // Trade interface - remove 5.
                    player.getTrade().removeItem(slot, 5);
                    break;

                case 620: // Shop - buy 1.
                    player.getShopSession().buyItem(slot, 1);
                    break;
//.........這裏部分代碼省略.........
開發者ID:ramatronics,項目名稱:rsps,代碼行數:101,代碼來源:InterfaceOptions.cs

示例7: handleClickSeven

        private void handleClickSeven(Player player, Packet packet)
        {
            int interfaceId = packet.readUShort();
            int child = packet.readUShort();
            int slot = packet.readUShort();
            Console.WriteLine("InterfaceOption 7: interfaceId: " + interfaceId);
            switch (interfaceId)
            {
                case 762: // Bank - All but one.
                    player.getBank().withdraw(slot, player.getBank().getAmountInSlot(slot) - 1);
                    player.getBank().refreshBank();
                    break;

                case 336: // Trade inventory - trade all.
                    //player.getTrade().lendItem(slot);
                    break;

                case 590: // Clan chat setup
                    Clan clan = Server.getClanManager().getClanByOwner(player.getLoginDetails().getUsername());
                    if (clan == null)
                    {
                        player.getPackets().sendMessage("Please create your clan chat before changing settings.");
                        break;
                    }
                    switch (child)
                    {
                        case 23: // "Who can enter chat" - captain.
                            clan.setEnterRights(Clan.ClanRank.CAPTAIN);
                            player.getPackets().modifyText(clan.getRankString(clan.getEnterRights()), 590, 23);
                            break;

                        case 24: // "Who can talk in chat" - captain.
                            clan.setTalkRights(Clan.ClanRank.CAPTAIN);
                            player.getPackets().modifyText(clan.getRankString(clan.getTalkRights()), 590, 24);
                            break;

                        case 25: // // "Who can kick in chat" - captain.
                            clan.setKickRights(Clan.ClanRank.CAPTAIN);
                            player.getPackets().modifyText(clan.getRankString(clan.getKickRights()), 590, 25);
                            break;

                        case 26: // "Who can share loot" - captain.
                            clan.setLootRights(Clan.ClanRank.CAPTAIN);
                            player.getPackets().modifyText(clan.getRankString(clan.getLootRights()), 590, 26);
                            break;
                    }
                    break;
            }
        }
開發者ID:ramatronics,項目名稱:rsps,代碼行數:49,代碼來源:InterfaceOptions.cs

示例8: handleClickSix

        private void handleClickSix(Player player, Packet packet)
        {
            int interfaceId = packet.readUShort();
            int child = packet.readUShort();
            int slot = packet.readUShort();
            Console.WriteLine("InterfaceOption 6: interfaceId: " + interfaceId);
            switch (interfaceId)
            {
                case 763: // Bank inventory - All.
                    player.getBank().deposit(slot, player.getInventory().getItemAmount(player.getInventory().getItemInSlot(slot)));
                    player.getBank().refreshBank();
                    break;

                case 762: // Bank - All.
                    player.getBank().withdraw(slot, player.getBank().getAmountInSlot(slot));
                    player.getBank().refreshBank();
                    break;

                case 590: // Clan chat setup
                    Clan clan = Server.getClanManager().getClanByOwner(player.getLoginDetails().getUsername());
                    if (clan == null)
                    {
                        player.getPackets().sendMessage("Please create your clan chat before changing settings.");
                        break;
                    }
                    switch (child)
                    {
                        case 23: // "Who can enter chat" - lieutenant.
                            clan.setEnterRights(Clan.ClanRank.LIEUTENANT);
                            player.getPackets().modifyText(clan.getRankString(clan.getEnterRights()), 590, 23);
                            break;

                        case 24: // "Who can talk in chat" - lieutenant.
                            clan.setTalkRights(Clan.ClanRank.LIEUTENANT);
                            player.getPackets().modifyText(clan.getRankString(clan.getTalkRights()), 590, 24);
                            break;

                        case 25: // // "Who can kick in chat" - lieutenant.
                            clan.setKickRights(Clan.ClanRank.LIEUTENANT);
                            player.getPackets().modifyText(clan.getRankString(clan.getKickRights()), 590, 25);
                            break;

                        case 26: // "Who can share loot" - lieutenant.
                            clan.setLootRights(Clan.ClanRank.LIEUTENANT);
                            player.getPackets().modifyText(clan.getRankString(clan.getLootRights()), 590, 26);
                            break;
                    }
                    break;
            }
        }
開發者ID:ramatronics,項目名稱:rsps,代碼行數:50,代碼來源:InterfaceOptions.cs

示例9: handleClickFour

        private void handleClickFour(Player player, Packet packet)
        {
            int interfaceId = packet.readUShort();
            int child = packet.readUShort();
            int slot = packet.readUShort();
            Console.WriteLine("InterfaceOption 4: interfaceId: " + interfaceId);
            switch (interfaceId)
            {
                case 763: // Bank inventory - Custom amount.
                    player.getBank().deposit(slot, player.getBank().getLastXAmount());
                    player.getBank().refreshBank();
                    break;

                case 762: // Bank - Custom amount.
                    player.getBank().withdraw(slot, player.getBank().getLastXAmount());
                    player.getBank().refreshBank();
                    break;

                case 154: // Craft normal leather.
                    player.getPackets().displayEnterAmount();
                    player.setTemporaryAttribute("interfaceVariable", new EnterVariable(154, child));
                    break;

                case 542: // Glassblowing.
                    switch (child)
                    {
                        case 40: // Make X beer glass.
                        case 41: // Make X candle lantern.
                        case 42: // Make X oil lamp.
                        case 38: // Make X vial.
                        case 44: // Make X Fishbowl
                        case 39: // Make X orb.
                        case 43: // Make X lantern lens
                        case 45: // Make X dorgeshuun light orb.
                            player.getPackets().displayEnterAmount();
                            player.setTemporaryAttribute("interfaceVariable", new EnterVariable(542, child));
                            break;
                    }
                    break;

                case 336: // Trade/stake inventory - trade all.
                    if (player.getTrade() != null)
                    {
                        player.getTrade().tradeItem(slot, player.getInventory().getItemAmount(player.getInventory().getItemInSlot(slot)));
                        break;
                    }
                    if (player.getDuel() != null)
                    {
                        player.getDuel().stakeItem(slot, player.getInventory().getItemAmount(player.getInventory().getItemInSlot(slot)));
                        break;
                    }
                    break;

                case 335: // Trade interface - remove all.
                    player.getTrade().removeItem(slot, player.getTrade().getItemAmount(player.getTrade().getItemInSlot(slot)));
                    break;

                case 631: // Duel interface - remove All
                    if (player.getDuel() != null)
                    {
                        player.getDuel().removeItem(slot, player.getDuel().getItemAmount(player.getDuel().getItemInSlot(slot)));
                        break;
                    }
                    break;

                case 620: // Shop - buy 10.
                    player.getShopSession().buyItem(slot, 10);
                    break;

                case 621: // Shop - sell 10.
                    player.getShopSession().sellItem(slot, 10);
                    break;

                case 590: // Clan chat setup
                    Clan clan = Server.getClanManager().getClanByOwner(player.getLoginDetails().getUsername());
                    if (clan == null)
                    {
                        player.getPackets().sendMessage("Please create your clan chat before changing settings.");
                        break;
                    }
                    switch (child)
                    {
                        case 23: // "Who can enter chat" - corporal.
                            clan.setEnterRights(Clan.ClanRank.CORPORAL);
                            player.getPackets().modifyText(clan.getRankString(clan.getEnterRights()), 590, 23);
                            break;

                        case 24: // "Who can talk in chat" - corporal.
                            clan.setTalkRights(Clan.ClanRank.CORPORAL);
                            player.getPackets().modifyText(clan.getRankString(clan.getTalkRights()), 590, 24);
                            break;

                        case 25: // // "Who can kick in chat" - corporal.
                            clan.setKickRights(Clan.ClanRank.CORPORAL);
                            player.getPackets().modifyText(clan.getRankString(clan.getKickRights()), 590, 25);
                            break;

                        case 26: // "Who can share loot" - corporal.
                            clan.setLootRights(Clan.ClanRank.CORPORAL);
                            player.getPackets().modifyText(clan.getRankString(clan.getLootRights()), 590, 26);
//.........這裏部分代碼省略.........
開發者ID:ramatronics,項目名稱:rsps,代碼行數:101,代碼來源:InterfaceOptions.cs

示例10: execute

 public void execute(Player player, string[] arguments)
 {
     if (!player.inCombat())
         player.getBank().openBank();
 }
開發者ID:ramatronics,項目名稱:rsps,代碼行數:5,代碼來源:Bank.cs

示例11: savePlayer

        public bool savePlayer(Player p)
        {
            if (p == null) return false;
            try
            {
                string username = p.getLoginDetails().getUsername().ToLower();

                /* Character saving code goes here */
                XmlTextWriter writer = new XmlTextWriter(Misc.getServerPath() + @"\accounts\" + username + ".xml", null);
                writer.Formatting = Formatting.Indented;
                writer.WriteStartElement("Player");
                writer.WriteStartElement("Login");
                writer.WriteElementString("Password", p.getLoginDetails().getPassword());
                writer.WriteElementString("Rights", p.getRights().ToString());
                writer.WriteElementString("BankPin", p.getBank().getBankPin());
                writer.WriteEndElement();

                writer.WriteStartElement("Position");
                writer.WriteElementString("X", p.getLocation().getX().ToString());
                writer.WriteElementString("Y", p.getLocation().getY().ToString());
                writer.WriteElementString("Z", p.getLocation().getZ().ToString());
                writer.WriteEndElement();

                writer.WriteStartElement("Settings");
                writer.WriteElementString("RunEnergy", p.getRunEnergy().ToString());
                writer.WriteStartElement("PrivacySettings");
                writer.WriteElementString("Public", p.getFriends().getPrivacyOption(0).ToString());
                writer.WriteElementString("Private", p.getFriends().getPrivacyOption(1).ToString());
                writer.WriteElementString("Trade", p.getFriends().getPrivacyOption(2).ToString());
                writer.WriteEndElement();
                writer.WriteEndElement();

                writer.WriteStartElement("Friends");
                foreach (long friend in p.getFriends().getFriendsList())
                    writer.WriteElementString("Friend", friend.ToString());
                writer.WriteEndElement();

                writer.WriteStartElement("Ignores");
                foreach (long ignore in p.getFriends().getIgnoresList())
                    writer.WriteElementString("Ignore", ignore.ToString());
                writer.WriteEndElement();

                writer.WriteStartElement("Stats");
                foreach (Skills.SKILL skill in Enum.GetValues(typeof(Skills.SKILL)))
                {
                    writer.WriteStartElement(skill.ToString()); //skill name.
                    writer.WriteElementString("CurrentLevel", p.getSkills().getCurLevel(skill).ToString());
                    writer.WriteElementString("XP", p.getSkills().getXp(skill).ToString());
                    writer.WriteEndElement();
                }
                writer.WriteEndElement();

                Item item;
                writer.WriteStartElement("EquipmentItems");
                foreach (ItemData.EQUIP equip in Enum.GetValues(typeof(ItemData.EQUIP)))
                {
                    if (equip == ItemData.EQUIP.NOTHING) continue;
                    item = p.getEquipment().getSlot(equip);
                    if (item.getItemId() == -1) continue; //empty slot.

                    writer.WriteStartElement(equip.ToString());
                    writer.WriteElementString("Id", item.getItemId().ToString());
                    writer.WriteElementString("Amount", item.getItemAmount().ToString());
                    writer.WriteEndElement();
                }
                writer.WriteEndElement();

                writer.WriteStartElement("InventoryItems");
                for (int i = 0; i < Inventory.MAX_INVENTORY_SLOTS; i++)
                {
                    item = p.getInventory().getSlot(i);
                    if (item.getItemId() == -1) continue; //empty slot.

                    writer.WriteStartElement("Item");
                    writer.WriteElementString("Slot", i.ToString());
                    writer.WriteElementString("Id", item.getItemId().ToString());
                    writer.WriteElementString("Amount", item.getItemAmount().ToString());
                    writer.WriteEndElement();
                }
                writer.WriteEndElement();

                writer.WriteStartElement("BankItems");
                for (int i = 0; i < Bank.MAX_BANK_SLOTS; i++)
                {
                    item = p.getBank().getSlot(i);
                    if (item.getItemId() == -1) continue; //empty slot.

                    writer.WriteStartElement("Item");
                    writer.WriteElementString("Slot", i.ToString());
                    writer.WriteElementString("Id", item.getItemId().ToString());
                    writer.WriteElementString("Amount", item.getItemAmount().ToString());
                    writer.WriteEndElement();
                }
                writer.WriteEndElement();
                writer.WriteEndElement();
                //Write the XML to file and close the writer
                writer.Close();
            }
            catch (Exception)
            {
//.........這裏部分代碼省略.........
開發者ID:ramatronics,項目名稱:rsps,代碼行數:101,代碼來源:LoginHandler.cs

示例12: loadPlayer

        public ReturnCode loadPlayer(Connection connection)
        {
            if (connection == null)
                return ReturnCode.COULD_NOT_COMPLETE;
            LoginDetails loginDetails = connection.getLoginDetails();
            if (loginDetails == null || loginDetails.getUsername() == "" || loginDetails.getLongName() == 0)
                return ReturnCode.INVALID_PASSWORD;//ReturnCode.INVALID_PASSWORD;

            foreach (char c in loginDetails.getUsername().ToCharArray())
            {
                if (!char.IsLetterOrDigit(c) && !char.IsWhiteSpace(c))
                    return ReturnCode.INVALID_PASSWORD;
            }
            Player createdPlayer = new Player(connection);
            connection.setPlayer(createdPlayer); //player finally created.
            createdPlayer.setLoginDetails(loginDetails);

            if (!File.Exists(Misc.getServerPath() + @"\accounts\" + loginDetails.getUsername() + ".xml"))
            {
                createdPlayer.setRights(2); //all new users admins atm (change later).
                createdPlayer.setLocation(new Location(2323, 3174, 0));
                return ReturnCode.LOGIN_OK; //new user.
            }
            //Yeah reading XML files is a bit homo.
            try
            {
                int temp;
                long lTemp;
                string username = createdPlayer.getLoginDetails().getUsername().ToLower();
                XmlDocument xmlDocument = new XmlDocument();
                xmlDocument.Load(Misc.getServerPath() + @"\accounts\" + username + ".xml");

                XmlNode xmlNode = xmlDocument.SelectSingleNode("/Player/Login/Password");
                if (xmlNode == null) return ReturnCode.INVALID_PASSWORD; //no password node.
                if (createdPlayer.getLoginDetails().getPassword() != xmlNode.InnerText)
                    return ReturnCode.INVALID_PASSWORD;

                XmlNode loginElement = xmlDocument.SelectSingleNode("/Player/Login");
                if (loginElement != null && loginElement.HasChildNodes)
                {
                    XmlNodeList childs = loginElement.ChildNodes;

                    foreach (XmlElement element in childs)
                    {
                        switch (element.Name)
                        {
                            case "Rights":
                                if (!int.TryParse(element.InnerText, out temp))
                                    temp = 0;
                                createdPlayer.setRights(temp);
                                break;

                            case "BankPin":
                                if (element.InnerText == "") continue;
                                createdPlayer.getBank().setBankPin(element.InnerText);
                                break;
                        }
                    }
                }

                loginElement = xmlDocument.SelectSingleNode("/Player/Position");
                if (loginElement != null && loginElement.HasChildNodes)
                {
                    XmlNodeList childs = loginElement.ChildNodes;
                    Location location = new Location();
                    foreach (XmlElement element in childs)
                    {
                        switch (element.Name)
                        {
                            case "X":
                                if (!int.TryParse(element.InnerText, out temp))
                                {
                                    createdPlayer.setLocation(Constants.HOME_SPAWN_LOCATION);
                                    break;
                                }
                                location.setX(temp);
                                break;

                            case "Y":
                                if (!int.TryParse(element.InnerText, out temp))
                                {
                                    createdPlayer.setLocation(Constants.HOME_SPAWN_LOCATION);
                                    break;
                                }
                                location.setY(temp);
                                break;

                            case "Z":
                                if (!int.TryParse(element.InnerText, out temp))
                                    temp = 0;
                                location.setZ(temp);
                                break;
                        }
                    }
                    createdPlayer.setLocation(location);
                    if (Location.atDuelArena(createdPlayer.getLocation()))
                        DuelSession.teleportDuelArenaHome(createdPlayer);
                }

                xmlNode = xmlDocument.SelectSingleNode("/Player/Settings/RunEnergy");
//.........這裏部分代碼省略.........
開發者ID:ramatronics,項目名稱:rsps,代碼行數:101,代碼來源:LoginHandler.cs

示例13: handleActionButton


//.........這裏部分代碼省略.........
                    Clan clan = Server.getClanManager().getClanByOwner(player.getLoginDetails().getUsername());
                    if (clan == null)
                    {
                        break;
                    }
                    switch (buttonId)
                    {
                        case 22: // Clan name
                            player.getPackets().displayEnterText("Enter clan name :");
                            player.setTemporaryAttribute("interfaceVariable", new EnterVariable(590, 0));
                            break;

                        case 23: // "Who can enter chat" - anyone.
                            clan.setEnterRights(Clan.ClanRank.NO_RANK);
                            player.getPackets().modifyText(clan.getRankString(clan.getEnterRights()), 590, 23);
                            break;

                        case 24: // "Who can talk in chat" - anyone.
                            clan.setTalkRights(Clan.ClanRank.NO_RANK);
                            player.getPackets().modifyText(clan.getRankString(clan.getTalkRights()), 590, 24);
                            break;

                        case 26: // "Who can share loot" - anyone.
                            clan.setLootRights(Clan.ClanRank.NO_RANK);
                            player.getPackets().modifyText(clan.getRankString(clan.getLootRights()), 590, 26);
                            break;
                    }
                    break;

                case 763: // Bank inventory
                    switch (buttonId)
                    {
                        case 0: // Deposit 1.
                            player.getBank().deposit(buttonId2, 1);
                            player.getBank().refreshBank();
                            break;
                    }
                    break;

                case 762: // Bank
                    switch (buttonId)
                    {
                        case 73: // withdraw 1.
                            player.getBank().withdraw(buttonId2, 1);
                            player.getBank().refreshBank();
                            break;

                        case 16: // Note item.
                            player.getBank().asNote();
                            break;

                        case 41: // first (main) bank tab
                            player.getBank().setCurrentTab(10);
                            break;

                        case 39: // first bank tab
                            player.getBank().setCurrentTab(2);
                            break;

                        case 37: // second bank tab
                            player.getBank().setCurrentTab(3);
                            break;

                        case 35: // third bank tab
                            player.getBank().setCurrentTab(4);
                            break;
開發者ID:ramatronics,項目名稱:rsps,代碼行數:67,代碼來源:ActionButton.cs


注:本文中的RS2.Server.player.Player.getBank方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。