Beispiel #1
0
        public static bool EjectRoomsDeployedBots(Room Room)
        {
            try
            {
                foreach (RoomUser RoleplayBot in RoleplayBotManager.DeployedRoleplayBots.Values)
                {
                    if (RoleplayBot == null)
                    {
                        continue;
                    }
                    if (RoleplayBot.GetRoom() == null)
                    {
                        continue;
                    }

                    if (RoleplayBot.GetRoom() == Room)
                    {
                        RoleplayBotManager.EjectDeployedBot(RoleplayBot, RoleplayBot.GetRoom());
                    }

                    return(true);
                }
            }
            catch (Exception ex)
            {
                RoleplayBotManager.OnError(ex.Message);
            }

            return(false);
        }
Beispiel #2
0
        public static void ClearRoleplayBotClones(int BotsID)
        {
            if (RoleplayBotManager.GetDeployedBotById(BotsID) == null)
            {
                return;
            }

            RoleplayBotManager.EjectDeployedBot(RoleplayBotManager.GetDeployedBotById(BotsID), RoleplayBotManager.GetDeployedBotById(BotsID).GetRoom());
        }
Beispiel #3
0
        public static bool TransportDeployedBot(RoomUser RoleplayBot, int NewRoomID, bool SaveDataToCache = true)
        {
            if (RoleplayBot == null)
            {
                return(false);
            }
            if (RoleplayBot.GetBotRoleplay() == null)
            {
                return(false);
            }

            int BotsID = RoleplayBot.GetBotRoleplay().Id;

            try
            {
                Room NewRoom;
                if (RoleplayManager.GenerateRoom(NewRoomID, false) == null)
                {
                    return(false);
                }
                else
                {
                    NewRoom = RoleplayManager.GenerateRoom(NewRoomID, false);
                }


                RoleplayBotManager.EjectDeployedBot(RoleplayBot, RoleplayBot.GetRoom(), SaveDataToCache);
                RoleplayBotManager.DeployBotByID(BotsID, "default", NewRoom.Id);


                //Console.WriteLine("Transfered bot " + RoleplayBotManager.GetDeployedBotById(BotsID).GetBotRoleplay().Name + " to [" + NewRoom.Id + "] " + NewRoom.Name);
                return(true);
            }
            catch (Exception ex)
            {
                RoleplayBotManager.OnError(ex.Message);
                return(false);
            }
        }
Beispiel #4
0
        public static void Initialize(bool Refresh)
        {
            lock (SyncLock)
            {
                #region Refresh
                if (Refresh)
                {
                    foreach (KeyValuePair <int, RoomUser> RoleplayBot in RoleplayBotManager.DeployedRoleplayBots)
                    {
                        if (RoleplayBot.Value == null)
                        {
                            continue;
                        }
                        RoleplayBotManager.EjectDeployedBot(RoleplayBot.Value, RoleplayBot.Value.GetBotRoleplayAI().GetRoom());
                    }
                }
                #endregion

                #region Start Cycler
                if (RoleplayBotManager.MainTimer == null)
                {
                    RoleplayBotManager.MainTimer = new RoleplayBotCycler();
                }
                #endregion

                #region Cache & Deploy Bots
                new Thread(() =>
                {
                    Thread.Sleep(2000);
                    RoleplayBotManager.FetchCachedBots();
                    Thread.Sleep(100);
                    RoleplayBotManager.DeployCachedBots();
                }).Start();
                #endregion
            }
        }