Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

Ascent [Release] Title Npc in C++

www.Warforge.Online
Joined
Jun 25, 2008
Messages
534
Reaction score
0
TITLE NPC IN C++​

Code:
#include "StdAfx.h"
#include "Setup.h"

/************************************ TITLE VENDOR **************************************/

class SCRIPT_DECL Titler : public GossipScript
{
public:
	void GossipHello(Object * pObject, Player* Plr, bool AutoSend);
	void GossipSelectOption(Object * pObject, Player* Plr, uint32 Id, uint32 IntId, const char * Code);
	void GossipEnd(Object * pObject, Player* Plr);
	void Destroy()
	{
		delete this;
	}
};

void Titler::GossipHello(Object * pObject, Player* Plr, bool AutoSend)
{
	GossipMenu *Menu;
	objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 1, Plr);
	Menu->AddItem(2, "Get a title", 0);
	Menu->AddItem(3, "What requirements do I need to meet for a PVP Title ?", 1);
	Menu->SendTo(Plr);
}
void Titler::GossipSelectOption(Object * pObject, Player* Plr, uint32 Id, uint32 IntId, const char * Code)
{
	Creature * pCreature = (pObject->GetTypeId()==TYPEID_UNIT)?((Creature*)pObject):NULL;
	if(pCreature==NULL)
		return;

	GossipMenu * Menu;
	switch(IntId)
	{
	case 0: //Title
		objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 1, Plr);

		for(int x = 1; x < 28; x++)
		{
			if(Plr->HasKnownTitle(x))
				Plr->RemoveKnownTitle(x);
		}

		if (Plr->GetTeam() > 0)
		{

			if (Plr->m_killsLifetime < 50)
			{
				if(!Plr->HasKnownTitle(15))
					Plr->AddKnownTitle(15);
				Plr->SetPVPRank(0);
				pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Your rank has been set to Scout! Please relog for the rank to become visible" );
			}

			else if (Plr->m_killsLifetime >= 50 && Plr->m_killsLifetime < 100)
			{
				if(!Plr->HasKnownTitle(16))
					Plr->AddKnownTitle(16);
				Plr->SetPVPRank(6);
				pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Your rank has been set to Grunt!" );
			}

			else if (Plr->m_killsLifetime >= 100 && Plr->m_killsLifetime < 200)
			{
				if(!Plr->HasKnownTitle(17))
					Plr->AddKnownTitle(17);
				Plr->SetPVPRank(7);
				pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Your rank has been set to Sergeant!" );

			}

			else if (Plr->m_killsLifetime >= 200 && Plr->m_killsLifetime < 400)
			{
				if(!Plr->HasKnownTitle(18))
					Plr->AddKnownTitle(18);
				Plr->SetPVPRank(8);
				pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Your rank has been set to Senior Sergeant!" );
			}

			else if (Plr->m_killsLifetime >= 400 && Plr->m_killsLifetime < 800)
			{
				if(!Plr->HasKnownTitle(19))
					Plr->AddKnownTitle(19);
				Plr->SetPVPRank(9);
			    pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Your rank has been set to First Sergeant!" );
			}

			else if (Plr->m_killsLifetime >= 1200 && Plr->m_killsLifetime < 2400)
			{
				if(!Plr->HasKnownTitle(20))
					Plr->AddKnownTitle(20);
				Plr->SetPVPRank(10);
				pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Your rank has been set to Stone Guard!" );
			}

			else if (Plr->m_killsLifetime >= 2400 && Plr->m_killsLifetime < 4800)
			{
				if(!Plr->HasKnownTitle(21))
					Plr->AddKnownTitle(21);
				Plr->SetPVPRank(11);
				pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Your rank has been set to Blood Guard!" );
			}

			else if (Plr->m_killsLifetime >= 4800 && Plr->m_killsLifetime < 9000)
			{
				if(!Plr->HasKnownTitle(22))
					Plr->AddKnownTitle(22);
				Plr->SetPVPRank(12);
				pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Your rank has been set to Legionnaire!" );
			}

			else if (Plr->m_killsLifetime >= 9000 && Plr->m_killsLifetime < 13000)
			{
				if(!Plr->HasKnownTitle(23))
					Plr->AddKnownTitle(23);
				Plr->SetPVPRank(13);
				pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Your rank has been set to Centurion!" );
			}

			else if (Plr->m_killsLifetime >= 13000 && Plr->m_killsLifetime < 18000)
			{
				if(!Plr->HasKnownTitle(24))
					Plr->AddKnownTitle(24);
				Plr->SetPVPRank(14);
				pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Your rank has been set to Champion!" );
			}

			else if (Plr->m_killsLifetime >= 18000 && Plr->m_killsLifetime < 20000)
			{
				if(!Plr->HasKnownTitle(25))
					Plr->AddKnownTitle(25);
				Plr->SetPVPRank(15);
				pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Your rank has been set to Lieutenant General!" );
			}

			else if (Plr->m_killsLifetime >= 20000 && Plr->m_killsLifetime < 24000)
			{
				if(!Plr->HasKnownTitle(26))
					Plr->AddKnownTitle(26);
				Plr->SetPVPRank(16);
				pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Your rank has been set to General!" );
			}

			else if (Plr->m_killsLifetime >= 24000 && Plr->m_killsLifetime < 50000)
			{
				if(!Plr->HasKnownTitle(27))
					Plr->AddKnownTitle(27);
				Plr->SetPVPRank(17);
				pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Your rank has been set to Warlord!" );
			}

			else if (Plr->m_killsLifetime >= 50000)
			{
				if(!Plr->HasKnownTitle(28))
					Plr->AddKnownTitle(28);
				Plr->SetPVPRank(18);
				pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Your rank has been set to High Warlord!" );
			}
			Plr->Gossip_Complete();
		}

		else
		{
			if (Plr->m_killsLifetime < 50)
			{
				if(!Plr->HasKnownTitle(1))
					Plr->AddKnownTitle(1);
				Plr->SetPVPRank(0);
				pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Your rank has been set to Private! Please relog for the rank to become visible" );
			}

			else if (Plr->m_killsLifetime >= 50 && Plr->m_killsLifetime < 100)
			{
				if(!Plr->HasKnownTitle(2))
					Plr->AddKnownTitle(2);
				Plr->SetPVPRank(6);
				pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Your rank has been set to Corporal!" );
			}

			else if (Plr->m_killsLifetime >= 100 && Plr->m_killsLifetime < 200)
			{
				if(!Plr->HasKnownTitle(3))
					Plr->AddKnownTitle(3);
				Plr->SetPVPRank(7);
				pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Your rank has been set to Sergeant!" );
			}

			else if (Plr->m_killsLifetime >= 200 && Plr->m_killsLifetime < 400)
			{
				if(!Plr->HasKnownTitle(4))
					Plr->AddKnownTitle(4);
				Plr->SetPVPRank(8);
				pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Your rank has been set to Master Sergeant!" );
			}

			else if (Plr->m_killsLifetime >= 400 && Plr->m_killsLifetime < 800)
			{
				if(!Plr->HasKnownTitle(5))
					Plr->AddKnownTitle(5);
				Plr->SetPVPRank(9);
				pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Your rank has been set to Sergeant Major!" );
			}

			else if (Plr->m_killsLifetime >= 1200 && Plr->m_killsLifetime < 2400)
			{
				if(!Plr->HasKnownTitle(6))
					Plr->AddKnownTitle(6);
				Plr->SetPVPRank(10);
				pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Your rank has been set to Knight!" );
			}

			else if (Plr->m_killsLifetime >= 2400 && Plr->m_killsLifetime < 4800)
			{
				if(!Plr->HasKnownTitle(7))
					Plr->AddKnownTitle(7);
				Plr->SetPVPRank(11);
				pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Your rank has been set to Knight Lieutenant!" );
			}

			else if (Plr->m_killsLifetime >= 4800 && Plr->m_killsLifetime < 9000)
			{
				if(!Plr->HasKnownTitle(8))
					Plr->AddKnownTitle(8);
				Plr->SetPVPRank(12);
				pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Your rank has been set to Knight Captain!" );
			}

			else if (Plr->m_killsLifetime >= 9000 && Plr->m_killsLifetime < 13000)
			{
				if(!Plr->HasKnownTitle(9))
					Plr->AddKnownTitle(9);
				Plr->SetPVPRank(13);
				pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Your rank has been set to Knight Champion!" );
			}

			else if (Plr->m_killsLifetime >= 13000 && Plr->m_killsLifetime < 18000)
			{
				if(!Plr->HasKnownTitle(10))
					Plr->AddKnownTitle(10);
				Plr->SetPVPRank(14);
				pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Your rank has been set to Lieutenant Commander!" );
			}

			else if (Plr->m_killsLifetime >= 18000 && Plr->m_killsLifetime < 20000)
			{
				if(!Plr->HasKnownTitle(11))
					Plr->AddKnownTitle(11);
				Plr->SetPVPRank(15);
				pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Your rank has been set to Commander!" );
			}

			else if (Plr->m_killsLifetime >= 20000 && Plr->m_killsLifetime < 24000)
			{
				if(!Plr->HasKnownTitle(12))
					Plr->AddKnownTitle(12);
				Plr->SetPVPRank(16);
				pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Your rank has been set to Marshal!" );
			}

			else if (Plr->m_killsLifetime >= 24000 && Plr->m_killsLifetime < 50000)
			{
				if(!Plr->HasKnownTitle(13))
					Plr->AddKnownTitle(13);
				Plr->SetPVPRank(17);
				pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Your rank has been set to Field Marshal!" );
			}

			else if (Plr->m_killsLifetime >= 50000)
			{
				if(!Plr->HasKnownTitle(14))
					Plr->AddKnownTitle(14);
				Plr->SetPVPRank(18);
				pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Your rank has been set to Grand Marshal!" );
			}
			Plr->Gossip_Complete();
		}
		break;

		case 1:
			GossipMenu *Menu;
			objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 1, Plr);
			if (Plr->GetTeam() > 0)
			{
				Menu->AddItem(18, "Scout- 0 Kills", 0);
				Menu->AddItem(19, "Grunt - 50 Kills", 0);
				Menu->AddItem(20, "Sergeant - 100 Kills", 0);
				Menu->AddItem(21, "Senior Sergeant - 200 Kills", 0);
				Menu->AddItem(22, "First Sergeant - 400 Kills", 0);
				Menu->AddItem(23, "Stone Guard - 1200 Kills", 0);
				Menu->AddItem(24, "Blood Guard - 2400 Kills", 0);
				Menu->AddItem(25, "Legionnaire - 4800 Kills", 0);
				Menu->AddItem(26, "Centurion - 9000 Kills", 0);
				Menu->AddItem(32, "Show more ranks", 32);
			}
			else
			{
				Menu->AddItem(4, "Private - 0 Kills", 0);
				Menu->AddItem(5, "Corporal - 50 Kills", 0);
				Menu->AddItem(6, "Sergeant - 100 Kills", 0);
				Menu->AddItem(7, "Master Sergeant - 200 Kills", 0);
				Menu->AddItem(8, "Sergeant Major - 400 Kills", 0);
				Menu->AddItem(9, "Knight - 1200 Kills", 0);
				Menu->AddItem(10, "Knight Lieutenant - 2400 Kills", 0);
				Menu->AddItem(11, "Knight Captain - 4800 Kills", 0);
				Menu->AddItem(12, "Knight Champion - 9000 Kills", 0);
				Menu->AddItem(33, "Show more ranks", 33);
			}
			Menu->SendTo(Plr);
			break;

		case 32:
			objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 1, Plr);
			Menu->AddItem(27, "Champion - 13000 Kills", 0);
			Menu->AddItem(28, "Lieutenant General - 18000 Kills", 0);
			Menu->AddItem(29, "General - 20000 Kills", 0);
			Menu->AddItem(30, "Warlord - 24000 Kills", 0);
			Menu->AddItem(31, "High Warlord - 50000 Kills", 0);
			Menu->AddItem(3, "What requirements do I need to meet for a PVP Title ?", 1);
			Menu->SendTo(Plr);
			break;

		case 33:
			objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 1, Plr);
			Menu->AddItem(13, "Lieutenant Commander - 13000 Kills", 0);
			Menu->AddItem(14, "Commander - 18000 Kills", 0);
			Menu->AddItem(15, "Marshal - 20000 Kills", 0);
			Menu->AddItem(16, "Field Marshal - 24000 Kills", 0);
			Menu->AddItem(17, "Grand Marshal - 50000 Kills", 0);
			Menu->AddItem(3, "What requirements do I need to meet for a PVP Title ?", 1);
			Menu->SendTo(Plr);
			break;
	}
}

