com.badlogic.gdx.utils.IntIntMap Java Examples

The following examples show how to use com.badlogic.gdx.utils.IntIntMap. 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: Item.java    From riiablo with Apache License 2.0 6 votes vote down vote up
public void update(Attributes attrs, CharStats.Entry charStats, IntIntMap equippedSets) {
  if ((flags & COMPACT) == COMPACT) return;
  props.reset();
  if (stats[MAGIC_PROPS] != null) props.add(stats[MAGIC_PROPS]);
  if (stats[RUNE_PROPS ] != null) props.add(stats[RUNE_PROPS ]);
  for (Item socket : sockets) {
    if (socket.type.is(Type.GEM) || socket.type.is(Type.RUNE)) {
      props.add(socket.stats[base.gemapplytype]);
    } else {
      props.add(socket.stats[MAGIC_PROPS]);
    }
  }
  if (quality == SET && location == EQUIPPED) {
    SetItems.Entry setItem = (SetItems.Entry) qualityData;
    int setId = Riiablo.files.Sets.index(setItem.set);
    int numEquipped = equippedSets.get(setId, 0);
    if (numEquipped >= 2) {
      for (int i = 0; i < numEquipped; i++) {
        props.add(stats[SET_PROPS + i]);
      }
    }
  }
  props.update(attrs, charStats);
}
 
Example #2
Source File: LR2SkinCSVLoader.java    From beatoraja with GNU General Public License v3.0 6 votes vote down vote up
protected void loadSkin0(Skin skin, Path f, MainState state, IntIntMap option) throws IOException {

		try (Stream<String> lines = Files.lines(f, Charset.forName("MS932"))) {
			lines.forEach(line -> {
				try {
					processLine(line, state);
				} catch (Throwable e) {
					e.printStackTrace();
				}
			});
		};

		skin.setOption(option);

		for (SkinObject obj : skin.getAllSkinObjects()) {
			if (obj instanceof SkinImage && obj.getAllDestination().length == 0) {
				skin.removeSkinObject(obj);
				Logger.getGlobal().warning("NO_DESTINATION : " + obj);
			}
		}
	}
 
Example #3
Source File: LR2SkinCSVLoader.java    From beatoraja with GNU General Public License v3.0 5 votes vote down vote up
protected S loadSkin(S skin, Path f, MainState state, SkinHeader header, IntIntMap option,
		ObjectMap<String, Object> property) throws IOException {
	this.skin = skin;
	this.state = state;
	for (String key : property.keys()) {
		if (property.get(key) != null) {
			if (property.get(key) instanceof Integer) {
				op.put((Integer) property.get(key), 1);
			}
			if (property.get(key) instanceof String) {
				for (CustomFile file : header.getCustomFiles()) {
					if (file.name.equals(key)) {
						filemap.put(file.path, (String) property.get(key));
						break;
					}
				}
			}
		}
	}

	IntMap<SkinConfig.Offset> offset = new IntMap<>();
	for (CustomOffset of : header.getCustomOffsets()) {
		final Object o = property.get(of.name);
		if(o instanceof Offset) {
			offset.put(of.id, (Offset)o);				
		}
	}
	skin.setOffset(offset);

	op.putAll(option);
	this.loadSkin0(skin, f, state, op);

	return skin;
}
 
Example #4
Source File: LR2SkinSelectSkinLoader.java    From beatoraja with GNU General Public License v3.0 5 votes vote down vote up
public SkinConfigurationSkin loadSkin(Path f, MainState selector, SkinHeader header,
                                      IntIntMap option, ObjectMap property) throws IOException {
	SkinConfigurationSkin skin = this.loadSkin(new SkinConfigurationSkin(src, dst), f, selector, header, option, property);
	int count = 0;
	for (SkinObject obj : skin.getAllSkinObjects()) {
		if (SkinPropertyMapper.isSkinCustomizeButton(obj.getClickeventId())) {
			int index = SkinPropertyMapper.getSkinCustomizeIndex(obj.getClickeventId());
			if (count <= index)
				count = index + 1;
		}
	}
	skin.setCustomPropertyCount(count);
	return skin;
}
 
