/* Thor Server 2.0 Project - Codenamed "Stockholm" Copyright 2008 - 2009 Joe Hegarty This file is part of The Thor Server 2.0 Project - Codenamed "Stockholm". The Thor Server 2.0 Project - Codenamed "Stockholm" is free software: you can redistribute it and/or modify it under the terms of the Microsoft Public License The Thor Server Project is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Microsoft Public License for more details. You should have received a copy of the Microsoft Public License along with The Thor Server Project. If not, see http://www.opensource.org/licenses/ms-pl.html */ using System; using System.Collections.Generic; using StockholmLibrary.Game.Flats; using StockholmLibrary.Game.Sessions; using StockholmLibrary.Game.Packets.Client; using StockholmLibrary.Game.Packets.Server; using StockholmLibrary.Net; namespace StockholmLibrary.Game.Entities.Components { //------------------------------------ public class ECCreature : EntityComponentRoomChild { int _creatureId; //********************************************** public int ID { get { return _creatureId; } } //********************************************** public void Initialise(int creatureId) { _creatureId = creatureId; } //********************************************** public override void FlatInitiailise(Flat flat) { } //********************************************** public override void FlatDeinitiailise(Flat flat) { } //********************************************** public override void UserInitiailise(Session userSession) { } //********************************************** public override void UserDeinitiailise(Session userSession) { } //********************************************** public void SendLeaving() { SendToAllCreatureSessions(new UserExitPacket(_creatureId)); } //********************************************** public void AnnounceCreatureObject() { SendToAllCreatureSessions(new UsersPacket(GetCreatureObject())); } //********************************************** public CreatureObject GetCreatureObject() { CreatureObject creatureObject = new CreatureObject(); creatureObject.ID = _creatureId; creatureObject.Location.Copy(GetParentEntity().GetPosition()); ECName ecName = null; if (GetParentEntity().GetEC(ref ecName)) { creatureObject.Name = ecName.Name; } ECFigure ecFigure = null; if (GetParentEntity().GetEC(ref ecFigure)) { creatureObject.Figure = ecFigure.Figure; } ECSex ecSex = null; if (GetParentEntity().GetEC(ref ecSex)) { creatureObject.Sex = ecSex.Sex; } ECMotto ecMotto = null; if (GetParentEntity().GetEC(ref ecMotto)) { creatureObject.Motto = ecMotto.Motto; } ECBadge ecBadge = null; if (GetParentEntity().GetEC(ref ecBadge)) { creatureObject.Badge = ecBadge.Badge; } ECPoolFigure ecPoolFigure = null; if (GetParentEntity().GetEC(ref ecPoolFigure)) { creatureObject.PoolFigure = ecPoolFigure.Figure; } return creatureObject; } } }