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!

UI Freezing while using Gollux Scrolls

Junior Spellweaver
Joined
Jul 1, 2008
Messages
138
Reaction score
39
Howdy Ragezone o/

I started tinkering with Acernis 146 again so I could play locally to pass some time. Replaced the Opcode for the strengthen UI so regular scrolls and Potential scrolls work great! However when attempting to use Gollux Scrolls or when trying to add bonus potential to an Item, the game freezes at the processing screen,

I suspect (in my very limited knowledge) That the Bonus potential issue is related to a wrong or unhandled Opcode, however I don't have the slightest clue as to why Gollux scrolls would freeze up when scrolling itself works as it should!

Any help would be greatly appreciated! :D

Thanks a bunch,
Cody
 
Last edited:
Newbie Spellweaver
Joined
Jan 29, 2013
Messages
50
Reaction score
3
You can add the bpot lines to the regular potential scroll but if you want the original ones to work just handle them in MapleItemInformationProvider Its not hard at all.
 
Upvote 0
Junior Spellweaver
Joined
Jul 1, 2008
Messages
138
Reaction score
39
You can add the bpot lines to the regular potential scroll but if you want the original ones to work just handle them in MapleItemInformationProvider Its not hard at all.

This is super helpful! I didn't actually know I could do that! Just real quick though, could you give me a brief example of how bonus potential scrolls would be handled?
 