Example #5
Source File: LR2SkinCSVLoader.java    From beatoraja with GNU General Public License v3.0 4 votes vote down vote up
public S loadSkin(Path f, MainState state, SkinHeader header, IntIntMap option, SkinConfig.Property property) throws IOException {
	ObjectMap m = new ObjectMap();
	for(SkinConfig.Option op : property.getOption()) {
		if(op.value != OPTION_RANDOM_VALUE) {
			m.put(op.name, op.value);
		} else {
			for (CustomOption opt : header.getCustomOptions()) {
				if(op.name.equals(opt.name)) {
					if(header.getRandomSelectedOptions(op.name) >= 0) m.put(op.name, header.getRandomSelectedOptions(op.name));
				}
			}
		}
	}
	for(SkinConfig.FilePath file : property.getFile()) {
		if(!file.path.equals("Random")) {
			m.put(file.name, file.path);
		} else {
			for (CustomFile cf : header.getCustomFiles()) {
				if(file.name.equals(cf.name)) {
					String ext = cf.path.substring(cf.path.lastIndexOf("*") + 1);
					if(cf.path.contains("|")) {
						if(cf.path.length() > cf.path.lastIndexOf('|') + 1) {
							ext = cf.path.substring(cf.path.lastIndexOf("*") + 1, cf.path.indexOf('|')) + cf.path.substring(cf.path.lastIndexOf('|') + 1);
						} else {
							ext = cf.path.substring(cf.path.lastIndexOf("*") + 1, cf.path.indexOf('|'));
						}
					}
					final int slashindex = cf.path.lastIndexOf('/');
					File dir = slashindex != -1 ? new File(cf.path.substring(0, slashindex)) : new File(cf.path);
					if (dir.exists() && dir.isDirectory()) {
						Array<File> l = new Array<File>();
						for (File subfile : dir.listFiles()) {
							if (subfile.getPath().toLowerCase().endsWith(ext)) {
								l.add(subfile);
							}
						}
						if (l.size > 0) {
							String filename = l.get((int) (Math.random() * l.size)).getName();
							m.put(file.name, filename);
						}
					}
				}
			}
		}
	}
	for(SkinConfig.Offset offset : property.getOffset()) {
		m.put(offset.name, offset);
	}

	mode = header.getSkinType().getMode();

	return loadSkin(f, state, header, option, m);
}
 
Example #6
Source File: ClientEntityFactory.java    From riiablo with Apache License 2.0 4 votes vote down vote up
@Override
public int createWarp(int index, float x, float y) {
  final int mainIndex   = DT1.Tile.Index.mainIndex(index);
  final int subIndex    = DT1.Tile.Index.subIndex(index);
  final int orientation = DT1.Tile.Index.orientation(index);

  int id = super.createWarp(index, x, y);
  Warp warp = mWarp.get(id);
  LvlWarp.Entry entry = warp.warp;

  BBox box = new BBox();
  box.xMin = entry.SelectX;
  box.yMin = entry.SelectY;
  box.width = entry.SelectDX;
  box.height = entry.SelectDY;
  box.xMax = box.width + box.xMin;
  box.yMax = box.height + box.yMin;

  String name = Riiablo.string.lookup(warp.dstLevel.LevelWarp);

  IntIntMap substs = warp.substs;
  if (entry.LitVersion) {
    // FIXME: Below will cover overwhelming majority of cases -- need to solve act 5 ice cave case where 3 tiles are used
    //        I think this can be done by checking if there's a texture with the same id, else it's a floor warp
    if (subIndex < 2) {
      for (int i = 0; i < 2; i++) {
        substs.put(DT1.Tile.Index.create(orientation, mainIndex, i), DT1.Tile.Index.create(orientation, mainIndex, i + entry.Tiles));
      }
    } else {
      substs.put(DT1.Tile.Index.create(0, subIndex, 0), DT1.Tile.Index.create(0, subIndex, 4));
      substs.put(DT1.Tile.Index.create(0, subIndex, 1), DT1.Tile.Index.create(0, subIndex, 5));
      substs.put(DT1.Tile.Index.create(0, subIndex, 2), DT1.Tile.Index.create(0, subIndex, 6));
      substs.put(DT1.Tile.Index.create(0, subIndex, 3), DT1.Tile.Index.create(0, subIndex, 7));
    }
  }

  mBBoxWrapper.create(id).box = box;

  Label label = mLabel.create(id);
  label.offset.set(box.xMin + box.width / 2, -box.yMax + box.height / 2);
  label.actor = createLabel(name);
  label.actor.setUserObject(id);

  mSelectable.create(id);
  return id;
}
 
