Example #1
0
 public void Clear()
 {
     Simulation.Clear();
     NPCs.Clear();
     Units.Clear();
     Invalidate();
 }
Example #2
0
 public World()
 {
     NPCs.Clear();
     Signs.Clear();
     Chests.Clear();
     CharacterNames.Clear();
 }
Example #3
0
        public static void LoadCustomAssets(Game p_game)
        {
            JKContentManager.LevelTexture = p_game.Content.Load <Texture2D>("mods/level");

            //default
            //JKContentManager.TitleLogo = p_game.Content.Load<Texture2D>("mods/title_logo");
            JKContentManager.TitleLogo         = SmartLoad(p_game, "title_logo");
            JKContentManager.NexileLogo        = Sprite.CreateSprite(p_game.Content.Load <Texture2D>("JK_Nexile_Logo"));
            JKContentManager.NexileLogo.center = Vector2.One / 2f;
            JKContentManager.SlopeTexture      = p_game.Content.Load <Texture2D>("slopes");
            JKContentManager.SlopeSprites.LoadSprites();
            JKContentManager.GUI.Load(p_game.Content);
            JKContentManager.Shaders.Mask      = new MaskShader(p_game.Content.Load <Effect>("shaders/Mask"));
            JKContentManager.Shaders.test_mask = p_game.Content.Load <Texture2D>("shaders/test_mask");

            //custom screens
            JKContentManager.m_foregrounds        = JKExtensions.UltraContent.LoadCunt <Texture2D>(p_game.Content, "mods/screens/foreground", ".*");
            JKContentManager.m_backgrounds        = JKExtensions.UltraContent.LoadCunt <Texture2D>(p_game.Content, "mods/screens/midground", ".*");
            JKContentManager.m_backbackgrounds    = JKExtensions.UltraContent.LoadCunt <Texture2D>(p_game.Content, "mods/screens/background", ".*");
            JKContentManager.ScrollingBackgrounds = JKExtensions.UltraContent.LoadCunt <Texture2D>(p_game.Content, "mods/screens/scrolling/textures", ".*");
            JKContentManager.m_weather_masks      = JKExtensions.UltraContent.LoadCunt <Texture2D>(p_game.Content, "mods/screens/masks", ".*");
            JKContentManager.m_scrolling_bg_data  = UltraContent.LoadXmlFiles <JumpKing.Level.Data.ScrollingBGdata>(p_game, "mods/screens/scrolling", ".xml");

            //modded
            NPCs.Load(p_game.Content);
            Raven.Load(p_game.Content);
            Particles.Load(p_game.Content);
            Music.Load(p_game.Content);
            Props.Load(p_game.Content);
            Fonts.Load(p_game.Content);
            Endings.Load(p_game.Content);
            King.Load(p_game.Content);
            JKContentManager.MiscSettings.CustomLoad(p_game.Content);
        }
Example #4
0
 public Location(string name, string enemyName, int enemyHealth, int enemyDamage, float locRisk, string nameNPC)
 {
     this.name    = name;
     enemy        = new Enemies(enemyName, enemyHealth, enemyDamage);
     this.locRisk = locRisk;
     npcName      = new NPCs(nameNPC);
 }
 protected virtual void OnStartedNpcInteraction(NPCs npc, GameObject go, string passageToLoad)
 {
     if (StartedNpcInteraction != null)
     {
         StartedNpcInteraction(npc, go, passageToLoad);
     }
 }
