Exemplo n.º 1
0
        public void Execute(IActor actor, ITrigger trigger = null) {
            if (actor.StanceState != CharacterStanceState.Decomposing) {
                Commands.CommandParser.ExecuteCommand(actor, "EMOTE", "carcass last bit of flesh has rotted away from its dead corpse.");
                actor.Description = "The only remains of " + actor.FirstName + " are just bones.";
                actor.SetStanceState(CharacterStanceState.Decomposing);
                ((NPC)actor).NextAiAction = DateTime.Now.AddMinutes(5).ToUniversalTime();
            }
            else {
                Commands.CommandParser.ExecuteCommand(actor, "EMOTE", "carcass has its bones break down to dust and carried off by the wind.");
                var mobCollection = MongoUtils.MongoData.GetCollection<BsonDocument>("World", "NPCs");
                var doc = MongoUtils.MongoData.RetrieveObject<BsonDocument>(mobCollection, n => n["_id"] == ((NPC)actor).MobTypeID);

                doc["Current"] = doc["Current"].AsInt32 - 1;
                actor.Save();

                var npcCollection = MongoUtils.MongoData.GetCollection<NPC>("Characters", "NPCCharacters");
                var deleteResult = npcCollection.DeleteOne(new BsonDocument("_id", actor.Id));
            }
        }