Beispiel #1
0
 // Start is called before the first frame update
 protected virtual void Start()
 {
     shark.AddSharkComponent(this);
     pixelManager = FindObjectOfType <PixelManager>();
     GetComponent <Rigidbody2D>().isKinematic = true;
     GetComponent <Collider2D>().enabled      = false;
 }
Beispiel #2
0
 public void Destroy()
 {
     if (Task != null)
     {
         Task = null;
     }
     using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient())
     {
         DatabaseCleanup(adapter, 0);
     }
     if (GetClientManager() != null)
     {
         GetClientManager().Clear();
         GetClientManager().StopConnectionChecker();
     }
     if (GetPixelManager() != null)
     {
         PixelManager.KeepAlive = false;
     }
     ClientManager        = null;
     BanManager           = null;
     RoleManager          = null;
     HelpTool             = null;
     Catalog              = null;
     Navigator            = null;
     ItemManager          = null;
     RoomManager          = null;
     AdvertisementManager = null;
     PixelManager         = null;
 }
Beispiel #3
0
        // POST: api/Home
        public IHttpActionResult Post(ManipulationRequestModel value)
        {
            Bitmap image = null;

            try
            {
                using (MemoryStream ms = new MemoryStream(value.Image.Buffer))
                    image = new Bitmap(ms, false);
                PixelManager.Manipulate(image, value.GetEffect());
                byte[] manipulatedImageByteArr;
                using (MemoryStream ms = new MemoryStream())
                {
                    image.Save(ms, ImageFormat.Png);
                    manipulatedImageByteArr = ms.ToArray();
                }
                return(Ok(new ManipulationResultModel
                {
                    Image = new ImageModel("image/png",
                                           manipulatedImageByteArr)
                }));
            }
            finally
            {
                image?.Dispose();
            }
        }
Beispiel #4
0
 public void ContinueLoading()
 {
     if (this.task_0 != null)
     {
         this.task_0 = null;
     }
     using (DatabaseClient @class = GoldTree.GetDatabase().GetClient())
     {
         this.method_0(@class, 0);
     }
     if (this.GetClientManager() != null)
     {
         this.GetClientManager().method_6();
         this.GetClientManager().method_11();
     }
     if (this.GetPixelManager() != null)
     {
         this.PixelManager.KeepAlive = false;
     }
     this.ClientManager        = null;
     this.BanManager           = null;
     this.RoleManager          = null;
     this.HelpTool             = null;
     this.Catalog              = null;
     this.Navigator            = null;
     this.ItemManager          = null;
     this.RoomManager          = null;
     this.AdvertisementManager = null;
     this.PixelManager         = null;
 }
Beispiel #5
0
        internal Game(int conns)
        {
            ClientManager = new GameClientManager();

            //if (ButterflyEnvironment.GetConfig().data["client.ping.enabled"] == "1")
            //{
            //    ClientManager.StartConnectionChecker();
            //}


            using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().getQueryreactor())
            {
                //ButterflyEnvironment.GameInstance = this;
                DateTime start = DateTime.Now;

                BanManager           = new ModerationBanManager();
                RoleManager          = new RoleManager();
                HelpTool             = new HelpTool();
                Catalog              = new Catalog();
                Navigator            = new Navigator();
                ItemManager          = new ItemManager();
                RoomManager          = new RoomManager();
                AdvertisementManager = new AdvertisementManager();
                PixelManager         = new PixelManager();

                ModerationTool = new ModerationTool();
                BotManager     = new BotManager();
                questManager   = new QuestManager();
                //soundMachineManager = new SoundMachineManager();

                TimeSpan spent = DateTime.Now - start;

                Logging.WriteLine("Class initialization -> READY! (" + spent.Seconds + " s, " + spent.Milliseconds + " ms)");
            }
        }
Beispiel #6
0
        public void ContinueLoading()
        {
            if (this.task_0 != null)
            {
                this.task_0 = null;
            }


            using (DatabaseClient dbClient = Essential.GetDatabase().GetClient())
            {
                this.RestoreStatistics(dbClient, 0);
            }

            if (this.GetClientManager() != null)
            {
                this.GetClientManager().StopPingTask();
            }

            if (this.GetPixelManager() != null)
            {
                this.PixelManager.KeepAlive = false;
            }

            this.ClientManager = null;
            this.BanManager    = null;
            this.RoleManager   = null;
            this.HelpTool      = null;
            this.Catalog       = null;
            this.Navigator     = null;
            this.ItemManager   = null;
            this.RoomManager   = null;
            this.PixelManager  = null;
        }
