public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client) { int vobType = 0; stream.Read(out vobType); Vob v = Vob.createVob((VobType)vobType); if (v == null) { throw new Exception("Vobtype was not known in Vob.createVob: " + vobType); } v.Read(stream); sWorld.addVob(v); }
public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client) { int id = 0; stream.Read(out id); Player.Hero.ID = id; sWorld.addVob(Player.Hero); using (BitStream stream2 = new BitStream()) { Zip.Decompress(stream, stream2); stream = stream2; stream.Read(out Player.EnableStatusMenu); stream.Read(out Player.EnableLogMenu); //Player-Defaults: if (Player.EnableStatusMenu) { Gothic.mClasses.InputHooked.deactivateStatusScreen(Process.ThisProcess(), true); } if (Player.EnableLogMenu) { Gothic.mClasses.InputHooked.deactivateLogScreen(Process.ThisProcess(), true); } stream.Read(out Player.sSendAllKeys); int playerKeyCount = 0; stream.Read(out playerKeyCount); for (int i = 0; i < playerKeyCount; i++) { byte key = 0; stream.Read(out key); Player.sSendKeys.Add(key); } int day = 0; byte hour = 0, minute = 0; stream.Read(out day); stream.Read(out hour); stream.Read(out minute); sWorld.Day = day; sWorld.Hour = hour; sWorld.Minute = minute; byte wt = 0, starthour = 0, startminute = 0, endhour = 0, endminute; stream.Read(out wt); stream.Read(out starthour); stream.Read(out startminute); stream.Read(out endhour); stream.Read(out endminute); sWorld.WeatherType = wt; sWorld.StartRainHour = starthour; sWorld.StartRainMinute = startminute; sWorld.EndRainHour = endhour; sWorld.EndRainMinute = endminute; short spellCount = 0; stream.Read(out spellCount); for (int i = 0; i < spellCount; i++) { Spell spell = new Spell(); spell.Read(stream); Spell.addItemInstance(spell); } short itemInstancesCount = 0; stream.Read(out itemInstancesCount); for (int i = 0; i < itemInstancesCount; i++) { ItemInstance ii = new ItemInstance(); ii.Read(stream); ItemInstance.addItemInstance(ii); } CreateItems(); //ItemList: int iLC = 0; stream.Read(out iLC); for (int i = 0; i < iLC; i++) { Item item = new Item(); item.Read(stream); sWorld.addVob(item); } //Vob-List: int vLC = 0; stream.Read(out vLC); for (int i = 0; i < vLC; i++) { int vobType = 0; stream.Read(out vobType); Vob vob = Vob.createVob((VobType)vobType); vob.Read(stream); sWorld.addVob(vob); } //NPC-List: int nLC = 0; stream.Read(out nLC); for (int i = 0; i < nLC; i++) { NPC npc = new NPC(); npc.Read(stream); sWorld.addVob(npc); } //Player-List: int pLC = 0; stream.Read(out pLC); for (int i = 0; i < pLC; i++) { Player player = new Player(false, ""); player.Read(stream); if (player.ID == id) { continue; } sWorld.addVob(player); } //WorldSpawnList: int worldListCount = 0; stream.Read(out worldListCount); for (int i = 0; i < worldListCount; i++) { World w = new World(); w.Read(stream); sWorld.WorldDict.Add(w.Map, w); } } }