コード例 #1
0
  private void init(ResourceEntry targetEntry) {
    songEntry = targetEntry;

    songId = -1L;
    Song2daBitmap songBitmap = new Song2daBitmap(StreamUtils.getByteBuffer(4), 0, 4);
    List<RefEntry> resList = songBitmap.getResourceList();
    for (final RefEntry refEntry : resList) {
      ResourceEntry entry = refEntry.getResourceEntry();
      if (entry != null && entry.equals(targetEntry)) {
        songId = refEntry.getValue();
        break;
      }
    }

    if (songId >= 0) {
      if (Profile.getGame() != Profile.Game.PST) {
        scriptActions.add(Pattern.compile("StartMusic\\(" + Long.toString(songId) + ",.+\\)"));
        IdsMap map = null;
        if (ResourceFactory.resourceExists("SONGLIST.IDS")) {
          map = IdsMapCache.get("SONGLIST.IDS");
        } else if (Profile.getGame() == Profile.Game.IWD2) {
          map = IdsMapCache.get("MUSIC.IDS");
        }
        if (map != null && map.getMap().containsKey(Long.valueOf(songId))) {
          String musicId = map.getMap().get(Long.valueOf(songId)).getString();
          scriptActions.add(Pattern.compile("SetMusic\\(.+?," + Long.toString(songId) + "\\)"));
          if (musicId != null && !musicId.isEmpty()) {
            scriptActions.add(Pattern.compile("SetMusic\\(.+?," + musicId + "\\)"));
          }
        }
      }
    }
  }
コード例 #2
0
 public Iwd2Spell() throws Exception {
   super(null, CRE_SPELL, StreamUtils.getByteBuffer(16), 0);
 }