Beispiel #7
0
 public ChangeAction( PixelManager pixelManager, PixelConfig pixel, Color newColor )
 {
    _pixelManager = pixelManager;
    _pixel = pixel;
    _originalColor = pixel.Color;
    _newColor = newColor;
 }
    // Update is called once per frame
    public void Update()
    {
        if (AvatarState == E_AvatarState.AS_DEAD)
        {
            return;
        }

        //if (_childObj.eulerAngles.x > 0 || _childObj.eulerAngles.z > 0)
        //{
        //    //补充功能:如果掉落,需要重新拉回
        //    _childObj.eulerAngles = new Vector3(0, _childObj.eulerAngles.y, 0);
        //  //  _ufpTransformChildObj.rotation = FPQuaternion.Eule(0, _ufpTransformChildObj.eulerAngles.y, 0);
        //}
        RaycastHit info;

        if (PixelManager.GetInstance() != null && _characterMotionObj.RayGroundInfo(out info) &&
            (AvatarMotion == E_AvatarMotionState.AM_IDLE))
        {
            PixelManager.E_InColorType type = PixelManager.GetInstance().GetPixelsInfo(AvatarEntityId, info.textureCoord);
            AcquireRestoreEnergySpeed(type);

            //2)处于敌方颜料中血量的减少
            if (type == PixelManager.E_InColorType.IC_OTHER_COLOR)
            {
                Hp--;
            }
        }

        //  Debug.Log("Hp::::" + Hp);
    }
Beispiel #9
0
        internal Game(int conns)
        {
            ClientManager = new GameClientManager();

            //if (PiciEnvironment.GetConfig().data["client.ping.enabled"] == "1")
            //{
            //    ClientManager.StartConnectionChecker();
            //}


            using (IQueryAdapter dbClient = PiciEnvironment.GetDatabaseManager().getQueryreactor())
            {
                //PiciEnvironment.GameInstance = this;
                DateTime start = DateTime.Now;

                BanManager           = new ModerationBanManager();
                RoleManager          = new RoleManager();
                HelpTool             = new HelpTool();
                Catalog              = new Catalog();
                Navigator            = new Navigator();
                ItemManager          = new ItemManager();
                RoomManager          = new RoomManager();
                AdvertisementManager = new AdvertisementManager();
                PixelManager         = new PixelManager();

                ModerationTool = new ModerationTool();
                BotManager     = new BotManager();
                questManager   = new QuestManager();
                //soundMachineManager = new SoundMachineManager();

                TimeSpan spent = DateTime.Now - start;
            }
        }
Beispiel #10
0
        //private static DateTime pixelLastExecution;
        private void CheckCycleUpdates()
        {
            if (cyclePixelsEnabled)
            {
                TimeSpan sinceLastTime = DateTime.Now - cyclePixelsLastUpdate;

                if (sinceLastTime.TotalMilliseconds >= cyclePixelsTime)
                {
                    cyclePixelsLastUpdate = DateTime.Now;
                    try
                    {
                        foreach (GameClient client in clients.Values)
                        {
                            if (client.GetHabbo() == null)
                            {
                                continue;
                            }

                            PixelManager.GivePixels(client, cyclePixelsAmount);
                        }
                    }

                    catch (Exception e)
                    {
                        Logging.LogThreadException(e.ToString(), "GCMExt.cyclePixelsEnabled task");
                    }
                }
            }

            if (cycleCreditsEnabled)
            {
                TimeSpan sinceLastTime = DateTime.Now - cycleCreditsLastUpdate;

                if (sinceLastTime.TotalMilliseconds >= cycleCreditsTime)
                {
                    cycleCreditsLastUpdate = DateTime.Now;
                    try
                    {
                        foreach (GameClient client in clients.Values)
                        {
                            if (client.GetHabbo() == null)
                            {
                                continue;
                            }

                            client.GetHabbo().Credits += cycleCreditsAmount;
                            client.GetHabbo().UpdateCreditsBalance();
                        }
                    }

                    catch (Exception e)
                    {
                        Logging.LogThreadException(e.ToString(), "GCMExt.cycleCreditsEnabled task");
                    }
                }
            }

            CheckEffects();
        }
Beispiel #11
0
 public static PixelManager GetInstance()
 {
     if (instance == null)
     {
         instance = new PixelManager();
     }
     return(instance);
 }
