MoopleDev v83 Town Scroll Fix

Results 1 to 1 of 1
  1. #1
    Valued Member KayVan is offline
    MemberRank
    May 2013 Join Date
    126Posts

    MoopleDev v83 Town Scroll Fix

    I've spent a few hours looking why Town Scrolls aren't working and yet Return to Nearest Town scroll works. After my investigations, I found out that there was something wrong with the code under Source > src > server > MapleStatEffect.java and look for this code.

    Code:
    if (moveTo != -1) {            if (applyto.getMap().getReturnMapId() != applyto.getMapId()) {
                    MapleMap target;
                    if (moveTo == 999999999) {
                        target = applyto.getMap().getReturnMap();
                    } else {
                        target = applyto.getClient().getWorldServer().getChannel(applyto.getClient().getChannel()).getMapFactory().getMap(moveTo);
                        int targetid = target.getId() / 10000000;
                        if (targetid != 60 && applyto.getMapId() / 10000000 != 61 && targetid != applyto.getMapId() / 10000000 && targetid != 21 && targetid != 20) {
                            return false;
                        }
                    }
                    applyto.changeMap(target);
                } else {
                    return false;
                }
    
    
            }
    The issue with the code was
    Code:
    if (applyto.getMap().getReturnMapId() != applyto.getMapId()) {
    "applyto.getMap().getReturnMapId()" & "applyto.getMapId()" always returns the map where the player is located at. For example, if the player who use the scroll is at Henesys (Map ID: 100000000), both of them will return 100000000. Anyways, here's the fix, replace it with the following code and it should be working.

    Code:
    if (moveTo != -1) {            if (moveTo != applyto.getMapId()) {
                    MapleMap target;
                    if (moveTo == 999999999) {
                        target = applyto.getMap().getReturnMap();
                    } else {
                        target = applyto.getClient().getWorldServer().getChannel(applyto.getClient().getChannel()).getMapFactory().getMap(moveTo);
                        int targetid = target.getId() / 10000000;
                        if (targetid != 10 && targetid != 60 && applyto.getMapId() / 10000000 != 61 && targetid != applyto.getMapId() / 10000000 && targetid != 21 && targetid != 20) {
                            return false;
                        }
                    }
                    applyto.changeMap(target);
                } else {
                    return false;
                }
            }
    All the maps that I've tested are working so if you find any bugs, tell me so I could investigate further!




Advertisement