Beispiel #1
0
 /// <summary>
 ///     Gets the game item handler.
 /// </summary>
 /// <returns>GameItemHandler.</returns>
 internal GameItemHandler GetGameItemHandler()
 {
     return _gameItemHandler ?? (_gameItemHandler = new GameItemHandler(this));
 }
Beispiel #2
0
 /// <summary>
 ///     Flushes the settings.
 /// </summary>
 internal void FlushSettings()
 {
     _mCycleEnded = true;
     using (var queryReactor = Azure.GetDatabaseManager().GetQueryReactor())
         GetRoomItemHandler().SaveFurniture(queryReactor);
     RoomData.Tags.Clear();
     UsersWithRights.Clear();
     Bans.Clear();
     ActiveTrades.Clear();
     LoadedGroups.Clear();
     if (GotFreeze())
         _freeze = new Freeze(this);
     if (GotBanzai())
         _banzai = new BattleBanzai(this);
     if (GotSoccer())
         _soccer = new Soccer(this);
     if (_gameItemHandler != null)
         _gameItemHandler = new GameItemHandler(this);
 }
Beispiel #3
0
 public GameItemHandler GetGameItemHandler()
 {
     return(_gameItemHandler ?? (_gameItemHandler = new GameItemHandler(this)));
 }
Beispiel #4
0
        public void Dispose()
        {
            SendPacket(new CloseConnectionComposer());

            if (!mDisposed)
            {
                isCrashed = false;
                mDisposed = true;

                /* TODO: Needs reviewing */
                try
                {
                    if (ProcessTask != null && ProcessTask.IsCompleted)
                    {
                        ProcessTask.Dispose();
                    }
                }
                catch { }

                if (ActiveTrades.Count > 0)
                {
                    ActiveTrades.Clear();
                }

                TonerData     = null;
                MoodlightData = null;

                if (MutedUsers.Count > 0)
                {
                    MutedUsers.Clear();
                }

                if (Tents.Count > 0)
                {
                    Tents.Clear();
                }

                if (UsersWithRights.Count > 0)
                {
                    UsersWithRights.Clear();
                }

                if (_gameManager != null)
                {
                    _gameManager.Dispose();
                    _gameManager = null;
                }

                if (_freeze != null)
                {
                    _freeze.Dispose();
                    _freeze = null;
                }

                if (_soccer != null)
                {
                    _soccer.Dispose();
                    _soccer = null;
                }

                if (_banzai != null)
                {
                    _banzai.Dispose();
                    _banzai = null;
                }

                if (_gamemap != null)
                {
                    _gamemap.Dispose();
                    _gamemap = null;
                }

                if (_gameItemHandler != null)
                {
                    _gameItemHandler.Dispose();
                    _gameItemHandler = null;
                }

                // Room Data?

                if (teambanzai != null)
                {
                    teambanzai.Dispose();
                    teambanzai = null;
                }

                if (teamfreeze != null)
                {
                    teamfreeze.Dispose();
                    teamfreeze = null;
                }

                if (_roomUserManager != null)
                {
                    _roomUserManager.Dispose();
                    _roomUserManager = null;
                }

                if (_roomItemHandling != null)
                {
                    _roomItemHandling.Dispose();
                    _roomItemHandling = null;
                }

                if (WordFilterList.Count > 0)
                {
                    WordFilterList.Clear();
                }

                if (_filterComponent != null)
                {
                    _filterComponent.Cleanup();
                }

                if (_wiredComponent != null)
                {
                    _wiredComponent.Cleanup();
                }

                if (_bansComponent != null)
                {
                    _bansComponent.Cleanup();
                }

                if (_tradingComponent != null)
                {
                    _tradingComponent.Cleanup();
                }
            }
        }