Upvote 0
Newbie Spellweaver
Joined
Jan 29, 2013
Messages
50
Reaction score
3
Code:
  } else if (GameConstants.isBonusPotentialScroll(scrollId.getItemId())) {  
                  if (Randomizer.nextInt(100) > success) {
                        return Randomizer.nextInt(99) < curse ? null : nEquip;
                    }
                    if (scrollId.getItemId() == 2048306) {
                          nEquip.renewPotential(3, 0, (short) 0, true);
                    } else {
                        nEquip.resetPotential();
                    }
That's an example but i'll send you what i am using if you want.
 
Upvote 0
Junior Spellweaver
Joined
Jul 1, 2008
Messages
138
Reaction score
39
Code:
  } else if (GameConstants.isBonusPotentialScroll(scrollId.getItemId())) {                    if (Randomizer.nextInt(100) > success) {
                        return Randomizer.nextInt(99) < curse ? null : nEquip;
                    }
                    if (scrollId.getItemId() == 2048306) {
                          nEquip.renewPotential(3, 0, (short) 0, true);
                    } else {
                        nEquip.resetPotential();
                    }
That's an example but i'll send you what i am using if you want.

That would be great if you wouldn't mind! :)
 
Upvote 0
Newbie Spellweaver
Joined
Jan 29, 2013
Messages
50
Reaction score
3
Replace the one you have now with this .

Code:
else if (GameConstants.isPotentialScroll(scrollId.getItemId())) {
  if (nEquip.getState() <= 17 && (scrollId.getItemId() / 100 == 20497)) {
                                final int chanc = (scrollId.getItemId() == 2049701 ? 80 : 100) + added; // 2049701
                                if (Randomizer.nextInt(100) > chanc) {
                                    return null; //destroyed, nib
                                }
                                nEquip.renewPotential(2, 0, (short) 0, false);
                            } else if (nEquip.getState() == 0) {
                                final int chanc = (scrollId.getItemId() == 5534000 || scrollId.getItemId() == 2049402 || scrollId.getItemId() == 2049406 ? 100 : scrollId.getItemId() == 2049701 ? 80 : (scrollId.getItemId() == 2049400 || scrollId.getItemId() == 2049407 || scrollId.getItemId() == 2049413 ? 90 : 70)) + added;
                                if (Randomizer.nextInt(100) > chanc) {
                                    return null; //destroyed, nib
                                }
                                nEquip.resetPotential();
                            }
                            break;
                             } else if (GameConstants.isBonusPotentialScroll(scrollId.getItemId())) {
                            if (nEquip.getState() <= 17 && (scrollId.getItemId() / 100 == 20497)) {
                                final int chanc = (scrollId.getItemId() == 2049701 ? 80 : 100) + added; // 2049701
                                if (Randomizer.nextInt(100) > chanc) {
                                    return null; //destroyed, nib
                                }
                                nEquip.renewPotential(3, 0, (short) 0, true);
                            } else if (nEquip.getState() == 0) {
                                final int chanc = (scrollId.getItemId() == 5530360 || scrollId.getItemId() == 2048306 || scrollId.getItemId() == 2048307 ||scrollId.getItemId() == 2048315 ? 100 : (scrollId.getItemId() == 0 || scrollId.getItemId() == 0 || scrollId.getItemId() == 0 ? 90 : 70)) + added;
                                if (Randomizer.nextInt(100) > chanc) {
                                    return null; //destroyed, nib
                                }
                                nEquip.resetPotential();
                            }
                            break;
 
Upvote 0
Junior Spellweaver
Joined
Jul 1, 2008
Messages
138
Reaction score
39
I really appreciate you sharing this! It's all rather exciting, really :D

Just one more thing, would you mind if I took a peek at your isBonusPotentialScroll method in GameConstants? I have one written out but I'd like to compare notes to make sure I don't break anything. :p
 
Upvote 0
Newbie Spellweaver
Joined
Jan 29, 2013
Messages
50
Reaction score
3
I am pretty sure you are using this one but if you dont so use it

Code:
public static boolean isBonusPotentialScroll(int scrollId) {
return scrollId == 2048306;
}

but you can also try out this

Code:
public static boolean isBonusPotentialScroll(int itemid) {
return itemid / 100 == 20483 && !(itemid >= 2048200 && itemid <= 2048304);
}
 
Upvote 0
Junior Spellweaver
Joined
Jul 1, 2008
Messages
138
Reaction score
39
I am pretty sure you are using this one but if you dont so use it

Code:
public static boolean isBonusPotentialScroll(int scrollId) {
return scrollId == 2048306;
}

but you can also try out this

Code:
public static boolean isBonusPotentialScroll(int itemid) {
return itemid / 100 == 20483 && !(itemid >= 2048200 && itemid <= 2048304);
}

Believe it or not I didn't actually have a isBonusPotentialScroll method, I wrote one out based on the code you sent me. :p

Again, thanks so much! I know not many people are very eager to share their work (and for good reason) So it was a real stroke of luck that you came by. I'll post the results once I get everything shiny and compiled!
 
Upvote 0
Newbie Spellweaver
Joined
Jan 29, 2013
Messages
50
Reaction score
3
Believe it or not I didn't actually have a isBonusPotentialScroll method, I wrote one out based on the code you sent me. :p

Again, thanks so much! I know not many people are very eager to share their work (and for good reason) So it was a real stroke of luck that you came by. I'll post the results once I get everything shiny and compiled!

Sure i'll be more then happy to help you with anything else
And make sure to use 2049400 this id to scroll the item.
 
Upvote 0
Junior Spellweaver
Joined
Jul 1, 2008
Messages
138
Reaction score
39
Sure i'll be more then happy to help you with anything else
And make sure to use 2049400 this id to scroll the item.

Sorry for the late response, had to prepare dinner for the family. :)

So I added the boolean in Constants, added USE_BONUS_POTENTIAL in MapleServer Handler and replaced the potential method in MapleItemInformationProvider and tried two things

1) Used the Advanced potential scroll (2049400) which worked, but did what it's supposed to do, providing potential lines without bonus potential.
2) Used one of the ID's provided in that method, which was a bonus potential scroll and it got stuck BUT I did get an error this time.
Code:
Return 3
[UNHANDLED] Recv [USE_BONUS_POTENTIAL] found

I am still very much a novice so it's likely that I missed a step somewhere, I just thought I'd share the progress thus far :)
 
Upvote 0
Joined
Apr 13, 2009
Messages
592
Reaction score
141
Sorry for the late response, had to prepare dinner for the family. :)
Code:
Return 3
[UNHANDLED] Recv [USE_BONUS_POTENTIAL] found

I am still very much a novice so it's likely that I missed a step somewhere, I just thought I'd share the progress thus far :)

