Forum > Tutorials

[Tutorial][TC2Core] - Scale system + Morph system

<< < (2/4) > >>

Blackplayer27:
In Player.cpp there are many "InitDisplayIds ();"...i dont found can include it in the Core >.<

glararan:
In func LoadFromDB

Blackplayer27:
now i have try to include the code so:

--- Code: ---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;
}
}
--- End code ---

but it not work.

Zim4ik:
glad, you forget
}
after

--- Quote ---CharacterDatabase.PExecute("INSERT INTO character_scale VALUES (%u, 1, [CORE] - Basic Scale)", GetGUID());
--- End quote ---

glararan:
or remove after else "{"
BTW! I forget post replace it in LoadFromDB feature!!

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version