Example #6
0
 static public void CreateNew()
 {
     Instance         = new World();
     Instance.AllNPCs = NPCs.GenerateNPCs();
     Traits.GenerateTraits(Instance.AllNPCs);
     Interactions.GenerateInteractions(Instance.AllNPCs);
 }
        public Database()
        {
            MYSQL = new MySQLHandler();
            try
            {
                if (MYSQL.Connection.State != ConnectionState.Open)
                {
                    MYSQL.Connection.Open();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("MSG_FATAL", "Can't connect to database. " + ex.ToString());
                return;
            }

            Console.WriteLine("MSG_STARTUP", "Connected to MYSQL.");

            skills = new Skills(MYSQL);
            Console.WriteLine("MSG_LOAD", "Skill database loaded with [" + skills.SkillList.Count + "] skills");
            ItemDatabase = new Items(MYSQL);
            Console.WriteLine("MSG_LOAD", "Item database loaded with [" + ItemDatabase.ItemList.Count + "] items");
            monsters = new Monsters(MYSQL);
            Console.WriteLine("MSG_LOAD", "Monster database loaded with [" + monsters.MonsterListDB.Count + "] monsters");
            waves = new Waves(MYSQL, new Monsters(MYSQL));
            Console.WriteLine("MSG_LOAD", "Waves database loaded with [" + waves.WaveList.Count + "] waves");
            NPCsDatabase = new NPCs(MYSQL, ItemDatabase);
            Console.WriteLine("MSG_LOAD", "NPC database loaded with [" + NPCsDatabase.NPCsList.Count + "] NPCs!");
            Maps = new maps();
        }
Example #8
0
        public void Initialize()
        {
            GameData = new EmbeddedData();

            //LootSerialization.PopulateLoot();

            Behaviors = new BehaviorDb(this);

            Player.HandleQuests(GameData);

            Merchant.HandleMerchant(GameData);

            AddWorld((int)WorldID.NEXUS_ID, Worlds[0] = new Nexus());
            AddWorld((int)WorldID.MARKET, new ClothBazaar());
            AddWorld((int)WorldID.TEST_ID, new Test());
            AddWorld((int)WorldID.TUT_ID, new Tutorial(true));
            AddWorld((int)WorldID.DAILY_QUEST_ID, new DailyQuestRoom());

            Monitor = new RealmPortalMonitor(this);

            Task.Factory.StartNew(() => GameWorld.AutoName(1, true)).ContinueWith(_ => AddWorld(_.Result), TaskScheduler.Default);

            InterServer = new ISManager(this);

            Chat = new ChatManager(this);

            Commands = new CommandManager(this);

            NPCs npcs = new NPCs();

            npcs.Initialize(this);

            Log.Info($"\t- {NPCs.Database.Count}\tNPC{(NPCs.Database.Count > 1 ? "s" : "")}.");
        }
 private void OnFinishedNpcInteraction(NPCs npc, GameObject go)
 {
     RestoreMainUI(UIDialogue);
     fading.StartFadeIn();
     Cursor.visible   = false;
     Cursor.lockState = CursorLockMode.Locked;
 }
Example #10
0
        //Updates Tiles and all NPCs on them
        protected void UpdateNPCs(GameTime gameTime)
        {
            List <NPC> toRemove = new List <NPC>();

            foreach (NPC n in NPCs)
            {
                n.Update(gameTime);

                //Reset any entity which falls down from the map
                if (CheckOutOfMap((int)n.Position.Y) == -1 && n.Alive)
                {
                    n.Reset();
                }

                if (!n.Alive)
                {
                    toRemove.Add(n);
                }
            }

            //Removes dead NPCs
            foreach (NPC n in toRemove)
            {
                if (NPCs.Contains(n))
                {
                    NPCs.Remove(n);
                }
            }
        }
 protected virtual void OnFinishedNpcInteraction(NPCs npc, GameObject go)
 {
     if (FinishedNpcInteraction != null)
     {
         FinishedNpcInteraction(npc, go);
     }
 }
 protected virtual void OnTriedForDialogue(NPCs npc, GameObject go)
 {
     if (TriedForDialogue != null)
     {
         TriedForDialogue(npc, go);
     }
 }
Example #13
0
        private void NPCsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (!CheckServerLocation())
            {
                return;
            }

            if (npcs.Visible)
            {
                npcs.Focus();
                return;
            }
            else
            {
                npcs = new NPCs();
            }

            npcs.FormClosed += (object s, FormClosedEventArgs fcea) =>
            {
                if (npcs.GetChanged())
                {
                    RestartServerOnChange("NPCs");
                }
            };

            npcs.Show();
        }
 private void OnFinishedNpcInteracting(NPCs npc, GameObject go)
 {
     foreach (var clue in npc.givenClues)
     {
         ProcessClue(clue);
     }
 }
