public override void WriteToStream(Stream mstream, short ParsingRule, ThingDb.Thing thing) { NoxBinaryWriter bw = new NoxBinaryWriter(mstream, CryptApi.NoxCryptFormat.NONE); bw.Write(SizeX); bw.Write(SizeY); bw.WriteColor(EdgeColor); bw.WriteColor(BackColor); bw.Write(UnkInt1); bw.WriteScriptEvent(ScriptOnPressed); bw.WriteScriptEvent(ScriptOnReleased); bw.WriteScriptEvent(ScriptOnCollided); bw.Write(AllowedObjClass); bw.Write(IgnoredObjClass); bw.Write(AllowedTeamID); bw.Write(IgnoredTeamID); bw.Write(TriggerState); bw.Write(Unk7); bw.Write(UnkInt2); }
public override void WriteToStream(Stream baseStream, short ParsingRule, ThingDb.Thing thing) { NoxBinaryWriter bw = new NoxBinaryWriter(baseStream, CryptApi.NoxCryptFormat.NONE); bw.Write((byte)MonsterSpawnRate.Length); bw.Write(MonsterSpawnRate); bw.Write(SpawnedMonsters); bw.Write(SavedSpawnLimit); bw.Write(LastSpawnFrame); bw.WriteScriptEvent(ScriptOnDamage); bw.WriteScriptEvent(ScriptOnDestroy); bw.WriteScriptEvent(ScriptOnCollide); bw.WriteScriptEvent(ScriptOnSpawn); bw.Write((byte)MonsterNames.Length); for (int i = 0; i < MonsterNames.Length; i++) { if (MonsterData[i] == null) { // empty bw.Write(false); continue; } bw.Write(true); bw.Write(MonsterNames[i]); bw.Write((short)(i + 1)); // SkipToNextQword bw.SkipToNextBoundary(); bw.Write(MonsterData[i].LongLength); bw.Write(MonsterData[i]); } bw.Write((byte)MonsterSpawnLimit.Length); bw.Write(MonsterSpawnLimit); if (ParsingRule >= 63) { bw.Write(GenerationFlags); } }
/// <summary> /// Преобразует структуру обратно в массив байтов, и сохраняет в Map.Object /// </summary> public override void WriteToStream(Stream mstream, short ParsingRule, ThingDb.Thing thing) { NoxBinaryWriter bw = new NoxBinaryWriter(mstream, CryptApi.NoxCryptFormat.NONE); // Направление bw.Write(MonsterXfer.NOX_DIRECT_LONG[DirectionId]); // Записываем обработчики for (int i = 0; i < 10; i++) { if (i == 2) { bw.Write(DetectEventTimeout); } bw.WriteScriptEvent(ScriptEvents[i]); } bw.Write((int)0); // цвета частей тела Color color; for (int i = 0; i < 6; i++) { color = NPCColors[i]; bw.Write(color.R); bw.Write(color.G); bw.Write(color.B); } // основная инфа bw.Write(ActionRoamPathFlag); bw.Write((uint)StatusFlags); bw.Write(HealthMultiplier); bw.Write(RetreatRatio); bw.Write(ResumeRatio); bw.Write(SightRange); bw.Write(Health); bw.Write(Aggressiveness); bw.Write(EscortObjName); // Записываем заклинания int knownSpellsCount = KnownSpells.Count; bw.Write(knownSpellsCount); foreach (MonsterXfer.SpellEntry se in KnownSpells) { bw.Write(se.SpellName); bw.Write(se.UseFlags); } bw.Write(ReactionCastingDelayMin); bw.Write(ReactionCastingDelayMax); bw.Write(BuffCastingDelayMin); bw.Write(BuffCastingDelayMax); bw.Write(DebuffCastingDelayMin); bw.Write(DebuffCastingDelayMax); bw.Write(OffensiveCastingDelayMin); bw.Write(OffensiveCastingDelayMax); bw.Write(BlinkCastingDelayMin); bw.Write(BlinkCastingDelayMax); // bw.Write(LockPathDistance); bw.Write(SpellPowerLevel); bw.Write(NPCStrength); bw.Write(NPCSpeed); bw.Write(AimSkillLevel); bw.Write(TrapSpell1); bw.Write(TrapSpell2); bw.Write(TrapSpell3); bw.Write(NoxEnums.AIActionStrings[DefaultAction]); // данные ИИ - пропускаем bw.Write((short)4); bw.Write((byte)0); // бессмертие bw.Write(Immortal); // MaxHealth - 4 bytes bw.Write(MagicNumber); bw.Write((int)MaxHealth); bw.Write(AddedSubclass); bw.Write(Health); bw.Write(Experience); bw.Write(NPCVoiceSet); // Список бафов bw.Write((short)2); byte buffsNum = (byte)BuffList.Length; MonsterXfer.BuffEntry buff; bw.Write(buffsNum); for (int i = 0; i < buffsNum; i++) { buff = BuffList[i]; bw.Write(buff.Name); bw.Write(buff.Power); bw.Write(buff.Duration); if (buff.Name == ENCHANT_SHIELD) { bw.Write(buff.ShieldHealth); } } bw.Write(PoisonLevel); }
public void WriteToStream(Stream baseStream, short ParsingRule) { NoxBinaryWriter bw = new NoxBinaryWriter(baseStream, CryptApi.NoxCryptFormat.NONE); bw.Write((byte) MonsterSpawnRate.Length); bw.Write(MonsterSpawnRate); bw.Write(SpawnedMonsters); bw.Write(SavedSpawnLimit); bw.Write(LastSpawnFrame); bw.WriteScriptEvent(ScriptOnDamage); bw.WriteScriptEvent(ScriptOnDestroy); bw.WriteScriptEvent(ScriptOnCollide); bw.WriteScriptEvent(ScriptOnSpawn); bw.Write((byte) MonsterNames.Length); for (int i = 0; i < MonsterNames.Length; i++) { if (MonsterData[i] == null) { // empty bw.Write(false); continue; } bw.Write(true); bw.Write(MonsterNames[i]); bw.Write((short) i + 1); // SkipToNextQword bw.SkipToNextBoundary(); bw.Write(MonsterData[i].LongLength); bw.Write(MonsterData[i]); } bw.Write((byte) MonsterSpawnLimit.Length); bw.Write(MonsterSpawnLimit); if (ParsingRule >= 63) bw.Write(GenerationFlags); }
/// <summary> /// Преобразует структуру обратно в массив байтов, и сохраняет в Map.Object /// </summary> public override void WriteToStream(Stream mstream, short ParsingRule, ThingDb.Thing thing) { ThingDb.Thing tt = thing; NoxBinaryWriter bw = new NoxBinaryWriter(mstream, CryptApi.NoxCryptFormat.NONE); // Направление bw.Write(NOX_DIRECT_LONG[DirectionId]); //bw.Write(Array.IndexOf(NOX_DIRECT_LONG, DirectionId)); // Записываем обработчики for (int i = 0; i < 10; i++) { if (i == 2) { bw.Write(DetectEventTimeout); } bw.WriteScriptEvent(ScriptEvents[i]); } bw.Write((int)0); // Основная инфа bw.Write(ActionRoamPathFlag); bw.Write((uint)StatusFlags); bw.Write(HealthMultiplier); bw.Write(RetreatRatio); bw.Write(ResumeRatio); bw.Write(SightRange); bw.Write(Aggressiveness); bw.Write(EscortObjName); // Записываем заклинания int knownSpellsCount = KnownSpells.Count; bw.Write(knownSpellsCount); foreach (SpellEntry se in KnownSpells) { bw.Write(se.SpellName); bw.Write(se.UseFlags); } bw.Write(ReactionCastingDelayMin); bw.Write(ReactionCastingDelayMax); bw.Write(BuffCastingDelayMin); bw.Write(BuffCastingDelayMax); bw.Write(DebuffCastingDelayMin); bw.Write(DebuffCastingDelayMax); bw.Write(OffensiveCastingDelayMin); bw.Write(OffensiveCastingDelayMax); bw.Write(BlinkCastingDelayMin); bw.Write(BlinkCastingDelayMax); // bw.Write(LockPathDistance); bw.Write(SpellPowerLevel); bw.Write(AimSkillLevel); bw.Write(TrapSpell1); bw.Write(TrapSpell2); bw.Write(TrapSpell3); bw.Write(NoxEnums.AIActionStrings[DefaultAction]); // данные ИИ - пропускаем bw.Write((short)4); bw.Write((byte)0); // Бессмертие - в общем то bool bw.Write(Immortal); // Магазин if (tt.Subclass[(int)ThingDb.Thing.SubclassBitIndex.SHOPKEEPER]) { bw.Write(ShopkeeperInfo.BuyValueMultiplier); bw.Write(ShopkeeperInfo.SellValueMultiplier); bw.Write(ShopkeeperInfo.ShopkeeperGreetingText); byte itemsCount = (byte)ShopkeeperInfo.ShopItems.Length; ShopItemInfo item; bw.Write(itemsCount); for (int i = 0; i < itemsCount; i++) { item = ShopkeeperInfo.ShopItems[i]; bw.Write(item.Count); bw.Write(item.Name); bw.Write(item.SpellID); bw.Write(item.Ench1); bw.Write(item.Ench2); bw.Write(item.Ench3); bw.Write(item.Ench4); } } // bw.Write(MagicNumber); bw.Write(AddedSubclass); bw.Write(Health); bw.Write(SetDefaultResumeRatio); bw.Write(SetDefaultRetreatRatio); bw.Write(SetDefaultMonsterStatus); // bw.Write(LearnDefaultSpells); if (tt.Subclass[(int)ThingDb.Thing.SubclassBitIndex.FEMALE_NPC]) { Color color; for (int i = 0; i < 6; i++) { color = MaidenBodyColors[i]; bw.Write(color.R); bw.Write(color.G); bw.Write(color.B); } bw.Write(MaidenVoiceSet); } // Список бафов bw.Write((short)2); byte buffsNum = (byte)BuffList.Length; BuffEntry buff; bw.Write(buffsNum); for (int i = 0; i < buffsNum; i++) { buff = BuffList[i]; bw.Write(buff.Name); bw.Write(buff.Power); bw.Write(buff.Duration); if (buff.Name == ENCHANT_SHIELD) { bw.Write(buff.ShieldHealth); } } // if (tt.Subclass[(int)ThingDb.Thing.SubclassBitIndex.WOUNDED_NPC]) { bw.Write(WoundedNPCVoiceSet); } bw.Write(PoisonLevel); }