Brought up to date with the private repository (feea4c7)

This commit is contained in:
S committed 2026-10-14 20:57:33 +03:00
1 parent 1aa738d692
commit 1b1df1ae48
7925 files changed
+2617237 -20

No files matched your search

File diff suppressed because it is too large. Load diff
@@ -0,0 +1,36 @@
package quest
{
import flash.events.Event;
public class QuestEvent extends Event
{
public static const LOAD_SFX:String = "QuestEventLoadSfx";
public static const PLAY_SFX:String = "QuestEventPlaySfx";
private var _secondaryType:String;
public function QuestEvent(param1:String, param2:String = "")
{
super(param1,true,false);
this._secondaryType = param2;
}
override public function clone() : Event
{
return new QuestEvent(type);
}
override public function toString() : String
{
return formatToString("QuestEvent",type,this._secondaryType);
}
public function get secondaryType() : String
{
return this._secondaryType;
}
}
}
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,247 @@
package quest
{
import avatar.AvatarManager;
import avatar.AvatarView;
import avatar.AvatarWorldView;
import com.sbi.graphics.PaletteHelper;
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.geom.Point;
import item.ItemXtCommManager;
import loader.MediaHelper;
public class QuestMelee extends Sprite
{
private var _weaponItem:Object;
private var _npc:QuestActor;
private var _mediaHelperObj:MediaHelper;
private var _swipeMC:MovieClip;
private var _localPlayerLaunched:Boolean;
private var _angle:Number;
private var _timer:Number;
private var _meleeID:int;
private var _players:Array;
private var _color:uint;
public function QuestMelee(param1:int)
{
super();
this._meleeID = param1;
}
public function get angle() : Number
{
return this._angle;
}
public function destroy() : void
{
if(this._mediaHelperObj != null)
{
this._mediaHelperObj.destroy();
this._mediaHelperObj = null;
}
if(parent != null)
{
parent.removeChild(this);
}
}
public function heartbeat(param1:Number) : Boolean
{
var _loc2_:Point = null;
var _loc3_:Array = null;
var _loc4_:QuestActor = null;
var _loc5_:* = 0;
var _loc6_:AvatarWorldView = null;
var _loc7_:Number = NaN;
var _loc8_:Number = NaN;
if(this._timer > 0)
{
this._timer -= param1;
if(this._timer <= 0)
{
return true;
}
}
else if(this._swipeMC != null)
{
if(this._swipeMC.weaponDone)
{
this._timer = 2;
}
else if(this._swipeMC.hitActive)
{
_loc2_ = this._swipeMC.getCollisionPoint();
_loc2_.x += x;
_loc2_.y += y;
if(this._npc != null)
{
if(this._players)
{
_loc5_ = int(this._players.length - 1);
while(_loc5_ >= 0)
{
_loc6_ = AvatarManager.avatarViewList[this._players[_loc5_]];
if(_loc6_ != null)
{
_loc7_ = _loc2_.x - (_loc6_.x + QuestManager.QUEST_PLAYER_AVATAR_OFFSETX);
_loc8_ = _loc2_.y - (_loc6_.y + QuestManager.QUEST_PLAYER_AVATAR_OFFSETY);
if(_loc7_ * _loc7_ + _loc8_ * _loc8_ < (this._swipeMC.radius + QuestManager.QUEST_PLAYER_AVATAR_RADIUS) * (this._swipeMC.radius + QuestManager.QUEST_PLAYER_AVATAR_RADIUS))
{
this.handleHit(null,_loc6_,this._localPlayerLaunched);
this._players.splice(_loc5_,1);
}
}
else
{
this._players.splice(_loc5_,1);
}
_loc5_--;
}
}
_loc3_ = QuestManager.meleeRadiusCheck(this._meleeID,_loc2_,this._swipeMC.radius,true);
if(_loc3_ != null)
{
for each(_loc4_ in _loc3_)
{
this.handleHit(_loc4_,null,true);
}
}
}
else
{
_loc3_ = QuestManager.meleeRadiusCheck(this._meleeID,_loc2_,this._swipeMC.radius,false);
if(_loc3_ != null)
{
for each(_loc4_ in _loc3_)
{
this.handleHit(_loc4_,null,this._localPlayerLaunched);
}
}
}
}
}
return false;
}
public function handleHit(param1:QuestActor, param2:AvatarWorldView, param3:Boolean) : void
{
var _loc4_:Point = null;
if(param1 != null)
{
param1.handleHit(param3,this._weaponItem.defId);
_loc4_ = param1.actorOffset;
_loc4_.x += param1.x - x;
_loc4_.y += param1.y - y;
}
else
{
if(param2 == AvatarManager.playerAvatarWorldView)
{
QuestXtCommManager.questActorAttacked("",this._weaponItem.defId);
}
_loc4_ = new Point(QuestManager.QUEST_PLAYER_AVATAR_OFFSETX,QuestManager.QUEST_PLAYER_AVATAR_OFFSETY);
_loc4_.x += param2.x - x;
_loc4_.y += param2.y - y;
}
var _loc5_:MediaHelper = new MediaHelper();
_loc5_.init(this._weaponItem.attackMediaRefId,this.onEffectLoaded,_loc4_);
}
public function swipe(param1:int, param2:uint, param3:Sprite, param4:int, param5:int, param6:QuestActor, param7:AvatarView) : Boolean
{
var _loc8_:Object = null;
var _loc9_:Point = null;
var _loc10_:Number = NaN;
var _loc11_:Number = NaN;
var _loc12_:Number = NaN;
var _loc13_:Number = NaN;
this._weaponItem = ItemXtCommManager.getItemDef(param1);
this._color = param2;
if(param6 == null)
{
if(param7 != null)
{
this._localPlayerLaunched = param7.userId == AvatarManager.playerSfsUserId;
if(this._localPlayerLaunched)
{
QuestXtCommManager.sendQuestSwipe(this._weaponItem.defId,param4,param5,"",param7.userId,param2);
}
x = param7.x + QuestManager.QUEST_PLAYER_AVATAR_OFFSETX;
y = param7.y + QuestManager.QUEST_PLAYER_AVATAR_OFFSETY;
this._mediaHelperObj = new MediaHelper();
this._mediaHelperObj.init(this._weaponItem.attackMediaRefId,this.onSwipeLoaded,this);
}
}
else
{
this._localPlayerLaunched = false;
this._players = new Array();
for(_loc8_ in AvatarManager.avatarViewList)
{
this._players.push(_loc8_);
}
_loc9_ = param6.actorOffset;
this._npc = param6;
x = this._npc.x + _loc9_.x;
y = this._npc.y + _loc9_.y;
this._mediaHelperObj = new MediaHelper();
this._mediaHelperObj.init(this._weaponItem.attackMediaRefId,this.onSwipeLoaded,this);
}
if(this._mediaHelperObj != null)
{
_loc10_ = param4 - x;
_loc11_ = param5 - y;
if(_loc10_ == 0 && _loc11_ == 0)
{
_loc10_ = 1;
}
_loc12_ = Math.sqrt(_loc10_ * _loc10_ + _loc11_ * _loc11_);
_loc10_ /= _loc12_;
_loc11_ /= _loc12_;
_loc13_ = Math.asin(_loc10_);
if(_loc11_ > 0)
{
_loc13_ = -(Math.PI + _loc13_);
}
this._angle = _loc13_ * 180 / Math.PI;
param3.addChild(this);
return true;
}
return false;
}
private function onEffectLoaded(param1:MovieClip) : void
{
param1.x = param1.passback.x;
param1.y = param1.passback.y;
param1.effect();
addChild(param1);
param1.mediaHelper.destroy();
}
private function onSwipeLoaded(param1:MovieClip) : void
{
var _loc2_:Array = PaletteHelper.getRGBColors(this._color);
var _loc3_:Array = new Array(new Array(_loc2_[0].r,_loc2_[0].g,_loc2_[0].b),new Array(_loc2_[1].r,_loc2_[1].g,_loc2_[1].b),new Array(_loc2_[2].r,_loc2_[2].g,_loc2_[2].b),new Array(_loc2_[3].r,_loc2_[3].g,_loc2_[3].b));
param1.rgbColors = _loc3_;
param1.setColors();
addChild(param1);
param1.strike(this._angle);
this._swipeMC = param1;
param1.mediaHelper.destroy();
}
}
}
@@ -0,0 +1,481 @@
package quest
{
import avatar.AvatarInfo;
import avatar.AvatarManager;
import avatar.AvatarWorldView;
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.events.Event;
import flash.filters.GlowFilter;
import flash.media.SoundChannel;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.utils.getDefinitionByName;
import gskinner.motion.GTween;
import gskinner.motion.easing.Linear;
import loader.MediaHelper;
public class QuestPlayerData extends Sprite
{
private var _levelUpHelperBottom:MediaHelper;
private var _levelUpHelperTop:MediaHelper;
private var _levelUpMCBottom:MovieClip;
private var _levelUpMCTop:MovieClip;
private var _levelUpLoaded:Boolean;
public var _avatarWorldView:AvatarWorldView;
private var _tintFrames:int;
private var _statusText:TextField;
private var _statusTextTween:GTween;
private var _healingTween:GTween;
private var _healingHeart:MovieClip;
private var _uID:int;
private var _itemEmoticonSound:SoundChannel;
private var _itemEmoticonSoundName:String;
private var _playerDamageMC:MovieClip;
private var _playerDamageMH:MediaHelper;
private var _pendingPlayerDamageMax:int;
private var _pendingPlayerDamageBefore:int;
private var _pendingPlayerDamageAfter:int;
public function QuestPlayerData()
{
super();
}
private function updateAvatarStatus() : void
{
if(this._avatarWorldView == null)
{
this._avatarWorldView = AvatarManager.avatarViewList[this._uID];
if(this._avatarWorldView)
{
this._avatarWorldView.addChild(this._statusText);
this._avatarWorldView.addChild(this._healingHeart);
}
}
}
public function init(param1:int) : void
{
this._uID = param1;
this._statusText = new TextField();
this._statusText.multiline = false;
this._statusText.selectable = false;
this._statusText.embedFonts = true;
this._statusText.defaultTextFormat = new TextFormat("Tiki-Island",36,65280);
this._statusText.filters = [new GlowFilter(0,1,3,3,10,2)];
this._statusText.visible = false;
this._healingHeart = new (getDefinitionByName("questHeartsCont") as Class)();
this._healingHeart.visible = false;
this._pendingPlayerDamageMax = 0;
this._playerDamageMH = new MediaHelper();
this._playerDamageMH.init(2252,this.onPlayerDamageLoaded);
this.updateAvatarStatus();
}
private function playLevelUpEffect() : void
{
if(this._levelUpLoaded)
{
this._levelUpMCTop.gotoAndPlay("tintOn");
this._levelUpMCBottom.gotoAndPlay("tintOn");
this._levelUpLoaded = false;
this._levelUpMCTop.addEventListener(Event.ENTER_FRAME,this.levelUpEnterFrameHandler);
this.updateAvatarStatus();
if(this._avatarWorldView)
{
this._avatarWorldView.setBlendColor(4290903190,7534606);
}
QuestManager.playSound("ajq_stingerLevelUp");
}
else
{
this._levelUpLoaded = true;
}
}
public function playerDamaged(param1:int, param2:int, param3:int) : void
{
if(this._playerDamageMC != null && this._avatarWorldView != null)
{
if(this._playerDamageMC.parent != QuestManager._layerManager.room_chat)
{
this._pendingPlayerDamageMax = 0;
this._playerDamageMC.x = this._avatarWorldView.x;
this._playerDamageMC.y = this._avatarWorldView.y;
QuestManager._layerManager.room_chat.addChild(this._playerDamageMC);
this._playerDamageMC.hit(param1,param2,param3);
this._playerDamageMC.addEventListener(Event.ENTER_FRAME,this.playerDamageFrameHandler);
}
}
else
{
this._pendingPlayerDamageMax = param1;
this._pendingPlayerDamageBefore = param2;
this._pendingPlayerDamageAfter = param3;
}
}
private function onPlayerDamageLoaded(param1:MovieClip) : void
{
this._playerDamageMC = param1;
this._playerDamageMH.destroy();
this._playerDamageMH = null;
if(this._pendingPlayerDamageMax > 0)
{
this.playerDamaged(this._pendingPlayerDamageMax,this._pendingPlayerDamageBefore,this._pendingPlayerDamageAfter);
}
}
private function onLevelUpTopLoaded(param1:MovieClip) : void
{
if(param1)
{
if(Boolean(this._levelUpMCTop) && Boolean(this._levelUpMCTop.parent))
{
this._levelUpMCTop.parent.removeChild(this._levelUpMCTop);
}
this._levelUpMCTop = param1;
this.updateAvatarStatus();
if(this._avatarWorldView)
{
this._levelUpMCTop.x = this._avatarWorldView.x;
this._levelUpMCTop.y = this._avatarWorldView.y;
QuestManager._layerManager.room_chat.addChild(this._levelUpMCTop);
}
this.playLevelUpEffect();
}
}
private function onLevelUpBottomLoaded(param1:MovieClip) : void
{
if(param1)
{
if(Boolean(this._levelUpMCBottom) && Boolean(this._levelUpMCBottom.parent))
{
this._levelUpMCBottom.parent.removeChild(this._levelUpMCBottom);
}
this._levelUpMCBottom = param1;
this.updateAvatarStatus();
if(this._avatarWorldView)
{
this._avatarWorldView.addChildAt(this._levelUpMCBottom,0);
}
this.playLevelUpEffect();
}
}
private function playerDamageFrameHandler(param1:Event) : void
{
this._playerDamageMC.x = this._avatarWorldView.x;
this._playerDamageMC.y = this._avatarWorldView.y;
if(this._playerDamageMC != null && Boolean(this._playerDamageMC.finished))
{
this._playerDamageMC.removeEventListener(Event.ENTER_FRAME,this.playerDamageFrameHandler);
if(this._playerDamageMC.parent == QuestManager._layerManager.room_chat)
{
QuestManager._layerManager.room_chat.removeChild(this._playerDamageMC);
}
}
}
private function levelUpEnterFrameHandler(param1:Event) : void
{
if(this._levelUpMCTop != null)
{
this._levelUpMCTop.x = this._avatarWorldView.x;
this._levelUpMCTop.y = this._avatarWorldView.y;
}
if(this._levelUpMCTop.currentFrameLabel == "tintOff")
{
this.updateAvatarStatus();
if(this._avatarWorldView)
{
this._avatarWorldView.setBlendColor(0);
}
}
if(this._levelUpMCTop.currentFrameLabel == "finished")
{
this._levelUpMCTop.removeEventListener(Event.ENTER_FRAME,this.levelUpEnterFrameHandler);
}
}
private function onTweenComplete(param1:GTween) : void
{
if(this._avatarWorldView)
{
if(Boolean(this._healingHeart) && Boolean(this._healingHeart.parent) && this._healingHeart.parent == this._avatarWorldView)
{
this._avatarWorldView.removeChild(this._healingHeart);
}
}
}
private function onTweenStatusTextComplete(param1:GTween) : void
{
if(this._avatarWorldView)
{
if(Boolean(this._statusText) && Boolean(this._statusText.parent) && this._statusText.parent == this._avatarWorldView)
{
this._avatarWorldView.removeChild(this._statusText);
}
}
}
public function levelUp(param1:int) : void
{
if(this._avatarWorldView)
{
this._avatarWorldView.updateNameBarLevelShape(param1);
}
this._levelUpHelperTop = new MediaHelper();
this._levelUpHelperTop.init(1823,this.onLevelUpTopLoaded);
this._levelUpHelperBottom = new MediaHelper();
this._levelUpHelperBottom.init(1875,this.onLevelUpBottomLoaded);
}
public function handleHit(param1:int) : void
{
var _loc2_:AvatarInfo = null;
if(this._avatarWorldView != null)
{
_loc2_ = gMainFrame.userInfo.getAvatarInfoByUserName(this._avatarWorldView.userName);
if(_loc2_ != null)
{
if(_loc2_.questHealthPercentage > 0)
{
this._tintFrames = 13;
this.playHitText(String(param1));
if(this._avatarWorldView)
{
this._avatarWorldView.handleOffScreenHit();
addEventListener(Event.ENTER_FRAME,this.hitEnterFrameHandler);
if(this._avatarWorldView == AvatarManager.playerAvatarWorldView)
{
QuestManager.playSound("ajq_playerhit");
}
}
}
else if(this._avatarWorldView)
{
this._avatarWorldView.handleOffScreenSleep();
}
}
}
}
public function playHitText(param1:String) : void
{
this.updateAvatarStatus();
if(!this._avatarWorldView)
{
}
}
public function playStatusText(param1:String) : void
{
this._statusText.visible = true;
this._statusText.alpha = 2;
this._statusText.text = param1;
this._statusText.x = this.x - this._statusText.textWidth * 0.5 - this._avatarWorldView.radius * 0.5;
this._statusText.y = this.y - this._avatarWorldView.radius * 2;
if(this._statusTextTween)
{
this._statusTextTween.resetValues({
"y":this._statusText.y - 90,
"alpha":0
});
this._statusTextTween.beginning();
this._statusTextTween.paused = false;
}
else
{
this._statusTextTween = new GTween(this._statusText,1,{
"y":this._statusText.y - 90,
"alpha":0
},{
"onComplete":this.onTweenComplete,
"ease":Linear.easeNone
});
}
}
public function handleHealing(param1:int) : void
{
this.updateAvatarStatus();
if(this._avatarWorldView)
{
this._healingHeart.visible = true;
this._healingHeart.alpha = 2;
this._healingHeart.x = this.x - this._avatarWorldView.radius * 0.5;
this._healingHeart.y = this.y - this._avatarWorldView.radius * 2 - 35;
if(this._healingTween)
{
this._healingTween.resetValues({
"y":this._healingHeart.y,
"alpha":0
});
this._healingTween.beginning();
this._healingTween.paused = false;
}
else
{
this._healingTween = new GTween(this._healingHeart,1.5,{
"y":this._healingHeart.y,
"alpha":0
},{
"onComplete":this.onTweenComplete,
"ease":Linear.easeNone
});
}
this._avatarWorldView.handleOffScreenSleep(true);
}
}
public function destroy() : void
{
this.stopItemEmoticonSound();
if(hasEventListener(Event.ENTER_FRAME))
{
removeEventListener(Event.ENTER_FRAME,this.hitEnterFrameHandler);
}
if(Boolean(this._levelUpMCTop) && this._levelUpMCTop.hasEventListener(Event.ENTER_FRAME))
{
this._levelUpMCTop.removeEventListener(Event.ENTER_FRAME,this.levelUpEnterFrameHandler);
}
if(this._playerDamageMC != null)
{
this._playerDamageMC.removeEventListener(Event.ENTER_FRAME,this.playerDamageFrameHandler);
}
if(this._playerDamageMH != null)
{
this._playerDamageMH.destroy();
this._playerDamageMH = null;
}
}
private function soundEnterFrameHandler(param1:Event) : void
{
var _loc2_:Number = NaN;
var _loc3_:Number = NaN;
var _loc4_:Number = NaN;
var _loc5_:Number = NaN;
var _loc6_:Number = NaN;
var _loc7_:Number = NaN;
if(this._avatarWorldView)
{
if(this._itemEmoticonSoundName != null)
{
_loc2_ = 1;
if(this._avatarWorldView != AvatarManager.playerAvatarWorldView)
{
_loc3_ = AvatarManager.playerAvatarWorldView.x - this._avatarWorldView.x;
_loc4_ = AvatarManager.playerAvatarWorldView.y - this._avatarWorldView.y;
_loc5_ = _loc3_ * _loc3_ + _loc4_ * _loc4_;
_loc6_ = 5 * 5;
_loc7_ = 600 * 600;
if(_loc5_ > _loc7_)
{
_loc2_ = 0;
}
else if(_loc5_ >= _loc6_)
{
_loc2_ = 1 - (_loc5_ - _loc6_) / (_loc7_ - _loc6_);
}
}
if(_loc2_ > 0)
{
if(this._itemEmoticonSound == null)
{
this._itemEmoticonSound = QuestManager.playLoopingSound(this._itemEmoticonSoundName);
}
QuestManager.setSoundLevel(this._itemEmoticonSound,_loc2_,this._avatarWorldView);
}
else if(this._itemEmoticonSound != null)
{
this._itemEmoticonSound.stop();
this._itemEmoticonSound = null;
}
}
}
}
private function hitEnterFrameHandler(param1:Event) : void
{
this.updateAvatarStatus();
if(this._avatarWorldView)
{
if(this._avatarWorldView.isValid())
{
--this._tintFrames;
switch(this._tintFrames)
{
case 10:
case 6:
case 2:
this._avatarWorldView.setBlendColor(0);
break;
case 12:
case 8:
case 4:
this._avatarWorldView.setBlendColor(3439329279,0,true);
break;
case 0:
removeEventListener(Event.ENTER_FRAME,this.hitEnterFrameHandler);
}
}
else
{
removeEventListener(Event.ENTER_FRAME,this.hitEnterFrameHandler);
}
}
}
public function stopItemEmoticonSound() : void
{
if(this._itemEmoticonSound != null)
{
this._itemEmoticonSound.stop();
this._itemEmoticonSound = null;
}
if(this._itemEmoticonSoundName != null)
{
removeEventListener(Event.ENTER_FRAME,this.soundEnterFrameHandler);
this._itemEmoticonSoundName = null;
}
}
public function playItemEmoticonSound(param1:String) : void
{
this.stopItemEmoticonSound();
var _loc2_:int = param1.lastIndexOf(".wav");
if(_loc2_ > 0)
{
param1 = param1.substring(0,_loc2_);
}
param1 = param1.toLowerCase();
this._itemEmoticonSoundName = param1;
addEventListener(Event.ENTER_FRAME,this.soundEnterFrameHandler);
}
}
}
@@ -0,0 +1,344 @@
package quest
{
import avatar.AvatarManager;
import avatar.AvatarView;
import avatar.AvatarWorldView;
import com.sbi.graphics.PaletteHelper;
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.geom.Point;
import item.ItemXtCommManager;
import loader.MediaHelper;
import room.RoomManagerWorld;
public class QuestProjectile extends Sprite
{
private static const PROJECTILE_VELOCITY:int = 400;
private static const PROJECTILE_RANGE:int = 600;
private static const PROJECTILE_RADIUS:int = 10;
private var _weaponItem:Object;
private var _npc:QuestActor;
private var _mediaHelperObj:MediaHelper;
private var _strikeMC:MovieClip;
private var _projectileMC:MovieClip;
private var _aimX:Number;
private var _aimY:Number;
private var _distanceTravelled:Number;
private var _timer:Number;
private var _angle:Number;
private var _collisionOffset:Point;
private var _color:uint;
private var _localPlayerLaunched:Boolean;
private var _healProjectile:Boolean;
public function QuestProjectile()
{
super();
this._distanceTravelled = 0;
this._timer = 0;
}
public function get angle() : Number
{
return this._angle;
}
public function destroy() : void
{
if(this._strikeMC != null && this._strikeMC.parent != null)
{
this._strikeMC.parent.removeChild(this._strikeMC);
}
if(this._mediaHelperObj != null)
{
this._mediaHelperObj.destroy();
this._mediaHelperObj = null;
}
if(parent != null)
{
parent.removeChild(this);
}
this._strikeMC.weapon.rotation = 0;
QuestManager.recycle(this._weaponItem.attackMediaRefId,this);
}
public function heartbeat(param1:Number) : Boolean
{
var _loc2_:QuestActor = null;
var _loc3_:Object = null;
var _loc4_:AvatarWorldView = null;
var _loc5_:Number = NaN;
var _loc6_:Number = NaN;
if(this._timer == 0)
{
if(this._projectileMC != null)
{
x += this._aimX * PROJECTILE_VELOCITY * param1;
y += this._aimY * PROJECTILE_VELOCITY * param1;
this._distanceTravelled += PROJECTILE_VELOCITY * param1;
if(this._distanceTravelled > PROJECTILE_RANGE || RoomManagerWorld.instance.collisionTestGrid(x + this._collisionOffset.x,y + this._collisionOffset.y) == 1)
{
this.handleHit(true,null,null,false);
}
else if(this._npc != null || this._healProjectile)
{
for(_loc3_ in AvatarManager.avatarViewList)
{
_loc4_ = AvatarManager.avatarViewList[_loc3_];
if(_loc4_ != null)
{
_loc5_ = x + this._collisionOffset.x - (_loc4_.x + QuestManager.QUEST_PLAYER_AVATAR_OFFSETX);
_loc6_ = y + this._collisionOffset.y - (_loc4_.y + QuestManager.QUEST_PLAYER_AVATAR_OFFSETY);
if(_loc5_ * _loc5_ + _loc6_ * _loc6_ < (PROJECTILE_RADIUS + QuestManager.QUEST_PLAYER_AVATAR_RADIUS) * (PROJECTILE_RADIUS + QuestManager.QUEST_PLAYER_AVATAR_RADIUS))
{
this.handleHit(false,null,_loc4_,this._localPlayerLaunched);
}
}
}
_loc2_ = QuestManager.projectileRadiusCheck(x + this._collisionOffset.x,y + this._collisionOffset.y,PROJECTILE_RADIUS,true);
if(_loc2_ != null)
{
this.handleHit(false,_loc2_,null,true);
}
}
else
{
_loc2_ = QuestManager.projectileRadiusCheck(x + this._collisionOffset.x,y + this._collisionOffset.y,PROJECTILE_RADIUS,false);
if(_loc2_ != null)
{
this.handleHit(false,_loc2_,null,this._localPlayerLaunched);
}
}
}
}
else
{
this._timer -= param1;
if(this._timer <= 0)
{
this._timer = 0;
return true;
}
}
return false;
}
public function handleHit(param1:Boolean, param2:QuestActor, param3:AvatarWorldView, param4:Boolean) : void
{
var _loc5_:Point = null;
this._projectileMC.visible = false;
this._timer = 2;
if(param1 == false)
{
if(param2 != null)
{
param2.handleHit(param4,this._weaponItem.defId);
_loc5_ = param2.actorOffset;
x = param2.x + _loc5_.x;
y = param2.y + _loc5_.y;
}
else
{
if(!this._healProjectile)
{
if(param3 == AvatarManager.playerAvatarWorldView)
{
QuestXtCommManager.questActorAttacked("",this._weaponItem.defId);
}
}
else if(this._localPlayerLaunched)
{
QuestXtCommManager.questPlayerHeal(this._weaponItem.defId,param3.avatarData.sfsUserId);
}
_loc5_ = new Point(QuestManager.QUEST_PLAYER_AVATAR_OFFSETX,QuestManager.QUEST_PLAYER_AVATAR_OFFSETY);
x = _loc5_.x + param3.x;
y = _loc5_.y + param3.y;
}
this._mediaHelperObj = new MediaHelper();
this._mediaHelperObj.init(this._weaponItem.attackMediaRefId,this.onEffectLoaded);
}
}
private function setAngle() : void
{
var _loc1_:Number = this._aimX - x;
var _loc2_:Number = this._aimY - y;
if(_loc1_ == 0 && _loc2_ == 0)
{
_loc1_ = 1;
}
var _loc3_:Number = Math.sqrt(_loc1_ * _loc1_ + _loc2_ * _loc2_);
this._aimX = _loc1_ / _loc3_;
this._aimY = _loc2_ / _loc3_;
var _loc4_:Number = Math.asin(this._aimX);
if(this._aimY > 0)
{
_loc4_ = -(Math.PI + _loc4_);
}
this._angle = _loc4_ * 180 / Math.PI;
}
public function relaunch(param1:int, param2:uint, param3:Sprite, param4:int, param5:int, param6:QuestActor, param7:AvatarView) : Boolean
{
var _loc8_:Point = null;
this._color = param2;
this._aimX = param4;
this._aimY = param5;
this._healProjectile = false;
this._distanceTravelled = 0;
if(param6 == null)
{
if(param7)
{
this._localPlayerLaunched = param7.userId == AvatarManager.playerSfsUserId;
if(this._localPlayerLaunched)
{
QuestXtCommManager.sendQuestProjectileLaunch(this._weaponItem.defId,param4,param5,"",param7.userId,param2);
}
this._healProjectile = this._weaponItem.attack < 0;
x = this._strikeMC.x = param7.x + QuestManager.QUEST_PLAYER_AVATAR_OFFSETX;
y = this._strikeMC.y = param7.y + QuestManager.QUEST_PLAYER_AVATAR_OFFSETY;
this.setAngle();
this._strikeMC.strike(this._angle);
param3.addChild(this._strikeMC);
this._projectileMC.visible = true;
this._projectileMC.projectile(this._angle);
}
}
else
{
this._localPlayerLaunched = false;
_loc8_ = param6.actorOffset;
this._npc = param6;
x = this._strikeMC.x = this._npc.x + _loc8_.x;
y = this._strikeMC.x = this._npc.y + _loc8_.y;
this.setAngle();
this._strikeMC.strike(this._angle);
param3.addChild(this._strikeMC);
this._projectileMC.visible = true;
this._projectileMC.projectile(this._angle);
}
param3.addChild(this);
return true;
}
public function launch(param1:int, param2:uint, param3:Sprite, param4:int, param5:int, param6:QuestActor, param7:AvatarView) : Boolean
{
var _loc8_:Object = null;
var _loc9_:Point = null;
this._color = param2;
this._weaponItem = ItemXtCommManager.getItemDef(param1);
this._aimX = param4;
this._aimY = param5;
this._healProjectile = false;
if(param6 == null)
{
if(param7)
{
this._localPlayerLaunched = param7.userId == AvatarManager.playerSfsUserId;
if(this._localPlayerLaunched)
{
QuestXtCommManager.sendQuestProjectileLaunch(this._weaponItem.defId,param4,param5,"",param7.userId,param2);
}
_loc8_ = ItemXtCommManager.getItemDef(param1);
if(_loc8_)
{
this._healProjectile = _loc8_.attack < 0;
}
x = param7.x + QuestManager.QUEST_PLAYER_AVATAR_OFFSETX;
y = param7.y + QuestManager.QUEST_PLAYER_AVATAR_OFFSETY;
this._mediaHelperObj = new MediaHelper();
this._mediaHelperObj.init(this._weaponItem.attackMediaRefId,this.onStrikeLoaded);
}
}
else
{
this._localPlayerLaunched = false;
_loc9_ = param6.actorOffset;
this._npc = param6;
x = this._npc.x + _loc9_.x;
y = this._npc.y + _loc9_.y;
this._mediaHelperObj = new MediaHelper();
this._mediaHelperObj.init(this._weaponItem.attackMediaRefId,this.onStrikeLoaded);
}
if(this._mediaHelperObj != null)
{
this.setAngle();
param3.addChild(this);
return true;
}
return false;
}
private function onStrikeLoaded(param1:MovieClip) : void
{
var _loc2_:Array = null;
var _loc3_:Array = null;
if(parent != null)
{
_loc2_ = PaletteHelper.getRGBColors(this._color);
_loc3_ = new Array(new Array(_loc2_[0].r,_loc2_[0].g,_loc2_[0].b),new Array(_loc2_[1].r,_loc2_[1].g,_loc2_[1].b),new Array(_loc2_[2].r,_loc2_[2].g,_loc2_[2].b),new Array(_loc2_[3].r,_loc2_[3].g,_loc2_[3].b));
param1.rgbColors = _loc3_;
param1.setColors();
param1.x += x;
param1.y += y;
param1.strike(this._angle);
parent.addChild(param1);
this._strikeMC = param1;
if(this._mediaHelperObj != null)
{
this._mediaHelperObj.destroy();
this._mediaHelperObj = null;
}
this._mediaHelperObj = new MediaHelper();
this._mediaHelperObj.init(this._weaponItem.attackMediaRefId,this.onProjectileLoaded);
}
}
private function onEffectLoaded(param1:MovieClip) : void
{
addChild(param1);
param1.effect();
if(this._mediaHelperObj != null)
{
this._mediaHelperObj.destroy();
this._mediaHelperObj = null;
}
}
private function onProjectileLoaded(param1:MovieClip) : void
{
var _loc2_:Array = PaletteHelper.getRGBColors(this._color);
var _loc3_:Array = new Array(new Array(_loc2_[0].r,_loc2_[0].g,_loc2_[0].b),new Array(_loc2_[1].r,_loc2_[1].g,_loc2_[1].b),new Array(_loc2_[2].r,_loc2_[2].g,_loc2_[2].b),new Array(_loc2_[3].r,_loc2_[3].g,_loc2_[3].b));
param1.rgbColors = _loc3_;
param1.setColors();
this._projectileMC = param1;
addChild(this._projectileMC);
this._projectileMC.projectile(this._angle);
this._collisionOffset = this._projectileMC.getCollisionPoint();
if(this._mediaHelperObj != null)
{
this._mediaHelperObj.destroy();
this._mediaHelperObj = null;
}
}
}
}
@@ -0,0 +1,483 @@
package quest
{
import avatar.AvatarManager;
import com.carlcalderon.arthropod.Debug;
import com.sbi.client.SFEvent;
import com.sbi.debug.DebugUtility;
import com.sbi.popup.SBOkPopup;
import flash.utils.Dictionary;
import gui.GuiManager;
import loader.DefPacksDefHelper;
import room.RoomManagerWorld;
import room.RoomXtCommManager;
public class QuestXtCommManager
{
private static var _questCache:Array;
private static var _questDefLookups:Array;
private static var _scriptDefs:Object;
public function QuestXtCommManager()
{
super();
}
public static function init() : void
{
_questCache = new Array();
_questDefLookups = new Array();
}
public static function questAskComplete(param1:String, param2:int, param3:int) : void
{
gMainFrame.server.setXtObject_Str("qaskr",[param1,param2,param3]);
}
public static function questMiniGameComplete(param1:String, param2:int, param3:int) : void
{
gMainFrame.server.setXtObject_Str("qmgc",[param1,param2,param3]);
}
public static function questActorAttacked(param1:String, param2:int) : void
{
gMainFrame.server.setXtObject_Str("qaa",[param1,param1 == "" ? 1 : 0,param2]);
}
public static function questPlayerHeal(param1:int, param2:int) : void
{
gMainFrame.server.setXtObject_Str("qph",[param1,param2]);
}
public static function questActorTriggered(param1:String, param2:int = 0) : void
{
DebugUtility.debugTrace("sending \'qat\' command with actorId: " + param1,Debug.RED);
gMainFrame.server.setXtObject_Str("qat",[param1,param2]);
}
public static function questPickUpItem(param1:String) : void
{
gMainFrame.server.setXtObject_Str("qpup",[param1,AvatarManager.playerSfsUserId]);
}
public static function questActorTreasureTriggered(param1:String, param2:int = 0) : void
{
gMainFrame.server.setXtObject_Str("qatt",[param1,param2]);
}
public static function questActorUntriggered(param1:String) : void
{
gMainFrame.server.setXtObject_Str("qaut",[param1]);
}
public static function questActorPositionUpdate(param1:String, param2:int, param3:int, param4:int, param5:int) : void
{
if(QuestManager._questStartingPlayerCount > 1)
{
gMainFrame.server.setXtObject_Str("qau",[param1,param2,param3,param4,param5]);
}
}
public static function questActorSeek(param1:String, param2:int) : void
{
gMainFrame.server.setXtObject_Str("qas",[param1,param2]);
}
public static function questPhantomZap(param1:String, param2:int, param3:int, param4:int) : void
{
gMainFrame.server.setXtObject_Str("qpzap",[param1,param2,param3,param4]);
}
public static function sendQuestWaitRequest(param1:int) : void
{
if(gMainFrame.server.getCurrentRoom())
{
if(RoomXtCommManager._loadingNewRoom)
{
DebugUtility.debugTrace("IGNORING sendQuestWaitRequest request because user is already joining a new room!");
return;
}
AvatarManager.joiningNewRoom = true;
RoomXtCommManager._loadingNewRoom = true;
RoomManagerWorld.instance.forceStopMovement();
gMainFrame.server.setXtObject_Str("qj",[gMainFrame.server.getCurrentRoomName(),param1]);
}
}
public static function sendQuestJoinCancel() : void
{
gMainFrame.server.setXtObject_Str("qjx",[]);
}
public static function sendQuestStartRequest() : void
{
if(gMainFrame.server.getCurrentRoom())
{
if(RoomXtCommManager._loadingNewRoom)
{
DebugUtility.debugTrace("IGNORING sendQuestStartRequest request because user is already joining a new room!");
return;
}
AvatarManager.joiningNewRoom = true;
RoomXtCommManager._loadingNewRoom = true;
gMainFrame.server.setXtObject_Str("qs",[gMainFrame.server.getCurrentRoomName()]);
}
}
public static function sendQuestProjectileLaunch(param1:int, param2:int, param3:int, param4:String, param5:int, param6:uint) : void
{
gMainFrame.server.setXtObject_Str("qp",[param1,param2,param3,param4,param5,param6]);
}
public static function sendQuestSwipe(param1:int, param2:int, param3:int, param4:String, param5:int, param6:uint) : void
{
gMainFrame.server.setXtObject_Str("qm",[param1,param2,param3,param4,param5,param6]);
}
public static function sendQuestExit() : void
{
gMainFrame.server.setXtObject_Str("qx",[]);
}
public static function sendAttackPlayer(param1:String, param2:int, param3:int, param4:uint) : void
{
gMainFrame.server.setXtObject_Str("qap",[param1,param2,param3,param4]);
}
public static function sendQuestPlayerRequestRespawn(param1:int, param2:int, param3:int) : void
{
gMainFrame.server.setXtObject_Str("qprr",[param1,param2,param3]);
}
public static function sendPlantSeed(param1:int, param2:int, param3:int) : void
{
gMainFrame.server.setXtObject_Str("qps",[param1,param2,param3]);
}
public static function sendEatPhantom(param1:String, param2:String, param3:int, param4:int) : void
{
gMainFrame.server.setXtObject_Str("qep",[param1,param2,param3,param4]);
}
public static function sendPickGiftResult(param1:int) : void
{
gMainFrame.server.setXtObject_Str("qpgift",[param1]);
}
public static function handleXtReply(param1:SFEvent) : void
{
var _loc2_:Object = param1.obj;
switch(_loc2_[0])
{
case "qap":
QuestManager.handleAttackPlayer(_loc2_);
break;
case "qau":
QuestManager.handleQuestActorPositionUpdateResponse(_loc2_);
break;
case "qahs":
QuestManager.handleActorHealthStatus(_loc2_);
break;
case "qas":
QuestManager.handleQuestActorRequestSeekResponse(_loc2_);
break;
case "qj":
AvatarManager.joiningNewRoom = false;
RoomXtCommManager._loadingNewRoom = false;
if(_loc2_[2] != 0)
{
QuestManager.handleQuestJoinResponse(_loc2_);
}
else if(_loc2_[3] == "NV")
{
new SBOkPopup(GuiManager.guiLayer,"Failed to join! Please try again.");
}
else if(_loc2_[3] == "NM")
{
new SBOkPopup(GuiManager.guiLayer,"This Adventure is currently for Club members only!");
}
else if(_loc2_[3] == "NL")
{
new SBOkPopup(GuiManager.guiLayer,"Your animal must be level " + _loc2_[4] + " to go on this Adventure.");
}
else
{
new SBOkPopup(GuiManager.guiLayer,"Failed to join! Please try again.");
}
break;
case "qjx":
QuestManager.handleQuestJoinCancelResponse(_loc2_);
break;
case "qw":
QuestManager.handleQuestWaitResponse(_loc2_);
break;
case "qs":
questStartResponse(_loc2_);
QuestManager.handleQuestStartResponse(_loc2_);
break;
case "qat":
questActorTriggeredResponse(_loc2_);
break;
case "qcmd":
QuestManager.handleCommand(_loc2_);
break;
case "qp":
QuestManager.handleLaunchProjectile(_loc2_);
break;
case "qm":
QuestManager.handleSwipe(_loc2_);
break;
case "quxp":
QuestManager.handleXpUpdate(_loc2_);
break;
case "quhp":
QuestManager.handleHealthUpdate(_loc2_,false);
break;
case "qrspn":
QuestManager.handleHealthUpdate(_loc2_,true);
break;
case "qad":
QuestManager.handleActorDeath(_loc2_);
break;
case "qx":
break;
case "qspn":
QuestManager.handleSpawn(_loc2_);
break;
case "qatt":
QuestManager.handleQuestActorTriggerTreasure(_loc2_);
break;
case "qusu":
QuestManager.handleStatsUpdate(_loc2_);
break;
case "qulu":
QuestManager.handleLevelUp(_loc2_);
break;
case "qpup":
QuestManager.handlePickUpItem(_loc2_);
break;
case "qsnd":
QuestManager.playSound(_loc2_[2]);
break;
case "qmusic":
QuestManager.playMusic(_loc2_[2]);
break;
case "qswfs":
QuestManager.handleSetSwfState(_loc2_);
break;
case "qmlib":
QuestManager.handleLoadMediaLib(_loc2_);
break;
case "qprr":
QuestManager.handleQuestPlayerRequestRespawn(_loc2_);
break;
case "qpd":
QuestManager.handleQuestPlayerDead(_loc2_);
break;
case "qsp":
QuestManager.handleQuestSetPath(_loc2_);
break;
case "qps":
QuestManager.handlePlantSeed(_loc2_);
break;
case "qep":
QuestManager.handleEatPhantom(_loc2_[2],_loc2_[3]);
break;
case "qpzap":
QuestManager.handlePhantomZap(_loc2_);
break;
case "qpgift":
QuestManager.handlePickGift(_loc2_);
break;
case "qplq":
QuestManager.handlePlayerLeftQuest(_loc2_);
break;
case "qrc":
QuestManager.handleQuestRoomChange(_loc2_);
}
}
private static function questStartResponse(param1:Object) : void
{
var _loc7_:Dictionary = null;
var _loc8_:Object = null;
var _loc9_:String = null;
var _loc10_:int = 0;
var _loc11_:int = 0;
var _loc12_:String = null;
var _loc13_:int = 0;
var _loc14_:Boolean = false;
var _loc15_:Boolean = false;
var _loc16_:String = null;
var _loc2_:* = 2;
var _loc3_:int = int(param1[_loc2_++]);
var _loc4_:int = int(param1[_loc2_++]);
var _loc5_:* = int(param1[_loc2_++]);
var _loc6_:String = param1[_loc2_++];
if(_loc5_ >= 0)
{
_loc7_ = new Dictionary();
while(_loc5_ > 0)
{
_loc8_ = new Object();
_loc9_ = param1[_loc2_++];
_loc10_ = int(param1[_loc2_++]);
_loc11_ = 0;
_loc12_ = null;
if(_loc10_ == QuestActor.QUEST_ACTOR_TYPE_SPEAKER)
{
_loc12_ = param1[_loc2_++];
}
else
{
_loc11_ = int(param1[_loc2_++]);
}
_loc13_ = int(param1[_loc2_++]);
_loc14_ = param1[_loc2_++] == 1;
_loc15_ = param1[_loc2_++] == 1;
_loc16_ = param1[_loc2_++];
_loc8_.visible = _loc14_;
_loc8_.requireClick = _loc15_;
_loc8_.defId = _loc11_;
_loc8_.defName = _loc12_;
_loc8_.type = _loc10_;
_loc8_.state = _loc13_;
_loc8_.pathName = _loc16_ != "" ? _loc16_ : null;
QuestManager.initInitialActorStatus(_loc8_,null);
_loc7_[_loc9_] = _loc8_;
_loc5_--;
}
QuestManager.setActorDictionary(_loc7_,_loc6_);
QuestManager.hasJustJoinedQuest = true;
}
else
{
AvatarManager.joiningNewRoom = false;
RoomXtCommManager._loadingNewRoom = false;
}
}
private static function questActorTriggeredResponse(param1:Object) : void
{
}
public static function questDefResponse(param1:DefPacksDefHelper) : void
{
var _loc4_:Object = null;
var _loc5_:Object = null;
var _loc2_:Object = param1.def;
DefPacksDefHelper.mediaArray[DefPacksDefHelper.DEF_BATTLE_CARD] = null;
var _loc3_:Object = new Object();
for each(_loc5_ in param1.def)
{
_loc4_ = {
"defId":int(_loc5_.id),
"type":int(_loc5_.type),
"cardMediaRefId":int(_loc5_.cardMediaRef),
"effectMediaRefId":int(_loc5_.effectMediaRef),
"screenEffectMediaRefId":int(_loc5_.screenEffectMediaRef),
"titleStrId":int(_loc5_.titleStrId),
"cardClass":int(_loc5_.cardClass),
"amount":int(_loc5_.amount),
"manaCost":int(_loc5_.manaCost),
"delayStartMS":int(_loc5_.delayStartMS),
"delayHitMS":int(_loc5_.delayHitMS),
"criticalHit":int(_loc5_.criticalHit),
"chanceHit":int(_loc5_.chanceHit),
"debuffType":int(_loc5_.debuffType),
"chanceDebuff":int(_loc5_.chanceDebuff),
"amountDebuff":int(_loc5_.amountDebuff),
"turnDurDebuff":int(_loc5_.turnDurDebuff),
"classModifierBits":int(_loc5_.classModifierBits)
};
_loc3_[_loc4_.defId] = _loc4_;
}
QuestManager.gameCardDefs = _loc3_;
}
public static function questNPCDefResponse(param1:DefPacksDefHelper) : void
{
var _loc4_:Object = null;
var _loc5_:Object = null;
var _loc2_:Object = param1.def;
DefPacksDefHelper.mediaArray[DefPacksDefHelper.DEF_NPC] = null;
var _loc3_:Object = new Object();
for each(_loc5_ in param1.def)
{
_loc4_ = {
"avatarRefId":int(_loc5_.avatarRefId),
"backColor":Number(_loc5_.backColor),
"backItemRefId":int(_loc5_.backItemRefId),
"eyesColor":Number(_loc5_.eyesColor),
"eyesItemRefId":int(_loc5_.eyesItemRefId),
"legColor":Number(_loc5_.legColor),
"legItemRefId":int(_loc5_.legItemRefId),
"headColor":int(_loc5_.headColor),
"headMediaRefId":uint(_loc5_.headMediaRefId),
"headItemRefId":int(_loc5_.headItemRefId),
"defId":int(_loc5_.id),
"mediaRefId":int(_loc5_.mediaRefId),
"neckColor":Number(_loc5_.neckColor),
"neckItemRefId":int(_loc5_.neckItemRefId),
"patternColor":Number(_loc5_.patternColor),
"patternItemRefId":int(_loc5_.patternItemRefId),
"tailColor":Number(_loc5_.tailColor),
"tailItemRefId":int(_loc5_.tailItemRefId),
"titleStrId":int(_loc5_.titleStrId),
"type":int(_loc5_.type),
"baseColor":int(_loc5_.baseColor),
"hps":int(_loc5_.hps),
"defense":int(_loc5_.defense),
"xpValue":int(_loc5_.xpValue),
"iconMediaRefId":int(_loc5_.iconMediaRefId),
"level":int(_loc5_.level)
};
_loc3_[_loc4_.defId] = _loc4_;
}
QuestManager.npcDefs = _loc3_;
}
public static function scriptResponse(param1:DefPacksDefHelper) : void
{
var _loc4_:Object = null;
var _loc5_:Object = null;
var _loc2_:Object = param1.def;
DefPacksDefHelper.mediaArray[DefPacksDefHelper.DEF_SCRIPT] = null;
var _loc3_:Object = new Object();
for each(_loc5_ in param1.def)
{
_loc4_ = {
"defId":int(_loc5_.id),
"avatarLimit":int(_loc5_.avatarLimit),
"avatarMin":int(_loc5_.avatarMin),
"descStrId":int(_loc5_.descStrId),
"difficulty":int(_loc5_.difficulty),
"levelMin":int(_loc5_.levelMin),
"mediaRefId":int(_loc5_.mediaRefId),
"time":int(_loc5_.time),
"titleStrId":int(_loc5_.titleStrId)
};
_loc3_[_loc4_.defId] = _loc4_;
}
_scriptDefs = _loc3_;
}
public static function roomJoined(param1:String) : void
{
QuestManager.questRoomJoined(param1.indexOf("quest_") == 0);
}
public static function getScriptDef(param1:int) : Object
{
return _scriptDefs[param1];
}
private static function searchQuestCache(param1:int) : Object
{
return _questCache[param1];
}
}
}