Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package net.cashshop;
- import constants.CashShopConstants;
- import tools.data.output.MaplePacketLittleEndianWriter;
- /**
- * CStockInfo
- *
- * @author Eric
- */
- public class StockInfo {
- public static void EncodeStock(MaplePacketLittleEndianWriter mplew) {
- mplew.writeShort(CashShopConstants.blockedCash.length); // nStockInfoCount
- for (int i : CashShopConstants.blockedCash) {
- mplew.writeInt(CashShop.CashItemFactory.getInstance().getSN(i)); // nCommoditySN
- mplew.writeInt(1); // nStockState
- }
- }
- }
- public static MaplePacket openCashShop(MapleClient c) {
- MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
- MapleCharacter chr = c.getPlayer();
- mplew.writeShort(SendPacketOpcode.CS_OPEN.getValue());
- mplew.writeLong(-1);
- mplew.write(0);
- addCharStats(mplew, chr);
- mplew.write(chr.getBuddylist().getCapacity());
- if (chr.getLinkedName() == null) {
- mplew.write(0);
- } else {
- mplew.write(1);
- mplew.writeMapleAsciiString(chr.getLinkedName());
- }
- mplew.writeInt(chr.getMeso());
- addInventoryInfo(mplew, chr);
- addSkillInfo(mplew, chr);
- addQuestInfo(mplew, chr);
- mplew.writeLong(0);
- for (int i = 0; i < 15; i++) {
- mplew.write(CHAR_INFO_MAGIC);
- }
- mplew.writeInt(0);
- mplew.writeShort(0);
- // mplew.writeShort(0);
- mplew.write(0);
- mplew.writeShort(0);//todo: area keys and w/e
- mplew.writeInt(0);
- mplew.write(1);
- mplew.writeMapleAsciiString(c.getAccountName());
- //removed commodity
- int[] removedItems = { };//item SN's that are removed go here
- mplew.writeInt(removedItems.length);
- for (int i : removedItems) {
- mplew.writeInt(i);
- }
- mplew.writeShort(1); //EncodeModifiedCommodity
- mplew.writeInt(50500070);
- mplew.writeInt(0x400);
- mplew.write(0);
- /*
- mplew.writeShort(CashDataProvider.getCustomSales().size());
- for (Pair<Integer, Byte> sn : CashDataProvider.getCustomSales()) {
- mplew.writeInt(sn.getLeft());
- mplew.writeInt(0x400);
- mplew.write(sn.getRight());
- }*/
- mplew.writeShort(0);
- for (int i = 0; i < 14; i++) {
- mplew.writeLong(0);
- }
- mplew.writeInt(0);
- mplew.writeShort(0);
- mplew.write(0);
- for (int i = 1; i <= 8; i++) {//EncodeSaleInfo
- for (int j = 0; j < 2; j++) {
- mplew.writeInt(i);
- mplew.writeInt(j);
- mplew.writeInt(50200004);
- mplew.writeInt(i);
- mplew.writeInt(j);
- mplew.writeInt(50200069);
- mplew.writeInt(i);
- mplew.writeInt(j);
- mplew.writeInt(50200117);
- mplew.writeInt(i);
- mplew.writeInt(j);
- mplew.writeInt(50100008);
- mplew.writeInt(i);
- mplew.writeInt(j);
- mplew.writeInt(50000047);
- }
- }
- int[] blockedItems = { }; // item SN's with "BUY" disables go here.
- mplew.writeShort(blockedItems.length); // nStockInfoCount
- for (int i : blockedItems) {
- mplew.writeInt(i); // nCommoditySN
- mplew.writeInt(1); // nStockState
- }
- mplew.writeShort(0);//limit goods
- mplew.writeShort(0);//zero limit goods
- mplew.write(0);//event boolean
- mplew.writeInt(75);//character level for item reqs like shops/gachapon
- return mplew.getPacket();
- }
Advertisement
Add Comment
Please, Sign In to add comment