Exemplo n.º 1
0
 public NpcEntity(EntityId id, EntityId ownerId, Entity owner,NpcInfo info)
     : base(id)
 {
     OwnerId = ownerId;
     Owner = owner;
     Info = info;
 }
Exemplo n.º 2
0
 public MissionView()
 {
     mTargetList      = new List <TargetShow>();
     mRewardsList     = new List <ItemSample>();
     mMissionStartNpc = new NpcInfo();
     mMissionEndNpc   = new NpcInfo();
     mMissionReplyNpc = new NpcInfo();
     mComplete        = false;
     mMissionTag      = true;
     mEndMisPos       = Vector3.zero;
     NeedArrow        = false;
 }
    void DrawNpcInfoList(ref Vector2 ScrollPos, Dictionary <int, NpcInfo> MonsterInfoList, int nChooseID, bool isChar = false)
    {
        StartSpace(1);
        float height           = 30;
        int   ScrollViewheight = m_OneShowNum * 30 + 20;

        if (ScrollViewheight > 280)
        {
            ScrollViewheight = 280;
        }
        GUILayout.BeginHorizontal();
        ScrollPos = EditorGUILayout.BeginScrollView(ScrollPos, false, false, GUILayout.Height(ScrollViewheight));
        GUILayout.BeginVertical();

        int        nCurIndex = m_ShowNpcIndex;
        List <int> tKeys     = new List <int>(MonsterInfoList.Keys);

        tKeys.Sort();
        int nStart = (nCurIndex - 1) * m_OneShowNum;
        int nEnd   = Mathf.Min(nCurIndex * m_OneShowNum, tKeys.Count);
        int nTotal = (int)Mathf.Ceil(tKeys.Count / (float)m_OneShowNum);

        for (int i = nStart; i < nEnd; i++)
        {
            NpcInfo info = null;
            int     id   = tKeys[i];
            MonsterInfoList.TryGetValue(id, out info);
            string Buttonshow = "名字:\t" + info.name + "\t" + "ID:\t" + info.id;
            if (id != nChooseID)
            {
                height = 30;
            }
            else
            {
                height     = 60;
                Buttonshow = "当  前  选  中\n\n" + Buttonshow;
            }
            GUIContent b = new GUIContent(Buttonshow);
            if (GUILayout.Button(b, GUILayout.Height(height)))
            {
                m_nChooseId = id;
            }
        }
        GUILayout.EndVertical();
        EditorGUILayout.EndScrollView();
        GUILayout.EndHorizontal();

        //EditorGUILayout.Space();
        nCurIndex      = EditorGUILayout.IntSlider(nCurIndex, 1, nTotal);
        m_ShowNpcIndex = nCurIndex;

        EndSpace();
    }
Exemplo n.º 4
0
 /// <summary>
 ///
 /// </summary>
 public bool FindNpcByName(string name, out NpcInfo npcInfo)
 {
     for (int i = 0; i < m_allNpc.Length; i++)
     {
         if (m_allNpc[i].name == name)
         {
             npcInfo = (m_allNpc[i]);
             return(true);
         }
     }
     npcInfo = null;
     return(false);
 }
Exemplo n.º 5
0
 public bool FindNpcById(int id, out NpcInfo npcInfo)
 {
     for (int i = 0; i < m_allNpc.Length; i++)
     {
         if (m_allNpc[i].id == id)
         {
             npcInfo = (m_allNpc[i]);
             return(true);
         }
     }
     npcInfo = null;
     return(false);
 }
