Files
burrow-server/swf-src/XtReplyDemuxer.as
T
SnipzilandClaude Opus 5.5 59d9d7e5fa feat(client): item maker, worn pictures, emoji, sitting, typing, AFK, staff window
Rebuilt swf/ajclient.swf from swf-src (tools/build-client.sh). New patched
classes: KeepAlive, AvatarView, AvatarUtility, Item, DenItemHelper,
SitForwardAction.

Custom items
- The Item Maker in Settings, in the game's own style: make an item from one
  of the game's, name it, upload a picture (PNG encoded in the client and
  shrunk when too big), choose sticker or texture, rename, delete.
- Pictures stand in for the item's icon and, for den items, the placed item.
- Worn pictures: LayerBitmap paints a sticker or a texture. Fixed it showing
  only until the player moved:
  - AvatarView rebuilt the worn layers on every new animation without the
    item id, so walking drew the base item. It now carries the id ("d").
  - Frames painted while the picture loaded stayed cached as the base item.
    They are all painted again when it arrives (LayerBitmap.artArrived).
- The picture loader checks the server's crossdomain policy before its pixels
  are read.

Chat
- Windows emoji and the AJ emotes inline with text in chat bubbles; emoji are
  sent as \{hex} tags. An emoji picker and :shortcodes:.
- Chat box limit 200 characters; the box shows emoji in the system font.
- Clicking an emote while typing puts its code in the chat box.
- Two new base emotes: 💀 and 😭 (HUDAssets.swf, EmoticonUtility).
- Typing bubble: a "..." over a player's animal while they type ("xty").
  It goes on a new line, when they stop, or after 8 seconds.
- loadArt shares pictures by address: emoji and icons load and decode once.

Actions
- Sit Front and Sit Back between the sit arrows, plus Mirror for any action
  (from the other session). Front now plays animation 5 (facing the camera)
  and Back animation 1 (facing away); both had played animation 1.

Staff
- The Moderate window from a player card's Report button for staff: warn
  (custom text too), kick, silence, ban, summon, goto, notes.
- Invisible staff drawn half see-through; staff land on the exact spot on
  goto and summon ("xgt").

Other
- AFK sign-out after 75 minutes instead of 7, with a 60-second warning
  (com.sbi.client.KeepAlive).
- Jam-a-Grams show custom items and colours; Jammer Wall avatar photos fixed.
- The Item Maker row in the settings menu and the item window toggle.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-17 21:44:11 -04:00

274 lines
8.0 KiB
ActionScript

