Beispiel #1
0
    public override BaseCorpse CreateCorpse()
    {
        int        i;
        BaseCorpse baseCorpse;

        using (TimeWarning timeWarning = TimeWarning.New("Create corpse", 0.1f))
        {
            NPCPlayerCorpse nPCPlayerCorpse = base.DropCorpse("assets/prefabs/npc/murderer/murderer_corpse.prefab") as NPCPlayerCorpse;
            if (nPCPlayerCorpse)
            {
                nPCPlayerCorpse.SetLootableIn(2f);
                nPCPlayerCorpse.SetFlag(BaseEntity.Flags.Reserved5, base.HasPlayerFlag(BasePlayer.PlayerFlags.DisplaySash), false, true);
                nPCPlayerCorpse.SetFlag(BaseEntity.Flags.Reserved2, true, false, true);
                int num = 0;
                while (num < this.inventory.containerWear.itemList.Count)
                {
                    Item item = this.inventory.containerWear.itemList[num];
                    if (item == null || !(item.info.shortname == "gloweyes"))
                    {
                        num++;
                    }
                    else
                    {
                        this.inventory.containerWear.Remove(item);
                        break;
                    }
                }
                nPCPlayerCorpse.TakeFrom(new ItemContainer[] { this.inventory.containerMain, this.inventory.containerWear, this.inventory.containerBelt });
                nPCPlayerCorpse.playerName    = base.displayName;
                nPCPlayerCorpse.playerSteamID = this.userID;
                nPCPlayerCorpse.Spawn();
                nPCPlayerCorpse.TakeChildren(this);
                ItemContainer[] itemContainerArray = nPCPlayerCorpse.containers;
                for (i = 0; i < (int)itemContainerArray.Length; i++)
                {
                    itemContainerArray[i].Clear();
                }
                if (this.LootSpawnSlots.Length != 0)
                {
                    LootContainer.LootSpawnSlot[] lootSpawnSlots = this.LootSpawnSlots;
                    for (i = 0; i < (int)lootSpawnSlots.Length; i++)
                    {
                        LootContainer.LootSpawnSlot lootSpawnSlot = lootSpawnSlots[i];
                        for (int j = 0; j < lootSpawnSlot.numberToSpawn; j++)
                        {
                            if (UnityEngine.Random.Range(0f, 1f) <= lootSpawnSlot.probability)
                            {
                                lootSpawnSlot.definition.SpawnIntoContainer(nPCPlayerCorpse.containers[0]);
                            }
                        }
                    }
                }
            }
            baseCorpse = nPCPlayerCorpse;
        }
        return(baseCorpse);
    }
 public override BaseCorpse OnCreateCorpse(HTNPlayer target)
 {
     if (this.DeathEffect.isValid)
     {
         Effect.server.Run(this.DeathEffect.resourcePath, (BaseEntity)target, 0U, Vector3.get_zero(), Vector3.get_zero(), (Connection)null, false);
     }
     using (TimeWarning.New("Create corpse", 0.1f))
     {
         NPCPlayerCorpse npcPlayerCorpse = target.DropCorpse("assets/prefabs/npc/murderer/murderer_corpse.prefab") as NPCPlayerCorpse;
         if (Object.op_Implicit((Object)npcPlayerCorpse))
         {
             if (Object.op_Inequality((Object)target.AiDomain, (Object)null) && Object.op_Inequality((Object)target.AiDomain.NavAgent, (Object)null) && target.AiDomain.NavAgent.get_isOnNavMesh())
             {
                 ((Component)npcPlayerCorpse).get_transform().set_position(Vector3.op_Addition(((Component)npcPlayerCorpse).get_transform().get_position(), Vector3.op_Multiply(Vector3.get_down(), target.AiDomain.NavAgent.get_baseOffset())));
             }
             npcPlayerCorpse.SetLootableIn(2f);
             npcPlayerCorpse.SetFlag(BaseEntity.Flags.Reserved5, target.HasPlayerFlag(BasePlayer.PlayerFlags.DisplaySash), false, true);
             npcPlayerCorpse.SetFlag(BaseEntity.Flags.Reserved2, true, false, true);
             for (int index = 0; index < target.inventory.containerWear.itemList.Count; ++index)
             {
                 Item obj = target.inventory.containerWear.itemList[index];
                 if (obj != null && obj.info.shortname == "gloweyes")
                 {
                     target.inventory.containerWear.Remove(obj);
                     break;
                 }
             }
             npcPlayerCorpse.TakeFrom(target.inventory.containerMain, target.inventory.containerWear, target.inventory.containerBelt);
             npcPlayerCorpse.playerName    = target.displayName;
             npcPlayerCorpse.playerSteamID = target.userID;
             npcPlayerCorpse.Spawn();
             npcPlayerCorpse.TakeChildren((BaseEntity)target);
             foreach (ItemContainer container in npcPlayerCorpse.containers)
             {
                 container.Clear();
             }
             if (this.Loot.Length != 0)
             {
                 foreach (LootContainer.LootSpawnSlot lootSpawnSlot in this.Loot)
                 {
                     for (int index = 0; index < lootSpawnSlot.numberToSpawn; ++index)
                     {
                         if ((double)Random.Range(0.0f, 1f) <= (double)lootSpawnSlot.probability)
                         {
                             lootSpawnSlot.definition.SpawnIntoContainer(npcPlayerCorpse.containers[0]);
                         }
                     }
                 }
             }
         }
         return((BaseCorpse)npcPlayerCorpse);
     }
 }
