//129 - "REDEEM_VOUCHER": "BA"
        public void Listener129()
        {
            string voucherCode = FuseMessage.getArgument(1, mPacketBody);

            if (InstanceManager.Game.Catalogue.VoucherValid(voucherCode))
            {
                mUserInfo.iCredits += InstanceManager.Game.Catalogue.GetVoucherAmount(voucherCode);
                InstanceManager.Game.Catalogue.MarkVoucherAsRedeemed(voucherCode, mUserInfo.userId);

                InstanceManager.Game.Users.UpdateUser(mUserInfo);
                mUserInfo = InstanceManager.Game.Users.GetUser(mUserInfo.userId);

                mMessage.Init(6); //@F
                mMessage.appendString(mUserInfo.iCredits.ToString() + ".0");
                SendMessage(mMessage);

                mMessage.Init(212); //CT
                SendMessage(mMessage);
            }
            else
            {
                mMessage.Init(213); //CU
                mMessage.appendInt(1);
                SendMessage(mMessage);
            }
        }
        //198 - "CHANGECALLCATEGORY": "CF"
        public void Listener198()
        {
            string payload  = FuseMessage.getArgument(1, mPacketBody);
            int    callId   = ArgumentEncoding.decodeInt(payload);
            int    priority = ArgumentEncoding.decodeInt(mPacketBody.Substring(payload.Length + 2));

            InstanceManager.Game.Moderation.UpgradeCFH(callId, priority, mUserInfo);
        }
        //199 - "MESSAGETOCALLER": "CG"
        public void Listener199()
        {
            int    callId  = ArgumentEncoding.decodeInt(FuseMessage.getArgument(1, mPacketBody));
            string message = FuseMessage.getArgument(2, mPacketBody);

            message = SpecialFiltering.FilterChars("2,9", message);
            InstanceManager.Game.Moderation.ReplyCallForHelp(callId, message, mUserInfo);
        }
        //41 - "FINDUSER": "******"
        public void Listener41()
        {
            string username = FuseMessage.getArgument(1, mPacketBody);
            string response = InstanceManager.Game.Messenger.BuildSearchResponse(username);

            if (response != null)
            {
                SendMessage(response);
            }
        }
        //74 - "SETSTUFFDATA": "AJ"
        public void Listener74()
        {
            string sItemId = FuseMessage.getArgument(1, mPacketBody);
            string sData   = SpecialFiltering.FilterChars("2,9,13,47", FuseMessage.getArgument(2, mPacketBody));
            int    itemId;

            if (int.TryParse(sItemId, out itemId))
            {
                mRoomInstance.Interactor.RequestSetStuffDataFloorItem(itemId, sData, mRoomInstance.GetUser(mSessionID), 0);
            }
        }
        private void DoRoomKick()
        {
            string alertMessage = FuseMessage.getArgument(1, mPayload);
            string alertExtra   = FuseMessage.getArgument(2, mPayload);

            int roomId = InstanceManager.Sessions.GetSession(mSessionID).mRoomID;

            if (roomId > 0)
            {
                InstanceManager.Game.Moderation.ModeratorRoomKick(roomId, mSessionID, alertMessage, alertExtra);
            }
        }
        private void DoKick()
        {
            string alertMessage = FuseMessage.getArgument(1, mPayload);
            string alertExtra   = FuseMessage.getArgument(2, mPayload);
            string alertUser    = FuseMessage.getArgument(3, mPayload);

            long targetSession = InstanceManager.Sessions.GetSessionFromUser(alertUser);

            if (targetSession != -1)
            {
                InstanceManager.Game.Moderation.ModeratorKick(null, targetSession, mSessionID, alertMessage, alertExtra);
            }
        }
        //203 - "APPROVE_PASSWORD": "******"
        public void Listener203()
        {
            string   newPassword = FuseMessage.getArgument(2, mPacketBody);
            UserInfo userInfo    = InstanceManager.Game.Users.GetUser(mUserInfo.userId);

            userInfo.sPassword = newPassword;
            InstanceManager.Game.Users.UpdateUser(userInfo);
            mUserInfo = InstanceManager.Game.Users.GetUser(userInfo.userId);
            InstanceManager.Sessions.GetSession(mSessionID).UpdateUserInfo(mUserInfo);
            mMessage.Init(169);     //Bi
            mMessage.appendInt(0);
            SendMessage(mMessage);
        }
 //42 - "APPROVENAME": "@j"
 public void Listener42()
 {
     mMessage.Init(36); //@d
     if (InstanceManager.Game.Users.UserExists(SpecialFiltering.FilterName(FuseMessage.getArgument(1, mPacketBody))) == true || FuseMessage.getArgument(1, mPacketBody).ToUpper().Contains("MOD-"))
     {
         mMessage.appendString("PA"); //Taken
     }
     else
     {
         mMessage.appendString("H"); //Free
     }
     SendMessage(mMessage);
 }