Essentially whats happening is your client(or server I forget) is receiving a packet called USE_BONUS_POTENTIAL which is called when the scroll is used. The error you received indicates that the packet isn't handled i.e no function is being called or associated with it.

To fix this you'd have to add a line in your MapleServerHandler.java underneath the function handlePacket. You could probably guess what this method does. The code should look something like

Code:
             case USE_BONUS_POTENTIAL:
             //whatever handler is used to deal with bonus potential scrolls. Probably inventoryhandler
             InventoryHandler.DoBonusPotential(); //DoBonusPotential is probably not the method in your source but it should look like this. 
             break;

Hope that helped.
 
Upvote 0
Junior Spellweaver
Joined
Jul 1, 2008
Messages
138
Reaction score
39
Essentially whats happening is your client(or server I forget) is receiving a packet called USE_BONUS_POTENTIAL which is called when the scroll is used. The error you received indicates that the packet isn't handled i.e no function is being called or associated with it.

To fix this you'd have to add a line in your MapleServerHandler.java underneath the function handlePacket. You could probably guess what this method does. The code should look something like

Code:
             case USE_BONUS_POTENTIAL:
             //whatever handler is used to deal with bonus potential scrolls. Probably inventoryhandler
             InventoryHandler.DoBonusPotential(); //DoBonusPotential is probably not the method in your source but it should look like this. 
             break;

Hope that helped.

Okay, so I discovered a lot from this! So it did help A ton!

Alright, let's see if I can explain what I found in a way that makes sense...

In the beginning, I replaced the Potential method with the one Naor graciously provided and added the isBonusPotentialScroll Boolean to GameConstants, as there wasn't one there to begin with.

Then, Baha sent me down another rabbit hole into the MapleServerHandler, where I had previously hastily added
PHP:
case:USE_BONUS_POTENTIAL
to the inventoryhandler.UseUpgradeScroll call BUT Baha got me thinking to check the actual UseUpgradeScroll boolean AND I FOUND THIS