void Titler::GossipEnd(Object * pObject, Player* Plr)
{
	GossipScript::GossipEnd(pObject, Plr);
}

void SetupTitler(ScriptMgr * mgr)
{
GossipScript * gs = (GossipScript*) new Titler();
	mgr->register_gossip_script(30090, gs);
}


SETUP.CPP

Code:
#include "StdAfx.h"
#include "Setup.h"

#include <ScriptSetup.h>

extern "C" SCRIPT_DECL uint32 _exp_get_script_type()
{
	return SCRIPT_TYPE_MISC;
}

extern "C" SCRIPT_DECL void _exp_script_register(ScriptMgr* mgr)
{
	SetupTitler(mgr);
}

#ifdef WIN32

BOOL APIENTRY DllMain( HANDLE hModule, DWORD  ul_reason_for_call, LPVOID lpReserved )
{
    return TRUE;
}

#endif


SETUP.H

Code:
#ifndef INSTANCE_SCRIPTS_SETUP_H
#define INSTANCE_SCRIPTS_SETUP_H

void SetupTitler(ScriptMgr * mgr);
;

#endif

Thanks to Scyther for the Help.

No pics ATM
 
Master Summoner
Joined
Oct 25, 2006
Messages
524
Reaction score
0
What exactly this does... anyway - thanks for the script
 
