Guest User

Untitled

a guest
May 31st, 2015
258
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.10 KB | None | 0 0
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6.  
  7. package net.cashshop;
  8.  
  9. import constants.CashShopConstants;
  10. import tools.data.output.MaplePacketLittleEndianWriter;
  11.  
  12. /**
  13. * CStockInfo
  14. *
  15. * @author Eric
  16. */
  17. public class StockInfo {
  18. public static void EncodeStock(MaplePacketLittleEndianWriter mplew) {
  19. mplew.writeShort(CashShopConstants.blockedCash.length); // nStockInfoCount
  20. for (int i : CashShopConstants.blockedCash) {
  21. mplew.writeInt(CashShop.CashItemFactory.getInstance().getSN(i)); // nCommoditySN
  22. mplew.writeInt(1); // nStockState
  23. }
  24. }
  25. }
  26.  
  27. public static MaplePacket openCashShop(MapleClient c) {
  28. MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
  29. MapleCharacter chr = c.getPlayer();
  30. mplew.writeShort(SendPacketOpcode.CS_OPEN.getValue());
  31.  
  32. mplew.writeLong(-1);
  33. mplew.write(0);
  34. addCharStats(mplew, chr);
  35. mplew.write(chr.getBuddylist().getCapacity());
  36.  
  37. if (chr.getLinkedName() == null) {
  38. mplew.write(0);
  39. } else {
  40. mplew.write(1);
  41. mplew.writeMapleAsciiString(chr.getLinkedName());
  42. }
  43.  
  44. mplew.writeInt(chr.getMeso());
  45.  
  46. addInventoryInfo(mplew, chr);
  47. addSkillInfo(mplew, chr);
  48. addQuestInfo(mplew, chr);
  49. mplew.writeLong(0);
  50. for (int i = 0; i < 15; i++) {
  51. mplew.write(CHAR_INFO_MAGIC);
  52. }
  53.  
  54. mplew.writeInt(0);
  55. mplew.writeShort(0);
  56. // mplew.writeShort(0);
  57. mplew.write(0);
  58.  
  59. mplew.writeShort(0);//todo: area keys and w/e
  60.  
  61. mplew.writeInt(0);
  62. mplew.write(1);
  63. mplew.writeMapleAsciiString(c.getAccountName());
  64.  
  65. //removed commodity
  66. int[] removedItems = { };//item SN's that are removed go here
  67. mplew.writeInt(removedItems.length);
  68. for (int i : removedItems) {
  69. mplew.writeInt(i);
  70. }
  71.  
  72. mplew.writeShort(1); //EncodeModifiedCommodity
  73. mplew.writeInt(50500070);
  74. mplew.writeInt(0x400);
  75. mplew.write(0);
  76. /*
  77. mplew.writeShort(CashDataProvider.getCustomSales().size());
  78. for (Pair<Integer, Byte> sn : CashDataProvider.getCustomSales()) {
  79. mplew.writeInt(sn.getLeft());
  80. mplew.writeInt(0x400);
  81. mplew.write(sn.getRight());
  82.  
  83. }*/
  84.  
  85. mplew.writeShort(0);
  86. for (int i = 0; i < 14; i++) {
  87. mplew.writeLong(0);
  88. }
  89. mplew.writeInt(0);
  90. mplew.writeShort(0);
  91. mplew.write(0);
  92.  
  93. for (int i = 1; i <= 8; i++) {//EncodeSaleInfo
  94. for (int j = 0; j < 2; j++) {
  95. mplew.writeInt(i);
  96. mplew.writeInt(j);
  97. mplew.writeInt(50200004);
  98.  
  99. mplew.writeInt(i);
  100. mplew.writeInt(j);
  101. mplew.writeInt(50200069);
  102.  
  103. mplew.writeInt(i);
  104. mplew.writeInt(j);
  105. mplew.writeInt(50200117);
  106.  
  107. mplew.writeInt(i);
  108. mplew.writeInt(j);
  109. mplew.writeInt(50100008);
  110.  
  111. mplew.writeInt(i);
  112. mplew.writeInt(j);
  113. mplew.writeInt(50000047);
  114. }
  115. }
  116. int[] blockedItems = { }; // item SN's with "BUY" disables go here.
  117. mplew.writeShort(blockedItems.length); // nStockInfoCount
  118. for (int i : blockedItems) {
  119. mplew.writeInt(i); // nCommoditySN
  120. mplew.writeInt(1); // nStockState
  121. }
  122. mplew.writeShort(0);//limit goods
  123. mplew.writeShort(0);//zero limit goods
  124. mplew.write(0);//event boolean
  125. mplew.writeInt(75);//character level for item reqs like shops/gachapon
  126.  
  127. return mplew.getPacket();
  128. }
Advertisement
Add Comment
Please, Sign In to add comment