[NR-Core] Map Scale command

Posts 1–13 of 13 · Page 1 of 1
[NR-Core] Map Scale command
Someone wanted to add this to his nr server and so I'm doing this besides why not.

Requirements:
-NR-27.7.X13 Client.
-IntelliJ IDEA (I don't really know what version you should use, but I'm using 2016 Ultimate).
-A server to test the command.


1. First we open up the project with IntelliJ IDEA and go to: kabam->rotmg->chat->control->ParseChatMessageCommand.as
now, replace the function "execute" with this:
Code:
public function execute():void {
    if(this.data.charAt(0) == "/") {
        var command:Array = this.data.substr(1, this.data.length).split(" ");
        switch (command[0]) {
            case "help":
                this.addTextLine.dispatch(ChatMessage.make(Parameters.HELP_CHAT_NAME, TextKey.HELP_COMMAND));
                return;
            case "mscale":
                if(command.length > 1) {
                    var mscale:Number = Number(command[1]);
                    if(mscale)
                        Parameters.data_.mscale = mscale;
                    Parameters.save();
                }
                this.addTextLine.dispatch(ChatMessage.make(Parameters.HELP_CHAT_NAME, "Map Scale: " + Parameters.data_.mscale));
                return;

        }
    }
    this.hudModel.gameSprite.gsc_.playerText(this.data);
}
we can add some limits to the command but since I don't care you will do it yourself. And it's not really important.

2.Now, we go to com->company
->assembleegameclient->parameters->Parameters.as

