Exemple #1
0
        public Room(RoomData data)
            : base(data)
        {
            IsLagging = 0;
            Unloaded  = false;
            IdleTime  = 0;

            RoomMuted = false;

            MutedUsers = new Dictionary <int, double>();
            Tents      = new Dictionary <int, List <RoomUser> >();

            _gamemap          = new Gamemap(this, data.Model);
            _roomItemHandling = new RoomItemHandling(this);

            _roomUserManager  = new RoomUserManager(this);
            _filterComponent  = new FilterComponent(this);
            _wiredComponent   = new WiredComponent(this);
            _bansComponent    = new BansComponent(this);
            _tradingComponent = new TradingComponent(this);

            GetRoomItemHandler().LoadFurniture();
            GetGameMap().GenerateMaps();

            LoadPromotions();
            LoadRights();
            LoadFilter();
            InitBots();
            InitPets();

            lastRegeneration = DateTime.Now;
        }
Exemple #2
0
 public Collision(Item item, WiredHandler handler, RoomUserManager roomUserManager)
 {
     this.item                  = item;
     this.handler               = handler;
     this.delegateFunction      = new UserAndItemDelegate(this.FurniCollision);
     this.handler.TrgCollision += this.delegateFunction;
 }
Exemple #3
0
        public Collision(RoomItem item, WiredHandler handler, RoomUserManager roomUserManager)
        {
            this.item    = item;
            this.handler = handler;

            handler.RequestCycle(this);
            this.disposed = false;
        }
Exemple #4
0
 public EntersRoom(Item item, WiredHandler handler, RoomUserManager roomUserManager, bool isOneUser, string userName)
 {
     this.item                    = item;
     this.handler                 = handler;
     this.isOneUser               = isOneUser;
     this.userName                = userName;
     this.delegateFunction        = new RoomEventDelegate(this.roomUserManager_OnUserEnter);
     roomUserManager.OnUserEnter += this.delegateFunction;
 }
        public BotAlcanzaUsuario(RoomItem item, WiredHandler handler, RoomUserManager roomUserManager, string botname)
        {
            this.item    = item;
            this.handler = handler;
            this.botname = botname;

            delegateFunction = roomUserManager_OnBotTakeUser;
            roomUserManager.OnBotTakeUser += delegateFunction;
        }
Exemple #6
0
        public EntersRoom(RoomItem item, WiredHandler handler, RoomUserManager roomUserManager, bool isOneUser, string userName)
        {
            this.item = item;
            this.handler = handler;
            this.isOneUser = isOneUser;
            this.userName = userName;
            this.delegateFunction = new RoomEventDelegate(roomUserManager_OnUserEnter);

            roomUserManager.OnUserEnter += delegateFunction;
        }
