public static void bringIntoWorld( VisibleObject visibleObject, int worldId, int instanceIndex, float x, float y, float z, byte h) { World world = World.getInstance(); world.storeObject(visibleObject); world.setPosition(visibleObject, worldId, instanceIndex, x, y, z, h); world.spawn(visibleObject); }
@Override public void execute(Player admin, String... params) { if (params.length != 1) { PacketSendUtility.sendMessage(admin, "Syntax: //addcube <player name>"); return; } Player receiver = null; receiver = World.getInstance().findPlayer(Util.convertName(params[0])); if (receiver == null) { PacketSendUtility.sendMessage( admin, "The player " + Util.convertName(params[0]) + " is not online."); return; } if (receiver != null) { if (receiver.getNpcExpands() < CustomConfig.BASIC_CUBE_SIZE_LIMIT) { CubeExpandService.expand(receiver, true); PacketSendUtility.sendMessage( admin, "9 cube slots successfully added to player " + receiver.getName() + "!"); PacketSendUtility.sendMessage( receiver, "Admin " + admin.getName() + " gave you a cube expansion!"); } else { PacketSendUtility.sendMessage( admin, "Cube expansion cannot be added to " + receiver.getName() + "!\nReason: player cube already fully expanded."); return; } } }
public Road(RoadTemplate template) { super( IDFactory.getInstance().nextId(), new RoadController(), null, null, World.getInstance() .createPosition( template.getMap(), template.getCenter().getX(), template.getCenter().getY(), template.getCenter().getZ(), (byte) 0, 0)); ((RoadController) getController()).setOwner(this); this.template = template; this.name = template.getName() == null ? "ROAD" : template.getName(); this.center = new Point3D( template.getCenter().getX(), template.getCenter().getY(), template.getCenter().getZ()); this.p1 = new Point3D(template.getP1().getX(), template.getP1().getY(), template.getP1().getZ()); this.p2 = new Point3D(template.getP2().getX(), template.getP2().getY(), template.getP2().getZ()); this.plane = new Plane3D(center, p1, p2); setKnownlist(new SphereKnownList(this, template.getRadius() * 2)); }
public static void startEvent() { initCoordinates(); World.getInstance() .doOnAllPlayers( new Visitor<Player>() { @Override public void visit(Player object) { PacketSendUtility.sendYellowMessageOnCenter( object, MuiService.getInstance().getMessage("PIG_EVENT_START")); } }); initPig(); ThreadPoolManager.getInstance() .schedule( new Runnable() { @Override public void run() { endEvent(); // To change body of generated methods, choose Tools | Templates. } }, 30 * 60 * 1000); }
private void analyzeWorldPlayers() { log.info("Starting analysis of world players at " + System.currentTimeMillis()); Iterator<Player> playersIterator = World.getInstance().getPlayersIterator(); while (playersIterator.hasNext()) { Player player = playersIterator.next(); /** Check connection */ AionConnection connection = player.getClientConnection(); if (connection == null) { log.warn( String.format( "[DEBUG SERVICE] Player without connection: " + "detected: ObjId %d, Name %s, Spawned %s", player.getObjectId(), player.getName(), player.isSpawned())); continue; } /** Check CM_PING packet */ long lastPingTimeMS = connection.getLastPingTimeMS(); long pingInterval = System.currentTimeMillis() - lastPingTimeMS; if (lastPingTimeMS > 0 && pingInterval > 300000) { log.warn( String.format( "[DEBUG SERVICE] Player with large ping interval: " + "ObjId %d, Name %s, Spawned %s, PingMS %d", player.getObjectId(), player.getName(), player.isSpawned(), pingInterval)); } } }
public static void endEvent() { World.getInstance() .doOnAllPlayers( new Visitor<Player>() { @Override public void visit(Player object) { PacketSendUtility.sendYellowMessageOnCenter( object, MuiService.getInstance().getMessage("PIG_EVENT_STOP")); } }); mainN.getController().onDelete(); }
/* (non-Javadoc) * @see org.typezero.gameserver.utils.chathandlers.ChatCommand#execute(org.typezero.gameserver.model.gameobjects.player.Player, java.lang.String[]) */ @Override public void execute(Player player, String... params) { if (params.length < 1) { PacketSendUtility.sendMessage( player, "Syntax: //token <playername> || //token show <playername>"); return; } Player receiver = null; if (params[0].equals("show")) { receiver = World.getInstance().findPlayer(Util.convertName(params[1])); if (receiver == null) { PacketSendUtility.sendMessage(player, "Can't find this player, maybe he's not online"); return; } if (!"".equals(receiver.getPlayerAccount().getSecurityToken())) { PacketSendUtility.sendMessage( player, "The Security Token of this player is: " + receiver.getPlayerAccount().getSecurityToken()); } else { PacketSendUtility.sendMessage(player, "This player haven't an Security Token!"); } } else { receiver = World.getInstance().findPlayer(Util.convertName(params[0])); if (receiver == null) { PacketSendUtility.sendMessage(player, "Can't find this player, maybe he's not online"); return; } PlayerSecurityTokenService.getInstance().generateToken(receiver); } }
public void spawn() { World w = World.getInstance(); w.storeObject(this); w.spawn(this); }
@Override protected void runImpl() { Player activePlayer = getConnection().getActivePlayer(); if (activePlayer.getHouseRegistry() != null) sendPacket(new SM_HOUSE_OBJECTS(activePlayer)); if (activePlayer.isInInstance()) { sendPacket( new SM_INSTANCE_COUNT_INFO(activePlayer.getWorldId(), activePlayer.getInstanceId())); } if (activePlayer.getItemEffectId() <= 1) activePlayer.updataItemEffectId(); sendPacket(new SM_PLAYER_INFO(activePlayer, false)); activePlayer.getController().startProtectionActiveTask(); sendPacket( new SM_MOTION(activePlayer.getObjectId(), activePlayer.getMotions().getActiveMotions())); WindstreamTemplate template = DataManager.WINDSTREAM_DATA.getStreamTemplate(activePlayer.getPosition().getMapId()); Location2D location; if (template != null) for (int i = 0; i < template.getLocations().getLocation().size(); i++) { location = template.getLocations().getLocation().get(i); sendPacket( new SM_WINDSTREAM_ANNOUNCE( location.getFlyPathType().getId(), template.getMapid(), location.getId(), location.getState())); } location = null; template = null; /** Spawn player into the world. */ // If already spawned, despawn before spawning into the world if (activePlayer.isSpawned()) World.getInstance().despawn(activePlayer); World.getInstance().spawn(activePlayer); activePlayer.getController().refreshZoneImpl(); // because fortress buff should only be avaible in fortress 5011-6011-6021 SiegeService.getInstance().fortressBuffRemove(activePlayer); // SM_SHIELD_EFFECT, SM_ABYSS_ARTIFACT_INFO3 if (activePlayer.isInSiegeWorld()) { SiegeService.getInstance().onEnterSiegeWorld(activePlayer); } // SM_NPC_INFO BaseService.getInstance().onEnterBaseWorld(activePlayer); // SM_SERIAL_KILLER SerialKillerService.getInstance().onEnterMap(activePlayer); // SM_RIFT_ANNOUNCE // RiftInformer.sendRiftsInfo(activePlayer); InstanceRiftSpawnManager.sendInstanceRiftStatus(activePlayer); // SM_UPGRADE_ARCADE // sendPacket(new SM_UPGRADE_ARCADE(true)); // SM_NEARBY_QUESTS activePlayer.getController().updateNearbyQuests(); /** Loading weather for the player's region */ WeatherService.getInstance().loadWeather(activePlayer); QuestEngine.getInstance().onEnterWorld(new QuestEnv(null, activePlayer, 0, 0)); activePlayer.getController().onEnterWorld(); // zone channel message (is this must be here?) if (!WorldMapType.getWorld(activePlayer.getWorldId()).isPersonal()) sendPacket(new SM_SYSTEM_MESSAGE(1390122, activePlayer.getPosition().getInstanceId())); activePlayer.getEffectController().updatePlayerEffectIcons(); sendPacket(SM_CUBE_UPDATE.cubeSize(StorageType.CUBE, activePlayer)); Pet pet = activePlayer.getPet(); if (pet != null && !pet.isSpawned()) World.getInstance().spawn(pet); activePlayer.setPortAnimation(0); TownService.getInstance().onEnterWorld(activePlayer); }
public static void printWorldSpawnStats() { StatsCollector visitor = new StatsCollector(); World.getInstance().doOnAllObjects(visitor); log.info("Loaded " + visitor.getNpcCount() + " npc spawns"); log.info("Loaded " + visitor.getGatherableCount() + " gatherable spawns"); }
public static void bringIntoWorld(VisibleObject visibleObject) { if (visibleObject.getPosition() == null) throw new IllegalArgumentException("Position is null"); World world = World.getInstance(); world.storeObject(visibleObject); world.spawn(visibleObject); }