[116] Ciphra/Lithium Block/Edit Cash item with out WZ edit

Results 1 to 10 of 10
  1. #1
    Proficient Member Chikn is offline
    MemberRank
    Jun 2010 Join Date
    164Posts

    [116] Ciphra/Lithium Block/Edit Cash item with out WZ edit

    Hi.
    I've played in Extalia and see they block items from the CS without editing WZ. And after a dozen times tried & failed. I have figured out how it work.

    Here is my CasItemFactory.java.
    Spoiler:

    PHP Code:
    /*
     This file is part of the OdinMS Maple Story Server
     Copyright (C) 2008 ~ 2010 Patrick Huy <patrick.huy@frz.cc> 
     Matthias Butz <matze@odinms.de>
     Jan Christian Meyer <vimes@odinms.de>

     This program is free software: you can redistribute it and/or modify
     it under the terms of the GNU Affero General Public License version 3
     as published by the Free Software Foundation. You may not use, modify
     or distribute this program under any other version of the
     GNU Affero General Public License.

     This program is distributed in the hope that it will be useful,
     but WITHOUT ANY WARRANTY; without even the implied warranty of
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     GNU Affero General Public License for more details.

     You should have received a copy of the GNU Affero General Public License
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
     */

    package server;

    import database.DatabaseConnection;
    import java.io.BufferedReader;
    import java.io.File;
    import java.io.FileReader;
    import java.io.IOException;
    import java.sql.Connection;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.util.*;
    import java.util.Map.Entry;
    import provider.MapleData;
    import provider.MapleDataProvider;
    import provider.MapleDataProviderFactory;
    import provider.MapleDataTool;
    import server.CashItemInfo.CashModInfo;

    public class 
    CashItemFactory {

        private final static 
    CashItemFactory instance = new CashItemFactory();
        private final static 
    int[] bestItems = new int[]{54500001012126523000055100005520000};
        private final 
    Map<IntegerCashItemInfoitemStats = new HashMap<>();
        private final 
    Map<Integer, List<Integer>> itemPackage = new HashMap<>();
        private final 
    Map<IntegerCashModInfoitemMods = new HashMap<>();
        private final 
    Map<Integer, List<Integer>> openBox = new HashMap<>();
        private final 
    MapleDataProvider data MapleDataProviderFactory.getDataProvider(new File("Wz/Etc.wz"));
        private static List<
    Integerblacklist = new ArrayList<>(); 

        public static 
    CashItemFactory getInstance() {
            return 
    instance;
        }

        public final 
    void initialize() {
            try {
                
    itemMods.clear();
                
    itemStats.clear();
                
    itemPackage.clear();
                
    openBox.clear();
                try {
                    
    BufferedReader reader = new BufferedReader(new FileReader("CBlackList.ini"));
                    
    String line reader.readLine();
                    while (
    line != null) {
                        try {
                            if (!
    line.isEmpty() && !line.split(",")[0].startsWith("#")) {
                                
    getBlacklist().add(Integer.parseInt(line.split(",")[0]));
                            }
                        } catch (
    Exception ex) {
    //                        System.err.println("Error while loading Black listed Cash Item.\r\n" + ex.getMessage());
                        
    }
                        
    line reader.readLine();
                    }
                } catch (
    IOException NumberFormatException ex) {
                    
    System.err.println("Error while loading cash black list.\r\n" ex.getMessage());
                }
                
    Connection con DatabaseConnection.getConnection();
                
    PreparedStatement ps con.prepareStatement("SELECT * FROM cashshop_modified_items");
                
    ResultSet rs ps.executeQuery();
                while (
    rs.next()) {
                    
    CashModInfo modded = new CashModInfo(rs.getInt("serial"), rs.getInt("discount_price"), 
                            
    rs.getInt("mark"), rs.getInt("showup") > 0rs.getInt("itemid"), 
                            
    rs.getInt("priority"), rs.getInt("package") > 0rs.getInt("period"), 
                            
    rs.getInt("gender"), rs.getInt("count"), rs.getInt("meso"), rs.getInt("unk_1"), 
                            
    rs.getInt("unk_2"), rs.getInt("unk_3"), rs.getInt("extra_flags"));
                    
    itemMods.put(modded.snmodded);
                    if (
    modded.showUp) {
                        final 
    CashItemInfo cc itemStats.get(Integer.valueOf(modded.sn));
                        if (
    cc != null) {
                            
    modded.toCItem(cc); //init
                        
    }
                    }
                }
                
    rs.close();
                
    ps.close();
                
    con.close();
                final List<
    MapleDatacccc data.getData("Commodity.img").getChildren();
                for (
    MapleData field cccc) {
                    final 
    int SN MapleDataTool.getIntConvert("SN"field0);
                    
    int ID MapleDataTool.getIntConvert("ItemId"field0);
                    final 
    int Bonus MapleDataTool.getIntConvert("Bonus"field0);
                    final 
    int Period MapleDataTool.getIntConvert("Period"field0);
                    final 
    int Priority MapleDataTool.getIntConvert("Priority"field0);
                    final 
    int Count MapleDataTool.getIntConvert("Count"field1);
                    final 
    int Price MapleDataTool.getIntConvert("Price"field0);
                    final 
    int Gender MapleDataTool.getIntConvert("Gender"field2);
                    final 
    boolean OnSale MapleDataTool.getIntConvert("OnSale"field0) > && Price 0;

                    if (
    getBlacklist().contains(ID) || ((Period == && OnSale))) { // Block black listed item from CS
                        
    if (!itemMods.containsKey(SN)) {
                            
    itemMods.put(SN, new CashModInfo(SN0, -1falseID100false0Gender0000040000));
                        }
                    }

                    final 
    CashItemInfo stats = new CashItemInfo(IDCountPriceSNPeriodGenderOnSale);

                    if (
    SN 0) {
                        
    itemStats.put(SNstats);
                    }
                }

                final 
    MapleData b data.getData("CashPackage.img");
                for (
    MapleData c b.getChildren()) {
                    if (
    c.getChildByPath("SN") == null) {
                        continue;
                    }
                    final 
    int packageID Integer.parseInt(c.getName());
                    final List<
    IntegerpackageItems = new ArrayList<>();
                    for (
    MapleData d c.getChildByPath("SN").getChildren()) {
                        
    packageItems.add(MapleDataTool.getIntConvert(d));
                    }
                    for (
    int pi packageItems) { // Block Cash Package if contain item in black list
                        
    if (getBlacklist().contains((itemStats.containsKey(pi) ? itemStats.get(pi).getId() : 0))) {
                            for (
    int _SN getSN(packageID)) {
                                if (!
    itemMods.containsKey(_SN)) {
                                    
    itemMods.put(_SN, new CashModInfo(_SN0, -1false0100false020000040000));
                                }
                            }
                        }
                    }
                    
    itemPackage.put(packageIDpackageItems);
                }

                for (
    int i 0getBlacklist().size(); i++) { // Block Cash Packages
                    
    if (getBlacklist().get(i) / 100000 == 9) { // Package only
                        
    for (int _SN getSN(getBlacklist().get(i))) {
                            if (!
    itemMods.containsKey(_SN)) {
                                
    itemMods.put(_SN, new CashModInfo(_SN0, -1false0100false020000040000));
                            }
                        }
                    }
                }
            } catch (
    SQLException NumberFormatException e) {
                
    System.err.println("[Error] An error has occured during init CashItemFactory.\r\n" e.getMessage());
            }
        }

        private List<
    IntegergetSN(int ItemId) {
            final List<
    IntegerSN = new ArrayList<>();
            for (
    Entry<IntegerCashItemInfoitem itemStats.entrySet()) {
                if (
    ItemId == item.getValue().getId()) {
                    
    SN.add(item.getKey());
                }
            }
            return 
    SN;
        }

        public final 
    CashItemInfo getSimpleItem(int sn) {
            return 
    itemStats.get(sn);
        }

        public final 
    CashItemInfo getItem(int sn) {
            final 
    CashItemInfo stats itemStats.get(Integer.valueOf(sn));
            final 
    CashModInfo z getModInfo(sn);
            if (
    != null && z.showUp) {
                return 
    z.toCItem(stats); //null doesnt matter
            
    }
            if (
    stats == null || !stats.onSale()) {
                return 
    null;
            }
            
    //hmm
            
    return stats;
        }

        public final List<
    IntegergetPackageItems(int packageID) {
            return 
    itemPackage.get(packageID);
        }

        public final 
    CashModInfo getModInfo(int sn) {
            return 
    itemMods.get(sn);
        }

        public final 
    Collection<CashModInfogetAllModInfo() {
            return 
    itemMods.values();
        }

        public final 
    Map<Integer, List<Integer>> getRandomItemInfo() {
            return 
    openBox;
        }

        public final 
    int[] getBestItems() {
            return 
    bestItems;
        }

        public static List<
    IntegergetBlacklist() {
            return 
    blacklist;
        }

        public static 
    void setBlacklist(List<IntegeraBlacklist) {
            
    blacklist aBlacklist;
        }



    And you can see. I load a list of items from the database. This is the information about the items that I want to change in CS. You can change everything like price, period, priority, ...

    cashshop_modified_items
    Spoiler:

    PHP Code:
    INSERT  INTO `cashshop_modified_items` (`serial`, `discount_price`, `mark`, `showup`, `itemid`, `priority`, `period`, `gender`, `count`,  `package`) VALUES (100118608900'0''1'18020381630210); -- Mini Celestial Wand OSN10002987 NSN10011860

    INSERT  INTO 
    `cashshop_modified_items` (`serial`, `discount_price`, `mark`, `showup`, `itemid`, `priority`, `period`, `gender`, `count`,  `package`) VALUES (100180101200'0''1'18120002530210); -- Meso Magnet OSN10003095 NSN10018010

    INSERT  INTO 
    `cashshop_modified_items` (`serial`, `discount_price`, `mark`, `showup`, `itemid`, `priority`, `period`, `gender`, `count`,  `package`) VALUES (101009781200'0''1'18120012530210); -- Item Pouch OSN10003096 NSN10100978 


    CBlackList.ini
    Spoiler:

    PHP Code:
    5750000// Alien Cube
    5062000// Miracle Cube
    5062001// Premium Miracle Cube
    5062002// Super Miracle Cube
    5062003// Revolutionary Miracle Cube
    5062005// Enlightening Miracle Cube
    5062100// 8th Anniversary Miracle Cube 


  2. #2
    Account Upgraded | Title Enabled! ngnam87 is offline
    MemberRank
    Mar 2013 Join Date
    666Posts

    Re: [116] Ciphra/Lithium Block/Edit Cash item with out WZ edit

    look in GameConstants
    param cashBlock

  3. #3
    Proficient Member Chikn is offline
    MemberRank
    Jun 2010 Join Date
    164Posts

    Re: [116] Ciphra/Lithium Block/Edit Cash item with out WZ edit

    It completely removed in CS. You can't see, search, buy blocked item and look more professional (lmao). Not that way

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

    Re: [116] Ciphra/Lithium Block/Edit Cash item with out WZ edit

    Do these sources have the packet parts already?

    Also it looks a bit the same with what I have in rev 121.

    PHP Code:
            List<ModifiedCashItemlsci CashItemFactory.getModifiedCashItems();
            
    mplew.writeShort(lsci.size());
            for (
    ModifiedCashItem sci lsci) {
                
    mplew.writeInt(sci.getSN());
                
    int mask sci.getMask();
                
    mplew.writeInt(mask);//mask
                
    if ((mask 0x1) > 0) {//nItemId
                    
    mplew.writeInt(sci.getItemId());
                }
                if ((
    mask 0x2) > 0) {//nCount
                    
    mplew.writeShort(sci.getCount());
                }
                if ((
    mask 0x4) > 0) {//nPrice
                    
    mplew.writeInt(sci.getPrice());
                }
                if ((
    mask 0x8) > 0) {//bBonus
                    
    mplew.write(sci.getBonus());
                }
                if ((
    mask 0x10) > 0) {//nPriority
                    
    mplew.write(sci.getPriority());
                }
                if ((
    mask 0x20) > 0) {//nPeriod
                    
    mplew.writeShort(sci.getPeriod());
                }
                if ((
    mask 0x40) > 0) {//nMaplePoint
                    
    mplew.writeInt(sci.getMaplePoint());
                }
                if ((
    mask 0x80) > 0) {//nMeso
                    
    mplew.writeInt(sci.getMeso());
                }
                if ((
    mask 0x100) > 0) {//bForPremiumUser
                    
    mplew.writeBool(sci.forPremiumOnly());
                }
                if ((
    mask 0x200) > 0) {//nCommodityGender
                    
    mplew.write(sci.getGender());
                }
                if ((
    mask 0x400) > 0) {//bOnSale
                    
    mplew.writeBool(sci.isOnSale());
                }
                if ((
    mask 0x800) > 0) {//nClass
                    
    mplew.write(sci.getnClass());
                }
                if ((
    mask 0x1000) > 0) {//nLimit
                    
    mplew.write(sci.getLimit());
                }
                if ((
    mask 0x2000) > 0) {//nPbCash
                    
    mplew.writeShort(sci.getPbCash());
                }
                if ((
    mask 0x4000) > 0) {//nPbPoint
                    
    mplew.writeShort(sci.getPbPoint());
                }
                if ((
    mask 0x8000) > 0) {//nPbGift
                    
    mplew.writeShort(sci.getPbGift());
                }
                if ((
    mask 0x10000) > 0) {//aPackageSN
                    
    final List<IntegerpackageSN sci.getPackageSN();
                    
    mplew.write(packageSN.size());
                    for (
    Integer i packageSN) {
                        
    mplew.writeInt(i);
                    }
                }
            } 
    It's funny as I never knew that Lithium had it. Mine is directly from the client btw, just saw that Lithium was missing some part.
    Oh and it's possible to add normal items to the cash shop too (you just have to do some coding for the buy part).

  5. #5
    Proficient Member Chikn is offline
    MemberRank
    Jun 2010 Join Date
    164Posts

    Re: [116] Ciphra/Lithium Block/Edit Cash item with out WZ edit

    Quote Originally Posted by kevintjuh93 View Post
    It's funny as I never knew that Lithium had it. Mine is directly from the client btw, just saw that Lithium was missing some part.
    Oh and it's possible to add normal items to the cash shop too (you just have to do some coding for the buy part).
    I tested it on CiphraDEV (the only one v116 i has) and i work fine =)
    Oh. I didn't know that you can add normal items to the CS. I thought u can do it with newer version only.

  6. #6
    Account Upgraded | Title Enabled! AristoCat is offline
    MemberRank
    Apr 2012 Join Date
    947Posts

    Re: [116] Ciphra/Lithium Block/Edit Cash item with out WZ edit

    I don't see what is this release for. The table was in database already, you only added a blacklist ini file which is not really needed?

  7. #7
    Proficient Member itai5001 is offline
    MemberRank
    Nov 2012 Join Date
    GarbageLocation
    174Posts

    Re: [116] Ciphra/Lithium Block/Edit Cash item with out WZ edit

    Quote Originally Posted by AristoCat View Post
    I don't see what is this release for. The table was in database already, you only added a blacklist ini file which is not really needed?
    +1, useless release.. :/

  8. #8
    Account Upgraded | Title Enabled! AristoCat is offline
    MemberRank
    Apr 2012 Join Date
    947Posts

    Re: [116] Ciphra/Lithium Block/Edit Cash item with out WZ edit

    Quote Originally Posted by itai5001 View Post
    +1, useless release.. :/
    Isn't there a rule against spamming?

  9. #9
    Proficient Member itai5001 is offline
    MemberRank
    Nov 2012 Join Date
    GarbageLocation
    174Posts

    Re: [116] Ciphra/Lithium Block/Edit Cash item with out WZ edit

    Quote Originally Posted by AristoCat View Post
    Isn't there a rule against spamming?
    WTH happend to you? o_O

  10. #10
    Proficient Member Chikn is offline
    MemberRank
    Jun 2010 Join Date
    164Posts

    Re: [116] Ciphra/Lithium Block/Edit Cash item with out WZ edit

    Quote Originally Posted by AristoCat View Post
    I don't see what is this release for. The table was in database already, you only added a blacklist ini file which is not really needed?
    I'm just testing and to lazy to change. So, bleh
    Btw, which table are you talking about?

    @itai5001: Just ignore if it useless with you. Kthxbye.



Advertisement