Beispiel #12
0
        public Game(int conns)
        {
            ClientManager = new GameClientManager(conns);
            if (PhoenixEnvironment.GetConfig().data["client.ping.enabled"] == "1")
            {
                ClientManager.StartConnectionChecker();
            }
            DateTime Now = DateTime.Now;

            Logging.Write("Connecting to database...");
            using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient())
            {
                Logging.WriteLine("completed!");
                PhoenixEnvironment.GameInstance = this;
                LoadSettings(adapter);
                BanManager           = new ModerationBanManager();
                RoleManager          = new RoleManager();
                HelpTool             = new HelpTool();
                Catalog              = new Catalog();
                Navigator            = new Navigator();
                ItemManager          = new ItemManager();
                RoomManager          = new RoomManager();
                AdvertisementManager = new AdvertisementManager();
                PixelManager         = new PixelManager();
                AchievementManager   = new AchievementManager();
                ModerationTool       = new ModerationTool();
                BotManager           = new BotManager();
                Marketplace          = new Marketplace();
                QuestManager         = new QuestManager();
                TextManage           = new TextManager();
                Guilds = new GroupManager();
                TextManager.LoadTexts(adapter);
                BanManager.LoadBans(adapter);
                RoleManager.LoadRoles(adapter);
                HelpTool.LoadCategories(adapter);
                HelpTool.LoadTopics(adapter);
                ModerationTool.LoadMessagePresets(adapter);
                ModerationTool.LoadPendingTickets(adapter);
                ItemManager.LoadItems(adapter);
                Catalog.Initialize(adapter);
                Catalog.InitCache();
                Navigator.Initialize(adapter);
                RoomManager.LoadModels(adapter);
                RoomManager.LoadCache();
                NavigatorCache = new NavigatorCache();
                AdvertisementManager.LoadRoomAdvertisements(adapter);
                BotManager.LoadBots(adapter);
                AchievementManager.LoadAchievements(adapter);
                PixelManager.Start();
                ChatCommandHandler.InitFilter(adapter);
                QuestManager.InitQuests();
                GroupManager.LoadGroups(adapter);
                DatabaseCleanup(adapter, 1);
            }
            Task = new Task(new Action(LowPriorityWorker.Process));
            Task.Start();
        }
    public void testNum()
    {
        int entityId = 1000;

        AvatarEntityId = entityId;
        PixelManager.GetInstance().SetPlayerIdToTeamColor(entityId, Color.blue);
        WeaponCasterObj.SetWeaponInkColor(Color.blue);
        AutoRenderSplatData(entityId);
    }
Beispiel #14
0
 // Start is called before the first frame update
 protected void Start()
 {
     uiManager       = FindObjectOfType <UIManager>();
     pixelManager    = FindObjectOfType <PixelManager>();
     sharkComponents = new List <SharkComponent>();
     attackComp      = null;
     meleeHitBox.SetActive(false);
     cooldownTimer = 0.0f;
     currHealth    = maxHealth;
 }
 public void RenderTextureToStaticData()
 {
     //对当前对象进行渲染
     if (PixelManager.GetInstance().JudgetRenderTexture(ObjectId, this))
     {
         Debug.Log("Render------ObjectId::" + ObjectId);
         texture2D = PixelManager.GetInstance().ObjectIDToTexture2D[ObjectId];
         SetRenderTexture2D(ref texture2D);
         texture2D.Apply();
     }
 }
    public bool AcquireInkColorType(out PixelManager.E_InColorType ColorType)
    {
        RaycastHit info;

        if (!_characterMotionObj.OnGrouldRayInfoAndRender(out info))
        {
            ColorType = PixelManager.E_InColorType.IC_BLANK_COLOR;
            return(false);
        }
        ColorType = PixelManager.GetInstance().GetPixelsInfo(AvatarEntityId, info.textureCoord);
        return(true);
    }
    /// <summary>
    /// 初始化武器数据
    /// </summary>
    public void InitWeaponData(int entityId)
    {
        if (!WeaponCasterObj)
        {
            Debug.Log("SetWeaponRenderColor:::WeaponCasterObj is null!!");
            return;
        }
        int   WeaponId    = GameManager.Instance.GetWeaponIdByEntityId(entityId);
        Color WeaponColor = GameManager.Instance.GetTeamColorByEntityId(entityId);

        PixelManager.GetInstance().SetPlayerIdToTeamColor(entityId, WeaponColor);
        WeaponCasterObj.InitWeaponData(WeaponId, WeaponColor);
    }
    public bool AcquireInkColorType(out PixelManager.E_InColorType ColorType, out bool Slope)
    {
        RaycastHit info;

        if (!_characterMotionObj.OnGrouldRayInfoAndRender(out info))
        {
            Slope     = false;
            ColorType = PixelManager.E_InColorType.IC_BLANK_COLOR;
            return(false);
        }
        ColorType = PixelManager.GetInstance().GetPixelsInfo(AvatarEntityId, info.textureCoord);
        Slope     = (Vector3.Angle(Vector3.up, info.normal) > _characterMotionObj.SlopeAngle) ? true : false;
        return(true);
    }
Beispiel #19
0
        internal void GetCreditsInfo()
        {
            if (FirewindEnvironment.GetGame().GetClientManager().pixelsOnLogin > 0)
            {
                PixelManager.GivePixels(Session, FirewindEnvironment.GetGame().GetClientManager().pixelsOnLogin);
            }
            else
            {
                Session.GetHabbo().UpdateActivityPointsBalance(false);
            }

            if (FirewindEnvironment.GetGame().GetClientManager().creditsOnLogin > 0)
            {
                Session.GetHabbo().Credits += FirewindEnvironment.GetGame().GetClientManager().creditsOnLogin;
            }

            Session.GetHabbo().UpdateCreditsBalance();
        }
 static void Main(string[] args)
 {
     //Creating a bitmap from a source file
     using (Bitmap carBitmap = new Bitmap(Image.FromFile($"sources/Car.jpeg")))
         using (Bitmap cloneCarBitmap = new Bitmap(carBitmap.Clone() as Image))
         {
             //Displaying the image pre manipulation
             PopupImage(carBitmap, "Photo pre manipulation");
             //Manipulating the image
             var before = DateTime.Now;
             for (int i = 0; i < 5000; i++)
             {
                 PixelManager.Manipulate(cloneCarBitmap, PixelManager.ManipulationEffect.Aesthetic);
             }
             var after = DateTime.Now;
             //Displaying the image post manipulation
             PopupImage(cloneCarBitmap, $"manipulation took {(after - before).ToString()}");
             Console.ReadKey();
         }
 }
