* correctly select model for gameobjects (no more cubes)
* updated stuffextract - added gameobjectdisplayinfo, for correct work needs reextracting models and scp files
This commit is contained in:
parent
ffb12014af
commit
a2bbc0c7d4
@ -1,14 +1,14 @@
|
|||||||
#script=register_db_loader
|
#script=register_db_loader
|
||||||
if ?{not ?{IsHooked _startup}}
|
if ?{not ?{IsHooked _startup}}
|
||||||
HookStart _startup
|
HookStart _startup
|
||||||
HookAdd db_loader_load_all
|
HookAdd db_loader_load_all
|
||||||
HookEnd
|
HookEnd
|
||||||
|
|
||||||
// set up paths; ./data/scp and ./cache are set in the core already
|
// set up paths; ./data/scp and ./cache are set in the core already
|
||||||
// the SCP files placed in this directory are used to override some values
|
// the SCP files placed in this directory are used to override some values
|
||||||
// in already present SCP files or to add custom fields or content
|
// in already present SCP files or to add custom fields or content
|
||||||
// note: it DOES matter in which order paths are added!!
|
// note: it DOES matter in which order paths are added!!
|
||||||
AddDBPath ./data/scp-patches
|
AddDBPath ./data/scp-patches
|
||||||
endif
|
endif
|
||||||
|
|
||||||
//---------------------------------------------------------
|
//---------------------------------------------------------
|
||||||
@ -26,6 +26,7 @@ LoadDB map
|
|||||||
LoadDB zone
|
LoadDB zone
|
||||||
LoadDB creaturedisplayinfo
|
LoadDB creaturedisplayinfo
|
||||||
LoadDB creaturemodeldata
|
LoadDB creaturemodeldata
|
||||||
|
LoadDB gameobjectdisplayinfo
|
||||||
// LoadDB itemdisplayinfo // not yet used
|
// LoadDB itemdisplayinfo // not yet used
|
||||||
// LoadDB charsections // not yet used
|
// LoadDB charsections // not yet used
|
||||||
// LoadDB sound // not yet used
|
// LoadDB sound // not yet used
|
||||||
|
|||||||
Binary file not shown.
@ -113,7 +113,9 @@ DefReturnResult DefScriptPackage::SCsavecache(CmdSet& Set){
|
|||||||
str << ((PseuInstance*)parentMethod)->GetWSession()->objmgr.GetItemProtoCount();
|
str << ((PseuInstance*)parentMethod)->GetWSession()->objmgr.GetItemProtoCount();
|
||||||
str << " Item Prototypes, ";
|
str << " Item Prototypes, ";
|
||||||
str << ((PseuInstance*)parentMethod)->GetWSession()->objmgr.GetCreatureTemplateCount();
|
str << ((PseuInstance*)parentMethod)->GetWSession()->objmgr.GetCreatureTemplateCount();
|
||||||
str << " Creature Templates";
|
str << " Creature Templates, ";
|
||||||
|
str << ((PseuInstance*)parentMethod)->GetWSession()->objmgr.GetGOTemplateCount();
|
||||||
|
str << " GameObject Tempates";
|
||||||
str << " ]";
|
str << " ]";
|
||||||
|
|
||||||
((PseuInstance*)parentMethod)->GetWSession()->SendChatMessage(CHAT_MSG_SAY,0,str.str(),"");
|
((PseuInstance*)parentMethod)->GetWSession()->SendChatMessage(CHAT_MSG_SAY,0,str.str(),"");
|
||||||
@ -490,6 +492,11 @@ DefReturnResult DefScriptPackage::SCGetName(CmdSet& Set)
|
|||||||
CreatureTemplate *ct = ws->objmgr.GetCreatureTemplate((uint32)id);
|
CreatureTemplate *ct = ws->objmgr.GetCreatureTemplate((uint32)id);
|
||||||
return ct ? ct->name : "";
|
return ct ? ct->name : "";
|
||||||
}
|
}
|
||||||
|
else if(source == "gameobject")
|
||||||
|
{
|
||||||
|
GameobjectTemplate *gt = ws->objmgr.GetGOTemplate((uint32)id);
|
||||||
|
return gt ? gt->name : "";
|
||||||
|
}
|
||||||
// TODO: add gameobject, dynamicobject
|
// TODO: add gameobject, dynamicobject
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
|
|||||||
@ -4,6 +4,8 @@
|
|||||||
#include "PseuWoW.h"
|
#include "PseuWoW.h"
|
||||||
#include "Object.h"
|
#include "Object.h"
|
||||||
#include "Player.h"
|
#include "Player.h"
|
||||||
|
#include "GameObject.h"
|
||||||
|
#include "WorldSession.h"
|
||||||
|
|
||||||
using namespace irr;
|
using namespace irr;
|
||||||
|
|
||||||
@ -46,12 +48,44 @@ void DrawObject::_Init(void)
|
|||||||
|
|
||||||
if(!cube && _obj->IsWorldObject()) // only world objects have coords and can be drawn
|
if(!cube && _obj->IsWorldObject()) // only world objects have coords and can be drawn
|
||||||
{
|
{
|
||||||
uint32 displayid = _obj->IsUnit() ? _obj->GetUInt32Value(UNIT_FIELD_DISPLAYID) : 0; // TODO: in case its GO get it from proto data
|
std::string modelfile;
|
||||||
SCPDatabase *cdi = _instance->dbmgr.GetDB("creaturedisplayinfo");
|
uint32 opacity = 255;
|
||||||
SCPDatabase *cmd = _instance->dbmgr.GetDB("creaturemodeldata");
|
if (_obj->IsUnit())
|
||||||
uint32 modelid = cdi && displayid ? cdi->GetUint32(displayid,"model") : 0;
|
{
|
||||||
std::string modelfile = std::string("data/model/") + cmd->GetString(modelid,"file");
|
uint32 displayid = _obj->GetUInt32Value(UNIT_FIELD_DISPLAYID);
|
||||||
uint32 opacity = cdi && displayid ? cdi->GetUint32(displayid,"opacity") : 255;
|
SCPDatabase *cdi = _instance->dbmgr.GetDB("creaturedisplayinfo");
|
||||||
|
SCPDatabase *cmd = _instance->dbmgr.GetDB("creaturemodeldata");
|
||||||
|
uint32 modelid = cdi && displayid ? cdi->GetUint32(displayid,"model") : 0;
|
||||||
|
modelfile = std::string("data/model/") + cmd->GetString(modelid,"file");
|
||||||
|
opacity = cdi && displayid ? cdi->GetUint32(displayid,"opacity") : 255;
|
||||||
|
}
|
||||||
|
else if (_obj->IsGameObject())
|
||||||
|
{
|
||||||
|
GameobjectTemplate* gotempl = _instance->GetWSession()->objmgr.GetGOTemplate(_obj->GetEntry());
|
||||||
|
while (!gotempl)
|
||||||
|
{
|
||||||
|
ZThread::Thread::sleep(10);
|
||||||
|
gotempl = _instance->GetWSession()->objmgr.GetGOTemplate(_obj->GetEntry());
|
||||||
|
}
|
||||||
|
if (gotempl)
|
||||||
|
{
|
||||||
|
// GAMEOBJECT_TYPE_TRAP
|
||||||
|
if (gotempl->type == 6) // damage source on fires, skip for now
|
||||||
|
{
|
||||||
|
_initialized = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32 displayid = gotempl->displayId;
|
||||||
|
SCPDatabase *gdi = _instance->dbmgr.GetDB("gameobjectdisplayinfo");
|
||||||
|
if (gdi && displayid)
|
||||||
|
modelfile = std::string("data/model/") + gdi->GetString(displayid,"model");
|
||||||
|
std::string test = gdi->GetString(displayid,"model");
|
||||||
|
DEBUG(logdebug("GAMEOBJECT: %u - %u - %s", _obj->GetEntry(), displayid, test.c_str()));
|
||||||
|
} else {
|
||||||
|
DEBUG(logdebug("GAMEOBJECT UNKNOWN: %u", _obj->GetEntry()));
|
||||||
|
}
|
||||||
|
}
|
||||||
scene::IAnimatedMesh *mesh = _smgr->getMesh(modelfile.c_str());
|
scene::IAnimatedMesh *mesh = _smgr->getMesh(modelfile.c_str());
|
||||||
if(mesh)
|
if(mesh)
|
||||||
{
|
{
|
||||||
@ -61,7 +95,7 @@ void DrawObject::_Init(void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cube = _smgr->addCubeSceneNode(2);
|
cube = _smgr->addCubeSceneNode(1);
|
||||||
}
|
}
|
||||||
//cube->getMaterial(0).DiffuseColor.setAlpha(opacity);
|
//cube->getMaterial(0).DiffuseColor.setAlpha(opacity);
|
||||||
cube->setName("OBJECT");
|
cube->setName("OBJECT");
|
||||||
|
|||||||
@ -392,6 +392,7 @@ void PseuInstance::SaveAllCache(void)
|
|||||||
GetWSession()->plrNameCache.SaveToFile();
|
GetWSession()->plrNameCache.SaveToFile();
|
||||||
ItemProtoCache_WriteDataToCache(GetWSession());
|
ItemProtoCache_WriteDataToCache(GetWSession());
|
||||||
CreatureTemplateCache_WriteDataToCache(GetWSession());
|
CreatureTemplateCache_WriteDataToCache(GetWSession());
|
||||||
|
GOTemplateCache_WriteDataToCache(GetWSession());
|
||||||
//...
|
//...
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -617,7 +617,7 @@ void GOTemplateCache_WriteDataToCache(WorldSession *session)
|
|||||||
for(GOTemplateMap::iterator it = session->objmgr.GetGOTemplateStorage()->begin(); it != session->objmgr.GetGOTemplateStorage()->end(); it++)
|
for(GOTemplateMap::iterator it = session->objmgr.GetGOTemplateStorage()->begin(); it != session->objmgr.GetGOTemplateStorage()->end(); it++)
|
||||||
{
|
{
|
||||||
buf.clear();
|
buf.clear();
|
||||||
GameobjectTemplate *go = new GameobjectTemplate();
|
GameobjectTemplate *go = it->second;
|
||||||
buf << go->entry;
|
buf << go->entry;
|
||||||
buf << go->type;
|
buf << go->type;
|
||||||
buf << go->displayId;
|
buf << go->displayId;
|
||||||
|
|||||||
@ -55,6 +55,7 @@ public:
|
|||||||
inline bool IsContainer(void) { return _typeid == TYPEID_CONTAINER; } // specific
|
inline bool IsContainer(void) { return _typeid == TYPEID_CONTAINER; } // specific
|
||||||
inline bool IsCorpse(void) { return _typeid == TYPEID_CORPSE; } // specific
|
inline bool IsCorpse(void) { return _typeid == TYPEID_CORPSE; } // specific
|
||||||
inline bool IsDynObject(void) { return _typeid == TYPEID_DYNAMICOBJECT; } // specific
|
inline bool IsDynObject(void) { return _typeid == TYPEID_DYNAMICOBJECT; } // specific
|
||||||
|
inline bool IsGameObject(void) { return _typeid == TYPEID_GAMEOBJECT; } // specific
|
||||||
inline bool IsWorldObject(void) { return _type & (TYPE_PLAYER | TYPE_UNIT | TYPE_CORPSE | TYPE_DYNAMICOBJECT | TYPE_GAMEOBJECT); }
|
inline bool IsWorldObject(void) { return _type & (TYPE_PLAYER | TYPE_UNIT | TYPE_CORPSE | TYPE_DYNAMICOBJECT | TYPE_GAMEOBJECT); }
|
||||||
inline const uint32 GetUInt32Value( uint16 index ) const
|
inline const uint32 GetUInt32Value( uint16 index ) const
|
||||||
{
|
{
|
||||||
|
|||||||
@ -109,6 +109,7 @@ void WorldSession::_LoadCache(void)
|
|||||||
plrNameCache.ReadFromFile(); // load names/guids of known players
|
plrNameCache.ReadFromFile(); // load names/guids of known players
|
||||||
ItemProtoCache_InsertDataToSession(this);
|
ItemProtoCache_InsertDataToSession(this);
|
||||||
CreatureTemplateCache_InsertDataToSession(this);
|
CreatureTemplateCache_InsertDataToSession(this);
|
||||||
|
GOTemplateCache_InsertDataToSession(this);
|
||||||
//...
|
//...
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -624,7 +625,7 @@ void WorldSession::_HandleCharEnumOpcode(WorldPacket& recvPacket)
|
|||||||
}
|
}
|
||||||
if(!char_found)
|
if(!char_found)
|
||||||
{
|
{
|
||||||
logerror("Character \"%s\" was not found on char list!", plr[charId]._name.c_str());
|
logerror("Character \"%s\" was not found on char list!", GetInstance()->GetConf()->charname.c_str());
|
||||||
GetInstance()->SetError();
|
GetInstance()->SetError();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -407,6 +407,25 @@ static const char *CharSectionsFormat = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// GameObjectDisplayInfo
|
||||||
|
|
||||||
|
enum GameObjectDisplayInfoEnum
|
||||||
|
{
|
||||||
|
GAMEOBJECTDISPLAYINFO_ID = 0, // <<-- this is the so-called DisplayID!!
|
||||||
|
GAMEOBJECTDISPLAYINFO_MODEL = 1,
|
||||||
|
GAMEOBJECTDISPLAYINFO_END = 18
|
||||||
|
};
|
||||||
|
|
||||||
|
static const char *GameObjectDisplayInfoFieldNames[] = {
|
||||||
|
"","model","","","","","","","","", // 0-9
|
||||||
|
"","","","","","","","" // 10-17
|
||||||
|
};
|
||||||
|
|
||||||
|
static const char *GameObjectDisplayInfoFormat = {
|
||||||
|
"isxxxxxxxx" // 0-9
|
||||||
|
"xxxxxxxx" // 10-17
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -255,9 +255,9 @@ bool ConvertDBC(void)
|
|||||||
{
|
{
|
||||||
std::map<uint8,std::string> racemap; // needed to extract other dbc files correctly
|
std::map<uint8,std::string> racemap; // needed to extract other dbc files correctly
|
||||||
SCPStorageMap EmoteDataStorage,RaceDataStorage,SoundDataStorage,MapDataStorage,ZoneDataStorage,ItemDisplayInfoStorage,
|
SCPStorageMap EmoteDataStorage,RaceDataStorage,SoundDataStorage,MapDataStorage,ZoneDataStorage,ItemDisplayInfoStorage,
|
||||||
CreatureModelStorage,CreatureDisplayInfoStorage,NPCSoundStorage,CharSectionStorage; // will store the converted data from dbc files
|
CreatureModelStorage,CreatureDisplayInfoStorage,NPCSoundStorage,CharSectionStorage, GameObjectDisplayInfoStorage; // will store the converted data from dbc files
|
||||||
DBCFile EmotesText,EmotesTextData,EmotesTextSound,ChrRaces,SoundEntries,Map,AreaTable,ItemDisplayInfo,
|
DBCFile EmotesText,EmotesTextData,EmotesTextSound,ChrRaces,SoundEntries,Map,AreaTable,ItemDisplayInfo,
|
||||||
CreatureModelData,CreatureDisplayInfo,NPCSounds,CharSections;
|
CreatureModelData,CreatureDisplayInfo,NPCSounds,CharSections,GameObjectDisplayInfo;
|
||||||
printf("Opening DBC archive...\n");
|
printf("Opening DBC archive...\n");
|
||||||
MPQHelper mpq("dbc");
|
MPQHelper mpq("dbc");
|
||||||
|
|
||||||
@ -272,6 +272,7 @@ bool ConvertDBC(void)
|
|||||||
ItemDisplayInfo.openmem(mpq.ExtractFile("DBFilesClient\\ItemDisplayInfo.dbc"));
|
ItemDisplayInfo.openmem(mpq.ExtractFile("DBFilesClient\\ItemDisplayInfo.dbc"));
|
||||||
CreatureModelData.openmem(mpq.ExtractFile("DBFilesClient\\CreatureModelData.dbc"));
|
CreatureModelData.openmem(mpq.ExtractFile("DBFilesClient\\CreatureModelData.dbc"));
|
||||||
CreatureDisplayInfo.openmem(mpq.ExtractFile("DBFilesClient\\CreatureDisplayInfo.dbc"));
|
CreatureDisplayInfo.openmem(mpq.ExtractFile("DBFilesClient\\CreatureDisplayInfo.dbc"));
|
||||||
|
GameObjectDisplayInfo.openmem(mpq.ExtractFile("DBFilesClient\\GameObjectDisplayInfo.dbc"));
|
||||||
NPCSounds.openmem(mpq.ExtractFile("DBFilesClient\\NPCSounds.dbc"));
|
NPCSounds.openmem(mpq.ExtractFile("DBFilesClient\\NPCSounds.dbc"));
|
||||||
CharSections.openmem(mpq.ExtractFile("DBFilesClient\\CharSections.dbc"));
|
CharSections.openmem(mpq.ExtractFile("DBFilesClient\\CharSections.dbc"));
|
||||||
//...
|
//...
|
||||||
@ -479,6 +480,30 @@ bool ConvertDBC(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
printf("gameobjectdisplayinfo..");
|
||||||
|
for(DBCFile::Iterator it = GameObjectDisplayInfo.begin(); it != GameObjectDisplayInfo.end(); ++it)
|
||||||
|
{
|
||||||
|
uint32 id = it->getUInt(GAMEOBJECTDISPLAYINFO_ID);
|
||||||
|
|
||||||
|
for(uint32 field=GAMEOBJECTDISPLAYINFO_ID; field < GAMEOBJECTDISPLAYINFO_END; field++)
|
||||||
|
{
|
||||||
|
if(strlen(GameObjectDisplayInfoFieldNames[field]))
|
||||||
|
{
|
||||||
|
std::string value = AutoGetDataString(it,GameObjectDisplayInfoFormat,field);
|
||||||
|
if(value.size()) // only store if not null
|
||||||
|
{
|
||||||
|
// TODO: add check for wmo model files ?
|
||||||
|
if(doModels)
|
||||||
|
modelNames.insert(NameAndAlt(value)); // we need to extract model later, store it
|
||||||
|
std::string fn = _PathToFileName(value);
|
||||||
|
if(stricmp(fn.c_str()+fn.length()-4, "mdx"))
|
||||||
|
fn = fn.substr(0,fn.length()-3) + "m2";
|
||||||
|
GameObjectDisplayInfoStorage[id].push_back(std::string(GameObjectDisplayInfoFieldNames[field]) + "=" + fn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
printf("npcsounds..");
|
printf("npcsounds..");
|
||||||
for(DBCFile::Iterator it = NPCSounds.begin(); it != NPCSounds.end(); ++it)
|
for(DBCFile::Iterator it = NPCSounds.begin(); it != NPCSounds.end(); ++it)
|
||||||
{
|
{
|
||||||
@ -544,6 +569,7 @@ bool ConvertDBC(void)
|
|||||||
printf("itemdisplayinfo.."); OutSCP(SCPDIR "/itemdisplayinfo.scp",ItemDisplayInfoStorage, "itemdisplayinfo");
|
printf("itemdisplayinfo.."); OutSCP(SCPDIR "/itemdisplayinfo.scp",ItemDisplayInfoStorage, "itemdisplayinfo");
|
||||||
printf("creaturemodeldata.."); OutSCP(SCPDIR "/creaturemodeldata.scp",CreatureModelStorage,"creaturemodeldata");
|
printf("creaturemodeldata.."); OutSCP(SCPDIR "/creaturemodeldata.scp",CreatureModelStorage,"creaturemodeldata");
|
||||||
printf("creaturedisplayinfo.."); OutSCP(SCPDIR "/creaturedisplayinfo.scp",CreatureDisplayInfoStorage,"creaturedisplayinfo");
|
printf("creaturedisplayinfo.."); OutSCP(SCPDIR "/creaturedisplayinfo.scp",CreatureDisplayInfoStorage,"creaturedisplayinfo");
|
||||||
|
printf("gameobjectdisplayinfo.."); OutSCP(SCPDIR "/gameobjectdisplayinfo.scp",GameObjectDisplayInfoStorage,"gameobjectdisplayinfo");
|
||||||
printf("npcsound.."); OutSCP(SCPDIR "/npcsound.scp",NPCSoundStorage,"npcsound");
|
printf("npcsound.."); OutSCP(SCPDIR "/npcsound.scp",NPCSoundStorage,"npcsound");
|
||||||
printf("charsections.."); OutSCP(SCPDIR "/charsections.scp",CharSectionStorage,"charsections");
|
printf("charsections.."); OutSCP(SCPDIR "/charsections.scp",CharSectionStorage,"charsections");
|
||||||
//...
|
//...
|
||||||
@ -912,10 +938,13 @@ void FetchTexturesFromModel(ByteBuffer& bb)
|
|||||||
{
|
{
|
||||||
bb.rpos(0);
|
bb.rpos(0);
|
||||||
irr::scene::ModelHeader header;
|
irr::scene::ModelHeader header;
|
||||||
|
if (bb.size() < sizeof(header))
|
||||||
|
return;
|
||||||
|
|
||||||
bb.read((uint8*)&header, sizeof(header));
|
bb.read((uint8*)&header, sizeof(header));
|
||||||
|
|
||||||
if (header.version[0] != 4 && header.version[1] != 1 && header.version[2] != 0 && header.version[3] != 0) {
|
if (header.version[0] != 4 || header.version[1] != 1 || header.version[2] != 0 || header.version[3] != 0) {
|
||||||
printf("Not model file!");
|
//printf("Not M2 model file!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user