World based character slots

Page 1 of 2 12 LastLast
Results 1 to 15 of 30
  1. #1
    Account Upgraded | Title Enabled! flav is offline
    MemberRank
    Jul 2008 Join Date
    655Posts

    World based character slots

    BuyCSItemHandler.java
    Code:
     else if (action == 8) { //Buy Extra Character Slot Coupon?
                slea.skip(1);
                int useNX = slea.readInt();
                int snCS = slea.readInt();
                CashItemInfo item = CashItemFactory.getItem(snCS);
                if (c.getPlayer().getCSPoints(useNX) >= item.getPrice()) {
                    if (c.getCSlots() < 6) {
                        c.getPlayer().modifyCSPoints(useNX, -item.getPrice());
                        c.gainCSlot();
                        c.getPlayer().dropMessage(1, "Your character slots have been increased to " + c.getCSlots() + ".");
                    } else {
                        c.getPlayer().dropMessage(1, "You can not have more than 6 character slots.");
                    }
                } else {
                    c.getSession().write(MaplePacketCreator.enableActions());
                    return;
                }
                //MapleInventoryManipulator.addById(c, item.getId(), (short) item.getCount());
                c.getSession().write(MaplePacketCreator.showBoughtCSItem(item.getId()));
                c.getSession().write(MaplePacketCreator.showNXMapleTokens(c.getPlayer()));
                c.getSession().write(MaplePacketCreator.enableCSUse0());
                c.getSession().write(MaplePacketCreator.enableCSUse1(c));
                c.getSession().write(MaplePacketCreator.enableCSUse2());
                c.getSession().write(MaplePacketCreator.enableActions());
            }
    MapleClient.java
    Code:
    private int charslots = 3;
    Code:
    public int getCSlots() {
            try {
                Connection con = DatabaseConnection.getConnection();
                PreparedStatement ps = con.prepareStatement("SELECT * FROM character_slots WHERE accid = ?");
                ps.setInt(1, accId);
                ResultSet rs = ps.executeQuery();
                if (rs.next()) {
                    charslots = rs.getInt("charslots");
                    rs.close();
                } else {
                    ps = con.prepareStatement("INSERT INTO character_slots (accid, worldid, charslots) VALUES (?, ?, ?)");
                    ps.setInt(1, accId);
                    ps.setInt(2, world);
                    ps.setInt(3, charslots);
                    ps.execute();
                }
                ps.close();
            } catch (SQLException sqlE) {
                System.out.print("Could not load Character Slots : " + sqlE);
            }
    
            return charslots;
        }
    
        public void gainCSlot() {
            charslots += 1;
    
            try {
                Connection con = DatabaseConnection.getConnection();
                PreparedStatement ps = con.prepareStatement("UPDATE character_slots SET charslots = ? WHERE worldid = ? AND accid = ?");
                ps.setInt(1, charslots);
                ps.setInt(2, world);
                ps.setInt(3, accId);
                ps.executeUpdate();
                ps.close();
            } catch (SQLException sqlE) {
                System.out.print("Could not save Character Slots : " + sqlE);
            }
        }
    SQL
    Code:
    --
    -- Definition of table `character_slots`
    --
    
    DROP TABLE IF EXISTS `character_slots`;
    CREATE TABLE `character_slots` (
      `id` int(11) NOT NULL AUTO_INCREMENT,
      `accid` int(11) NOT NULL DEFAULT '0',
      `worldid` int(11) NOT NULL DEFAULT '0',
      `charslots` int(11) NOT NULL DEFAULT '3',
      PRIMARY KEY (`id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
    
    --
    -- Dumping data for table `character_slots`
    --
    
    /*!40000 ALTER TABLE `character_slots` DISABLE KEYS */;
    /*!40000 ALTER TABLE `character_slots` ENABLE KEYS */;


  2. #2
    Valued Member Quаlitys is offline
    MemberRank
    Apr 2009 Join Date
    103Posts

    Re: World based character slots

    You're on fire, very nice release!

  3. #3
    Account Upgraded | Title Enabled! <XENON> is offline
    MemberRank
    Feb 2009 Join Date
    Titti TownLocation
    223Posts

    Re: World based character slots

    nice.

    usefull for gms like server :D

  4. #4
    Valued Member Shogi is offline
    MemberRank
    Apr 2008 Join Date
    134Posts

    Re: World based character slots

    can i ask, what that for? i guess that's more gms-like but what it does?

  5. #5
    Account Upgraded | Title Enabled! Cappe is offline
    MemberRank
    Aug 2008 Join Date
    330Posts

    Re: World based character slots

    It's for Gms like server so players can buy more char slots for their account.

  6. #6
    Valued Member Shogi is offline
    MemberRank
    Apr 2008 Join Date
    134Posts

    Re: World based character slots

    so what that mean, they can open new character with more char slots?

  7. #7
    Account Upgraded | Title Enabled! flav is offline
    MemberRank
    Jul 2008 Join Date
    655Posts

    Re: World based character slots

    If you buy a character slot in Bera you can make 4 characters in Bera, in the other worlds you can still only make 3 characters. That's also how it is in GMS if I am not mistaken.

  8. #8
    Xephizion Development Ehab is offline
    MemberRank
    Apr 2008 Join Date
    Somewhere I BelLocation
    1,935Posts

    Re: World based character slots

    very very good
    you're not mistaken

  9. #9
    Account Upgraded | Title Enabled! lzylzy is offline
    MemberRank
    Sep 2008 Join Date
    351Posts

    Re: World based character slots

    Wow,nice release.

    I didn't have this though,I never knew it even exist

  10. #10
    Proficient Member Bye is offline
    MemberRank
    Apr 2009 Join Date
    190Posts

    Re: World based character slots

    Code:
    c.getSession().write(MaplePacketCreator.enableCSUse1(c));
    Will give an error due to the (c)), cause most enableCSUse1 don't have c declared.

  11. #11
    Alpha Member Anujan is offline
    MemberRank
    May 2008 Join Date
    Ontario, CanadaLocation
    1,633Posts

    Re: World based character slots

    Quote Originally Posted by Bye View Post
    Code:
    c.getSession().write(MaplePacketCreator.enableCSUse1(c));
    Will give an error due to the (c)), cause most enableCSUse1 don't have c declared.
    Then delete it.
    Common sense.

  12. #12
    Account Upgraded | Title Enabled! flav is offline
    MemberRank
    Jul 2008 Join Date
    655Posts

    Re: World based character slots

    Quote Originally Posted by Bye View Post
    Code:
    c.getSession().write(MaplePacketCreator.enableCSUse1(c));
    Will give an error due to the (c)), cause most enableCSUse1 don't have c declared.
    Made this for updating the storage slot display in Cash Shop, released it anywhere. Otherwise remove the c.

  13. #13
    Valued Member Shogi is offline
    MemberRank
    Apr 2008 Join Date
    134Posts

    Re: World based character slots

    just add the storage, btw flav i had problem by adding to storage to the source, using bubblesdev revision 17, can u just add it to the BuyCSItemHandler.java and ill do the rest? since its the only file giving me error when adding the storage with else if

  14. #14
    Account Upgraded | Title Enabled! redeemer34 is offline
    MemberRank
    Aug 2008 Join Date
    335Posts

    Re: World based character slots

    Very nice. great release. And OMFGOMA YOur on FIRE?!@?#?

  15. #15
    Account Upgraded | Title Enabled! CharlieBoy is offline
    MemberRank
    Mar 2009 Join Date
    SwedenLocation
    471Posts

    Re: World based character slots

    >,< Never heard of this, but awesome dude =D



Page 1 of 2 12 LastLast

Advertisement