public CAffectedArea(int nSkillID, int dwOwnerId, TagPoint position, Point lt, Point rb, AffectedAreaType nAreaType)
 {
     this.nSkillID  = nSkillID;
     this.dwOwnerId = dwOwnerId;
     rcArea         = new TagRect(lt.X, lt.Y, rb.X, rb.Y);
     rcArea.OffsetRect(position, true);
     nType = nAreaType;
 }
 /// <summary>
 /// Creates an affected area using the coordinates of the
 ///     lt/rb points, offset by the position
 /// </summary>
 public CAffectedArea(int nSkillID, int dwOwnerId, TagPoint position, Point lt, Point rb, bool bLeft)
 {
     this.nSkillID  = nSkillID;
     this.dwOwnerId = dwOwnerId;
     rcArea         = new TagRect(lt.X, lt.Y, rb.X, rb.Y);
     rcArea.OffsetRect(position, bLeft);
     nType = AffectedAreaConstants.GetAreaType(nSkillID);
 }
Exemple #3
0
        public CField_Zakum(WvsGame parentInstance, int nMapId, int nInstanceId)
            : base(parentInstance, nMapId, nInstanceId)
        {
            SpawnPoint = new TagPoint(-11, -215);

            DropRect = new TagRect(-185, -240, 185, -200);

            IsChaosZakum = MapId == CHAOSZAKUM_MAP_ID;
            _exitmap     = IsChaosZakum ? 211042301 : 211042300;         // door to (chaos) zakum
        }
        public List <Foothold> GetFootholdRandom(int nCount, TagRect rcRange)
        {
            var ret = new List <Foothold>();
            // IntersectRect(&rcArea, rcRange, &v4->m_rcMBR); ???

            var nStart = rcRange.Left;
            var nGrid  = (rcRange.Right - rcRange.Left + 1) / (2 * nCount);

            // uhh this is too complicated

            return(ret);
        }
Exemple #5
0
        public List <CFieldObj> FindObjectsInRect(TagRect rect)
        {
            var retVal = new List <CFieldObj>();

            foreach (var item in this)
            {
                var position = item.Position.Clone();
                var x        = position.X;
                var y        = position.Y;

                if (x >= rect.Left && y >= rect.Top &&
                    x <= rect.Right && y <= rect.Bottom)
                {
                    retVal.Add(item);
                }
            }
            return(retVal);
        }
Exemple #6
0
 public static extern bool GetWindowRect([System.Runtime.InteropServices.InAttribute()] System.IntPtr hWnd,
                                         [System.Runtime.InteropServices.OutAttribute()] out TagRect lpRect);
Exemple #7
0
 public static extern bool GetWindowRect([In] IntPtr hWnd, out TagRect lpRect);
Exemple #8
0
 public static extern bool PlayM4_SetDisplayRegion(int nPort, uint nRegionNum, ref TagRect pSrcRect, IntPtr hDestWnd, [MarshalAs(UnmanagedType.Bool)] bool bEnable);
Exemple #9
0
        //--------------------------------------------------

        /// <summary>
        /// This iterates the mobgen and spawns the mobs that can be spawned.
        /// </summary>
        /// <remarks>
        /// Previously referred to as RedistributeLife()
        /// </remarks>
        /// <param name="bReset">This will force the map to reset its spawns regardless of current spawn cooldowns.</param>
        public void TryCreateMob(bool bReset)
        {
            if (Field.bPauseSpawn)
            {
                return;
            }

            if (bReset)
            {
                SetMobGen(true, 0);
            }

            if (aMobGen.Count <= 0 || nMobGenCount == 0)
            {
                return;
            }

            var tTime = DateTime.Now;

            if (!bReset && m_tLastCreateMobTime.MillisSinceStart() < 7000)
            {
                return;
            }

            m_tLastCreateMobTime = DateTime.Now;

            var nMobCapacity = aMobGen.Count * 0.75;

            var nMobCount = nMobCapacity - Count;

            if (nMobCount <= 0)
            {
                return;
            }

            var aMobGen_ = new List <MOBGEN>();
            var aPts     = new List <TagPoint>();
            var nCount   = 0;

            if (bMobGenEnable)
            {
                aPts.AddRange(this.Select(pMob => pMob.Position.CurrentXY));

                var bCheckArea = false;
                foreach (var pMG in aMobGen)
                {
                    if (!aMobGenExcept.Contains(pMG.dwTemplateID))
                    {
                        if (pMG.tRegenInterval == 0)
                        {
                            bCheckArea = true;
                        }
                        else if (pMG.tRegenInterval > 0)
                        {
                            if (bReset)
                            {
                                var tInterval = pMG.tRegenInterval >> 6;

                                // from 22-130 minutes on BF to 100-603 seconds

                                tInterval += Constants.Rand.Next() % (6 * (tInterval >> 2));

                                pMG.tRegenAfter = DateTime.Now.AddMilliseconds(tInterval);
                            }

                            if (pMG.nMobCount == 0 && (tTime - pMG.tRegenAfter).TotalMilliseconds >= 0)
                            {
                                aMobGen_.Add(pMG);
                                aPts.Add(new TagPoint((short)pMG.X, (short)pMG.Y));
                            }
                        }
                    }

                    if (bCheckArea)
                    {
                        var rcArea = new TagRect(pMG.X - 100, pMG.Y - 100, pMG.X + 100, pMG.Y + 100);
                        var bAdd   = true;
                        var nIdx   = 0;

                        while (nIdx < aPts.Count)
                        {
                            var _pt = aPts[nIdx];

                            if (rcArea.PointInRect(_pt))
                            {
                                bAdd = false;
                                break;
                            }

                            nIdx += 1;
                        }

                        if (bAdd)
                        {
                            aMobGen_.Add(pMG);
                            aPts.Add(new TagPoint((short)pMG.X, (short)pMG.Y));
                        }

                        bCheckArea = false;
                    }

                    nCount += 1;

                    if (nCount >= nMobGenCount)
                    {
                        break;
                    }
                }
            }

            if (aMobGen_.Count > 0)
            {
                while (true)
                {
                    if (aMobGen_.Count <= 0)
                    {
                        break;
                    }

                    var nIdx = Math.Abs(Constants.Rand.Next() % aMobGen_.Count);
                    var pMG  = aMobGen_.ElementAtOrDefault(nIdx);

                    aMobGen_.RemoveAt(nIdx);

                    if (CreateMob(pMG.dwTemplateID, pMG, pMG.X, pMG.Y, pMG.FH, (byte)MobAppearType.MOBAPPEAR_REGEN, 0, pMG.F ? 1 : 0, 0, null))
                    {
                        nMobCount -= 1;
                    }

                    if (nMobCount <= 0)
                    {
                        break;
                    }
                }
            }

            aMobGen_.Clear();
        }