Exemple #7
0
        public EntersRoom(RoomItem item, WiredHandler handler, RoomUserManager roomUserManager, bool isOneUser, string userName)
        {
            this.item        = item;
            this.handler     = handler;
            this.isOneUser   = isOneUser;
            this.userName    = userName;
            delegateFunction = roomUserManager_OnUserEnter;

            roomUserManager.OnUserEnter += delegateFunction;
        }
        public BotAlcanzaFurni(RoomItem item, WiredHandler handler, RoomUserManager roomUserManager, List <RoomItem> items, string botname)
        {
            this.item    = item;
            this.handler = handler;
            this.items   = items;
            this.botname = botname;

            delegateFunction = roomUserManager_OnBotTakeItem;

            foreach (var targetItem in items)
            {
                targetItem.OnBotWalksOnFurni += delegateFunction;
            }
        }
        //private ProcessComponent _process = null;

        public Room(RoomData Data)
        {
            this.IsLagging = 0;
            this.IdleTime  = 0;

            this.BallSpeed = 150; //you can change this using a command (milliseconds)

            this._roomData = Data;
            RoomMuted      = false;
            mDisposed      = false;


            this.Id          = Data.Id;
            this.Name        = Data.Name;
            this.Description = Data.Description;
            this.OwnerName   = Data.OwnerName;
            this.OwnerId     = Data.OwnerId;

            this.WiredScoreBordDay              = Data.WiredScoreBordDay;
            this.WiredScoreBordWeek             = Data.WiredScoreBordWeek;
            this.WiredScoreBordMonth            = Data.WiredScoreBordMonth;
            this.WiredScoreFirstBordInformation = Data.WiredScoreFirstBordInformation;

            this.ForSale   = false;
            this.SalePrice = 0;
            this.Category  = Data.Category;
            this.Type      = Data.Type;
            this.Access    = Data.Access;
            this.UsersNow  = 0;
            this.UsersMax  = Data.UsersMax;
            this.ModelName = Data.ModelName;
            this.Score     = Data.Score;
            this.Tags      = new List <string>();
            foreach (string tag in Data.Tags)
            {
                Tags.Add(tag);
            }

            this.AllowPets           = Data.AllowPets;
            this.AllowPetsEating     = Data.AllowPetsEating;
            this.RoomBlockingEnabled = Data.RoomBlockingEnabled;
            this.Hidewall            = Data.Hidewall;
            this.Group = Data.Group;

            this.Password  = Data.Password;
            this.Wallpaper = Data.Wallpaper;
            this.Floor     = Data.Floor;
            this.Landscape = Data.Landscape;

            this.WallThickness  = Data.WallThickness;
            this.FloorThickness = Data.FloorThickness;

            this.chatMode     = Data.chatMode;
            this.chatSize     = Data.chatSize;
            this.chatSpeed    = Data.chatSpeed;
            this.chatDistance = Data.chatDistance;
            this.extraFlood   = Data.extraFlood;

            this.TradeSettings = Data.TradeSettings;

            this.WhoCanBan  = Data.WhoCanBan;
            this.WhoCanKick = Data.WhoCanKick;
            this.WhoCanBan  = Data.WhoCanBan;

            this.GolpeEnabled   = Data.GolpeEnabled;
            this.PushEnabled    = Data.PushEnabled;
            this.PullEnabled    = Data.PullEnabled;
            this.SPullEnabled   = Data.SPullEnabled;
            this.SPushEnabled   = Data.SPushEnabled;
            this.EnablesEnabled = Data.EnablesEnabled;
            this.RespectNotificationsEnabled = Data.RespectNotificationsEnabled;
            this.PetMorphsAllowed            = Data.PetMorphsAllowed;

            this.poolQuestion   = string.Empty;
            this.yesPoolAnswers = new List <int>();
            this.noPoolAnswers  = new List <int>();

            this.ActiveTrades = new ArrayList();
            this.Bans         = new Dictionary <int, double>();
            this.MutedUsers   = new Dictionary <int, double>();
            this.Tents        = new Dictionary <int, List <RoomUser> >();

            _gamemap = new Gamemap(this);
            if (_roomItemHandling == null)
            {
                _roomItemHandling = new RoomItemHandling(this);
            }
            _roomUserManager = new RoomUserManager(this);

            this._filterComponent = new FilterComponent(this);
            this._wiredComponent  = new WiredComponent(this);
            this._traxManager     = new RoomTraxManager(this);

            GetRoomItemHandler().LoadFurniture();
            GetGameMap().GenerateMaps();
            OnFurnisLoad();

            this.LoadPromotions();
            this.LoadRights();
            this.LoadBans();
            this.LoadFilter();
            this.InitBots();
            this.InitPets();

            Data.UsersNow = 1;
        }
Exemple #10
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();
                }
            }
        }
Exemple #11
0
        public Room(RoomData Data)
        {
            IsLagging   = 0;
            IdleTime    = 0;
            RoomData    = Data;
            RoomMuted   = false;
            mDisposed   = false;
            Id          = Data.Id;
            Name        = Data.Name;
            Description = Data.Description;
            OwnerName   = Data.OwnerName;
            OwnerId     = Data.OwnerId;
            Category    = Data.Category;
            Type        = Data.Type;
            Access      = Data.Access;
            UsersNow    = 0;
            UsersMax    = Data.UsersMax;
            ModelName   = Data.ModelName;
            Score       = Data.Score;
            Tags        = new List <string>();
            foreach (var tag in Data.Tags)
            {
                Tags.Add(tag);
            }

            AllowPets           = Data.AllowPets;
            AllowPetsEating     = Data.AllowPetsEating;
            RoomBlockingEnabled = Data.RoomBlockingEnabled;
            Hidewall            = Data.Hidewall;
            Group          = Data.Group;
            Password       = Data.Password;
            Wallpaper      = Data.Wallpaper;
            Floor          = Data.Floor;
            Landscape      = Data.Landscape;
            WallThickness  = Data.WallThickness;
            FloorThickness = Data.FloorThickness;
            chatMode       = Data.chatMode;
            chatSize       = Data.chatSize;
            chatSpeed      = Data.chatSpeed;
            chatDistance   = Data.chatDistance;
            extraFlood     = Data.extraFlood;
            TradeSettings  = Data.TradeSettings;
            WhoCanBan      = Data.WhoCanBan;
            WhoCanKick     = Data.WhoCanKick;
            WhoCanBan      = Data.WhoCanBan;
            PushEnabled    = Data.PushEnabled;
            PullEnabled    = Data.PullEnabled;
            SPullEnabled   = Data.SPullEnabled;
            SPushEnabled   = Data.SPushEnabled;
            EnablesEnabled = Data.EnablesEnabled;
            RespectNotificationsEnabled = Data.RespectNotificationsEnabled;
            PetMorphsAllowed            = Data.PetMorphsAllowed;
            ActiveTrades = new ArrayList();
            MutedUsers   = new Dictionary <int, double>();
            Tents        = new Dictionary <int, List <RoomUser> >();
            _gamemap     = new Gamemap(this);
            if (_roomItemHandling == null)
            {
                _roomItemHandling = new RoomItemHandling(this);
            }
            _roomUserManager  = new RoomUserManager(this);
            _filterComponent  = new FilterComponent(this);
            _wiredComponent   = new WiredComponent(this);
            _bansComponent    = new BansComponent(this);
            _tradingComponent = new TradingComponent(this);
            GetRoomItemHandler().LoadFurniture();
            GetGameMap().GenerateMaps();
            LoadPromotions();
            LoadRights();
            LoadFilter();
            InitBots();
            InitPets();
            Data.UsersNow = 1;
        }