Exemple #10
0
        //52 - "CHAT": "@t"
        public void Listener52()
        {
            string message = FuseMessage.getArgument(1, mPacketBody);

            InstanceManager.Game.Misc.ChatFilter.FilterText(ref message, mSessionID, mRoomInstance.RoomInfo.RoomID, false, "say");
            RoomUser user = mRoomInstance.GetUser(mSessionID);

            if (message != null && !user.SpecialStates.ContainsKey("mute"))
            {
                ApplyEmotes(message);
                mRoomInstance.RoomTalkBroadcast(user.CurrentX, user.CurrentY, message, user.RoomUserID);
                mRoomInstance.MakeTalk(mSessionID, message);
            }
        }
Exemple #11
0
        //55 - "SHOUT": "@w"
        public void Listener55()
        {
            string message = FuseMessage.getArgument(1, mPacketBody);

            InstanceManager.Game.Misc.ChatFilter.FilterText(ref message, mSessionID, mRoomInstance.RoomInfo.RoomID, false, "shout");

            if (message != null && !mRoomInstance.GetUser(mSessionID).SpecialStates.ContainsKey("mute"))
            {
                ApplyEmotes(message);
                mMessage.Init(26); //@Z
                mMessage.appendString(ArgumentEncoding.encodeInt(mRoomInstance.GetUser(mSessionID).RoomUserID));
                mMessage.appendString(message);
                mMessage.appendChar(2);
                mRoomInstance.RoomBroadcast(mMessage);
                mRoomInstance.MakeTalk(mSessionID, message);
            }
        }
        //4 - "TRY_LOGIN": "******"
        public void Listener4()
        {
            loginTries++;

            if (loginTries > 3)
            {
                mMessage.Init(35); // @c
                mMessage.appendString("Too many login attempts");
                SendMessage(mMessage);
                InstanceManager.Connections.EndConnection(mSessionID);
            }
            else
            {
                string username = FuseMessage.getArgument(1, mPacketBody);
                string password = FuseMessage.getArgument(2, mPacketBody);
                ProcessLogin(username, password);
            }
        }
        private void DoBan()
        {
            string banReason = FuseMessage.getArgument(1, mPayload);
            string banExtra  = FuseMessage.getArgument(2, mPayload);
            string banUser   = FuseMessage.getArgument(3, mPayload);
            string banLast   = mPayload.Substring(FuseMessage.getArgumentEnd(3, mPayload));

            int  banHours   = ArgumentEncoding.decodeInt(banLast);
            bool banIp      = ArgumentEncoding.decodeInt(banLast.Substring(ArgumentEncoding.getLength(banHours) + 1)) > 0;
            bool banMachine = ArgumentEncoding.decodeInt(banLast.Substring(ArgumentEncoding.getLength(banHours))) > 0;

            long targetSession = InstanceManager.Sessions.GetSessionFromUser(banUser);

            if (targetSession != -1)
            {
                UserInfo user = InstanceManager.Sessions.GetSession(targetSession).mUserInfo;
                InstanceManager.Game.Moderation.ModeratorBan(null, user.userId, mUserInfo.userId, banReason, banHours, targetSession, mSessionID, banMachine, banIp, banExtra);
            }
        }
        //39 - "MESSENGER_REQUESTBUDDY": "@g"
        public void Listener39()
        {
            string username = FuseMessage.getArgument(1, mPacketBody);

            if (InstanceManager.Game.Users.UserExists(username))
            {
                UserInfo user = InstanceManager.Game.Users.GetUser(username);
                if (InstanceManager.Game.Messenger.GetBuddy(mUserInfo.userId, user.userId) == null)
                {
                    InstanceManager.Game.Messenger.AddBuddy(mUserInfo.userId, user.userId);

                    if (InstanceManager.Sessions.GetSessionFromUser(user.userId) != -1)
                    {
                        mMessage.Init(132); //BD
                        mMessage.appendArgumentInt(mUserInfo.userId);
                        mMessage.appendString(mUserInfo.sUsername);
                        mMessage.appendChar(2);
                        InstanceManager.Sessions.GetSession(InstanceManager.Sessions.GetSessionFromUser(user.userId)).SendMessage(mMessage);
                    }
                }
            }
        }
 //98 - "LETUSERIN": "Ab"
 public void Listener98()
 {
     if (mRoomInstance.GetUser(mSessionID).HasRights || mRoomInstance.GetUser(mSessionID).HasAdmin)
     {
         string userName = FuseMessage.getArgument(1, mPacketBody);
         string letIn    = mPacketBody.Substring(mPacketBody.Length - 1);
         Session.SessionHandler session = InstanceManager.Sessions.GetSession(InstanceManager.Sessions.GetSessionFromUser(userName));
         if (session.waitingFlat == mRoomInstance.RoomInfo.RoomID)
         {
             session.waitingFlat = 0;
             if (Base64Encoding.DecodeInt(letIn) == 0)
             {
                 mMessage.Init(131); //BC
             }
             else
             {
                 session.authenticatedFlat = mRoomInstance.RoomInfo.RoomID;
                 mMessage.Init(41); // @i
             }
             session.SendMessage(mMessage);
         }
     }
 }
