Modcraft - The community dedicated to quality WoW modding!
Wrath of the Lich King Modding => Serverside Modding => Tutorials => Topic started by: glararan on October 31, 2011, 05:18:26 pm
-
Hi, it's too many long how i code it for my RP project, but i want to give you too this code.
So.
1)Open Player.cpp
2)Find - InitDisplayIds();
3)Replace it with:
[spoiler:xb4yxe79]// Morph system
QueryResult result2 = CharacterDatabase.PQuery("SELECT morph FROM character_morph WHERE guid = %u", fields[0].GetUInt32());
if(result2)
{
Field *fields2 = result2->Fetch();
SetNativeDisplayId(fields2[0].GetUInt32());
SetDisplayId(fields2[0].GetUInt32());
}
else
InitDisplayIds();
// Scale system
QueryResult result3 = CharacterDatabase.PQuery("SELECT scale FROM character_scale WHERE guid = %u", fields[0].GetFloat());
if(result3)
{
Field* fields3;
fields3 = result3->Fetch();
float Scale;
Scale = fields3[0].GetFloat();
SetFloatValue(OBJECT_FIELD_SCALE_X, Scale);
}
else
{
CharacterDatabase.PExecute("INSERT INTO character_scale VALUES (%u, 1, [CORE] - Basic Scale)", GetGUID());[/spoiler:xb4yxe79]
4)Save
5)Open CharacterDatabase
6)Insert:
[spoiler:xb4yxe79]SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for character_morph
-- ----------------------------
CREATE TABLE `character_morph` (
`guid` int(11) NOT NULL DEFAULT '0',
`morph` int(11) DEFAULT NULL,
PRIMARY KEY (`guid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-- ----------------------------
-- Table structure for character_scale
-- ----------------------------
CREATE TABLE `character_scale` (
`guid` int(11) NOT NULL,
`scale` float NOT NULL,
`comment` text,
PRIMARY KEY (`guid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;[/spoiler:xb4yxe79]
7)Compile
8)ENJOY!
How to add scale or morph?
1)Open table of scale or morph
2)Add guid of character
3)Add scale or morph(DisplayID)
-
Does morph works after relogin?
-
Of Course...its perma morph....if you login you have morph or scale, if you delete morph you have normal morph of your char.
-
WoW!!!
You really help me)
Thank You)
-
Very ty ^^
-
In Player.cpp there are many "InitDisplayIds ();"...i dont found can include it in the Core >.<
-
In func LoadFromDB
-
now i have try to include the code so:
void Player::InitDisplayIds()
{
//Start Custom Script
// Morph system
QueryResult result2 = CharacterDatabase.PQuery("SELECT morph FROM character_morph WHERE guid = %u", fields[0].GetUInt32());
if(result2)
{
Field *fields2 = result2->Fetch();
SetNativeDisplayId(fields2[0].GetUInt32());
SetDisplayId(fields2[0].GetUInt32());
}
else
InitDisplayIds();
// Scale system
QueryResult result3 = CharacterDatabase.PQuery("SELECT scale FROM character_scale WHERE guid = %u", fields[0].GetFloat());
if(result3)
{
Field* fields3;
fields3 = result3->Fetch();
float Scale;
Scale = fields3[0].GetFloat();
SetFloatValue(OBJECT_FIELD_SCALE_X, Scale);
}
else
{
CharacterDatabase.PExecute("INSERT INTO character_scale VALUES (%u, 1, [CORE] - Basic Scale)", GetGUID());
}
//End Custom Script
PlayerInfo const* info = sObjectMgr->GetPlayerInfo(getRace(), getClass());
if (!info)
{
sLog->outError("Player %u has incorrect race/class pair. Can't init display ids.", GetGUIDLow());
return;
}
uint8 gender = getGender();
switch (gender)
{
case GENDER_FEMALE:
SetDisplayId(info->displayId_f);
SetNativeDisplayId(info->displayId_f);
break;
case GENDER_MALE:
SetDisplayId(info->displayId_m);
SetNativeDisplayId(info->displayId_m);
break;
default:
sLog->outError("Invalid gender %u for player", gender);
return;
}
}
but it not work.
-
glad, you forget
}
after
CharacterDatabase.PExecute("INSERT INTO character_scale VALUES (%u, 1, [CORE] - Basic Scale)", GetGUID());
-
or remove after else "{"
BTW! I forget post replace it in LoadFromDB feature!!
-
I've been testing and trying around, however, this is not working - for some reason, it doesn't load the scale system up. Model System works properly and has no issues, but auto scale doesn't load up. Might be because of the age - any idea ?
-
put the script in the CharachterHandler.cpp
Script: http://pastebin.de/28600 (http://pastebin.de/28600" onclick="window.open(this.href);return false;)
-
Hi does this still work? I have the newest trinity 3.3.5 I have never touched this kind of scripting before... I don't understand this step:
5)Open CharacterDatabase
What/where is the CharacterDatabase where I put the second script in? ty :)
-
For the morph one, it's OK for me. On TC2.
The "Characters" Database is one of the 3 original databases by TC2.
(Auth, Characters and World.)
Just open Characters and create an SQL request with the good content.
-
To make the scale work, you need to insert the Scale stuff at the bottom of the LoadFromDB function (right above "return true;"). I didn't search where, but somewhere between InitDisplayId and the end of the function the scale is changed to 1.
Tested and working with newest TrinityCore. Thanks! :)
-
I really do suck at those things. So do I have to replace things there: http://scr.hu/0j3a/2bf2l
To look like http://scr.hu/0j3a/tllw0
and then execute this sql ?
-
More or less, yes.