Beispiel #21
0
    public bool CanMoveByInk(ref RaycastHit rayHitInfo)
    {
        if (rayHitInfo.transform == null)
        {
            return(false);
        }
        if (rayHitInfo.transform.gameObject.layer != _layerNum)
        {
            return(false);
        }
        //if (CurGroundObj == null || CurGroundObj.name != rayHitInfo.transform.name)
        //{
        //    CurGroundObj = rayHitInfo.transform;
        SplatManager renderObj = rayHitInfo.transform.GetComponent <SplatManager>();

        if (renderObj == null)
        {
            Debug.Log("SplatManager_name_name_name:::" + rayHitInfo.transform.name);
            return(false);
        }

        if (PixelManager.GetInstance() == null)
        {
            Debug.Log("renderObj.ObjectId_PixelManager.GetInstance() is null!!!:::" + renderObj.ObjectId);
            return(false);
        }

        //先判断是否已经有玩家对象和渲染对象了,根据情况添加玩家对象和渲染对象
        if (!PixelManager.GetInstance().ObjectIDToTexture2D.ContainsKey(renderObj.ObjectId))
        {
            Texture2D obj = RenderTexturePool.GetInstance().InstanceTexture2D();
            renderObj.SetRenderTexture2D(ref obj);
            PixelManager.GetInstance().SetObjectIDToTexture2D(renderObj.ObjectId, obj);
            renderObj.RenderTextureToStaticData();
            Debug.Log("PlayerIDToObjectID.GetInstance():::" + PixelManager.GetInstance().PlayerIDToObjectID.Count + " ," + PixelManager.GetInstance().PlayerIDToObjectID.Keys);
        }
        return(PixelManager.GetInstance().IsInOneSelfInk(AvatarEntityId, renderObj.ObjectId, rayHitInfo.textureCoord));
        //  bool data = PixelManager.GetInstance().GetPixelsInfo(PlayerId, _groundHit.textureCoord);
        //   }
    }
Beispiel #22
0
    public bool OnGrouldRayInfoAndRender(out RaycastHit _groundHit)
    {
        if (!RayGroundInfo(out _groundHit))
        {
            return(false);
        }

        if (_groundHit.transform.gameObject.layer != _layerNum)
        {
            return(false);
        }
        if (CurGroundObj == null || CurGroundObj.name != _groundHit.transform.name)
        {
            CurGroundObj = _groundHit.transform;
            SplatManager renderObj = _groundHit.transform.GetComponent <SplatManager>();
            if (renderObj == null)
            {
                Debug.Log("SplatManager_name_name_name:::" + _groundHit.transform.name);
                return(false);
            }

            if (PixelManager.GetInstance() == null)
            {
                Debug.Log("renderObj.ObjectId_PixelManager.GetInstance() is null!!!:::" + renderObj.ObjectId);
                return(false);
            }

            //先判断是否已经有玩家对象和渲染对象了,根据情况添加玩家对象和渲染对象
            if (!PixelManager.GetInstance().SetPlayerIdToObjectID(AvatarEntityId, renderObj.ObjectId))
            {
                Texture2D obj = RenderTexturePool.GetInstance().InstanceTexture2D();
                renderObj.SetRenderTexture2D(ref obj);
                PixelManager.GetInstance().SetObjectIDToTexture2D(renderObj.ObjectId, obj);
                Debug.Log("PlayerIDToObjectID.GetInstance():::" + PixelManager.GetInstance().PlayerIDToObjectID.Count + " ," + PixelManager.GetInstance().PlayerIDToObjectID.Keys);
            }
            //  bool data = PixelManager.GetInstance().GetPixelsInfo(PlayerId, _groundHit.textureCoord);
        }
        return(true);
    }
Beispiel #23
0
        public void ContinueLoading()
        {
            if (this.task_0 != null)
            {
                this.task_0 = null;
            }

            try
            {
                using (DatabaseClient dbClient = GoldTree.GetDatabase().GetClient())
                {
                    this.RestoreStatistics(dbClient, 0);
                }
            }
            catch (MySql.Data.MySqlClient.MySqlException e) { /* database connection not available */ }

            if (this.GetClientManager() != null)
            {
                this.GetClientManager().method_6();
                this.GetClientManager().method_11();
            }

            if (this.GetPixelManager() != null)
            {
                this.PixelManager.KeepAlive = false;
            }

            this.ClientManager        = null;
            this.BanManager           = null;
            this.RoleManager          = null;
            this.HelpTool             = null;
            this.Catalog              = null;
            this.Navigator            = null;
            this.ItemManager          = null;
            this.RoomManager          = null;
            this.AdvertisementManager = null;
            this.PixelManager         = null;
        }
