Пример #1
0
        public Bot(uint Id, uint DefId, string BehaviorType, string Name, string Look, string Motto, uint RoomId, Vector3 Position,
            Vector2 ServePosition, List<Vector2> DefinedPositions, BotWalkMode WalkMode, bool Kickable, int Rotation,
            List<BotResponse> Responses, int Effect, int ResponseDistance, Pet PetData = null)
        {
            mId = Id;
            mDefinitionId = DefId;
            mBehaviorType = BehaviorType;
            mName = Name;
            mLook = Look;
            mMotto = Motto;
            mRoomId = RoomId;
            mInitialPosition = Position;
            mServePosition = ServePosition;
            mDefinedPositions = DefinedPositions;
            mWalkMode = WalkMode;
            mKickable = Kickable;
            mRotation = Rotation;
            mEffect = Effect;
            mResponses = Responses;
            mResponseDistance = ResponseDistance;
            mPetData = PetData;

            switch (mBehaviorType.ToLower())
            {
                case "pet":

                    mBrain = new PetBot();
                    break;

                default:

                    mBrain = new GenericBot();
                    break;
            }
        }
Пример #2
0
 public void Add(Pet Pet)
 {
     lock (mInner)
     {
         if (!mInner.ContainsKey(Pet.Id))
         {
             mInner.Add(Pet.Id, Pet);
         }
     }
 }
Пример #3
0
 public static ServerMessage Compose(Pet Pet)
 {
     ServerMessage Message = new ServerMessage(OpcodesOut.INVENTORY_PET_ADDED);
     Message.AppendUInt32(Pet.Id);
     Message.AppendStringWithBreak(Pet.Name);
     Message.AppendInt32(Pet.Type);
     Message.AppendInt32(Pet.Race);
     Message.AppendStringWithBreak(Pet.ColorCode);
     return Message;
 }
Пример #4
0
 public static ServerMessage Compose(uint DisplayId, Pet Pet)
 {
     ServerMessage Message = new ServerMessage(OpcodesOut.ROOM_PET_UPDATE);
     Message.AppendInt32(9);
     Message.AppendUInt32(DisplayId);
     Message.AppendUInt32(DisplayId);
     Message.AppendStringWithBreak(Pet.Name);
     Message.AppendInt32(Pet.Type);
     Message.AppendInt32(Pet.Race);
     Message.AppendStringWithBreak(Pet.ColorCode);
     return Message;
 }
Пример #5
0
        public static Bot CreateNewInstance(Bot Definition, uint RoomId, Vector3 Position, Pet PetData = null)
        {
            uint ResultId = 0;

            lock (mSyncRoot)
            {
                ResultId = mBotInstanceIdGenerator++;
            }

            Bot BotInstance = new Bot(ResultId, Definition.Id, Definition.BehaviorType, Definition.Name, Definition.Look,
                Definition.Motto, RoomId, Position, Definition.ServePosition, Definition.PredefinedPositions.ToList(),
                Definition.WalkMode, Definition.Kickable, Definition.Rotation, Definition.Responses, Definition.Effect,
                Definition.ResponseDistance, PetData);

            lock (mSyncRoot)
            {
                mBotInstances.Add(ResultId, BotInstance);
            }

            return BotInstance;
        }
Пример #6
0
        public static void MarkWriteback(Pet Pet)
        {
            lock (mWritebackPets)
            {
                if (mWritebackPets.Contains(Pet))
                {
                    return;
                }

                mWritebackPets.Add(Pet);
            }
        }