adding marriage rings issue

Results 1 to 5 of 5
  1. #1
    Member Smartloser is offline
    MemberRank
    Mar 2013 Join Date
    26Posts

    adding marriage rings issue

    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 by Smartloser; 19-07-14 at 10:10 PM.


  2. #2
    Grand Master ExtremeDevilz is offline
    Grand MasterRank
    Apr 2008 Join Date
    647Posts

    Re: adding marriage rings issue

    Quote Originally Posted by Smartloser View Post
    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);

  3. #3
    Member Smartloser is offline
    MemberRank
    Mar 2013 Join Date
    26Posts

    Re: adding marriage rings issue

    Quote Originally Posted by Multo View Post
    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.

  4. #4
    Member Smartloser is offline
    MemberRank
    Mar 2013 Join Date
    26Posts

    Re: adding marriage rings issue

    I still haven't found a solution. If someone could help me, that'll be great, thank you.

    Regards,
    Smartloser

  5. #5
    Grand Master Syre is offline
    Grand MasterRank
    Jan 2013 Join Date
    700Posts

    Re: adding marriage rings issue

    Print checkpoints in the process and you'll find where it's broken.



Advertisement