Beispiel #24
0
 internal Game(int conns)
 {
     Logging.WriteLine("Starting modules...");
     this.ClientManager  = new GameClientManager();
     this.BanManager     = new ModerationBanManager();
     this.RoleManager    = new RoleManager();
     this.Navigator      = new Navigator();
     this.ItemManager    = new ItemManager();
     this.Catalog        = new Catalog();
     this.RoomManager    = new RoomManager();
     this.PixelManager   = new PixelManager();
     this.HotelView      = new HotelView();
     this.ModerationTool = new ModerationTool();
     this.BotManager     = new BotManager();
     this.questManager   = new QuestManager();
     this.Events         = new RoomEvents();
     this.groupManager   = new GroupManager();
     this.talentManager  = new TalentManager();
     this.VideoManager   = new VideoManager();
     this.PinataHandler  = new PinataHandler();
     this.PollManager    = new PollManager();
     this.AntiMutant     = new AntiMutant();
 }
Beispiel #25
0
 // Start is called before the first frame update
 void Start()
 {
     pixelManager = FindObjectOfType <PixelManager>();
 }
Beispiel #26
0
        internal bool tryLogin(string AuthTicket)
        {
            try
            {
                string   ip        = GetConnection().getIp();
                byte     errorCode = 0;
                UserData userData  = UserDataFactory.GetUserData(AuthTicket, ip, out errorCode);
                if (errorCode == 1)
                {
                    SendNotifWithScroll(LanguageLocale.GetValue("login.invalidsso"));
                    return(false);
                }
                else if (errorCode == 2)
                {
                    SendNotifWithScroll(LanguageLocale.GetValue("login.loggedin"));
                    return(false);
                }

                PiciEnvironment.GetGame().GetClientManager().RegisterClient(this, userData.userID, userData.user.Username);
                this.Habbo = userData.user;
                userData.user.LoadData(userData);

                if (userData.user.Username == null)
                {
                    SendBanMessage("You have no username.");
                    return(false);
                }
                string banReason = PiciEnvironment.GetGame().GetBanManager().GetBanReason(userData.user.Username, ip);
                if (!string.IsNullOrEmpty(banReason))
                {
                    SendBanMessage(banReason);
                    return(false);
                }

                userData.user.Init(this, userData);

                QueuedServerMessage response = new QueuedServerMessage(Connection);

                userData.user.SerializeQuests(ref response);

                GetMessageHandler().GetResponse().Init(2);
                if (userData.user.HasRight("acc_anyroomowner"))
                {
                    GetMessageHandler().GetResponse().AppendInt32(7);
                }
                else if (userData.user.HasRight("acc_anyroomrights"))
                {
                    GetMessageHandler().GetResponse().AppendInt32(5);
                }
                else if (userData.user.HasRight("acc_supporttool"))
                {
                    GetMessageHandler().GetResponse().AppendInt32(4);
                }
                else if (GetHabbo().GetSubscriptionManager().HasSubscription("habbo_vip"))
                {
                    GetMessageHandler().GetResponse().AppendInt32(2);
                }
                else if (GetHabbo().GetSubscriptionManager().HasSubscription("habbo_club"))
                {
                    GetMessageHandler().GetResponse().AppendInt32(1);
                }
                else
                {
                    GetMessageHandler().GetResponse().AppendInt32(0);
                }

                GetMessageHandler().SendResponse();

                if (userData.user.HasRight("acc_supporttool"))
                {
                    SendMessage(PiciEnvironment.GetGame().GetModerationTool().SerializeTool());
                    PiciEnvironment.GetGame().GetModerationTool().SerializeOpenTickets(this);
                }

                SendMessage(userData.user.GetAvatarEffectsInventoryComponent().Serialize());

                GetMessageHandler().GetResponse().Init(290);
                GetMessageHandler().GetResponse().AppendBoolean(true);
                GetMessageHandler().GetResponse().AppendBoolean(false);
                GetMessageHandler().SendResponse();

                GetMessageHandler().GetResponse().Init(3);
                GetMessageHandler().SendResponse();

                GetMessageHandler().GetResponse().Init(517);
                GetMessageHandler().GetResponse().AppendBoolean(true);
                GetMessageHandler().SendResponse();

                //if (PixelManager.NeedsUpdate(this))
                //    PixelManager.GivePixels(this);

                if (PiciEnvironment.GetGame().GetClientManager().pixelsOnLogin > 0)
                {
                    PixelManager.GivePixels(this, PiciEnvironment.GetGame().GetClientManager().pixelsOnLogin);
                }



                if (PiciEnvironment.GetGame().GetClientManager().creditsOnLogin > 0)
                {
                    userData.user.Credits += PiciEnvironment.GetGame().GetClientManager().creditsOnLogin;
                    userData.user.UpdateCreditsBalance();
                }

                if (userData.user.HomeRoom > 0)
                {
                    GetMessageHandler().GetResponse().Init(455);
                    GetMessageHandler().GetResponse().AppendUInt(userData.user.HomeRoom);
                    GetMessageHandler().SendResponse();
                }

                GetMessageHandler().GetResponse().Init(458);
                GetMessageHandler().GetResponse().AppendInt32(30);
                GetMessageHandler().GetResponse().AppendInt32(userData.user.FavoriteRooms.Count);

                foreach (uint Id in userData.user.FavoriteRooms.ToArray())
                {
                    GetMessageHandler().GetResponse().AppendUInt(Id);
                }

                GetMessageHandler().SendResponse();

                if (!userData.user.GetBadgeComponent().HasBadge("ACH_BasicClub1"))
                {
                    userData.user.GetBadgeComponent().GiveBadge("ACH_BasicClub1", true);
                }
                else if (userData.user.GetBadgeComponent().HasBadge("ACH_BasicClub1"))
                {
                    userData.user.GetBadgeComponent().RemoveBadge("ACH_BasicClub1");
                }


                if (!userData.user.GetBadgeComponent().HasBadge("Z63"))
                {
                    userData.user.GetBadgeComponent().GiveBadge("Z63", true);
                }

                if (userData.user.Rank > 5 && !userData.user.GetBadgeComponent().HasBadge("ADM"))
                {
                    userData.user.GetBadgeComponent().GiveBadge("ADM", true);
                }


                ServerMessage alert = new ServerMessage(810);
                alert.AppendUInt(1);
                alert.AppendStringWithBreak(LanguageLocale.welcomeAlert);
                SendMessage(alert);
                Logging.WriteLine("[" + Habbo.Username + "] logged in");

                return(true);
            }
            catch (UserDataNotFoundException e)
            {
                SendNotifWithScroll(LanguageLocale.GetValue("login.invalidsso") + "extra data: " + e.ToString());
            }
            catch (Exception e)
            {
                Logging.LogCriticalException("Invalid Dario bug duing user login: "******"Login error: " + e.ToString());
                SendNotifWithScroll("Login error: " + e.ToString());
            }
            return(false);
        }