Example #15
0
 static void ShowNPCName(int npcID)
 {
     if (NPCs.ContainsKey(npcID))
     {
         NPCs[npcID].save.Set("show_name", true, true);
     }
 }
 private void OnStartedNpcInteracting(NPCs npc, GameObject go, string passage)
 {
     if (npc.name == "Phone")
     {
         soundSource.Stop();
     }
 }
Example #17
0
    public void ChangeSceneState(bool increase)
    {
        if (increase)
        {
            if (currentState != 5)
            {
                currentState += 1;
            }
        }
        else
        {
            if (currentState != 1)
            {
                currentState -= 1;
            }
        }

        foreach (TimeSceneNPC NPCs in GameObject.FindObjectsOfType <TimeSceneNPC>())
        {
            NPCs.ChangeStateNPC();
        }

        foreach (TimeSceneObjects objects in GameObject.FindObjectsOfTypeAll(typeof(TimeSceneObjects)))
        {
            objects.ChangeStateObject();
        }
    }
Example #18
0
    /// <summary>
    /// Check a list of npc names from the database against the npc names in the current scene so
    /// if the names are not there (meaning they have been removed from the scene) then the table
    /// of characters is updated to remove the scene from the character table scene field and in
    /// turn informs the user using the data dialogue UI.
    /// </summary>
    /// <param name="namesList">A list of character names</param>
    private void UpdateCharsInDbNoLongerInScene(List <string[]> namesList)
    {
        NPCs npcs = FindObjectOfType <NPCs>();

        foreach (string[] nameBox in namesList)
        {
            string npcName = nameBox[0];
            string npcParam;
            if (npcName == "")
            {
                npcParam = "''";
            }
            else
            {
                npcParam = DbCommands.GetParameterNameFromValue(npcName);
            }
            if (!npcs.IsNameInCharDict(npcName))
            {
                DbCommands.UpdateTableField(
                    "Characters",
                    "Scenes",
                    "null",
                    "CharacterNames = " + npcParam,
                    npcName
                    );
            }
        }
    }
 private void OnFinishedNpcInteracting(NPCs npc, GameObject go)
 {
     if (npc.name != "Phone")
     {
         go.GetComponent <Animator>().SetTrigger("default");
     }
 }
Example #20
0
 private void OnFinishedNpcInteracting(NPCs npc, GameObject go)
 {
     if (!CheckForNoPlay())
     {
         PlayGame();
         Debug.Log("testplay");
     }
 }
Example #21
0
 private void AddNPCs(string name, int min, int max)
 {
     //Random rand = new Random(Guid.NewGuid().GetHashCode());
     for (int i = 0; i < rand.Next(min, max + 1); i++)
     {
         NPCs.Add(new NPC(name, friendly));
     }
 }
Example #22
0
 public World()
 {
     NPCs.Clear();
     Signs.Clear();
     Chests.Clear();
     CharacterNames.Clear();
     TileFrameImportant = SettingsTileFrameImportant.ToArray(); // clone for "new" world. Loaded worlds will replace this with file data
 }
Example #23
0
 public void Update()
 {
     foreach (NPC n in Npcs)
     {
         n.Update();
     }
     NPCs.RemoveAll(npc => npc.Dead);
 }
Example #24
0
    /// <summary>
    /// Inserts any character in the scene that is not yet in the characters table.
    /// </summary>
    private void InsertCharsNotInDbFromScene(string currentScene)
    {
        NPCs npcs = FindObjectOfType <NPCs>();

        foreach (string npcName in npcs.GetCharNamesList())
        {
            DbCommands.InsertTupleToTable("Characters", npcName, currentScene);
        }
    }
