Example #1
0
        private static void LeafUserlistEnd(Leaf leaf)
        {
            if (leaf.LoginPhase != LinkLogin.AwaitingUserlist)
            {
                leaf.SendPacket(HubOutbound.LinkError(LinkError.BadProtocol));
                leaf.Disconnect();
                return;
            }

            leaf.LoginPhase = LinkLogin.Ready;

            LeafPool.Leaves.ForEachWhere(x => x.SendPacket(HubOutbound.HubLeafConnected(x, leaf)),
                                         x => x.Ident != leaf.Ident && x.LoginPhase == LinkLogin.Ready);

            foreach (LinkUser u in leaf.Users)
            {
                LeafPool.Leaves.ForEachWhere(x => x.SendPacket(HubOutbound.HubUserlistItem(x, leaf.Ident, u)),
                                             x => x.Ident != leaf.Ident && x.LoginPhase == LinkLogin.Ready);

                if (u.CustomName.Length > 0)
                {
                    LeafPool.Leaves.ForEachWhere(x => x.SendPacket(HubOutbound.HubCustomName(x, leaf.Ident, u)),
                                                 x => x.Ident != leaf.Ident && x.LoginPhase == LinkLogin.Ready);
                }

                if (u.Avatar.Length > 0)
                {
                    LeafPool.Leaves.ForEachWhere(x => x.SendPacket(HubOutbound.HubAvatar(x, leaf.Ident, u)),
                                                 x => x.Ident != leaf.Ident && x.LoginPhase == LinkLogin.Ready);
                }

                if (u.PersonalMessage.Length > 0)
                {
                    LeafPool.Leaves.ForEachWhere(x => x.SendPacket(HubOutbound.HubPersonalMessage(x, leaf.Ident, u)),
                                                 x => x.Ident != leaf.Ident && x.LoginPhase == LinkLogin.Ready);
                }
            }

            LeafPool.Leaves.ForEachWhere(x =>
            {
                leaf.SendPacket(HubOutbound.HubLeafConnected(leaf, x));

                foreach (LinkUser u in x.Users)
                {
                    leaf.SendPacket(HubOutbound.HubUserlistItem(leaf, x.Ident, u));

                    if (u.CustomName.Length > 0)
                    {
                        leaf.SendPacket(HubOutbound.HubCustomName(leaf, x.Ident, u));
                    }

                    if (u.Avatar.Length > 0)
                    {
                        leaf.SendPacket(HubOutbound.HubAvatar(leaf, x.Ident, u));
                    }

                    if (u.PersonalMessage.Length > 0)
                    {
                        leaf.SendPacket(HubOutbound.HubPersonalMessage(leaf, x.Ident, u));
                    }
                }
            },
                                         x => x.Ident != leaf.Ident && x.LoginPhase == LinkLogin.Ready);
        }