Exemplo n.º 6
0
        public override void Setup(object data = null)
        {
            base.Setup(data);
            info = data as NpcInfo;
            if (info != null)
            {
                nameText.text            = resourceService.GetString(info.Data.nameId);
                descriptionText.text     = resourceService.GetString(info.Data.descriptionId);
                iconImage.overrideSprite = resourceService.GetSprite(info.Data.largeIconKey, info.Data.largeIconPath);

                WeaponData weapon = resourceService.GetWeapon(info.Data.weaponId);
                weaponIconImage.overrideSprite = resourceService.GetSprite(weapon);
                weaponNameText.text            = resourceService.GetString(weapon.nameId);

                int playerCount = playerService.GetItemCount(weapon);
                if (playerCount > 0)
                {
                    priceParent.gameObject.DeactivateSelf();
                    buttonText.text = resourceService.GetString("Loc_KillEnPanel_killButton");
                    buyOrKillButton.SetListener(() => {
                        playerService.RemoveItem(weapon.type, weapon.id, 1);
                        engine.Cast <RavenhillEngine>().DropItems(info.Data.rewards, null, () => !viewService.hasModals);
                        engine.GetService <INpcService>().Cast <NpcService>().RemoveNpc(info.RoomId);
                        Close();
                    }, engine.GetService <IAudioService>());
                    weaponIconImage.SetAlpha(1);
                }
                else
                {
                    priceParent.gameObject.ActivateSelf();
                    priceText.text            = weapon.price.price.ToString();
                    priceImage.overrideSprite = resourceService.GetPriceSprite(weapon.price);
                    buttonText.text           = resourceService.GetString("Loc_KillEnPanel_buyButton");
                    buyOrKillButton.SetListener(() => {
                        if (playerService.HasCoins(weapon.price))
                        {
                            playerService.RemoveCoins(weapon.price);
                            playerService.AddItem(new InventoryItem(weapon, 1));
                            Setup(info);
                        }
                        else
                        {
                            viewService.ShowView(RavenhillViewType.bank);
                        }
                    }, engine.GetService <IAudioService>());
                    weaponIconImage.SetAlpha(0.5f);
                }
            }
            closeBigButton.SetListener(Close, engine.GetService <IAudioService>());
        }
Exemplo n.º 7
0
    private void OnDisable()
    {
        StopAllCoroutines();
        TargetInfo = null;

        if (mWantItem)
        {
            mWantItem.ResetItem();
        }
        mWantItem = null;
        StopAllCoroutines();
        mGaugeBar.fillAmount = 1f;
        guestDoHandler       = null;
    }
Exemplo n.º 8
0
 public Skill(long amount, Database.Type type, EntityId target, EntityId source, int skillId, bool hotdot,
              bool critic, long time, NpcInfo pet, HitDirection direction)
 {
     Amount    = amount;
     Type      = type;
     Target    = target;
     Source    = source;
     SkillId   = skillId;
     Critic    = critic;
     HotDot    = hotdot;
     Time      = time;
     Pet       = pet;
     Direction = direction;
 }
Exemplo n.º 9
0
 public SimpleNpc(int id, BaseGame game, NpcInfo npcInfo, int type, int direction, int rank) : base(id, game, npcInfo.Camp, npcInfo.Name, npcInfo.ModelID, npcInfo.Blood, npcInfo.Immunity, direction, npcInfo.MaxBeatDis)
 {
     if (type == 0)
     {
         base.Type = eLivingType.SimpleNpc;
     }
     else
     {
         if (type == 1)
         {
             base.Type = eLivingType.SimpleNpcNormal;
         }
         else
         {
             if (type == 2)
             {
                 base.Type = eLivingType.SimpleNpcDeck;
             }
             else
             {
                 if (type == 3)
                 {
                     base.Type = eLivingType.SimpleWingNpc;
                 }
             }
         }
     }
     this.m_npcInfo = npcInfo;
     this.m_ai      = (ScriptMgr.CreateInstance(npcInfo.Script) as ABrain);
     if (this.m_ai == null)
     {
         if (this.m_npcInfo.Type != 3)
         {
             SimpleNpc.log.ErrorFormat("Can't create abrain :{0}", npcInfo.Script);
         }
         this.m_ai = SimpleBrain.Simple;
     }
     this.m_ai.Game = this.m_game;
     this.m_ai.Body = this;
     this.m_rank    = rank;
     this.Reset();
     try
     {
         this.m_ai.OnCreated();
     }
     catch (Exception ex)
     {
         SimpleNpc.log.ErrorFormat("SimpleNpc Created error:{0}", ex);
     }
 }
Exemplo n.º 10
0
 public void SetNpcInfo(NpcInfo _npcInfo)
 {
     npcInfo = _npcInfo;
     graphic.GetComponent <SpriteRenderer>().sprite = npcInfo.graphic;
     life    = npcInfo.LifeValue;
     attack  = npcInfo.OffensiveValue;
     defence = npcInfo.DefensiveValue;
     heal    = npcInfo.HealingValue;
     npcUI.GetComponent <NpcUI>().SetHealth(_npcInfo.LifeValue, life);
     npcUI.GetComponent <NpcUI>().SetActionSpended(actionExpended);
     itsLooteable       = _npcInfo.itsLooteable;
     itsInanimateObject = _npcInfo.inanimateObject;
     loot = _npcInfo.loot;
 }
