This is a read only copy without any forum functionality of the old Modcraft forum.
If there is anything that you would like to have removed, message me on Discord via Kaev#5208.
Big thanks to Alastor for making this copy!

Menu

Author Topic: [C++] Trinity Announce System  (Read 4915 times)

Everon Mightbane

  • Registred Member
  • Loreweaver
  • *****
  • Posts: 89
    • View Profile
[C++] Trinity Announce System
« on: August 24, 2011, 09:09:53 pm »
Hey does anyone have or know about a trinity announce system that roughly outputs:

Servername Rank PlayerName: Message

So for example


CoolWoW Admin Bob: Hello world.

Thanks in advance.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Laniax

  • Registred Member
  • Polygonshifter
  • *****
  • Posts: 62
    • View Profile
Re: [C++] Trinity Announce System
« Reply #1 on: August 25, 2011, 12:10:51 am »
you can mod the announce command to include the servername. check out the cs_* and level* files.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
Current project: AIO Emulation solution.

Everon Mightbane

  • Registred Member
  • Loreweaver
  • *****
  • Posts: 89
    • View Profile
Re: [C++] Trinity Announce System
« Reply #2 on: August 25, 2011, 11:32:06 am »
Yeah, I've been able to include the server name but I haven't managed to do the rank part.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Laniax

  • Registred Member
  • Polygonshifter
  • *****
  • Posts: 62
    • View Profile
Re: [C++] Trinity Announce System
« Reply #3 on: August 25, 2011, 11:21:08 pm »
You could call the player's GMlevel and then based on that level add a rank to the command

for example:

Code: [Select]
uint32 gmlevel = player->GetSession()->GetSecurity();
std::string rank;
switch (gmlevel)
{
   case 1: // gmlevel is 1
     rank = "Moderator"; break;
  case 2: // gmlevel is 2
     rank = "Game Master"; break;
   case 3: // gmlevel is 3
     rank = "Server Admin"; break;
default: rank = ""; break;
}

that way the 'rank' string has the current playerrank, you can simple add this inside the announce. Adding more ranks should be easy.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
Current project: AIO Emulation solution.

schlumpf

  • Administrator
  • Creator of Worlds
  • *****
  • Posts: 2967
    • View Profile
Re: [C++] Trinity Announce System
« Reply #4 on: August 25, 2011, 11:28:08 pm »
Quote from: "Laniax"
You could call the player's GMlevel and then based on that level add a rank to the command

for example:

Code: [Select]
uint32 gmlevel = player->GetSession()->GetSecurity();
std::string rank;
switch (gmlevel)
{
   case 1: // gmlevel is 1
     rank = "Moderator"; break;
  case 2: // gmlevel is 2
     rank = "Game Master"; break;
   case 3: // gmlevel is 3
     rank = "Server Admin"; break;
default: rank = ""; break;
}

that way the 'rank' string has the current playerrank, you can simple add this inside the announce. Adding more ranks should be easy.

I hope their rank variable is enumerated. You may want to use that enumeration instead.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Laniax

  • Registred Member
  • Polygonshifter
  • *****
  • Posts: 62
    • View Profile
Re: [C++] Trinity Announce System
« Reply #5 on: August 25, 2011, 11:37:14 pm »
Quote from: "schlumpf"
I hope their rank variable is enumerated. You may want to use that enumeration instead.

It is, and GetSecurity() returns the value of that. yet you have to put a string with that int yourself.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
Current project: AIO Emulation solution.

schlumpf

  • Administrator
  • Creator of Worlds
  • *****
  • Posts: 2967
    • View Profile
Re: [C++] Trinity Announce System
« Reply #6 on: August 25, 2011, 11:38:16 pm »
Quote from: "Laniax"
Quote from: "schlumpf"
I hope their rank variable is enumerated. You may want to use that enumeration instead.

It is, and GetSecurity() returns the value of that. yet you have to put a string with that int yourself.
Yes, but you shouldn't compare to 1, 2 and 3 then but against the names of the enumeration, to be safe and verbose.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Laniax

  • Registred Member
  • Polygonshifter
  • *****
  • Posts: 62
    • View Profile
