• Unfortunately, we have experienced significant hard drive damage that requires urgent maintenance and rebuilding. The forum will be a state of read only until we install our new drives and rebuild all the configurations needed. Please follow our Facebook page for updates, we will be back up shortly! (The forum could go offline at any given time due to the nature of the failed drives whilst awaiting the upgrades.) When you see an Incapsula error, you know we are in the process of migration.

[Help] Ring Tags v83

Joined
Sep 2, 2010
Messages
393
Reaction score
10
Is there any way to create a ring with the tag by NPC "A COUPLE-RING WITH: <PARTNER IGN HERE>"? I know it can obviously be done in Cash Shop if you buy a crush ring the default way with your birthday and etc... when I try creating a ring through an NPC (and of course I have the functions necessary) the ring is created without any bugs but it's missing the "a couple-ring with" tag and it doesn't work. It seems rings only work and show their effects when it has the "couple" tag? Here's the script I am using. Here's an SS to show the tag.

BestSiteEvar - [Help] Ring Tags v83 - RaGEZONE Forums

PHP:
public int createRing(int ringId, String partner) {
        if (partner.length() < 1 || partner.length() > 15) {
            return 4;
        }
        final MapleCharacter couple = c.getChannelServer().getPlayerStorage().getCharacterByName(partner);
        if (couple == null) {
            return 1;
        }
        if (getPlayer().getInventory(MapleInventoryType.EQUIP).isFull()) {
            return 2;
        } else if (couple.getInventory(MapleInventoryType.EQUIP).isFull()) {
            return 3;
        } else if (partner.equals(getPlayer().getName())) {
            return 5;
        }
        MapleRing.createRing(ringId, getPlayer(), couple);
        getPlayer().addCrushRing(MapleRing.loadFromDb(ringId));
        return 0;
    }
 
Last edited:
Joined
Sep 2, 2010
Messages
393
Reaction score
10
It should be under addringsInfo part in setField packet.
Well, ring effects not showing isn't the problem here. Everything in relation to rings works flawlessly. From the purchase of it in Cash Shop to the usage of the effects in 1st, 2nd, and 3rd person view. The problem is when I create a ring through an NPC (using the same functions similar to those that get used in Cash Shop, as if you would create a ring) the ring comes out fine, the only thing missing is the couple's/partners name on the ring and since it's not tagged with the couples name it can't show any effects because it doesn't know who it's shared with.
 
Upvote 0
Interesting...
Loyal Member
Joined
Oct 25, 2008
Messages
1,372
Reaction score
604
Make sure the ring's couple is set upon creation with the NPC? If you use the code the cash shop uses (which you say works), then there would be no difference if you run that same code by through an NPC instead.
 
Upvote 0
Joined
Sep 2, 2010
Messages
393
Reaction score
10
Make sure the ring's couple is set upon creation with the NPC? If you use the code the cash shop uses (which you say works), then there would be no difference if you run that same code by through an NPC instead.
That's the problem, some functions in Cash Shop can't be brought over to NPCConversationManager. After looking it over, the problem seems to be
PHP:
getPlayer().addCrushRing(MapleRing.loadFromDb(ringId));
which doesn't make sense, after the creation it should be in the database and have no trouble loading it.
 