Example #2
0
        public static void Eval(Leaf leaf, LinkMsg msg, TCPPacketReader packet, ulong time, LinkMode mode)
        {
            switch (msg)
            {
            case LinkMsg.MSG_LINK_LEAF_AVATAR:
                LeafAvatar(leaf, packet);
                break;

            case LinkMsg.MSG_LINK_LEAF_CUSTOM_NAME:
                LeafCustomName(leaf, packet);
                break;

            case LinkMsg.MSG_LINK_LEAF_EMOTE_TEXT:
                LeafEmoteText(leaf, packet);
                break;

            case LinkMsg.MSG_LINK_LEAF_LOGIN:
                LeafLogin(leaf, packet, time, mode);
                break;

            case LinkMsg.MSG_LINK_LEAF_PERSONAL_MESSAGE:
                LeafPersonalMessage(leaf, packet);
                break;

            case LinkMsg.MSG_LINK_LEAF_PRIVATE_IGNORED:
                LeafPrivateIgnored(leaf, packet);
                break;

            case LinkMsg.MSG_LINK_LEAF_PRIVATE_TEXT:
                LeafPrivateText(leaf, packet);
                break;

            case LinkMsg.MSG_LINK_LEAF_PUBLIC_TEXT:
                LeafPublicText(leaf, packet);
                break;

            case LinkMsg.MSG_LINK_LEAF_USERLIST_END:
                LeafUserlistEnd(leaf);
                break;

            case LinkMsg.MSG_LINK_LEAF_USERLIST_ITEM:
                LeafUserlistItem(leaf, packet);
                break;

            case LinkMsg.MSG_LINK_LEAF_JOIN:
                LeafJoin(leaf, packet);
                break;

            case LinkMsg.MSG_LINK_LEAF_PART:
                LeafPart(leaf, packet);
                break;

            case LinkMsg.MSG_LINK_LEAF_PING:
                LeafPing(leaf, time);
                break;

            case LinkMsg.MSG_LINK_LEAF_USER_UPDATED:
                LeafUserUpdated(leaf, packet);
                break;

            case LinkMsg.MSG_LINK_LEAF_NICK_CHANGED:
                LeafNickChanged(leaf, packet);
                break;

            case LinkMsg.MSG_LINK_LEAF_VROOM_CHANGED:
                LeafVroomChanged(leaf, packet);
                break;

            case LinkMsg.MSG_LINK_LEAF_IUSER:
                LeafIUser(leaf, packet);
                break;

            case LinkMsg.MSG_LINK_LEAF_IUSER_BIN:
                LeafIUserBin(leaf, packet);
                break;

            case LinkMsg.MSG_LINK_LEAF_ADMIN:
                LeafAdmin(leaf, packet);
                break;

            case LinkMsg.MSG_LINK_LEAF_NO_ADMIN:
                LeafNoAdmin(leaf, packet);
                break;

            case LinkMsg.MSG_LINK_LEAF_BROWSE:
                LeafBrowse(leaf, packet);
                break;

            case LinkMsg.MSG_LINK_LEAF_BROWSE_DATA:
                LeafBrowseData(leaf, packet);
                break;

            case LinkMsg.MSG_LINK_LEAF_CUSTOM_DATA_TO:
                LeafCustomDataTo(leaf, packet);
                break;

            case LinkMsg.MSG_LINK_LEAF_CUSTOM_DATA_ALL:
                LeafCustomDataAll(leaf, packet);
                break;

            case LinkMsg.MSG_LINK_LEAF_PRINT_ALL:
                LeafPrintAll(leaf, packet);
                break;

            case LinkMsg.MSG_LINK_LEAF_PRINT_VROOM:
                LeafPrintVroom(leaf, packet);
                break;

            case LinkMsg.MSG_LINK_LEAF_PRINT_LEVEL:
                LeafPrintLevel(leaf, packet);
                break;

            case LinkMsg.MSG_LINK_LEAF_PUBLIC_TO_USER:
                LeafPublicToUser(leaf, packet);
                break;

            case LinkMsg.MSG_LINK_LEAF_EMOTE_TO_USER:
                LeafEmoteToUser(leaf, packet);
                break;

            case LinkMsg.MSG_LINK_LEAF_PUBLIC_TO_LEAF:
                LeafPublicToLeaf(leaf, packet);
                break;

            case LinkMsg.MSG_LINK_LEAF_EMOTE_TO_LEAF:
                LeafEmoteToLeaf(leaf, packet);
                break;

            case LinkMsg.MSG_LINK_LEAF_NUDGE:
                LeafNudge(leaf, packet);
                break;

            case LinkMsg.MSG_LINK_LEAF_SCRIBBLE_USER:
                LeafScribbleUser(leaf, packet);
                break;

            case LinkMsg.MSG_LINK_LEAF_SCRIBBLE_LEAF:
                LeafScribbleLeaf(leaf, packet);
                break;
            }
        }
Example #3
0
 private static void LeafPing(Leaf leaf, ulong time)
 {
     leaf.Time = time;
     leaf.SendPacket(HubOutbound.HubPong());
 }
Example #4
0
 private static void LeafLogin(Leaf leaf, TCPPacketReader packet, ulong time, LinkMode mode)
 {
 }