Beispiel #27
0
 public AddAction( PixelManager pixelManager, PixelConfig pixel )
 {
    _pixelManager = pixelManager;
    _pixel = pixel;
    _originalColor = pixel.Color;
 }
Beispiel #28
0
        internal bool tryLogin(string AuthTicket)
        {
            try
            {
                string   ip        = GetConnection().getIp();
                byte     errorCode = 0;
                UserData userData  = UserDataFactory.GetUserData(AuthTicket, ip, out errorCode);
                if (errorCode == 1)
                {
                    SendNotifWithScroll(LanguageLocale.GetValue("login.invalidsso"));
                    return(false);
                }
                else if (errorCode == 2)
                {
                    SendNotifWithScroll(LanguageLocale.GetValue("login.loggedin"));
                    return(false);
                }


                if (Program.LicHandeler != null && ButterflyEnvironment.GetGame().GetClientManager().ClientCount > Program.LicHandeler.AmountOfSlots)
                {
                    Program.LicHandeler.ReportFullServer();
                    SendBanMessage(LanguageLocale.GetValue("server.full"));
                    return(false);
                }
                ButterflyEnvironment.GetGame().GetClientManager().RegisterClient(this, userData.userID, userData.user.Username);
                this.Habbo = userData.user;
                userData.user.LoadData(userData);

                if (userData.user.Username == null)
                {
                    SendBanMessage("You have no username.");
                    return(false);
                }
                string banReason = ButterflyEnvironment.GetGame().GetBanManager().GetBanReason(userData.user.Username, ip);
                if (!string.IsNullOrEmpty(banReason))
                {
                    SendBanMessage(banReason);
                    return(false);
                }

                userData.user.Init(this, userData);

                QueuedServerMessage response = new QueuedServerMessage(Connection);

                userData.user.SerializeQuests(ref response);

                List <string> Rights = ButterflyEnvironment.GetGame().GetRoleManager().GetRightsForHabbo(userData.user);

                ServerMessage appendingResponse = new ServerMessage(2);
                appendingResponse.Init(2);
                appendingResponse.AppendInt32(Rights.Count);

                foreach (string Right in Rights)
                {
                    appendingResponse.AppendStringWithBreak(Right);
                }

                response.appendResponse(appendingResponse);

                if (userData.user.HasFuse("fuse_mod"))
                {
                    response.appendResponse(ButterflyEnvironment.GetGame().GetModerationTool().SerializeTool());
                    ButterflyEnvironment.GetGame().GetModerationTool().SerializeOpenTickets(ref response, userData.userID);
                }

                response.appendResponse(userData.user.GetAvatarEffectsInventoryComponent().Serialize());

                appendingResponse.Init(290);
                appendingResponse.AppendBoolean(true);
                appendingResponse.AppendBoolean(false);
                response.appendResponse(appendingResponse);

                appendingResponse.Init(3);
                response.appendResponse(appendingResponse);

                appendingResponse.Init(517);
                appendingResponse.AppendBoolean(true);
                response.appendResponse(appendingResponse);

                //if (PixelManager.NeedsUpdate(this))
                //    PixelManager.GivePixels(this);

                if (ButterflyEnvironment.GetGame().GetClientManager().pixelsOnLogin > 0)
                {
                    PixelManager.GivePixels(this, ButterflyEnvironment.GetGame().GetClientManager().pixelsOnLogin);
                }

                if (ButterflyEnvironment.GetGame().GetClientManager().creditsOnLogin > 0)
                {
                    userData.user.Credits += ButterflyEnvironment.GetGame().GetClientManager().creditsOnLogin;
                    userData.user.UpdateCreditsBalance();
                }

                if (userData.user.HomeRoom > 0)
                {
                    appendingResponse.Init(455);
                    appendingResponse.AppendUInt(userData.user.HomeRoom);
                    response.appendResponse(appendingResponse);
                }

                appendingResponse.Init(458);
                appendingResponse.AppendInt32(30);
                appendingResponse.AppendInt32(userData.user.FavoriteRooms.Count);

                foreach (uint Id in userData.user.FavoriteRooms.ToArray())
                {
                    appendingResponse.AppendUInt(Id);
                }

                response.appendResponse(appendingResponse);

                if (userData.user.HasFuse("fuse_use_club_badge") && !userData.user.GetBadgeComponent().HasBadge("ACH_BasicClub1"))
                {
                    userData.user.GetBadgeComponent().GiveBadge("ACH_BasicClub1", true);
                }
                else if (!userData.user.HasFuse("fuse_use_club_badge") && userData.user.GetBadgeComponent().HasBadge("ACH_BasicClub1"))
                {
                    userData.user.GetBadgeComponent().RemoveBadge("ACH_BasicClub1");
                }


                if (!userData.user.GetBadgeComponent().HasBadge("Z63"))
                {
                    userData.user.GetBadgeComponent().GiveBadge("Z63", true);
                }

                appendingResponse.Init(2);
                appendingResponse.AppendInt32(0);

                if (userData.user.HasFuse("fuse_use_vip_outfits")) // VIP
                {
                    appendingResponse.AppendInt32(2);
                }
                else if (userData.user.HasFuse("fuse_furni_chooser")) // HC
                {
                    appendingResponse.AppendInt32(1);
                }
                else
                {
                    appendingResponse.AppendInt32(0);
                }

                appendingResponse.AppendInt32(0);
                response.appendResponse(appendingResponse);

                appendingResponse.Init(2);
                appendingResponse.AppendInt32(Rights.Count);

                foreach (string Right in Rights)
                {
                    appendingResponse.AppendStringWithBreak(Right);
                }

                response.appendResponse(appendingResponse);

                if (LanguageLocale.welcomeAlertEnabled)
                {
                    ServerMessage alert = new ServerMessage(810);
                    alert.AppendUInt(1);
                    alert.AppendStringWithBreak(LanguageLocale.welcomeAlert);
                    response.appendResponse(alert);
                }

                response.sendResponse();
                Logging.WriteLine("[" + Habbo.Username + "] logged in");

                return(true);
            }
            catch (UserDataNotFoundException e)
            {
                SendNotifWithScroll(LanguageLocale.GetValue("login.invalidsso") + "extra data: " + e.ToString());
            }
            catch (Exception e)
            {
                //Logging.LogCriticalException("Invalid Dario bug duing user login: "******"Login error: " + e.ToString());
                SendNotifWithScroll("Login error: " + e.ToString());
            }
            return(false);
        }