Upvote 0
Joined
Sep 2, 2010
Messages
393
Reaction score
10
I've gotten to work on this real hard and the only bug I have is finding out an item's "SN"? Here's my code so far, it gives me the ring successfully in MY Cash Shop, but it won't gift it to my partner. I've tried gifting and it does work, but when I try to do it with my method the gifting window doesn't appear and say "you have a gift" and I think it's because I am not correctly retrieving a cash item's SN.
PHP:
public int createRing(final int ringId, final String recipient) {
        if (recipient.length() < 1 || recipient.length() > 15) {
            return 4;
        }
        MapleCharacter partner = c.getChannelServer().getPlayerStorage().getCharacterByName(recipient);
        CashShop cs = getPlayer().getCashShop();
        if (partner == null) {
            return 1;
        }
        if (getPlayer().getInventory(MapleInventoryType.EQUIP).isFull()) {
            return 2;
        } else if (partner.getInventory(MapleInventoryType.EQUIP).isFull()) {
            return 3;
        } else if (recipient.equals(getPlayer().getName())) {
            return 5;
        }
        Equip nItem = new Equip(ringId, (byte) 0);
        int ringid = MapleRing.createRing(nItem.getItemId(), getPlayer(), partner);
        nItem.setRingId(ringid);
        cs.addToInventory(nItem);
        cs.gift(partner.getId(), getPlayer().getName(), "Ayeee!", nItem.getSN(), (ringid + 1));
        getPlayer().addCrushRing(MapleRing.loadFromDb(ringid));
        try {
            getPlayer().sendNote(partner.getName(), "Congratulations, you've received a love ring from " + getPlayer().getName() + "!", (byte) 1);
        } catch (SQLException ex) {
            ex.printStackTrace();
        }
        partner.showNote();
        System.out.println("Medievil.");
        return 0;
    }
