Hi all. Just thought I should contribute whenever I can as I have been helped a lot already
Usage: /revive <accountId> <characterId>
You should also add another fame line to the fame description whenever a character dies called 'CharacterId' to allow users to know their character Id should you want to revive them. Up to you tho
1. Navigate to 'AdminCommands.cs'
2. Insert the following code as a new command
Code:
internal class ReviveCommand : Command
{
public ReviveCommand()
: base("revive", >INSERT RANK<)
{
}
protected override bool Process(Player player, RealmTime time, string[] args)
{
if (args.Length == 2)
{
player.Manager.Database.DoActionAsync(db =>
{
var testcmd = db.CreateQuery();
testcmd.CommandText = "SELECT dead FROM characters WHERE accId=@accId AND charId=@charId";
testcmd.Parameters.AddWithValue("@accId", args[0]);
testcmd.Parameters.AddWithValue("@charId", args[1]);
try
{
bool success = (bool)testcmd.ExecuteScalar();
if (success)
{
var cmd = db.CreateQuery();
cmd.CommandText = "UPDATE characters SET hp=50, mp=50, dead=FALSE, deathTime='0000-00-00 00:00:00' WHERE accId=@accId AND charId=@charId";
cmd.Parameters.AddWithValue("@accId", args[0]);
cmd.Parameters.AddWithValue("@charId", args[1]);
cmd.ExecuteNonQuery();
var cmd2 = db.CreateQuery();
cmd2.CommandText = "DELETE FROM death WHERE accId=@accId AND chrId=@chrId";
cmd2.Parameters.AddWithValue("@accId", args[0]);
cmd2.Parameters.AddWithValue("@chrId", args[1]);
cmd2.ExecuteNonQuery();
player.SendInfo("Successfully revived!");
}
else
{
player.SendHelp("Character is not dead!");
}
}
catch (*********enceException)
{
player.SendHelp("Character does not yet exist!");
}
});
return true;
}
else
{
player.SendHelp("Usage: /revive <accId> <chrId>");
return false;
}
}
}
Obviously, replace the bold code with whatever system you're using for ranking.