[Fab] Tags in database+Updated /tag command+More
The tags in database, will be a picture tutorial, since it is hard to explain where to exactly put the code, you'll just have to navigate to the line numbers you see in the pic and add it yourself.
Then I will provide the new updated /tag command and a few more tiny commands.
The tut for tags in database is in size 4 so you can see the text easier with all the pictures around em.
Don't get scared when seeing the 4 spoilers lol, the tut is really short, the pictures just make it look big.
REMEMBER: EVERYTHING MUST BE WRITTEN SAME WAY, writing "tag" instead of "Tag" WILL CAUSE AN ERROR.. vs should correct it usually, but don't depend on it and then cry here complaining that you get errors but "followed all the steps".
Now, this is the nice part, this is the same how SD does theirs, most servers, the way they add tags, they do something like name = "[Example]" + name; and it messes with commands requiring player names such as /tell, but I am pretty sure this way "fixes" that
What you wanna do is go to source folder/wServer/realm/chatmanager.cs
Replace what is highlighted (which is the whole function lol)

with this
You will have to edit the .sql file as well, if you are running a server that is currently released and want to add this, it is not hard at all to reimport your old database, but ask someone else, I don't feel like explaining. (this will reset database after editing and reimporting, thats why i am saying that)
So go to source folder/db/rotmgprod.sql
and simply add this in
like this

SAVE, AND IMPORT THE STRUCT AGAIN JUST LIKE YOU DID WHEN YOU FIRST SET UP THE SERVER
Well the old /tag command just changed their name, but this is a better way of adding tags, so now this updated one changes the tag in database.
Suicides you, obviously
Idk if a clear inv command was released for fab, but oh well
Put any requests for another feature you want, or any errors below.
Then I will provide the new updated /tag command and a few more tiny commands.
The tut for tags in database is in size 4 so you can see the text easier with all the pictures around em.
Don't get scared when seeing the 4 spoilers lol, the tut is really short, the pictures just make it look big.
REMEMBER: EVERYTHING MUST BE WRITTEN SAME WAY, writing "tag" instead of "Tag" WILL CAUSE AN ERROR.. vs should correct it usually, but don't depend on it and then cry here complaining that you get errors but "followed all the steps".
Tags In Database
source/db/models.cs
Go to: source folder/db/models.cs and add this
Picture Example
Code:
[XmlElement("Tag")]
public string Tag { get; set; }
source/db/database.cs
Go to: source folder/db/database.cs
Add the lines that relate to tag, all of them will be highlighted in the pictures

THEN

Add the highlighted line at bottom of pic, and also Add the "tag" in the 'INSERT INTO accounts' line AS SHOWN IN THE PIC, not after rank, not before name, in between them, as shown!!!, and then scroll to the right to the end of that SAME EXACT LINE and add @tag right before @rank as seen in the pic, and again, add it before @rank just like how it is in the picture!!!!

THEN
Add the lines that relate to tag, all of them will be highlighted in the pictures

THEN

Add the highlighted line at bottom of pic, and also Add the "tag" in the 'INSERT INTO accounts' line AS SHOWN IN THE PIC, not after rank, not before name, in between them, as shown!!!, and then scroll to the right to the end of that SAME EXACT LINE and add @tag right before @rank as seen in the pic, and again, add it before @rank just like how it is in the picture!!!!

THEN
source/wServer/realm/chatmanager.cs
Now, this is the nice part, this is the same how SD does theirs, most servers, the way they add tags, they do something like name = "[Example]" + name; and it messes with commands requiring player names such as /tell, but I am pretty sure this way "fixes" that
What you wanna do is go to source folder/wServer/realm/chatmanager.cs
Replace what is highlighted (which is the whole function lol)

with this
Code:
public void Say(Player src, string text)
{
string tag = "";
if (src.Client.Account.Tag != "")
tag = "[" + src.Client.Account.Tag + "] ";
src.Owner.BroadcastPacketSync(new TextPacket()
{
Name = (src.Client.Account.Rank >= 2 ? "@" : src.Client.Account.Rank >= 1 ? "#" : "") + tag + src.Name,
ObjectId = src.Id,
Stars = src.Stars,
BubbleTime = 10,
Recipient = "",
Text = text.ToSafeText(),
CleanText = text.ToSafeText()
}, p => !p.Ignored.Contains(src.AccountId));
log.InfoFormat("[{0}({1})] <{2}> {3}", src.Owner.Name, src.Owner.Id, src.Name, text);
src.Owner.ChatReceived(text);
}
source/db/rotmgprod.sql
You will have to edit the .sql file as well, if you are running a server that is currently released and want to add this, it is not hard at all to reimport your old database, but ask someone else, I don't feel like explaining. (this will reset database after editing and reimporting, thats why i am saying that)
So go to source folder/db/rotmgprod.sql
and simply add this in
Code:
`tag` varchar(11) NOT NULL DEFAULT '',

SAVE, AND IMPORT THE STRUCT AGAIN JUST LIKE YOU DID WHEN YOU FIRST SET UP THE SERVER
Updated /tag command
Well the old /tag command just changed their name, but this is a better way of adding tags, so now this updated one changes the tag in database.
Code:
internal class TagCommand : Command
{
public TagCommand() : base("tag") {}
protected override bool Process(Player player, RealmTime time, string[] args)
{
if (string.IsNullOrEmpty(args[0]))
{
player.SendHelp("******************************************************************");
player.SendHelp("Usage: /tag <TagYouWant>");
player.SendHelp("8 Character Limit");
player.SendHelp("No Spaces, Ex: ''My Tag'', but ''MyTag'' is fine.");
player.SendHelp("No Profanity");
player.SendHelp("No tags relating/similar to a staff/donator tag");
player.SendHelp("******************************************************************");
return false;
}
if (args.Length == 1)
{
if (player.Client.Account.Credits < 50)
{
player.SendError("Not enough credits. Credits needed: 50 or above.");
return false;
}
if (player.Client.Account.Credits >= 50)
{
player.Manager.Database.DoActionAsync(db =>
{
player.Client.Account.Tag = args[0];
player.Credits = db.UpdateCredit(player.Client.Account, -50);
player.UpdateCount++;
});
int cred = player.Client.Account.Credits - 50;
player.SendInfo("Your tag is now: " + args[0]);
player.SendInfo("You now have " + cred + " gold!");
return true;
}
}
return true;
}
}
Some more junk
Suicides you, obviously
Code:
internal class SuicideCommand : Command
{
public SuicideCommand()
: base("suicide")
{
}
protected override bool Process(Player player, RealmTime time, string[] args)
{
player.HP = 0;
player.Death("deez nuts"); //what is will say has killed you
return true;
}
}
Code:
internal class CICommand : Command
{
public CICommand() : base("ci") { }
protected override bool Process(Player player, RealmTime time, string[] args)
{
for (int i = 0; i < player.Inventory.Length; i++)
{
player.Inventory[i] = null;
player.UpdateCount++;
}
player.SendInfo("Inventory Cleared");
return true;
}
}
Put any requests for another feature you want, or any errors below.