Exemple #16
0
        //56 - "WHISPER": "@x"
        public void Listener56()
        {
            string message = FuseMessage.getArgument(1, mPacketBody);
            int    tSpace  = message.IndexOf(" ");
            string user    = message.Substring(0, tSpace);
            string chat    = message.Substring(tSpace + 1);

            InstanceManager.Game.Misc.ChatFilter.FilterText(ref chat, mSessionID, mRoomInstance.RoomInfo.RoomID, false, "whisper to " + user);

            if (chat != null && !mRoomInstance.GetUser(mSessionID).SpecialStates.ContainsKey("mute"))
            {
                ApplyEmotes(chat);
                long sender   = mRoomInstance.GetUser(mSessionID).SessionID;
                long receiver = mRoomInstance.GetUser(user).SessionID;
                mMessage.Init(25); //@Y
                mMessage.appendString(ArgumentEncoding.encodeInt(mRoomInstance.GetUser(mSessionID).RoomUserID));
                mMessage.appendString(chat);
                mMessage.appendChar(2);
                mRoomInstance.SendMessage(mMessage, sender);
                mRoomInstance.SendMessage(mMessage, receiver);
                mRoomInstance.MakeTalk(mSessionID, chat);
            }
        }
        //999 - "HOUSEKEEPING0": "Og"
        public void Listener999()
        {
            if (InstanceManager.Connections.GetConnection(mSessionID).GetIP() == "127.0.0.1")
            {
                string command = FuseMessage.getArgument(1, mPacketBody);
                int    issuer  = int.Parse(FuseMessage.getArgument(2, mPacketBody));
                int    target  = int.Parse(FuseMessage.getArgument(3, mPacketBody));
                string message = FuseMessage.getArgument(4, mPacketBody);
                if (InstanceManager.Game.Moderation.HouseKeepingCommand(mSessionID, issuer, target, command, message))
                {
                    SendMessage("ACK");
                }
                else
                {
                    SendMessage("BAD");
                }
            }
            else
            {
                SendMessage("BAD");
            }

            InstanceManager.Sessions.GetSession(mSessionID).MakeSessionDirty();
        }
