Exemplo n.º 1
0
        //public override movie getMovieItemInfo(string itemUrl)
        //{
        //    victimDetailContent = getRootNode(itemUrl);
        //    if (is404(victimDetailContent)) return null;
        //    if (checkIgnoreMovie(victimDetailContent)) return null;
        //    movie mv = getMovie(victimDetailContent);
        //    if (mv == null || movieExistedWithVictim(mv, victimDomain)) return null;
        //    victim vtm = getVictim(victimDetailContent);
        //    if (vtm == null) return null;
        //    vtm.name = victimDomain;
        //    vtm.movieDetailHref = itemUrl;
        //    //getAndAddEpisodesToVictim(vtm);
        //    if (!movieExisted(mv))
        //    {
        //        vtm.isDefault = 1;
        //        mv.directors = getDirectors(victimDetailContent);
        //        mv.actors = getActors(victimDetailContent);
        //        mv.countries = getCountries(victimDetailContent);
        //        mv.categories  = getCategories(victimDetailContent);
        //        mv.keywords = buildKeyWords(mv);
        //    } else
        //    {
        //        vtm.movieId = findMovieByCheckFields(mv.name1CheckField, mv.name2CheckField).movieId;
        //    }
        //    mv.victims.Add(vtm);
        //    return mv;
        //}

        public override movie getMovieItemInfo(string itemUrl)
        {
            victimDetailContent = getRootNode(itemUrl);
            if (is404(victimDetailContent) || checkIgnoreMovie(victimDetailContent))
            {
                logForm.append("   !!! Skip the movie !!!");
                return(null);
            }
            movie mv = getMovie(victimDetailContent);

            string[] checkFields = { mv.name1CheckField, mv.name2CheckField };
            if (!movieExisted(string.Join("-", checkFields)))
            {
                victim vtm = getVictim(victimDetailContent);
                if (vtm == null)
                {
                    return(null);
                }
                vtm.movieDetailHref = itemUrl;
                vtm.isDefault       = 1;
                mv.directors        = getDirectors(victimDetailContent);
                mv.actors           = getActors(victimDetailContent);
                mv.countries        = getCountries(victimDetailContent);
                mv.categories       = getCategories(victimDetailContent);
                mv.keywords         = buildKeyWords(mv);
                mv.victims.Add(vtm);
                return(mv);
            }
            return(null);
        }
Exemplo n.º 2
0
    private void OnAttackStay(GameObject vic)
    {
        bool isNew = true;

        for (int i = 0; i < Victims.Count; i++)
        {
            if (Victims[i].g != vic)
            {
                isNew = true;
            }
            else
            {
                isNew = false;
                break;
            }
        }
        if (isNew)
        {
            Vector2 pushV2 = (Vector2)(transform.position - vic.transform.position).normalized * gravSpeed; //! times some speed
            Victims.Add(new victim(vic, vic.GetComponent <Movement>().AddPushVector(pushV2)));
            Debug.Log("Adding: " + vic + " index: " + Victims[Victims.Count - 1].pushIndex + " at: " + vic.transform.position);
            //Debug.Break();
        }
        else if (Victims.Count > 0)
        {
            victim targetVic = Victims[0];
            foreach (victim v in Victims)
            {
                if (v.g == vic)
                {
                    targetVic = v;
                    break;
                }
            }
            if (targetVic.g != null)
            {
                targetVic.g.GetComponent <Movement>().push[targetVic.pushIndex] = (Vector2)(transform.position - vic.transform.position).normalized * gravSpeed;
            }
            Debug.Log("Same object: " + vic + " index: " + targetVic.pushIndex + " at: " + vic.transform.position);
            //Debug.Break();
        }
    }
Exemplo n.º 3
0
        public override ICollection <episode> getEpisodes(string movieHref, bool excludeGroup)
        {
            victim vtm = new victim();

            vtm.movieHref = movieHref;
            var victimWatchContent = getRootNode(UriUtil.checkAndAddDomain(vtm.movieHref, victimDomain, protocol));
            var groupMap           = new List <string>();

            groupMap.Add("default~" + vtm.movieHref);
            if (!excludeGroup)
            {
                var groups = victimWatchContent.SelectNodes("//ul[@class='choose-server'] //a");
                if (groups != null)
                {
                    groupMap.Clear();
                    foreach (var group in groups)
                    {
                        groupMap.Add(group.InnerText.Trim() + "~" + group.Attributes["href"].Value);
                    }
                }
            }


            foreach (var g in groupMap)
            {
                var ginfo        = g.Split('~');
                var href         = UriUtil.checkAndAddDomain(ginfo[1], victimDomain, protocol);
                var episodeNodes = getRootNode(href).SelectNodes(".//div[@class='list-episode'] //a");
                if (episodeNodes != null)
                {
                    foreach (var episodeNode in episodeNodes)
                    {
                        vtm.episodes.Add(newEpisodeInstance(episodeNode.InnerText.Trim(), vtm.victimId, ginfo[0], episodeNode.Attributes["href"].Value));
                    }
                }
                else
                {
                    vtm.episodes.Add(newEpisodeInstance("1", vtm.victimId, g.Split('~')[0], vtm.movieHref));
                }
            }
            return(vtm.episodes);
        }