PHP:
 public static boolean UseUpgradeScroll(final short slot, final short dst, final short ws, final MapleClient c, final MapleCharacter chr, final int vegas, final boolean legendarySpirit) {
        boolean whiteScroll = false; // white scroll being used?
        final MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
        chr.setScrolledPosition((short) 0);
        if ((ws & 2) == 2) {
            whiteScroll = true;
        }
        Equip toScroll = null;
        if (dst < 0) {
            toScroll = (Equip) chr.getInventory(MapleInventoryType.EQUIPPED).getItem(dst);
        } else /*if (legendarySpirit)*/ {//may want to create a boolean for strengthen ui? lol
            toScroll = (Equip) chr.getInventory(MapleInventoryType.EQUIP).getItem(dst);
        }
//        if (toScroll == null || c.getPlayer().hasBlockedInventory()) {//removed just in case :P
//            c.getSession().write(CWvsContext.enableActions());
//            return false;
//        }
        
        //07 00 F5 FF 01 00 00
        final byte oldLevel = toScroll.getLevel(); //07
        final byte oldEnhance = toScroll.getEnhance(); // 00
        final byte oldState = toScroll.getState(); // F5
        final short oldFlag = toScroll.getFlag(); // FF 01
        final short oldSlots = toScroll.getUpgradeSlots(); // v146+
        

        Item scroll = chr.getInventory(MapleInventoryType.USE).getItem(slot);
        if (scroll == null) {
            scroll = chr.getInventory(MapleInventoryType.CASH).getItem(slot);
            if (scroll == null) {
                c.getSession().write(InventoryPacket.getInventoryFull());
                c.getSession().write(CWvsContext.enableActions());
                return false;
            }
        }
        if (scroll.getItemId() == 5064200) { //TODO: test this
            Item item = chr.getInventory(MapleInventoryType.EQUIPPED).getItem(toScroll.getPosition());
            Equip equip = (Equip) item;
            int itemid = toScroll.getItemId();
            int potential1 = equip.getPotential1();
            int potential2 = equip.getPotential2();
            int potential3 = equip.getPotential3();
            int bonuspotential1 = equip.getBonusPotential1();
            int bonuspotential2 = equip.getBonusPotential2();
            short position = toScroll.getPosition();
            chr.getInventory(MapleInventoryType.EQUIPPED).removeItem(toScroll.getPosition());
            Equip neweq = (Equip) ii.getEquipById(itemid);
            neweq.setPotential1(potential1);
            neweq.setPotential2(potential2);
            neweq.setPotential3(potential3);
            neweq.setBonusPotential1(bonuspotential1);
            neweq.setBonusPotential2(bonuspotential2);
            neweq.setPosition(position);
            MapleInventoryManipulator.addbyItem(c, neweq);
        }
        if (GameConstants.isAzwanScroll(scroll.getItemId())) {
            if (toScroll.getUpgradeSlots() < MapleItemInformationProvider.getInstance().getEquipStats(scroll.getItemId()).get("tuc")) {
                c.getSession().write(InventoryPacket.getInventoryFull());
                c.getSession().write(CWvsContext.enableActions());
                return false;
            }
        }
        if (!GameConstants.isSpecialScroll(scroll.getItemId()) && !GameConstants.isCleanSlate(scroll.getItemId()) && !GameConstants.isEquipScroll(scroll.getItemId()) && !GameConstants.isPotentialScroll(scroll.getItemId())) {
            if (toScroll.getUpgradeSlots() < 1) {
                c.getSession().write(InventoryPacket.getInventoryFull());
                c.getSession().write(CWvsContext.enableActions());
                return false;
            }
        } else if (GameConstants.isEquipScroll(scroll.getItemId())) {
            if (toScroll.getUpgradeSlots() >= 1 || toScroll.getEnhance() >= 100 || vegas > 0 || ii.isCash(toScroll.getItemId())) {
                c.getSession().write(InventoryPacket.getInventoryFull());
                c.getSession().write(CWvsContext.enableActions());
                return false;
            }
        } else if (GameConstants.isPotentialScroll(scroll.getItemId())) {
            final boolean isEpic = scroll.getItemId() / 100 == 20497 && scroll.getItemId() < 2049750;
            final boolean isUnique = scroll.getItemId() / 100 == 20497 && scroll.getItemId() >= 2049750;
            if ((!isEpic && !isUnique && toScroll.getState() >= 1) || (isEpic && toScroll.getState() >= 18) || (isUnique && toScroll.getState() >= 19) || (toScroll.getLevel() == 0 && toScroll.getUpgradeSlots() == 0 && toScroll.getItemId() / 10000 != 135/* && !isEpic && !isUnique*/) || vegas > 0 || ii.isCash(toScroll.getItemId())) {
                c.getSession().write(InventoryPacket.getInventoryFull());
                c.getSession().write(CWvsContext.enableActions());
                return false;
            }
        } else if (GameConstants.isSpecialScroll(scroll.getItemId())) {
            if (ii.isCash(toScroll.getItemId()) || toScroll.getEnhance() >= 12) {
                c.getSession().write(InventoryPacket.getInventoryFull());
                c.getSession().write(CWvsContext.enableActions());
                return false;
            }
        }
        if (!GameConstants.canScroll(toScroll.getItemId()) && !GameConstants.isChaosScroll(toScroll.getItemId())) {
            c.getSession().write(InventoryPacket.getInventoryFull());
            c.getSession().write(CWvsContext.enableActions());
            return false;
        }
        if ((GameConstants.isCleanSlate(scroll.getItemId()) || GameConstants.isTablet(scroll.getItemId()) || GameConstants.isGeneralScroll(scroll.getItemId()) || GameConstants.isChaosScroll(scroll.getItemId())) && (vegas > 0 || ii.isCash(toScroll.getItemId()))) {
            c.getSession().write(InventoryPacket.getInventoryFull());
            c.getSession().write(CWvsContext.enableActions());
            return false;
        }
        if (GameConstants.isTablet(scroll.getItemId()) && toScroll.getDurability() < 0) { //not a durability item
            c.getSession().write(InventoryPacket.getInventoryFull());
            c.getSession().write(CWvsContext.enableActions());
            return false;
        } else if ((!GameConstants.isTablet(scroll.getItemId()) && !GameConstants.isPotentialScroll(scroll.getItemId()) && !GameConstants.isEquipScroll(scroll.getItemId()) && !GameConstants.isCleanSlate(scroll.getItemId()) && !GameConstants.isSpecialScroll(scroll.getItemId()) && !GameConstants.isChaosScroll(scroll.getItemId())) && toScroll.getDurability() >= 0) {
            c.getSession().write(InventoryPacket.getInventoryFull());
            c.getSession().write(CWvsContext.enableActions());
            return false;
        }
        Item wscroll = null;

        // Anti cheat and validation
        List<Integer> scrollReqs = ii.getScrollReqs(scroll.getItemId());
        if (scrollReqs != null && scrollReqs.size() > 0 && !scrollReqs.contains(toScroll.getItemId())) {
            c.getSession().write(InventoryPacket.getInventoryFull());
            c.getSession().write(CWvsContext.enableActions());
            return false;
        }

        if (whiteScroll) {
            wscroll = chr.getInventory(MapleInventoryType.USE).findById(2340000);
            if (wscroll == null) {
                whiteScroll = false;
            }
        }
        if (GameConstants.isTablet(scroll.getItemId()) || GameConstants.isGeneralScroll(scroll.getItemId())) {
            switch (scroll.getItemId() % 1000 / 100) {
                case 0: //1h
                    if (GameConstants.isTwoHanded(toScroll.getItemId()) || !GameConstants.isWeapon(toScroll.getItemId())) {
                        c.getSession().write(CWvsContext.enableActions());
                        return false;
                    }
                    break;
                case 1: //2h
                    if (!GameConstants.isTwoHanded(toScroll.getItemId()) || !GameConstants.isWeapon(toScroll.getItemId())) {
                        c.getSession().write(CWvsContext.enableActions());
                        return false;
                    }
                    break;
                case 2: //armor
                    if (GameConstants.isAccessory(toScroll.getItemId()) || GameConstants.isWeapon(toScroll.getItemId())) {
                        c.getSession().write(CWvsContext.enableActions());
                        return false;
                    }
                    break;
                case 3: //accessory
                    if (!GameConstants.isAccessory(toScroll.getItemId()) || GameConstants.isWeapon(toScroll.getItemId())) {
                        c.getSession().write(CWvsContext.enableActions());
                        return false;
                    }
                    break;
            }
        } else if (!GameConstants.isAccessoryScroll(scroll.getItemId()) && !GameConstants.isChaosScroll(scroll.getItemId()) && !GameConstants.isCleanSlate(scroll.getItemId()) && !GameConstants.isEquipScroll(scroll.getItemId()) && !GameConstants.isPotentialScroll(scroll.getItemId()) && !GameConstants.isSpecialScroll(scroll.getItemId())) {
            if (!ii.canScroll(scroll.getItemId(), toScroll.getItemId())) {
                c.getSession().write(CWvsContext.enableActions());
                return false;
            }
        }
        if (GameConstants.isAccessoryScroll(scroll.getItemId()) && !GameConstants.isAccessory(toScroll.getItemId())) {
            c.getSession().write(CWvsContext.enableActions());
            return false;
        }
        if (scroll.getQuantity() <= 0) {
            c.getSession().write(CWvsContext.enableActions());
            return false;
        }

        if (legendarySpirit && vegas == 0) {
            if (chr.getSkillLevel(SkillFactory.getSkill(PlayerStats.getSkillByJob(1003, chr.getJob()))) <= 0) {
                c.getSession().write(CWvsContext.enableActions());
                return false;
            }
        }

        // Scroll Success/ Failure/ Curse
        Equip scrolled = (Equip) ii.scrollEquipWithId(toScroll, scroll, whiteScroll, chr, vegas);
        ScrollResult scrollSuccess;
        if (scrolled == null) {
            if (ItemFlag.SHIELD_WARD.check(oldFlag)) {
                scrolled = toScroll;
                scrollSuccess = Equip.ScrollResult.FAIL;
                scrolled.setFlag((short) (oldFlag - ItemFlag.SHIELD_WARD.getValue()));
            } else {
                scrollSuccess = Equip.ScrollResult.CURSE;
            }
        } else if ((scroll.getItemId() / 100 == 20497 && scrolled.getState() == 1) || scrolled.getLevel() > oldLevel || scrolled.getEnhance() > oldEnhance || scrolled.getState() > oldState || scrolled.getFlag() > oldFlag) {
            scrollSuccess = Equip.ScrollResult.SUCCESS;
        } else if ((GameConstants.isCleanSlate(scroll.getItemId()) && scrolled.getUpgradeSlots() > oldSlots)) {
            scrollSuccess = Equip.ScrollResult.SUCCESS;
        } else if (c.getPlayer().isGM()) {
            scrollSuccess = Equip.ScrollResult.SUCCESS;
        } else {
            scrollSuccess = Equip.ScrollResult.FAIL;
        }
        // Update
        chr.getInventory(GameConstants.getInventoryType(scroll.getItemId())).removeItem(scroll.getPosition(), (short) 1, false);
        if (whiteScroll) {
            MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.USE, wscroll.getPosition(), (short) 1, false, false);
        } else if (scrollSuccess == Equip.ScrollResult.FAIL && scrolled.getUpgradeSlots() < oldSlots && c.getPlayer().getInventory(MapleInventoryType.CASH).findById(5640000) != null) {
            chr.setScrolledPosition(scrolled.getPosition());
            if (vegas == 0) {
                c.getSession().write(CWvsContext.pamSongUI());
            }
        }

        if (scrollSuccess == Equip.ScrollResult.CURSE) {
            c.getSession().write(InventoryPacket.scrolledItem(scroll, MapleInventoryType.EQUIP, toScroll, true, false, false));
            if (dst < 0) {
                chr.getInventory(MapleInventoryType.EQUIPPED).removeItem(toScroll.getPosition());
            } else {
                chr.getInventory(MapleInventoryType.EQUIP).removeItem(toScroll.getPosition());
            }
        } else if (vegas == 0) {
            c.getSession().write(InventoryPacket.scrolledItem(scroll, MapleInventoryType.EQUIP, scrolled, false, false, false));
        }

        chr.getMap().broadcastMessage(chr, CField.getScrollEffect(c.getPlayer().getId(), scrollSuccess, legendarySpirit, toScroll.getItemId(), scroll.getItemId()), vegas == 0);
        //toscroll
        //scroll
        c.getSession().write(CField.enchantResult(scrollSuccess == ScrollResult.SUCCESS ? 1 : scrollSuccess == ScrollResult.CURSE ? 2 : 0));
        //addToScrollLog(chr.getAccountID(), chr.getId(), scroll.getItemId(), itemID, oldSlots, (byte)(scrolled == null ? -1 : scrolled.getUpgradeSlots()), oldVH, scrollSuccess.name(), whiteScroll, legendarySpirit, vegas);
        // equipped item was scrolled and changed
        if (dst < 0 && (scrollSuccess == Equip.ScrollResult.SUCCESS || scrollSuccess == Equip.ScrollResult.CURSE) && vegas == 0) {
            chr.equipChanged();
        }
        return true;
    }

