[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:
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:
(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:
4.Go to com->company->assembleegameclient->map->Map.as
search for a function called draw and replace the whole function with this:
5.Below the draw function we just replaced. Put this:
that's it, rebuild client and your command should be working properly
ofc the credits:
NR team, I think
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);
}
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);
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; }
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); }
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);
}
ofc the credits:
NR team, I think

