This script announces the name, race, and class of the newly created character to the rest of the server.
V1.1: Thank Karyuudo for the DK fix
Source
NewCharacter.cpp:
Code:
/*
Author: insanesk8123 (Pragma)
Date: 9/25/08
DK Fix: Karyuudo
Purpose: make a greeting for new characters
todo: nothing right now
*/
#include "StdAfx.h"
#include "Setup.h"
#include <ScriptSetup.h>
#ifdef WIN32
#pragma warning(disable:4305)// warning C4305: 'argument' : truncation from 'double' to 'float'
#endif
void NewCharacter(Player* Plr)
{
char welcomeStr[255]; //final string to be displayed
plrInfo classInfo;
plrInfo raceInfo;
/* Getting integer info for class and race */
classInfo.intForm = Plr->getClass();
raceInfo.intForm = Plr->getRace();
//turning the int class id into a string
switch(classInfo.intForm)
{
case 1:
classInfo.strForm = "Warrior";
break;
case 2:
classInfo.strForm = "Paladin";
break;
case 3:
classInfo.strForm = "Hunter";
break;
case 4:
classInfo.strForm = "Rogue";
break;
case 5:
classInfo.strForm = "Priest";
break;
case 6:
classInfo.strForm = "Death Knight";
break;
case 7:
classInfo.strForm = "Shaman";
break;
case 8:
classInfo.strForm = "Mage";
break;
case 9:
classInfo.strForm = "Warlock";
break;
case 11:
classInfo.strForm = "Druid";
break;
default:
classInfo.strForm = "";
break;
}
//turning the int race id into a string
switch(raceInfo.intForm)
{
case 1:
raceInfo.strForm = "Human";
break;
case 2:
raceInfo.strForm = "Orc";
break;
case 3:
raceInfo.strForm = "Dwarf";
break;
case 4:
raceInfo.strForm = "Night Elf";
break;
case 5:
raceInfo.strForm = "Undead";
break;
case 6:
raceInfo.strForm = "Tauren";
break;
case 7:
raceInfo.strForm = "Gnome";
break;
case 8:
raceInfo.strForm = "Troll";
break;
case 10:
raceInfo.strForm = "Blood Elf";
break;
case 11:
raceInfo.strForm = "Draenei";
break;
default:
raceInfo.strForm = "";
break;
}
//combines all the strings into one message
sprintf(welcomeStr,"[|cff00ff00News!|r]Give a warm welcome to |cff00ccff%s|r the |cffff0000%s|r |cffff00ff%s|r.",Plr->GetName(), raceInfo.strForm, classInfo.strForm);
//displays the message to the world
sWorld.SendWorldText(welcomeStr);
}
extern "C" SCRIPT_DECL uint32 _exp_get_script_type()
{
return SCRIPT_TYPE_MISC;
}
extern "C" SCRIPT_DECL void _exp_script_register(ScriptMgr* mgr)
{
mgr->register_hook(SERVER_HOOK_EVENT_ON_FIRST_ENTER_WORLD, &NewCharacter);
}
Setup.h
Code:
struct plrInfo
{
uint8 intForm;
char * strForm; /*stores info of player in both variable types*/
};
void NewCharacter(Player* Plr);
Download DLL for ascent 5.0: Filebeam - Free Fast File Hosting