If you Ctrl+f
Code:
 (GameConstants.isPotentialScrol
You'll see the regular potential method, but as Baha suspected, IsBonusPotentialScroll is unhandled. Zip, zilch, zero! No where to be found.

I don't want to be a pest again, but would someone mind showing an example of how I would create the method? I think I might be able edit the ID's around in IsPotentialScroll to make a isBonusPotentialScroll but there are some parts in there that I don't quite understand what they do.

This has been fun though, I'm starting to learn where thing A is and how thing B and thing C need to be connected so that Thing A works. It's kinda neat. I've saved lots of notes.
 
Upvote 0
Joined
Apr 13, 2009
Messages
592
Reaction score
141
edit : Naor provided you with
Code:
public static boolean isBonusPotentialScroll(int itemid) {
return itemid / 100 == 20483 && !(itemid >= 2048200 && itemid <= 2048304);
}

basically the code is just returning a true or false to see if the item is a bonus pot scroll or not.

here's some extra information if you want to learn more.

I believe you need to read the actual packet structure for USE_BONUS_POTENTIAL.
The reason is simply because the packet will look something like

Code:
[A3 03] [EE 03 ED AD] 2E 2A 3F 0D 23 12 23 AS 23 E1 F3 23 3D //ARBITRARY EXAMPLE
.

Now, when you create the method, the packet above would tell you information like what item you are adding potential too, the slot number, etc...

This is why if you look at most handler methods, the parameters are usually like

Code:
public void useBonusPotential(final LittleEndianAccessor slea, final MapleClient c) //again arbitrary example

MapleClient c is the actual character object that's sending the packet. This is very important as you can grab almost all the character information using this object.

LittleEndianAccessor slea can be used to read data types like ints,shorts,longs in the packet(VERY important)! You can assign variables to these bytes so you can gather the information that you need.

For example, in the arbitrary packet I provided, lets say the first the first two bytes correspond to the equip slot. Then you could say like

Code:
 c.getPlayer().setScrolledPosition((short) 0); <- we say short b/c lets assume the first two bytes are the slot position

Now lets say the next 4 bytes are the item ID, then we can assign an integer to the slea object

Code:
final int itemId = slea.readInt();

^Now we can use itemId variable to call other functions like finding the the actual item in the player inventory, or creating an equip object to call functions like renewpotential.

Essentially you need to rebuild the packet with "arbitrary" parameters for ANY item(of course there may be exceptions with special items).
 
Last edited:
Upvote 0
Junior Spellweaver
Joined
Jul 1, 2008
Messages
138
Reaction score
39
I looks like I have a whole heck of a lot of reading to do! I can look at a Method and slowly figure out what it does and why, but I've never done a whole lot of study or worked with packets before! I do see what you mean with the parameters though, just looking through MapleServerHandler it sticks out
Code:
c.getPlayer().updateTick(slea.readInt());
                InventoryHandler.UseUpgradeScroll(slea.readShort(), slea.readShort(), (short) 0, c, c.getPlayer(), slea.readByte() > 0);
                break;
I'm not sure if it's the correct packet. But this seems to be related based on what I'm seeing in the console
Code:
06 02 44 00 00 00 00 E1 F5 05 03 0C 00 00 4E 01 00 00
 
Upvote 0
Newbie Spellweaver
Joined
Jan 29, 2013
Messages
50
Reaction score
3
What is the RecvP you are using for the BPOT Scrolls?

And why dont you try to replace the one i gave you with this one let me know again if you use
the same id i gave you

Code:
 else if (GameConstants.isPotentialScroll(scrollId.getItemId())) {
                            if (nEquip.getState() <= 17 && (scrollId.getItemId() / 100 == 20497)) {
                                final int chanc = (scrollId.getItemId() == 2049701 ? 80 : 100) + added; // 2049701
                                if (Randomizer.nextInt(100) > chanc) {
                                    return null; //destroyed, nib
                                }
                                nEquip.renewPotential(2, 0, (short) 0, false);
                                nEquip.renewPotential(2, 0, (short) 0, true);
                            } else if (nEquip.getState() == 0) {
                                final int chanc = (scrollId.getItemId() == 5534000 || scrollId.getItemId() == 2049402 || scrollId.getItemId() == 2049406 ? 100 : scrollId.getItemId() == 2049701 ? 80 : (scrollId.getItemId() == 2049400 || scrollId.getItemId() == 2049407 || scrollId.getItemId() == 2049413 ? 90 : 70)) + added;
                                if (Randomizer.nextInt(100) > chanc) {
                                    return null; //destroyed, nib
                                }
                                nEquip.resetPotential();
                            }
                            break;
 
Last edited:
Upvote 0
Junior Spellweaver
Joined
Jul 1, 2008
Messages
138
Reaction score
39
What is the RecvP you are using for the BPOT Scrolls?

And why dont you try to replace the one i gave you with this one let me know again if you use
the same id i gave you

-snip-

I replaced the code, compiled and restarted the server but it still works as intended, 2 lines of regular potential.

my USE_BONUS_POTENTIAL RecvOp is 0xC8 :)
 
Last edited:
Upvote 0
Back
Top