package
{
import com.sbi.client.SFEvent;
import avatar.NPCView;
import buddy.BuddyCard;
import com.sbi.graphics.PaletteHelper;
import flash.events.TimerEvent;
import flash.utils.Timer;
import flash.utils.getTimer;
public class XtReplyDemuxer
{
private static var MSG_DELAY_MS:int = 0;
private static var _delayList:Array;
private static var _delayTimer:Timer;
private static var _xtReplyCallbacks:Vector.<Function>;
private static var _xtReplyCommands:Vector.<String>;
public function XtReplyDemuxer()
{
super();
}
public static function init() : void
{
if(MSG_DELAY_MS > 0)
{
_delayList = [];
_delayTimer = new Timer(10);
_delayTimer.addEventListener("timer",delayTimerHandler,false,0,true);
_delayTimer.start();
}
_xtReplyCallbacks = new Vector.<Function>();
_xtReplyCommands = new Vector.<String>();
gMainFrame.server.addEventListener("OnXtReply",xtReplyHandler,false,0,true);
}
public static function destroy() : void
{
_delayList = null;
if(_delayTimer)
{
if(_delayTimer.running)
{
_delayTimer.stop();
}
_delayTimer = null;
}
_xtReplyCallbacks = null;
_xtReplyCommands = null;
gMainFrame.server.removeEventListener("OnXtReply",xtReplyHandler);
}
public static function addModule(param1:Function, param2:String) : void
{
_xtReplyCallbacks.push(param1);
_xtReplyCommands.push(param2);
}
public static function removeModule(param1:Function) : void
{
var _loc2_:int = _xtReplyCallbacks.indexOf(param1);
if(_loc2_ >= 0)
{
_xtReplyCallbacks.splice(_loc2_,1);
_xtReplyCommands.splice(_loc2_,1);
return;
}
throw new Error("module not found! callback:" + param1);
}
public static function xtReplyHandler(param1:SFEvent) : void
{
var _loc3_:String = null;
var _loc4_:int = 0;
var _loc2_:Function = null;
if(param1.obj[0] == "xcc")
{
PaletteHelper.handleCustomColors(param1.obj);
return;
}
if(param1.obj[0] == "xsp")
{
AJClient.onStaff(param1.obj);
return;
}
if(param1.obj[0] == "xdi")
{
AJClient.onItemDefs(param1.obj);
return;
}
if(param1.obj[0] == "xtl")
{
AJClient.showMessage(param1.obj);
return;
}
if(param1.obj[0] == "xyn")
{
AJClient.askYesNo(param1.obj);
return;
}
if(param1.obj[0] == "xgt")
{
AJClient.onStaffGoto(param1.obj);
return;
}
if(param1.obj[0] == "xcm")
{
AJClient.onItemMaker(param1.obj);
return;
}
if(param1.obj[0] == "xiv")
{
AJClient.onInvisible(param1.obj);
return;
}
if(param1.obj[0] == "xty")
{
AJClient.onTyping(param1.obj);
return;
}
if(param1.obj[0] == "xw")
{
AJClient.onWhisper(param1.obj);
return;
}
if(param1.obj[0] == "xrn")
{
AJClient.onRenamed(param1.obj);
return;
}
if(param1.obj[0] == "xls")
{
AJClient.noteLastSeen(param1.obj);
return;
}
if(param1.obj[0] == "xfl")
{
AJClient.onFilterState(param1.obj);
return;
}
if(param1.obj[0] == "xfa")
{
AJClient.onFilterAsk(param1.obj);
return;
}
// the player's chat filter (AJClient.filterText), on what other
// players wrote, before any of the game sees it. A chat line
// ([.., room, who, text, type, ..], typed chat being types 0 and
// 9) that is to be left out is simply not passed on.
try
{
if(param1.obj[0] == "uc" && (int(param1.obj[4]) == 0 || int(param1.obj[4]) == 9) && int(param1.obj[2]) != gMainFrame.server.userId)
{
_loc3_ = AJClient.filterText(String(param1.obj[3]));
if(_loc3_ == null)
{
AJClient.whisperNext = false;
return;
}
param1.obj[3] = _loc3_;
}
// Jam-A-Grams: one pushed ("ep", 17 fields from the third), or
// the inbox ("el": a count, then 17 fields a card). the words
// are a card's sixth field and who sent it (0 a player) its
// fourteenth.
else if(param1.obj[0] == "ep" && param1.obj.length >= 19 && int(param1.obj[15]) == 0)
{
param1.obj[7] = AJClient.filterOrNote(String(param1.obj[7]));
}
else if(param1.obj[0] == "el")
{
_loc4_ = 3;
while(_loc4_ + 16 < param1.obj.length)
{
if(int(param1.obj[_loc4_ + 13]) == 0)
{
param1.obj[_loc4_ + 5] = AJClient.filterOrNote(String(param1.obj[_loc4_ + 5]));
}
_loc4_ += 17;
}
}
// A player's bio, the last field of what their card is told:
// their own too, so they see it as others do.
else if(param1.obj[0] == "xbn" && param1.obj.length > 7)
{
param1.obj[7] = AJClient.filterOrNote(String(param1.obj[7]));
}
}
catch(e:Error)
{
GlobalErrorCatch.reportToServer("chat filter: " + e + "\n" + e.getStackTrace());
}
if(param1.obj[0] == "xbn")
{
BuddyCard.onBanInfo(param1.obj);
return;
}
_loc4_ = 0;
while(_loc4_ < _xtReplyCommands.length)
{
_loc3_ = _xtReplyCommands[_loc4_];
if(_loc3_.charAt(0) == param1.obj[0].charAt(0))
{
if(_loc3_.length == 1)
{
_loc2_ = _xtReplyCallbacks[_loc4_];
break;
}
if(param1.obj[0].indexOf(_loc3_) != -1)
{
_loc2_ = _xtReplyCallbacks[_loc4_];
break;
}
}
_loc4_++;
}
if(_loc2_ == null)
{
throw new Error("ERROR: undefined module command:" + param1.obj[0]);
}
if(MSG_DELAY_MS == 0)
{
NPCView.disguiseDefId = param1.obj[0] == "dph" ? int(param1.obj[5]) : 0;
try
{
_loc2_(param1);
}
catch(e:Error)
{
NPCView.disguiseDefId = 0;
GlobalErrorCatch.reportToServer("while handling server message \"" + param1.obj[0] + "\": " + e + "\n" + e.getStackTrace());
// not thrown on: the global catch only reported it a second time
}
NPCView.disguiseDefId = 0;
}
else
{
_delayList.push({
"f":_loc2_,
"e":param1,
"ts":getTimer() + MSG_DELAY_MS
});
}
}
private static function delayTimerHandler(param1:TimerEvent) : void
{
var _loc4_:Object = null;
var _loc2_:int = 0;
var _loc3_:uint = uint(getTimer());
_loc2_ = 0;
while(_loc2_ < _delayList.length)
{
_loc4_ = _delayList[_loc2_];
if(_loc4_.ts >= _loc3_)
{
break;
}
_loc4_.f(_loc4_.e);
_delayList.splice(0,1);
_loc2_--;
_loc2_++;
}
}
}
}