public void OnDeath(ShPlayer player) { if (player.svPlayer.lastAttacker && player.svPlayer.lastAttacker != player) { player.svPlayer.lastAttacker.job.OnKillPlayer(player); // Only drop items if attacker present, to prevent AI suicide item farming if (Physics.Raycast( player.GetPosition + Vector3.up, Vector3.down, out RaycastHit hit, 10f, MaskIndex.defaultMask)) { ShEntity briefcase = player.manager.svManager.AddNewEntity( player.manager.svManager.briefcasePrefabs.GetRandom(), player.GetPlace, hit.point, Quaternion.LookRotation(player.GetPositionT.forward, Vector3.up), false); if (briefcase) { foreach (KeyValuePair <int, InventoryItem> pair in player.myItems) { if (UnityEngine.Random.value < 0.8f) { InventoryItem i = new InventoryItem( pair.Value.item, Mathf.CeilToInt(pair.Value.count * UnityEngine.Random.Range(0.05f, 0.3f))); briefcase.myItems.Add(pair.Key, i); } } } } } player.RemoveItemsDeath(); player.svPlayer.ClearWitnessed(); player.DeactivateEffects(); if (!player.isHuman) { player.svPlayer.SetState(StateIndex.Null); } player.svPlayer.Send(SvSendType.Self, Channel.Reliable, ClPacket.ShowTimer, player.svPlayer.RespawnTime); player.SetStance(StanceIndex.Dead, true); }