Exemplo n.º 4
0
        public override victim getVictim(HtmlNode victimDetailContent)
        {
            try
            {
                if (checkIgnoreMovie(victimDetailContent))
                {
                    return(null);
                }
                var dd = victimDetailContent.SelectNodes("//ul[@class='meta-data'] //li");
                var currentMovieInfo = dd[0].SelectSingleNode("./strong").InnerText.Trim().ToLower().Replace("bản đẹp", "HD").ToLower();
                var smallImage       = victimDetailContent.SelectSingleNode("//div[@class='poster'] //img").Attributes["src"].Value;
                if (smallImage.IndexOf(victimDomainNoExt) != -1)
                {
                    smallImage = UriUtil.getUrlNoDomain(smallImage);
                }
                var movieHref         = UriUtil.checkAndAddDomain(victimDetailContent.SelectSingleNode(".//a[@class='btn-see btn btn-danger']").Attributes["href"].Value, victimDomain, protocol);
                var totalEpisode      = 1;
                var isContinue        = 0;
                var duration          = dd[dd.Count - 6].SelectSingleNode("./span").InnerText.Trim();
                int isMultipleEpisode = (duration.IndexOf("tập") != -1 || duration.IndexOf("/") != -1) ? 1 : 0;
                int currentEpisode    = 0;
                int viewed            = 999;
                try { viewed = Int32.Parse(dd[dd.Count - 5].SelectSingleNode("./span").InnerText.Trim().Replace(".", "").Trim()); } catch (Exception ex) { Console.Write(ex.Message); }
                var rating = 9D;
                try { rating = NumberUtil.GetDouble(victimDetailContent.SelectSingleNode("//span[@itempop='ratingValue']").InnerText.Trim()); } catch (Exception ex) { Console.Write(ex.Message); }
                var schedule = victimDetailContent.SelectSingleNode("//div[@class='broadcast']");
                var priority = Int32.Parse(smallImage.Split('/')[3]);

                if (isMultipleEpisode == 1)
                {
                    var infoArray = currentMovieInfo.Split(' ');
                    isContinue   = 1;
                    totalEpisode = 0;
                    foreach (var info in infoArray)
                    {
                        if (info.IndexOf("/") != -1)
                        {
                            var episodeInfo = info.Split('/');
                            try { currentEpisode = Int32.Parse(episodeInfo[0].Trim()); } catch (Exception ex) { Console.Write(ex.Message); }
                            try { totalEpisode = Int32.Parse(episodeInfo[1].Trim()); } catch (Exception ex) { Console.Write(ex.Message); }
                            if (currentEpisode == totalEpisode)
                            {
                                isContinue = 0;
                            }
                            break;
                        }
                        else if (IsNumber(info))
                        {
                            currentEpisode = Int32.Parse(info);
                            break;
                        }
                    }
                }
                var description = victimDetailContent.SelectSingleNode("//div[@class='film-content']");
                description.InnerHtml = removeTextNodes(description, "h3");
                enhanceDescription(description);
                var playListHtml = getPlayListHtml(movieHref);
                if (playListHtml == null)
                {
                    return(null);
                }
                victim vtm = new victim()
                {
                    name           = victimDomain,
                    movieHref      = movieHref,
                    thumb          = CryptoUtil.encrypt(smallImage),
                    poster         = CryptoUtil.encrypt(smallImage.Replace("/240/", "/600/")),
                    smallImage     = CryptoUtil.encrypt(smallImage.Replace("/240/", "/150/")),
                    description    = description.InnerHtml,
                    currentEpisode = currentEpisode,
                    totalEpisode   = totalEpisode,
                    duration       = duration.Replace(" / tập", "").Trim(),
                    quality        = getQuality(currentMovieInfo),
                    hasSub         = (currentMovieInfo.IndexOf("vietsub") != -1) ? 1 : 0,
                    hasDubbing     = (currentMovieInfo.IndexOf("lồng tiếng") != -1) ? 1 : 0,
                    hasTrans       = (currentMovieInfo.IndexOf("thuyết minh") != -1) ? 1 : 0,
                    isContinue     = isContinue,
                    dateUpdate     = DateTime.Now,
                    updateState    = 1,
                    viewed         = viewed,
                    rating         = rating,
                    schedule       = (schedule != null) ? replaceDomain(schedule.InnerHtml) : "",
                    victimTypeNo   = victimTypeNo,
                    priority       = priority,
                    isTrailer      = isTrailer(victimDetailContent) ? 1 : 0,
                    playListHtml   = playListHtml[0],
                    playListHtmlBk = playListHtml[1]
                };
                return(vtm);
            }
            catch (Exception ex)
            {
                Console.Write(ex.InnerException);
                return(null);
            }
        }