Exemplo n.º 11
0
        public void LoadLife(WzImage mapImage, Board mapBoard)
        {
            WzImageProperty lifeParent = mapImage["life"];

            if (lifeParent == null)
            {
                return;
            }
            foreach (WzSubProperty life in lifeParent.WzProperties)
            {
                string    id          = InfoTool.GetString(life["id"]);
                int       x           = InfoTool.GetInt(life["x"]);
                int       y           = InfoTool.GetInt(life["y"]);
                int       cy          = InfoTool.GetInt(life["cy"]);
                int?      mobTime     = InfoTool.GetOptionalInt(life["mobTime"]);
                int?      info        = InfoTool.GetOptionalInt(life["info"]);
                int?      team        = InfoTool.GetOptionalInt(life["team"]);
                int       rx0         = InfoTool.GetInt(life["rx0"]);
                int       rx1         = InfoTool.GetInt(life["rx1"]);
                MapleBool flip        = InfoTool.GetOptionalBool(life["f"]);
                MapleBool hide        = InfoTool.GetOptionalBool(life["hide"]);
                string    type        = InfoTool.GetString(life["type"]);
                string    limitedname = InfoTool.GetOptionalString(life["limitedname"]);

                switch (type)
                {
                case "m":
                    MobInfo mobInfo = MobInfo.Get(id);
                    if (mobInfo == null)
                    {
                        continue;
                    }
                    mapBoard.BoardItems.Mobs.Add((MobInstance)mobInfo.CreateInstance(mapBoard, x, cy, x - rx0, rx1 - x, cy - y, limitedname, mobTime, flip, hide, info, team));
                    break;

                case "n":
                    NpcInfo npcInfo = NpcInfo.Get(id);
                    if (npcInfo == null)
                    {
                        continue;
                    }
                    mapBoard.BoardItems.NPCs.Add((NpcInstance)npcInfo.CreateInstance(mapBoard, x, cy, x - rx0, rx1 - x, cy - y, limitedname, mobTime, flip, hide, info, team));
                    break;

                default:
                    throw new Exception("invalid life type " + type);
                }
            }
        }
Exemplo n.º 12
0
 public void StartLoading()
 {
     if (base.GameState == eGameState.Prepared)
     {
         this.m_gameState = eGameState.Loading;
         base.ClearWaitTimer();
         if (this.m_npcID != 0 && base.RoomType == eRoomType.Match)
         {
             NpcInfo npc = NPCInfoMgr.GetNpcInfoById(this.m_npcID);
             base.AddLoadingFile(2, npc.ResourcesPath, npc.ModelID);
         }
         base.SendStartLoading(60);
         base.AddAction(new WaitPlayerLoadingAction(this, 65000));
     }
 }
Exemplo n.º 13
0
        private void TryUpdateValue(StoryInstance instance)
        {
            Scene scene = instance.Context as Scene;

            if (null != scene)
            {
                int objId = m_ObjId.Value;
                m_HaveValue = true;
                NpcInfo npc = scene.SceneContext.GetCharacterInfoById(objId) as NpcInfo;
                if (null != npc)
                {
                    m_Value = (npc.IsCombatNpc() ? 1 : 0);
                }
            }
        }
Exemplo n.º 14
0
 public SkillAggregate(Skill skill, Skills skillsData, Entity source, Entity target, PlayerDamageDealt playerDamageDealt, bool timed,
                       Database.Database.Type type)
 {
     _playerDamageDealt = playerDamageDealt;
     _timed             = timed;
     _target            = target;
     _petinfo           = skill.NpcInfo;
     Type       = type;
     Skills     = new Dictionary <Skill, List <Entity> >();
     Name       = skill.ShortName;
     SkillsData = skillsData;
     Skills.Add(skill, new List <Entity> {
         source
     });
 }