Skilled Illusionist
Joined
Jul 23, 2007
Messages
371
Reaction score
0
well i guess its a title vendor, by the looks on it, its the pvp titles..
 
Initiate Mage
Joined
Aug 3, 2006
Messages
4
Reaction score
0
A small tutorial on this would be perfect for us newbs.
The idea is simply great though.
 
Junior Spellweaver
Joined
Mar 22, 2008
Messages
169
Reaction score
0
is this really yours? i've seen this on the arcemu forum.. (ey dont shout, i've just seen it there, just asking)
 
Junior Spellweaver
Joined
Mar 23, 2008
Messages
135
Reaction score
2
nice script, gonna try it out when i find the time....

i was also looking for a way to bring back the old PvP ranking system,
but then maybe based on the new achievments system and give additional Title's,
when completing self made objectives.

Then u could like give a title for every raid u complete or something like that.
the titles are still in there only there not used.
So why not use them to do a few more cool things...
 
Junior Spellweaver
Joined
Mar 22, 2008
Messages
169
Reaction score
0
Really, ive seen this before.. XD.. using it for Arcemu atm.. works fine :S
 
Junior Spellweaver
Joined
Mar 23, 2008
Messages
135
Reaction score
2
if you put it like that, nothing is original.
Take arcemu...

Arcemu is based off ascent, so taking everything that literly.

"you can maybe shave the goat or pain it into another color, but you cant change it into a chicken..."

so please dont start with the originality comments on things like this...
 
www.Warforge.Online
Joined
Jun 25, 2008
Messages
534
Reaction score
0
Hmm, Guess they started Copy/pasting or reverting the function for Arcemu because i think they changed some functions in it hmm o well Arcemu can suk my balls any way
 
Back
Top