Exemple #12
0
        //private ProcessComponent _process = null;

        public Room(RoomData Data)
        {
            this.IsLagging = 0;
            this.IdleTime  = 0;

            this._roomData = Data;
            RoomMuted      = false;
            mDisposed      = false;

            this.Id          = Data.Id;
            this.Name        = Data.Name;
            this.Description = Data.Description;
            this.OwnerName   = Data.OwnerName;
            this.OwnerId     = Data.OwnerId;

            this.Category  = Data.Category;
            this.Type      = Data.Type;
            this.Access    = Data.Access;
            this.UsersNow  = 0;
            this.UsersMax  = Data.UsersMax;
            this.ModelName = Data.ModelName;
            this.Score     = Data.Score;
            this.Tags      = new List <string>();
            foreach (string tag in Data.Tags)
            {
                Tags.Add(tag);
            }

            this.AllowPets           = Data.AllowPets;
            this.AllowPetsEating     = Data.AllowPetsEating;
            this.RoomBlockingEnabled = Data.RoomBlockingEnabled;
            this.Hidewall            = Data.Hidewall;
            this.Group = Data.Group;

            this.Password  = Data.Password;
            this.Wallpaper = Data.Wallpaper;
            this.Floor     = Data.Floor;
            this.Landscape = Data.Landscape;

            this.WallThickness  = Data.WallThickness;
            this.FloorThickness = Data.FloorThickness;

            this.chatMode     = Data.chatMode;
            this.chatSize     = Data.chatSize;
            this.chatSpeed    = Data.chatSpeed;
            this.chatDistance = Data.chatDistance;
            this.extraFlood   = Data.extraFlood;

            this.TradeSettings = Data.TradeSettings;

            this.WhoCanBan  = Data.WhoCanBan;
            this.WhoCanKick = Data.WhoCanKick;
            this.WhoCanBan  = Data.WhoCanBan;

            this.PushEnabled    = Data.PushEnabled;
            this.PullEnabled    = Data.PullEnabled;
            this.SPullEnabled   = Data.SPullEnabled;
            this.SPushEnabled   = Data.SPushEnabled;
            this.EnablesEnabled = Data.EnablesEnabled;
            this.RespectNotificationsEnabled = Data.RespectNotificationsEnabled;
            this.PetMorphsAllowed            = Data.PetMorphsAllowed;

            this.BankEnabled        = Data.BankEnabled;
            this.ShootEnabled       = Data.ShootEnabled;
            this.HitEnabled         = Data.HitEnabled;
            this.SafeZoneEnabled    = Data.SafeZoneEnabled;
            this.SexCommandsEnabled = Data.SexCommandsEnabled;
            this.TurfEnabled        = Data.TurfEnabled;
            this.RobEnabled         = Data.RobEnabled;
            this.GymEnabled         = Data.GymEnabled;
            this.DeliveryEnabled    = Data.DeliveryEnabled;
            this.TutorialEnabled    = Data.TutorialEnabled;
            this.DriveEnabled       = Data.DriveEnabled;
            this.TaxiFromEnabled    = Data.TaxiFromEnabled;
            this.TaxiToEnabled      = Data.TaxiToEnabled;
            this.EnterRoomMessage   = Data.EnterRoomMessage;
            this.RoleplayEvent      = Data.RoleplayEvent;

            this.ActiveTrades = new ArrayList();
            this.Bans         = new Dictionary <int, double>();
            this.MutedUsers   = new Dictionary <int, double>();
            this.Tents        = new Dictionary <int, List <RoomUser> >();

            _gamemap = new Gamemap(this);
            if (_roomItemHandling == null)
            {
                _roomItemHandling = new RoomItemHandling(this);
            }
            _roomUserManager = new RoomUserManager(this);

            this._filterComponent = new FilterComponent(this);
            this._wiredComponent  = new WiredComponent(this);

            GetRoomItemHandler().LoadFurniture();
            GetGameMap().GenerateMaps();

            this.LoadPromotions();
            this.LoadRights();
            this.LoadBans();
            this.LoadFilter();
            this.InitBots();
            this.InitPets();

            if (this.GetRoomUserManager() != null && this.GetRoomUserManager().GetRoomUsers() != null && this.GetRoomUserManager().GetRoomUsers().Where(x => !x.IsBot) != null)
            {
                Data.UsersNow = this.GetRoomUserManager().GetRoomUsers().Where(x => !x.IsBot).ToList().Count;
            }
            else
            {
                Data.UsersNow = 0;
            }
        }
