コード例 #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);
        }
コード例 #2
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);
            }
        }
コード例 #3
0
        public static RoomUser DeployBotByAI(RoleplayBotAIType BotAI, string SpawnType = "default", int RoomID = 0)
        {
            lock (SyncLock)
            {
                try
                {
                    RoleplayBot Bot = RoleplayBotManager.GetCachedBotByAI(BotAI);

                    if (Bot == null)
                    {
                        return(null);
                    }

                    return(RoleplayBotManager.DeployBotByID(Bot.Id));
                }
                catch (Exception ex)
                {
                    RoleplayBotManager.OnError(ex.Message);
                }
            }

            return(null);
        }