javolution.util.FastMap Java Examples
The following examples show how to use
javolution.util.FastMap.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Captor.java From aion-germany with GNU General Public License v3.0 | 7 votes |
private void configureProtocols() throws Exception { Captor.setActiveProtocols(PacketSamurai.loadSnifferActiveProtocols()); if (Captor.getActiveProtocols() == null) { Captor.setActiveProtocols(new FastMap<Integer, Protocol>()); for (Protocol p : ProtocolManager.getInstance().getProtocols()) { if (Captor.getActiveProtocols().containsKey(p.getPort())) { // invalidate the map being built Captor.setActiveProtocols(null); throw new Exception("System [Network] - More then one protocol with same port, only one protocol per port can be active for the sniffer."); } Captor.getActiveProtocols().put(p.getPort(), p); } } }
Example #2
Source File: KnownList.java From aion-germany with GNU General Public License v3.0 | 6 votes |
public int doOnAllNpcs(Visitor<Npc> visitor, int iterationLimit) { int counter = 0; try { for (FastMap.Entry<Integer, VisibleObject> e = knownObjects.head(), mapEnd = knownObjects.tail(); (e = e.getNext()) != mapEnd;) { VisibleObject newObject = e.getValue(); if (newObject instanceof Npc) { if ((++counter) == iterationLimit) { break; } visitor.visit((Npc) newObject); } } } catch (Exception ex) { // log.error("Exception when running visitor on all npcs" + ex); } return counter; }
Example #3
Source File: ItemUpgradeService.java From aion-germany with GNU General Public License v3.0 | 6 votes |
public static boolean decreaseMaterial(Player player, Item baseItem, int resultItemId) { FastMap<Integer, UpgradeResultItem> resultItemMap = DataManager.ITEM_UPGRADE_DATA.getResultItemMap(baseItem.getItemId()); UpgradeResultItem resultItem = resultItemMap.get(resultItemId); if (resultItem.getNeed_kinah() == null) { for (SubMaterialItem item : resultItem.getUpgrade_materials().getSubMaterialItem()) { if (!player.getInventory().decreaseByItemId(item.getId(), item.getCount())) { AuditLogger.info(player, "try item upgrade without sub material"); return false; } } } else { player.getInventory().decreaseKinah(-resultItem.getNeed_kinah().getCount()); } if (resultItem.getNeed_abyss_point() != null) { AbyssPointsService.setAp(player, -resultItem.getNeed_abyss_point().getCount()); } if (resultItem.getNeed_kinah() != null) { player.getInventory().decreaseKinah(-resultItem.getNeed_kinah().getCount()); } player.getInventory().decreaseByObjectId(baseItem.getObjectId(), 1); return true; }
Example #4
Source File: NpcShoutData.java From aion-germany with GNU General Public License v3.0 | 6 votes |
/** * Get global npc shouts plus world specific shouts. Make sure to clean it after the use. * * @return null if not found */ public List<NpcShout> getNpcShouts(int worldId, int npcId) { FastMap<Integer, List<NpcShout>> worldShouts = shoutsByWorldNpcs.get(0); if (worldShouts == null || worldShouts.get(npcId) == null) { worldShouts = shoutsByWorldNpcs.get(worldId); if (worldShouts == null || worldShouts.get(npcId) == null) { return null; } return new ArrayList<NpcShout>(worldShouts.get(npcId)); } List<NpcShout> npcShouts = new ArrayList<NpcShout>(worldShouts.get(npcId)); worldShouts = shoutsByWorldNpcs.get(worldId); if (worldShouts == null || worldShouts.get(npcId) == null) { return npcShouts; } npcShouts.addAll(worldShouts.get(npcId)); return npcShouts; }
Example #5
Source File: KnownList.java From aion-germany with GNU General Public License v3.0 | 6 votes |
public int doOnAllNpcsWithOwner(VisitorWithOwner<Npc, VisibleObject> visitor, int iterationLimit) { int counter = 0; try { for (FastMap.Entry<Integer, VisibleObject> e = knownObjects.head(), mapEnd = knownObjects.tail(); (e = e.getNext()) != mapEnd;) { VisibleObject newObject = e.getValue(); if (newObject instanceof Npc) { if ((++counter) == iterationLimit) { break; } visitor.visit((Npc) newObject, owner); } } } catch (Exception ex) { // log.error("Exception when running visitor on all npcs" + ex); } return counter; }
Example #6
Source File: MySQL5NetworkBannedDAO.java From aion-germany with GNU General Public License v3.0 | 6 votes |
@Override public Map<String, NetworkBanEntry> load() { Map<String, NetworkBanEntry> map = new FastMap<String, NetworkBanEntry>(); PreparedStatement ps = DB.prepareStatement("SELECT `ip`,`time`,`details` FROM `network_ban`"); try { ResultSet rs = ps.executeQuery(); while (rs.next()) { String address = rs.getString("ip"); map.put(address, new NetworkBanEntry(address, rs.getTimestamp("time"), rs.getString("details"))); } } catch (SQLException e) { log.error("Error loading last saved server time", e); } finally { DB.close(ps); } return map; }
Example #7
Source File: TownService.java From aion-germany with GNU General Public License v3.0 | 6 votes |
public void onEnterWorld(Player player) { if (player.getWorldId() != 700010000 && player.getWorldId() != 710010000) { // offi 4.9.1 send empty packet PacketSendUtility.sendPacket(player, new SM_TOWNS_LIST(new FastMap<Integer, Town>())); return; } switch (player.getRace()) { case ELYOS: if (player.getWorldId() == 700010000) { PacketSendUtility.sendPacket(player, new SM_TOWNS_LIST(elyosTowns)); } break; case ASMODIANS: if (player.getWorldId() == 710010000) { PacketSendUtility.sendPacket(player, new SM_TOWNS_LIST(asmosTowns)); } break; default: break; } }
Example #8
Source File: MonsterHunt.java From aion-germany with GNU General Public License v3.0 | 6 votes |
public MonsterHunt(int questId, List<Integer> startNpcIds, List<Integer> endNpcIds, FastMap<Monster, Set<Integer>> monsters, int startDialog, int endDialog, List<Integer> aggroNpcs, int invasionWorld) { super(questId); this.questId = questId; this.startNpcs.addAll(startNpcIds); this.startNpcs.remove(0); if (endNpcIds == null) { this.endNpcs.addAll(startNpcs); } else { this.endNpcs.addAll(endNpcIds); this.endNpcs.remove(0); } this.monsters = monsters; this.startDialog = startDialog; this.endDialog = endDialog; if (aggroNpcs != null) { this.aggroNpcs.addAll(aggroNpcs); this.aggroNpcs.remove(0); } this.invasionWorldId = invasionWorld; }
Example #9
Source File: SpawnsTool.java From aion-germany with GNU General Public License v3.0 | 6 votes |
public static void load() { maps = new WorldMaps(); mapNameById = new FastMap<Integer, String>(); npc = new FastList<SpawnTemplates>(); base = new FastList<SpawnTemplates>(); siege = new FastList<SpawnTemplates>(); conquest = new FastList<SpawnTemplates>(); gather = new FastList<SpawnTemplates>(); ids_conquest = new FastList<Integer>(); ids_base = new FastList<Integer>(); ids_siege = new FastList<Integer>(); ids_npc = new FastList<Integer>(); ids_gather = new FastList<Integer>(); gatherSpawnsByWorldId = new FastMap<Integer, FastMap<Integer, SpawnTemplate>>(); conquestSpawnsByWorldId = new FastMap<Integer, FastMap<Integer, SpawnTemplate>>(); load("WorldMap"); load("Npcs"); load("Gather"); load("Sieges"); load("Bases"); load("Conquest"); }
Example #10
Source File: World.java From aion-germany with GNU General Public License v3.0 | 5 votes |
/** * Constructor. */ private World() { allPlayers = new PlayerContainer(); allObjects = new FastMap<Integer, VisibleObject>().shared(); baseNpc = new FastMap<Integer, FastList<Npc>>().shared(); allNpcs = new FastMap<Integer, Npc>().shared(); worldMaps = new TIntObjectHashMap<>(); for (WorldMapTemplate template : DataManager.WORLD_MAPS_DATA) { worldMaps.put(template.getMapId(), new WorldMap(template, this)); } log.info("World: " + worldMaps.size() + " worlds map created."); }
Example #11
Source File: SiegeService.java From aion-germany with GNU General Public License v3.0 | 5 votes |
public Map<Integer, SiegeLocation> getSiegeLocations(int worldId) { Map<Integer, SiegeLocation> mapLocations = new FastMap<Integer, SiegeLocation>(); for (SiegeLocation location : getSiegeLocations().values()) { if (location.getWorldId() == worldId) { mapLocations.put(location.getLocationId(), location); } } return mapLocations; }
Example #12
Source File: Captor.java From aion-germany with GNU General Public License v3.0 | 5 votes |
public static void showSetActiveProtocols() { int total = ProtocolManager.getInstance().getProtocolsByPort().size(); String[] titles = new String[total]; String[][] choices = new String[total][]; Protocol[][] protocols = new Protocol[total][]; int i = 0; for (int port : ProtocolManager.getInstance().getProtocolsByPort().keySet()) { Set<Protocol> prots = ProtocolManager.getInstance().getProtocolForPort(port); titles[i] = "Port "+port; int count = prots.size(); int j = 0; choices[i] = new String[count]; protocols[i] = new Protocol[count]; for (Protocol prot : prots) { protocols[i][j] = prot; choices[i][j++] = prot.getName(); } i++; } PacketSamurai.getUserInterface().log("System [Network] - Please select the active protocols for Sniffing, non active protocols are used for opening old logs."); int[] ret = ChoiceDialog.choiceDialog("Select Active Protocols for Sniffing", titles, choices); // u are doomed to properly set it if (ret != null) { Map<Integer,Protocol> activeProtocols = new FastMap<Integer, Protocol>(); i = 0; for (int sel : ret) { Protocol p = protocols[i++][sel]; activeProtocols.put(p.getPort(), p); } Captor.setActiveProtocols(activeProtocols); PacketSamurai.saveSnifferActiveProtocols(); } }
Example #13
Source File: Creature.java From aion-germany with GNU General Public License v3.0 | 5 votes |
/** * @param cooldownId * @param time */ public void setSkillCoolDown(int cooldownId, long time) { if (cooldownId == 0) { return; } if (skillCoolDowns == null) { skillCoolDowns = new FastMap<Integer, Long>().shared(); } skillCoolDowns.put(cooldownId, time); }
Example #14
Source File: PacketFamilly.java From aion-germany with GNU General Public License v3.0 | 5 votes |
public PacketFamilly(int id, String name) { super(id); _id = id; _name = name; _nodes = new FastMap<Integer, ProtocolNode>(); }
Example #15
Source File: RemoteLogRepositoryBackend.java From aion-germany with GNU General Public License v3.0 | 5 votes |
@SuppressWarnings("unused") private static Map<String,Integer> createPacketIDList(LogFile file) { boolean mustUnload = false; if(!file.isFullyLoaded()) { mustUnload = true; file.loadFully(); } Session s = file.getSession(); Map<String, Integer> packetIDs = new FastMap<String, Integer>(); for(DataPacket packet : s.getPackets()) { if (packet.getFormat() != null) { String op = packet.getPacketFormat().getOpcodeStr(); Integer count = packetIDs.get(op); if(count != null) { packetIDs.put(op, count+1); } else { packetIDs.put(op, 1); } } } if(mustUnload) file.unLoadSessionPackets(); return packetIDs; }
Example #16
Source File: PacketSamurai.java From aion-germany with GNU General Public License v3.0 | 5 votes |
public static Map<Integer, Protocol> loadSnifferActiveProtocols() { if (_loggerProperties.containsKey("SnifferProtocols")) { Map<Integer, Protocol> activeProtocols = new FastMap<Integer, Protocol>(); String[] protocols = PacketSamurai.getConfigProperty("SnifferProtocols").split(";"); for (String activeProtocol : protocols) { String[] parts = activeProtocol.split(":"); try { int port = Integer.parseInt(parts[0]); Protocol p = ProtocolManager.getInstance().getProtocolByName(parts[1]); if (p != null) { // ignore this entry if (port != p.getPort()) { PacketSamurai.getUserInterface().log("Port does not match for protocol "+p.getName()); continue; } activeProtocols.put(port, p); } else { PacketSamurai.getUserInterface().log("ERROR: While retrieveing active sniffing protocol from config. Protocol ["+parts[1]+"] was not found."); } } catch (NumberFormatException e) { // msg should be: stop playing with the config mannualy noob PacketSamurai.getUserInterface().log("ERROR: While retrieveing active sniffing protocol from config, invalid port."); } } return activeProtocols; } return null; }
Example #17
Source File: SiegeZoneInstance.java From aion-germany with GNU General Public License v3.0 | 5 votes |
public void doOnAllPlayers(Visitor<Player> visitor) { try { for (FastMap.Entry<Integer, Player> e = players.head(), mapEnd = players.tail(); (e = e.getNext()) != mapEnd;) { Player player = e.getValue(); if (player != null) { visitor.visit(player); } } } catch (Exception ex) { log.error("Exception when running visitor on all players" + ex); } }
Example #18
Source File: PlayerMoveTaskManager.java From aion-germany with GNU General Public License v3.0 | 5 votes |
@Override public void run() { for (FastMap.Entry<Integer, Creature> e = movingPlayers.head(), mapEnd = movingPlayers.tail(); (e = e.getNext()) != mapEnd;) { Creature player = e.getValue(); player.getMoveController().moveToDestination(); } }
Example #19
Source File: NpcShoutData.java From aion-germany with GNU General Public License v3.0 | 5 votes |
public void afterUnmarshal(Unmarshaller u, Object parent) { for (ShoutGroup group : shoutGroups) { for (int i = group.getShoutNpcs().size() - 1; i >= 0; i--) { ShoutList shoutList = group.getShoutNpcs().get(i); int worldId = shoutList.getRestrictWorld(); FastMap<Integer, List<NpcShout>> worldShouts = shoutsByWorldNpcs.get(worldId); if (worldShouts == null) { worldShouts = FastMap.newInstance(); this.shoutsByWorldNpcs.put(worldId, worldShouts); } this.count += shoutList.getNpcShouts().size(); for (int j = shoutList.getNpcIds().size() - 1; j >= 0; j--) { int npcId = shoutList.getNpcIds().get(j); List<NpcShout> shouts = new ArrayList<NpcShout>(shoutList.getNpcShouts()); if (worldShouts.get(npcId) == null) { worldShouts.put(npcId, shouts); } else { worldShouts.get(npcId).addAll(shouts); } shoutList.getNpcIds().remove(j); } shoutList.getNpcShouts().clear(); shoutList.makeNull(); group.getShoutNpcs().remove(i); } group.makeNull(); } this.shoutGroups.clear(); this.shoutGroups = null; }
Example #20
Source File: KnownList.java From aion-germany with GNU General Public License v3.0 | 5 votes |
public void doOnAllObjects(Visitor<VisibleObject> visitor) { try { for (FastMap.Entry<Integer, VisibleObject> e = knownObjects.head(), mapEnd = knownObjects.tail(); (e = e.getNext()) != mapEnd;) { VisibleObject newObject = e.getValue(); if (newObject != null) { visitor.visit(newObject); } } } catch (Exception ex) { // log.error("Exception when running visitor on all objects" + ex); } }
Example #21
Source File: ReportToManyData.java From aion-germany with GNU General Public License v3.0 | 5 votes |
@Override public void register(QuestEngine questEngine) { int maxVar = 0; FastMap<Integer, NpcInfos> NpcInfo = new FastMap<Integer, NpcInfos>(); for (NpcInfos mi : npcInfos) { NpcInfo.put(mi.getNpcId(), mi); if (mi.getVar() > maxVar) { maxVar = mi.getVar(); } } ReportToMany template = new ReportToMany(id, startItemId, startNpcIds, endNpcIds, NpcInfo, startDialog, endDialog, maxVar, mission); questEngine.addQuestHandler(template); }
Example #22
Source File: ItemGroupsData.java From aion-germany with GNU General Public License v3.0 | 5 votes |
void MapCraftReward(FastMap<Integer, FastMap<IntRange, List<CraftReward>>> dataHolder, CraftReward reward) { FastMap<IntRange, List<CraftReward>> ranges; int lowerBound = 0, upperBound = 0; if (reward instanceof CraftRecipe) { CraftRecipe recipe = (CraftRecipe) reward; lowerBound = recipe.getLevel(); upperBound = lowerBound + RECIPE_UPPER; if (upperBound / 100 != lowerBound / 100) { upperBound = lowerBound / 100 + 99; } } else { CraftItem item = (CraftItem) reward; lowerBound = item.getMinLevel(); upperBound = item.getMaxLevel(); } IntRange range = new IntRange(lowerBound, upperBound); if (dataHolder.containsKey(reward.getSkill())) { ranges = dataHolder.get(reward.getSkill()); } else { ranges = new FastMap<IntRange, List<CraftReward>>(); dataHolder.put(reward.getSkill(), ranges); } List<CraftReward> items; if (ranges.containsKey(range)) { items = ranges.get(range); } else { items = new ArrayList<CraftReward>(); ranges.put(range, items); } items.add(reward); }
Example #23
Source File: ItemUpgradeService.java From aion-germany with GNU General Public License v3.0 | 5 votes |
public static boolean checkItemUpgrade(Player player, Item baseItem, int resultItemId) { ItemUpgradeTemplate itemUpgradeTemplate = DataManager.ITEM_UPGRADE_DATA.getItemUpgradeTemplate(baseItem.getItemId()); if (itemUpgradeTemplate == null) { log.warn(resultItemId + " item's itemupgrade template is null"); return false; } FastMap<Integer, UpgradeResultItem> resultItemMap = DataManager.ITEM_UPGRADE_DATA.getResultItemMap(baseItem.getItemId()); if (!resultItemMap.containsKey(resultItemId)) { AuditLogger.info(player, resultItemId + " item's baseItem and resultItem is not matched (possible client modify)"); return false; } UpgradeResultItem resultItem = resultItemMap.get(resultItemId); if (resultItem.getCheck_enchant_count() > 0) { if (baseItem.getEnchantOrAuthorizeLevel() < resultItem.getCheck_enchant_count()) { PacketSendUtility.sendPacket(player, SM_SYSTEM_MESSAGE.STR_REGISTER_ITEM_MSG_UPGRADE_CANNOT(new DescriptionId(baseItem.getNameId()))); return false; } } if (resultItem.getNeed_abyss_point() != null) { if (player.getAbyssRank().getAp() < resultItem.getNeed_abyss_point().getCount()) { PacketSendUtility.sendPacket(player, SM_SYSTEM_MESSAGE.STR_REGISTER_ITEM_MSG_UPGRADE_CANNOT_NEED_AP); return false; } } if (resultItem.getNeed_kinah() == null) { for (SubMaterialItem sub : resultItem.getUpgrade_materials().getSubMaterialItem()) { if (player.getInventory().getItemCountByItemId(sub.getId()) < sub.getCount()) { // SubMaterial is not enough return false; } } } else { if (player.getInventory().getKinah() < resultItem.getNeed_kinah().getCount()) { PacketSendUtility.sendPacket(player, SM_SYSTEM_MESSAGE.STR_REGISTER_ITEM_MSG_UPGRADE_CANNOT_NEED_QINA); return false; } } return true; }
Example #24
Source File: AggroList.java From aion-germany with GNU General Public License v3.0 | 5 votes |
/** * @return most hated creature */ public Creature getMostHated() { if (aggroList.isEmpty()) { return null; } Creature mostHated = null; int maxHate = 0; for (FastMap.Entry<Integer, AggroInfo> e = aggroList.head(), mapEnd = aggroList.tail(); (e = e.getNext()) != mapEnd;) { AggroInfo ai = e.getValue(); if (ai == null) { continue; } // aggroList will never contain anything but creatures Creature attacker = (Creature) ai.getAttacker(); if (attacker.getLifeStats().isAlreadyDead()) { ai.setHate(0); } if (ai.getHate() > maxHate) { mostHated = attacker; maxHate = ai.getHate(); } } return mostHated; }
Example #25
Source File: Player.java From aion-germany with GNU General Public License v3.0 | 5 votes |
/** * @param delayId * @param time * @param useDelay */ public void addItemCoolDown(int delayId, long time, int useDelay) { if (itemCoolDowns == null) { itemCoolDowns = new FastMap<Integer, ItemCooldown>().shared(); } itemCoolDowns.put(delayId, new ItemCooldown(time, useDelay)); }
Example #26
Source File: SkillUse.java From aion-germany with GNU General Public License v3.0 | 5 votes |
public SkillUse(int questId, int startNpc, int endNpc, FastMap<List<Integer>, QuestSkillData> qsd) { super(questId); this.questId = questId; this.startNpc = startNpc; if (endNpc != 0) { this.endNpc = endNpc; } else { this.endNpc = startNpc; } this.qsd = qsd; }
Example #27
Source File: KnownList.java From aion-germany with GNU General Public License v3.0 | 5 votes |
/** * Find objects that are in visibility range. */ protected void findVisibleObjects() { if (owner == null || !owner.isSpawned()) { return; } MapRegion[] regions = owner.getActiveRegion().getNeighbours(); for (int i = 0; i < regions.length; i++) { MapRegion r = regions[i]; FastMap<Integer, VisibleObject> objects = r.getObjects(); for (FastMap.Entry<Integer, VisibleObject> e = objects.head(), mapEnd = objects.tail(); (e = e.getNext()) != mapEnd;) { VisibleObject newObject = e.getValue(); if (newObject == owner || newObject == null) { continue; } if (!isAwareOf(newObject)) { continue; } if (knownObjects.containsKey(newObject.getObjectId())) { continue; } if (!checkObjectInRange(newObject) && !newObject.getKnownList().checkReversedObjectInRange(owner)) { continue; } /** * New object is not known. */ if (add(newObject)) { newObject.getKnownList().add(owner); } } } }
Example #28
Source File: Creature.java From aion-germany with GNU General Public License v3.0 | 5 votes |
/** * This function saves the currentMillis of skill that generated the cooldown of an entire cooldownGroup * * @param cooldownId * @param baseTime */ public void setSkillCoolDownBase(int cooldownId, long baseTime) { if (cooldownId == 0) { return; } if (skillCoolDownsBase == null) { skillCoolDownsBase = new FastMap<Integer, Long>().shared(); } skillCoolDownsBase.put(cooldownId, baseTime); }
Example #29
Source File: RiftInformer.java From aion-germany with GNU General Public License v3.0 | 5 votes |
private static FastMap<Integer, Integer> getAnnounceData(int worldId) { FastMap<Integer, Integer> localRifts = new FastMap<Integer, Integer>(); // init empty list for (int i = 0; i < 14; i++) { //OLD 8 (TODO) localRifts.put(i, 0); } for (Npc rift : getSpawned(worldId)) { RVController rc = (RVController) rift.getController(); localRifts = calcRiftsData(rc, localRifts); } return localRifts; }
Example #30
Source File: DElement.java From org.openntf.domino with Apache License 2.0 | 5 votes |
@Override public Map<String, Object> toMap(final String[] props) { FastMap<String, Object> result = new FastMap<String, Object>(); for (String prop : props) { result.put(prop, getProperty(prop)); } return result.unmodifiable(); }