Example #7
Source File: Map.java    From riiablo with Apache License 2.0 4 votes vote down vote up
public void clearWarpSubsts(IntIntMap warps) {
  for (IntIntMap.Entry entry : warps.entries()) {
    this.warpSubsts.remove(entry.key, entry.value);
  }
}
 
Example #8
Source File: Map.java    From riiablo with Apache License 2.0 4 votes vote down vote up
public void addWarpSubsts(IntIntMap warps) {
  this.warpSubsts.putAll(warps);
}
 
Example #9
Source File: CharData.java    From riiablo with Apache License 2.0 4 votes vote down vote up
private void notifySkillChanged(IntIntMap skills, Array<Stat> chargedSkills) {
  for (SkillListener l : skillListeners) l.onChanged(this, skills, chargedSkills);
}
 
Example #10
Source File: ItemData.java    From riiablo with Apache License 2.0 4 votes vote down vote up
public IntIntMap getEquippedSets() {
  return equippedSets;
}
 
Example #11
Source File: PaletteReducer.java    From gdx-texture-packer-gui with Apache License 2.0 4 votes vote down vote up
@Override
public int compare(IntIntMap.Entry o1, IntIntMap.Entry o2) {
    return o2.value - o1.value;
}
 
Example #12
Source File: LR2SkinCSVLoader.java    From beatoraja with GNU General Public License v3.0 4 votes vote down vote up
protected void loadSkin(Skin skin, Path f, MainState state, IntIntMap option) throws IOException {
	this.loadSkin0(skin, f, state, option);
}
 
Example #13
Source File: LR2SkinCSVLoader.java    From beatoraja with GNU General Public License v3.0 4 votes vote down vote up
protected void loadSkin(Skin skin, Path f, MainState state) throws IOException {
	this.loadSkin(skin, f, state, new IntIntMap());
}
 
Example #14
Source File: LR2SkinLoader.java    From beatoraja with GNU General Public License v3.0 4 votes vote down vote up
public IntIntMap getOption() {
	return op;
}
 
Example #15
Source File: LR2DecideSkinLoader.java    From beatoraja with GNU General Public License v3.0 4 votes vote down vote up
public MusicDecideSkin loadSkin(Path f, MainState decide, SkinHeader header, IntIntMap option, ObjectMap property) throws IOException {
	return this.loadSkin(new MusicDecideSkin(src, dst), f, decide, header, option, property);
}
 
Example #16
Source File: LR2CourseResultSkinLoader.java    From beatoraja with GNU General Public License v3.0 4 votes vote down vote up
public CourseResultSkin loadSkin(Path f, MainState state, SkinHeader header, IntIntMap option,
                                 ObjectMap property) throws IOException {
    return this.loadSkin(new CourseResultSkin(src, dst), f, state, header, option, property);
}
 
Example #17
Source File: LR2SelectSkinLoader.java    From beatoraja with GNU General Public License v3.0 4 votes vote down vote up
public MusicSelectSkin loadSkin(Path f, MainState selector, SkinHeader header,
		IntIntMap option, ObjectMap property) throws IOException {
	MusicSelectSkin skin = this.loadSkin(new MusicSelectSkin(src, dst), f, selector, header, option, property);
	skinbar.setBarImage(barimageon, barimageoff);
	return skin;
}
 
Example #18
Source File: LR2SkinCSVLoader.java    From beatoraja with GNU General Public License v3.0 votes vote down vote up
public abstract S loadSkin(Path f, MainState state, SkinHeader header, IntIntMap option, ObjectMap property) throws IOException; 
Example #19
Source File: CharData.java    From riiablo with Apache License 2.0 votes vote down vote up
void onChanged(CharData client, IntIntMap skills, Array<Stat> chargedSkills);