Beispiel #29
0
 void Awake()
 {
     pixelManager = PixelManager.instance;
 }
Beispiel #30
0
    private void SpawnTask(LevelInfo data, GameType type) //Create a new level scene
    {
        if (DataManager.Instance.RemoveClearButtons)
        {
            letterDeleteButton.transform.parent.gameObject.SetActive(false);
            lettersFields.GetComponent <RectTransform>().sizeDelta += new Vector2(200f, 0f);
        }
        if (DataManager.Instance.isRatePopupNeeded && PlayerPrefs.GetInt("rate", 0) == 0 && (data.currentLevel - 1) != 0 &&
            (data.currentLevel - 1) % DataManager.Instance.afterEeachLevel == 0)
        {
            Instantiate(ratePrefab, main);
        }
        try
        {
            // Load and create new sprite from Resources in RAM optimization purpose
            Texture2D newtask = Resources.Load(data.directoryName + "\u002F" + data.currentLevel) as Texture2D;
            taskImage.sprite = Sprite.Create(newtask, new Rect(0, 0, newtask.width, newtask.height), new Vector2(0.5f, 0.5f));
        }
        catch (System.Exception)
        {
            Debug.LogError("You made a mistake in filenames in the Resources folder probably");
        }

        levelColor = DataManager.Instance.colors[Random.Range(0, DataManager.Instance.colors.Length - 1)];
        StaticBehaviors.SetCoinsText();

        //Provide requested manager with data and start its logic
        switch (type)
        {
        case GameType.Default:
            break;

        case GameType.Pixel:

            PixelManager pixel = taskImage.gameObject.GetComponent <PixelManager>();
            pixel.enabled = true;
            pixel.OnStart(data);
            break;

        case GameType.Erasure:

            ErasureManager erasure = taskImage.gameObject.GetComponent <ErasureManager>();
            erasure.enabled = true;
            erasure.OnStart(data);
            break;

        case GameType.Planks:

            PlanksManager planks = taskImage.gameObject.GetComponent <PlanksManager>();
            planks.OnStart(data);
            break;

        case GameType.ImageText:
            ImageTextManager imageText = taskImage.gameObject.GetComponent <ImageTextManager>();
            imageText.OnStart();
            break;

        default:
            break;
        }

        taskLevel.text   = data.currentLevel.ToString();
        letterList       = CreateLetterList(LevelManager.fullList);          //Instantiate letter prefabs and add their scripts to the collection
        letterFieldsList = CreateLetterFields(LevelManager.rightAnswerList); //Instantiate letter fields and add their scripts to the collection
        border.gameObject.GetComponent <Image>().color = levelColor;

        StartCoroutine(SpawnLetters(letterList, data)); //Spawn letters
        MusicManager.instance.PlaySound("start");
    }
