mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-19 01:27:51 -05:00
Brought up to date with the private repository (feea4c7)
This commit is contained in:
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,753 @@
|
||||
package playerWall
|
||||
{
|
||||
import buddy.BuddyManager;
|
||||
import collection.IntItemCollection;
|
||||
import com.sbi.popup.SBOkPopup;
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.MouseEvent;
|
||||
import flash.events.TimerEvent;
|
||||
import flash.net.SharedObject;
|
||||
import flash.utils.Dictionary;
|
||||
import flash.utils.Timer;
|
||||
import gui.DarkenManager;
|
||||
import gui.GuiManager;
|
||||
import gui.UpsellManager;
|
||||
import localization.LocalizationManager;
|
||||
import room.RoomManagerWorld;
|
||||
|
||||
public class PlayerWallManager
|
||||
{
|
||||
|
||||
public static const PATTERN_MEDIA_ID:int = 3983;
|
||||
|
||||
private static var _guiLayer:DisplayLayer;
|
||||
|
||||
private static var _hudWallBtn:MovieClip;
|
||||
|
||||
private static var _glowTimer:Timer;
|
||||
|
||||
private static var _openWallUpdateTimer:Timer;
|
||||
|
||||
private static var _myPlayerWallClosedTimer:Timer;
|
||||
|
||||
private static var _myInbox:Vector.<PostMessage>;
|
||||
|
||||
private static var _myNotifications:Vector.<PostMessage>;
|
||||
|
||||
private static var _strangerInbox:Vector.<PostMessage>;
|
||||
|
||||
private static var _myPlayerWall:PlayerWallGui;
|
||||
|
||||
private static var _strangersPlayerWall:PlayerWallGui;
|
||||
|
||||
private static var _isFirstTime:Boolean;
|
||||
|
||||
private static var _statusText:String;
|
||||
|
||||
private static var _currentMessageColorId:int;
|
||||
|
||||
private static var _currentMessagePattern:int;
|
||||
|
||||
private static var _myPrivacyId:int;
|
||||
|
||||
private static var _myWallParameters:Object;
|
||||
|
||||
private static var _isWaitingOnResponse:Boolean;
|
||||
|
||||
private static var _myBlockedMessages:Object;
|
||||
|
||||
private static var _myViewedWalls:Dictionary;
|
||||
|
||||
public static var tokenMap:Object = {};
|
||||
|
||||
public function PlayerWallManager()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function init(param1:MovieClip) : void
|
||||
{
|
||||
PlayerWallXtCommManager.init();
|
||||
_guiLayer = GuiManager.guiLayer;
|
||||
_hudWallBtn = param1;
|
||||
_isFirstTime = true;
|
||||
_hudWallBtn.newPostCount.visible = false;
|
||||
_hudWallBtn.newPostCount.postCountTxt.text = 0;
|
||||
_glowTimer = new Timer(5000);
|
||||
_glowTimer.addEventListener("timer",glowTimerHandler,false,0,true);
|
||||
_openWallUpdateTimer = new Timer(7000);
|
||||
_openWallUpdateTimer.addEventListener("timer",onMessageUpdateTimer,false,0,true);
|
||||
_myPlayerWallClosedTimer = new Timer(60000);
|
||||
_myPlayerWallClosedTimer.addEventListener("timer",onMessageUpdateTimer,false,0,true);
|
||||
_myPlayerWallClosedTimer.start();
|
||||
_myBlockedMessages = {};
|
||||
_myViewedWalls = new Dictionary();
|
||||
var _loc2_:SharedObject = GuiManager.sharedObj;
|
||||
if(_loc2_ && _loc2_.data)
|
||||
{
|
||||
_currentMessageColorId = _loc2_.data.msgColor != null ? _loc2_.data.msgColor : 1;
|
||||
_currentMessagePattern = _loc2_.data.msgPattern != null ? _loc2_.data.msgPattern : 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
_currentMessageColorId = 1;
|
||||
_currentMessagePattern = 1;
|
||||
}
|
||||
_myInbox = new Vector.<PostMessage>();
|
||||
_myNotifications = new Vector.<PostMessage>();
|
||||
_hudWallBtn.addEventListener("mouseDown",playerWallBtnDownHandler,false,0,true);
|
||||
firstTimeRequest();
|
||||
}
|
||||
|
||||
public static function destroy() : void
|
||||
{
|
||||
if(_openWallUpdateTimer)
|
||||
{
|
||||
_openWallUpdateTimer.removeEventListener("timer",onMessageUpdateTimer);
|
||||
_openWallUpdateTimer.reset();
|
||||
_openWallUpdateTimer = null;
|
||||
}
|
||||
if(_myPlayerWallClosedTimer)
|
||||
{
|
||||
_myPlayerWallClosedTimer.removeEventListener("timer",onMessageUpdateTimer);
|
||||
_myPlayerWallClosedTimer.reset();
|
||||
_myPlayerWallClosedTimer = null;
|
||||
}
|
||||
closeWalls();
|
||||
}
|
||||
|
||||
public static function closeWalls() : void
|
||||
{
|
||||
if(_myPlayerWall)
|
||||
{
|
||||
_myPlayerWall.destroy();
|
||||
_myPlayerWall = null;
|
||||
}
|
||||
if(_strangersPlayerWall)
|
||||
{
|
||||
_strangersPlayerWall.destroy();
|
||||
_strangersPlayerWall = null;
|
||||
}
|
||||
}
|
||||
|
||||
public static function closeOpenPlayerWallDueToTokenFailures() : void
|
||||
{
|
||||
onMyPlayerWallClose(true);
|
||||
onStrangerPlayerWallClose();
|
||||
}
|
||||
|
||||
public static function setForWaitingOnWallResponse(param1:Boolean) : void
|
||||
{
|
||||
_isWaitingOnResponse = param1;
|
||||
}
|
||||
|
||||
public static function ownerNameOfCurrentOpenWall() : String
|
||||
{
|
||||
if(_myPlayerWall && _myPlayerWall.isCurrentlyActive)
|
||||
{
|
||||
return _myPlayerWall.owner;
|
||||
}
|
||||
if(_strangersPlayerWall)
|
||||
{
|
||||
return _strangersPlayerWall.owner;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public static function isMyWallOpen() : Boolean
|
||||
{
|
||||
return _myPlayerWall != null;
|
||||
}
|
||||
|
||||
public static function checkAndRemoveMasterpieceItems(param1:IntItemCollection, param2:Function = null) : void
|
||||
{
|
||||
var _loc3_:Array = null;
|
||||
var _loc5_:IntItemCollection = new IntItemCollection();
|
||||
if(_myWallParameters && _myWallParameters.mp)
|
||||
{
|
||||
_loc3_ = _myWallParameters.mp;
|
||||
loop0:
|
||||
for each(var _loc6_:Object in _loc3_)
|
||||
{
|
||||
var _loc8_:int = 0;
|
||||
var _loc7_:Array = param1.getCoreArray();
|
||||
do
|
||||
{
|
||||
for each(var _loc4_:int in _loc7_)
|
||||
{
|
||||
}
|
||||
continue loop0;
|
||||
}
|
||||
while(_loc6_.iid != _loc4_);
|
||||
_loc5_.pushIntItem(_loc4_);
|
||||
}
|
||||
}
|
||||
if(_loc5_.length > 0)
|
||||
{
|
||||
PlayerWallXtCommManager.sendRemoveMasterpiece(_loc5_,param2);
|
||||
}
|
||||
}
|
||||
|
||||
public static function handleTokenResponse(param1:Array, param2:Boolean) : void
|
||||
{
|
||||
if(param1[2] == "1")
|
||||
{
|
||||
tokenMap[param1[6].toLowerCase()] = {
|
||||
"token":param1[3],
|
||||
"read":param1[4],
|
||||
"write":param1[5],
|
||||
"time":0
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
PlayerWallManager.setForWaitingOnWallResponse(false);
|
||||
if(int(param1[2]) == -1)
|
||||
{
|
||||
new SBOkPopup(_guiLayer,LocalizationManager.translateIdOnly(22623));
|
||||
}
|
||||
else if(int(param1[2]) == -2)
|
||||
{
|
||||
new SBOkPopup(_guiLayer,LocalizationManager.translateIdOnly(22624));
|
||||
}
|
||||
else if(param2)
|
||||
{
|
||||
new SBOkPopup(_guiLayer,LocalizationManager.translateIdOnly(22625));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function openStrangersPlayerWall(param1:String, param2:String, param3:String, param4:String = "", param5:Boolean = true) : void
|
||||
{
|
||||
if(param5)
|
||||
{
|
||||
if(_strangersPlayerWall)
|
||||
{
|
||||
_strangersPlayerWall.destroy();
|
||||
_strangersPlayerWall = null;
|
||||
}
|
||||
if(tokenMap[param1.toLowerCase()] != null)
|
||||
{
|
||||
_strangersPlayerWall = new PlayerWallGui();
|
||||
_strangerInbox = new Vector.<PostMessage>();
|
||||
_strangersPlayerWall.init(_strangerInbox,null,param1,param2,param3,"",_currentMessagePattern,_currentMessageColorId,param4,onStrangerPlayerWallClose);
|
||||
}
|
||||
else
|
||||
{
|
||||
PlayerWallXtCommManager.sendWallTokenRequest(param1,openStrangersPlayerWall,{"data":[param1,param2,param3,param4]},true,true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
BuddyManager.setPlayerWallLoading(false);
|
||||
if(_myPlayerWall)
|
||||
{
|
||||
_myPlayerWall.isCurrentlyActive = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function onCheckResponse(param1:Boolean, param2:Object, param3:String, param4:Boolean) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
if(updateTimestamp(param3,param2.t))
|
||||
{
|
||||
PlayerWallXtCommManager.sendGetFromPlayerWall(param3,null,param4);
|
||||
}
|
||||
if(!param4)
|
||||
{
|
||||
_openWallUpdateTimer.reset();
|
||||
_openWallUpdateTimer.start();
|
||||
}
|
||||
else if(_myPlayerWallClosedTimer)
|
||||
{
|
||||
_myPlayerWallClosedTimer.reset();
|
||||
_myPlayerWallClosedTimer.start();
|
||||
}
|
||||
}
|
||||
else if(param2)
|
||||
{
|
||||
if(tokenMap[param3] != null)
|
||||
{
|
||||
delete tokenMap[param3];
|
||||
}
|
||||
if(param2.e == "token")
|
||||
{
|
||||
PlayerWallXtCommManager.sendWallTokenRequest(param3,PlayerWallXtCommManager.ContinueCommandAfterTokenRequest,{
|
||||
"cmd":"CHK",
|
||||
"username":param3,
|
||||
"isFromHudTimer":param4
|
||||
},true,true);
|
||||
}
|
||||
else if(param2.e == "unavailable")
|
||||
{
|
||||
new SBOkPopup(_guiLayer,LocalizationManager.translateIdOnly(22625));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function onGetResponse(param1:Boolean, param2:Vector.<PostMessage>, param3:Vector.<PostMessage>, param4:Object, param5:Boolean, param6:String, param7:String = "", param8:Function = null) : void
|
||||
{
|
||||
var _loc9_:int = 0;
|
||||
var _loc10_:int = 0;
|
||||
if(param1)
|
||||
{
|
||||
if(param5)
|
||||
{
|
||||
if(param2.length > _myInbox.length || param3.length > _myNotifications.length)
|
||||
{
|
||||
if(param2.length > _myInbox.length)
|
||||
{
|
||||
_loc10_ = 0;
|
||||
while(_loc10_ < param2.length)
|
||||
{
|
||||
if(param2[_loc10_].postTime > param4.rdt)
|
||||
{
|
||||
_loc9_++;
|
||||
}
|
||||
_loc10_++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc10_ = 0;
|
||||
while(_loc10_ < param3.length)
|
||||
{
|
||||
if(param3[_loc10_].postTime > param4.rdt)
|
||||
{
|
||||
_loc9_++;
|
||||
}
|
||||
_loc10_++;
|
||||
}
|
||||
}
|
||||
if(_loc9_ > 0)
|
||||
{
|
||||
_hudWallBtn.newPostCount.visible = true;
|
||||
_hudWallBtn.newPostCount.postCountTxt.text = int(_hudWallBtn.newPostCount.postCountTxt.text) + _loc9_;
|
||||
_hudWallBtn.glow.visible = true;
|
||||
_glowTimer.start();
|
||||
}
|
||||
_myInbox = param2.concat();
|
||||
_myNotifications = param3.concat();
|
||||
_myWallParameters = param4;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(param4 == "")
|
||||
{
|
||||
param4 = "19";
|
||||
}
|
||||
if(_myPlayerWall && _myPlayerWall.isCurrentlyActive)
|
||||
{
|
||||
_hudWallBtn.newPostCount.visible = false;
|
||||
_hudWallBtn.glow.visible = false;
|
||||
_glowTimer.reset();
|
||||
_hudWallBtn.newPostCount.postCountTxt.text = 0;
|
||||
isFirstTime = false;
|
||||
_myWallParameters = param4;
|
||||
_myPlayerWall.currWallParameters = param4;
|
||||
_myNotifications = param3.concat();
|
||||
_myInbox = _myPlayerWall.reloadMessages(param2.concat(),_myNotifications,0);
|
||||
}
|
||||
else if(_strangersPlayerWall)
|
||||
{
|
||||
_strangersPlayerWall.currWallParameters = param4;
|
||||
_strangerInbox = _strangersPlayerWall.reloadMessages(param2.concat(),null,0);
|
||||
}
|
||||
}
|
||||
if(!param5 && _openWallUpdateTimer)
|
||||
{
|
||||
_openWallUpdateTimer.reset();
|
||||
_openWallUpdateTimer.start();
|
||||
}
|
||||
else if(_myPlayerWallClosedTimer)
|
||||
{
|
||||
_myPlayerWallClosedTimer.reset();
|
||||
_myPlayerWallClosedTimer.start();
|
||||
}
|
||||
}
|
||||
else if(param7 && param7 == "token")
|
||||
{
|
||||
PlayerWallXtCommManager.sendWallTokenRequest(param6,PlayerWallXtCommManager.ContinueCommandAfterTokenRequest,{
|
||||
"cmd":"GET",
|
||||
"username":param6,
|
||||
"wallParameters":param4,
|
||||
"isFromHudTimer":param5,
|
||||
"callback":param8
|
||||
},true,true);
|
||||
}
|
||||
}
|
||||
|
||||
public static function processMessageUpdate(param1:String, param2:String) : void
|
||||
{
|
||||
var _loc3_:PostMessage = null;
|
||||
var _loc4_:int = 0;
|
||||
var _loc5_:Vector.<PostMessage> = new Vector.<PostMessage>();
|
||||
if(_myPlayerWall && _myPlayerWall.isCurrentlyActive)
|
||||
{
|
||||
_loc5_ = _myInbox;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc5_ = _strangerInbox;
|
||||
}
|
||||
_loc4_ = 0;
|
||||
while(_loc4_ < _loc5_.length)
|
||||
{
|
||||
_loc3_ = _loc5_[_loc4_];
|
||||
if(_loc3_ != null && _loc3_.msgId == param1)
|
||||
{
|
||||
_loc5_[_loc4_].message = param2;
|
||||
if(_myPlayerWall && _myPlayerWall.isCurrentlyActive)
|
||||
{
|
||||
_myInbox = _myPlayerWall.reloadMessages(_loc5_,_myNotifications,2,param2);
|
||||
}
|
||||
else if(_strangersPlayerWall)
|
||||
{
|
||||
_strangerInbox = _strangersPlayerWall.reloadMessages(_loc5_,null,2,param2);
|
||||
}
|
||||
break;
|
||||
}
|
||||
_loc4_++;
|
||||
}
|
||||
}
|
||||
|
||||
public static function onPrivacyResponse(param1:Boolean, param2:int) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
gMainFrame.userInfo.playerWallSettings = param2;
|
||||
}
|
||||
}
|
||||
|
||||
public static function onParametersResponse(param1:Boolean, param2:Object) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
_myWallParameters = param2;
|
||||
}
|
||||
if(_myPlayerWall && _myPlayerWall.isCurrentlyActive)
|
||||
{
|
||||
_myPlayerWall.currWallParameters = _myWallParameters;
|
||||
}
|
||||
}
|
||||
|
||||
public static function onWallCountIncrementResponse(param1:Boolean, param2:String) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
_myViewedWalls[param2] = true;
|
||||
}
|
||||
}
|
||||
|
||||
public static function onBlockedMessagesResponse(param1:Boolean, param2:Object) : void
|
||||
{
|
||||
var _loc4_:Array = null;
|
||||
var _loc3_:int = 0;
|
||||
if(param1)
|
||||
{
|
||||
_loc4_ = param2.r;
|
||||
_loc3_ = 0;
|
||||
while(_loc3_ < _loc4_.length)
|
||||
{
|
||||
_myBlockedMessages[_loc4_[_loc3_]] = _loc4_[_loc3_];
|
||||
_loc3_++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function onSetBlockedMessageResponse(param1:Boolean, param2:String) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
_myBlockedMessages[param2] = param2;
|
||||
if(_myPlayerWall && _myPlayerWall.isCurrentlyActive)
|
||||
{
|
||||
_myInbox = _myPlayerWall.reloadMessages(_myInbox,_myNotifications,3,param2);
|
||||
}
|
||||
else if(_strangersPlayerWall)
|
||||
{
|
||||
_strangerInbox = _strangersPlayerWall.reloadMessages(_strangerInbox,null,3,param2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function onSendClearAllMessagesResponse(param1:Boolean) : void
|
||||
{
|
||||
var _loc2_:* = undefined;
|
||||
if(param1)
|
||||
{
|
||||
_myBlockedMessages = {};
|
||||
_loc2_ = new Vector.<PostMessage>();
|
||||
if(_myPlayerWall)
|
||||
{
|
||||
_myInbox = _myPlayerWall.reloadMessages(new Vector.<PostMessage>(),new Vector.<PostMessage>(),4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function onSendRemoveMasterpieceResponse(param1:Boolean, param2:IntItemCollection) : void
|
||||
{
|
||||
var _loc3_:Object = null;
|
||||
if(param1)
|
||||
{
|
||||
if(_myWallParameters && _myWallParameters.mp)
|
||||
{
|
||||
_loc3_ = _myWallParameters.mp;
|
||||
loop0:
|
||||
for(var _loc5_:int in _loc3_)
|
||||
{
|
||||
var _loc7_:int = 0;
|
||||
var _loc6_:Array = param2.getCoreArray();
|
||||
do
|
||||
{
|
||||
for each(var _loc4_:int in _loc6_)
|
||||
{
|
||||
}
|
||||
continue loop0;
|
||||
}
|
||||
while(_loc3_[_loc5_].iid != _loc4_);
|
||||
delete _loc3_[_loc5_];
|
||||
_myWallParameters.mp = _loc3_;
|
||||
}
|
||||
}
|
||||
if(_myPlayerWall)
|
||||
{
|
||||
_myPlayerWall.currWallParameters = _myWallParameters;
|
||||
_myPlayerWall.reloadMasterpieceItems();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function onSendAcknowledgeNotificationResponse(param1:Boolean, param2:Array) : void
|
||||
{
|
||||
var _loc3_:PostMessage = null;
|
||||
var _loc4_:String = null;
|
||||
var _loc6_:int = 0;
|
||||
var _loc5_:int = 0;
|
||||
if(param1)
|
||||
{
|
||||
if(_myNotifications)
|
||||
{
|
||||
_loc6_ = 0;
|
||||
while(_loc6_ < param2.length)
|
||||
{
|
||||
_loc4_ = param2[_loc6_];
|
||||
_loc5_ = 0;
|
||||
while(_loc5_ < _myNotifications.length)
|
||||
{
|
||||
_loc3_ = _myNotifications[_loc5_];
|
||||
if(_loc3_ && _loc3_.parentMessageId == _loc4_)
|
||||
{
|
||||
_myNotifications[_loc5_].isRead = true;
|
||||
break;
|
||||
}
|
||||
_loc5_++;
|
||||
}
|
||||
_loc6_++;
|
||||
}
|
||||
}
|
||||
if(_myPlayerWall)
|
||||
{
|
||||
_myPlayerWall.currNotifications = _myNotifications;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function get isFirstTime() : Boolean
|
||||
{
|
||||
return _isFirstTime;
|
||||
}
|
||||
|
||||
public static function set isFirstTime(param1:Boolean) : void
|
||||
{
|
||||
_isFirstTime = param1;
|
||||
}
|
||||
|
||||
public static function get myBlockedMessages() : Object
|
||||
{
|
||||
return _myBlockedMessages;
|
||||
}
|
||||
|
||||
public static function get myWallParameters() : Object
|
||||
{
|
||||
return _myWallParameters;
|
||||
}
|
||||
|
||||
public static function get myViewedWalls() : Dictionary
|
||||
{
|
||||
return _myViewedWalls;
|
||||
}
|
||||
|
||||
public static function updateTimestamp(param1:String, param2:Number) : Boolean
|
||||
{
|
||||
var _loc3_:Object = tokenMap[param1.toLowerCase()];
|
||||
if(_loc3_)
|
||||
{
|
||||
if(_loc3_.time < param2)
|
||||
{
|
||||
tokenMap[param1.toLowerCase()].time = param2;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function startMyWallTimer() : void
|
||||
{
|
||||
if(_openWallUpdateTimer)
|
||||
{
|
||||
_openWallUpdateTimer.start();
|
||||
}
|
||||
}
|
||||
|
||||
private static function playerWallBtnDownHandler(param1:Object, param2:Boolean = true) : void
|
||||
{
|
||||
if(param1 is MouseEvent)
|
||||
{
|
||||
if(param1.currentTarget.isGray)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(gMainFrame.userInfo.webPlayerWallSettings != 0)
|
||||
{
|
||||
if(gMainFrame.userInfo.isMember)
|
||||
{
|
||||
if(param1 is MouseEvent)
|
||||
{
|
||||
param1.currentTarget.activateLoadingState(true);
|
||||
param1.stopPropagation();
|
||||
}
|
||||
_myPlayerWallClosedTimer.reset();
|
||||
_hudWallBtn.glow.visible = false;
|
||||
_glowTimer.reset();
|
||||
if(_myPlayerWall)
|
||||
{
|
||||
_myPlayerWall.destroy();
|
||||
_myPlayerWall = null;
|
||||
}
|
||||
if(param2)
|
||||
{
|
||||
RoomManagerWorld.instance.forceStopMovement();
|
||||
if(tokenMap[gMainFrame.userInfo.myUserName.toLowerCase()] != null)
|
||||
{
|
||||
_myPlayerWall = new PlayerWallGui();
|
||||
_myPlayerWall.init(_myInbox,_myNotifications,gMainFrame.server.userName,gMainFrame.userInfo.userNameModerated,gMainFrame.userInfo.myUUID,_statusText,_currentMessagePattern,_currentMessageColorId,"",onMyPlayerWallClose);
|
||||
_hudWallBtn.newPostCount.visible = false;
|
||||
_hudWallBtn.newPostCount.postCountTxt.text = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
PlayerWallXtCommManager.sendWallTokenRequest(gMainFrame.userInfo.myUserName,playerWallBtnDownHandler,gMainFrame.userInfo.myUserName,true,true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GuiManager.mainHud.playerWall.activateLoadingState(false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
UpsellManager.displayPopup("jammerWall","playerWall");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
new SBOkPopup(_guiLayer,LocalizationManager.translateIdOnly(23144));
|
||||
}
|
||||
}
|
||||
|
||||
private static function onMyPlayerWallClose(param1:Boolean = false) : void
|
||||
{
|
||||
_openWallUpdateTimer.reset();
|
||||
if(!param1)
|
||||
{
|
||||
_myPlayerWallClosedTimer.start();
|
||||
}
|
||||
if(_myPlayerWall)
|
||||
{
|
||||
_currentMessageColorId = _myPlayerWall.myCurrMessageColorId;
|
||||
_currentMessagePattern = _myPlayerWall.currMessagePattern;
|
||||
_myPlayerWall.destroy();
|
||||
_myPlayerWall = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static function onStrangerPlayerWallClose() : void
|
||||
{
|
||||
_openWallUpdateTimer.reset();
|
||||
if(_strangersPlayerWall)
|
||||
{
|
||||
_currentMessageColorId = _strangersPlayerWall.myCurrMessageColorId;
|
||||
_currentMessagePattern = _strangersPlayerWall.currMessagePattern;
|
||||
_strangersPlayerWall.destroy();
|
||||
_strangersPlayerWall = null;
|
||||
}
|
||||
if(_myPlayerWall)
|
||||
{
|
||||
_myPlayerWall.isCurrentlyActive = true;
|
||||
}
|
||||
}
|
||||
|
||||
private static function glowTimerHandler(param1:TimerEvent) : void
|
||||
{
|
||||
_glowTimer.stop();
|
||||
_hudWallBtn.glow.visible = false;
|
||||
}
|
||||
|
||||
private static function onMessageUpdateTimer(param1:TimerEvent) : void
|
||||
{
|
||||
var _loc2_:Boolean = false;
|
||||
if(_myPlayerWallClosedTimer || _openWallUpdateTimer)
|
||||
{
|
||||
_loc2_ = param1.currentTarget == _myPlayerWallClosedTimer;
|
||||
if(_loc2_)
|
||||
{
|
||||
_myPlayerWallClosedTimer.reset();
|
||||
}
|
||||
else
|
||||
{
|
||||
_openWallUpdateTimer.reset();
|
||||
}
|
||||
if(_loc2_)
|
||||
{
|
||||
PlayerWallXtCommManager.sendCheckPlayerWall(gMainFrame.userInfo.myUserName,null,true);
|
||||
}
|
||||
else if(_strangersPlayerWall)
|
||||
{
|
||||
PlayerWallXtCommManager.sendCheckPlayerWall(_strangersPlayerWall.owner,null);
|
||||
}
|
||||
else
|
||||
{
|
||||
PlayerWallXtCommManager.sendCheckPlayerWall(gMainFrame.userInfo.myUserName,null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static function firstTimeRequest() : void
|
||||
{
|
||||
PlayerWallXtCommManager.sendWallTokenRequest(gMainFrame.userInfo.myUserName,onInitialTokenGet,null,false);
|
||||
}
|
||||
|
||||
private static function onInitialTokenGet(param1:Boolean) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
PlayerWallXtCommManager.sendGetBlockedMessages(onBlockedMessagesLoaded,param1);
|
||||
}
|
||||
}
|
||||
|
||||
private static function onBlockedMessagesLoaded(param1:Boolean, param2:Object) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
PlayerWallXtCommManager.sendGetFromPlayerWall(gMainFrame.userInfo.myUserName,null,true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,773 @@
|
||||
package playerWall
|
||||
{
|
||||
import buddy.BuddyManager;
|
||||
import collection.IntItemCollection;
|
||||
import com.sbi.client.SFEvent;
|
||||
import com.sbi.debug.DebugUtility;
|
||||
import flash.events.ErrorEvent;
|
||||
import flash.events.Event;
|
||||
import flash.net.URLLoader;
|
||||
import flash.net.URLRequest;
|
||||
import flash.net.URLRequestHeader;
|
||||
import gui.DarkenManager;
|
||||
import gui.GuiManager;
|
||||
import localization.LocalizationManager;
|
||||
|
||||
public class PlayerWallXtCommManager
|
||||
{
|
||||
|
||||
private static var _requestor:URLLoader;
|
||||
|
||||
private static var _deleteResponseCallback:Function;
|
||||
|
||||
private static var _getResponseCallback:Function;
|
||||
|
||||
private static var _putResponseCallback:Function;
|
||||
|
||||
private static var _setSettingsResponseCallback:Function;
|
||||
|
||||
private static var _getSettingsResponseCallback:Function;
|
||||
|
||||
private static var _setParametersResponseCallback:Function;
|
||||
|
||||
private static var _blockedMessagesCallback:Function;
|
||||
|
||||
private static var _setBlockedMessageCallback:Function;
|
||||
|
||||
private static var _wallTokenCallback:Function;
|
||||
|
||||
private static var _checkResponseCallback:Function;
|
||||
|
||||
private static var _sendClearAllMessagesCallback:Function;
|
||||
|
||||
private static var _sendMasterpieceCallback:Function;
|
||||
|
||||
private static var _setCounterIncrementResponseCallback:Function;
|
||||
|
||||
private static var _sendAcknowledgeNotificationCallback:Function;
|
||||
|
||||
private static var _wallTokenPassback:Object;
|
||||
|
||||
private static var _setSettingsId:int;
|
||||
|
||||
private static var _currentRequestUsername:String;
|
||||
|
||||
private static var _messageToPost:PostMessage;
|
||||
|
||||
private static var _currMessageuuid:String;
|
||||
|
||||
private static var _setWallParameters:Object;
|
||||
|
||||
private static var _messageToBeBlocked:String;
|
||||
|
||||
private static var _wallTokenShouldShowFailure:Boolean;
|
||||
|
||||
private static var _masterpieceInvIdsToRemove:IntItemCollection;
|
||||
|
||||
private static var _setCounterIncrementWallOwner:String;
|
||||
|
||||
private static var _sendAcknowledgeMessages:Array;
|
||||
|
||||
private static var _isProcessingRequest:Boolean;
|
||||
|
||||
private static var _currCommand:String;
|
||||
|
||||
private static var _tokenFailures:int;
|
||||
|
||||
private static var _isFromHudTimer:Boolean;
|
||||
|
||||
public function PlayerWallXtCommManager()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function init() : void
|
||||
{
|
||||
_requestor = new URLLoader();
|
||||
}
|
||||
|
||||
public static function destroy() : void
|
||||
{
|
||||
}
|
||||
|
||||
public static function sendWallTokenRequest(param1:String, param2:Function = null, param3:Object = null, param4:Boolean = true, param5:Boolean = false) : void
|
||||
{
|
||||
if(_tokenFailures < 2)
|
||||
{
|
||||
if(param5)
|
||||
{
|
||||
_tokenFailures = _tokenFailures + 1;
|
||||
}
|
||||
PlayerWallManager.setForWaitingOnWallResponse(true);
|
||||
_wallTokenCallback = param2;
|
||||
_wallTokenPassback = param3;
|
||||
_wallTokenShouldShowFailure = param4;
|
||||
gMainFrame.server.setXtObject_Str("wt",[param1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
PlayerWallManager.closeOpenPlayerWallDueToTokenFailures();
|
||||
_tokenFailures = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static function sendSetWallSettingsRequest(param1:int, param2:Function) : void
|
||||
{
|
||||
_setSettingsResponseCallback = param2;
|
||||
_setSettingsId = param1;
|
||||
gMainFrame.server.setXtObject_Str("wss",[param1]);
|
||||
}
|
||||
|
||||
public static function sendGetWallSettingsRequest(param1:String, param2:Function) : void
|
||||
{
|
||||
_getSettingsResponseCallback = param2;
|
||||
gMainFrame.server.setXtObject_Str("wsg",[param1]);
|
||||
}
|
||||
|
||||
public static function sendSetWallParametersRequest(param1:Object, param2:Object, param3:Function) : void
|
||||
{
|
||||
_setParametersResponseCallback = param3;
|
||||
_setWallParameters = param1;
|
||||
gMainFrame.server.setXtObject_Str("wps",[JSON.stringify(param2)]);
|
||||
}
|
||||
|
||||
public static function sendSetWallCounterIncrementRequest(param1:String, param2:Function) : void
|
||||
{
|
||||
_setCounterIncrementResponseCallback = param2;
|
||||
_setCounterIncrementWallOwner = param1;
|
||||
gMainFrame.server.setXtObject_Str("wci",[param1]);
|
||||
}
|
||||
|
||||
public static function handleXtReply(param1:SFEvent) : void
|
||||
{
|
||||
var _loc3_:Array = null;
|
||||
if(!param1.status)
|
||||
{
|
||||
DebugUtility.debugTrace("ERROR: PlayerWallXtCommManager handleXtReply was called with bad evt.status:" + param1.status);
|
||||
return;
|
||||
}
|
||||
var _loc2_:Array = param1.obj;
|
||||
switch(_loc2_[0])
|
||||
{
|
||||
case "wt":
|
||||
PlayerWallManager.handleTokenResponse(_loc2_,_wallTokenShouldShowFailure);
|
||||
if(_wallTokenCallback != null)
|
||||
{
|
||||
if(_wallTokenPassback != null)
|
||||
{
|
||||
if(_wallTokenPassback.hasOwnProperty("data"))
|
||||
{
|
||||
_loc3_ = _wallTokenPassback.data;
|
||||
switch(int(_loc3_.length) - 1)
|
||||
{
|
||||
case 0:
|
||||
_wallTokenCallback(_loc3_[0],_loc2_[2] == "1");
|
||||
break;
|
||||
case 1:
|
||||
_wallTokenCallback(_loc3_[0],_loc3_[1],_loc2_[2] == "1");
|
||||
break;
|
||||
case 2:
|
||||
_wallTokenCallback(_loc3_[0],_loc3_[1],_loc3_[2],_loc2_[2] == "1");
|
||||
break;
|
||||
case 3:
|
||||
_wallTokenCallback(_loc3_[0],_loc3_[1],_loc3_[2],_loc3_[3],_loc2_[2] == "1");
|
||||
break;
|
||||
case 4:
|
||||
_wallTokenCallback(_loc3_[0],_loc3_[1],_loc3_[2],_loc3_[3],_loc3_[4],_loc2_[2] == "1");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_wallTokenCallback(_wallTokenPassback,_loc2_[2] == "1");
|
||||
}
|
||||
_wallTokenPassback = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
_wallTokenCallback(_loc2_[2] == "1");
|
||||
}
|
||||
_wallTokenCallback = null;
|
||||
}
|
||||
break;
|
||||
case "wss":
|
||||
PlayerWallManager.onPrivacyResponse(_loc2_[2] == "1",_setSettingsId);
|
||||
if(_setSettingsResponseCallback != null)
|
||||
{
|
||||
_setSettingsResponseCallback(_loc2_[2] == "1",_setSettingsId);
|
||||
_setSettingsResponseCallback = null;
|
||||
}
|
||||
break;
|
||||
case "wsg":
|
||||
if(_getSettingsResponseCallback != null)
|
||||
{
|
||||
_getSettingsResponseCallback(_loc2_[2]);
|
||||
_getSettingsResponseCallback = null;
|
||||
}
|
||||
break;
|
||||
case "wps":
|
||||
setParametersResponse(_loc2_);
|
||||
break;
|
||||
case "wci":
|
||||
PlayerWallManager.onWallCountIncrementResponse(_loc2_[2] == "1",_setCounterIncrementWallOwner);
|
||||
if(_setCounterIncrementResponseCallback != null)
|
||||
{
|
||||
_setCounterIncrementResponseCallback(_loc2_[2]);
|
||||
_setCounterIncrementResponseCallback = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function sendCheckPlayerWall(param1:String, param2:Function, param3:Boolean = false, param4:Boolean = true) : void
|
||||
{
|
||||
var _loc5_:Object = PlayerWallManager.tokenMap[param1.toLowerCase()];
|
||||
var _loc6_:String = null;
|
||||
if(_loc5_)
|
||||
{
|
||||
_loc6_ = _loc5_.token;
|
||||
}
|
||||
_currentRequestUsername = param1;
|
||||
_checkResponseCallback = param2;
|
||||
_isFromHudTimer = param3;
|
||||
if(_loc6_)
|
||||
{
|
||||
sendServiceRequest({
|
||||
"cmd":"CHK",
|
||||
"t":_loc6_
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
sendWallTokenRequest(param1,sendCheckPlayerWall,{"data":[param1,param2,param3]},!param3,!param4);
|
||||
}
|
||||
}
|
||||
|
||||
public static function sendPutToPlayerWall(param1:String, param2:PostMessage, param3:Object, param4:Function, param5:Boolean = true) : void
|
||||
{
|
||||
var _loc6_:Object = null;
|
||||
var _loc7_:Object = PlayerWallManager.tokenMap[param1.toLowerCase()];
|
||||
var _loc8_:String = null;
|
||||
if(_loc7_)
|
||||
{
|
||||
_loc8_ = _loc7_.token;
|
||||
}
|
||||
_messageToPost = param2;
|
||||
_currentRequestUsername = param1;
|
||||
_putResponseCallback = param4;
|
||||
if(_loc8_)
|
||||
{
|
||||
_loc6_ = {
|
||||
"cmd":"PUT",
|
||||
"t":_loc8_,
|
||||
"sid":param2.senderDbId,
|
||||
"s":param2.patternId,
|
||||
"c":param2.colorId,
|
||||
"m":param2.message,
|
||||
"ai":param2.avtDefId,
|
||||
"ac":param2.avtColors,
|
||||
"ae":param2.avtEyeDefId,
|
||||
"ap":param2.avtPatternDefId,
|
||||
"aci":param2.avtCustomId,
|
||||
"l":param2.localizationId,
|
||||
"p":param3
|
||||
};
|
||||
if(param2.parentMessageId != null && param2.parentMessageId.length > 0)
|
||||
{
|
||||
_loc6_.pp = param2.parentMessageId;
|
||||
}
|
||||
sendServiceRequest(_loc6_);
|
||||
}
|
||||
else
|
||||
{
|
||||
sendWallTokenRequest(param1,sendPutToPlayerWall,{"data":[param1,param4,param2,param3]},true,!param5);
|
||||
}
|
||||
}
|
||||
|
||||
public static function sendDeleteFromPlayerWall(param1:String, param2:String, param3:Function, param4:Boolean = true) : void
|
||||
{
|
||||
var _loc5_:Object = PlayerWallManager.tokenMap[param1.toLowerCase()];
|
||||
var _loc6_:String = null;
|
||||
if(_loc5_)
|
||||
{
|
||||
_loc6_ = _loc5_.token;
|
||||
}
|
||||
_currentRequestUsername = param1;
|
||||
_currMessageuuid = param2;
|
||||
_deleteResponseCallback = param3;
|
||||
if(_loc6_)
|
||||
{
|
||||
sendServiceRequest({
|
||||
"cmd":"DEL",
|
||||
"t":_loc6_,
|
||||
"x":param2
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
sendWallTokenRequest(param1,sendDeleteFromPlayerWall,{"data":[param1,param3,param2]},true,!param4);
|
||||
}
|
||||
}
|
||||
|
||||
public static function sendGetFromPlayerWall(param1:String, param2:Function, param3:Boolean = false, param4:Boolean = true) : void
|
||||
{
|
||||
var _loc5_:Object = PlayerWallManager.tokenMap[param1.toLowerCase()];
|
||||
var _loc6_:String = null;
|
||||
if(_loc5_)
|
||||
{
|
||||
_loc6_ = _loc5_.token;
|
||||
}
|
||||
_currentRequestUsername = param1;
|
||||
_getResponseCallback = param2;
|
||||
_isFromHudTimer = param3;
|
||||
if(_loc6_)
|
||||
{
|
||||
sendServiceRequest({
|
||||
"cmd":"GET",
|
||||
"t":_loc6_
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
sendWallTokenRequest(param1,sendGetFromPlayerWall,{"data":[param1,param2,param3]},true,!param4);
|
||||
}
|
||||
}
|
||||
|
||||
public static function sendGetBlockedMessages(param1:Function, param2:Boolean = true) : void
|
||||
{
|
||||
_blockedMessagesCallback = param1;
|
||||
var _loc3_:Object = PlayerWallManager.tokenMap[gMainFrame.userInfo.myUserName.toLowerCase()];
|
||||
var _loc4_:String = null;
|
||||
if(_loc3_)
|
||||
{
|
||||
_loc4_ = _loc3_.token;
|
||||
}
|
||||
_currentRequestUsername = gMainFrame.userInfo.myUserName;
|
||||
if(_loc4_)
|
||||
{
|
||||
sendServiceRequest({
|
||||
"cmd":"GMB",
|
||||
"t":_loc4_
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
sendWallTokenRequest(_currentRequestUsername,sendGetBlockedMessages,{"callback":param1},true,!param2);
|
||||
}
|
||||
}
|
||||
|
||||
public static function sendSetBlockedMessage(param1:String, param2:Function, param3:Boolean = true) : void
|
||||
{
|
||||
_setBlockedMessageCallback = param2;
|
||||
_messageToBeBlocked = param1;
|
||||
var _loc4_:Object = PlayerWallManager.tokenMap[gMainFrame.userInfo.myUserName.toLowerCase()];
|
||||
var _loc5_:String = null;
|
||||
if(_loc4_)
|
||||
{
|
||||
_loc5_ = _loc4_.token;
|
||||
}
|
||||
_currentRequestUsername = gMainFrame.userInfo.myUserName;
|
||||
if(_loc5_)
|
||||
{
|
||||
sendServiceRequest({
|
||||
"cmd":"AMB",
|
||||
"t":_loc5_,
|
||||
"x":param1
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
sendWallTokenRequest(_currentRequestUsername,sendSetBlockedMessage,{"data":[param2,param1]},true,!param3);
|
||||
}
|
||||
}
|
||||
|
||||
public static function sendClearAllMessages(param1:Function, param2:Boolean = true) : void
|
||||
{
|
||||
_sendClearAllMessagesCallback = param1;
|
||||
var _loc3_:Object = PlayerWallManager.tokenMap[gMainFrame.userInfo.myUserName.toLowerCase()];
|
||||
var _loc4_:String = null;
|
||||
if(_loc3_)
|
||||
{
|
||||
_loc4_ = _loc3_.token;
|
||||
}
|
||||
_currentRequestUsername = gMainFrame.userInfo.myUserName;
|
||||
if(_loc4_)
|
||||
{
|
||||
sendServiceRequest({
|
||||
"cmd":"CLW",
|
||||
"t":_loc4_
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
sendWallTokenRequest(_currentRequestUsername,sendClearAllMessages,{"callback":param1},true,!param2);
|
||||
}
|
||||
}
|
||||
|
||||
public static function sendRemoveMasterpiece(param1:IntItemCollection, param2:Function, param3:Boolean = true) : void
|
||||
{
|
||||
_masterpieceInvIdsToRemove = param1;
|
||||
_sendMasterpieceCallback = param2;
|
||||
var _loc4_:Object = PlayerWallManager.tokenMap[gMainFrame.userInfo.myUserName.toLowerCase()];
|
||||
var _loc5_:String = null;
|
||||
if(_loc4_)
|
||||
{
|
||||
_loc5_ = _loc4_.token;
|
||||
}
|
||||
_currentRequestUsername = gMainFrame.userInfo.myUserName;
|
||||
if(_loc5_)
|
||||
{
|
||||
sendServiceRequest({
|
||||
"cmd":"RMP",
|
||||
"t":_loc5_,
|
||||
"mp":param1.getCoreArray()
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
sendWallTokenRequest(_currentRequestUsername,sendRemoveMasterpiece,{"data":[param2,param1]},true,!param3);
|
||||
}
|
||||
}
|
||||
|
||||
public static function sendAcknowledgeNotificationRequest(param1:Array, param2:Function, param3:Boolean = true) : void
|
||||
{
|
||||
var _loc4_:Object = PlayerWallManager.tokenMap[gMainFrame.userInfo.myUserName.toLowerCase()];
|
||||
var _loc5_:String = null;
|
||||
if(_loc4_)
|
||||
{
|
||||
_loc5_ = _loc4_.token;
|
||||
}
|
||||
_sendAcknowledgeNotificationCallback = param2;
|
||||
_currentRequestUsername = gMainFrame.userInfo.myUserName;
|
||||
_sendAcknowledgeMessages = param1;
|
||||
if(_loc5_)
|
||||
{
|
||||
sendServiceRequest({
|
||||
"cmd":"ACK",
|
||||
"t":_loc5_,
|
||||
"x":param1
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
sendWallTokenRequest(_currentRequestUsername,sendAcknowledgeNotificationRequest,{"data":[param2,param1]},true,!param3);
|
||||
}
|
||||
}
|
||||
|
||||
public static function ContinueCommandAfterTokenRequest(param1:Object, param2:Boolean) : void
|
||||
{
|
||||
var _loc3_:String = null;
|
||||
var _loc4_:String = null;
|
||||
if(param1 && param2)
|
||||
{
|
||||
_loc3_ = param1.cmd;
|
||||
_loc4_ = param1.username;
|
||||
switch(_loc3_)
|
||||
{
|
||||
case "CHK":
|
||||
sendCheckPlayerWall(_loc4_,param1.callback,param1.isFromHudTimer,param2);
|
||||
break;
|
||||
case "PUT":
|
||||
sendPutToPlayerWall(_loc4_,param1.msgToPost,param1.wallParameters,param1.callback,param2);
|
||||
break;
|
||||
case "DEL":
|
||||
sendDeleteFromPlayerWall(_loc4_,param1.messageuuid,param1.callback,param2);
|
||||
break;
|
||||
case "GET":
|
||||
sendGetFromPlayerWall(_loc4_,param1.callback,param1.isFromHudTimer,param2);
|
||||
break;
|
||||
case "GMP":
|
||||
sendGetBlockedMessages(param1.callback,param2);
|
||||
break;
|
||||
case "AMB":
|
||||
sendSetBlockedMessage(param1.messageToBeBlocked,param1.callback,param2);
|
||||
break;
|
||||
case "CLW":
|
||||
sendClearAllMessages(param1.callback,param2);
|
||||
break;
|
||||
case "RMP":
|
||||
sendRemoveMasterpiece(param1.invIdToRemove,param1.callback,param2);
|
||||
break;
|
||||
case "ACK":
|
||||
sendAcknowledgeNotificationRequest(param1.messageId,param1.callback,param2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
PlayerWallManager.closeOpenPlayerWallDueToTokenFailures();
|
||||
}
|
||||
}
|
||||
|
||||
private static function checkResponse(param1:Object) : void
|
||||
{
|
||||
var _loc2_:Boolean = param1 != null ? Boolean(param1.s) : false;
|
||||
PlayerWallManager.onCheckResponse(_loc2_,param1,_currentRequestUsername,_isFromHudTimer);
|
||||
if(_checkResponseCallback != null)
|
||||
{
|
||||
_checkResponseCallback(_loc2_,param1);
|
||||
}
|
||||
}
|
||||
|
||||
private static function deleteResponse(param1:Object) : void
|
||||
{
|
||||
var _loc2_:Boolean = param1 != null ? Boolean(param1.s) : false;
|
||||
if(_deleteResponseCallback != null)
|
||||
{
|
||||
_deleteResponseCallback(_loc2_,_currMessageuuid,param1.e);
|
||||
_deleteResponseCallback = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static function addResponse(param1:Object) : void
|
||||
{
|
||||
var _loc4_:Boolean = param1 != null ? Boolean(param1.PUT.s) : false;
|
||||
var _loc2_:int = int(param1.PUT.cs != null ? param1.PUT.cs : 0);
|
||||
var _loc3_:int = int(param1.PUT.tag != null ? param1.PUT.tag : 0);
|
||||
if(_loc4_)
|
||||
{
|
||||
_messageToPost.msgId = param1.x;
|
||||
_messageToPost.postTime = param1.t;
|
||||
getResponse(param1.GET);
|
||||
}
|
||||
if(_putResponseCallback != null)
|
||||
{
|
||||
_putResponseCallback(_loc4_,_messageToPost,_loc2_,_loc3_,param1.PUT.e);
|
||||
_putResponseCallback = null;
|
||||
}
|
||||
}
|
||||
|
||||
public static function getResponse(param1:Object) : void
|
||||
{
|
||||
var _loc11_:Object = null;
|
||||
var _loc5_:int = 0;
|
||||
var _loc4_:int = 0;
|
||||
var _loc12_:String = null;
|
||||
var _loc10_:Boolean = false;
|
||||
var _loc2_:Array = null;
|
||||
var _loc6_:int = 0;
|
||||
var _loc13_:Array = null;
|
||||
var _loc8_:Object = null;
|
||||
var _loc7_:int = 0;
|
||||
var _loc3_:Vector.<PostMessage> = new Vector.<PostMessage>();
|
||||
var _loc9_:Vector.<PostMessage> = new Vector.<PostMessage>();
|
||||
var _loc14_:Boolean = param1 != null ? Boolean(param1.s) : false;
|
||||
if(_loc14_)
|
||||
{
|
||||
_loc2_ = param1.r;
|
||||
_loc6_ = 0;
|
||||
while(_loc6_ < _loc2_.length)
|
||||
{
|
||||
_loc11_ = _loc2_[_loc6_];
|
||||
if(_loc11_)
|
||||
{
|
||||
_loc12_ = _loc11_.um == 1 ? _loc11_.un : LocalizationManager.translateIdOnly(11098);
|
||||
_loc10_ = _loc11_.u == gMainFrame.userInfo.myUUID ? true : BuddyManager.isBuddy(_loc11_.un);
|
||||
_loc3_.push(new PostMessage(_loc11_.x,_loc11_.m,_loc11_.uid,_loc11_.un,_loc12_,_loc11_.s,_loc11_.c,_loc11_.t,_loc10_,_loc11_.ai,_loc11_.ac,_loc11_.ae,_loc11_.ap,_loc11_.l,_loc11_.aci,_loc11_.pp,"",false));
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc4_++;
|
||||
}
|
||||
_loc6_++;
|
||||
}
|
||||
_loc13_ = param1.n;
|
||||
if(_loc13_ != null && _loc13_.length > 0)
|
||||
{
|
||||
_loc7_ = 0;
|
||||
while(_loc7_ < _loc13_.length)
|
||||
{
|
||||
_loc8_ = _loc13_[_loc7_];
|
||||
if(_loc8_ != null)
|
||||
{
|
||||
_loc12_ = _loc8_.um == 1 ? _loc8_.un : LocalizationManager.translateIdOnly(11098);
|
||||
_loc10_ = _loc8_.un == gMainFrame.userInfo.myUserName ? true : BuddyManager.isBuddy(_loc8_.un);
|
||||
_loc9_.push(new PostMessage(_loc8_.x,_loc8_.m,0,_loc8_.un,_loc12_,0,_loc8_.c,_loc8_.t,_loc10_,_loc8_.ai,_loc8_.ac,_loc8_.ae,_loc8_.ap,_loc8_.l,_loc8_.aci,_loc8_.pp,_loc8_.u,_loc8_.read));
|
||||
}
|
||||
_loc7_++;
|
||||
}
|
||||
_loc9_.sort(orderTimestamp);
|
||||
}
|
||||
PlayerWallManager.updateTimestamp(_currentRequestUsername,param1.t);
|
||||
_loc3_.sort(orderTimestamp);
|
||||
}
|
||||
PlayerWallManager.onGetResponse(_loc14_,_loc3_,_loc9_,param1.p,_isFromHudTimer,_currentRequestUsername,param1.e,_getResponseCallback);
|
||||
if(_getResponseCallback != null)
|
||||
{
|
||||
_getResponseCallback(_loc14_);
|
||||
_getResponseCallback = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static function setSettingsResponse(param1:Array) : void
|
||||
{
|
||||
var _loc2_:Boolean = param1 != null ? Boolean(param1.s) : false;
|
||||
PlayerWallManager.onPrivacyResponse(_loc2_,_setSettingsId);
|
||||
if(_setSettingsResponseCallback != null)
|
||||
{
|
||||
_setSettingsResponseCallback(_loc2_,_setSettingsId);
|
||||
_setSettingsResponseCallback = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static function setParametersResponse(param1:Array) : void
|
||||
{
|
||||
var _loc2_:Boolean = param1[2] == "1";
|
||||
PlayerWallManager.onParametersResponse(_loc2_,_setWallParameters);
|
||||
if(_setParametersResponseCallback != null)
|
||||
{
|
||||
_setParametersResponseCallback(_loc2_,_setWallParameters);
|
||||
_setParametersResponseCallback = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static function getBlockedMessagesResponse(param1:Object) : void
|
||||
{
|
||||
var _loc2_:Boolean = param1 != null ? Boolean(param1.s) : false;
|
||||
PlayerWallManager.onBlockedMessagesResponse(_loc2_,param1);
|
||||
if(_blockedMessagesCallback != null)
|
||||
{
|
||||
_blockedMessagesCallback(_loc2_,param1);
|
||||
_blockedMessagesCallback = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static function setBlockedMessageResponse(param1:Object) : void
|
||||
{
|
||||
var _loc2_:Boolean = param1 != null ? Boolean(param1.s) : false;
|
||||
PlayerWallManager.onSetBlockedMessageResponse(_loc2_,_messageToBeBlocked);
|
||||
if(_setBlockedMessageCallback != null)
|
||||
{
|
||||
_setBlockedMessageCallback(_loc2_,_messageToBeBlocked);
|
||||
_setBlockedMessageCallback = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static function sendClearAllMessagesResponse(param1:Object) : void
|
||||
{
|
||||
var _loc2_:Boolean = param1 != null ? Boolean(param1.s) : false;
|
||||
PlayerWallManager.onSendClearAllMessagesResponse(_loc2_);
|
||||
if(_sendClearAllMessagesCallback != null)
|
||||
{
|
||||
_sendClearAllMessagesCallback(_loc2_);
|
||||
_sendClearAllMessagesCallback = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static function sendRemoveMasterpieceResponse(param1:Object) : void
|
||||
{
|
||||
var _loc2_:Boolean = param1 != null ? Boolean(param1.s) : false;
|
||||
PlayerWallManager.onSendRemoveMasterpieceResponse(_loc2_,_masterpieceInvIdsToRemove);
|
||||
if(_sendMasterpieceCallback != null)
|
||||
{
|
||||
_sendMasterpieceCallback(_loc2_,_masterpieceInvIdsToRemove);
|
||||
_sendMasterpieceCallback = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static function sendAcknowledgeNotificationResponse(param1:Object) : void
|
||||
{
|
||||
var _loc2_:Boolean = param1 != null ? Boolean(param1.s) : false;
|
||||
PlayerWallManager.onSendAcknowledgeNotificationResponse(_loc2_,_sendAcknowledgeMessages);
|
||||
if(_sendAcknowledgeNotificationCallback != null)
|
||||
{
|
||||
_sendAcknowledgeNotificationCallback(_loc2_,_sendAcknowledgeMessages,param1.e);
|
||||
_sendAcknowledgeNotificationCallback = null;
|
||||
}
|
||||
}
|
||||
|
||||
public static function sendServiceRequest(... rest) : void
|
||||
{
|
||||
var _loc3_:URLRequestHeader = null;
|
||||
var _loc4_:String = null;
|
||||
var _loc2_:URLRequest = null;
|
||||
if(!_isProcessingRequest)
|
||||
{
|
||||
_isProcessingRequest = true;
|
||||
_currCommand = rest[0].cmd;
|
||||
_loc3_ = new URLRequestHeader("Content-type","application/json");
|
||||
_loc4_ = JSON.stringify(rest[0]);
|
||||
_loc2_ = new URLRequest(gMainFrame.clientInfo.playerWallHost);
|
||||
_loc2_.method = "POST";
|
||||
_loc2_.requestHeaders.push(_loc3_);
|
||||
_loc2_.data = _loc4_;
|
||||
_requestor = new URLLoader();
|
||||
_requestor.addEventListener("complete",httpRequestComplete);
|
||||
_requestor.addEventListener("ioError",httpRequestError);
|
||||
_requestor.addEventListener("securityError",httpRequestError);
|
||||
_requestor.load(_loc2_);
|
||||
}
|
||||
}
|
||||
|
||||
private static function httpRequestComplete(param1:Event) : void
|
||||
{
|
||||
_isProcessingRequest = false;
|
||||
var _loc2_:Object = param1.target.data != "" ? JSON.parse(param1.target.data) : null;
|
||||
if(_loc2_ != null)
|
||||
{
|
||||
if("s" in _loc2_)
|
||||
{
|
||||
if(_loc2_.s == true)
|
||||
{
|
||||
_tokenFailures = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
switch(_currCommand)
|
||||
{
|
||||
case "CHK":
|
||||
checkResponse(_loc2_);
|
||||
break;
|
||||
case "PUT":
|
||||
addResponse(_loc2_);
|
||||
if(_loc2_.PUT.s == true)
|
||||
{
|
||||
_tokenFailures = 0;
|
||||
}
|
||||
break;
|
||||
case "DEL":
|
||||
deleteResponse(_loc2_);
|
||||
break;
|
||||
case "GET":
|
||||
getResponse(_loc2_);
|
||||
break;
|
||||
case "GMB":
|
||||
getBlockedMessagesResponse(_loc2_);
|
||||
break;
|
||||
case "AMB":
|
||||
setBlockedMessageResponse(_loc2_);
|
||||
break;
|
||||
case "CLW":
|
||||
sendClearAllMessagesResponse(_loc2_);
|
||||
break;
|
||||
case "RMP":
|
||||
sendRemoveMasterpieceResponse(_loc2_);
|
||||
break;
|
||||
case "ACK":
|
||||
sendAcknowledgeNotificationResponse(_loc2_);
|
||||
}
|
||||
}
|
||||
|
||||
private static function httpRequestError(param1:ErrorEvent) : void
|
||||
{
|
||||
_isProcessingRequest = false;
|
||||
if(GuiManager.mainHud.playerWall)
|
||||
{
|
||||
GuiManager.mainHud.playerWall.activateLoadingState(false);
|
||||
}
|
||||
BuddyManager.setPlayerWallLoading(false);
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
}
|
||||
|
||||
private static function orderTimestamp(param1:PostMessage, param2:PostMessage) : int
|
||||
{
|
||||
if(param1.postTime < param2.postTime)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
if(param1.postTime > param2.postTime)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,236 @@
|
||||
package playerWall
|
||||
{
|
||||
public class PostMessage
|
||||
{
|
||||
|
||||
private var _message:String;
|
||||
|
||||
private var _senderUserName:String;
|
||||
|
||||
private var _patternId:int;
|
||||
|
||||
private var _colorId:int;
|
||||
|
||||
private var _msgId:String;
|
||||
|
||||
private var _postTime:Number;
|
||||
|
||||
private var _isBuddy:Boolean;
|
||||
|
||||
private var _senderModeratedUserName:String;
|
||||
|
||||
private var _avtDefId:int;
|
||||
|
||||
private var _avtColors:Array;
|
||||
|
||||
private var _avtEyeDefId:int;
|
||||
|
||||
private var _avtPatternDefId:int;
|
||||
|
||||
private var _senderDbId:int;
|
||||
|
||||
private var _localizationId:int;
|
||||
|
||||
private var _avtCustomId:int;
|
||||
|
||||
private var _parentMessageId:String;
|
||||
|
||||
private var _senderUUID:String;
|
||||
|
||||
private var _isRead:Boolean;
|
||||
|
||||
public function PostMessage(param1:String, param2:String, param3:int, param4:String, param5:String, param6:int, param7:int, param8:Number, param9:Boolean, param10:int, param11:Array, param12:int, param13:int, param14:int, param15:int, param16:String, param17:String, param18:Boolean)
|
||||
{
|
||||
super();
|
||||
_msgId = param1;
|
||||
_message = param2;
|
||||
_senderDbId = param3;
|
||||
_senderUserName = param4;
|
||||
_patternId = param6;
|
||||
_colorId = param7;
|
||||
_postTime = param8;
|
||||
_isBuddy = param9;
|
||||
_senderModeratedUserName = param5;
|
||||
_avtDefId = param10;
|
||||
_avtColors = param11;
|
||||
_avtEyeDefId = param12;
|
||||
_avtPatternDefId = param13;
|
||||
_avtCustomId = param15;
|
||||
_localizationId = param14;
|
||||
_parentMessageId = param16;
|
||||
_senderUUID = param17;
|
||||
_isRead = param18;
|
||||
}
|
||||
|
||||
public function get msgId() : String
|
||||
{
|
||||
return _msgId;
|
||||
}
|
||||
|
||||
public function get message() : String
|
||||
{
|
||||
return _message;
|
||||
}
|
||||
|
||||
public function get senderDbId() : int
|
||||
{
|
||||
return _senderDbId;
|
||||
}
|
||||
|
||||
public function get senderUserName() : String
|
||||
{
|
||||
return _senderUserName;
|
||||
}
|
||||
|
||||
public function get senderModeratedUserName() : String
|
||||
{
|
||||
return _senderModeratedUserName;
|
||||
}
|
||||
|
||||
public function get patternId() : int
|
||||
{
|
||||
return _patternId;
|
||||
}
|
||||
|
||||
public function get colorId() : int
|
||||
{
|
||||
return _colorId;
|
||||
}
|
||||
|
||||
public function get postTime() : Number
|
||||
{
|
||||
return _postTime;
|
||||
}
|
||||
|
||||
public function get isBuddy() : Boolean
|
||||
{
|
||||
return _isBuddy;
|
||||
}
|
||||
|
||||
public function get avtDefId() : int
|
||||
{
|
||||
return _avtDefId;
|
||||
}
|
||||
|
||||
public function get avtColors() : Array
|
||||
{
|
||||
return _avtColors;
|
||||
}
|
||||
|
||||
public function get avtEyeDefId() : int
|
||||
{
|
||||
return _avtEyeDefId;
|
||||
}
|
||||
|
||||
public function get avtPatternDefId() : int
|
||||
{
|
||||
return _avtPatternDefId;
|
||||
}
|
||||
|
||||
public function get localizationId() : int
|
||||
{
|
||||
return _localizationId;
|
||||
}
|
||||
|
||||
public function get avtCustomId() : int
|
||||
{
|
||||
return _avtCustomId;
|
||||
}
|
||||
|
||||
public function get parentMessageId() : String
|
||||
{
|
||||
return _parentMessageId;
|
||||
}
|
||||
|
||||
public function get senderUUID() : String
|
||||
{
|
||||
return _senderUUID;
|
||||
}
|
||||
|
||||
public function get isRead() : Boolean
|
||||
{
|
||||
return _isRead;
|
||||
}
|
||||
|
||||
public function set msgId(param1:String) : void
|
||||
{
|
||||
_msgId = param1;
|
||||
}
|
||||
|
||||
public function set message(param1:String) : void
|
||||
{
|
||||
_message = param1;
|
||||
}
|
||||
|
||||
public function set senderDbId(param1:int) : void
|
||||
{
|
||||
_senderDbId = param1;
|
||||
}
|
||||
|
||||
public function set senderUserName(param1:String) : void
|
||||
{
|
||||
_senderUserName = param1;
|
||||
}
|
||||
|
||||
public function set senderModeratedUserName(param1:String) : void
|
||||
{
|
||||
_senderModeratedUserName = param1;
|
||||
}
|
||||
|
||||
public function set patternId(param1:int) : void
|
||||
{
|
||||
_patternId = param1;
|
||||
}
|
||||
|
||||
public function set colorId(param1:int) : void
|
||||
{
|
||||
_colorId = param1;
|
||||
}
|
||||
|
||||
public function set postTime(param1:Number) : void
|
||||
{
|
||||
_postTime = param1;
|
||||
}
|
||||
|
||||
public function set isBuddy(param1:Boolean) : void
|
||||
{
|
||||
_isBuddy = param1;
|
||||
}
|
||||
|
||||
public function set avtDefId(param1:int) : void
|
||||
{
|
||||
_avtDefId = param1;
|
||||
}
|
||||
|
||||
public function set avtColors(param1:Array) : void
|
||||
{
|
||||
_avtColors = param1;
|
||||
}
|
||||
|
||||
public function set avtEyeDefId(param1:int) : void
|
||||
{
|
||||
_avtEyeDefId = param1;
|
||||
}
|
||||
|
||||
public function set avtPatternDefId(param1:int) : void
|
||||
{
|
||||
_avtPatternDefId = param1;
|
||||
}
|
||||
|
||||
public function set localizationId(param1:int) : void
|
||||
{
|
||||
_localizationId = param1;
|
||||
}
|
||||
|
||||
public function set avtCustomId(param1:int) : void
|
||||
{
|
||||
_avtCustomId = param1;
|
||||
}
|
||||
|
||||
public function set isRead(param1:Boolean) : void
|
||||
{
|
||||
_isRead = param1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
package playerWall
|
||||
{
|
||||
import flash.display.MovieClip;
|
||||
import loader.MediaHelper;
|
||||
|
||||
public class StickerItem extends MovieClip
|
||||
{
|
||||
|
||||
private var _sticker:MovieClip;
|
||||
|
||||
private var _stickerMediaId:int;
|
||||
|
||||
private var _onLoadedCallback:Function;
|
||||
|
||||
private var _mediaHelper:MediaHelper;
|
||||
|
||||
private var _passback:Object;
|
||||
|
||||
public function StickerItem(param1:int, param2:Function, param3:Object = null)
|
||||
{
|
||||
super();
|
||||
_onLoadedCallback = param2;
|
||||
_passback = param3;
|
||||
_mediaHelper = new MediaHelper();
|
||||
_stickerMediaId = param1;
|
||||
_mediaHelper.init(param1,onStickerLoaded);
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
if(_mediaHelper)
|
||||
{
|
||||
_mediaHelper.destroy();
|
||||
_mediaHelper = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function get mediaId() : int
|
||||
{
|
||||
return _stickerMediaId;
|
||||
}
|
||||
|
||||
public function clone(param1:Function) : StickerItem
|
||||
{
|
||||
return new StickerItem(mediaId,param1);
|
||||
}
|
||||
|
||||
private function onStickerLoaded(param1:MovieClip) : void
|
||||
{
|
||||
_sticker = MovieClip(param1.getChildAt(0));
|
||||
addChild(_sticker);
|
||||
if(_onLoadedCallback.length > 0)
|
||||
{
|
||||
if(_passback != null)
|
||||
{
|
||||
_onLoadedCallback(this,_passback);
|
||||
}
|
||||
else
|
||||
{
|
||||
_onLoadedCallback(this);
|
||||
}
|
||||
}
|
||||
else if(_passback != null)
|
||||
{
|
||||
_onLoadedCallback(_passback);
|
||||
}
|
||||
else
|
||||
{
|
||||
_onLoadedCallback();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user