Package net.sf.l2j.gameserver.model.actor.instance

Examples of net.sf.l2j.gameserver.model.actor.instance.L2ControlTowerInstance


        // Register guard to the closest Control Tower
        // When CT dies, so do all the guards that it controls
        if (getSiegeGuardManager().getSiegeGuardSpawn().size() > 0 && _controlTowers.size() > 0)
        {
            L2ControlTowerInstance closestCt;
            double distance, x, y, z;
            double distanceClosest = 0;
            for (L2Spawn spawn : getSiegeGuardManager().getSiegeGuardSpawn())
            {
                if (spawn == null) continue;
                closestCt = null;
                distanceClosest = 0;
                for (L2ControlTowerInstance ct : _controlTowers)
                {
                    if (ct == null) continue;
                    x = (spawn.getLocx() - ct.getX());
                    y = (spawn.getLocy() - ct.getY());
                    z = (spawn.getLocz() - ct.getZ());

                    distance = (x * x) + (y * y) + (z * z);

                    if (closestCt == null || distance < distanceClosest)
                    {
                        closestCt = ct;
                        distanceClosest = distance;
                    }
                }

                if (closestCt != null) closestCt.registerGuard(spawn);
            }
        }
    }
View Full Code Here


        if (_controlTowers == null)
          _controlTowers = new FastList<L2ControlTowerInstance>();

        for (SiegeSpawn _sp: SiegeManager.getInstance().getControlTowerSpawnList(Id))
        {
          L2ControlTowerInstance ct;

          L2NpcTemplate template = NpcTable.getInstance().getTemplate(_sp.getNpcId());

            template.getStatsSet().set("baseHpMax", _sp.getHp());
            // TODO: Check/confirm if control towers have any special weapon resistances/vulnerabilities
            // template.addVulnerability(Stats.BOW_WPN_VULN,0);
            // template.addVulnerability(Stats.BLUNT_WPN_VULN,0);
            // template.addVulnerability(Stats.DAGGER_WPN_VULN,0);

            ct = new L2ControlTowerInstance(IdFactory.getInstance().getNextId(), template);


            ct.setCurrentHpMp(ct.getMaxHp(), ct.getMaxMp());
            ct.spawnMe(_sp.getLocation().getX(),_sp.getLocation().getY(),_sp.getLocation().getZ() + 20);

            _controlTowers.add(ct);
        }
    }
View Full Code Here

TOP

Related Classes of net.sf.l2j.gameserver.model.actor.instance.L2ControlTowerInstance

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.