using System.Collections.Generic;
using uLink;
namespace Oxide.Plugins
{
[Info("CustomDeathMessages", "Trentu", "1.0.4")]
[Description("Just displays custom death messages.")]
class CustomDeathMessages : HurtworldPlugin
{
protected override void LoadDefaultConfig()
void LoadDefaultMessages()
{
var messages = new Dictionary<string, string>
{
{"EntityStats/Sources/Fall Damage","{Name} разбился насмерть"},
{"EntityStats/Sources/Damage Over Time","{Name} just died"},
{"EntityStats/Sources/Radiation Poisoning","{Name} just died"},
{"EntityStats/Sources/Starvation","{Name} just died"},
{"EntityStats/Sources/Hypothermia","{Name} just died"},
{"EntityStats/Sources/Asphyxiation","{Name} just died"},
{"EntityStats/Sources/Poison","{Name} just died"},
{"EntityStats/Sources/Burning","{Name} just died"},
{"EntityStats/Sources/Suicide","{Name} committed suicide"},
{"EntityStats/Sources/Explosives","{Name} dead by explosion"},
{"EntityStats/Sources/a Vehicle Impact","{Name} killed by a car"},
{"Creatures/Tokar","{Name} got killed by Tokar"},
{"Creatures/Shigi","{Name} got killed by a Shigi"},
{"Creatures/Bor","{Name} got killed by a Bor"},
{"Creatures/Yeti","{Name} got killed by a Yeti"},
{"player","{Name} got killed by {Killer}"},
{"Unknown","{Name} just died on a mystic way"}
};
lang.RegisterMessages(messages, this);
}
void Loaded() => LoadDefaultMessages();
string GetNameOfObject(UnityEngine.GameObject obj){
//NetworkView view = obj.GetComponent<uLink.NetworkView>();
var ManagerInstance = GameManager.Instance;
return ManagerInstance.GetDescriptionKey(obj);
}
object OnDeathNotice(string name, EntityEffectSourceData source)
{
string KillerName = GetNameOfObject(source.EntitySource);
if(KillerName == ""){
hurt.BroadcastChat((lang.GetMessage(source.SourceDescriptionKey, this) ?? lang.GetMessage("Unknown", this)).Replace("{Name}", name));
}else{
hurt.BroadcastChat((lang.GetMessage(source.SourceDescriptionKey, this) ?? lang.GetMessage("player", this)).Replace("{Name}", name).Replace("{Killer}", KillerName));
}
return true;
}
}
}