Beispiel #3
0
        public override BaseCorpse OnCreateCorpse(HTNPlayer target)
        {
            int        i;
            BaseCorpse baseCorpse;

            if (this.DeathEffect.isValid)
            {
                Effect.server.Run(this.DeathEffect.resourcePath, target, 0, Vector3.zero, Vector3.zero, null, false);
            }
            using (TimeWarning timeWarning = TimeWarning.New("Create corpse", 0.1f))
            {
                NPCPlayerCorpse navAgent = target.DropCorpse("assets/prefabs/npc/scientist/scientist_corpse.prefab") as NPCPlayerCorpse;
                if (navAgent)
                {
                    if (target.AiDomain != null && target.AiDomain.NavAgent != null && target.AiDomain.NavAgent.isOnNavMesh)
                    {
                        navAgent.transform.position = navAgent.transform.position + (Vector3.down * target.AiDomain.NavAgent.baseOffset);
                    }
                    navAgent.SetLootableIn(2f);
                    navAgent.SetFlag(BaseEntity.Flags.Reserved5, target.HasPlayerFlag(BasePlayer.PlayerFlags.DisplaySash), false, true);
                    navAgent.SetFlag(BaseEntity.Flags.Reserved2, true, false, true);
                    navAgent.TakeFrom(new ItemContainer[] { target.inventory.containerMain, target.inventory.containerWear, target.inventory.containerBelt });
                    navAgent.playerName    = target.displayName;
                    navAgent.playerSteamID = target.userID;
                    navAgent.Spawn();
                    navAgent.TakeChildren(target);
                    ItemContainer[] itemContainerArray = navAgent.containers;
                    for (i = 0; i < (int)itemContainerArray.Length; i++)
                    {
                        itemContainerArray[i].Clear();
                    }
                    if (this.Loot.Length != 0)
                    {
                        LootContainer.LootSpawnSlot[] loot = this.Loot;
                        for (i = 0; i < (int)loot.Length; i++)
                        {
                            LootContainer.LootSpawnSlot lootSpawnSlot = loot[i];
                            for (int j = 0; j < lootSpawnSlot.numberToSpawn; j++)
                            {
                                if (UnityEngine.Random.Range(0f, 1f) <= lootSpawnSlot.probability)
                                {
                                    lootSpawnSlot.definition.SpawnIntoContainer(navAgent.containers[0]);
                                }
                            }
                        }
                    }
                }
                baseCorpse = navAgent;
            }
            return(baseCorpse);
        }
Beispiel #4
0
 public override BaseCorpse CreateCorpse()
 {
     using (TimeWarning.New("Create corpse"))
     {
         NPCPlayerCorpse nPCPlayerCorpse = DropCorpse("assets/prefabs/npc/scientist/scientist_corpse.prefab") as NPCPlayerCorpse;
         if ((bool)nPCPlayerCorpse)
         {
             nPCPlayerCorpse.transform.position = nPCPlayerCorpse.transform.position + Vector3.down * NavAgent.baseOffset;
             nPCPlayerCorpse.SetLootableIn(2f);
             nPCPlayerCorpse.SetFlag(Flags.Reserved5, HasPlayerFlag(PlayerFlags.DisplaySash));
             nPCPlayerCorpse.SetFlag(Flags.Reserved2, true);
             nPCPlayerCorpse.TakeFrom(inventory.containerMain, inventory.containerWear, inventory.containerBelt);
             nPCPlayerCorpse.playerName    = OverrideCorpseName();
             nPCPlayerCorpse.playerSteamID = userID;
             nPCPlayerCorpse.Spawn();
             nPCPlayerCorpse.TakeChildren(this);
             ItemContainer[] containers = nPCPlayerCorpse.containers;
             for (int i = 0; i < containers.Length; i++)
             {
                 containers[i].Clear();
             }
             if (LootSpawnSlots.Length != 0)
             {
                 object obj = Interface.CallHook("OnCorpsePopulate", this, nPCPlayerCorpse);
                 if (obj is BaseCorpse)
                 {
                     return((BaseCorpse)obj);
                 }
                 LootContainer.LootSpawnSlot[] lootSpawnSlots = LootSpawnSlots;
                 for (int i = 0; i < lootSpawnSlots.Length; i++)
                 {
                     LootContainer.LootSpawnSlot lootSpawnSlot = lootSpawnSlots[i];
                     for (int j = 0; j < lootSpawnSlot.numberToSpawn; j++)
                     {
                         if (UnityEngine.Random.Range(0f, 1f) <= lootSpawnSlot.probability)
                         {
                             lootSpawnSlot.definition.SpawnIntoContainer(nPCPlayerCorpse.containers[0]);
                         }
                     }
                 }
             }
         }
         return(nPCPlayerCorpse);
     }
 }