Beispiel #31
0
        public Game(int conns)
        {
            this.ClientManager = new GameClientManager(conns);

            if (GoldTree.GetConfig().data["client.ping.enabled"] == "1")
            {
                this.ClientManager.method_10();
            }

            DateTime now = DateTime.Now;

            Logging.Write("Connecting to the database.. ");

            try
            {
                using (DatabaseClient dbClient = GoldTree.GetDatabase().GetClient())
                {
                    Logging.WriteLine("completed!", ConsoleColor.Green);

                    GoldTree.Game = this;
                    this.LoadServerSettings(dbClient);
                    this.BanManager           = new ModerationBanManager();
                    this.RoleManager          = new RoleManager();
                    this.HelpTool             = new HelpTool();
                    this.Catalog              = new Catalog();
                    this.Navigator            = new Navigator();
                    this.ItemManager          = new ItemManager();
                    this.RoomManager          = new RoomManager();
                    this.AdvertisementManager = new AdvertisementManager();
                    this.PixelManager         = new PixelManager();
                    this.AchievementManager   = new AchievementManager();
                    this.ModerationTool       = new ModerationTool();
                    this.BotManager           = new BotManager();
                    this.Marketplace          = new Marketplace();
                    this.QuestManager         = new QuestManager();
                    this.GoldTreeEnvironment  = new GoldTreeEnvironment();

                    this.Groups = new Groups();

                    GoldTreeEnvironment.LoadExternalTexts(dbClient);

                    this.BanManager.Initialise(dbClient);

                    this.RoleManager.method_0(dbClient);

                    this.HelpTool.method_0(dbClient);
                    this.HelpTool.method_3(dbClient);

                    this.ModerationTool.method_1(dbClient);
                    this.ModerationTool.method_2(dbClient);
                    this.ItemManager.method_0(dbClient);
                    this.Catalog.method_0(dbClient);
                    this.Catalog.method_1();
                    this.Navigator.method_0(dbClient);
                    this.RoomManager.method_8(dbClient);
                    this.RoomManager.method_0();
                    this.NavigatorCache = new NavigatorCache();
                    this.AdvertisementManager.method_0(dbClient);
                    this.BotManager.method_0(dbClient);
                    AchievementManager.smethod_0(dbClient);
                    this.PixelManager.method_0();
                    ChatCommandHandler.smethod_0(dbClient);
                    this.QuestManager.method_0();
                    Groups.smethod_0(dbClient);
                    this.RestoreStatistics(dbClient, 1);
                }
            }
            catch (MySql.Data.MySqlClient.MySqlException e)
            {
                Logging.WriteLine("failed!", ConsoleColor.Red);
                Logging.WriteLine(e.Message + " Check the given configuration details in config.conf\r\n", ConsoleColor.Yellow);
                GoldTree.Destroy("", true, true);

                return;
            }

            this.task_0 = new Task(new Action(LowPriorityWorker.Initialise));
            this.task_0.Start();

            StartGameLoop();
        }
Beispiel #32
0
 void Awake()
 {
     pixelManager = PixelManager.instance;
     id           = this.GetID();
 }