This is a tutorial for MScale for the AS3 27.7.X2 client because somebody needed help.
Credits:
nilly
1. Go to Gamesprite.as and Find public function connect():void and replace with
Code:
public function connect():void
{
if (!this.isGameStarted)
{
this.isGameStarted = true;
Renderer.inGame = true;
gsc_.connect();
thi*****leWatcher_.start(this);
lastUpdate_ = getTimer();
stage.addEventListener(MoneyChangedEvent.MONEY_CHANGED, this.onMoneyChanged);
stage.addEventListener(Event.ENTER_FRAME, this.onEnterFrame);
this.parent.parent.setChildIndex((this.parent.parent as Layers).top, 0);
if (Parameters.data_.mscale == undefined)
{
Parameters.data_.mscale = "1.0";
Parameters.save();
};
if (Parameters.data_.stageScale == undefined)
{
Parameters.data_.stageScale = StageScaleMode.NO_SCALE;
Parameters.save();
};
if (Parameters.data_.uiscale == undefined)
{
Parameters.data_.uiscale = true;
Parameters.save();
};
stage.scaleMode = Parameters.data_.stageScale;
stage.addEventListener(Event.RESIZE, this.onScreenResize);
stage.dispatchEvent(new Event(Event.RESIZE));
LoopedProcess.addProcess(new LoopedCallback(100, this.updateNearestInteractive));
};
}
2. Go to Camera.as and find public function correctViewingArea(_arg_1:Boolean):Rectangle and replace with
Code:
public function correctViewingArea(_arg_1:Boolean):Rectangle
{
var _local_2:Number;
var _local_3:Number;
var _local_4:Number;
var _local_5:Number;
if (Parameters.data_.stageScale == StageScaleMode.NO_SCALE)
{
_local_2 = Parameters.data_.mscale;
_local_3 = (WebMain.sWidth / _local_2);
_local_4 = (WebMain.sHeight / _local_2);
_local_5 = ((Parameters.data_.uiscale) ? (((200 * WebMain.sHeight) / 600) / _local_2) : (200 / _local_2));
if (_arg_1)
{
return (new Rectangle(-((_local_3 - _local_5) / 2), -((_local_4 * 13) / 24), _local_3, _local_4));
};
return (new Rectangle(-((_local_3 - _local_5) / 2), -((_local_4 * 3) / 4), _local_3, _local_4));
};
if (_arg_1)
{
return (new Rectangle(-300, -325, 600, 600));
};
return (new Rectangle(-300, -450, 600, 600));
}
3. Go to Map.as and find public function correctMapView(_arg_1:Camera):Point and replace with
Code:
public function correctMapView(_arg_1:Camera):Point
{
var _local_2:Rectangle = _arg_1.clipRect_;
if (stage.scaleMode == StageScaleMode.NO_SCALE)
{
x = ((-(_local_2.x) * 800) / (WebMain.sWidth / Parameters.data_.mscale));
y = ((-(_local_2.y) * 600) / (WebMain.sHeight / Parameters.data_.mscale));
}
else
{
x = -(_local_2.x);
y = -(_local_2.y);
};
var _local_3:Number = ((-(_local_2.x) - (_local_2.width / 2)) / 50);
var _local_4:Number = ((-(_local_2.y) - (_local_2.height / 2)) / 50);
var _local_5:Number = Math.sqrt(((_local_3 * _local_3) + (_local_4 * _local_4)));
var _local_6:Number = ((_arg_1.angleRad_ - (Math.PI / 2)) - Math.atan2(_local_3, _local_4));
return (new Point((_arg_1.x_ + (_local_5 * Math.cos(_local_6))), (_arg_1.y_ + (_local_5 * Math.sin(_local_6)))));
}
4. Go to GameObjectArrow and add this or replace the old correctQuestNote
Code:
public function correctQuestNote(_arg_1:Rectangle):Rectangle
{
var _local_2:Rectangle = _arg_1.clone();
if (stage.scaleMode == StageScaleMode.NO_SCALE)
{
if (Parameters.data_.uiscale)
{
this.scaleY = (this.scaleX = ((((stage.stageWidth < stage.stageHeight) ? stage.stageWidth : stage.stageHeight) / Parameters.data_["mscale"]) / 600));
}
else
{
this.scaleX = 1;
this.scaleY = 1;
};
_local_2.right = (_local_2.right - ((((800 - this.go_.map_.gs_.hudView.x) * stage.stageWidth) / Parameters.data_.mscale) / 800));
}
else
{
this.scaleX = (this.scaleY = 1);
};
return (_local_2);
}
5. Go to ParseChatMessageCommand and add
Code:
if (_arg_1 == "/mscale")
{
this.addTextLine.dispatch(ChatMessage.make(Parameters.HELP_CHAT_NAME, (("Map Scale: " + Parameters.data_.mscale) + " - Usage: /mscale <any decimal number>.")));
return (true);
};
var _local_3:Array = _arg_1.match("/mscale (\\d*\\.*\\d+)$");
if (_local_3 != null)
{
Parameters.data_["mscale"] = _local_3[1];
Parameters.save();
_local_2.dispatchEvent(new Event(Event.RESIZE));
this.addTextLine.dispatch(ChatMessage.make(Parameters.HELP_CHAT_NAME, ("Map Scale: " + _local_3[1])));
return (true);
};
and your done. I might have forgot a couple of steps but I'll fix it. Make sure to leave a thanks!