Exemple #13
0
        //public RoomTraxManager traxManager; // Added

        //private ProcessComponent _process = null;

        public Room(RoomData Data)
        {
            IsLagging = 0;
            IdleTime  = 0;

            _roomData         = Data;
            RoomMuted         = false;
            mDisposed         = false;
            muteSignalEnabled = false;

            Id          = Data.Id;
            Name        = Data.Name;
            Description = Data.Description;
            OwnerName   = Data.OwnerName;
            OwnerId     = Data.OwnerId;

            WiredScoreBordDay              = Data.WiredScoreBordDay;
            WiredScoreBordWeek             = Data.WiredScoreBordWeek;
            WiredScoreBordMonth            = Data.WiredScoreBordMonth;
            WiredScoreFirstBordInformation = Data.WiredScoreFirstBordInformation;

            ForSale   = false;
            SalePrice = 0;
            Category  = Data.Category;
            Type      = Data.Type;
            Access    = Data.Access;
            UsersNow  = 0;
            UsersMax  = Data.UsersMax;
            ModelName = Data.ModelName;
            Score     = Data.Score;
            Tags      = new List <string>();
            foreach (string tag in Data.Tags)
            {
                Tags.Add(tag);
            }

            AllowPets           = Data.AllowPets;
            AllowPetsEating     = Data.AllowPetsEating;
            RoomBlockingEnabled = Data.RoomBlockingEnabled;
            Hidewall            = Data.Hidewall;
            Group = Data.Group;

            Password  = Data.Password;
            Wallpaper = Data.Wallpaper;
            Floor     = Data.Floor;
            Landscape = Data.Landscape;

            WallThickness  = Data.WallThickness;
            FloorThickness = Data.FloorThickness;

            chatMode     = Data.chatMode;
            chatSize     = Data.chatSize;
            chatSpeed    = Data.chatSpeed;
            chatDistance = Data.chatDistance;
            extraFlood   = Data.extraFlood;

            TradeSettings = Data.TradeSettings;

            WhoCanBan  = Data.WhoCanBan;
            WhoCanKick = Data.WhoCanKick;
            WhoCanBan  = Data.WhoCanBan;

            poolQuestion   = string.Empty;
            yesPoolAnswers = new List <int>();
            noPoolAnswers  = new List <int>();

            ActiveTrades = new ArrayList();
            Bans         = new Dictionary <int, double>();
            MutedUsers   = new Dictionary <int, double>();
            Tents        = new Dictionary <int, List <RoomUser> >();

            _gamemap = new Gamemap(this);
            if (_roomItemHandling == null)
            {
                _roomItemHandling = new RoomItemHandling(this);
            }
            _roomUserManager = new RoomUserManager(this);

            _filterComponent = new FilterComponent(this);
            _wiredComponent  = new WiredComponent(this);
            _bansComponent   = new BansComponent(this);
            _traxManager     = new RoomTraxManager(this);
            OnFurnisLoad();

            GetRoomItemHandler().LoadFurniture();
            GetGameMap().GenerateMaps();

            LoadPromotions();
            LoadRights();
            LoadBans();
            LoadFilter();
            InitBots();
            InitPets();

            Data.UsersNow = 1;
        }
