Added support for the spawn_anim to be converted and accurate for earlier clients like KoS and DoF, when spawning skeletons, zombies so on their animation is now present
This commit is contained in:
parent
ab41124e73
commit
f47896f5b8
@ -221,10 +221,20 @@ void Spawn::InitializeHeaderPacketData(Player* player, PacketStruct* header, int
|
|||||||
header->setDataByName("index", index);
|
header->setDataByName("index", index);
|
||||||
|
|
||||||
if (GetSpawnAnim() > 0 && Timer::GetCurrentTime2() < (GetAddedToWorldTimestamp() + GetSpawnAnimLeeway())) {
|
if (GetSpawnAnim() > 0 && Timer::GetCurrentTime2() < (GetAddedToWorldTimestamp() + GetSpawnAnimLeeway())) {
|
||||||
|
int32 spawn_anim = GetSpawnAnim();
|
||||||
|
if (header->GetVersion() <= 561) { // spell's spell_visual field is based on newer clients, DoF has to convert
|
||||||
|
Emote* spellVisualEmote = visual_states.FindEmoteByID(spawn_anim, 60085);
|
||||||
|
if (spellVisualEmote != nullptr && spellVisualEmote->GetMessageString().size() > 0) {
|
||||||
|
spellVisualEmote = visual_states.FindEmote(spellVisualEmote->GetMessageString(), header->GetVersion());
|
||||||
|
if (spellVisualEmote) {
|
||||||
|
spawn_anim = (int32)spellVisualEmote->GetVisualState();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (header->GetVersion() >= 57080)
|
if (header->GetVersion() >= 57080)
|
||||||
header->setDataByName("spawn_anim", GetSpawnAnim());
|
header->setDataByName("spawn_anim", spawn_anim);
|
||||||
else
|
else
|
||||||
header->setDataByName("spawn_anim", (int16)GetSpawnAnim());
|
header->setDataByName("spawn_anim", (int16)spawn_anim);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (header->GetVersion() >= 57080)
|
if (header->GetVersion() >= 57080)
|
||||||
|
@ -172,6 +172,7 @@ public:
|
|||||||
for(map_list = emoteMap.begin(); map_list != emoteMap.end(); map_list++ )
|
for(map_list = emoteMap.begin(); map_list != emoteMap.end(); map_list++ )
|
||||||
safe_delete(map_list->second);
|
safe_delete(map_list->second);
|
||||||
emoteMap.clear();
|
emoteMap.clear();
|
||||||
|
emoteMapID.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClearVisualStates(){
|
void ClearVisualStates(){
|
||||||
@ -191,8 +192,9 @@ public:
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void InsertEmoteRange(EmoteVersionRange* emote) {
|
void InsertEmoteRange(EmoteVersionRange* emote, int32 animation_id) {
|
||||||
emoteMap[emote->GetName()] = emote;
|
emoteMap[emote->GetName()] = emote;
|
||||||
|
emoteMapID[animation_id] = emote;
|
||||||
}
|
}
|
||||||
|
|
||||||
EmoteVersionRange* FindEmoteRange(string var) {
|
EmoteVersionRange* FindEmoteRange(string var) {
|
||||||
@ -217,6 +219,28 @@ public:
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EmoteVersionRange* FindEmoteRangeByID(int32 id) {
|
||||||
|
if (emoteMapID.count(id) > 0)
|
||||||
|
{
|
||||||
|
return emoteMapID[id];
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
Emote* FindEmoteByID(int32 visual_id, int32 version){
|
||||||
|
if (emoteMapID.count(visual_id) > 0)
|
||||||
|
{
|
||||||
|
map<VersionRange*,Emote*>::iterator itr = emoteMapID[visual_id]->FindEmoteVersion(version);
|
||||||
|
|
||||||
|
if (itr != emoteMapID[visual_id]->GetRangeEnd())
|
||||||
|
{
|
||||||
|
Emote* emote = itr->second;
|
||||||
|
return emote;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
void InsertSpellVisualRange(EmoteVersionRange* emote, int32 spell_visual_id) {
|
void InsertSpellVisualRange(EmoteVersionRange* emote, int32 spell_visual_id) {
|
||||||
spellMap[emote->GetName()] = emote;
|
spellMap[emote->GetName()] = emote;
|
||||||
spellMapID[spell_visual_id] = emote;
|
spellMapID[spell_visual_id] = emote;
|
||||||
@ -276,6 +300,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
map<string,VisualState*> visualStateMap;
|
map<string,VisualState*> visualStateMap;
|
||||||
map<string,EmoteVersionRange*> emoteMap;
|
map<string,EmoteVersionRange*> emoteMap;
|
||||||
|
map<int32,EmoteVersionRange*> emoteMapID;
|
||||||
map<string,EmoteVersionRange*> spellMap;
|
map<string,EmoteVersionRange*> spellMap;
|
||||||
map<int32,EmoteVersionRange*> spellMapID;
|
map<int32,EmoteVersionRange*> spellMapID;
|
||||||
};
|
};
|
||||||
|
@ -460,7 +460,7 @@ void WorldDatabase::LoadVisualStates()
|
|||||||
if ((range = visual_states.FindEmoteRange(string(row2[0]))) == NULL)
|
if ((range = visual_states.FindEmoteRange(string(row2[0]))) == NULL)
|
||||||
{
|
{
|
||||||
range = new EmoteVersionRange(row2[0]);
|
range = new EmoteVersionRange(row2[0]);
|
||||||
visual_states.InsertEmoteRange(range);
|
visual_states.InsertEmoteRange(range, atoul(row2[1]));
|
||||||
}
|
}
|
||||||
|
|
||||||
range->AddVersionRange(atoul(row2[4]),atoul(row2[5]), row2[0], atoul(row2[1]), row2[2], row2[3]);
|
range->AddVersionRange(atoul(row2[4]),atoul(row2[5]), row2[0], atoul(row2[1]), row2[2], row2[3]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user