Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

adding marriage rings issue

Initiate Mage
Joined
Mar 3, 2013
Messages
26
Reaction score
1
Hey guys. So to test the marriages ring effect I wanted to create a command that'll add a ring to both of the characters and the ring to the database. This is my code:

Code:
Item i = MapleItemInformationProvider.getInstance().getEquipById(1112803);
        Equip item = (Equip) i;
        int ringid = MapleRing.createRing(i.getItemId(), chr, partner);
        item.setRingId(ringid);
        chr.getInventory(MapleInventoryType.EQUIP).addItem(item);
        chr.getClient().announce(MaplePacketCreator.modifyInventory(true, Collections.singletonList(new ModifyInventory(0, item))));
        chr.addMarriageRing(MapleRing.loadFromDb(ringid));
        chr.dropMessage("Loaded ring " + MapleRing.loadFromDb(ringid).getRingId() + " " + MapleRing.loadFromDb(ringid).getPartnerName());
        chr.getClient().disconnect(false, false);
         Equip ring = (Equip) i;
         ring.setSN(item.getSN());
         item.setRingId((ringid+1));
         partner.getInventory(MapleInventoryType.EQUIP).addItem(ring);
         partner.getClient().announce(MaplePacketCreator.modifyInventory(true, Collections.singletonList(new ModifyInventory(0, ring))));
         partner.addMarriageRing(MapleRing.loadFromDb((ringid+1)));
         chr.dropMessage("Loaded ring " + MapleRing.loadFromDb(ringid+1).getRingId() + " " + MapleRing.loadFromDb(ringid+1).getPartnerName());
Now for some odd reason, it keeps adding the same ring for both of the characters.. and I am trying to figure out why, so I hope you guys can help me with that.

UPDATE:
Fixed the issue, but now I can't wear the rings, when I double click them it just stays there and I have to dispose to be able to click items again. Any solution for that?

Regards,
Matt
 
Last edited:
Elite Diviner
Joined
Apr 7, 2008
Messages
494
Reaction score
66
Hey guys. So to test the marriages ring effect I wanted to create a command that'll add a ring to both of the characters and the ring to the database. This is my code:

Code:
    public static void Marry(MapleCharacter chr, MapleCharacter partner, MarriageRingType type) {
        Item i = MapleItemInformationProvider.getInstance().getEquipById(1112803); // moonstone
        Equip item = (Equip) i;
        int ringid = MapleRing.createRing(i.getItemId(), chr, partner);
        item.setRingId(ringid);
        chr.getInventory(MapleInventoryType.EQUIP).addItem(item);
        chr.getClient().announce(MaplePacketCreator.modifyInventory(true, Collections.singletonList(new ModifyInventory(0, item))));
        chr.addMarriageRing(MapleRing.loadFromDb(ringid));
        //chr.dropMessage("Loaded ring " + MapleRing.loadFromDb(ringid).getRingId() + " " + MapleRing.loadFromDb(ringid).getPartnerName());
        
        Equip ring = (Equip) i;
        ring.setSN(item.getSN());
        item.setRingId((ringid+1));
        partner.getInventory(MapleInventoryType.EQUIP).addItem(ring);
        partner.getClient().announce(MaplePacketCreator.modifyInventory(true, Collections.singletonList(new ModifyInventory(0, ring))));
        partner.addMarriageRing(MapleRing.loadFromDb((ringid+1)));
        //chr.dropMessage("Loaded ring " + MapleRing.loadFromDb(ringid+1).getRingId() + " " + MapleRing.loadFromDb(ringid+1).getPartnerName());
    }
Now for some odd reason, it keeps adding the same ring for both of the characters.. and I am trying to figure out why, so I hope you guys can help me with that.

Regards,
Matt


cause you created the same ring for both of the characters ? what did you expect ?

int ringid = MapleRing.createRing(i.getItemId(), chr, partner);
 
Upvote 0
Initiate Mage
Joined
Mar 3, 2013
Messages
26
Reaction score
1
cause you created the same ring for both of the characters ? what did you expect ?

int ringid = MapleRing.createRing(i.getItemId(), chr, partner);
Correct, this is how this should be. I looked on the code on how crush rings are generated. Basically, when you create a ring it generates two rows in the MySQL.
 
Upvote 0
Initiate Mage
Joined
Mar 3, 2013
Messages
26
Reaction score
1
I still haven't found a solution. If someone could help me, that'll be great, thank you.

Regards,
Smartloser
 
Upvote 0
Legendary Battlemage
Joined
Jan 23, 2013
Messages
695
Reaction score
101
Print checkpoints in the process and you'll find where it's broken.
 
Upvote 0
Back
Top