Exemplo n.º 15
0
 private void lifeListBox_SelectedValueChanged(object sender, EventArgs e)
 {
     lock (hcsm.MultiBoard)
     {
         lifePictureBox.Image = new Bitmap(1, 1);
         if (lifeListBox.SelectedItem == null)
         {
             return;
         }
         if (reactorRButton.Checked)
         {
             ReactorInfo info = Program.InfoManager.Reactors[(string)lifeListBox.SelectedItem];
             lifePictureBox.Image = new Bitmap(info.Image);
             hcsm.EnterEditMode(ItemTypes.Reactors);
             hcsm.MultiBoard.SelectedBoard.Mouse.SetHeldInfo(info);
         }
         else if (npcRButton.Checked)
         {
             string  id   = ((string)lifeListBox.SelectedItem).Substring(0, ((string)lifeListBox.SelectedItem).IndexOf(" - "));
             NpcInfo info = WzInfoTools.GetNpcInfoById(id);
             if (info == null)
             {
                 lifePictureBox.Image = null;
                 return;
             }
             if (info.Height == 1 && info.Width == 1)
             {
                 info.Image = global::HaCreator.Properties.Resources.placeholder;
             }
             lifePictureBox.Image = new Bitmap(info.Image);
             hcsm.EnterEditMode(ItemTypes.NPCs);
             hcsm.MultiBoard.SelectedBoard.Mouse.SetHeldInfo(info);
         }
         else if (mobRButton.Checked)
         {
             string  id   = ((string)lifeListBox.SelectedItem).Substring(0, ((string)lifeListBox.SelectedItem).IndexOf(" - "));
             MobInfo info = WzInfoTools.GetMobInfoById(id);
             if (info == null)
             {
                 lifePictureBox.Image = null;
                 return;
             }
             lifePictureBox.Image = new Bitmap(info.Image);
             hcsm.EnterEditMode(ItemTypes.Mobs);
             hcsm.MultiBoard.SelectedBoard.Mouse.SetHeldInfo(info);
         }
     }
 }
Exemplo n.º 16
0
        public override void OnPrepareNewSession()
        {
            base.OnPrepareNewSession();
            int[] resources = { npcID, bossID };
            Game.LoadResources(resources);

            NpcInfo npcInfo4 = NPCInfoMgr.GetNpcInfoById(4);

            Game.GameOverResources[0] = npcInfo4.ModelID;
            NpcInfo npcInfo8 = NPCInfoMgr.GetNpcInfoById(8);

            Game.GameOverResources[1] = npcInfo8.ModelID;

            Game.SetMap(1076);
            Game.IsBossWar = "真炸弹人王";
        }
Exemplo n.º 17
0
        public override void OnPrepareNewSession()
        {
            base.OnPrepareNewSession();

            NpcInfo npcInfo28 = NPCInfoMgr.GetNpcInfoById(28);

            Game.GameOverResources[0] = npcInfo28.ModelID;
            Game.AddLoadingFile(2, npcInfo28.ResourcesPath, npcInfo28.ModelID);

            NpcInfo npcInfo32 = NPCInfoMgr.GetNpcInfoById(32);

            Game.GameOverResources[1] = npcInfo32.ModelID;
            Game.AddLoadingFile(2, npcInfo32.ResourcesPath, npcInfo32.ModelID);

            Game.SetMap(1076);
            Game.IsBossWar = "真炸弹人王";
        }
Exemplo n.º 18
0
        private void Butcher(ICommandSender sender)
        {
            var npcCount      = 0;
            var npcService    = _server.Npcs;
            var playerService = _server.Players;
            var npcInfoPacket = new NpcInfo();

            foreach (var npc in npcService.Where(n => n != null && n.IsActive && n.Health > 0 && !Terraria.Main.npc[n.Index].friendly && !Terraria.Main.npc[n.Index].townNPC))
            {
                npc.IsActive           = false;
                npcInfoPacket.NpcIndex = (short)npc.Index;
                playerService.BroadcastPacket(npcInfoPacket);
                ++npcCount;
            }

            sender.SendMessage($"Butchered {npcCount} NPC(s).");
        }
