diff --git a/lib/minigames.js b/lib/minigames.js index 2ab43bc..830286a 100644 --- a/lib/minigames.js +++ b/lib/minigames.js @@ -6,6 +6,7 @@ const defpacks = require("./defpacks.js"); const buddyGames = require("./buddygames.js"); const masterpieces = require("./masterpieces.js"); const dens = require("./dens.js"); +const customItems = require("./customitems.js"); const limits = require("./limits.js"); const {activeAvatar, addClothing, sendClothingAdded} = require("./player.js"); @@ -42,6 +43,7 @@ const {activeAvatar, addClothing, sendClothingAdded} = require("./player.js"); const games = new Map(require("./games.json").map(game => [game.id, game])); +const GAME_AFTERGLOW_MS = 15000; // how long a game's room id is still taken after leaving it (leave) const IN_ROOM = 0; const MAX_GEMS_PER_AWARD = 5000; const MAX_MASTERY_PER_AWARD = 100; @@ -234,6 +236,10 @@ module.exports = ({tell, leaveRoom, findOnline, blocks, watchers}) => { return; } session.game = null; + // an in-room game may say it is done just before it hands over what it + // made (the Juice Bar's smoothie, the Cocoa Hut's drink: an attachment, + // lib/world.js pubMsg), labelled with the game's room + session.lastGame = {roomId: game.roomId, until: Date.now() + GAME_AFTERGLOW_MS}; if (session.bubbleOffOwed) { bubbleOff(session); } @@ -408,8 +414,12 @@ module.exports = ({tell, leaveRoom, findOnline, blocks, watchers}) => { // den items a claw machine can drop: the plushies, of the machine's own // animal when it is named for one ("The Wolf Claw"). let plushies = null; + // the game's own den items only: a custom item (and a player's own, which + // is nobody else's to win) may be missing from the winner's game, whose + // prize popup then threw (DenItem.initShopItem) and left the game frozen. + const gameOwnDenItemIds = () => defpacks.denItemIds().filter(id => id < customItems.FIRST_ID); const clawPrizes = game => { - plushies = plushies || defpacks.denItemIds().filter(id => /plush/i.test(defpacks.denItemDef(id).abbrName)); + plushies = plushies || gameOwnDenItemIds().filter(id => /plush/i.test(defpacks.denItemDef(id).abbrName)); const item = defpacks.denItemIds().map(id => defpacks.denItemDef(id)).find(def => Number(def.gameDefId) === game.id); const animal = item ? /^ArcCraneGame(.+)$/.exec(item.abbrName) : null; const own = animal ? plushies.filter(id => defpacks.denItemDef(id).abbrName.toLowerCase().includes(animal[1].toLowerCase())) : []; @@ -420,7 +430,7 @@ module.exports = ({tell, leaveRoom, findOnline, blocks, watchers}) => { // machines aside. let phantomItems = null; const invasionPrizes = () => { - phantomItems = phantomItems || defpacks.denItemIds().filter(id => /phantom/i.test(defpacks.denItemDef(id).abbrName) + phantomItems = phantomItems || gameOwnDenItemIds().filter(id => /phantom/i.test(defpacks.denItemDef(id).abbrName) && !/^Arc/.test(defpacks.denItemDef(id).abbrName) && defpacks.string(defpacks.denItemDef(id).nameStrId)); return phantomItems.length ? phantomItems : defpacks.denItemIds().slice(0, 1); }; @@ -550,7 +560,7 @@ module.exports = ({tell, leaveRoom, findOnline, blocks, watchers}) => { WindRider: { go() {}, gw(session, game, params, reply) { - const ids = defpacks.clothingIds(); + const ids = defpacks.clothingIds().filter(id => id < customItems.FIRST_ID); const def = Math.random() < SKY_HIGH_PRIZE_CHANCE ? defpacks.itemDef(ids[Math.floor(Math.random() * ids.length)]) : null; session.gamePrize = def ? {def: Number(def.id), color: Number(String(def.colors).split(",")[0])} : null; reply("gw", def ? "1" : "0", def ? def.id : 0, 0, def ? session.gamePrize.color : 0); diff --git a/lib/trades.js b/lib/trades.js index d2af03e..38f138c 100644 --- a/lib/trades.js +++ b/lib/trades.js @@ -15,7 +15,7 @@ const TYPE_CLOTHING = 0; const TYPE_DEN_ITEM = 1; const TYPE_PET = 3; -const MAX_TRADE_ITEMS = 50; +const MAX_TRADE_ITEMS = 200; // on a trade list (the game sets no end to it; past this the rest were dropped) const MAX_PETS = 1000; // as in lib/pets.js // "ti" request steps (first parameter from the client) @@ -46,7 +46,7 @@ const TRADES_KEPT = 50; // per account, for its page const MAX_WAITING_OFFERS = 50; // offers left on one account const MAX_OFFERS_MADE = 20; // by one account, still waiting -module.exports = ({findOnline, blocks}) => { +module.exports = ({findOnline, blocks, showTrading}) => { // TradeManager.onTradeListReceived: [username, clothingCount, (defId, // invIdx, color)..., denItemCount, (defId, invIdx, version, approved, // imageId, creatorDbId, creatorUuid)..., petCount, (speciesId, invIdx, @@ -138,6 +138,8 @@ module.exports = ({findOnline, blocks}) => { const other = trade.requester === session ? trade.owner : trade.requester; trade.requester.trade = trade.owner.trade = null; other.sendXt("ti", -1, status, session.account.username, USERNAME_SHOWN); + showTrading(session); + showTrading(other); }; // moves one entry between accounts. it gets a fresh inventory id, and @@ -209,6 +211,8 @@ module.exports = ({findOnline, blocks}) => { return; } session.trade = owner.trade = {requester: session, owner, wantedType, wanted, offered, accepted: false, confirmed: new Set()}; + showTrading(session); + showTrading(owner); // TradeManager.displayTradeRequested: [0, requesterName, moderatedFlag, // wantedCode, wantedInvIdx, clothingCount, denCount, petCount, ...items] const ofType = type => offered.filter(item => item.type === type); @@ -251,6 +255,8 @@ module.exports = ({findOnline, blocks}) => { } const {requester, owner, wantedType, wanted, offered} = trade; requester.trade = owner.trade = null; + showTrading(requester); + showTrading(owner); // either side may have recycled or re-traded something while deciding. const stillThere = collectionOf(owner.account, wantedType).includes(wanted) && offered.every(item => collectionOf(requester.account, item.type).includes(item.entry)) @@ -312,8 +318,12 @@ module.exports = ({findOnline, blocks}) => { sendTradeList(session, account); }, - // ["1"/"0"]: busy flag while the trade window is open; nothing to answer. - tb() {}, + // ["1"/"0"]: busy flag while the trade window is open; nothing to + // answer. it shows as the trading sign (lib/world.js showTrading). + tb(session, roomId, [busy]) { + session.tradeBusy = busy === "1"; + showTrading(session); + }, ti(session, roomId, params) { switch (params[0]) { diff --git a/lib/world.js b/lib/world.js index 45f6cec..f6651f3 100644 --- a/lib/world.js +++ b/lib/world.js @@ -794,6 +794,10 @@ const handlers = { other.sendXt("au", session.room.id, 1, session.id, count, ...coords, teleport); } } + // a trade going on when they came in: the sign over them again + if (firstUpdate) { + showTrading(session); + } }, // GenericListXtCommManager.handleNewData: [listId, entryType, 4 unused @@ -1343,8 +1347,25 @@ const staffMove = (whoName, toName) => { return {ok: true, room: shown}; }; +// trading: a sign over the animal of a player in a trade, or with the trade +// window open, in everyone else's game (the patched AvatarWorldView. +// setTrading): "xtr" [.., .., sfsId, 1 | 0], told as it changes, and to +// whoever comes into the room (enterRoom). +const isTrading = session => Boolean(session.trade || session.tradeBusy); +const showTrading = session => { + const on = isTrading(session) && Boolean(session.room); + if (Boolean(session.tradingShown) === on) { + return; + } + session.tradingShown = on; + for (const other of watchers(session)) { + other.sendXt("xtr", -1, session.id, on ? 1 : 0); + } +}; + const context = { others: watchers, + showTrading, watchers, findOnline, findBySfsId, @@ -1398,6 +1419,9 @@ const leaveRoom = session => { session.room = null; session.pos = null; delete session.activeAction; + // the sign goes with the animal; it comes back in the next room if the + // trade goes on there (showTrading) + session.tradingShown = false; minigames.roomLeft(session); for (const other of room.sessions) { // AvatarManager.avatarRemoveResponse @@ -1607,6 +1631,9 @@ const enterRoom = (session, name, base, displayName, shardId, props = {}) => { for (const other of others(session)) { if (other.pos && sees(session, other)) { sendAvatarCreate(session, other); + if (other.tradingShown) { + session.sendXt("xtr", -1, other.id, 1); + } } } return room; @@ -1837,7 +1864,9 @@ module.exports = { // embedded SWF labels outgoing user messages with the minigame's // temporary sub-room id. Accept that id as well so its attachment // reward can make the normal round trip back to the avatar. - if (session.room && (session.room.id === msg.roomId || (session.game && session.game.roomId === Number(msg.roomId)))) { + const fromGame = (session.game && session.game.roomId === Number(msg.roomId)) + || (session.lastGame && session.lastGame.roomId === Number(msg.roomId) && Date.now() < session.lastGame.until); + if (session.room && (session.room.id === msg.roomId || fromGame)) { // at most text, type and one extra field, and no essays. const fields = decodeEntities(msg.cdata("txt") || "").split("%").slice(0, 3); if (fields[0].length > config.maxChatLength || (fields[2] || "").length > MAX_CHAT_EXTRA) { diff --git a/swf-src/AJClient.as b/swf-src/AJClient.as index cf5dad7..9b310dd 100644 --- a/swf-src/AJClient.as +++ b/swf-src/AJClient.as @@ -1533,6 +1533,17 @@ package } } + // "xtr": [.., .., sfsId, 1 | 0]: another player trading, or not + // (lib/world.js showTrading). + public static function onTrading(param1:Object) : void + { + var _loc2_:AvatarWorldView = AvatarManager.avatarViewList != null ? AvatarManager.avatarViewList[int(param1[2])] as AvatarWorldView : null; + if(_loc2_ != null) + { + _loc2_.setTrading(String(param1[3]) == "1"); + } + } + // "xyn": [.., .., id, text]. A yes-or-no box; the answer goes back as // "xyn" [id, 1 | 0]. public static function askYesNo(param1:Object) : void diff --git a/swf-src/AvatarEditor.as b/swf-src/AvatarEditor.as index 21a31e8..73e4471 100644 --- a/swf-src/AvatarEditor.as +++ b/swf-src/AvatarEditor.as @@ -2212,6 +2212,15 @@ package gui if(!DenAndClothesItemSelect.moreToCome) { openCloseTradeWindow(); + // the list drawn again with all of it: each item added went into + // an empty window of the list, and with many picked at once + // there were too few of those, so the rest were not shown + if(_itemTradeWindows && avEditor.tradeBtnUp.visible) + { + _itemTradeWindows.destroy(); + _itemTradeWindows = null; + createItemWindows(_currTradesArray,avEditor.itemBlock); + } } } diff --git a/swf-src/AvatarWorldView.as b/swf-src/AvatarWorldView.as index 61bbcbf..51ea100 100644 --- a/swf-src/AvatarWorldView.as +++ b/swf-src/AvatarWorldView.as @@ -241,6 +241,8 @@ package avatar private var _typing:Sprite; + private var _tradingSign:Sprite; + private var _typingDots:Array; private var _typingTimer:Timer; @@ -681,6 +683,8 @@ package avatar } _typing = null; _typingDots = null; + setTrading(false); + _tradingSign = null; removeChild(_namebar); if(_secondaryEmot && _chatLayer.contains(_secondaryEmot)) { @@ -1140,6 +1144,49 @@ package avatar } } + // trading (lib/world.js showTrading): a round sign with two arrows by + // the head, for as long as the trade goes on. a child of the animal's + // own, so it goes where the animal goes. + public function setTrading(param1:Boolean) : void + { + var _loc2_:Point = null; + if(!param1) + { + if(_tradingSign && _tradingSign.parent) + { + _tradingSign.parent.removeChild(_tradingSign); + } + return; + } + if(_tradingSign == null) + { + _tradingSign = new Sprite(); + _tradingSign.mouseEnabled = false; + _tradingSign.mouseChildren = false; + _tradingSign.graphics.lineStyle(2,0x7F6744); + _tradingSign.graphics.beginFill(0xFFF2C4); + _tradingSign.graphics.drawCircle(0,0,12); + _tradingSign.graphics.endFill(); + // an arrow to the right over one to the left + _tradingSign.graphics.lineStyle(2,0x4FA52F,1,false,"normal","round","round"); + _tradingSign.graphics.moveTo(-6,-3); + _tradingSign.graphics.lineTo(6,-3); + _tradingSign.graphics.moveTo(3,-6); + _tradingSign.graphics.lineTo(6,-3); + _tradingSign.graphics.lineTo(3,0); + _tradingSign.graphics.lineStyle(2,0xD4482A,1,false,"normal","round","round"); + _tradingSign.graphics.moveTo(6,4); + _tradingSign.graphics.lineTo(-6,4); + _tradingSign.graphics.moveTo(-3,1); + _tradingSign.graphics.lineTo(-6,4); + _tradingSign.graphics.lineTo(-3,7); + } + _loc2_ = _avatar ? AvatarUtility.getAvatarChatOffset(_avatar.avTypeId) : new Point(0,-80); + _tradingSign.x = _loc2_.x + 26; + _tradingSign.y = _loc2_.y + 16; + addChild(_tradingSign); + } + private function hideTyping() : void { if(_typingTimer) diff --git a/swf-src/MicroSmoothie.as b/swf-src/MicroSmoothie.as new file mode 100644 index 0000000..d53a432 --- /dev/null +++ b/swf-src/MicroSmoothie.as @@ -0,0 +1,551 @@ +package game.microSmoothie +{ + import flash.display.MovieClip; + import flash.display.Sprite; + import flash.events.Event; + import flash.events.KeyboardEvent; + import flash.events.MouseEvent; + import flash.geom.Point; + import flash.utils.getTimer; + import game.GameBase; + import game.IMinigame; + import game.MinigameManager; + import game.SoundManager; + import gskinner.motion.GTween; + + public class MicroSmoothie extends GameBase implements IMinigame + { + + private static const MAX_VELOCITY_X:Number = 900; + + private static const MAX_VELOCITY_Y:Number = 250; + + private static const ACCELERATION_X:Number = 2500; + + private static const ACCELERATION_Y:Number = 450; + + private static const BRAKE_X:Number = 4000; + + private static const BRAKE_Y:Number = 800; + + private static const REQUIRED_FRUITS:int = 10; + + public var _fruitTypesColor:Array; + + public var _fruitTypes:Array; + + public var myId:uint; + + public var _pIDs:Array; + + public var _dbIDs:Array; + + private var _sceneLoaded:Boolean; + + private var _bInit:Boolean; + + public var _layerBack:Sprite; + + public var _layerFront:Sprite; + + public var _layerFruits:Sprite; + + public var _layerCupFront:Sprite; + + private var _lastTime:int; + + private var _frameTime:Number; + + private var _gameTime:Number; + + private var _cupFront:Object; + + private var _cupBack:Object; + + private var _cupFrontMax:Object; + + private var _cupBackMax:Object; + + private var _fruitMachine:Object; + + private var _ready:Object; + + private var _congrats:Object; + + private var _fruitStart:Object; + + public var _leftArrowDown:Boolean; + + public var _rightArrowDown:Boolean; + + public var _downArrowDown:Boolean; + + public var _upArrowDown:Boolean; + + public var _nextFruitTimer:Number; + + public var _congratsTimer:Number; + + public var _velocityX:Number; + + public var _fruitCaught:int; + + public var _smoothieType:int; + + private var _dismissDialogTimer:Number; + + public var _soundMan:SoundManager; + + public var _fruitStartSounds:Array; + + private var _audio:Array = ["slushy_fruit_passby.mp3","slushy_fruit_passby2.mp3","slushy_correct_fruit.mp3","slushy_wrong_fruit.mp3","MG_popup_youWon.mp3"]; + + private var _soundNameFruitStart1:String = _audio[0]; + + private var _soundNameFruitStart2:String = _audio[1]; + + private var _soundNameCorrect:String = _audio[2]; + + private var _soundNameWrong:String = _audio[3]; + + private var _soundNamePlayerWins:String = _audio[4]; + + public function MicroSmoothie() + { + super(); + _fruitTypesColor = new Array("purple","orange","red","yellow"); + _fruitTypes = new Array("grapes","orange","strawberry","banana"); + init(); + } + + private function loadSounds() : void + { + _fruitStartSounds = []; + _soundMan.addSoundByName(_audioByName[_soundNameFruitStart1],_soundNameFruitStart1,0.5); + _soundMan.addSoundByName(_audioByName[_soundNameFruitStart2],_soundNameFruitStart2,0.5); + _fruitStartSounds = new Array(_soundNameFruitStart1,_soundNameFruitStart2); + _soundMan.addSoundByName(_audioByName[_soundNameCorrect],_soundNameCorrect,0.8); + _soundMan.addSoundByName(_audioByName[_soundNameWrong],_soundNameWrong,0.8); + _soundMan.addSoundByName(_audioByName[_soundNamePlayerWins],_soundNamePlayerWins,0.35); + } + + private function keyHandleUp(param1:KeyboardEvent) : void + { + switch(int(param1.keyCode) - 37) + { + case 0: + _leftArrowDown = false; + break; + case 1: + _upArrowDown = false; + break; + case 2: + _rightArrowDown = false; + break; + case 3: + _downArrowDown = false; + } + } + + private function keyHandleDown(param1:KeyboardEvent) : void + { + switch(int(param1.keyCode) - 37) + { + case 0: + _leftArrowDown = true; + break; + case 1: + _upArrowDown = true; + break; + case 2: + _rightArrowDown = true; + break; + case 3: + _downArrowDown = true; + } + } + + public function start(param1:uint, param2:Array) : void + { + myId = param1; + _pIDs = param2; + init(); + } + + public function end(param1:Array) : void + { + releaseBase(); + stage.removeEventListener("keyUp",keyHandleUp); + stage.removeEventListener("keyDown",keyHandleDown); + stage.removeEventListener("enterFrame",heartbeat); + stage.removeEventListener("click",mouseClickHandler); + resetGame(); + _bInit = false; + removeLayer(_layerBack); + removeLayer(_layerFront); + removeLayer(_layerFruits); + removeLayer(_layerCupFront); + removeLayer(_guiLayer); + _layerBack = null; + _layerFront = null; + _layerFruits = null; + _layerCupFront = null; + _guiLayer = null; + MinigameManager.leave(); + } + + private function init() : void + { + if(!_bInit) + { + _layerBack = new Sprite(); + _layerFront = new Sprite(); + _layerFruits = new Sprite(); + _layerCupFront = new Sprite(); + _layerBack.mouseEnabled = false; + _layerFront.mouseEnabled = false; + _layerFruits.mouseEnabled = false; + _layerCupFront.mouseEnabled = false; + _guiLayer = new Sprite(); + addChild(_layerBack); + addChild(_layerFruits); + addChild(_layerFront); + addChild(_layerCupFront); + addChild(_guiLayer); + loadScene("SmoothieAssets/room_main.xroom",_audio); + _bInit = true; + } + else + { + startGame(); + } + } + + override protected function sceneLoaded(param1:Event) : void + { + var _loc3_:int = 0; + var _loc4_:Object = null; + var _loc2_:* = null; + _soundMan = new SoundManager(this); + loadSounds(); + _loc4_ = _scene.getLayer("closeButton"); + addBtn("CloseButton",_loc4_.x,_loc4_.y,onCloseButton); + _cupFront = _scene.getLayer("cupFront"); + _cupBack = _scene.getLayer("cupBack"); + _cupFrontMax = _scene.getLayer("cupFrontMax"); + _cupBackMax = _scene.getLayer("cupBackMax"); + _fruitMachine = _scene.getLayer("smoothieGame"); + _layerBack.addChild(_scene.getLayer("smoothieBackground").loader); + _layerBack.addChild(_cupBack.loader); + _layerFruits.addChild(_fruitMachine.loader); + _layerCupFront.addChild(_cupFront.loader); + _congrats = _scene.getLayer("smoothieSuccess"); + _leftArrowDown = false; + _rightArrowDown = false; + _downArrowDown = false; + _upArrowDown = false; + stage.addEventListener("keyUp",keyHandleUp); + stage.addEventListener("keyDown",keyHandleDown); + _sceneLoaded = true; + stage.addEventListener("enterFrame",heartbeat,false,0,true); + stage.addEventListener("click",mouseClickHandler); + startGame(); + super.sceneLoaded(param1); + } + + public function message(param1:Array) : void + { + var _loc3_:int = 0; + var _loc2_:int = 0; + if(param1[0] != "ml") + { + if(param1[0] == "ms") + { + _dbIDs = []; + _loc2_ = 0; + while(_loc2_ < _pIDs.length) + { + _dbIDs[_loc2_] = param1[_loc2_ + 1]; + _loc2_++; + } + } + else if(param1[0] == "mm") + { + } + } + } + + public function heartbeat(param1:Event) : void + { + var _loc3_:int = 0; + var _loc7_:* = null; + var _loc6_:Point = null; + var _loc5_:int = 0; + var _loc2_:int = 0; + var _loc4_:int = 0; + if(_sceneLoaded) + { + _frameTime = (getTimer() - _lastTime) / 1000; + if(_frameTime > 0.5) + { + _frameTime = 0.5; + } + _lastTime = getTimer(); + if(_sceneLoaded) + { + _gameTime += _frameTime; + if(_fruitCaught < 10) + { + if(_dismissDialogTimer > 0) + { + _dismissDialogTimer -= _frameTime; + if(_dismissDialogTimer <= 0) + { + hideDlg(); + _nextFruitTimer = 1.5; + } + } + else if(_nextFruitTimer >= 0) + { + _loc6_ = localToGlobal(new Point(_cupBack.loader.x,_cupBack.loader.y)); + _loc5_ = int(_fruitMachine.loader.content.detectCollision(_loc6_.x,_loc6_.y,_cupBack.width,_cupBack.height + 75)); + if(_loc5_ >= 0) + { + if(_loc5_ == _smoothieType) + { + _soundMan.playByName(_soundNameCorrect); + _fruitCaught += 2; + updateFruitMeter(); + if(_fruitCaught >= 10) + { + new GTween(_fruitMachine.loader,0.5,{"alpha":0}); + _guiLayer.addChild(_congrats.loader); + _congrats.loader.content.Ready_Text.gotoAndPlay("on"); + if(_closeBtn) + { + _closeBtn.visible = false; + } + // the adventure's own smoothie machine (91) counts + // towards it; any other gives a smoothie, even when + // the game it is was not noted down (-1), where + // before it gave nothing + if(MinigameManager.minigameInfoCache && MinigameManager.minigameInfoCache.currMinigameId == 91) + { + MinigameManager.handleQuestMiniGameComplete(1); + } + else + { + MinigameManager.msg(["_a",2,_fruitTypesColor[_smoothieType]]); + } + _congratsTimer = 3; + _soundMan.playByName(_soundNamePlayerWins); + } + } + else + { + _soundMan.playByName(_soundNameWrong); + _cupFront.loader.content.loseSlush(); + _fruitCaught -= 2; + if(_fruitCaught < 0) + { + _fruitCaught = 0; + } + updateFruitMeter(); + } + } + _nextFruitTimer -= _frameTime; + if(_nextFruitTimer <= 0) + { + _loc2_ = Math.random() * 6; + if(_loc2_ >= 3) + { + _loc2_ = _smoothieType; + } + else if(_smoothieType == _loc2_) + { + _loc2_ = 3; + } + _nextFruitTimer = 0.5 + Math.random() * 0.5; + _fruitMachine.loader.content.createFruit(_loc2_); + _loc4_ = Math.random() * _fruitStartSounds.length; + _soundMan.playByName(_fruitStartSounds[_loc4_]); + } + _cupBack.loader.x = stage.mouseX - _cupFront.width / 2; + _cupFront.loader.x = stage.mouseX - _cupFront.width / 2; + if(_cupFront.loader.x < _cupFront.x) + { + _cupBack.loader.x = _cupBack.x; + _cupFront.loader.x = _cupFront.x; + } + else if(_cupFront.loader.x > _cupFrontMax.x) + { + _cupBack.loader.x = _cupBackMax.x; + _cupFront.loader.x = _cupFrontMax.x; + } + } + } + else + { + _congratsTimer -= _frameTime; + if(_congratsTimer <= 0) + { + end(null); + } + } + } + } + } + + public function updateFruitMeter() : void + { + var _loc1_:int = 2; + if(_fruitCaught > 0) + { + _loc1_ = Math.max(3,_fruitCaught / 10 * 15 + 1); + if(_loc1_ > 16) + { + _loc1_ = 16; + } + } + _cupFront.loader.content.gotoAndStop(_loc1_); + } + + public function updateControls() : void + { + if(stage.mouseX < _cupFront.loader.x + _cupFront.width / 5) + { + _velocityX -= 2500 * _frameTime; + if(_velocityX < -900) + { + _velocityX = -900; + } + } + else if(stage.mouseX > _cupFront.loader.x + 4 * _cupFront.width / 5) + { + _velocityX += 2500 * _frameTime; + if(_velocityX > 900) + { + _velocityX = 900; + } + } + else if(_velocityX > 0) + { + _velocityX -= 4000 * _frameTime; + if(_velocityX < 0) + { + _velocityX = 0; + } + } + else if(_velocityX < 0) + { + _velocityX += 4000 * _frameTime; + if(_velocityX > 0) + { + _velocityX = 0; + } + } + } + + public function startGame() : void + { + var _loc2_:int = 0; + var _loc4_:* = null; + var _loc3_:Number = NaN; + var _loc1_:MovieClip = null; + _gameTime = 0; + _lastTime = getTimer(); + _frameTime = 0; + _nextFruitTimer = -1; + _dismissDialogTimer = 0; + _fruitCaught = 0; + _velocityX = 0; + if(_sceneLoaded) + { + _loc3_ = (_cupFrontMax.x - _cupFront.x) / 2; + _cupFront.loader.x = _cupFront.x + _loc3_; + _cupBack.loader.x = _cupBack.x + _loc3_; + _cupFront.loader.content.gotoAndStop(2); + _loc1_ = showDlg("popup_flavor",[{ + "name":"button_strawberry", + "f":onFlavorStrawberry + },{ + "name":"button_orange", + "f":onFlavorOrange + },{ + "name":"button_banana", + "f":onFlavorBanana + },{ + "name":"button_grape", + "f":onFlavorGrape + }]); + _loc1_.x = 455; + _loc1_.y = 225; + } + } + + public function resetGame() : void + { + var _loc1_:int = 0; + } + + private function mouseClickHandler(param1:MouseEvent) : void + { + if(_sceneLoaded) + { + } + } + + public function onCloseButton() : void + { + end(null); + } + + public function onStart() : void + { + hideDlg(); + if(_ready && _ready.loader.parent) + { + _ready.loader.parent.removeChild(_ready.loader); + } + _nextFruitTimer = 3; + } + + public function selectFlavor(param1:int) : void + { + _smoothieType = param1; + _cupFront.loader.content.slush.gotoAndStop(_fruitTypesColor[_smoothieType]); + hideDlg(); + var _loc2_:MovieClip = showDlg("popup_fillcup",[]); + _loc2_.x = 455; + _loc2_.y = 300; + _loc2_.gotoAndStop(_fruitTypes[_smoothieType]); + _dismissDialogTimer = 3; + addChild(_scene.getLayer("pickedFruit").loader); + } + + public function onFlavorStrawberry() : void + { + _scene.getLayer("pickedFruit").loader.content.gotoAndStop("icon_strawberry"); + selectFlavor(2); + } + + public function onFlavorBanana() : void + { + _scene.getLayer("pickedFruit").loader.content.gotoAndStop("icon_banana"); + selectFlavor(3); + } + + public function onFlavorOrange() : void + { + _scene.getLayer("pickedFruit").loader.content.gotoAndStop("icon_orange"); + selectFlavor(1); + } + + public function onFlavorGrape() : void + { + _scene.getLayer("pickedFruit").loader.content.gotoAndStop("icon_grape"); + selectFlavor(0); + } + } +} + diff --git a/swf-src/MinigameManager.as b/swf-src/MinigameManager.as new file mode 100644 index 0000000..41e5ce8 --- /dev/null +++ b/swf-src/MinigameManager.as @@ -0,0 +1,2101 @@ +package game +{ + import achievement.AchievementManager; + import avatar.Avatar; + import avatar.AvatarManager; + import avatar.AvatarUtility; + import avatar.AvatarView; + import avatar.AvatarWorldView; + import avatar.UserCommXtCommManager; + import avatar.UserInfo; + import com.adobe.utils.StringUtil; + import com.sbi.analytics.SBTracker; + import com.sbi.client.KeepAlive; + import com.sbi.client.SFEvent; + import com.sbi.client.SFRoom; + import com.sbi.debug.DebugUtility; + import com.sbi.popup.SBMessage; + import com.sbi.popup.SBOkPopup; + import com.sbi.popup.SBPopup; + import com.sbi.popup.SBYesNoPopup; + import diamond.DiamondXtCommManager; + import flash.display.DisplayObjectContainer; + import flash.display.MovieClip; + import flash.display.Sprite; + import flash.events.Event; + import flash.events.EventDispatcher; + import flash.events.MouseEvent; + import flash.geom.Point; + import flash.text.TextFormat; + import flash.utils.Dictionary; + import flash.utils.getDefinitionByName; + import flash.utils.getTimer; + import gui.DarkenManager; + import gui.EmoticonUtility; + import gui.GameCardPopup; + import gui.GuiManager; + import gui.LoadingSpiral; + import gui.SafeChatManager; + import gui.UpsellManager; + import loadProgress.LoadProgress; + import loader.MediaHelper; + import localization.LocalizationManager; + import pet.PetDef; + import pet.PetItem; + import pet.PetManager; + import pet.PetXtCommManager; + import pet.WorldPet; + import playerWall.PlayerWallManager; + import quest.QuestManager; + import quest.QuestXtCommManager; + import room.RoomManagerWorld; + import room.RoomXtCommManager; + import shop.MyShopItem; + import shop.ShopManager; + + public class MinigameManager + { + + private static const keepGameBase:GameBase = null; + + public static const PET_SALON_DEF_ID:int = 52; + + public static const PET_SALON_PARTY_DEF_ID:int = 81; + + public static const AVATAR_WIDTH:int = 150; + + public static const AVATAR_HEIGHT:int = 150; + + public static const PET_WASH_DEF_ID:int = 43; + + private static var _userId:int; + + private static var _parentLayer:DisplayObjectContainer; + + private static var _minigameRef:IMinigame; + + private static var _primaryRoomName:String; + + private static var _roomMgr:RoomManagerWorld; + + private static var _gameCardPopup:GameCardPopup; + + private static var _joinGameObj:Object; + + private static var _oldJoinGameObj:Object; + + private static var _onClickParams:Object; + + private static var _joinFrgCallback:Function; + + private static var _inMinigame:Boolean; + + private static var _waitlistP1X:Number; + + private static var _waitlistP2X:Number; + + private static var _waitlistP3X:Number; + + private static var _waitlistP4X:Number; + + private static var _pvpGameDefId:int; + + private static var _pvpUserName:String; + + private static var _pvpUserNameModerated:String; + + private static var _pvpCancelSubRoomId:int = -1; + + private static var _pvpCancelMSReceived:Boolean; + + private static var _buddyGameInviteContent:MovieClip; + + private static var _buddyGamePopup:SBPopup; + + private static var _miniSpiral:LoadingSpiral; + + private static var _pvpMedia:Array; + + private static var _pvpAmISender:Boolean; + + private static var _inInRoomGame:Boolean; + + private static var _frgWaiting:Boolean = false; + + private static var _rejoin:Boolean = false; + + private static var _minReqPlayers:int; + + private static var _maxAllowedPlayers:int; + + private static var joinGameX:int; + + private static var joinGameY:int; + + private static var _roomName:String; + + private static var _waitIds:Array; + + private static var _startData:Array; + + private static var _currentMinigameNonSwf:GameBase; + + private static var _mmToSendWhenRefLoaded:Array; + + private static var _waitListPopup:SBPopup; + + private static var _waitList:MovieClip; + + private static var _gemSerialNumber:int; + + private static var _scoreSN:int; + + private static var _petMasterySerialNumber:int; + + private static var _petMasteryQueuePopup:Boolean; + + private static var _awardGemsQueue:Array; + + private static var _awardMasteryPointsQueue:Array; + + private static var _primaryRoomNameBypass:Boolean; + + private static var _proModeId:int; + + private static var _gameCloseCallback:Function; + + private static var _leaderBoardCache:Dictionary; + + public static var _pvpPromptReplay:Boolean; + + public static var minigameInfoCache:MinigameInfoCache; + + public static const GameTotem:Class = Game_Sign_swf; + + public function MinigameManager() + { + super(); + } + + public static function init(param1:DisplayObjectContainer, param2:RoomManagerWorld) : void + { + _parentLayer = param1; + _roomMgr = param2; + IncludeMinigames.init(); + _primaryRoomName = ""; + _frgWaiting = false; + _inMinigame = false; + _mmToSendWhenRefLoaded = null; + minigameInfoCache = new MinigameInfoCache(); + minigameInfoCache.init(); + _buddyGameInviteContent = GETDEFINITIONBYNAME("BuddyGameInviteContent"); + _buddyGamePopup = new SBPopup(_parentLayer,GETDEFINITIONBYNAME("BuddyGameInviteSkin"),_buddyGameInviteContent,false,true,false,false,true); + _buddyGameInviteContent.invite.visible = false; + _buddyGameInviteContent.request.visible = false; + _buddyGameInviteContent.refuse.visible = false; + _buddyGameInviteContent.invite.cancelBtn.addEventListener("mouseDown",onPVPCloseInvite); + _buddyGameInviteContent.request.noBtn.addEventListener("mouseDown",onPVPNoInvite); + _buddyGameInviteContent.request.okBtn.addEventListener("mouseDown",onPVPYesInvite); + _buddyGameInviteContent.refuse.okBtn.addEventListener("mouseDown",onPVPCloseInvite); + _miniSpiral = new LoadingSpiral(_buddyGameInviteContent.invite,105,37); + _miniSpiral.scaleX = 0.5; + _miniSpiral.scaleY = 0.5; + _pvpMedia = []; + _gemSerialNumber = -1; + _scoreSN = -1; + _petMasterySerialNumber = -1; + _petMasteryQueuePopup = false; + _awardGemsQueue = []; + _awardMasteryPointsQueue = []; + _pvpPromptReplay = false; + _leaderBoardCache = new Dictionary(); + gMainFrame.server.addEventListener("OnJoinRoom",joinRoomHandler,false,0,true); + } + + public static function destroy() : void + { + minigameInfoCache = null; + gMainFrame.server.removeEventListener("OnJoinRoom",joinRoomHandler); + } + + public static function setPrimaryRoomNameBypass() : void + { + _primaryRoomNameBypass = true; + } + + public static function getLeaderBoardCache() : Dictionary + { + return _leaderBoardCache; + } + + public static function leave(param1:Boolean = false, param2:int = 0) : void + { + var _loc4_:Boolean = false; + var _loc3_:String = null; + if(_frgWaiting) + { + _loc4_ = true; + } + if(_inInRoomGame) + { + RoomXtCommManager.sendRoomLeaveRequest(gMainFrame.server.getCurrentRoomId(true)); + } + else + { + if(_primaryRoomName != "") + { + if(gMainFrame.server.isConnected) + { + _loc3_ = _primaryRoomName.slice(0,6); + if(_loc3_ != "quest_") + { + _roomMgr.minigameJoinRoom(_primaryRoomName); + } + else + { + QuestXtCommManager.questFullRoomMinigameComplete(_primaryRoomName,param2); + } + } + } + else if(_frgWaiting) + { + MinigameXtCommManager.sendMinigameJoinRequest(_joinGameObj.typeDefId); + _frgWaiting = false; + } + if(_currentMinigameNonSwf) + { + DarkenManager.unDarken(_currentMinigameNonSwf); + _currentMinigameNonSwf.parent.removeChild(_currentMinigameNonSwf); + _currentMinigameNonSwf = null; + } + } + if(_waitListPopup && _waitListPopup.visible) + { + _waitListPopup.close(); + _waitListPopup.content["p1"].x = _waitlistP1X; + _waitListPopup.content["p2"].x = _waitlistP2X; + _waitListPopup.content["p3"].x = _waitlistP3X; + _waitListPopup.content["p4"].x = _waitlistP4X; + } + leaveGame(_loc4_); + if(_minigameRef) + { + _minigameRef = null; + } + _mmToSendWhenRefLoaded = null; + _roomName = ""; + if(param1) + { + _rejoin = true; + } + _proModeId = 0; + GuiManager.chatHist.reAddKeyListeners(); + } + + private static function leaveGame(param1:Boolean) : void + { + SBTracker.pop(); + if(_minigameRef) + { + KeepAlive.stopKATimer(DisplayObjectContainer(_minigameRef).stage); + } + if(_currentMinigameNonSwf) + { + DarkenManager.unDarken(_currentMinigameNonSwf); + _currentMinigameNonSwf.parent.removeChild(_currentMinigameNonSwf); + _currentMinigameNonSwf = null; + } + GuiManager.handleGameExit(); + _inMinigame = false; + minigameInfoCache.currMinigameId = -1; + gMainFrame.stage.quality = gMainFrame.currStageQuality; + DarkenManager.showLoadingSpiral(false); + if(!_inInRoomGame && !param1) + { + LoadProgress.show(true,10); + } + if(_pvpGameDefId >= 0) + { + if(_pvpPromptReplay) + { + new SBYesNoPopup(GuiManager.guiLayer,LocalizationManager.translateIdOnly(14682),true,onYesNoReplay,{ + "gameDefId":_pvpGameDefId, + "userName":_pvpUserName, + "userNameModerated":_pvpUserNameModerated, + "mediaRefId":minigameInfoCache.getMinigameInfo(_pvpGameDefId).gameLibraryIconMediaId + }); + } + _pvpGameDefId = -1; + _pvpUserName = ""; + _pvpUserNameModerated = ""; + _pvpCancelSubRoomId = -1; + _pvpCancelMSReceived = false; + } + if(_gameCloseCallback != null) + { + _gameCloseCallback(); + _gameCloseCallback = null; + } + if(_inInRoomGame) + { + AvatarManager.showAvtAndChatLayers(true); + PetManager.checkAndOpenMasteryPopup(_petMasteryQueuePopup); + _petMasteryQueuePopup = false; + } + readySelfForPvpGame(null,"",false); + readySelfForQuickMinigame(null,false); + GuiManager.grayOutHudItemsForPrivateLobby(false); + GuiManager.closeJoinGamesPopup(); + if(_waitListPopup) + { + _waitListPopup.destroy(); + _waitListPopup = null; + } + _inInRoomGame = false; + AchievementManager.displayNewAchievements(); + } + + private static function createGameWindow(param1:String = "") : void + { + var _loc2_:Class = null; + if(_pvpGameDefId >= 0) + { + killJoinGamePopup(); + } + _oldJoinGameObj = null; + if(_joinGameObj == null) + { + if(_pvpCancelSubRoomId <= 0) + { + return; + } + gMainFrame.server.setCurrSubRoomId(_pvpCancelSubRoomId); + if(gMainFrame.server.getCurrentRoomId(true) > 0) + { + RoomXtCommManager.sendRoomLeaveRequest(gMainFrame.server.getCurrentRoomId(true),true); + _mmToSendWhenRefLoaded = null; + _pvpCancelMSReceived = false; + } + else + { + _pvpCancelMSReceived = true; + } + return; + } + var _loc3_:String = getGameName(_joinGameObj.typeDefId); + if(_joinGameObj.typeDefId == 48) + { + _loc3_ += " Land"; + } + else if(_joinGameObj.typeDefId == 66) + { + _loc3_ += " Ocean"; + } + SBTracker.push(); + SBTracker.trackPageview("/game/play/minigame/#" + getGameNameId(_joinGameObj.typeDefId)); + if(_waitListPopup && _waitListPopup.content && _waitListPopup.content["waitingTxt"]) + { + LocalizationManager.translateId(_waitListPopup.content["waitingTxt"],11099); + } + var _loc4_:String = IncludeMinigames.minigameFullyQualifiedNames[_joinGameObj.swfName]; + if(_loc4_ != null) + { + _loc2_ = getDefinitionByName(_loc4_) as Class; + if(_loc2_ != null) + { + startGameLoaded(_loc2_); + return; + } + } + throw new Error("Could not launch minigame! joinGameFullyQualifiedName:" + _loc4_ + " _joinGameObj:" + _joinGameObj); + } + + private static function killJoinGamePopup(param1:MouseEvent = null) : void + { + if(_gameCardPopup) + { + _gameCardPopup.destroy(); + _gameCardPopup = null; + } + } + + private static function waitListUpdate() : void + { + } + + private static function sendPVPRequest(param1:int, param2:String) : void + { + MinigameXtCommManager.sendMinigamePvpMsg(param1,0,param2); + } + + private static function sendResponseToPVPRequest(param1:Boolean) : void + { + MinigameXtCommManager.sendMinigamePvpMsg(_pvpGameDefId,param1 ? 0 : 1); + } + + private static function playGame(param1:int, param2:Object = null) : void + { + if(RoomXtCommManager.isSwitching) + { + return; + } + if(param2 != null) + { + _joinGameObj = param2; + } + if(QuestManager.isInPrivateAdventureState) + { + QuestManager.showLeaveQuestLobbyPopup(playGame,param1); + return; + } + _proModeId = param1; + killJoinGamePopup(); + if(_joinGameObj.mi.maxPlayers > 1 && _joinGameObj.mi.maxPlayers <= 4) + { + setupWaitListPopup(true); + } + else + { + launchGame(); + } + } + + private static function setupWaitListPopup(param1:Boolean) : void + { + _waitList = GETDEFINITIONBYNAME("MinigameLobbyContent"); + _waitListPopup = new SBPopup(_parentLayer,GETDEFINITIONBYNAME("MinigameLobbySkin"),_waitList,true,true,false,false,true); + _waitListPopup.content.scaleX = 1; + _waitListPopup.content.scaleY = 1; + _waitListPopup.skin.s["bx"].addEventListener("mouseDown",onSingleMultiplayerPopupXBtn,false,0,true); + _waitList.gameTitleTxt.text = _joinGameObj.name; + _waitList.startBtn.visible = false; + _waitList.waiting_txt.visible = false; + _waitList.player_count_txt.x += _waitList.player_count_txt.width; + LocalizationManager.translateIdAndInsert(_waitList.player_count_txt,11100,_joinGameObj.mi.maxPlayers); + var _loc2_:TextFormat = new TextFormat(); + _loc2_.align = "center"; + _waitList.player_count_txt.setTextFormat(_loc2_); + if(!Utility.canMultiplayer() || !param1) + { + _waitList.multiplayerBtn.activateGrayState(true); + _waitList.startBtn.activateGrayState(true); + } + _waitList.multiplayerBtn.addEventListener("mouseDown",onSingleMultiplayerBtn,false,0,true); + _waitList.singlePlayerBtn.addEventListener("mouseDown",onSingleMultiplayerBtn,false,0,true); + } + + private static function onSingleMultiplayerPopupXBtn(param1:MouseEvent) : void + { + if(_frgWaiting) + { + closeHandler(); + } + else + { + readySelfForPvpGame(null,"",false); + readySelfForQuickMinigame(null,false); + GuiManager.grayOutHudItemsForPrivateLobby(false); + if(_waitListPopup) + { + _waitListPopup.destroy(); + _waitListPopup = null; + } + } + } + + public static function closeAndResetPVPAndMingameJoins() : void + { + if(_frgWaiting) + { + closeHandler(); + } + else + { + UserCommXtCommManager.sendCustomPVPMessage(false,0); + MinigameManager.readySelfForQuickMinigame(null,false); + MinigameManager.readySelfForPvpGame(null,"",false); + GuiManager.grayOutHudItemsForPrivateLobby(false); + } + if(_waitListPopup) + { + _waitListPopup.destroy(); + _waitListPopup = null; + } + readySelfForPvpGame(null,"",false); + readySelfForQuickMinigame(null,false); + GuiManager.grayOutHudItemsForPrivateLobby(false); + } + + private static function onSingleMultiplayerBtn(param1:MouseEvent) : void + { + param1.stopPropagation(); + if(param1.currentTarget.isGray) + { + return; + } + launchGame(param1.currentTarget.name == "multiplayerBtn"); + } + + private static function joinRoomHandler(param1:SFEvent) : void + { + var _loc2_:SFRoom = null; + var _loc3_:SFRoom = null; + if(param1.status) + { + if(param1.obj.subRoom) + { + if(_pvpCancelMSReceived) + { + RoomXtCommManager.sendRoomLeaveRequest(gMainFrame.server.getCurrentRoomId(true),true); + _mmToSendWhenRefLoaded = null; + _pvpCancelMSReceived = false; + return; + } + _loc2_ = param1.obj.room; + if(_loc2_.isGame && _loc2_.isTemp) + { + if(_roomName == "") + { + _roomName = param1.obj.subRoom.name; + } + } + } + else if(param1.roomId > -1) + { + _loc3_ = param1.obj.room; + if(_loc3_.isGame && _loc3_.isTemp && _loc3_.name.substr(0,3) != "den") + { + if(!_primaryRoomNameBypass) + { + _primaryRoomName = _roomName; + _roomName = _loc3_.name; + } + _primaryRoomNameBypass = false; + } + else if(!_inInRoomGame && _primaryRoomName != "") + { + _primaryRoomName = ""; + return; + } + } + } + else if(_roomName != "") + { + DebugUtility.debugTrace("MinigameManager: could not join room! msg:" + param1.message); + } + } + + private static function launchGame(param1:Boolean = false) : void + { + var _loc2_:TextFormat = null; + var _loc6_:AvatarView = null; + var _loc7_:String = null; + var _loc10_:int = 0; + var _loc3_:String = null; + var _loc4_:String = null; + DebugUtility.debugTrace("Launch Game: " + _joinGameObj.name + " typeDefId:" + _joinGameObj.typeDefId); + minigameInfoCache.currMinigameId = _joinGameObj.typeDefId; + _inMinigame = true; + if(!_inInRoomGame && _primaryRoomName != "" && _joinFrgCallback != null) + { + _joinFrgCallback(); + _joinFrgCallback = null; + } + var _loc8_:MinigameInfo = minigameInfoCache.getMinigameInfo(_joinGameObj.typeDefId); + var _loc5_:int = int(_loc8_.minPlayers); + var _loc9_:int = int(_loc8_.maxPlayers); + _minReqPlayers = _loc5_; + _maxAllowedPlayers = _loc9_; + if(_loc9_ > 1 && _loc9_ <= 4 && param1) + { + if(_loc9_ > 2) + { + _waitList.multiplayerBtn.visible = false; + _waitList.singlePlayerBtn.visible = false; + _waitList.waiting_txt.visible = true; + _waitList.startBtn.visible = true; + _waitList.player_count_txt.x -= _waitList.player_count_txt.width; + _loc2_ = new TextFormat(); + _loc2_.align = "right"; + _waitList.player_count_txt.setTextFormat(_loc2_); + _waitlistP1X = _waitList.p1.x; + _waitlistP2X = _waitList.p2.x; + _waitlistP3X = _waitList.p3.x; + _waitlistP4X = _waitList.p4.x; + _waitList.p1.nameBar.name_txt.visible = false; + _waitList.p2.nameBar.name_txt.visible = false; + _waitList.p3.nameBar.name_txt.visible = false; + _waitList.p4.nameBar.name_txt.visible = false; + if(_waitList.p1.char.currentFrameLabel != "up") + { + _waitList.p1.char.gotoAndPlay("up"); + } + _loc6_ = new AvatarView(); + _loc6_.init(AvatarManager.playerAvatar); + _loc6_.playAnim(15,false,0,null,true); + _waitList.p1.char.charLayer.addChild(_loc6_); + _loc7_ = AvatarManager.playerAvatar.avName; + _loc10_ = _loc7_.indexOf(" "); + if(_loc10_ != -1) + { + _loc3_ = _loc7_.substr(0,_loc10_); + _loc4_ = _loc7_.substr(_loc10_ + 1,_loc7_.length); + } + else + { + _loc3_ = _loc7_; + } + _waitList.p1.nameBar.firstName_txt.text = _loc3_; + if(_loc4_) + { + _waitList.p1.nameBar.lastName_txt.text = _loc4_; + } + if(_loc9_ == 2) + { + LocalizationManager.translateId(_waitList.p2.nameBar.firstName_txt,11101); + _waitList.p2.nameBar.lastName_txt.text = ""; + if(_waitList.p2.char.currentFrameLabel != "waiting") + { + _waitList.p2.char.gotoAndPlay("waiting"); + } + _waitList.p3.visible = false; + _waitList.p4.visible = false; + _waitList.p1.x = _waitlistP2X; + _waitList.p2.x = _waitlistP3X; + LocalizationManager.translateIdAndInsert(_waitList["player_count_txt"],11100,2); + } + else if(_loc9_ == 3) + { + LocalizationManager.translateId(_waitList.p2.nameBar.firstName_txt,11101); + _waitList.p2.nameBar.lastName_txt.text = ""; + if(_waitList.p2.char.currentFrameLabel != "waiting") + { + _waitList.p2.char.gotoAndPlay("waiting"); + } + LocalizationManager.translateId(_waitList.p3.nameBar.firstName_txt,11101); + _waitList.p3.nameBar.lastName_txt.text = ""; + if(_waitList.p3.char.currentFrameLabel != "waiting") + { + _waitList.p3.char.gotoAndPlay("waiting"); + } + _waitList.p4.visible = false; + _waitList.p1.x = _waitlistP1X + (_waitlistP2X - _waitlistP1X) * 0.5; + _waitList.p2.x = _waitlistP2X + (_waitlistP3X - _waitlistP2X) * 0.5; + _waitList.p3.x = _waitlistP3X + (_waitlistP4X - _waitlistP3X) * 0.5; + LocalizationManager.translateIdAndInsert(_waitList["player_count_txt"],11100,3); + } + else if(_loc9_ == 4) + { + LocalizationManager.translateId(_waitList.p2.nameBar.firstName_txt,11101); + _waitList.p2.nameBar.lastName_txt.text = ""; + if(_waitList.p2.char.currentFrameLabel != "waiting") + { + _waitList.p2.char.gotoAndPlay("waiting"); + } + LocalizationManager.translateId(_waitList.p3.nameBar.firstName_txt,11101); + _waitList.p3.nameBar.lastName_txt.text = ""; + if(_waitList.p3.char.currentFrameLabel != "waiting") + { + _waitList.p3.char.gotoAndPlay("waiting"); + } + LocalizationManager.translateId(_waitList.p4.nameBar.firstName_txt,11101); + _waitList.p4.nameBar.lastName_txt.text = ""; + if(_waitList.p4.char.currentFrameLabel != "waiting") + { + _waitList.p4.char.gotoAndPlay("waiting"); + } + LocalizationManager.translateIdAndInsert(_waitList["player_count_txt"],11100,4); + } + if(_loc5_ > 1) + { + _waitList["player_count_txt"].text = _waitList["player_count_txt"].text.replace("1",_loc5_); + } + if(_loc5_ < _loc9_) + { + _waitList.startBtn.addEventListener("mouseDown",startNowHandler,false,0,true); + _waitList.startBtn.visible = true; + } + else + { + _waitList.startBtn.visible = false; + } + } + else + { + _waitListPopup.destroy(); + _waitListPopup = null; + } + } + else + { + if(_gameCardPopup) + { + killJoinGamePopup(); + } + DarkenManager.showLoadingSpiral(true); + } + if(AvatarManager.isMyUserInCustomPVPState()) + { + UserCommXtCommManager.sendCustomPVPMessage(false,0); + } + PlayerWallManager.setForWaitingOnWallResponse(false); + if(_inInRoomGame) + { + gMainFrame.server.setToJoinIRG(true); + } + else + { + if(_frgWaiting) + { + throw new Error("if we were already waiting then something went wrong"); + } + _frgWaiting = true; + gMainFrame.server.setToJoinIRG(false); + } + _roomName = gMainFrame.server.getCurrentRoomName(false); + MinigameXtCommManager.sendMinigameJoinRequest(_joinGameObj.typeDefId,false,param1,_proModeId); + } + + private static function startGameLoaded(param1:Class) : void + { + if(_inInRoomGame) + { + _currentMinigameNonSwf = new param1(); + if(_pvpGameDefId >= 0) + { + _buddyGamePopup.close(); + DarkenManager.showLoadingSpiral(true); + } + _parentLayer.addChild(_currentMinigameNonSwf); + _currentMinigameNonSwf.addEventListener("mouseDown",stopMouse,false,0,true); + _currentMinigameNonSwf.addEventListener("mouseMove",stopMouse,false,0,true); + KeepAlive.startKATimer(_currentMinigameNonSwf); + } + else + { + _roomMgr.exitRoom(); + _currentMinigameNonSwf = new param1(); + _parentLayer.addChild(_currentMinigameNonSwf); + _frgWaiting = false; + gMainFrame.stage.focus = null; + if(_joinGameObj.swfName == "Twister" || _joinGameObj.swfName == "FallingPhantoms" || _joinGameObj.swfName == "HorseRace" || _joinGameObj.swfName == "DolphinRace" || _joinGameObj.swfName == "GemBreaker" || _joinGameObj.swfName == "FortSmasher" || _joinGameObj.swfName == "SuperSort" || _joinGameObj.swfName == "FashionShow" || _joinGameObj.swfName == "PillBugs" || _joinGameObj.swfName == "QuestCombat" || _joinGameObj.swfName == "HedgeHog" || _joinGameObj.swfName == "TouchPool" || _joinGameObj.swfName == "ParachuteGlider" || _joinGameObj.swfName == "Pachinko" || _joinGameObj.swfName == "MiniGame_Memory" || _joinGameObj.swfName == "DistanceChallenge" || _joinGameObj.swfName == "PhantomFighter" || _joinGameObj.swfName == "QuestParachuteGlider" || _joinGameObj.swfName == "TowerDefense" || _joinGameObj.swfName == "EagleFlap" || _joinGameObj.swfName == "SpotOn" || _joinGameObj.swfName == "TrueFalse" || _joinGameObj.swfName == "Trivia" || _joinGameObj.swfName == "FastFoodies") + { + gMainFrame.stage.quality = gMainFrame.currStageQuality; + } + else if(_joinGameObj.swfName == "ArtStudioPrint" || _joinGameObj.swfName == "ArtPrintPlayPortrait" || _joinGameObj.swfName == "ArtStudioColor" || _joinGameObj.swfName == "ArtStudioPottery" || _joinGameObj.swfName == "ArtStudioPainting" || _joinGameObj.swfName == "ArtStudioGridDrawing" || _joinGameObj.swfName == "BradyExpeditions" || _joinGameObj.swfName == "MicroMiraSays" || _joinGameObj.swfName == "MoatMadness" || _joinGameObj.swfName == "PhantomsTreasure") + { + gMainFrame.stage.quality = "high"; + } + else + { + gMainFrame.stage.quality = "low"; + } + if(_joinGameObj.swfName == "TrueFalse") + { + GuiManager.enableGameHud(true,"game"); + GuiManager.mainHud.parent.setChildIndex(GuiManager.mainHud,GuiManager.mainHud.parent.numChildren - 1); + } + } + if(_waitListPopup && _waitListPopup.visible) + { + _waitListPopup.close(); + _waitListPopup.content["p1"].x = _waitlistP1X; + _waitListPopup.content["p2"].x = _waitlistP2X; + _waitListPopup.content["p3"].x = _waitlistP3X; + _waitListPopup.content["p4"].x = _waitlistP4X; + } + DarkenManager.darken(_currentMinigameNonSwf); + _minigameRef = IMinigame(_currentMinigameNonSwf); + var _loc4_:int = parseInt(_startData[2]); + DebugUtility.debugTrace("numPlayers:" + _loc4_); + var _loc3_:Array = new Array(_loc4_); + var _loc2_:int = 3; + while(_loc2_ < _loc4_ + 3) + { + DebugUtility.debugTrace("p" + (_loc2_ - 2) + "Id:" + _startData[_loc2_]); + _loc3_[_loc2_ - 3] = parseInt(_startData[_loc2_++]); + } + if(inMinigame() && _joinGameObj.swfName != "TrueFalse") + { + GuiManager.chatHist.removeKeyListeners(); + } + KeepAlive.startKATimer(DisplayObjectContainer(_minigameRef).stage); + EventDispatcher(_minigameRef).addEventListener("complete",minigameLoadCompleteHandler,false,0,true); + _minigameRef.start(_userId,_loc3_); + _startData.splice(1,2 + _loc3_.length); + _minigameRef.message(_startData); + while(_mmToSendWhenRefLoaded && _mmToSendWhenRefLoaded.length > 0) + { + _minigameRef.message(_mmToSendWhenRefLoaded.shift()); + } + } + + private static function loadPVPGameMedia(param1:int) : void + { + if(_buddyGameInviteContent) + { + while(_buddyGameInviteContent.itemBlock.numChildren > 1) + { + _buddyGameInviteContent.itemBlock.removeChildAt(_buddyGameInviteContent.itemBlock.numChildren - 1); + } + } + var _loc2_:MediaHelper = new MediaHelper(); + _loc2_.init(param1,mediaHelperCallback,true); + } + + private static function mediaHelperCallback(param1:MovieClip) : void + { + _pvpMedia[param1.mediaHelper.id] = param1.getChildAt(0); + setMediaImage(param1); + } + + private static function setMediaImage(param1:MovieClip) : void + { + var _loc2_:Number = NaN; + if(_buddyGameInviteContent) + { + while(_buddyGameInviteContent.itemBlock.numChildren > 1) + { + _buddyGameInviteContent.itemBlock.removeChildAt(_buddyGameInviteContent.itemBlock.numChildren - 1); + } + } + if(param1.scaleX == 1) + { + _loc2_ = _buddyGameInviteContent.itemBlock.width / Math.max(param1.width,param1.height); + param1.scaleX = param1.scaleY = _loc2_; + } + _buddyGameInviteContent.itemBlock.addChild(param1); + } + + private static function onPVPCloseInvite(param1:MouseEvent) : void + { + param1.stopPropagation(); + if(param1.currentTarget.parent.name == "invite") + { + if(_pvpGameDefId >= 0 && _pvpUserName != "") + { + _pvpCancelSubRoomId = gMainFrame.server.getPvpSubRoomId(); + MinigameXtCommManager.sendMinigamePvpMsg(_pvpGameDefId,1); + readySelfForPvpGame({"typeDefId":_pvpGameDefId},_pvpUserName,false); + } + } + GuiManager.grayOutHudItemsForPrivateLobby(false,true); + if(_buddyGamePopup) + { + _buddyGamePopup.close(); + } + } + + private static function onPVPYesInvite(param1:MouseEvent) : void + { + param1.stopPropagation(); + sendResponseToPVPRequest(true); + _buddyGamePopup.close(); + DarkenManager.showLoadingSpiral(true); + } + + private static function onPVPNoInvite(param1:MouseEvent) : void + { + param1.stopPropagation(); + sendResponseToPVPRequest(false); + readySelfForPvpGame({"typeDefId":_pvpGameDefId},_pvpUserName,false); + _buddyGamePopup.close(); + } + + private static function onYesNoReplay(param1:Object) : void + { + if(param1.status) + { + sendPVPRequest(param1.passback.gameDefId,param1.passback.userName); + displaySentRequestPopup(param1.passback.mediaRefId,param1.passback.userNameModerated); + readySelfForPvpGame({"typeDefId":param1.passback.gameDefId},param1.passback.userName,true); + } + } + + private static function displayPVPReceivedRequestPopup(param1:int, param2:String, param3:String) : void + { + _pvpAmISender = false; + _buddyGameInviteContent.invite.visible = false; + _buddyGameInviteContent.refuse.visible = false; + if(_pvpMedia[param1] == null) + { + loadPVPGameMedia(param1); + } + else + { + setMediaImage(_pvpMedia[param1]); + } + _buddyGameInviteContent.request.visible = true; + _buddyGameInviteContent.request.popupTxt1.text = param2; + _buddyGameInviteContent.request.popupTxt3.text = param3; + if(!_buddyGamePopup.visible) + { + _buddyGamePopup.open(); + } + } + + private static function displayPVPDeniedRequestPopup(param1:int, param2:String) : void + { + _pvpAmISender = false; + _buddyGameInviteContent.invite.visible = false; + _buddyGameInviteContent.request.visible = false; + if(_pvpMedia[param1] == null) + { + loadPVPGameMedia(param1); + } + else + { + setMediaImage(_pvpMedia[param1]); + } + _buddyGameInviteContent.refuse.visible = true; + _buddyGameInviteContent.refuse.popupTxt1.text = param2; + if(!_buddyGamePopup.visible) + { + _buddyGamePopup.open(); + } + } + + private static function minigameLoadCompleteHandler(param1:Event) : void + { + LoadProgress.show(false); + if(_inInRoomGame) + { + AvatarManager.showAvtAndChatLayers(false); + DarkenManager.showLoadingSpiral(false); + } + } + + private static function startNowHandler(param1:MouseEvent) : void + { + param1.stopPropagation(); + if(param1.currentTarget.isGray) + { + return; + } + if(_frgWaiting && _waitIds.length >= _minReqPlayers && !RoomXtCommManager.isSwitching && !QuestManager.isInPrivateAdventureState) + { + MinigameXtCommManager.sendMinigameStartRequest(_joinGameObj.typeDefId); + DarkenManager.showLoadingSpiral(true); + } + } + + public static function inMinigame() : Boolean + { + if(_joinGameObj != null && (_joinGameObj.swfName == "QuestCombat" || _joinGameObj.isCustom || _joinGameObj.mi && (_joinGameObj.mi.maxPlayers > 1 && _joinGameObj.mi.maxPlayers <= 2))) + { + return false; + } + return _inMinigame; + } + + public static function get joinGameObj() : Object + { + return _joinGameObj; + } + + public static function isInReadyModeForPVP() : Boolean + { + return _inMinigame; + } + + public static function inInRoomGame() : Boolean + { + return _inInRoomGame; + } + + public static function get inFullRoomGame() : Boolean + { + return _inMinigame && !_inInRoomGame; + } + + public static function get roomName() : String + { + return _roomName; + } + + public static function get roomEnviroType() : int + { + return _roomMgr.roomEnviroType; + } + + public static function set userId(param1:int) : void + { + _userId = param1; + } + + public static function msg(param1:Array, param2:Boolean = false) : void + { + var _loc3_:int = 0; + var _loc4_:String = null; + if(param1[0] == "_a" && param1.length > 1) + { + _loc3_ = int(param1[1]); + if(param1.length > 2) + { + _loc4_ = param1[2]; + } + // a reward always goes out, even one like the one the player + // was last given (the game sends only what differs from that, + // and the last one may be gone from sight or from the room): + // what it remembers is cleared first, quietly + AvatarManager.setPlayerAttachmentEmot(0,null,2880,false); + AvatarManager.setPlayerAttachmentEmot(_loc3_,_loc4_); + return; + } + if(param2) + { + param1[0] = UserCommXtCommManager.fixMispellings(param1[0]); + param1[0] = UserCommXtCommManager.adjustCamelCase(param1[0]); + param1[0] = UserCommXtCommManager.adjustSpecialWords(param1[0]); + } + param1.splice(0,0,_joinGameObj.typeDefId); + MinigameXtCommManager.sendMinigameMessageRequest(param1,_inInRoomGame); + if(param2 && GuiManager.chatHist.enableFreeChatValue) + { + GuiManager.chatHist.resetTreeSearch(); + GuiManager.chatHist.chatMsgText.text = ""; + gMainFrame.stage.focus = GuiManager.chatHist.chatMsgText; + } + } + + public static function readySelfForCustomPVPGame(param1:int, param2:String) : void + { + minigameInfoCache.currMinigameId = param1; + _pvpUserName = param2; + } + + public static function readySelfForPvpGame(param1:Object, param2:String, param3:Boolean, param4:Boolean = false) : void + { + var _loc6_:MinigameInfo = null; + var _loc5_:UserInfo = null; + if(param3) + { + _loc6_ = minigameInfoCache.getMinigameInfo(param1.typeDefId); + if(_loc6_ && _loc6_.readyForPVP) + { + _inInRoomGame = _loc6_.isInRoomGame; + if(_inInRoomGame) + { + if(_joinGameObj && !_joinGameObj.isPvp) + { + _oldJoinGameObj = _joinGameObj; + } + _pvpGameDefId = param1.typeDefId; + if(param2) + { + _loc5_ = gMainFrame.userInfo.getUserInfoByUserName(param2); + if(_loc5_ == null) + { + throw new Error("User info not available for " + param2 + ". This should get fixed!"); + } + _pvpUserNameModerated = _loc5_.getModeratedUserName(); + _pvpUserName = param2; + } + _joinGameObj = param1; + _joinGameObj.name = LocalizationManager.translateIdOnly(_loc6_.titleStrId); + _joinGameObj.swfName = _loc6_.swfName; + _joinGameObj.isPvp = true; + _joinGameObj.isCustom = param4; + _joinGameObj.mi = _loc6_; + gMainFrame.server.setToJoinIRG(true); + minigameInfoCache.currMinigameId = _joinGameObj.typeDefId; + _inMinigame = true; + } + } + } + else if(_joinGameObj && _joinGameObj.isPvp) + { + _pvpGameDefId = -1; + _pvpUserName = ""; + _pvpUserNameModerated = ""; + if(_oldJoinGameObj) + { + _joinGameObj = _oldJoinGameObj; + _oldJoinGameObj = null; + } + else + { + _joinGameObj = null; + } + _inInRoomGame = false; + gMainFrame.server.setToJoinIRG(false); + minigameInfoCache.currMinigameId = -1; + _inMinigame = false; + _frgWaiting = false; + } + } + + public static function readySelfForQuickMinigame(param1:Object, param2:Boolean, param3:Boolean = false) : void + { + var _loc4_:MinigameInfo = null; + if(param2) + { + _loc4_ = minigameInfoCache.getMinigameInfo(param1.typeDefId); + if(_loc4_ && !_loc4_.readyForPVP) + { + _inInRoomGame = _loc4_.isInRoomGame; + if(_joinGameObj && !_joinGameObj.isPvp) + { + _oldJoinGameObj = _joinGameObj; + } + _pvpGameDefId = param1.typeDefId; + _joinGameObj = param1; + _joinGameObj.name = LocalizationManager.translateIdOnly(_loc4_.titleStrId); + _joinGameObj.swfName = _loc4_.swfName; + _joinGameObj.isPvp = false; + _joinGameObj.isCustom = param3; + _joinGameObj.mi = _loc4_; + gMainFrame.server.setToJoinIRG(_loc4_.isInRoomGame); + _frgWaiting = !_loc4_.isInRoomGame; + _roomName = gMainFrame.server.getCurrentRoomName(false); + minigameInfoCache.currMinigameId = _joinGameObj.typeDefId; + _inMinigame = true; + } + } + else if(_joinGameObj && !_joinGameObj.isPvp) + { + _pvpGameDefId = -1; + _pvpUserName = ""; + _pvpUserNameModerated = ""; + if(_oldJoinGameObj) + { + _joinGameObj = _oldJoinGameObj; + _oldJoinGameObj = null; + } + else + { + _joinGameObj = null; + } + _inInRoomGame = false; + gMainFrame.server.setToJoinIRG(false); + minigameInfoCache.currMinigameId = -1; + _inMinigame = false; + _frgWaiting = false; + } + } + + public static function handleGameClick(param1:Object, param2:Function, param3:Boolean = false, param4:Function = null, param5:int = 0, param6:Boolean = false) : void + { + var _loc9_:MinigameInfo = null; + var _loc12_:Object = null; + var _loc7_:PetDef = null; + var _loc13_:Boolean = false; + var _loc8_:Object = null; + var _loc10_:Array = null; + var _loc11_:int = 0; + if(_gameCardPopup) + { + killJoinGamePopup(); + } + if(AvatarManager.isMyUserInCustomPVPState() || MinigameManager.minigameInfoCache.currMinigameId == param1.typeDefId) + { + DarkenManager.showLoadingSpiral(true); + UserCommXtCommManager.sendCustomPVPMessage(false,0,handleGameClick,{ + "gameEntry":param1, + "frgJoinedCallback":param2, + "skipGameCard":param3, + "gameCloseCallback":param4, + "optionalParam":param5 + }); + MinigameManager.readySelfForPvpGame(null,null,false); + return; + } + if(QuestManager.isInPrivateAdventureState) + { + QuestManager.showLeaveQuestLobbyPopup(handleGameClick,param1,param2,param3,param4,param5); + return; + } + if(!_inMinigame && !_gameCardPopup) + { + _roomMgr.forceStopMovement(); + if(!minigameInfoCache.getMinigameInfo(param1.typeDefId)) + { + DarkenManager.showLoadingSpiral(true); + MinigameXtCommManager.sendMinigameInfoRequest([param1.typeDefId],false,onMinigameInfoResponseWhenClicked); + _onClickParams = { + "gameEntry":param1, + "frgJoinedCallback":param2, + "skipGameCard":param3, + "gameCloseCallback":param4, + "optionalParam":param5 + }; + return; + } + _joinGameObj = param1; + _loc9_ = minigameInfoCache.getMinigameInfo(_joinGameObj.typeDefId); + if(_loc9_.gameDefId == 82) + { + _proModeId = param5; + } + _joinGameObj.mi = _loc9_; + _joinGameObj.name = LocalizationManager.translateIdOnly(_loc9_.titleStrId); + _joinGameObj.swfName = _loc9_.swfName; + _joinGameObj.isPvp = false; + _joinFrgCallback = param2; + _inInRoomGame = _loc9_.isInRoomGame; + _loc12_ = PetManager.myActivePet; + _loc7_ = null; + if(_loc9_.gameDefId == 43) + { + if(AvatarManager.playerAvatarWorldView) + { + if(!AvatarManager.playerAvatarWorldView.getActivePet()) + { + new SBOkPopup(_parentLayer,LocalizationManager.translateIdOnly(14683)); + return; + } + if(!gMainFrame.userInfo.isMember && (!param1.hasOwnProperty("fromMyDenItem") || !param1.fromMyDenItem)) + { + new SBOkPopup(_parentLayer,LocalizationManager.translateIdOnly(14684)); + return; + } + } + } + else if(_loc9_.gameDefId == 52 || _loc9_.gameDefId == 81) + { + if(AvatarManager.playerAvatarWorldView) + { + if(!AvatarManager.playerAvatarWorldView.getActivePet()) + { + new SBOkPopup(_parentLayer,LocalizationManager.translateIdOnly(14685)); + return; + } + if(!gMainFrame.userInfo.isMember) + { + new SBOkPopup(_parentLayer,LocalizationManager.translateIdOnly(14686)); + return; + } + } + _loc13_ = false; + if(_loc12_ != null) + { + _loc7_ = PetManager.getPetDef(_loc12_.lBits & 0xFF); + if(_loc7_ == null) + { + _loc13_ = true; + } + else + { + if(_loc7_.isEgg && !PetManager.hasHatched(_loc12_.createdTs)) + { + new SBOkPopup(_parentLayer,LocalizationManager.translateIdOnly(29538)); + return; + } + if(_loc12_.denStoreInvId > 0) + { + new SBYesNoPopup(_parentLayer,LocalizationManager.translateIdOnly(34045),true,onConfirmRemovePetFromStore,{ + "myActivePet":_loc12_, + "gameEntry":param1, + "frgJoinedCallback":param2, + "skipGameCard":param3, + "gameCloseCallback":param4, + "optionalParam":param5 + }); + return; + } + } + } + else + { + _loc13_ = true; + } + if(_loc13_) + { + new SBOkPopup(_parentLayer,LocalizationManager.translateIdOnly(14685)); + return; + } + } + _gameCloseCallback = param4; + if(_loc9_.petDefId > 0 && (_loc12_ == null || _loc12_.defId != _loc9_.petDefId)) + { + if(!gMainFrame.userInfo.isMember && (_loc9_.gameDefId != 43 || (!param1.hasOwnProperty("fromMyDenItem") || !param1.fromMyDenItem))) + { + UpsellManager.displayPopup("pets","playPetGame/" + _loc9_.titleStrId); + } + else + { + _loc7_ = PetManager.getPetDef(_loc9_.petDefId); + _loc8_ = null; + _loc10_ = PetManager.myPetList; + _loc11_ = 0; + while(_loc11_ < _loc10_.length) + { + if(_loc10_[_loc11_].defId == _loc7_.defId) + { + _loc8_ = _loc10_[_loc11_]; + break; + } + _loc11_++; + } + if(_loc8_ != null && PetManager.canCurrAvatarUsePet(AvatarManager.playerAvatar.enviroTypeFlag,_loc8_.currPetDef,_loc8_.createdTs) && (_inInRoomGame || param3)) + { + AvatarManager.playerAvatarWorldView.setActivePet(_loc8_.createdTs,_loc8_.lBits,_loc8_.uBits,_loc8_.eBits,_loc8_.name,_loc8_.personalityDefId,_loc8_.favoriteFoodDefId,_loc8_.favoriteToyDefId); + PetXtCommManager.sendPetSwitchRequest(_loc8_.idx,launchInRoomGame); + } + else + { + new SBOkPopup(_parentLayer,LocalizationManager.translateIdAndInsertOnly(14687,_loc7_.title.toLowerCase(),_joinGameObj.name)); + } + } + return; + } + if(_inInRoomGame || param3) + { + gMainFrame.server.setToJoinIRG(true); + launchGame(); + } + else + { + _gameCardPopup = new GameCardPopup(_parentLayer,_joinGameObj,playGame,killJoinGamePopup,param6); + } + } + } + + public static function checkAndStartPvpGame(param1:MinigameInfo, param2:String = null, param3:String = null) : void + { + GuiManager.grayOutHudItemsForPrivateLobby(true,true); + var _loc4_:int = int(param1.gameDefId); + if(AvatarManager.isMyUserInCustomPVPState() || MinigameManager.minigameInfoCache.currMinigameId == _loc4_) + { + DarkenManager.showLoadingSpiral(true); + UserCommXtCommManager.sendCustomPVPMessage(false,0,checkAndStartPvpGame,{ + "gameInfo":param1, + "currUserName":param2, + "currUserNameModerated":param3 + }); + MinigameManager.readySelfForCustomPVPGame(-1,""); + return; + } + DarkenManager.showLoadingSpiral(false); + if(param2 != null) + { + MinigameXtCommManager.sendMinigamePvpMsg(_loc4_,0,param2); + MinigameManager.displaySentRequestPopup(param1.gameCardMediaId,param3); + MinigameManager.readySelfForPvpGame({"typeDefId":_loc4_},param2,true); + } + else + { + UserCommXtCommManager.sendCustomPVPMessage(true,_loc4_); + MinigameManager.readySelfForCustomPVPGame(_loc4_,""); + } + } + + private static function launchInRoomGame(param1:Boolean) : void + { + gMainFrame.server.setToJoinIRG(true); + launchGame(); + } + + private static function closeHandler(param1:MouseEvent = null) : void + { + leave(); + } + + private static function stopMouse(param1:MouseEvent) : void + { + param1.stopPropagation(); + } + + private static function onMinigameInfoResponseWhenClicked() : void + { + if(_onClickParams) + { + handleGameClick(_onClickParams.gameEntry,_onClickParams.frgJoinedCallback,_onClickParams.skipGameCard,_onClickParams.gameCloseCallback,_onClickParams.optionalParam); + _onClickParams = null; + } + } + + private static function onConfirmRemovePetFromStore(param1:Object) : void + { + var _loc4_:Object = null; + var _loc3_:* = undefined; + var _loc2_:PetItem = null; + if(param1.status) + { + _loc4_ = param1.passback.myActivePet; + _loc3_ = new Vector.(); + _loc2_ = new PetItem(); + _loc2_.init(_loc4_.createdTs,_loc4_.defId,[_loc4_.lBits,_loc4_.uBits,_loc4_.eBits],_loc4_.personalityDefId,_loc4_.favoriteToyDefId,_loc4_.favoriteFoodDefId,_loc4_.idx,_loc4_.name,false,null,DiamondXtCommManager.getDiamondItem(DiamondXtCommManager.getDiamondDefIdByRefId(_loc4_.defId,2)),_loc4_.denStoreInvId); + _loc3_.push(new MyShopItem(_loc2_,0,0,_loc4_.denStoreInvId)); + ShopManager.findAndRemoveDenShopItems(_loc3_,onRemovalComplete,param1.passback); + } + } + + private static function onRemovalComplete(param1:Boolean, param2:Object) : void + { + DarkenManager.showLoadingSpiral(false); + if(param1) + { + param2.myActivePet.denStoreInvId = 0; + handleGameClick(param2.gameEntry,param2.frgJoinedCallback,param2.skipGameCard,param2.gameCloseCallback,param2.optionalParam,param2.fromWorldVolume); + } + else + { + new SBOkPopup(_parentLayer,LocalizationManager.translateIdOnly(24788)); + } + } + + public static function startGame(param1:Array) : void + { + var _loc2_:UserInfo = null; + _startData = param1; + if(_joinGameObj && _joinGameObj.isPvp && (_pvpUserName == null || _pvpUserName == "")) + { + if(param1[8]) + { + _loc2_ = gMainFrame.userInfo.getUserInfoByUserName(param1[8]); + if(_loc2_ == null) + { + throw new Error("User info not available for " + param1[8] + ". This should get fixed!"); + } + _pvpUserNameModerated = _loc2_.getModeratedUserName(); + _pvpUserName = param1[8]; + } + } + _mmToSendWhenRefLoaded = []; + createGameWindow(); + } + + public static function joinGameResponse(param1:Array) : void + { + var _loc6_:PetDef = null; + var _loc9_:Boolean = false; + var _loc2_:TextFormat = null; + var _loc11_:MinigameInfo = null; + var _loc4_:int = 0; + var _loc16_:int = 0; + var _loc14_:int = 0; + var _loc15_:Avatar = null; + var _loc7_:AvatarView = null; + var _loc5_:Point = null; + var _loc8_:String = null; + var _loc12_:int = 0; + var _loc13_:String = null; + var _loc3_:String = null; + var _loc10_:Boolean = true; + if(param1[2] == "hc") + { + readySelfForPvpGame(null,"",false); + readySelfForQuickMinigame(null,false); + if(_waitListPopup) + { + _waitListPopup.destroy(); + _waitListPopup = null; + } + } + else if(param1[2] == "pf") + { + DarkenManager.showLoadingSpiral(false); + GuiManager.handleGameExit(); + _inMinigame = false; + _inInRoomGame = false; + minigameInfoCache.currMinigameId = -1; + gMainFrame.stage.quality = gMainFrame.currStageQuality; + gMainFrame.server.setToJoinIRG(false); + _loc6_ = PetManager.getPetDef(parseInt(param1[3])); + if(!gMainFrame.userInfo.isMember) + { + UpsellManager.displayPopup("pets","playPetGame/" + _loc6_.title); + } + else + { + new SBOkPopup(_parentLayer,LocalizationManager.translateIdAndInsertOnly(14687,_loc6_.title.toLowerCase(),_joinGameObj.name)); + } + } + else if(param1[2] == "mo") + { + DarkenManager.showLoadingSpiral(false); + GuiManager.handleGameExit(); + _inMinigame = false; + _inInRoomGame = false; + minigameInfoCache.currMinigameId = -1; + gMainFrame.stage.quality = gMainFrame.currStageQuality; + gMainFrame.server.setToJoinIRG(false); + _frgWaiting = false; + UpsellManager.displayPopup("oceanAnimals","playMOGame/" + _joinGameObj.name); + } + else if(param1[2] == "as") + { + DarkenManager.showLoadingSpiral(false); + _roomMgr.setMinigameIdToJoin(minigameInfoCache.currMinigameId); + if(param1[3] == -1) + { + new SBYesNoPopup(_parentLayer,LocalizationManager.translateIdOnly(23803),true,GuiManager.switchToOceanAnimal,{ + "switchRooms":false, + "switchDens":false + }); + } + else + { + new SBOkPopup(_parentLayer,LocalizationManager.translateIdOnly(23910)); + } + GuiManager.handleGameExit(); + _inMinigame = false; + _inInRoomGame = false; + minigameInfoCache.currMinigameId = -1; + gMainFrame.stage.quality = gMainFrame.currStageQuality; + gMainFrame.server.setToJoinIRG(false); + _frgWaiting = false; + } + else if(param1[2] == "ul") + { + DarkenManager.showLoadingSpiral(false); + } + else + { + _loc9_ = false; + if(int(param1[1]) != gMainFrame.server.getCurrentRoomId(_inInRoomGame)) + { + _loc9_ = true; + } + if(_joinGameObj && (_joinGameObj.mi as MinigameInfo).maxPlayers == 4 && _waitListPopup == null) + { + setupWaitListPopup(false); + _waitList.multiplayerBtn.visible = false; + _waitList.singlePlayerBtn.visible = false; + _waitList.waiting_txt.visible = true; + _waitList.startBtn.visible = false; + _waitList.player_count_txt.x -= _waitList.player_count_txt.width; + _loc2_ = new TextFormat(); + _loc2_.align = "right"; + _waitList.player_count_txt.setTextFormat(_loc2_); + _waitlistP1X = _waitList.p1.x; + _waitlistP2X = _waitList.p2.x; + _waitlistP3X = _waitList.p3.x; + _waitlistP4X = _waitList.p4.x; + _waitList.p1.nameBar.name_txt.visible = false; + _waitList.p2.nameBar.name_txt.visible = false; + _waitList.p3.nameBar.name_txt.visible = false; + _waitList.p4.nameBar.name_txt.visible = false; + if(_waitList.p1.char.currentFrameLabel != "up") + { + _waitList.p1.char.gotoAndPlay("up"); + } + _loc11_ = minigameInfoCache.getMinigameInfo(_joinGameObj.typeDefId); + _minReqPlayers = _loc11_.minPlayers; + _maxAllowedPlayers = _loc11_.maxPlayers; + } + if(!_loc9_ && (_inInRoomGame || _waitListPopup == null)) + { + _loc9_ = true; + } + _loc10_ = false; + GuiManager.grayOutHudItemsForPrivateLobby(true,true); + if(!_loc9_ && _waitListPopup) + { + _waitIds = []; + _loc4_ = 1; + while(_loc4_ < _maxAllowedPlayers + 1) + { + while(_waitListPopup.content["p" + _loc4_].char.charLayer.numChildren > 0) + { + _waitListPopup.content["p" + _loc4_].char.charLayer.removeChildAt(0); + } + _waitListPopup.content["p" + _loc4_].char.gotoAndPlay("waiting"); + _waitListPopup.content["p" + _loc4_].nameBar.lastName_txt.text = ""; + _loc4_++; + } + _loc16_ = 2; + while(_loc16_ < _maxAllowedPlayers + 2) + { + if(_loc16_ < param1.length) + { + _loc14_ = int(param1[_loc16_]); + _waitIds.push(_loc14_); + _waitListPopup.content["p" + (_loc16_ - 1)].char.gotoAndPlay("up"); + _loc15_ = AvatarManager.getAvatarBySfsUserId(_loc14_); + if(_loc15_ == null) + { + DebugUtility.debugTraceObject("AvatarManager.avatarList",AvatarManager.avatarList); + throw new Error("\"mj\" sent down bad sfsUserId wid:" + _loc14_); + } + _loc7_ = new AvatarView(); + _loc7_.init(_loc15_); + _loc7_.playAnim(15,false,0,null,true); + _loc7_.scaleX = 0.7; + _loc7_.scaleY = 0.7; + _loc5_ = AvatarUtility.getAvatarMinigameLobbyOffset(_loc7_.avTypeId); + _loc7_.x = _loc5_.x; + _loc7_.y = _loc5_.y; + _waitListPopup.content["p" + (_loc16_ - 1)].char.charLayer.addChild(_loc7_); + _loc8_ = _loc15_.avName; + _loc12_ = _loc8_.indexOf(" "); + if(_loc12_ != -1) + { + _loc13_ = _loc8_.substr(0,_loc12_); + _loc3_ = _loc8_.substr(_loc12_ + 1,_loc8_.length); + } + else + { + _loc13_ = _loc8_; + } + _waitListPopup.content["p" + (_loc16_ - 1)].nameBar.firstName_txt.text = _loc13_; + if(_loc3_) + { + _waitListPopup.content["p" + (_loc16_ - 1)].nameBar.lastName_txt.text = _loc3_; + } + } + else + { + _waitListPopup.content["p" + (_loc16_ - 1)].char.gotoAndPlay("waiting"); + LocalizationManager.translateId(_waitListPopup.content["p" + (_loc16_ - 1)].nameBar.firstName_txt,11101); + _waitListPopup.content["p" + (_loc16_ - 1)].nameBar.lastName_txt.text = ""; + } + _loc16_++; + } + if(!_waitListPopup.visible) + { + _waitListPopup.open(); + } + waitListUpdate(); + } + } + if(_loc10_) + { + GuiManager.grayOutHudItemsForPrivateLobby(false); + } + } + + public static function minigameEndResponse(param1:Array) : void + { + var _loc2_:SBMessage = null; + if(_minigameRef) + { + _minigameRef.end(param1); + _minigameRef = null; + } + _mmToSendWhenRefLoaded = null; + if(!_inInRoomGame) + { + _loc2_ = new SBMessage(_parentLayer,GETDEFINITIONBYNAME("ConfirmSkin"),LocalizationManager.translateIdOnly(11131)); + _loc2_.closeCallback = minigameEndResponseMessageClose; + } + else + { + gMainFrame.server.setToJoinIRG(false); + } + } + + private static function minigameEndResponseMessageClose() : void + { + leave(); + } + + public static function minigameRoomRemovedResponse(param1:Array) : void + { + if(_rejoin) + { + launchGame(); + _rejoin = false; + } + } + + public static function messageGame(param1:Array) : void + { + if(_minigameRef) + { + _minigameRef.message(param1); + } + else if(_mmToSendWhenRefLoaded) + { + _mmToSendWhenRefLoaded.push(param1); + } + } + + public static function pvpResponse(param1:Array) : void + { + var _loc4_:String = null; + var _loc3_:int = 0; + var _loc2_:int = int(param1[2]); + var _loc5_:int = int(param1[3]); + if(_loc5_ == 0) + { + _loc4_ = param1[4]; + _loc3_ = int(param1[5]); + readySelfForPvpGame({"typeDefId":_loc2_},_loc4_,true); + displayPVPReceivedRequestPopup(minigameInfoCache.getMinigameInfo(_pvpGameDefId).gameCardMediaId,_loc3_ > 0 ? _loc4_ : LocalizationManager.translateIdOnly(11098),MinigameManager.getGameName(_pvpGameDefId)); + } + else if(_loc5_ == 1) + { + if(_pvpGameDefId > 0 && _pvpUserName != "") + { + if(_buddyGamePopup.visible && !_pvpAmISender) + { + _buddyGamePopup.close(); + } + else + { + displayPVPDeniedRequestPopup(minigameInfoCache.getMinigameInfo(_pvpGameDefId).gameCardMediaId,_pvpUserNameModerated); + } + readySelfForPvpGame({"typeDefId":_loc2_},_pvpUserName,false); + } + } + } + + public static function leaderBoardResponse(param1:Array) : void + { + var _loc2_:Object = null; + var _loc3_:int = 0; + var _loc4_:int = 0; + var _loc6_:int = 0; + var _loc5_:int = int(param1[2]); + if(_loc5_ != -1) + { + _loc2_ = {}; + _loc2_._cacheTime = getTimer(); + _loc2_._allTime = []; + _loc2_._thisWeek = []; + _loc2_._buddy = []; + _loc4_ = 3; + _loc3_ = int(param1[_loc4_++]); + _loc6_ = 0; + while(_loc3_ > 0) + { + _loc2_._allTime[_loc6_] = {}; + _loc2_._allTime[_loc6_]._name = param1[_loc4_++]; + _loc2_._allTime[_loc6_++]._score = param1[_loc4_++]; + _loc3_--; + } + _loc3_ = int(param1[_loc4_++]); + _loc6_ = 0; + while(_loc3_ > 0) + { + _loc2_._thisWeek[_loc6_] = {}; + _loc2_._thisWeek[_loc6_]._name = param1[_loc4_++]; + _loc2_._thisWeek[_loc6_++]._score = param1[_loc4_++]; + _loc3_--; + } + _loc3_ = int(param1[_loc4_++]); + _loc6_ = 0; + while(_loc3_ > 0) + { + _loc2_._buddy[_loc6_] = {}; + _loc2_._buddy[_loc6_]._name = param1[_loc4_++]; + _loc2_._buddy[_loc6_++]._score = param1[_loc4_++]; + _loc3_--; + } + _leaderBoardCache[_loc5_] = _loc2_; + if(_joinGameObj != null && _gameCardPopup != null && _joinGameObj.typeDefId == _loc5_) + { + _gameCardPopup.onLeaderBoardSelected(); + } + } + DarkenManager.showLoadingSpiral(false); + } + + public static function displaySentRequestPopup(param1:int, param2:String) : void + { + _pvpAmISender = true; + _buddyGameInviteContent.request.visible = false; + _buddyGameInviteContent.refuse.visible = false; + if(_pvpMedia[param1] == null) + { + loadPVPGameMedia(param1); + } + else + { + setMediaImage(_pvpMedia[param1]); + } + _buddyGameInviteContent.invite.visible = true; + _buddyGameInviteContent.invite.popupTxt2.text = param2; + if(!_buddyGamePopup.visible) + { + _buddyGamePopup.open(); + } + } + + public static function getGameName(param1:int) : String + { + var _loc2_:MinigameInfo = null; + if(minigameInfoCache) + { + _loc2_ = minigameInfoCache.getMinigameInfo(param1); + if(_loc2_) + { + return LocalizationManager.translateIdOnly(_loc2_.titleStrId); + } + } + return ""; + } + + public static function getGameNameId(param1:int) : int + { + var _loc2_:MinigameInfo = null; + if(minigameInfoCache) + { + _loc2_ = minigameInfoCache.getMinigameInfo(param1); + if(_loc2_) + { + return _loc2_.titleStrId; + } + } + return -1; + } + + public static function getActivePet(param1:Function) : Sprite + { + var _loc2_:WorldPet = AvatarManager.playerAvatarWorldView.getActivePet(); + if(_loc2_) + { + return PetManager.getPetSprite(_loc2_.getCreatedTs(),_loc2_.getLBits(),_loc2_.getUBits(),_loc2_.getEBits(),_loc2_.getType(),param1); + } + return null; + } + + public static function getActivePetName() : String + { + if(PetManager.myActivePet) + { + return LocalizationManager.translatePetName(PetManager.myActivePet.name); + } + return ""; + } + + public static function sendPetItemRequest(param1:int, param2:int, param3:int, param4:int, param5:Function) : void + { + PetXtCommManager.sendPetItemRequest(param1,param2,param3,param4,param5); + } + + public static function setPetSparkle(param1:int) : void + { + PetManager.sendPetSparkle(param1); + } + + public static function getIsPlayerMember() : Boolean + { + return gMainFrame.userInfo.isMember; + } + + public static function minigameGems(param1:Object) : void + { + var _loc2_:Object = null; + _gemSerialNumber = parseInt(param1[2]); + if(parseInt(param1[3]) == 1) + { + _scoreSN = _gemSerialNumber; + } + if(_awardGemsQueue.length > 0) + { + _loc2_ = _awardGemsQueue.pop(); + sendGemAward(_loc2_); + } + } + + public static function minigamePetMastery(param1:Object) : void + { + var _loc2_:Object = null; + _petMasterySerialNumber = parseInt(param1[2]); + if(param1[3] == "1") + { + _petMasteryQueuePopup = true; + } + if(_awardMasteryPointsQueue.length > 0) + { + _loc2_ = _awardMasteryPointsQueue.pop(); + sendMasteryPoints(_loc2_); + } + } + + public static function awardPetMasteryPoints(param1:int) : void + { + var _loc2_:Object = null; + if(param1 > 0) + { + if(MainFrame.isInitialized()) + { + _loc2_ = {}; + _loc2_.amount = param1; + PetManager.addToActivePetMastery(param1); + if(minigameInfoCache != null) + { + _loc2_.minigameID = minigameInfoCache.currMinigameId; + } + else + { + _loc2_.minigameID = -1; + } + if(_petMasterySerialNumber != -1) + { + sendMasteryPoints(_loc2_); + } + else + { + _awardMasteryPointsQueue.push(_loc2_); + } + } + } + } + + public static function awardGems(param1:int, param2:int) : void + { + var _loc3_:Object = null; + if(param1 > 0) + { + if(MainFrame.isInitialized()) + { + _loc3_ = {}; + _loc3_.amount = param1; + _loc3_.minigameID = param2; + if(_gemSerialNumber != -1) + { + sendGemAward(_loc3_); + } + else + { + _awardGemsQueue.push(_loc3_); + } + } + } + } + + private static function sendMasteryPoints(param1:Object) : void + { + var _loc3_:Number = (param1.amount + 29) * 7 + (_userId + 99) * 3 + (_petMasterySerialNumber + 49) * 5; + var _loc4_:Number = (param1.minigameID + 49) * 3 + (_petMasterySerialNumber + 83) * 5; + var _loc2_:Number = (_petMasterySerialNumber + _userId + param1.amount) * 3 + param1.amount * 3; + _petMasterySerialNumber = -1; + gMainFrame.server.setXtObject_Str("ma",[_loc3_,_loc4_,_loc2_]); + } + + private static function sendGemAward(param1:Object) : void + { + var _loc3_:Number = (param1.amount + 29) * 7 + (_userId + 99) * 3 + (_gemSerialNumber + 49) * 5; + var _loc4_:Number = (param1.minigameID + 49) * 3 + (_gemSerialNumber + 83) * 5; + var _loc2_:Number = (_gemSerialNumber + _userId + param1.amount) * 3 + param1.amount * 3; + _gemSerialNumber = -1; + gMainFrame.server.setXtObject_Str("mg",[_loc3_,_loc4_,_loc2_]); + } + + public static function sendScore(param1:Number, param2:Number, param3:Number, param4:int, param5:int) : void + { + gMainFrame.server.setXtObject_Str("msv",[param1 + 3 * param4,param2 - 8 * param4,param3 + 5 * param4,param4 * 5 + 7 * _scoreSN,param5 * 3 + _scoreSN]); + } + + public static function getScoreSN() : int + { + return _scoreSN; + } + + public static function keepAlive() : void + { + KeepAlive.inputReceivedHandler(null); + } + + public static function handleQuestMiniGameComplete(param1:int) : void + { + QuestManager.handleQuestMiniGameComplete(param1); + } + + public static function sendChatMsg(param1:MouseEvent, param2:String = "") : void + { + var _loc5_:Object = null; + var _loc3_:String = null; + var _loc4_:String = param2 == "" ? GuiManager.mainHud.chatBar.text01_chat.text : param2; + _loc4_ = _loc4_.split("\r").join(""); + _loc4_ = _loc4_.split(gMainFrame.server.rawProtocolSeparator).join(""); + _loc4_ = StringUtil.trim(_loc4_); + if(_loc4_.length <= 0) + { + return; + } + var _loc6_:Object = EmoticonUtility.matchEmoteString(_loc4_); + if(_loc6_.status) + { + _loc5_ = _minigameRef; + _loc3_ = SafeChatManager.safeChatCodeForString(sendChatMsg,[param1,param2],_loc4_,4); + if(_loc3_ == "") + { + return; + } + if(_loc3_) + { + msg(["cm",_loc3_,1],true); + _loc5_.addAvatarMessageForMyself(msg,0); + GuiManager.safeChatBtnDownHandler(null); + } + else + { + _loc5_.addAvatarMessageForMyself("...",0); + msg(["cm",_loc4_,gMainFrame.userInfo.sgChatType == 1 ? 0 : 9],true); + } + return; + } + GuiManager.chatHist.resetTreeSearch(); + GuiManager.chatHist.chatMsgText.text = ""; + gMainFrame.stage.focus = GuiManager.chatHist.chatMsgText; + } + + public static function sendSafeChatMsg(param1:String, param2:String) : void + { + sendChatMsg(null,param1); + } + + public static function sendEmoteMsg(param1:Sprite) : void + { + var _loc2_:Object = _minigameRef; + if(gMainFrame.clientInfo.invisMode) + { + return; + } + _loc2_.setAvatarEmote(param1); + if(!EmoticonUtility.getEmoteString(param1)) + { + throw new Error("setAvatarEmote: sent invalid emote sprite?!"); + } + msg(["cm",EmoticonUtility.idForEmote(param1) + UserCommXtCommManager.RAW_STR + 2],true); + } + + public static function emoteForId(param1:int) : Sprite + { + return EmoticonUtility.emoteForId(param1); + } + + public static function stringForId(param1:int) : String + { + return EmoticonUtility.stringForId(param1); + } + + public static function playAnimFromActionString(param1:String, param2:int) : void + { + var _loc3_:Object = _minigameRef; + for each(var _loc4_:Object in AvatarWorldView._actionLookup) + { + if(_loc4_.name == param1) + { + _loc3_.playAnim(_loc4_,param2); + break; + } + } + } + + public static function sendActionMsg(param1:Sprite) : void + { + var _loc3_:Object = _minigameRef; + if(gMainFrame.clientInfo.invisMode) + { + return; + } + var _loc2_:String = GuiManager.actionMgr.getActionString(param1); + for each(var _loc5_:Object in AvatarWorldView._actionLookup) + { + if(_loc5_.name == _loc2_) + { + _loc3_.playAnim(_loc5_); + break; + } + } + if(!GuiManager.actionMgr.getActionString(param1)) + { + throw new Error("setAvatarAction: sent invalid action sprite?!"); + } + var _loc4_:int = 0; + msg(["cm",GuiManager.actionMgr.getActionString(param1) + UserCommXtCommManager.RAW_STR + 3 + UserCommXtCommManager.RAW_STR + _loc4_],true); + } + + public static function isMember(param1:int) : Boolean + { + return Utility.isMember(param1); + } + } +} + diff --git a/swf-src/TradeManager.as b/swf-src/TradeManager.as index ccc9aae..56b0777 100644 --- a/swf-src/TradeManager.as +++ b/swf-src/TradeManager.as @@ -878,7 +878,9 @@ package gui _loc32_.dispatchEvent(new AvatarEvent("OnAvatarChanged")); } GuiManager.showHudAvt(); - closeRequestSentPopup(); + // the "waiting" window goes quietly: the trade went through, and + // its failure sound played over the success one + closeRequestSentPopup(false); } else { @@ -2308,11 +2310,14 @@ package gui } } - private static function closeRequestSentPopup() : void + private static function closeRequestSentPopup(param1:Boolean = true) : void { if(_requestSentPopup && _requestSentPopup.visible) { - AJAudio.playTradeFailedSound(); + if(param1) + { + AJAudio.playTradeFailedSound(); + } DarkenManager.unDarken(_requestSentPopup); if(_requestSentPopup.parent == _guiLayer) { diff --git a/swf-src/XtReplyDemuxer.as b/swf-src/XtReplyDemuxer.as index dc960c3..2050526 100644 --- a/swf-src/XtReplyDemuxer.as +++ b/swf-src/XtReplyDemuxer.as @@ -135,6 +135,11 @@ package AJClient.onMentions(param1.obj); return; } + if(param1.obj[0] == "xtr") + { + AJClient.onTrading(param1.obj); + return; + } if(param1.obj[0] == "xty") { AJClient.onTyping(param1.obj); diff --git a/swf/ajclient.swf b/swf/ajclient.swf index 424ef41..79d6291 100644 Binary files a/swf/ajclient.swf and b/swf/ajclient.swf differ diff --git a/tools/build-client.sh b/tools/build-client.sh index 9f3e122..7dbd172 100755 --- a/tools/build-client.sh +++ b/tools/build-client.sh @@ -96,6 +96,8 @@ set -- \ avatar.AvatarUtility AvatarUtility.as \ item.Item Item.as \ loader.DenItemHelper DenItemHelper.as \ + game.MinigameManager MinigameManager.as \ + game.microSmoothie.MicroSmoothie MicroSmoothie.as \ room.DenItemHolder ../tools/decompiled/room/DenItemHolder.as # not in the game: added before the replace (game.ArtStudioKit is Strawberry # Jam's, shared by its two art studio painters; gui.SitForwardAction is the