Exemple #14
0
        private void Initialize(uint Id, string Name, string Description, string Type, string Owner, int OwnerId, int Category, int State, int TradeState, int UsersMax, string ModelName, int Score, List <string> pTags, int AllowPets, int AllowPetsEating, int AllowWalkthrough, int Hidewall, string Password, string Wallpaper, string Floor, string Landscape, RoomData RoomData, bool RightOverride, int walltickness, int floorthickness, Guild group, int GameId, int chattype, int chatballoon, int chatspeed, int chatmaxdis, int chatprotection, int whomute, int whokick, int whoban, uint groupid, HashSet <Chatlog> Chat, List <string> WordFilter, int WallHeight)
        {
            this.mDisposed   = false;
            this.Id          = Id;
            this.Name        = Name;
            this.Description = Description;
            this.Owner       = Owner;
            this.OwnerId     = OwnerId;
            this.Category    = Category;
            this.Type        = Type;
            this.State       = State;
            this.TradeState  = TradeState;
            this.UsersNow    = 0;
            this.UsersMax    = UsersMax;
            this.ModelName   = ModelName;
            this.Score       = Score;
            this.tagCount    = 0;
            this.Tags        = new ArrayList();
            foreach (string current in pTags)
            {
                this.tagCount++;
                this.Tags.Add(current);
            }
            this.ChatType            = chattype;
            this.ChatBalloon         = chatballoon;
            this.ChatSpeed           = chatspeed;
            this.ChatMaxDistance     = chatmaxdis;
            this.ChatFloodProtection = chatprotection;
            this.AllowPets           = AllowPets;
            this.AllowPetsEating     = AllowPetsEating;
            this.AllowWalkthrough    = AllowWalkthrough;
            this.Hidewall            = Hidewall;
            this.Group             = group;
            this.Password          = Password;
            this.Bans              = new Dictionary <long, double>();
            this.MutedUsers        = new Dictionary <uint, uint>();
            this.Wallpaper         = Wallpaper;
            this.Floor             = Floor;
            this.Landscape         = Landscape;
            this.ActiveTrades      = new ArrayList();
            this.MutedBots         = false;
            this.mCycleEnded       = false;
            this.mRoomData         = RoomData;
            this.EveryoneGotRights = RightOverride;
            this.LoadedGroups      = new Dictionary <uint, string>();
            this.roomKick          = new Queue();
            this.IdleTime          = 0;
            this.RoomMuted         = false;
            this.WallThickness     = walltickness;
            this.FloorThickness    = floorthickness;
            this.WallHeight        = WallHeight;
            this.gamemap           = new Gamemap(this);
            this.roomItemHandling  = new RoomItemHandling(this);
            this.roomUserManager   = new RoomUserManager(this);
            this.RoomChat          = Chat;
            this.WordFilter        = WordFilter;
            this.Event             = CyberEnvironment.GetGame().GetRoomEvents().GetEvent(Id);
            this.WhoCanBan         = whoban;
            this.WhoCanKick        = whokick;
            this.WhoCanBan         = whoban;
            this.GroupId           = groupid;
            this.LoadRights();
            this.LoadMusic();
            this.LoadBans();
            this.InitUserBots();

            this.RoomThread = new Thread(new ThreadStart(StartRoomProcessing));
            this.RoomThread.Start();
            CyberEnvironment.GetGame().GetRoomManager().QueueActiveRoomAdd(this.mRoomData);
        }
Exemple #15
0
        private void Initialize(UInt32 Id, string Name, string Description, string Owner, int OwnerId, int Category,
                                int State, int UsersMax, string ModelName, int Score, List <string> pTags, bool AllowPets,
                                bool AllowPetsEating, bool AllowWalkthrough, bool Hidewall, string Password, string Wallpaper, string Floor,
                                string Landscape, RoomData RoomData, bool RightOverride, int walltickness, int floorthickness, Group group)
        {
            this.mDisposed   = false;
            this.Id          = Id;
            this.Name        = Name;
            this.Description = Description;
            this.Owner       = Owner;
            this.OwnerId     = OwnerId;
            this.Category    = Category;
            this.State       = State;
            this.UsersNow    = 0;
            this.UsersMax    = UsersMax;
            this.ModelName   = ModelName;
            this.Score       = Score;

            tagCount  = 0;
            this.Tags = new ArrayList();
            foreach (string tag in pTags)
            {
                tagCount++;
                Tags.Add(tag);
            }

            this.AllowPets        = AllowPets;
            this.AllowPetsEating  = AllowPetsEating;
            this.AllowWalkthrough = AllowWalkthrough;
            this.Hidewall         = Hidewall;

            this.Password           = Password;
            this.Bans               = new Dictionary <UInt32, double>();
            this.Wallpaper          = Wallpaper;
            this.Floor              = Floor;
            this.Landscape          = Landscape;
            this.chatMessageManager = new ChatMessageManager();
            this.ActiveTrades       = new ArrayList();


            this.mCycleEnded = false;

            this.mRoomData         = RoomData;
            this.EveryoneGotRights = RightOverride;

            this.roomMessages     = new Queue();
            this.chatMessageQueue = new Queue();
            this.rnd = new Random();

            this.roomMessages       = new Queue();
            this.roomAlerts         = new Queue();
            this.roomBadge          = new Queue();
            this.roomKick           = new Queue();
            this.roomServerMessages = new Queue();
            this.IdleTime           = 0;
            this.RoomMuted          = false;
            this.WallThickness      = walltickness;
            this.FloorThickness     = floorthickness;

            this.gamemap          = new Gamemap(this);
            this.roomItemHandling = new RoomItemHandling(this);
            this.roomUserManager  = new RoomUserManager(this);
            this.wiredHandler     = new WiredHandler(this);

            this.Group = group;

            LoadRights();
            GetRoomItemHandler().LoadFurniture();
            wiredHandler.LoadWired();
            GetGameMap().GenerateMaps();
            LoadMusic();
            //LoadBots();
            using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor())
            {
                dbClient.runFastQuery("REPLACE INTO room_active VALUES (" + Id + ",1)");
            }

            FirewindEnvironment.GetGame().GetRoomManager().QueueActiveRoomAdd(mRoomData);
        }