Exemplo n.º 19
0
        public double Average(Entity source, Entity target, int skillid, bool timed, NpcInfo petInfo, Database.Type type)
        {
            var targetString = target?.Id.ToString() ?? "";
            var key          = "average/" + source + "/" + targetString + "/" + skillid + "/" + (petInfo?.Name ?? "") + "/" + type + "/" + timed;

            if (_caching.ContainsKey(key))
            {
                return((double)_caching[key]);
            }

            var dataSource = DataSource(source, target, skillid, timed);
            var result     = from skills in dataSource where skills.Type == type && skills.Pet == petInfo select skills.Amount;

            var average = result.Average();

            _caching[key] = average;
            return(average);
        }
Exemplo n.º 20
0
        public long Amount(Entity source, Entity target, int skillid, bool timed, NpcInfo petInfo, Database.Type type)
        {
            var targetString = target?.Id.ToString() ?? "";
            var key          = "amount/" + source + "/" + targetString + "/" + skillid + "/" + (petInfo?.Name ?? "") + "/" + type + "/" + timed;

            if (_caching.ContainsKey(key))
            {
                return((long)_caching[key]);
            }

            var dataSource = DataSource(source, target, skillid, timed);
            var result     = from skills in dataSource where skills.Type == type && skills.Pet == petInfo select skills.Amount;

            var sum = result.Sum();

            _caching[key] = sum;
            return(sum);
        }
Exemplo n.º 21
0
        public int Hits(Entity source, Entity target, int skillid, bool timed, NpcInfo petInfo, Database.Type type)
        {
            var targetString = target?.Id.ToString() ?? "";
            var key          = "hits/" + source + "/" + targetString + "/" + skillid + "/" + (petInfo?.Name ?? "") + "/" + type + "/" + timed;

            if (_caching.ContainsKey(key))
            {
                return((int)_caching[key]);
            }

            var dataSource = DataSource(source, target, skillid, timed);
            var result     = from skills in dataSource where skills.Type == type && skills.Pet == petInfo select skills;

            var hits = result.Count();

            _caching[key] = hits;
            return(hits);
        }
Exemplo n.º 22
0
        protected override bool ExecCommand(StoryInstance instance, long delta)
        {
            Scene scene = instance.Context as Scene;

            if (null != scene)
            {
                if (0 == m_ParamNum)
                {
                    for (LinkedListNode <UserInfo> linkNode = scene.UserManager.Users.FirstValue; null != linkNode; linkNode = linkNode.Next)
                    {
                        UserInfo info = linkNode.Value;
                        User     user = info.CustomData as User;

                        if (null != info && null != user)
                        {
                            MovementStateInfo msi = info.GetMovementStateInfo();

                            LogSystem.Info("CameraFollowImmediately:{0}", info.GetId());

                            ArkCrossEngineMessage.Msg_RC_CameraFollow msg = new ArkCrossEngineMessage.Msg_RC_CameraFollow();
                            msg.obj_id         = info.GetId();
                            msg.is_immediately = true;

                            user.SendMessage(msg);
                        }
                    }
                }
                else
                {
                    int     unitId = m_UnitId.Value;
                    NpcInfo npc    = scene.SceneContext.GetCharacterInfoByUnitId(unitId) as NpcInfo;
                    if (null != npc)
                    {
                        LogSystem.Info("CameraFollowImmediately:{0}", npc.GetId());

                        ArkCrossEngineMessage.Msg_RC_CameraFollow msg = new ArkCrossEngineMessage.Msg_RC_CameraFollow();
                        msg.obj_id         = npc.GetId();
                        msg.is_immediately = true;
                        scene.NotifyAllUser(msg);
                    }
                }
            }
            return(false);
        }
Exemplo n.º 23
0
        private static Dictionary <int, NpcInfo> LoadFromDatabase()
        {
            Dictionary <int, NpcInfo> list = new Dictionary <int, NpcInfo>();

            using (ProduceBussiness db = new ProduceBussiness())
            {
                NpcInfo[] infos = db.GetAllNPCInfo();
                NpcInfo[] array = infos;
                for (int i = 0; i < array.Length; i++)
                {
                    NpcInfo info = array[i];
                    if (!list.ContainsKey(info.ID))
                    {
                        list.Add(info.ID, info);
                    }
                }
            }
            return(list);
        }
