public override void WriteToStream(Stream mstream, short ParsingRule, ThingDb.Thing thing) { NoxBinaryWriter bw = new NoxBinaryWriter(mstream, CryptApi.NoxCryptFormat.NONE); bw.Write(MapName.Length + 1); bw.Write(Encoding.ASCII.GetBytes(MapName)); bw.Write((byte)0); // null terminator bw.Write(ExitX); bw.Write(ExitY); }
public override void WriteToStream(Stream mstream, short ParsingRule, ThingDb.Thing thing) { NoxBinaryWriter bw = new NoxBinaryWriter(mstream, CryptApi.NoxCryptFormat.NONE); for (int i = 0; i < 4; i++) { bw.Write(Enchantments[i]); } bw.Write(AmmoCurrent); bw.Write(AmmoLimit); }
public override void WriteToStream(Stream mstream, short ParsingRule, ThingDb.Thing thing) { NoxBinaryWriter bw = new NoxBinaryWriter(mstream, CryptApi.NoxCryptFormat.NONE); bw.Write(Angle); bw.Write(TargX); bw.Write(TargY); bw.Write((byte)Spells.Count); foreach (string s in Spells) { bw.Write(s); } }
public override void WriteToStream(Stream mstream, short ParsingRule, ThingDb.Thing thing) { NoxBinaryWriter bw = new NoxBinaryWriter(mstream, CryptApi.NoxCryptFormat.NONE); for (int i = 0; i < 4; i++) { bw.Write(Enchantments[i]); } if (thing.HasClassFlag(ThingDb.Thing.ClassFlags.WAND) && !thing.Subclass[(int)ThingDb.Thing.SubclassBitIndex.STAFF]) { bw.Write(WandChargesCurrent); bw.Write(WandChargesLimit); if (WandChargesLimit != 0) { float recalculated = (float)(WandChargesCurrent / WandChargesLimit) * 100f; bw.Write((int)recalculated); } else { bw.Write(0); } } bw.Write(Durability); if (ParsingRule == 63) { bw.Write((byte)0); } if (ParsingRule >= 64) { bw.Write(Unknown); } }
public override void WriteToStream(Stream mstream, short ParsingRule, ThingDb.Thing thing) { NoxBinaryWriter bw = new NoxBinaryWriter(mstream, CryptApi.NoxCryptFormat.NONE); for (int i = 0; i < 4; i++) { bw.Write(Enchantments[i]); } bw.Write(Durability); if (ParsingRule == 61) { bw.Write((byte)0); } if (ParsingRule >= 62) { bw.Write(Unknown); } }
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 mstream, short ParsingRule, ThingDb.Thing thing) { NoxBinaryWriter bw = new NoxBinaryWriter(mstream, CryptApi.NoxCryptFormat.NONE); bw.Write(ScriptActivated); // script event bw.Write((short)1); bw.Write(UnknownScriptHandler.Length); bw.Write(Encoding.ASCII.GetBytes(UnknownScriptHandler)); bw.Write((int)0); // coordinates bw.Write(FallX); bw.Write(FallY); // script delay bw.Write(ScriptTime1); bw.Write(ScriptTimeout); }
public override void WriteToStream(Stream mstream, short ParsingRule, ThingDb.Thing thing) { NoxBinaryWriter bw = new NoxBinaryWriter(mstream, CryptApi.NoxCryptFormat.NONE); bw.Write(Unknown2); bw.Write(LightRadius); bw.Write(NumOfColors); bw.Write(LightIntensity); bw.Write(UnknownVal); //bw.Write(Unknown5); //bw.Write(Unknown6); bw.Write(ChangeIntensity); /* * bw.Write(R1); * bw.Write(G1); * bw.Write(B1); * bw.Write(R2); * bw.Write(G2); * bw.Write(B2); * */ bw.WriteColor(Color1); bw.WriteColor(Color2); bw.Write(Unknown3); bw.Write(PulseSpeed); bw.Write(Unknown4); //for (int i = 0; i < 16; i++) bw.WriteColor(ChangeColors[i]); // for (int i = 0; i < 16; i++) bw.Write(ChangeIntensity[i]); // for (int i = 0; i < 16; i++) bw.Write(ChangeRadius[i]); // bw.Write(ColorChangeIndex); // bw.Write(IntensityChangeIndex); // bw.Write(RadiusChangeIndex); // bw.Write(ObjExtentID); // bw.Write(Unknown13); // bw.Write(Unknown14); // bw.Write(Unknown15); // bw.Write(IsAntiLight); }
/// <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 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); } }
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); }
public override void WriteToStream(Stream mstream, short ParsingRule, ThingDb.Thing thing) { NoxBinaryWriter bw = new NoxBinaryWriter(mstream, CryptApi.NoxCryptFormat.NONE); bw.Write(Unknown2); bw.Write(Unknown7); bw.Write(Unknown8); bw.Write(LightRadius); bw.Write(NumOfColors); bw.Write(LightIntensity); bw.Write(R); bw.Write(R2); bw.Write(UnknownR); bw.Write(UnknownR2); bw.Write(G); bw.Write(G2); bw.Write(UnknownG); bw.Write(UnknownG2); bw.Write(B); bw.Write(B2); bw.Write(UnknownB); bw.Write(UnknownB2); bw.Write(UnknownVal); //bw.Write(Unknown5); //bw.Write(Unknown6); bw.Write(ChangeIntensity); /* * bw.Write(R1); * bw.Write(G1); * bw.Write(B1); * bw.Write(R2); * bw.Write(G2); * bw.Write(B2); * */ bw.WriteColor(Color1); bw.WriteColor(Color2); bw.WriteColor(Color3); bw.WriteColor(Color4); bw.WriteColor(Color5); bw.WriteColor(Color6); bw.WriteColor(Color7); bw.WriteColor(Color8); bw.WriteColor(Color9); bw.WriteColor(Color10); bw.Write(Unknown3); bw.Write(ChangeIntensitySingle); bw.Write(Unknown10); bw.Write(MaxRadius2); bw.Write(MinRadius2); bw.Write(MaxRadius3); bw.Write(MinRadius3); bw.Write(MaxRadius4); bw.Write(MinRadius4); bw.Write(MaxRadius5); bw.Write(MinRadius5); bw.Write(MaxRadius6); bw.Write(MinRadius6); bw.Write(MaxRadius7); bw.Write(MinRadius7); bw.Write(MaxRadius8); bw.Write(MinRadius8); bw.Write(MaxRadius9); bw.Write(MinRadius9); bw.Write(MaxRadius10); bw.Write(MinRadius10); bw.Write(Unknown30); bw.Write(PulseSpeed); bw.Write(Unknown11); bw.Write(PulseSpeedSingle); bw.Write(Unknown4); bw.Write(Unknown80); bw.Write(type); bw.Write(Unknown9); }
public override void WriteToStream(Stream mstream, short ParsingRule, ThingDb.Thing thing) { NoxBinaryWriter bw = new NoxBinaryWriter(mstream, CryptApi.NoxCryptFormat.NONE); bw.Write((uint)RewardType); bw.Write(Unknown1); bw.Write((short)Spells.Count); foreach (string spell in Spells) { bw.Write(spell); } bw.Write((short)Abilities.Count); foreach (string ability in Abilities) { bw.Write(ability); } bw.Write((short)Monsters.Count); foreach (string scroll in Monsters) { bw.Write(scroll); } bw.Write(Unknown2); bw.Write(Unknown3); bw.Write(Unknown4); bw.Write(Unknown5); bw.Write(Unknown6); bw.Write(ActivateChance); bw.Write(RareOrSpecial); }