Exemple #18
0
        //86 - "CRYFORHELP": "AV"
        public void Listener86()
        {
            string message = FuseMessage.getArgument(1, mPacketBody);

            InstanceManager.Game.Moderation.CallForHelp(mRoomInstance.GetUser(mSessionID), mRoomInstance.RoomInfo, message);
        }
        //48 - "PICK_CRYFORHELP": "@p"
        public void Listener48()
        {
            int callId = ArgumentEncoding.decodeInt(FuseMessage.getArgument(1, mPacketBody));

            InstanceManager.Game.Moderation.PickupCallForHelp(callId, mUserInfo);
        }
        //190 - "SCR_BUY": "B~"
        public void Listener190()
        {
            if (FuseMessage.getArgument(1, mPacketBody) == "club_habbo")
            {
                int months       = 0;
                int deduct       = 9999;
                int purchaseType = ArgumentEncoding.decodeInt(mPacketBody.Substring(12));
                if (purchaseType == 1)
                {
                    deduct = 25;
                    months = 1;
                }
                if (purchaseType == 2)
                {
                    deduct = 60;
                    months = 3;
                }
                if (purchaseType == 3)
                {
                    deduct = 105;
                    months = 6;
                }

                if (mUserInfo.iCredits - deduct >= 0)
                {
                    mUserInfo.iCredits -= deduct;
                    for (int i = 1; i <= months; i++)
                    {
                        if (mUserInfo.ClubDaysRemaining == 0)
                        {
                            mUserInfo.ClubDaysRemaining = 31;
                        }
                        else
                        {
                            mUserInfo.ClubMonthsRemaining++;
                        }
                        if (mUserInfo.iRole == int.Parse(Users.UserSettings.DefaultRole))
                        {
                            mUserInfo.iRole = int.Parse(Users.UserSettings.ClubRole);
                        }
                    }
                    mUserInfo.ClubLastUpdate = DateTime.Now;

                    InstanceManager.Game.Users.UpdateUser(mUserInfo);
                    mUserInfo = InstanceManager.Game.Users.GetUser(mUserInfo.userId);

                    mMessage.Init(2); //@B
                    mMessage.appendString(InstanceManager.Game.Roles.GenerateRightsList(mUserInfo.iRole));
                    SendMessage(mMessage);

                    mMessage.Init(8); //@H
                    mMessage.appendString(Settings.ClientClubAllowedSets);
                    SendMessage(mMessage);

                    mMessage.Init(6); //@F
                    mMessage.appendString(mUserInfo.iCredits.ToString() + ".0");
                    SendMessage(mMessage);

                    mMessage.Init(7); //@G
                    mMessage.appendString("club_habbo");
                    mMessage.appendChar(2);
                    mMessage.appendArgumentInt(mUserInfo.ClubDaysRemaining);
                    mMessage.appendArgumentInt(mUserInfo.ClubMonthsPassed);
                    mMessage.appendArgumentInt(mUserInfo.ClubMonthsRemaining);
                    mMessage.appendArgumentInt(1);
                    SendMessage(mMessage);

                    mMessage.Init(229); //Ce
                    int badgeCount = InstanceManager.Game.Roles.GetBadgeCount(mUserInfo.iRole);
                    mMessage.appendString(ArgumentEncoding.encodeInt(badgeCount));
                    if (badgeCount > 0)
                    {
                        mMessage.appendString(InstanceManager.Game.Roles.GenerateBadgeList(mUserInfo.iRole));
                        mUserInfo.Badges = InstanceManager.Game.Roles.GetBadges(mUserInfo.iRole);
                    }
                    mMessage.appendString("HH");
                    SendMessage(mMessage);
                }
            }
        }