Exemplo n.º 24
0
        private static Dictionary <int, NpcInfo> LoadFromDatabase()
        {
            Dictionary <int, NpcInfo> dictionary = new Dictionary <int, NpcInfo>();

            using (ProduceBussiness produceBussiness = new ProduceBussiness())
            {
                NpcInfo[] allNPCInfo = produceBussiness.GetAllNPCInfo();
                NpcInfo[] array      = allNPCInfo;
                for (int i = 0; i < array.Length; i++)
                {
                    NpcInfo npcInfo = array[i];
                    if (!dictionary.ContainsKey(npcInfo.ID))
                    {
                        dictionary.Add(npcInfo.ID, npcInfo);
                    }
                }
            }
            return(dictionary);
        }
Exemplo n.º 25
0
        public int CritRate(Entity source, Entity target, int skillid, bool timed, NpcInfo petInfo, Database.Type type)
        {
            var targetString = target?.Id.ToString() ?? "";
            var key          = "critrate/" + source + "/" + targetString + "/" + skillid + "/" + (petInfo?.Name ?? "") + "/" + type + "/" + timed;

            if (_caching.ContainsKey(key))
            {
                return((int)_caching[key]);
            }

            var dataSource = DataSource(source, target, skillid, timed);
            var result     = from skills in dataSource where skills.Type == type && skills.Pet == petInfo select skills.Critic;

            var enumerable = result as bool[] ?? result.ToArray();
            var crit       = enumerable.Count(x => x) * 100 / enumerable.Length;

            _caching[key] = crit;
            return(crit);
        }
Exemplo n.º 26
0
    public void Show(CopyInfo copyInfo, SceneInfo sceneInfo)
    {
        if (container)
        {
            container.gameObject.SetActive(true);
        }
        mapNameText.text = copyInfo.Name;
        mapResText.text  = copyInfo.ResName;
        thingsListView.Clear();
        things.Clear();
        GameObjectInfo gameObjectInfo = null;

        for (int i = 0; i < sceneInfo.AllGameObjectInfos.Count; ++i)
        {
            gameObjectInfo = sceneInfo.AllGameObjectInfos[i];
            if (gameObjectInfo.Type != GameObjectTypes.Effect)
            {
                things.Add(gameObjectInfo.myIndex + ":" + gameObjectInfo.PrefabName);
            }
        }
        gameObjectInfo = sceneInfo.TerrainInfo;
        things.Add(gameObjectInfo.myIndex + ":" + gameObjectInfo.PrefabName);
        thingsListView.DataSource = things;

        effectsListView.Clear();
        effects.Clear();
        for (int i = 0; i < sceneInfo.Effects.Count; ++i)
        {
            gameObjectInfo = sceneInfo.Effects[i];
            effects.Add(gameObjectInfo.myIndex + ":" + gameObjectInfo.PrefabName);
        }
        effectsListView.DataSource = effects;

        npcListView.Clear();
        NpcInfo npcInfo = null;

        for (int i = 0; i < copyInfo.NPCList.Count; ++i)
        {
            npcInfo = copyInfo.NPCList[i];
            // npcs.Add();
        }
    }
Exemplo n.º 27
0
    public void InitNpcInfo(object[] npcInfo)
    {
        //m_NpcInfoList;
        string[] sIdInfo = npcInfo[0].ToString().Split(',');
        LuaTable tInfo   = (LuaTable)npcInfo[1];

        for (int i = 0; i < sIdInfo.Length; i++)
        {
            string   sId      = sIdInfo[i];
            int      npcId    = int.Parse(sId);
            LuaTable tNpcInfo = (LuaTable)tInfo[npcId];

            NpcInfo npc = new NpcInfo();
            if (tNpcInfo != null)
            {
                npc.setInfo(tNpcInfo["npcid"].ToString(), tNpcInfo["name"].ToString(), tNpcInfo["npclevel"].ToString(), tNpcInfo["npcresource"].ToString());
                m_NpcInfoList.Add(npcId, npc);
            }
        }
    }
    public void LoadLowData()
    {
        {
            TextAsset    data   = Resources.Load("TestJson/NpcData_Npc", typeof(TextAsset)) as TextAsset;
            StringReader sr     = new StringReader(data.text);
            string       strSrc = sr.ReadToEnd();
            JSONObject   Npc    = new JSONObject(strSrc);

            for (int i = 0; i < Npc.list.Count; i++)
            {
                NpcInfo tmpInfo = new NpcInfo();
                tmpInfo.Id            = (uint)Npc[i]["Id_ui"].n;
                tmpInfo.DescriptionId = (uint)Npc[i]["DescriptionId_ui"].n;
                tmpInfo.prefab        = Npc[i]["prefab_c"].str;
                tmpInfo.PortraitId    = Npc[i]["PortraitId_c"].str;
                tmpInfo.Type          = (byte)Npc[i]["Type_b"].n;

                NpcInfoDic.Add(tmpInfo.Id, tmpInfo);
            }
        }
    }