AND here's the one from Cash Shop that actually works and successfully gifts.
PHP:
} else if (action == 0x1D) { //crush ring (action 28)
            if (!checkBirthday(c, slea.readInt())) {
                int toCharge = slea.readInt();
                int SN = slea.readInt();
                String recipient = slea.readMapleAsciiString();
                String text = slea.readMapleAsciiString();
                CashItem ring = CashItemFactory.getItem(SN);
                MapleCharacter partner = c.getChannelServer().getPlayerStorage().getCharacterByName(recipient);
                if (partner == null) {
                    chr.getClient().announce(MaplePacketCreator.serverNotice(1, "The partner you specified cannot be found.\r\nPlease make sure your partner is online and in the same channel."));
                } else {
                    IEquip item = (IEquip) ring.toItem();
                    int ringid = MapleRing.createRing(ring.getItemId(), chr, partner);
                    item.setRingId(ringid);
                    cs.addToInventory(item);
                    c.announce(MaplePacketCreator.showBoughtCashItem(item, c.getAccID()));
                    cs.gift(partner.getId(), chr.getName(), text, item.getSN(), (ringid + 1));
                    cs.gainCash(toCharge, -ring.getPrice());
                    chr.addCrushRing(MapleRing.loadFromDb(ringid));
                    try {
                        chr.sendNote(partner.getName(), text, (byte) 1);
                    } catch (SQLException ex) {
                        ex.printStackTrace();
                    }
                    partner.showNote();
                }
            } else {
                chr.dropMessage("The birthday you entered was incorrect.");
            }
            c.announce(MaplePacketCreator.showCash(c.getPlayer()));
 
Upvote 0
Skilled Illusionist
Joined
Jul 17, 2010
Messages
333
Reaction score
165
I've gotten to work on this real hard and the only bug I have is finding out an item's "SN"? Here's my code so far, it gives me the ring successfully in MY Cash Shop, but it won't gift it to my partner. I've tried gifting and it does work, but when I try to do it with my method the gifting window doesn't appear and say "you have a gift" and I think it's because I am not correctly retrieving a cash item's SN.
PHP:
public int createRing(final int ringId, final String recipient) {
        if (recipient.length() < 1 || recipient.length() > 15) {
            return 4;
        }
        MapleCharacter partner = c.getChannelServer().getPlayerStorage().getCharacterByName(recipient);
        CashShop cs = getPlayer().getCashShop();
        if (partner == null) {
            return 1;
        }
        if (getPlayer().getInventory(MapleInventoryType.EQUIP).isFull()) {
            return 2;
        } else if (partner.getInventory(MapleInventoryType.EQUIP).isFull()) {
            return 3;
        } else if (recipient.equals(getPlayer().getName())) {
            return 5;
        }
        Equip nItem = new Equip(ringId, (byte) 0);
        int ringid = MapleRing.createRing(nItem.getItemId(), getPlayer(), partner);
        nItem.setRingId(ringid);
        cs.addToInventory(nItem);
        cs.gift(partner.getId(), getPlayer().getName(), "Ayeee!", nItem.getSN(), (ringid + 1));
        getPlayer().addCrushRing(MapleRing.loadFromDb(ringid));
        try {
            getPlayer().sendNote(partner.getName(), "Congratulations, you've received a love ring from " + getPlayer().getName() + "!", (byte) 1);
        } catch (SQLException ex) {
            ex.printStackTrace();
        }
        partner.showNote();
        System.out.println("Medievil.");
        return 0;
    }
AND here's the one from Cash Shop that actually works and successfully gifts.
PHP:
} else if (action == 0x1D) { //crush ring (action 28)
            if (!checkBirthday(c, slea.readInt())) {
                int toCharge = slea.readInt();
                int SN = slea.readInt();
                String recipient = slea.readMapleAsciiString();
                String text = slea.readMapleAsciiString();
                CashItem ring = CashItemFactory.getItem(SN);
                MapleCharacter partner = c.getChannelServer().getPlayerStorage().getCharacterByName(recipient);
                if (partner == null) {
                    chr.getClient().announce(MaplePacketCreator.serverNotice(1, "The partner you specified cannot be found.\r\nPlease make sure your partner is online and in the same channel."));
                } else {
                    IEquip item = (IEquip) ring.toItem();
                    int ringid = MapleRing.createRing(ring.getItemId(), chr, partner);
                    item.setRingId(ringid);
                    cs.addToInventory(item);
                    c.announce(MaplePacketCreator.showBoughtCashItem(item, c.getAccID()));
                    cs.gift(partner.getId(), chr.getName(), text, item.getSN(), (ringid + 1));
                    cs.gainCash(toCharge, -ring.getPrice());
                    chr.addCrushRing(MapleRing.loadFromDb(ringid));
                    try {
                        chr.sendNote(partner.getName(), text, (byte) 1);
                    } catch (SQLException ex) {
                        ex.printStackTrace();
                    }
                    partner.showNote();
                }
            } else {
                chr.dropMessage("The birthday you entered was incorrect.");
            }
            c.announce(MaplePacketCreator.showCash(c.getPlayer()));
Yes, you need to get real 'SN' of the ring item. (you would find it from the handler or searching on the commodity file?)

Because 'gifts' load the cash item from 'SN'
Code:
CashItem cItem = CashItemFactory.getItem(rs.getInt("sn"));
and your code doesn't set SN (probably 0 by default)
Code:
nItem.getSN()//return 0
so the CashItemFactory.getItem can't find the item, the partner won't receive a gift.
 
Upvote 0
Joined
Sep 2, 2010
Messages
393
Reaction score
10
Yes, you need to get real 'SN' of the ring item. (you would find it from the handler or searching on the commodity file?)

Because 'gifts' load the cash item from 'SN'
Code:
CashItem cItem = CashItemFactory.getItem(rs.getInt("sn"));
and your code doesn't set SN (probably 0 by default)
Code:
nItem.getSN()//return 0
so the CashItemFactory.getItem can't find the item, the partner won't receive a gift.
This makes sense. How would you go about getting the 'SN' from an item NOT made in Cash Shop? Do all cash items have default 'sn' values, if so I can just replicate it or is there some formula to it? Upon seeing this, it definitely makes sense as to why gifts don't successfully go through.
 
Upvote 0
Skilled Illusionist
Joined
Jul 17, 2010
Messages
333
Reaction score
165
This makes sense. How would you go about getting the 'SN' from an item NOT made in Cash Shop? Do all cash items have default 'sn' values, if so I can just replicate it or is there some formula to it? Upon seeing this, it definitely makes sense as to why gifts don't successfully go through.
It is just a cash package's id. (or I believe so)
You can get it from the handler
Code:
                int toCharge = slea.readInt(); 
                int SN = slea.readInt(); //<- print
                String recipient = slea.readMapleAsciiString();
or manually search itemId on Etc.wz/Commodity.img as I intended to say above.
 
Upvote 0
Joined
Sep 2, 2010
Messages
393
Reaction score
10
It is just a cash package's id. (or I believe so)
You can get it from the handler
Code:
                int toCharge = slea.readInt(); 
                int SN = slea.readInt(); //<- print
                String recipient = slea.readMapleAsciiString();
or manually search itemId on Etc.wz/Commodity.img as I intended to say above.
Ah, thank you very much. It works perfectly now. Got a little lost and brain-farted and forgot how to print and debug for a sec, there, lol! Even went full Special person and manually searched ring ID's in the WZ files, instead of checking my server wz directory, when it's already XML format xD. Any idea as to how to read the 'SN' on the items? Tried finding a formula but couldn't. Every item has a huge 'SN' but it gets read in Cash Shop when it buys the ring and returns a smaller value. The 'SN' for a crush ring is '20900105' and the crush ring ID is '1112001' but in CS after purchasing and reading the "slea.readInt()" value it went to '20900028' <- new SN. No idea how the values change, as there are some rings that are not available and I've no idea how to get their SN's!
 
Upvote 0
Skilled Illusionist
Joined
Jul 17, 2010
Messages
333
Reaction score
165
Ah, thank you very much. It works perfectly now. Got a little lost and brain-farted and forgot how to print and debug for a sec, there, lol! Even went full Special person and manually searched ring ID's in the WZ files, instead of checking my server wz directory, when it's already XML format xD. Any idea as to how to read the 'SN' on the items? Tried finding a formula but couldn't. Every item has a huge 'SN' but it gets read in Cash Shop when it buys the ring and returns a smaller value. The 'SN' for a crush ring is '20900105' and the crush ring ID is '1112001' but in CS after purchasing and reading the "slea.readInt()" value it went to '20900028' <- new SN. No idea how the values change, as there are some rings that are not available and I've no idea how to get their SN's!
Code:
  <imgdir name="7161">
    <int name="SN" value="20900028" />
    <int name="ItemId" value="1112001" />
    <int name="Count" value="1" />
    <int name="Price" value="6000" />
    <int name="Period" value="90" />
    <int name="Priority" value="9" />
    <int name="Gender" value="2" />
    [B]<int name="OnSale" value="1" />[/B]
    <int name="Class" value="2" />
  </imgdir>
Code:
  <imgdir name="7238">
    <int name="SN" value="20900105" />
    <int name="ItemId" value="1112001" />
    <int name="Count" value="1" />
    <int name="Price" value="4800" />
    <int name="Period" value="90" />
    <int name="Priority" value="12" />
    <int name="Gender" value="2" />
    [B]<int name="OnSale" value="0" />[/B]
  </imgdir>
Well, did you really buy 20900105?

And as for the rings that are not available, I think that you need to manually search item id on the xml.
 
Upvote 0
Newbie Spellweaver
Joined
Aug 6, 2014
Messages
56
Reaction score
42
IIRC, the CashItemInfoFactory can lookup an item's SN based on its itemId.
 
Upvote 0
Joined
Sep 2, 2010
Messages
393
Reaction score
10
Code:
  <imgdir name="7161">
    <int name="SN" value="20900028" />
    <int name="ItemId" value="1112001" />
    <int name="Count" value="1" />
    <int name="Price" value="6000" />
    <int name="Period" value="90" />
    <int name="Priority" value="9" />
    <int name="Gender" value="2" />
    [B]<int name="OnSale" value="1" />[/B]
    <int name="Class" value="2" />
  </imgdir>
Code:
  <imgdir name="7238">
    <int name="SN" value="20900105" />
    <int name="ItemId" value="1112001" />
    <int name="Count" value="1" />
    <int name="Price" value="4800" />
    <int name="Period" value="90" />
    <int name="Priority" value="12" />
    <int name="Gender" value="2" />
    [B]<int name="OnSale" value="0" />[/B]
  </imgdir>
Well, did you really buy 20900105?

And as for the rings that are not available, I think that you need to manually search item id on the xml.
Holy cow. I didn't even realize there were similar ID's! Looks like you were right. I assumed there was only one ID per ring and one 'SN' but there were a couple of more similar ID's. I'll see if I can find a work around for rings that are not in the XML but they do exist.
 
Last edited:
Upvote 0
Back
Top