and just so you don't mess it up, we search for "HPBar"(not toggleHpBar) and we write this:
Code:
setDefault("fullscreenMod", true);
setDefault("mscale", 12);
(the number after "mscale" is the scale we want, 12 is the normal rotmg scale, but wait, we're not done yet)

3.After that, we go to com->company->assembleegameclient->map->Camera.as

search for configureCamera function, once you find it replace the whole function with this:
Code:
public function configureCamera(_arg1:GameObject, _arg2:Boolean):void {
    var playerRect:Rectangle = ((Parameters.data_.centerOnPlayer) ? CENTER_SCREEN_RECT : OFFSET_SCREEN_RECT);
    var clipRect:Rectangle = playerRect.clone();
    if(Parameters.data_.fullscreenMod) {
       clipRect.x = -(Parameters.data_.mscale * 50 * (1 / 2));
       clipRect.y = -(Parameters.data_.mscale * 50 * (clipRect.y / -600));
       clipRect.width = Parameters.data_.mscale * 50;
       clipRect.height = Parameters.data_.mscale * 50;
    }
    if (Parameters.screenShotMode_) {
        if (!Parameters.screenShotSlimMode_) {
            clipRect = SCREENSHOT_SCREEN_RECT;
        }
        else {
            clipRect = SLIM_SCREENSHOT_SCREEN_RECT;
        }
    }
    var _local4:Number = Parameters.data_.cameraAngle;
    this.configure(_arg1.x_, _arg1.y_, 12, _local4, clipRect);
    this.isHallucinating_ = _arg2;
}
4.Go to com->company->assembleegameclient->map->Map.as

search for a function called draw and replace the whole function with this:
Code:
override public function draw(camera:Camera, currentTime:int):void {
    if (wasLastFrameGpu != Parameters.isGpuRender()) {
        var context:Context3D = WebMain.STAGE.stage3Ds[0].context3D;
        if (wasLastFrameGpu == true && context != null &&
                context.driverInfo.toLowerCase().indexOf("disposed") == -1) {
            context.clear();
            context.present();
        }
        else {
            map_.graphics.clear();
        }
        signalRenderSwitch.dispatch(wasLastFrameGpu);
        wasLastFrameGpu = Parameters.isGpuRender();
    }

    var rect:Rectangle = camera.clipRect_;
    if(Parameters.data_.fullscreenMod) {
        this.scaleX = 600 / (Parameters.data_.mscale * 50);
        this.scaleY = 600 / (Parameters.data_.mscale * 50);
        x = (-rect.x * 600) / (Parameters.data_.mscale * 50);
        y = (-rect.y * 600) / (Parameters.data_.mscale * 50);
    }
    else {
        this.scaleX = 1;
        this.scaleY = 1;
        x = -rect.x;
        y = -rect.y;
    }

    var sy:Number = (-rect.y - rect.height / 2) / 50;
    var plrPos:Point = new Point(
            camera.x_ + sy * Math.cos(camera.angleRad_ - Math.PI / 2),
            camera.y_ + sy * Math.sin(camera.angleRad_ - Math.PI / 2));

    if (background_ != null) {
        background_.draw(camera, currentTime);
    }

    this.visible_.length = 0;
    this.visibleUnder_.length = 0;
    this.visibleSquares_.length = 0;
    this.visibleHit_.length = 0;
    this.topSquares_.length = 0;

    var distMax:int = camera.maxDist_;
    var xMin:int = Math.max(0, plrPos.x - distMax);
    var xMax:int = Math.min(width_ - 1, plrPos.x + distMax);
    var yMin:int = Math.max(0, plrPos.y - distMax);
    var yMax:int = Math.min(height_ - 1, plrPos.y + distMax);

    this.graphicsData_.length = 0;
    this.graphicsDataStageSoftware_.length = 0;
    this.graphicsData3d_.length = 0;

    // visible tiles
var sqr:Square;
    for (var i:int = xMin; i <= xMax; i++) {
        for (var j:int = yMin; j <= yMax; j++) {
            sqr = squares_[i + j * width_];
            if (sqr != null) {
                var dx:Number = plrPos.x - sqr.center_.x;
                var dy:Number = plrPos.y - sqr.center_.y;
                var sqrDist:Number = dx * dx + dy * dy;
                if (sqrDist <= camera.maxDistSq_) {
                    sqr.lastVisible_ = currentTime;
                    sqr.draw(this.graphicsData_, camera, currentTime);
                    this.visibleSquares_.push(sqr);
                    if (sqr.topFace_ != null) {
                        this.topSquares_.push(sqr);
                    }
                }
            }
        }
    }

    // visible game objects
for each (var go:GameObject in goDict_) {
        go.drawn_ = false;
        if (go.dead_) {
            continue;
        }
        sqr = go.square_;
        if (sqr != null && sqr.lastVisible_ == currentTime) {
            go.drawn_ = true;
            go.computeSortVal(camera);
            if (!(go is ParticleEffect)) {
                this.visibleHit_.push(go);
            }
            if (go.props_.drawUnder_) {
                if (go.props_.drawOnGround_) {
                    go.draw(this.graphicsData_, camera, currentTime);
                }
                this.visibleUnder_.push(go);
            }
            else {
                this.visible_.push(go);
            }
        }
    }

    // visible basic objesetDefault("fullscreenMod", true);cts (projectiles, particles and such)
for each (var bo:BasicObject in boDict_) {
        bo.drawn_ = false;
        sqr = bo.square_;
        if (sqr != null && sqr.lastVisible_ == currentTime) {
            bo.drawn_ = true;
            bo.computeSortVal(camera);
            this.visible_.push(bo);
        }
    }

    // draw visible under
if (this.visibleUnder_.length > 0) {
        this.visibleUnder_.sortOn(VISIBLE_SORT_FIELDS, VISIBLE_SORT_PARAMS);
        for each (bo in this.visibleUnder_) {
            if (bo is GameObject && (bo as GameObject).props_.drawOnGround_) {
                continue;
            }
            bo.draw(this.graphicsData_, camera, currentTime);
        }
    }

    // draw shadows
this.visible_.sortOn(VISIBLE_SORT_FIELDS, VISIBLE_SORT_PARAMS);
    if (Parameters.data_.drawShadows) {
        for each (bo in this.visible_) {
            if (bo.hasShadow_) {
                bo.drawShadow(this.graphicsData_, camera, currentTime);
            }
        }
    }

    // draw visible
for each (bo in this.visible_) {
        bo.draw(this.graphicsData_, camera, currentTime);
        if (Parameters.isGpuRender()) {
            bo.draw3d(this.graphicsData3d_);
        }
    }

    // draw top squares
if (this.topSquares_.length > 0) {
        for each (sqr in this.topSquares_) {
            sqr.drawTop(this.graphicsData_, camera, currentTime);
        }
    }

    // draw hw capable screen filters
if (Parameters.isGpuRender() && Renderer.inGame) {
        var fIndex:uint = this.getFilterIndex();
        var r3d:Render3D = StaticInjectorContext.getInjector().getInstance(Render3D);
        r3d.dispatch(this.graphicsData_, this.graphicsData3d_, width_, height_, camera, fIndex);
        for (var i:int = 0; i < this.graphicsData_.length; i++) {
            if (this.graphicsData_[i] is GraphicsBitmapFill && GraphicsFillExtra.isSoftwareDraw(GraphicsBitmapFill(this.graphicsData_[i]))) {
                this.graphicsDataStageSoftware_.push(this.graphicsData_[i]);
                this.graphicsDataStageSoftware_.push(this.graphicsData_[i + 1]);
                this.graphicsDataStageSoftware_.push(this.graphicsData_[i + 2]);
            }
            else {
                if (this.graphicsData_[i] is GraphicsSolidFill && GraphicsFillExtra.isSoftwareDrawSolid(GraphicsSolidFill(this.graphicsData_[i]))) {
                    this.graphicsDataStageSoftware_.push(this.graphicsData_[i]);
                    this.graphicsDataStageSoftware_.push(this.graphicsData_[i + 1]);
                    this.graphicsDataStageSoftware_.push(this.graphicsData_[i + 2]);
                }
            }
        }
        if (this.graphicsDataStageSoftware_.length > 0) {
            map_.graphics.clear();
            map_.graphics.drawGraphicsData(this.graphicsDataStageSoftware_);
            if (this.lastSoftwareClear) {
                this.lastSoftwareClear = false;
            }
        }
        else {
            if (!this.lastSoftwareClear) {
                map_.graphics.clear();
                this.lastSoftwareClear = true;
            }
        }
        if ((currentTime % 149) == 0) {
            GraphicsFillExtra.manageSize();
        }
    }
    else {
        map_.graphics.clear();
        map_.graphics.drawGraphicsData(this.graphicsData_);
    }

    // draw filters
map_.filters.length = 0;
    if (player_ != null && (player_.condition_[ConditionEffect.CE_FIRST_BATCH] & ConditionEffect.MAP_FILTER_BITMASK) != 0) {
        var filters:Array = [];
        if (player_.isDrunk()) {
            var blur:Number = 20 + 10 * Math.sin(currentTime / 1000);
            filters.push(new BlurFilter(blur, blur));
        }
        if (player_.isBlind()) {
            filters.push(BLIND_FILTER);
        }
        map_.filters = filters;
    }
    else {
        if (map_.filters.length > 0) {
            map_.filters = [];
        }
    }

    mapOverlay_.draw(camera, currentTime);
    partyOverlay_.draw(camera, currentTime);
}
5.Below the draw function we just replaced. Put this:
Code:
private function getFilterIndex():uint {
    var _local1:uint;
    if (((!((player_ == null))) && (!(((player_.condition_[ConditionEffect.CE_FIRST_BATCH] & ConditionEffect.MAP_FILTER_BITMASK) == 0))))) {
        if (player_.isPaused()) {
            _local1 = Renderer.STAGE3D_FILTER_PAUSE;
        }
        else {
            if (player_.isBlind()) {
                _local1 = Renderer.STAGE3D_FILTER_BLIND;
            }
            else {
                if (player_.isDrunk()) {
                    _local1 = Renderer.STAGE3D_FILTER_DRUNK;
                }
            }
        }
    }
    return (_local1);
}
that's it, rebuild client and your command should be working properly

ofc the credits:
NR team, I think
noo why u do dis.
Quote Originally Posted by SeXZeFPS View Post
noo why u do dis.
what's wrong with it
Quote Originally Posted by Zolmex View Post
what's wrong with it
Why release
Quote Originally Posted by SeXZeFPS View Post
Why release
I know what you mean, but this is not a release, it's just how to implement it on your server. Still, it's not so uncommon to see pservers with this
Quote Originally Posted by SeXZeFPS View Post
noo why u do dis.
If you check his location, it says hes bored in hell(aka hes so bored that he made dis)
Quote Originally Posted by robloxmaster123 View Post
If you check his location, it says hes bored in hell(aka hes so bored that he made dis)
im pretty sure this is somewhere in the NR client github

and why is default mscale 12 not 1
Quote Originally Posted by RHGAErghaerghaerhgerh View Post
im pretty sure this is somewhere in the NR client github

and why is default mscale 12 not 1
Cause if the mscale is set to 1 it will be super zoomed in and 12 is to fix the screen scale.
Quote Originally Posted by RHGAErghaerghaerhgerh View Post
im pretty sure this is somewhere in the NR client github

and why is default mscale 12 not 1
the client they made for source release is a different client from the one in the server, I took this from a nr client that GhostMaree had in his git hub.
Quote Originally Posted by ManCake View Post
Cause if the mscale is set to 1 it will be super zoomed in and 12 is to fix the screen scale.
i thought the default mscale command is 0.5-5
Ofc u can download fullscreen client if u want from nilly's github
Request for master zolmex: Please create another feature called a shield (not the knight ability). A shield can last for a certain duration and can absorb a certain amount of damage.
Quote Originally Posted by robloxmaster123 View Post
Request for master zolmex: Please create another feature called a shield (not the knight ability). A shield can last for a certain duration and can absorb a certain amount of damage.
He wont do that for you lmao, and also that's a copy of votr.
Posts 1–13 of 13 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us