static public SpawnPreset Find(int act, int type, int id) { SpawnPreset obj = null; lookup.TryGetValue(Key(act, type, id), out obj); return(obj); }
private static void ReadObjects(DS1 ds1, BinaryReader reader, int act) { if (ds1.version < 2) { return; } int objectCount = reader.ReadInt32(); //Debug.Log("Objects " + objectCount); ds1.objects = new ObjectSpawnInfo[objectCount]; for (int i = 0; i < objectCount; i++) { var info = new ObjectSpawnInfo(); int type = reader.ReadInt32(); int id = reader.ReadInt32(); info.x = reader.ReadInt32(); info.y = reader.ReadInt32(); if (ds1.version > 5) { reader.ReadInt32(); // flags } info.preset = SpawnPreset.Find(act, type, id); ds1.objects[i] = info; } }
public static void LoadAll() { var sw = System.Diagnostics.Stopwatch.StartNew(); Translation.Load(); SoundInfo.Load(); SoundEnvironment.Load(); ObjectInfo.Load(); BodyLoc.Load(); ExpTable.Load(); LevelType.Load(); LevelWarpInfo.Load(); LevelPreset.Load(); LevelMazeInfo.Load(); LevelInfo.Load(); OverlayInfo.Load(); MissileInfo.Load(); ItemStat.Load(); ItemRatio.Load(); ItemType.Load(); ItemPropertyInfo.Load(); ItemSet.Load(); UniqueItem.Load(); SetItem.Load(); TreasureClass.Load(); MagicAffix.Load(); CharStatsInfo.Load(); MonLvl.Load(); MonPreset.Load(); MonSound.Load(); MonStatsExtended.Load(); MonStat.Load(); SuperUnique.Load(); SkillDescription.Load(); SkillInfo.Load(); SpawnPreset.Load(); StateInfo.Load(); Debug.Log("All txt files loaded in " + sw.ElapsedMilliseconds + " ms"); }
static bool CreateObject(SpawnPreset obj, int x, int y, int level, Transform root) { var pos = Iso.MapToWorld(x - 2, y - 2); if (obj.type == 2) { if (obj.objectId >= ObjectInfo.sheet.Count) { return(false); } ObjectInfo objectInfo = ObjectInfo.sheet[obj.objectId]; var staticObject = World.SpawnObject(objectInfo, pos, parent: root); staticObject.modeName = obj.mode; return(true); } else { string monPreset = MonPreset.Find(obj.act, obj.id); MonStat monStat = null; SuperUnique superUnique = null; if (monPreset != null) { monStat = MonStat.Find(monPreset); if (monStat == null) { superUnique = SuperUnique.Find(monPreset); } } else { monStat = MonStat.sheet[obj.id]; } if (monStat != null) { World.SpawnMonster(monStat, pos, root); return(true); } if (superUnique != null) { var monster = World.SpawnMonster(superUnique.monStat, pos, root); monster.gameObject.name = superUnique.nameStr; monster.title = superUnique.name; monster.level = level; int minionCount = Random.Range(superUnique.minGrp, superUnique.maxGrp + 1); for (int i = 0; i < minionCount; ++i) { var minion = World.SpawnMonster(superUnique.monStat, pos, root); minion.level = level; } return(true); } if (obj.id == 10) { // Fallens for (int i = 0; i < 4; ++i) { World.SpawnMonster("fallen1", pos, root); } return(true); } if (obj.id == 11) { // Fallen shaman + fallens Spawn(MonStat.Find("fallenshaman1"), x, y, level, root); for (int i = 0; i < 4; ++i) { var fallen = World.SpawnMonster("fallen1", pos, root); fallen.level = level; } return(true); } if (obj.id == 27) { // Fallen shaman Spawn(MonStat.Find("fallenshaman1"), x, y, level, root); return(true); } return(false); } }