Loading Cash Items Form MCDB

Results 1 to 8 of 8
  1. #1
    Account Upgraded | Title Enabled! ExtremeDevilz is offline
    MemberRank
    Apr 2008 Join Date
    647Posts

    Loading Cash Items Form MCDB

    Code:
    /*
       @Author : ExtremeDevilz
    */
    
    package server;
    
    import java.sql.Connection;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.util.HashMap;
    import java.util.Map;
    
    
    import client.inventory.Item;
    import client.inventory.MapleInventoryType;
    import client.inventory.MaplePet;
    import constants.GameConstants;
    import database.DatabaseConnection;
    
    
    
    
    public class CashItemFactory {
    
    
        public static class CashItem {
    
    
            private int sn, itemId, price;
            private short quantity, expireDay, priority;
            private boolean gender, flags;
    
    
            private static Map<Integer, CashItem> mItems = new HashMap<>();
            private static Map<Integer, CashItem> mPackages = new HashMap<>();
    
    
            public CashItem(int sn, int itemId, short quantity, int price,
                    short expireDay, short priority, boolean gender, boolean flags) {
                this.sn = sn;
                this.itemId = itemId;
                this.quantity = quantity;
                this.price = price;
                this.expireDay = expireDay;
                this.priority = priority;
                this.gender = gender;
                this.flags = flags;
    
    
            }
    
    
            Connection mcdb = DatabaseConnection.getConnection();
    
    
            public void loadCashItems() {
                try {
    
    
                    PreparedStatement ps = mcdb
                            .prepareStatement("SELECT * FROM cash_commodity_data");
                    ResultSet rs = ps.executeQuery();
    
    
                    while (rs.next()) {
                        this.sn = rs.getInt("serial_number");
                        this.itemId = rs.getInt("itemid");
                        this.quantity = rs.getShort("quantity");
                        this.price = rs.getInt("price");
                        this.expireDay = rs.getShort("expireDay");
                        this.priority = rs.getShort("priority");
                        this.gender = rs.getBoolean("gender");
                        this.flags = rs.getString("flags").contains("on_sale");
    
    
                        mItems.put(sn, new CashItem(sn, itemId, quantity, price,
                                expireDay, priority, gender, flags));
    
    
                    }
    
    
                    ps.close();
                    rs.close();
    
    
                } catch (Exception Ex) {
                    Ex.printStackTrace();
                }
            }
    
    
            public void loadCashItemsPackages() {
                try {
                    PreparedStatement ps = mcdb .prepareStatement("SELECT `packageid`, `serial_number` FROM `cash_package_data`");
                    ResultSet rs = ps.executeQuery();
                    while (rs.next()) {
                        int packageId = rs.getInt("packageid");
                        int serial_number = rs.getInt("serial_number");
                        mPackages.put(packageId, getItem(serial_number));
                    }
                } catch (Exception Ex) {
                    Ex.getMessage();
                }
            }
    
    
            public static CashItem getItem(int sn) {
                return mItems.get(sn);
            }
    
    
            public int getSN() {
                return sn;
            }
    
    
            public int getItemId() {
                return itemId;
            }
    
    
            public int getPrice() {
                return price;
            }
        }
    }


  2. #2
    Banned SilentThief is offline
    BannedRank
    Sep 2012 Join Date
    The MatrixLocation
    466Posts

    Re: Loading Cash Items Form MCDB

    omg please, this is just spam, stop releasing this dump.
    OT: THANKS I GUESS? DAFAQ

  3. #3
    Account Upgraded | Title Enabled! ExtremeDevilz is offline
    MemberRank
    Apr 2008 Join Date
    647Posts

    Re: Loading Cash Items Form MCDB

    it is not junk... unless you can figure out how to loadCashItems.. from asrealms source good luck.

  4. #4
    Banned SilentThief is offline
    BannedRank
    Sep 2012 Join Date
    The MatrixLocation
    466Posts

    Re: Loading Cash Items Form MCDB

    Quote Originally Posted by Apparition View Post
    it is not junk... unless you can figure out how to loadCashItems.. from asrealms source good luck.
    Just make a compilation of your releases and delete all of these threads.
    Last edited by Kreeate; 07-01-14 at 09:43 PM.

  5. #5
    Account Upgraded | Title Enabled! StripedCow is offline
    MemberRank
    Jun 2011 Join Date
    813Posts

    Re: Loading Cash Items Form MCDB

    You didn't make this, i've seen this in like almost all Odin-Based sources. + this isn't the right way to do it.

  6. #6
    Banned SilentThief is offline
    BannedRank
    Sep 2012 Join Date
    The MatrixLocation
    466Posts

    Re: Loading Cash Items Form MCDB

    Quote Originally Posted by StripedCow View Post
    You didn't make this, i've seen this in like almost all Odin-Based sources. + this isn't the right way to do it.
    Conclusion: He didn't make this...and he broke it?

  7. #7
    Member TheGM is offline
    MemberRank
    Apr 2008 Join Date
    OdinMS<3Location
    76Posts

    Re: Loading Cash Items Form MCDB

    If you can not use/update Astral's way of dumping cashitems, you must not know to much, and should stop releasing useless stuff..

  8. #8
    while(true) spam(); kevintjuh93 is offline
    MemberRank
    Jun 2008 Join Date
    The NetherlandsLocation
    4,119Posts

    Re: Loading Cash Items Form MCDB

    First of all, if you plan on releasing multiple things, please make one thread like SilentThief said.
    Secondly, this release is already existing, only thing different is that you didn't release everything. There is no SQL table included.

    Also, how dare you to take Flav's credits.



Advertisement