Exemple #16
0
        public static RoomUser DeployBotByID(int RoleplayBotsID, string SpawnType = "default", int RoomID = 0)
        {
            lock (SyncLock)
            {
                try
                {
                    if (!RoleplayBotManager.CachedRoleplayBots.ContainsKey(RoleplayBotsID))
                    {
                        return(null);
                    }

                    #region If the bot already exists simply transfer it
                    RoleplayBot DeployingBot = RoleplayBotManager.CachedRoleplayBots[RoleplayBotsID];

                    if (DeployingBot.DRoomUser != null)
                    {
                        if (DeployingBot.DRoom != null)
                        {
                            if (DeployingBot.DRoom.Id != RoomID)
                            {
                                RoleplayBotManager.TransportDeployedBot(DeployingBot.DRoomUser, (RoomID == 0 ? DeployingBot.SpawnId : RoomID));
                            }
                        }
                        return(null);
                    }
                    #endregion

                    Room RoleplayBotsRoom;

                    if (RoomID == 0)
                    {
                        if (RoleplayManager.GenerateRoom(DeployingBot.SpawnId, false) == null)
                        {
                            return(null);
                        }
                        else
                        {
                            RoleplayBotsRoom = RoleplayManager.GenerateRoom(DeployingBot.SpawnId, false);
                        }
                    }
                    else
                    {
                        if (RoleplayManager.GenerateRoom(RoomID, false) == null)
                        {
                            return(null);
                        }
                        else
                        {
                            RoleplayBotsRoom = RoleplayManager.GenerateRoom(RoomID, false);
                        }

                        DeployingBot.SpawnId = RoleplayBotsRoom.RoomId;
                    }

                    #region Misc variables
                    RoomUserManager     RoomManager          = RoleplayBotsRoom.GetRoomUserManager();
                    RoomUser            BotsRoomUserInstance = new RoomUser(0, RoleplayBotsRoom.RoomId, RoomManager.primaryPrivateUserID++, RoleplayBotsRoom);
                    List <RandomSpeech> BotsSpeech           = new List <RandomSpeech>();
                    int BotsPersonalID = RoomManager.secondaryPrivateUserID++;
                    BotsRoomUserInstance.InternalRoomID = BotsPersonalID;
                    RoomManager._users.TryAdd(BotsPersonalID, BotsRoomUserInstance);
                    DynamicRoomModel RoleplayBotsModel = RoleplayBotsRoom.GetGameMap().Model;
                    #endregion

                    #region Spawning & Positioning
                    if (DeployingBot.Dead)
                    {
                        RoleplayManager.SpawnBeds(null, "hosptl_bed", BotsRoomUserInstance);
                    }
                    else
                    {
                        #region Spawn at origin
                        if (SpawnType == "default")
                        {
                            if ((DeployingBot.X > 0 && DeployingBot.Y > 0) && DeployingBot.X < RoleplayBotsModel.MapSizeX && DeployingBot.Y < RoleplayBotsModel.MapSizeY)
                            {
                                BotsRoomUserInstance.SetPos(DeployingBot.X, DeployingBot.Y, DeployingBot.Z);
                                BotsRoomUserInstance.SetRot(DeployingBot.SpawnRot, false);
                            }
                            else
                            {
                                DeployingBot.X = RoleplayBotsModel.DoorX;
                                DeployingBot.Y = RoleplayBotsModel.DoorY;

                                BotsRoomUserInstance.SetPos(RoleplayBotsModel.DoorX, RoleplayBotsModel.DoorY, RoleplayBotsModel.DoorZ);
                                BotsRoomUserInstance.SetRot(RoleplayBotsModel.DoorOrientation, false);
                            }
                        }
                        #endregion

                        #region Spawn at work item
                        if (SpawnType == "workitem")
                        {
                            Item Item;
                            if (DeployingBot.GetStopWorkItem(RoleplayBotsRoom, out Item))
                            {
                                var Point = new Point(Item.GetX, Item.GetY);

                                BotsRoomUserInstance.X = Point.X;
                                BotsRoomUserInstance.Y = Point.Y;

                                BotsRoomUserInstance.SetPos(Point.X, Point.Y, RoleplayBotsRoom.GetGameMap().GetHeightForSquare(Point));
                                BotsRoomUserInstance.SetRot(Item.Rotation, false);
                            }
                            else
                            {
                                BotsRoomUserInstance.X = RoleplayBotsModel.DoorX;
                                BotsRoomUserInstance.Y = RoleplayBotsModel.DoorY;

                                BotsRoomUserInstance.SetPos(RoleplayBotsModel.DoorX, RoleplayBotsModel.DoorY, RoleplayBotsModel.DoorZ);
                                BotsRoomUserInstance.SetRot(RoleplayBotsModel.DoorOrientation, false);
                            }
                        }
                        #endregion

                        #region Spawn at owner

                        if (SpawnType == "owner" && DeployingBot.Owner != null)
                        {
                            RoomUser OwnerInstance = DeployingBot.Owner.GetRoomUser();
                            int      X             = OwnerInstance.SquareInFront.X;
                            int      Y             = OwnerInstance.SquareInFront.Y;
                            double   Z             = OwnerInstance.Z;

                            if ((OwnerInstance != null) && (X > 0 && Y > 0) && X < RoleplayBotsModel.MapSizeX && Y < RoleplayBotsModel.MapSizeY)
                            {
                                BotsRoomUserInstance.SetPos(X, Y, Z);
                                BotsRoomUserInstance.SetRot(DeployingBot.SpawnRot, false);
                            }
                            else
                            {
                                X = OwnerInstance.X;
                                Y = OwnerInstance.Y;
                                DeployingBot.X = X;
                                DeployingBot.Y = Y;

                                BotsRoomUserInstance.SetPos(X, Y, OwnerInstance.Z);
                                BotsRoomUserInstance.SetRot(DeployingBot.SpawnRot, false);
                            }
                        }
                        #endregion
                    }
                    #endregion

                    #region Generate Roleplay Bot's data, timers

                    BotsRoomUserInstance.BotData = new RoomBot(DeployingBot.Id, DeployingBot.SpawnId, DeployingBot.AITypeString, "stand", DeployingBot.Name, "Motto", DeployingBot.Figure, DeployingBot.X, DeployingBot.Y, DeployingBot.Z, DeployingBot.SpawnRot, DeployingBot.X, DeployingBot.Y, DeployingBot.X, DeployingBot.Y, ref BotsSpeech, DeployingBot.Gender, 0, 0, false, 0, false, 0);
                    BotsRoomUserInstance.RPBotAI = RoleplayBotManager.GetRoleplayBotAI(DeployingBot.AIType, BotsRoomUserInstance.VirtualId);
                    BotsRoomUserInstance.BotAI   = BotsRoomUserInstance.BotData.GenerateBotAI(BotsRoomUserInstance.VirtualId);

                    if (DeployingBot.IsPet)
                    {
                        BotsRoomUserInstance.PetData           = DeployingBot.PetInstance;
                        BotsRoomUserInstance.PetData.VirtualId = BotsRoomUserInstance.VirtualId;
                    }

                    BotsRoomUserInstance.RPBotAI.Init(DeployingBot.Id, DeployingBot, BotsRoomUserInstance.VirtualId, DeployingBot.SpawnId, BotsRoomUserInstance, RoleplayBotsRoom);

                    BotsRoomUserInstance.BotAI.Init(DeployingBot.Id, BotsRoomUserInstance.VirtualId, DeployingBot.SpawnId, BotsRoomUserInstance, RoleplayBotsRoom);

                    if (DeployingBot.TimerManager == null)
                    {
                        DeployingBot.TimerManager = new BotTimerManager(DeployingBot);
                    }
                    else
                    {
                        DeployingBot.TimerManager.CachedBot = DeployingBot;
                    }

                    if (DeployingBot.CooldownManager == null)
                    {
                        DeployingBot.CooldownManager = new BotCooldownManager(DeployingBot);
                    }
                    else
                    {
                        DeployingBot.CooldownManager.CachedBot = DeployingBot;
                    }

                    RoomManager.UpdateUserStatus(BotsRoomUserInstance, false);
                    BotsRoomUserInstance.UpdateNeeded = true;

                    #region Set general variables
                    DeployingBot.Teleporting        = false;
                    DeployingBot.TeleporterEntering = null;
                    DeployingBot.TeleporterExiting  = null;
                    DeployingBot.Teleported         = false;
                    DeployingBot.Deployed           = true;
                    DeployingBot.RoomStayTime       = new CryptoRandom().Next(0, DeployingBot.RoomStayInterval);
                    DeployingBot.FollowCooldown     = new CryptoRandom().Next(0, DeployingBot.FollowInterval);
                    DeployingBot.AttackCooldown     = new CryptoRandom().Next(0, DeployingBot.AttackInterval);
                    DeployingBot.RoamCooldown       = new CryptoRandom().Next(0, DeployingBot.RoamInterval);
                    DeployingBot.RoomStayTime       = new CryptoRandom().Next(0, DeployingBot.RoomStayInterval);
                    DeployingBot.LookCooldown       = new CryptoRandom().Next(0, DeployingBot.LookCooldown);
                    #endregion

                    #endregion

                    #region Compose Roleplay Bot's visibility & insert into deployed bots

                    DeployingBot.Invisible = false;

                    if (!DeployingBot.Invisible)
                    {
                        RoleplayBotsRoom.SendMessage(new UsersComposer(BotsRoomUserInstance));
                    }


                    if (RoomManager._bots.ContainsKey(DeployingBot.Id))
                    {
                        RoomManager._bots[DeployingBot.Id] = BotsRoomUserInstance;
                    }
                    else
                    {
                        RoomManager._bots.TryAdd(DeployingBot.Id, BotsRoomUserInstance);
                    }

                    RoleplayBotsRoom.SendMessage(new DanceComposer(BotsRoomUserInstance, 0));

                    #endregion

                    #region Attach RoleplayBot Instance to RoomUser & deliver its respective data
                    BotsRoomUserInstance.RPBotData = DeployingBot;
                    if (!RoleplayBotManager.DeployedRoleplayBots.ContainsKey(DeployingBot.Id))
                    {
                        RoleplayBotManager.DeployedRoleplayBots.TryAdd(DeployingBot.Id, BotsRoomUserInstance);
                    }
                    else
                    {
                        RoomUser NullBot;
                        RoleplayBotManager.ClearRoleplayBotClones(DeployingBot.Id);
                        RoleplayBotManager.DeployedRoleplayBots.TryAdd(DeployingBot.Id, BotsRoomUserInstance);
                    }


                    #region Start roaming
                    if (DeployingBot.RoamBot)
                    {
                        DeployingBot.MoveRandomly();
                    }
                    #endregion

                    DeployingBot.DRoomUser.GetBotRoleplayAI().OnDeployed(DeployingBot.Owner);

                    #endregion

                    return(BotsRoomUserInstance);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }
            return(null);
        }
Exemple #17
0
        /// <summary>
        ///     Initializes the specified identifier.
        /// </summary>
        /// <param name="id">The identifier.</param>
        /// <param name="roomData">The room data.</param>
        /// <param name="rightOverride">if set to <c>true</c> [right override].</param>
        /// <param name="wordFilter">The word filter.</param>
        /// <param name="forceLoad"></param>
        private void Initialize(uint id, RoomData roomData, bool rightOverride, List<string> wordFilter, bool forceLoad)
        {
            RoomData = roomData;

            Disposed = false;
            RoomId = id;
            Bans = new Dictionary<long, double>();
            MutedUsers = new Dictionary<uint, uint>();
            ActiveTrades = new ArrayList();
            MutedBots = false;
            MutedPets = false;
            _mCycleEnded = false;
            EveryoneGotRights = rightOverride;
            LoadedGroups = new Dictionary<uint, string>();
            _roomKick = new Queue();
            _idleTime = 0;
            RoomMuted = false;
            _gameMap = new Gamemap(this);
            _roomItemHandler = new RoomItemHandler(this);
            _roomUserManager = new RoomUserManager(this);
            WordFilter = wordFilter;

            LoadRights();
            LoadMusic();
            LoadBans();
            InitUserBots();

            if (!forceLoad)
            {
                _roomThread = new Thread(StartRoomProcessing);
                _roomThread.Name = "Room Loader";
                _roomThread.Start();
            }

            Azure.GetGame().GetRoomManager().QueueActiveRoomAdd(RoomData);
        }