Beispiel #5
0
        }//End Fucnction

        private static void LookAround(int col, int row, int roomnumber)
        {
            //Object item = null;
            RoomMapSearchResult searchresult;
            List <Object>       objectlist1 = null;
            List <Object>       objectlist2 = null;

            //Serach surrounding 1 character away in all directon.
            searchresult = gwinfo.SearchRoom(roomnumber, col, row, (int)RoomMapSearchResult.SEARCH_TYPE.ALL_DIRECTION);


            objectlist1 = new List <Object>(searchresult.AutoCollectedList);
            objectlist2 = new List <Object>(searchresult.CollectedList);

            if (searchresult.ItemFound > 0)
            {
                //Pick up auto collectable item first
                //foreach (Object item in searchresult.AutoCollectedList)
                foreach (Object item in objectlist1)
                {
                    if (item is Gold)
                    {
                        gwinfo.GetGameRoombyNumber(roomnumber).TotalGoldItem--;
                        gwinfo.GetGameRoombyNumber(roomnumber).TotalItem--;

                        //*******************************************
                        PlayUIBottomItem.updateMessageBox(ConfigManager.GetStringResource(15));
                        //*******************************************
                    }
                    else if (item is Silver)
                    {
                        gwinfo.GetGameRoombyNumber(roomnumber).TotalSilverItem--;
                        gwinfo.GetGameRoombyNumber(roomnumber).TotalItem--;

                        //*******************************************
                        PlayUIBottomItem.updateMessageBox(ConfigManager.GetStringResource(16));
                        //*******************************************
                    }
                    else if (item is HealthPotion)
                    {
                        gwinfo.GetGameRoombyNumber(roomnumber).TotalHealthPotionItem--;
                        gwinfo.GetGameRoombyNumber(roomnumber).TotalItem--;
                        gwinfo.UpdatePlyerHealth(((HealthPotion)item).lifeLine);
                    }

                    GameState.inventory.Add((Item)item);
                }

                //foreach (Object item in searchresult.AutoCollectedList)
                foreach (Object item in objectlist2)
                {
                    if (item is Key)
                    {
                        //Susepend all Enemy
                        SuspendEnemies(GameState.currentRoom);
                        GameItemHandler.HandleKey(item);

                        //************************************
                        PlayUIBottomItem.updateMessageBox(ConfigManager.GetStringResource(25));
                        //************************************

                        ReleaseEnemies(GameState.currentRoom);
                    }
                    else if (item is IronArmour)
                    {
                        SuspendEnemies(GameState.currentRoom);
                        GameItemHandler.HandleArmour(item);

                        //************************************
                        PlayUIBottomItem.updateMessageBox(ConfigManager.GetStringResource(25));
                        //************************************

                        ReleaseEnemies(GameState.currentRoom);
                    }
                    else if (item is WoodenArmour)
                    {
                        SuspendEnemies(GameState.currentRoom);
                        GameItemHandler.HandleArmour(item);

                        //************************************
                        PlayUIBottomItem.updateMessageBox(ConfigManager.GetStringResource(25));
                        //************************************

                        ReleaseEnemies(GameState.currentRoom);
                    }
                    else if (item is IronSword)
                    {
                        SuspendEnemies(GameState.currentRoom);
                        GameItemHandler.HandleSword(item);

                        //************************************
                        PlayUIBottomItem.updateMessageBox(ConfigManager.GetStringResource(25));
                        //************************************

                        ReleaseEnemies(GameState.currentRoom);
                    }
                    else if (item is WoodenSword)
                    {
                        SuspendEnemies(GameState.currentRoom);
                        GameItemHandler.HandleSword(item);

                        //************************************
                        PlayUIBottomItem.updateMessageBox(ConfigManager.GetStringResource(25));
                        //************************************

                        ReleaseEnemies(GameState.currentRoom);
                    }
                    else if (item is Chest)
                    {
                        SuspendEnemies(GameState.currentRoom);
                        GameItemHandler.HandleChest(item);

                        //************************************
                        PlayUIBottomItem.updateMessageBox(ConfigManager.GetStringResource(25));
                        //************************************

                        ReleaseEnemies(GameState.currentRoom);
                    }
                }

                GameState.UpdateScore();
                searchresult = null;

                //*************************************
                ScreenManager.printScreenGoldAndSilver();
                PlayUIRightPanel.PaintLegendOption(GameState.currentRoom);
                //*************************************
            }
        }