Beispiel #1
0
        public override void OnEnterZone(Player player, Section section)
        {
            if(section == null)
            {
                Log.Warn("QStepMovePc: Warning, current player section is NULL!");
                return;
            }

            if (Task.TargetArea == null
                || Task.TargetArea.Length < 2
                || !TaskAreaIdSectionNameIdMap.ContainsKey(Task.TargetArea[1]))
                return;

            if (TaskAreaIdSectionNameIdMap[Task.TargetArea[1]] == section.NameId)
                Processor.FinishStep(player);
        }
Beispiel #2
0
 public virtual void OnEnterZone(Player player, Section section)
 {
 }
Beispiel #3
0
 public void OnPlayerEnterZone(Player player, Section section)
 {
     foreach (var data in player.Quests)
         if (data.Value.Status == QuestStatus.Start)
             Quests[data.Key].GetNowStep(player).OnEnterZone(player, section);
 }
Beispiel #4
0
        private void SortSections(Section section)
        {
            if (section.Sections == null)
                section.Sections = new List<Section>();

            section.Sections.Sort((s1, s2) =>
                {
                    if (s1.Priority == s2.Priority)
                        return 0;

                    return s1.Priority > s2.Priority
                               ? -1
                               : 1;
                });

            foreach (var section2 in section.Sections)
                SortSections(section2);
        }
        protected static void LoadAreas()
        {
            Areas = new Dictionary<int, List<Area>>();
            foreach (var area in DC.GetMainObjectsByName("Area"))
            {
                var data = DC.GetValues(area);
                Area a = new Area();
                a.ContinentId = int.Parse(data["continentId"].ToString());
                a.NameId = int.Parse(data["nameId"].ToString());
                a.AreaName = data["areaName"].ToString();
                a.WorldMapGuardId = int.Parse(data["worldMapGuardId"].ToString());
                a.WorldMapWorldId = int.Parse(data["worldMapWorldId"].ToString());

                a.Sections = new List<Section>();

                foreach (var sct in (List<Dictionary<string, object>>)DC.GetValues(area)["Section"])
                {
                    Section s = new Section();
                    s.Priority = int.Parse(sct["priority"].ToString());
                    s.HuntingZoneId = int.Parse(sct["huntingZoneId"].ToString());
                    s.AddMaxZ = float.Parse(sct["addMaxZ"].ToString());
                    s.CampId = int.Parse(sct["campId"].ToString());
                    s.Destext = bool.Parse(sct["desTex"].ToString());
                    s.Floor = int.Parse(sct["floor"].ToString());
                    s.NameId = int.Parse(sct["nameId"].ToString());
                    s.PcMoveCylinder = bool.Parse(sct["pcMoveCylinder"].ToString());
                    s.PcSafe = sct["pk"].ToString() == "safe";

                    if (sct.ContainsKey("restBonus"))
                        s.RestBonus = bool.Parse(sct["restBonus"].ToString());

                    s.SubtractMinZ = float.Parse(sct["subtractMinZ"].ToString());
                    s.Vender = bool.Parse(sct["vender"].ToString());
                    s.WorldMapSectionId = int.Parse(sct["worldMapSectionId"].ToString());

                    if (Names.ContainsKey(s.NameId))
                        s.Name = Names[s.NameId];

                    if (sct.ContainsKey("Fence"))
                        foreach (Dictionary<string, object> fncpoint in (List<Dictionary<string, object>>)sct["Fence"])
                        {
                            if (s.Polygon == null)
                                s.Polygon = new Polygon {PointList = new List<Point3D>()};

                            s.Polygon.PointList.Add(TransformStringArrayToIntArray(fncpoint["pos"].ToString().Split(',')));
                        }

                    if (sct.ContainsKey("Section"))
                    {
                        if (s.Sections== null)
                            s.Sections = new List<Section>();

                        foreach (Dictionary<string, object> dictionary in (List<Dictionary<string, object>>)sct["Section"])
                        {
                            Section sq = new Section();
                            sq.Priority = int.Parse(dictionary["priority"].ToString());
                            sq.HuntingZoneId = int.Parse(dictionary["huntingZoneId"].ToString());
                            sq.AddMaxZ = float.Parse(dictionary["addMaxZ"].ToString());
                            sq.CampId = int.Parse(dictionary["campId"].ToString());
                            sq.Destext = bool.Parse(dictionary["desTex"].ToString());
                            sq.Floor = int.Parse(dictionary["floor"].ToString());
                            sq.NameId = int.Parse(dictionary["nameId"].ToString());
                            sq.PcMoveCylinder = bool.Parse(dictionary["pcMoveCylinder"].ToString());
                            sq.PcSafe = dictionary["pk"].ToString() == "safe";

                            if (dictionary.ContainsKey("restBonus"))
                                sq.RestBonus = bool.Parse(dictionary["restBonus"].ToString());

                            sq.SubtractMinZ = float.Parse(dictionary["subtractMinZ"].ToString());
                            sq.Vender = bool.Parse(dictionary["vender"].ToString());
                            sq.WorldMapSectionId = int.Parse(dictionary["worldMapSectionId"].ToString());

                            if (Names.ContainsKey(sq.NameId))
                                sq.Name = Names[sq.NameId];

                            if (dictionary.ContainsKey("Fence"))
                                foreach (Dictionary<string, object> fncpoint in (List<Dictionary<string, object>>)dictionary["Fence"])
                                {
                                    if (sq.Polygon == null)
                                        sq.Polygon = new Polygon {PointList = new List<Point3D>()};

                                    sq.Polygon.PointList.Add(TransformStringArrayToIntArray(fncpoint["pos"].ToString().Split(',')));
                                }

                            s.Sections.Add(sq);
                        }
                    }

                    a.Sections.Add(s);
                }

                if(!Areas.ContainsKey(a.ContinentId))
                    Areas.Add(a.ContinentId, new List<Area>());

                Areas[a.ContinentId].Add(a);
            }
        }