/// <summary> /// </summary> /// <param name="client"> /// </param> public static void Read(ZoneClient client) { // client got all the needed data and // wants to enter the world. After we // reply to this, the character will really be in game var announce = new CharInPlayMessage { Identity = client.Character.Identity, Unknown = 0x00 }; client.Playfield.Announce(announce); // Player is in game now, starting is over, set stats normally now client.Character.Starting = false; // Needed fix, so gmlevel will be loaded client.Character.Stats[StatIds.gmlevel].Value = client.Character.Stats[StatIds.gmlevel].Value; // Mobs get sent whenever player enters playfield, BUT (!) they are NOT synchronized, because the mobs don't save stuff yet. // for instance: the waypoints the mob went through will NOT be saved and therefore when you re-enter the PF, it will AGAIN // walk the same waypoints. // TODO: Fix it /*foreach (MobType mob in NPCPool.Mobs) { // TODO: Make cache - use pf indexing somehow. if (mob.pf == client.Character.pf) { mob.SendToClient(client); } }*/ }
/// <summary> /// </summary> /// <param name="sendSCFUs"> /// </param> public void SendSCFUsToClient(IMSendPlayerSCFUs sendSCFUs) { Identity dontSendTo = sendSCFUs.toClient.Character.Identity; foreach (IEntity entity in this.Entities) { if (entity.Identity != dontSendTo) { if (entity.Identity.Type == IdentityType.CanbeAffected) { var temp = entity as INamedEntity; if (temp != null) { // TODO: make it NPC-safe SimpleCharFullUpdateMessage simpleCharFullUpdate = SimpleCharFullUpdate.ConstructMessage((Character)temp); sendSCFUs.toClient.SendCompressed(simpleCharFullUpdate); var charInPlay = new CharInPlayMessage { Identity = temp.Identity, Unknown = 0x00 }; sendSCFUs.toClient.SendCompressed(charInPlay); } } } } }