Beispiel #5
0
 public override BaseCorpse CreateCorpse()
 {
     using (TimeWarning.New("Create corpse", 0.1f))
     {
         NPCPlayerCorpse npcPlayerCorpse = this.DropCorpse("assets/prefabs/npc/murderer/murderer_corpse.prefab") as NPCPlayerCorpse;
         if (Object.op_Implicit((Object)npcPlayerCorpse))
         {
             npcPlayerCorpse.SetLootableIn(2f);
             npcPlayerCorpse.SetFlag(BaseEntity.Flags.Reserved5, this.HasPlayerFlag(BasePlayer.PlayerFlags.DisplaySash), false, true);
             npcPlayerCorpse.SetFlag(BaseEntity.Flags.Reserved2, true, false, true);
             for (int index = 0; index < this.inventory.containerWear.itemList.Count; ++index)
             {
                 Item obj = this.inventory.containerWear.itemList[index];
                 if (obj != null && obj.info.shortname == "gloweyes")
                 {
                     this.inventory.containerWear.Remove(obj);
                     break;
                 }
             }
             npcPlayerCorpse.TakeFrom(this.inventory.containerMain, this.inventory.containerWear, this.inventory.containerBelt);
             npcPlayerCorpse.playerName    = this.displayName;
             npcPlayerCorpse.playerSteamID = this.userID;
             npcPlayerCorpse.Spawn();
             npcPlayerCorpse.TakeChildren((BaseEntity)this);
             foreach (ItemContainer container in npcPlayerCorpse.containers)
             {
                 container.Clear();
             }
             if (this.LootSpawnSlots.Length != 0)
             {
                 foreach (LootContainer.LootSpawnSlot lootSpawnSlot in this.LootSpawnSlots)
                 {
                     for (int index = 0; index < lootSpawnSlot.numberToSpawn; ++index)
                     {
                         if ((double)Random.Range(0.0f, 1f) <= (double)lootSpawnSlot.probability)
                         {
                             lootSpawnSlot.definition.SpawnIntoContainer(npcPlayerCorpse.containers[0]);
                         }
                     }
                 }
             }
         }
         return((BaseCorpse)npcPlayerCorpse);
     }
 }
Beispiel #6
0
 public override BaseCorpse CreateCorpse()
 {
     using (TimeWarning.New("Create corpse", 0.1f))
     {
         NPCPlayerCorpse npcPlayerCorpse = this.DropCorpse("assets/prefabs/npc/scientist/scientist_corpse.prefab") as NPCPlayerCorpse;
         if (Object.op_Implicit((Object)npcPlayerCorpse))
         {
             ((Component)npcPlayerCorpse).get_transform().set_position(Vector3.op_Addition(((Component)npcPlayerCorpse).get_transform().get_position(), Vector3.op_Multiply(Vector3.get_down(), this.NavAgent.get_baseOffset())));
             npcPlayerCorpse.SetLootableIn(2f);
             npcPlayerCorpse.SetFlag(BaseEntity.Flags.Reserved5, this.HasPlayerFlag(BasePlayer.PlayerFlags.DisplaySash), false, true);
             npcPlayerCorpse.SetFlag(BaseEntity.Flags.Reserved2, true, false, true);
             npcPlayerCorpse.TakeFrom(this.inventory.containerMain, this.inventory.containerWear, this.inventory.containerBelt);
             npcPlayerCorpse.playerName    = this.displayName;
             npcPlayerCorpse.playerSteamID = this.userID;
             npcPlayerCorpse.Spawn();
             npcPlayerCorpse.TakeChildren((BaseEntity)this);
             foreach (ItemContainer container in npcPlayerCorpse.containers)
             {
                 container.Clear();
             }
             if (this.LootSpawnSlots.Length != 0)
             {
                 foreach (LootContainer.LootSpawnSlot lootSpawnSlot in this.LootSpawnSlots)
                 {
                     for (int index = 0; index < lootSpawnSlot.numberToSpawn; ++index)
                     {
                         if ((double)Random.Range(0.0f, 1f) <= (double)lootSpawnSlot.probability)
                         {
                             lootSpawnSlot.definition.SpawnIntoContainer(npcPlayerCorpse.containers[0]);
                         }
                     }
                 }
             }
         }
         return((BaseCorpse)npcPlayerCorpse);
     }
 }