Exemplo n.º 1
0
 public void SpawnVillagers()
 {
     m_Beggar    = m_Factory.GetNPC(NPCType.Beggar);
     m_Farmer    = m_Factory.GetNPC(NPCType.Farmer);
     m_Shopowner = m_Factory.GetNPC(NPCType.Shopowner);
     m_Guard     = m_Factory.GetNPC(NPCType.Guard);
     m_Beggar.Speak();
     m_Farmer.Speak();
     m_Shopowner.Speak();
     m_Guard.Speak();
 }
Exemplo n.º 2
0
    public void SpawnVillagers()
    {
        //HAVE FACTORY MANUFACTURE THEM!!!

        mBeggar    = mFactory.GetNPC(NPCType.Beggar);
        mFarmer    = mFactory.GetNPC(NPCType.Farmer);
        mShopowner = mFactory.GetNPC(NPCType.Shopowner);

        mBeggar.Speak();
        mFarmer.Speak();
        mShopowner.Speak();
    }
    public void SpawnVillagers()
    {
        beggar    = factory.GetNPC(NPCType.Beggar);
        shopOwner = factory.GetNPC(NPCType.Shopowener);
        farmer    = factory.GetNPC(NPCType.Farmer);
        villager  = factory.GetNPC(NPCType.Villager);

        beggar.Speak();
        shopOwner.Speak();
        farmer.Speak();
        villager.Speak();
    }
    public void SpawnVillagers()
    {
        //Have factory manufacture the villagers

        m_Farmer    = m_Factory.GetNPC(NPCType.Farmer);
        m_Beggar    = m_Factory.GetNPC(NPCType.Beggar);
        m_Shopowner = m_Factory.GetNPC(NPCType.Shopowner);

        m_Farmer.Speak();
        m_Beggar.Speak();
        m_Shopowner.Speak();
    }
Exemplo n.º 5
0
 public void SpawnVillagers()
 {
     /**
      * We don't want to specify the class to instiate for each type
      * of villager.
      * Instead, we ask the factory to "manufacture" it for us.
      **/
     m_Beggar    = m_Factory.GetNPC(NPCType.Beggar);
     m_Farmer    = m_Factory.GetNPC(NPCType.Farmer);
     m_Shopowner = m_Factory.GetNPC(NPCType.Shopowner);
     m_Boss      = m_Factory.GetNPC(NPCType.Boss);
     m_Beggar.Speak();
     m_Farmer.Speak();
     m_Shopowner.Speak();
 }
Exemplo n.º 6
0
        public IActionResult GetName(int npcId)
        {
            NPC npcData = NPCFactory.GetNPC(npcId);

            return(Json(new
            {
                Name = npcData.Name,
                Id = npcData.Id
            }));
        }
Exemplo n.º 7
0
        public IActionResult GetNPC(int npcId)
        {
            NPC npcInfo = NPCFactory.GetNPC(npcId);

            npcInfo.RelatedQuestsInfo = npcInfo.RelatedQuests?.Select(c => QuestFactory.GetQuest(c)).Where(c => c != null).Select(c => new QuestName()
            {
                id = c.Id, name = c.Name
            }).ToArray();
            return(Json(npcInfo));
        }
Exemplo n.º 8
0
        public IActionResult GetQuest(int questId)
        {
            var quest = QuestFactory.GetQuest(questId);

            if (quest.RequirementToStart.NPCId.HasValue)
            {
                quest.RequirementToStart.NPCInfo = NPCFactory.GetNPC(quest.RequirementToStart.NPCId.Value);
            }
            if (quest.RequirementToComplete.NPCId.HasValue)
            {
                quest.RequirementToComplete.NPCInfo = NPCFactory.GetNPC(quest.RequirementToComplete.NPCId.Value);
            }

            if (quest == null)
            {
                return(NotFound());
            }
            return(Json(quest));
        }
Exemplo n.º 9
0
    public void SpawnVillagers()
    {
        m_Beggar    = m_Factory.GetNPC(NPCType.Beggar);
        m_Farmer    = m_Factory.GetNPC(NPCType.Farmer);
        m_Shopowner = m_Factory.GetNPC(NPCType.Shopowner);
        m_Priest    = m_Factory.GetNPC(NPCType.Priest);
        m_Straydog  = m_Factory.GetNPC(NPCType.StrayDog);
        m_Baker     = m_Factory.GetNPC(NPCType.Baker);

        m_Beggar.Speak();
        m_Farmer.Speak();
        m_Shopowner.Speak();
        m_Priest.Speak();
        m_Straydog.Speak();
        m_Baker.Speak();
    }
Exemplo n.º 10
0
        public IActionResult GetFrame(int npcId)
        {
            NPC npcData = NPCFactory.GetNPC(npcId);

            if (npcData.IsComponentNPC ?? false)
            {
                return(File(AvatarFactory.Render(new Character()
                {
                    AnimationName = "stand1",
                    ItemEntries = npcData.ComponentIds
                                  .Concat(new int[] { npcData.ComponentSkin ?? 2000, (npcData.ComponentSkin ?? 2000) + 10000 })
                                  .Select(c => new AvatarItemEntry()
                    {
                        ItemId = c, Region = Region, Version = Version
                    })
                                  .ToArray()
                }).ImageToByte(Request), "image/png"));
            }
            if (!npcData.Framebooks.ContainsKey("stand"))
            {
                return(NotFound());
            }

            FrameBook standing = npcData.GetFrameBook("stand").First();

            if (standing == null)
            {
                return(NotFound());
            }

            Frame firstFrame = standing.frames.First();

            if (firstFrame == null || firstFrame.Image == null)
            {
                return(NotFound());
            }

            return(File(firstFrame.Image.ImageToByte(Request), "image/png"));
        }
Exemplo n.º 11
0
        public IActionResult Render(int npcId, string framebook, int frame = 0)
        {
            NPC npcData = NPCFactory.GetNPC(npcId);

            if (npcData.IsComponentNPC ?? false)
            {
                return(File(AvatarFactory.Render(new Character()
                {
                    AnimationName = framebook,
                    FrameNumber = frame,
                    ItemEntries = npcData.ComponentIds
                                  .Concat(new int[] { npcData.ComponentSkin ?? 2000, (npcData.ComponentSkin ?? 2000) + 10000 })
                                  .Select(c => new AvatarItemEntry()
                    {
                        ItemId = c, Region = Region, Version = Version
                    })
                                  .ToArray()
                }).ImageToByte(Request), "image/png"));
            }

            FrameBook standing = npcData.GetFrameBook(framebook).First();

            if (standing == null)
            {
                return(NotFound());
            }

            Frame firstFrame = standing.frames.ElementAt(frame % standing.frames.Count());

            if (firstFrame == null || firstFrame.Image == null)
            {
                return(NotFound());
            }

            return(File(firstFrame.Image.ImageToByte(Request), "image/png"));
        }