Ejemplo n.º 1
0
 public static void DeployCachedBots()
 {
     foreach (KeyValuePair <int, RoleplayBot> RoleplayBot in RoleplayBotManager.CachedRoleplayBots)
     {
         RoleplayBotManager.DeployBotByID(RoleplayBot.Key, "default");
         // Console.WriteLine("Deployed bot: " + RoleplayBot.Value.Name + " to room " + RoleplayBot.Value.SpawnId);
     }
 }
Ejemplo n.º 2
0
        public static void DeployCachedBots(Room Room)
        {
            foreach (RoleplayBot RoleplayBot in RoleplayBotManager.CachedRoleplayBots.Values.Where(CachedBot => CachedBot != null).Where(CachedBot => CachedBot.SpawnId == Room.Id))
            {
                /// Don't deploy delivery bot
                if (RoleplayBot.AIType == RoleplayBotAIType.DELIVERY)
                {
                    continue;
                }

                RoleplayBotManager.DeployBotByID(RoleplayBot.Id, "default");
            }
        }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 4
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);
        }