Re: [C++] Trinity Announce System
« Reply #7 on: August 25, 2011, 11:42:54 pm »
Quote from: "schlumpf"
Quote from: "Laniax"
Quote from: "schlumpf"
I hope their rank variable is enumerated. You may want to use that enumeration instead.

It is, and GetSecurity() returns the value of that. yet you have to put a string with that int yourself.
Yes, but you shouldn't compare to 1, 2 and 3 then but against the names of the enumeration, to be safe and verbose.

Yeah alright :P i wasn't applying code styles eitherway since i wrote this in 10secs.
Yet with your way it would look like this;

Code: [Select]
  case SEC_MODERATOR:
     rank = "Moderator"; break;
  case SEC_GAMEMASTER:
     rank = "Game Master"; break;
   case SEC_ADMINISTRATOR:
     rank = "Server Admin"; break;
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
Current project: AIO Emulation solution.

Everon Mightbane

  • Registred Member
  • Loreweaver
  • *****
  • Posts: 89
    • View Profile
Re: [C++] Trinity Announce System
« Reply #8 on: August 26, 2011, 12:11:52 am »
Alright, Just compiling now. Lets see how this goes :D Thanks for your help everyone.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Everon Mightbane

  • Registred Member
  • Loreweaver
  • *****
  • Posts: 89
    • View Profile
Re: [C++] Trinity Announce System
« Reply #9 on: August 27, 2011, 01:54:09 pm »
It didn't work so far but I'm going to tinker with it, one thing though. As trinity only has the account permissions 0-4, 4 being the console, is there anyway to increase the number? Or change it to like az a p - As in alphabetical account permissions?
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Laniax

  • Registred Member
  • Polygonshifter
  • *****
  • Posts: 62
    • View Profile
Re: [C++] Trinity Announce System
« Reply #10 on: August 27, 2011, 03:02:16 pm »
Quote from: "Everon Mightbane"
It didn't work so far but I'm going to tinker with it, one thing though. As trinity only has the account permissions 0-4, 4 being the console, is there anyway to increase the number? Or change it to like az a p - As in alphabetical account permissions?

You can add more account permission levels in Common.h atleast if you keep your SEC_CONSOLE as the last one. The security level required to do commands is held in the Command table in your database. so you will probably have to update all those records. (can be done with a few lines of SQL)
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
Current project: AIO Emulation solution.

Everon Mightbane

  • Registred Member
  • Loreweaver
  • *****
  • Posts: 89
    • View Profile
Re: [C++] Trinity Announce System
« Reply #11 on: August 27, 2011, 03:36:32 pm »
Thanks :D I'll work on that now. EDIT: Also, can I change them to alphabetic characters so for example:

SEC_ADMINISTRATOR = "az",

Would that work?
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Laniax

  • Registred Member
  • Polygonshifter
  • *****
  • Posts: 62
    • View Profile
Re: [C++] Trinity Announce System
« Reply #12 on: August 27, 2011, 09:20:14 pm »
Quote from: "Everon Mightbane"
Thanks :D I'll work on that now. EDIT: Also, can I change them to alphabetic characters so for example:

SEC_ADMINISTRATOR = "az",

Would that work?

No that won't work, you cannot enumerate anything else then integers
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
Current project: AIO Emulation solution.

Everon Mightbane

  • Registred Member
  • Loreweaver
  • *****
  • Posts: 89
    • View Profile
Re: [C++] Trinity Announce System
« Reply #13 on: August 27, 2011, 09:49:02 pm »
Yeah, I worked that out after I attempted to compile it, Is there any way I can change that?
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Laniax

  • Registred Member
  • Polygonshifter
  • *****
  • Posts: 62
    • View Profile
Re: [C++] Trinity Announce System
« Reply #14 on: August 27, 2011, 09:59:32 pm »
Quote from: "Everon Mightbane"
Yeah, I worked that out after I attempted to compile it, Is there any way I can change that?
I'm afraid there isn't an easy way, no. :P
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
Current project: AIO Emulation solution.