Well had some issues with my current host and my server is going for a fucking reformat ..So i've decided to release some useful codes while waiting :D Heres the buy ring :
This goes into buycsitemhandler
Code:case 0x1D: { if (checkBirthday(c, slea.readInt())) { //friendship System.out.println("BIRTHDAY CORRECT"); int i = 1; int toCharge = slea.readInt(); int SN = slea.readInt(); String recipient = slea.readMapleAsciiString(); String text = slea.readMapleAsciiString(); System.out.println(i); i++; CashItemInfo ring = CashItemFactory.getInstance().getItem(SN); System.out.println(i); i++; MapleCharacter partnerChar = c.getChannelServer().getPlayerStorage().getCharacterByName(recipient); System.out.println(i); i++; if (partnerChar == null) { System.out.println("PARTNER IS GAY"); c.getPlayer().getClient().getSession().write(MaplePacketCreator.serverNotice(1, "The partner you specified cannot be found.\r\nPlease make sure your partner is online and in the same channel.")); } else { if (partnerChar.getGender() == c.getPlayer().getGender()) { System.out.println("SAME GENDER FAILURE"); c.getPlayer().dropMessage("You and your partner are the same gender, please buy a friendship ring."); return; } System.out.println("NOW GOING TO SEND BOUGHTCSITEM PACKET"); c.getSession().write(MaplePacketCreator.showBoughtCSItem(c, ring)); System.out.println("Done; NOW GOING TO MODIFY CS POINTS"); c.getPlayer().modifyCSPoints(toCharge, -ring.getPrice()); System.out.println("DONE; OK NOW CREATING RING!"); MapleRing.createRing(ring.getId(), c.getPlayer(), partnerChar, text); System.out.println("Done lulz"); c.getPlayer().getClient().getSession().write(MaplePacketCreator.serverNotice(1, "Successfully created a ring for both you and your partner!")); } } else { c.getPlayer().dropMessage("The birthday you entered was incorrect."); } showCS(c); break; }Partial Credits to both kevins :D ( kevintjuh for println to check whats wrong) , (expedia for giving me the correct headers)Code:case 0x23: { // crush ring if (checkBirthday(c, slea.readInt())) { System.out.println("BIRTHDAY CORRECT"); int i = 1; int toCharge = slea.readInt(); int SN = slea.readInt(); String recipient = slea.readMapleAsciiString(); String text = slea.readMapleAsciiString(); System.out.println(i); i++; CashItemInfo ring = CashItemFactory.getInstance().getItem(SN); System.out.println(i); i++; MapleCharacter partnerChar = c.getChannelServer().getPlayerStorage().getCharacterByName(recipient); System.out.println(i); i++; if (partnerChar == null) { System.out.println("PARTNER IS GAY"); c.getPlayer().getClient().getSession().write(MaplePacketCreator.serverNotice(1, "The partner you specified cannot be found.\r\nPlease make sure your partner is online and in the same channel.")); } else { System.out.println("NOW GOING TO SEND BOUGHTCSITEM PACKET"); c.getSession().write(MaplePacketCreator.showBoughtCSItem(c, ring)); System.out.println("Done; NOW GOING TO MODIFY CS POINTS"); c.getPlayer().modifyCSPoints(toCharge, -ring.getPrice()); System.out.println("DONE; OK NOW CREATING RING!"); MapleRing.createRing(ring.getId(), c.getPlayer(), partnerChar, text); System.out.println("Done lulz"); c.getPlayer().getClient().getSession().write(MaplePacketCreator.serverNotice(1, "Successfully created a ring for both you and your partner!")); } } else { c.getPlayer().dropMessage("The birthday you entered was incorrect."); } showCS(c); break; }
Other than that i take credit for this



Reply With Quote