Example #25
0
        public void AddNPC(NPC n)
        {
            if (NPCs == null)
            {
                NPCs = new List <NPC>();
            }

            NPCs.Add(n);
        }
Example #26
0
    public void OnTriggerEnter(Collider collision)
    {
        NPCs n = collision.gameObject.GetComponent <NPCs>();

        if (n && n.team != team)
        {
            n.ModifieHP(damage);
            Die();
        }
    }
Example #27
0
        public List <NPC> CreateNPC()
        {
            XmlSerializer serializer = new XmlSerializer(typeof(List <NPC>), new XmlRootAttribute("NPCs"));

            using (XmlReader reader = XmlReader.Create(@"..\..\data\npc.xml"))
            {
                NPCs = (List <NPC>)serializer.Deserialize(reader);
                NPCs.ForEach(i => XMLReference <Item> .Link(i.Items, Items));
                return(NPCs);
            }
        }
Example #28
0
 /// <summary>
 /// [EDITOR ONLY]
 /// </summary>
 /// <param name="_character"></param>
 public void AddCharacter(Character _character)
 {
     if (_character.IsPlayable == true && PCs.Contains(_character) == false)
     {
         PCs.Add(_character);
     }
     else if (_character.IsPlayable == false && NPCs.Contains(_character) == false)
     {
         NPCs.Add(_character);
     }
 }
Example #29
0
 public void DeleteCharacter(Character _character)
 {
     if (_character.IsPlayable == true && PCs.Contains(_character) == true)
     {
         PCs.Remove(_character);
     }
     else if (_character.IsPlayable == false && NPCs.Contains(_character) == true)
     {
         NPCs.Remove(_character);
     }
 }
Example #30
0
        //Like Map.Update, updates player, NPCs, items, events and displayed text. Also advances the intro/outro as needed and checks for task completion
        public override void Update(GameTime gameTime, KeyboardState keyboardState)
        {
            Player.Update(gameTime, keyboardState);
            UpdateNPCs(gameTime);
            UpdateItems(gameTime);
            UpdateEvents();
            TextAnimationMgr.Update();

            if (CheckOutOfMap((int)Player.Position.Y) == -1)
            {
                //player fell down, reset player
                ResetPlayer();
            }

            //Player entered the "red door"
            if (exitZone != null && CheckZone(exitZone))
            {
                Game.Dialogue = new Dialogue(device, this, "Start your adventure now?", delegate { exitZone = null; Game.endIntro = true; Game.Loading = new Loading(device, this, "Game is now loading..."); }, delegate { ResetPlayer(); });
            }

            //Player is trying to reach all "green doors"
            if (movementTestZones != null)
            {
                foreach (Zone z in movementTestZones)
                {
                    if (CheckZone(z))
                    {
                        z.Deactivate();
                    }
                }

                //Success, create next task
                if (!movementTestZones.Any(x => x.Active == true))
                {
                    movementTestZones = null;
                    SetText("Good.\nNow there is an Item and an NPC (which can move around and attack you).\nUse your action keys to pick the item up (K) and attack the NPC (J)!", 50);
                    NPCs.Add(new NPC(device, this, new Vector2(400, 400), 0, tiles[0], 32, 32));
                    items.Add(new Item(this, device, Item.ItemType.Weapon, 0, new Vector2(600, 600), 0, 16, 16, true, null, new ItemProperties("ITEM")));
                }
            }

            if (Player.HeldItem != null)
            {
                pickedUpItem = true;
            }

            //Item picked up and NPC is dead, show red door and last part of text
            if (!lastStage && pickedUpItem && NPCs.Count == 0) //0 NPCs if item has been held means that the NPC is dead
            {
                lastStage = true;
                SetText("Well done!\nYou seem ready, " + Player.Name + ".\nYour objective in the game is to complete all the quests.\nIf you can't or don't want to, press ESC to end the current map and see\ngame statistics.\n\nTo start the game, jump through the red door.", 50);
                exitZone = GetScreenZone(device, Color.Red);
            }
        }