Exemplo n.º 5
0
    public BTCoroutine SeekTarget()
    {
        SeekTarget();

        while (true)
        {
            if (target.isTagged(this.gameObject)){
                target = null;
                yield return BTNodeResult.Failure;
                yield break;
            }
            if (target == null){
                target = null;
                yield return BTNodeResult.Success;
                yield break;
            }

            yield return BTNodeResult.NotFinished;
        }
    }
Exemplo n.º 6
0
    private bool IsBestOption(victim option)
    {
        victim optimized = null;
        optimized = bestOption();

        if(option.Equals(optimized)){
            return true;
        }
        return false;
    }
Exemplo n.º 7
0
        public override victim getVictim(HtmlNode victimDetailContent)
        {
            if (checkIgnoreMovie(victimDetailContent))
            {
                return(null);
            }
            var dd = getDDItems();
            var currentMovieInfo = dd[0].InnerText.Trim().ToLower().Replace("bản đẹp", "HD").ToLower();
            var smallImage       = victimDetailContent.SelectSingleNode("//div[@class='movie-l-img'] //img").Attributes["src"].Value;

            if (smallImage.IndexOf(victimDomainNoExt) != -1)
            {
                smallImage = UriUtil.getUrlNoDomain(smallImage);
            }
            var movieHref         = UriUtil.checkAndAddDomain(victimDetailContent.SelectSingleNode("//a[@id='btn-film-watch']").Attributes["href"].Value, victimDomain, protocol);
            var totalEpisode      = 1;
            var isContinue        = 0;
            int isMultipleEpisode = (currentMovieInfo.IndexOf("tập") != -1 || currentMovieInfo.IndexOf("/") != -1) ? 1 : 0;
            int currentEpisode    = 0;
            int viewed            = Int32.Parse(dd[dd.Count() - 1].InnerText.Trim().Replace(",", "").Trim());
            var rating            = NumberUtil.GetDouble(victimDetailContent.SelectSingleNode("//div[@id='star']").Attributes["data-score"].Value);
            var schedule          = victimDetailContent.SelectSingleNode("//div[@class='show-time']");
            var priority          = Int32.Parse(smallImage.Split('/')[2]);

            if (isMultipleEpisode == 1)
            {
                var infoArray = currentMovieInfo.Replace("(", "").Replace(")", "").Split(' ');
                isContinue   = 1;
                totalEpisode = 0;
                foreach (var info in infoArray)
                {
                    if (info.IndexOf("/") != -1)
                    {
                        var episodeInfo = info.Split('/');
                        try { currentEpisode = Int32.Parse(episodeInfo[0].Trim()); } catch (Exception ex) { Console.Write(ex.Message); }
                        try { totalEpisode = Int32.Parse(episodeInfo[1].Trim()); } catch (Exception ex) { Console.Write(ex.Message); }
                        if (currentEpisode == totalEpisode)
                        {
                            isContinue = 0;
                        }
                        break;
                    }
                    else if (IsNumber(info))
                    {
                        currentEpisode = Int32.Parse(info);
                        break;
                    }
                }
            }
            var description = victimDetailContent.SelectSingleNode("//div[@id='film-content']");

            description.InnerHtml = removeTextNodes(description, "h3");
            enhanceDescription(description);
            var caption      = dd[6].InnerText.Trim().ToLower();
            var playListHtml = getPlayListHtml(movieHref);

            if (playListHtml == null)
            {
                return(null);
            }
            victim vtm = new victim()
            {
                name           = victimDomain,
                movieHref      = movieHref,
                thumb          = CryptoUtil.encrypt(smallImage),
                poster         = CryptoUtil.encrypt(smallImage.Replace("/medium/", "/large/")),
                smallImage     = CryptoUtil.encrypt(smallImage.Replace("/medium/", "/small/")),
                description    = description.InnerHtml,
                currentEpisode = currentEpisode,
                totalEpisode   = totalEpisode,
                duration       = dd[4].InnerText.Trim().Replace(" / tập", "").Trim(),
                quality        = dd[5].InnerText.Trim(),
                hasSub         = (caption.IndexOf("phụ đề") != -1) ? 1 : 0,
                hasDubbing     = (caption.IndexOf("lồng tiếng") != -1) ? 1 : 0,
                hasTrans       = (caption.IndexOf("thuyết minh") != -1) ? 1 : 0,
                isContinue     = isContinue,
                dateUpdate     = DateTime.Now,
                updateState    = 1,
                viewed         = viewed,
                rating         = rating,
                schedule       = (schedule != null) ? replaceDomain(schedule.InnerHtml) : "",
                victimTypeNo   = victimTypeNo,
                priority       = priority,
                isTrailer      = isTrailer(victimDetailContent) ? 1 : 0,
                playListHtml   = playListHtml[0],
                playListHtmlBk = playListHtml[1]
            };

            return(vtm);
        }
Exemplo n.º 8
0
 abstract public ICollection <episode> getAndAddEpisodesToVictim(victim vtm);