Esempio n. 1
0
        public void Initialize()
        {
            _worldRegions = new L2WorldRegion[REGIONS_X + 1][];

            for (int i = 0; i <= REGIONS_X; i++)
            {
                _worldRegions[i] = new L2WorldRegion[REGIONS_Y + 1];
                for (int j = 0; j <= REGIONS_Y; j++)
                {
                    _worldRegions[i][j] = new L2WorldRegion(i, j);
                }
            }

            for (int x = 0; x <= REGIONS_X; x++)
            {
                for (int y = 0; y <= REGIONS_Y; y++)
                {
                    for (int a = -1; a <= 1; a++)
                    {
                        for (int b = -1; b <= 1; b++)
                        {
                            if (ValidRegion(x + a, y + b))
                            {
                                _worldRegions[x + a][y + b].addSurroundingRegion(_worldRegions[x][y]);
                            }
                        }
                    }
                }
            }
            CLogger.info("L2World: WorldRegion grid (" + REGIONS_X + " by " + REGIONS_Y + ") is now setted up.");
        }
Esempio n. 2
0
        public void BroadcastToRegion(int instanceId, int x, int y, GameServerNetworkPacket pck)
        {
            L2WorldRegion reg = GetRegion(x, y);

            if (reg != null)
            {
                reg.broadcastPacket(instanceId, pck, false);
            }
            else
            {
                CLogger.warning("l2world: broadcastRegionPacket error, object on unk territory " + x + " " + y);
            }
        }
Esempio n. 3
0
        public void CheckToUpdate(L2Object obj, int _x, int _y, int radius, int height, bool delLongest, bool zones)
        {
            L2WorldRegion reg = GetRegion(_x, _y);

            if (reg != null)
            {
                reg.showObjects(obj, true, radius, height, delLongest, zones);
            }
            else
            {
                CLogger.warning("l2world: unrealiseEntry error, object on unk territory " + obj.X + " " + obj.Y + " " + obj.Z);
            }
        }
Esempio n. 4
0
        public void GetKnowns(L2Object obj, int range, int height, bool zones)
        {
            L2WorldRegion reg = GetRegion(obj.X, obj.Y);

            obj.CurrentRegion = reg.getName();
            if (reg != null)
            {
                reg.showObjects(obj, true, range, height, true, zones);
            }
            else
            {
                CLogger.warning("l2world: unrealiseEntry error, object on unk territory " + obj.X + " " + obj.Y + " " + obj.Z);
            }
        }
Esempio n. 5
0
        public void RealiseEntry(L2Object obj, GameServerNetworkPacket pk, bool pkuse)
        {
            if (_allObjects.ContainsKey(obj.ObjID))
            {
                _allObjects.Add(obj.ObjID, obj);

                if (obj is L2Player)
                {
                    _allPlayers.Add(obj.ObjID, (L2Player)obj);
                }

                L2WorldRegion reg = GetRegion(obj.X, obj.Y);
                obj.CurrentRegion = reg.getName();
                if (reg != null)
                {
                    reg.realiseMe(obj, pk, pkuse);
                }
                else
                {
                    CLogger.warning("l2world: realiseEntry error, object on unk territory " + obj.X + " " + obj.Y + " " + obj.Z);
                }
            }
        }
Esempio n. 6
0
        public void UnrealiseEntry(L2Object obj, bool pkuse)
        {
            lock (_allObjects)
            {
                _allObjects.Remove(obj.ObjID);
            }

            if (obj is L2Player)
            {
                lock (_allPlayers)
                    _allPlayers.Remove(obj.ObjID);
            }

            L2WorldRegion reg = GetRegion(obj.X, obj.Y);

            if (reg != null)
            {
                reg.unrealiseMe(obj, pkuse);
            }
            else
            {
                CLogger.warning("l2world: unrealiseEntry error, object on unk territory " + obj.X + " " + obj.Y + " " + obj.Z);
            }
        }
Esempio n. 7
0
 public void addSurroundingRegion(L2WorldRegion reg)
 {
     _surroundingRegions.Add(reg);
 }