mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-20 17:37:50 -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,486 @@
|
||||
package playerWall
|
||||
{
|
||||
import com.sbi.popup.SBOkPopup;
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.MouseEvent;
|
||||
import flash.events.TimerEvent;
|
||||
import flash.net.SharedObject;
|
||||
import flash.utils.Timer;
|
||||
import gui.DarkenManager;
|
||||
import gui.GuiManager;
|
||||
import localization.LocalizationManager;
|
||||
|
||||
public class PlayerWallManager
|
||||
{
|
||||
|
||||
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 _unreadCount:int;
|
||||
|
||||
private static var _inbox:Array;
|
||||
|
||||
private static var _strangerInbox:Array;
|
||||
|
||||
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 _currentDecorId:int;
|
||||
|
||||
private static var _myPrivacyId:int;
|
||||
|
||||
private static var _reportedPosts:Array;
|
||||
|
||||
public static const PATTERN_MEDIA_ID:int = 3983;
|
||||
|
||||
public static var tokenMap:Object = new Object();
|
||||
|
||||
public function PlayerWallManager()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function init(param1:MovieClip) : void
|
||||
{
|
||||
PlayerWallXtCommManager.init();
|
||||
_guiLayer = GuiManager.guiLayer;
|
||||
_hudWallBtn = param1;
|
||||
_unreadCount = 0;
|
||||
_isFirstTime = true;
|
||||
_hudWallBtn.newPostCount.visible = false;
|
||||
_hudWallBtn.newPostCount.postCountTxt.text = "";
|
||||
_hudWallBtn.glow.visible = true;
|
||||
_glowTimer = new Timer(5000);
|
||||
_glowTimer.addEventListener(TimerEvent.TIMER,glowTimerHandler,false,0,true);
|
||||
_glowTimer.start();
|
||||
_openWallUpdateTimer = new Timer(15000);
|
||||
_openWallUpdateTimer.addEventListener(TimerEvent.TIMER,onMessageUpdateTimer,false,0,true);
|
||||
_myPlayerWallClosedTimer = new Timer(60000);
|
||||
_myPlayerWallClosedTimer.addEventListener(TimerEvent.TIMER,onMessageUpdateTimer,false,0,true);
|
||||
_myPlayerWallClosedTimer.start();
|
||||
var _loc2_:SharedObject = GuiManager.sharedObj;
|
||||
if(Boolean(_loc2_) && Boolean(_loc2_.data))
|
||||
{
|
||||
_currentMessageColorId = _loc2_.data.msgColor != null ? int(_loc2_.data.msgColor) : 1;
|
||||
_currentMessagePattern = _loc2_.data.msgPattern != null ? int(_loc2_.data.msgPattern) : 1;
|
||||
_currentDecorId = _loc2_.data.decorId != null ? int(_loc2_.data.decorId) : 9;
|
||||
_reportedPosts = _loc2_.data.reportedPosts != null ? _loc2_.data.reportedPosts : [];
|
||||
}
|
||||
else
|
||||
{
|
||||
_currentMessageColorId = 1;
|
||||
_currentMessagePattern = 1;
|
||||
_currentDecorId = 9;
|
||||
_reportedPosts = [];
|
||||
}
|
||||
_inbox = [];
|
||||
_hudWallBtn.addEventListener(MouseEvent.MOUSE_DOWN,playerWallBtnDownHandler,false,0,true);
|
||||
}
|
||||
|
||||
public static function destroy() : void
|
||||
{
|
||||
_openWallUpdateTimer.reset();
|
||||
_openWallUpdateTimer = null;
|
||||
_myPlayerWallClosedTimer.reset();
|
||||
_myPlayerWallClosedTimer = null;
|
||||
}
|
||||
|
||||
public static function closeOpenPlayerWallDueToTokenFailures() : void
|
||||
{
|
||||
onMyPlayerWallClose(true);
|
||||
onStrangerPlayerWallClose();
|
||||
new SBOkPopup(_guiLayer,LocalizationManager.translateIdOnly(22626));
|
||||
}
|
||||
|
||||
public static function handleTokenResponse(param1:Array) : void
|
||||
{
|
||||
if(param1[2] == "1")
|
||||
{
|
||||
tokenMap[param1[4]] = {
|
||||
"token":param1[3],
|
||||
"time":0
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
if(int(param1[2]) == SbiConstants.PLAYER_WALL_TOKEN_LOCKED_FAILURE)
|
||||
{
|
||||
new SBOkPopup(_guiLayer,LocalizationManager.translateIdOnly(22623));
|
||||
}
|
||||
else if(int(param1[2]) == SbiConstants.PLAYER_WALL_TOKEN_BUDDIES_FAILURE)
|
||||
{
|
||||
new SBOkPopup(_guiLayer,LocalizationManager.translateIdOnly(22624));
|
||||
}
|
||||
else
|
||||
{
|
||||
new SBOkPopup(_guiLayer,LocalizationManager.translateIdOnly(22625));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function openStrangersPlayerWall(param1:String, param2:Boolean = true) : void
|
||||
{
|
||||
if(param2)
|
||||
{
|
||||
if(_strangersPlayerWall)
|
||||
{
|
||||
_strangersPlayerWall.destroy();
|
||||
_strangersPlayerWall = null;
|
||||
}
|
||||
if(tokenMap[param1] != null)
|
||||
{
|
||||
_strangersPlayerWall = new PlayerWallGui();
|
||||
_strangerInbox = [];
|
||||
_strangersPlayerWall.init(_strangerInbox,param1,"",_currentMessagePattern,_currentMessageColorId,_currentDecorId,onStrangerPlayerWallClose);
|
||||
}
|
||||
else
|
||||
{
|
||||
PlayerWallXtCommManager.sendWallTokenRequest(param1,openStrangersPlayerWall,param1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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.start();
|
||||
}
|
||||
else
|
||||
{
|
||||
_myPlayerWallClosedTimer.start();
|
||||
}
|
||||
}
|
||||
else if(param2)
|
||||
{
|
||||
if(param2.e == SbiConstants.PLAYER_WALL_FAILURE_TOKEN)
|
||||
{
|
||||
PlayerWallXtCommManager.sendWallTokenRequest(param3,PlayerWallXtCommManager.ContinueCommandAfterTokenRequest,{
|
||||
"cmd":"CHK",
|
||||
"userName":param3,
|
||||
"isFromHudTimer":param4
|
||||
});
|
||||
}
|
||||
else if(param2.e == SbiConstants.PLAYER_WALL_FAILURE_UNAVAILABLE)
|
||||
{
|
||||
new SBOkPopup(_guiLayer,LocalizationManager.translateIdOnly(22625));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function onGetResponse(param1:Boolean, param2:Array, param3:Boolean, param4:String, param5:String = "") : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
if(param3)
|
||||
{
|
||||
if(param2.length > _inbox.length && !isFirstTime)
|
||||
{
|
||||
_unreadCount = param2.length - _inbox.length;
|
||||
_hudWallBtn.newPostCount.visible = true;
|
||||
_hudWallBtn.newPostCount.postCountTxt.text = _unreadCount;
|
||||
_hudWallBtn.glow.visible = true;
|
||||
_glowTimer.start();
|
||||
}
|
||||
}
|
||||
else if(_myPlayerWall)
|
||||
{
|
||||
isFirstTime = false;
|
||||
_inbox = param2.concat();
|
||||
_myPlayerWall.reloadMessages(_inbox);
|
||||
}
|
||||
else if(_strangersPlayerWall)
|
||||
{
|
||||
_strangerInbox = param2.concat();
|
||||
_strangersPlayerWall.reloadMessages(_strangerInbox);
|
||||
}
|
||||
if(!param3)
|
||||
{
|
||||
_openWallUpdateTimer.start();
|
||||
}
|
||||
else
|
||||
{
|
||||
_myPlayerWallClosedTimer.start();
|
||||
}
|
||||
}
|
||||
else if(Boolean(param5) && param5 == SbiConstants.PLAYER_WALL_FAILURE_TOKEN)
|
||||
{
|
||||
PlayerWallXtCommManager.sendWallTokenRequest(param4,PlayerWallXtCommManager.ContinueCommandAfterTokenRequest,{
|
||||
"cmd":"GET",
|
||||
"username":param4,
|
||||
"isFromHudTimer":param3,
|
||||
"callback":null
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public static function processMessagePush(param1:PostMessage) : void
|
||||
{
|
||||
if(_myPlayerWall)
|
||||
{
|
||||
_inbox.unshift(param1);
|
||||
if(_myPlayerWall)
|
||||
{
|
||||
_myPlayerWall.reloadMessages(_inbox);
|
||||
}
|
||||
}
|
||||
else if(_strangersPlayerWall)
|
||||
{
|
||||
_strangerInbox.unshift(param1);
|
||||
_strangersPlayerWall.reloadMessages(_strangerInbox);
|
||||
}
|
||||
}
|
||||
|
||||
public static function processMessageUpdate(param1:String, param2:String) : void
|
||||
{
|
||||
var _loc3_:PostMessage = null;
|
||||
var _loc4_:Array = [];
|
||||
if(_myPlayerWall)
|
||||
{
|
||||
_loc4_ = _inbox;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc4_ = _strangerInbox;
|
||||
}
|
||||
var _loc5_:int = 0;
|
||||
while(_loc5_ < _loc4_.length)
|
||||
{
|
||||
_loc3_ = _loc4_[_loc5_];
|
||||
if(_loc3_ != null && _loc3_.msgId == param1)
|
||||
{
|
||||
_loc3_.message = param2;
|
||||
if(_myPlayerWall)
|
||||
{
|
||||
_myPlayerWall.reloadMessages(_loc4_);
|
||||
}
|
||||
else if(_strangersPlayerWall)
|
||||
{
|
||||
_strangersPlayerWall.reloadMessages(_loc4_);
|
||||
}
|
||||
break;
|
||||
}
|
||||
_loc5_++;
|
||||
}
|
||||
}
|
||||
|
||||
public static function onReportMessage(param1:String) : void
|
||||
{
|
||||
if(_reportedPosts.length > SbiConstants.PLAYER_WALL_MAX_REPORTED_POSTS_SAVED)
|
||||
{
|
||||
_reportedPosts.pop();
|
||||
}
|
||||
_reportedPosts.splice(0,0,param1);
|
||||
if(_strangersPlayerWall)
|
||||
{
|
||||
_strangersPlayerWall.reloadMessages(_strangerInbox);
|
||||
}
|
||||
else if(_myPlayerWall)
|
||||
{
|
||||
_myPlayerWall.reloadMessages(_inbox);
|
||||
}
|
||||
GuiManager.setSharedObj("reportedPosts",_reportedPosts);
|
||||
}
|
||||
|
||||
public static function onDeleteResponse(param1:String, param2:String, param3:Boolean) : void
|
||||
{
|
||||
var _loc4_:String = null;
|
||||
var _loc6_:Boolean = false;
|
||||
var _loc7_:int = 0;
|
||||
var _loc5_:Array = [];
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
if(param3)
|
||||
{
|
||||
_loc6_ = param1 == gMainFrame.userInfo.myUserName;
|
||||
if(_loc6_)
|
||||
{
|
||||
_loc5_ = _inbox;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc5_ = _strangerInbox;
|
||||
}
|
||||
_loc7_ = 0;
|
||||
while(_loc7_ < _loc5_.length)
|
||||
{
|
||||
_loc4_ = _loc5_[_loc7_].msgId;
|
||||
if(_loc4_ == param2)
|
||||
{
|
||||
_loc5_.splice(_loc7_,1);
|
||||
break;
|
||||
}
|
||||
_loc7_++;
|
||||
}
|
||||
}
|
||||
if(_loc6_ && Boolean(_myPlayerWall))
|
||||
{
|
||||
_myPlayerWall.reloadMessages(_loc5_);
|
||||
}
|
||||
else if(_strangersPlayerWall)
|
||||
{
|
||||
_strangersPlayerWall.reloadMessages(_loc5_);
|
||||
}
|
||||
}
|
||||
|
||||
public static function onPrivacyResponse(param1:Boolean, param2:int) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
gMainFrame.userInfo.playerWallSettings = param2;
|
||||
}
|
||||
}
|
||||
|
||||
public static function get isFirstTime() : Boolean
|
||||
{
|
||||
return _isFirstTime;
|
||||
}
|
||||
|
||||
public static function set isFirstTime(param1:Boolean) : void
|
||||
{
|
||||
_isFirstTime = param1;
|
||||
}
|
||||
|
||||
public static function get reportedPostIds() : Array
|
||||
{
|
||||
return _reportedPosts;
|
||||
}
|
||||
|
||||
public static function updateTimestamp(param1:String, param2:Number) : Boolean
|
||||
{
|
||||
var _loc3_:Object = tokenMap[param1];
|
||||
if(_loc3_)
|
||||
{
|
||||
if(_loc3_.time < param2)
|
||||
{
|
||||
tokenMap[param1].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)
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
param1.stopPropagation();
|
||||
}
|
||||
_myPlayerWallClosedTimer.reset();
|
||||
_hudWallBtn.glow.visible = false;
|
||||
_glowTimer.reset();
|
||||
if(_myPlayerWall)
|
||||
{
|
||||
_myPlayerWall.destroy();
|
||||
_myPlayerWall = null;
|
||||
}
|
||||
if(param2)
|
||||
{
|
||||
if(tokenMap[gMainFrame.userInfo.myUserName] != null)
|
||||
{
|
||||
_myPlayerWall = new PlayerWallGui();
|
||||
_myPlayerWall.init(_inbox,gMainFrame.server.userName,_statusText,_currentMessagePattern,_currentMessageColorId,_currentDecorId,onMyPlayerWallClose);
|
||||
_hudWallBtn.newPostCount.visible = false;
|
||||
_hudWallBtn.newPostCount.postCountTxt.text = "";
|
||||
_unreadCount = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
PlayerWallXtCommManager.sendWallTokenRequest(gMainFrame.userInfo.myUserName,playerWallBtnDownHandler,gMainFrame.userInfo.myUserName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static function onMyPlayerWallClose(param1:Boolean = false) : void
|
||||
{
|
||||
_openWallUpdateTimer.reset();
|
||||
if(!param1)
|
||||
{
|
||||
_myPlayerWallClosedTimer.start();
|
||||
}
|
||||
if(_myPlayerWall)
|
||||
{
|
||||
_currentMessageColorId = _myPlayerWall.myCurrMessageColorId;
|
||||
_currentMessagePattern = _myPlayerWall.currMessagePattern;
|
||||
_currentDecorId = _myPlayerWall.currDecorIndex;
|
||||
_myPlayerWall.destroy();
|
||||
_myPlayerWall = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static function onStrangerPlayerWallClose() : void
|
||||
{
|
||||
_openWallUpdateTimer.reset();
|
||||
if(_strangersPlayerWall)
|
||||
{
|
||||
_currentMessageColorId = _strangersPlayerWall.myCurrMessageColorId;
|
||||
_currentMessagePattern = _strangersPlayerWall.currMessagePattern;
|
||||
_strangersPlayerWall.destroy();
|
||||
_strangersPlayerWall = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static function glowTimerHandler(param1:TimerEvent) : void
|
||||
{
|
||||
_glowTimer.stop();
|
||||
_hudWallBtn.glow.visible = false;
|
||||
}
|
||||
|
||||
private static function onMessageUpdateTimer(param1:TimerEvent) : void
|
||||
{
|
||||
var _loc2_:Boolean = 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,403 @@
|
||||
package playerWall
|
||||
{
|
||||
import com.adobe.serialization.json.JSON;
|
||||
import com.sbi.client.SFEvent;
|
||||
import com.sbi.debug.DebugUtility;
|
||||
import flash.events.ErrorEvent;
|
||||
import flash.events.Event;
|
||||
import flash.events.IOErrorEvent;
|
||||
import flash.events.SecurityErrorEvent;
|
||||
import flash.net.URLLoader;
|
||||
import flash.net.URLRequest;
|
||||
import flash.net.URLRequestHeader;
|
||||
import flash.net.URLRequestMethod;
|
||||
import gui.BuddyManager;
|
||||
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 _isFromHudTimer:Boolean;
|
||||
|
||||
private static var _wallTokenCallback:Function;
|
||||
|
||||
private static var _wallTokenPassback:Object;
|
||||
|
||||
private static var _setSettingsId:int;
|
||||
|
||||
private static var _isProcessingRequest:Boolean;
|
||||
|
||||
private static var _currCommand:String;
|
||||
|
||||
private static var _checkResponseCallback:Function;
|
||||
|
||||
private static var _currentRequestUsername:String;
|
||||
|
||||
private static var _messageToPost:PostMessage;
|
||||
|
||||
private static var _currMessageuuid:String;
|
||||
|
||||
private static var _tokenFailures:int;
|
||||
|
||||
private static const PLAYER_WALL_URL:String = "https://playerwall.smartbombinteractive.com:443/wall/";
|
||||
|
||||
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 = false) : void
|
||||
{
|
||||
if(_tokenFailures < 2)
|
||||
{
|
||||
if(param4)
|
||||
{
|
||||
++_tokenFailures;
|
||||
}
|
||||
_wallTokenCallback = param2;
|
||||
_wallTokenPassback = param3;
|
||||
gMainFrame.server.setXtObject_Str("wt",[param1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
PlayerWallManager.closeOpenPlayerWallDueToTokenFailures();
|
||||
_tokenFailures = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static function sendWallSettingsRequest(param1:int, param2:Function) : void
|
||||
{
|
||||
_setSettingsResponseCallback = param2;
|
||||
_setSettingsId = param1;
|
||||
gMainFrame.server.setXtObject_Str("ws",[param1]);
|
||||
}
|
||||
|
||||
public static function handleXtReply(param1:SFEvent) : void
|
||||
{
|
||||
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_);
|
||||
if(_wallTokenCallback != null)
|
||||
{
|
||||
if(_wallTokenPassback != null)
|
||||
{
|
||||
_wallTokenCallback(_wallTokenPassback,_loc2_[2] == "1");
|
||||
_wallTokenPassback = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
_wallTokenCallback(_loc2_[2] == "1");
|
||||
}
|
||||
_wallTokenCallback = null;
|
||||
}
|
||||
break;
|
||||
case "ws":
|
||||
PlayerWallManager.onPrivacyResponse(_loc2_[2] == "1",_setSettingsId);
|
||||
if(_setSettingsResponseCallback != null)
|
||||
{
|
||||
_setSettingsResponseCallback(_loc2_[2] == "1",_setSettingsId);
|
||||
_setSettingsResponseCallback = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function sendCheckPlayerWall(param1:String, param2:Function, param3:Boolean = false) : void
|
||||
{
|
||||
var _loc4_:Object = PlayerWallManager.tokenMap[param1];
|
||||
var _loc5_:String = null;
|
||||
if(_loc4_)
|
||||
{
|
||||
_loc5_ = _loc4_.token;
|
||||
}
|
||||
_currentRequestUsername = param1;
|
||||
_checkResponseCallback = param2;
|
||||
_isFromHudTimer = param3;
|
||||
if(_loc5_)
|
||||
{
|
||||
sendServiceRequest({
|
||||
"cmd":"CHK",
|
||||
"t":_loc5_
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
checkResponse(null);
|
||||
}
|
||||
}
|
||||
|
||||
public static function sendPutToPlayerWall(param1:String, param2:PostMessage, param3:Function) : void
|
||||
{
|
||||
var _loc4_:Object = PlayerWallManager.tokenMap[param1];
|
||||
var _loc5_:String = null;
|
||||
if(_loc4_)
|
||||
{
|
||||
_loc5_ = _loc4_.token;
|
||||
}
|
||||
_messageToPost = param2;
|
||||
_currentRequestUsername = param1;
|
||||
_putResponseCallback = param3;
|
||||
if(_loc5_)
|
||||
{
|
||||
sendServiceRequest({
|
||||
"cmd":"PUT",
|
||||
"t":_loc5_,
|
||||
"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
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
addResponse(null);
|
||||
}
|
||||
}
|
||||
|
||||
public static function sendDeleteFromPlayerWall(param1:String, param2:String, param3:Function) : void
|
||||
{
|
||||
var _loc4_:Object = PlayerWallManager.tokenMap[param1];
|
||||
var _loc5_:String = null;
|
||||
if(_loc4_)
|
||||
{
|
||||
_loc5_ = _loc4_.token;
|
||||
}
|
||||
_currentRequestUsername = param1;
|
||||
_currMessageuuid = param2;
|
||||
_deleteResponseCallback = param3;
|
||||
if(_loc5_)
|
||||
{
|
||||
sendServiceRequest({
|
||||
"cmd":"DEL",
|
||||
"t":_loc5_,
|
||||
"x":param2
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
deleteResponse(null);
|
||||
}
|
||||
}
|
||||
|
||||
public static function sendGetFromPlayerWall(param1:String, param2:Function, param3:Boolean = false) : void
|
||||
{
|
||||
var _loc4_:Object = PlayerWallManager.tokenMap[param1];
|
||||
var _loc5_:String = null;
|
||||
if(_loc4_)
|
||||
{
|
||||
_loc5_ = _loc4_.token;
|
||||
}
|
||||
_currentRequestUsername = param1;
|
||||
_getResponseCallback = param2;
|
||||
_isFromHudTimer = param3;
|
||||
if(_loc5_)
|
||||
{
|
||||
sendServiceRequest({
|
||||
"cmd":"GET",
|
||||
"t":_loc5_
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
getResponse(null);
|
||||
}
|
||||
}
|
||||
|
||||
public static function ContinueCommandAfterTokenRequest(param1:Object, param2:Boolean) : void
|
||||
{
|
||||
var _loc3_:String = null;
|
||||
var _loc4_:String = null;
|
||||
if(Boolean(param1) && param2)
|
||||
{
|
||||
_loc3_ = param1.cmd;
|
||||
_loc4_ = param1.username;
|
||||
switch(_loc3_)
|
||||
{
|
||||
case "CHK":
|
||||
sendCheckPlayerWall(_loc4_,param1.callback,param1.isFromHudTimer);
|
||||
break;
|
||||
case "PUT":
|
||||
sendPutToPlayerWall(_loc4_,param1.msgToPost,param1.callback);
|
||||
break;
|
||||
case "DEL":
|
||||
sendDeleteFromPlayerWall(_loc4_,param1.messageuuid,param1.callback);
|
||||
break;
|
||||
case "GET":
|
||||
sendGetFromPlayerWall(_loc4_,param1.callback,param1.isFromHudTimer);
|
||||
}
|
||||
}
|
||||
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 _loc2_:Boolean = param1 != null ? Boolean(param1.s) : false;
|
||||
var _loc3_:int = param1.cs != null ? int(param1.cs) : 0;
|
||||
if(_loc2_)
|
||||
{
|
||||
_messageToPost.msgId = param1.x;
|
||||
_messageToPost.postTime = param1.t;
|
||||
}
|
||||
if(_putResponseCallback != null)
|
||||
{
|
||||
_putResponseCallback(_loc2_,_messageToPost,_loc3_,param1.e);
|
||||
_putResponseCallback = null;
|
||||
}
|
||||
}
|
||||
|
||||
public static function getResponse(param1:Object) : void
|
||||
{
|
||||
var _loc3_:Object = null;
|
||||
var _loc4_:int = 0;
|
||||
var _loc5_:int = 0;
|
||||
var _loc7_:String = null;
|
||||
var _loc8_:Boolean = false;
|
||||
var _loc9_:Array = null;
|
||||
var _loc10_:int = 0;
|
||||
var _loc2_:Array = [];
|
||||
var _loc6_:Boolean = param1 != null ? Boolean(param1.s) : false;
|
||||
if(_loc6_)
|
||||
{
|
||||
_loc9_ = param1.r;
|
||||
_loc10_ = 0;
|
||||
while(_loc10_ < _loc9_.length)
|
||||
{
|
||||
_loc3_ = _loc9_[_loc10_];
|
||||
if(_loc3_)
|
||||
{
|
||||
_loc7_ = _loc3_.um == 1 ? _loc3_.un : LocalizationManager.translateIdOnly(LocalizationManager.NEW_JAMMER_USERNAME);
|
||||
_loc8_ = _loc3_.u == gMainFrame.userInfo.myUUID ? true : BuddyManager.isBuddy(_loc3_.un);
|
||||
_loc2_.push(new PostMessage(_loc3_.x,_loc3_.m,_loc3_.uid,_loc3_.un,_loc7_,_loc3_.s,_loc3_.c,_loc3_.t,_loc8_,_loc3_.ai,_loc3_.ac,_loc3_.ae,_loc3_.ap,_loc3_.l,_loc3_.aci));
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc5_++;
|
||||
}
|
||||
_loc10_++;
|
||||
}
|
||||
PlayerWallManager.updateTimestamp(_currentRequestUsername,param1.t);
|
||||
}
|
||||
PlayerWallManager.onGetResponse(_loc6_,_loc2_,_isFromHudTimer,_currentRequestUsername,param1.e);
|
||||
if(_getResponseCallback != null)
|
||||
{
|
||||
_getResponseCallback(_loc6_,_loc2_);
|
||||
_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;
|
||||
}
|
||||
}
|
||||
|
||||
public static function sendServiceRequest(... rest) : void
|
||||
{
|
||||
var _loc2_:URLRequestHeader = null;
|
||||
var _loc3_:String = null;
|
||||
var _loc4_:URLRequest = null;
|
||||
if(!_isProcessingRequest)
|
||||
{
|
||||
_isProcessingRequest = true;
|
||||
_currCommand = rest[0].cmd;
|
||||
_loc2_ = new URLRequestHeader("Content-type","application/json");
|
||||
_loc3_ = com.adobe.serialization.json.JSON.encode(rest[0]);
|
||||
_loc4_ = new URLRequest(PLAYER_WALL_URL);
|
||||
_loc4_.method = URLRequestMethod.POST;
|
||||
_loc4_.requestHeaders.push(_loc2_);
|
||||
_loc4_.data = _loc3_;
|
||||
_requestor = new URLLoader();
|
||||
_requestor.addEventListener(Event.COMPLETE,httpRequestComplete);
|
||||
_requestor.addEventListener(IOErrorEvent.IO_ERROR,httpRequestError);
|
||||
_requestor.addEventListener(SecurityErrorEvent.SECURITY_ERROR,httpRequestError);
|
||||
_requestor.load(_loc4_);
|
||||
}
|
||||
}
|
||||
|
||||
private static function httpRequestComplete(param1:Event) : void
|
||||
{
|
||||
_tokenFailures = 0;
|
||||
_isProcessingRequest = false;
|
||||
var _loc2_:Object = param1.target.data != "" ? com.adobe.serialization.json.JSON.decode(param1.target.data) : null;
|
||||
switch(_currCommand)
|
||||
{
|
||||
case "CHK":
|
||||
checkResponse(_loc2_);
|
||||
break;
|
||||
case "PUT":
|
||||
addResponse(_loc2_);
|
||||
break;
|
||||
case "DEL":
|
||||
deleteResponse(_loc2_);
|
||||
break;
|
||||
case "GET":
|
||||
getResponse(_loc2_);
|
||||
}
|
||||
}
|
||||
|
||||
private static function httpRequestError(param1:ErrorEvent) : void
|
||||
{
|
||||
_isProcessingRequest = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,207 @@
|
||||
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;
|
||||
|
||||
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)
|
||||
{
|
||||
super();
|
||||
this._msgId = param1;
|
||||
this._message = param2;
|
||||
this._senderDbId = param3;
|
||||
this._senderUserName = param4;
|
||||
this._patternId = param6;
|
||||
this._colorId = param7;
|
||||
this._postTime = param8;
|
||||
this._isBuddy = param9;
|
||||
this._senderModeratedUserName = param5;
|
||||
this._avtDefId = param10;
|
||||
this._avtColors = param11;
|
||||
this._avtEyeDefId = param12;
|
||||
this._avtPatternDefId = param13;
|
||||
this._avtCustomId = param15;
|
||||
this._localizationId = param14;
|
||||
}
|
||||
|
||||
public function get msgId() : String
|
||||
{
|
||||
return this._msgId;
|
||||
}
|
||||
|
||||
public function get message() : String
|
||||
{
|
||||
return this._message;
|
||||
}
|
||||
|
||||
public function get senderDbId() : int
|
||||
{
|
||||
return this._senderDbId;
|
||||
}
|
||||
|
||||
public function get senderUserName() : String
|
||||
{
|
||||
return this._senderUserName;
|
||||
}
|
||||
|
||||
public function get senderModeratedUserName() : String
|
||||
{
|
||||
return this._senderModeratedUserName;
|
||||
}
|
||||
|
||||
public function get patternId() : int
|
||||
{
|
||||
return this._patternId;
|
||||
}
|
||||
|
||||
public function get colorId() : int
|
||||
{
|
||||
return this._colorId;
|
||||
}
|
||||
|
||||
public function get postTime() : Number
|
||||
{
|
||||
return this._postTime;
|
||||
}
|
||||
|
||||
public function get isBuddy() : Boolean
|
||||
{
|
||||
return this._isBuddy;
|
||||
}
|
||||
|
||||
public function get avtDefId() : int
|
||||
{
|
||||
return this._avtDefId;
|
||||
}
|
||||
|
||||
public function get avtColors() : Array
|
||||
{
|
||||
return this._avtColors;
|
||||
}
|
||||
|
||||
public function get avtEyeDefId() : int
|
||||
{
|
||||
return this._avtEyeDefId;
|
||||
}
|
||||
|
||||
public function get avtPatternDefId() : int
|
||||
{
|
||||
return this._avtPatternDefId;
|
||||
}
|
||||
|
||||
public function get localizationId() : int
|
||||
{
|
||||
return this._localizationId;
|
||||
}
|
||||
|
||||
public function get avtCustomId() : int
|
||||
{
|
||||
return this._avtCustomId;
|
||||
}
|
||||
|
||||
public function set msgId(param1:String) : void
|
||||
{
|
||||
this._msgId = param1;
|
||||
}
|
||||
|
||||
public function set message(param1:String) : void
|
||||
{
|
||||
this._message = param1;
|
||||
}
|
||||
|
||||
public function set senderDbId(param1:int) : void
|
||||
{
|
||||
this._senderDbId = param1;
|
||||
}
|
||||
|
||||
public function set senderUserName(param1:String) : void
|
||||
{
|
||||
this._senderUserName = param1;
|
||||
}
|
||||
|
||||
public function set senderModeratedUserName(param1:String) : void
|
||||
{
|
||||
this._senderModeratedUserName = param1;
|
||||
}
|
||||
|
||||
public function set patternId(param1:int) : void
|
||||
{
|
||||
this._patternId = param1;
|
||||
}
|
||||
|
||||
public function set colorId(param1:int) : void
|
||||
{
|
||||
this._colorId = param1;
|
||||
}
|
||||
|
||||
public function set postTime(param1:Number) : void
|
||||
{
|
||||
this._postTime = param1;
|
||||
}
|
||||
|
||||
public function set isBuddy(param1:Boolean) : void
|
||||
{
|
||||
this._isBuddy = param1;
|
||||
}
|
||||
|
||||
public function set avtDefId(param1:int) : void
|
||||
{
|
||||
this._avtDefId = param1;
|
||||
}
|
||||
|
||||
public function set avtColors(param1:Array) : void
|
||||
{
|
||||
this._avtColors = param1;
|
||||
}
|
||||
|
||||
public function set avtEyeDefId(param1:int) : void
|
||||
{
|
||||
this._avtEyeDefId = param1;
|
||||
}
|
||||
|
||||
public function set avtPatternDefId(param1:int) : void
|
||||
{
|
||||
this._avtPatternDefId = param1;
|
||||
}
|
||||
|
||||
public function set localizationId(param1:int) : void
|
||||
{
|
||||
this._localizationId = param1;
|
||||
}
|
||||
|
||||
public function set avtCustomId(param1:int) : void
|
||||
{
|
||||
this._avtCustomId = param1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user