Exemplo n.º 29
0
    public void CreateGroup(Dictionary <int, NpcInfo> npcGroupInfo)
    {
        this.itsPlayerGroup = true;
        //this.transform.tag = "HeroGroup";
        GameObject gameManager = GameObject.FindGameObjectWithTag("GameManager");

        for (int i = 0; i < 3; i++)
        {
            if (npcGroupInfo.ContainsKey(i))
            {
                GameObject hero = Instantiate(npcPrefab, spawPosition[i]);
                NpcInfo    temp = new NpcInfo();
                npcGroupInfo.TryGetValue(i, out temp);
                hero.GetComponent <Npc>().SetNpcInfo(temp);
                hero.transform.position = spawPosition[i].position;
                hero.GetComponent <Npc>().setItsPlayerGroup(true);
                members.Add(hero);
                gameManager.GetComponent <GameManagerController>().SetPlayerGroup(this.gameObject);
            }
        }
    }
Exemplo n.º 30
0
        public override void Setup(object data = null)
        {
            base.Setup(data);
            npc = data as NpcInfo;
            if (npc == null)
            {
                throw new UnityException("PatientRewardView: Setup NpcInfo is null");
            }
            npcData = npc.Data;
            if (npcData == null)
            {
                throw new NullReferenceException("PatientRewardView.Setup(): NpcData is null");
            }

            descriptionText.text = resourceService.GetString(npcData.descriptionId);

            DropItem expDropItem = npcData.rewards.Where(di => di.type == DropType.exp).FirstOrDefault();

            if (expDropItem != null)
            {
                expParent.ActivateSelf();
                expCountText.text = expDropItem.count.ToString();
            }
            else
            {
                expParent.DeactivateSelf();
            }

            DropItem silverDropItem = npcData.rewards.Where(di => di.type == DropType.silver).FirstOrDefault();

            if (silverDropItem != null)
            {
                silverParent.ActivateSelf();
                silverCountText.text = silverDropItem.count.ToString();
            }
            else
            {
                silverParent.DeactivateSelf();
            }
        }
Exemplo n.º 31
0
        public bool Type(EntityId source, Entity target, int skillid, NpcInfo pet, bool timed, Database.Type type)
        {
            var targetString = target?.Id.ToString() ?? "";
            var name         = "";

            if (pet != null)
            {
                name = pet.Name;
            }
            var key = "type/" + source + "/" + targetString + "/" + name + "/" + skillid + "/" + type + "/" + timed;

            if (_caching.ContainsKey(key))
            {
                return((bool)_caching[key]);
            }

            var dataSource = DataSource(source, target, skillid, timed);
            IEnumerable <Database.Type> result;

            if (pet == null)
            {
                result = from skills in dataSource
                         where
                         skills.Pet == null && skills.Type == type
                         select skills.Type;
            }
            else
            {
                result = from skills in dataSource
                         where
                         skills.Pet != null &&
                         skills.Pet.Name == pet.Name && skills.Type == type
                         select skills.Type;
            }

            var typeExist = result.Count();

            _caching[key] = typeExist != 0;
            return(typeExist != 0);
        }
Exemplo n.º 32
0
 public NpcInstance(NpcInfo baseInfo, Board board, int x, int y, int rx0Shift, int rx1Shift, int yShift, string limitedname, int? mobTime, MapleBool flip, MapleBool hide, int? info, int? team)
     : base(baseInfo, board, x, y, rx0Shift, rx1Shift, yShift, limitedname, mobTime, flip, hide, info, team)
 {
     this.baseInfo = baseInfo;
 }
Exemplo n.º 33
0
 public NpcInstance(Board board, SerializationForm json)
     : base(board, json)
 {
     baseInfo = NpcInfo.Get(json.id);
 }