Skip to content

Commit

Permalink
SQL: Fix naming of modelId in Classic
Browse files Browse the repository at this point in the history
  • Loading branch information
insunaa committed May 7, 2024
1 parent f928d60 commit ba946d9
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion sql/base/mangos.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1074,7 +1074,7 @@ CREATE TABLE `creature_model_info` (
`SpeedRun` FLOAT NOT NULL DEFAULT '1.14286' COMMENT 'Default running speed for any creature with model',
`gender` tinyint(3) unsigned NOT NULL DEFAULT '2',
`modelid_other_gender` mediumint(8) unsigned NOT NULL DEFAULT '0',
`modelid_other_team` mediumint(8) unsigned NOT NULL DEFAULT '0',
`modelid_alternative` mediumint(8) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`modelid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Creature System (Model related info)';

Expand Down
2 changes: 2 additions & 0 deletions sql/updates/mangos/z2823_01_mangos_displayid_probability.sql
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ ALTER TABLE `creature_template` ADD COLUMN `DisplayIdProbability2` SMALLINT UNSI
ALTER TABLE `creature_template` ADD COLUMN `DisplayIdProbability3` SMALLINT UNSIGNED NOT NULL DEFAULT 0 AFTER `DisplayIdProbability2`;
ALTER TABLE `creature_template` ADD COLUMN `DisplayIdProbability4` SMALLINT UNSIGNED NOT NULL DEFAULT 0 AFTER `DisplayIdProbability3`;

ALTER TABLE `creature_template` RENAME COLUMN `modelid_other_team` TO `modelid_alternative`;

SET sql_safe_updates=0;
-- setting probabilities to exactly replicate previous behaviour
UPDATE creature_template SET DisplayIdProbability1=100 WHERE DisplayId1!=0;
Expand Down
2 changes: 1 addition & 1 deletion src/game/Entities/Creature.h
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ struct CreatureModelInfo
float SpeedRun;
uint8 gender;
uint32 modelid_other_gender; // The oposite gender for this modelid (male/female)
uint32 modelid_other_team; // The oposite team. Generally for alliance totem
uint32 modelid_alternative; // The oposite team. Generally for alliance totem
};

struct CreatureConditionalSpawn
Expand Down
16 changes: 8 additions & 8 deletions src/game/Globals/ObjectMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1476,7 +1476,7 @@ void ObjectMgr::LoadEquipmentTemplates()
uint32 ObjectMgr::GetCreatureModelOtherTeamModel(uint32 modelId) const
{
if (const CreatureModelInfo* modelInfo = GetCreatureModelInfo(modelId))
return modelInfo->modelid_other_team;
return modelInfo->modelid_alternative;

return 0;
}
Expand Down Expand Up @@ -1535,17 +1535,17 @@ void ObjectMgr::LoadCreatureModelInfo()
}
}

if (minfo->modelid_other_team)
if (minfo->modelid_alternative)
{
if (minfo->modelid_other_team == minfo->modelid)
if (minfo->modelid_alternative == minfo->modelid)
{
sLog.outErrorDb("Table `creature_model_info` has redundant modelid_other_team model (%u) defined for model id %u.", minfo->modelid_other_team, minfo->modelid);
const_cast<CreatureModelInfo*>(minfo)->modelid_other_team = 0;
sLog.outErrorDb("Table `creature_model_info` has redundant modelid_alternative model (%u) defined for model id %u.", minfo->modelid_alternative, minfo->modelid);
const_cast<CreatureModelInfo*>(minfo)->modelid_alternative = 0;
}
else if (!sCreatureDisplayInfoStore.LookupEntry(minfo->modelid_other_team))
else if (!sCreatureDisplayInfoStore.LookupEntry(minfo->modelid_alternative))
{
sLog.outErrorDb("Table `creature_model_info` has nonexistent modelid_other_team model (%u) defined for model id %u.", minfo->modelid_other_team, minfo->modelid);
const_cast<CreatureModelInfo*>(minfo)->modelid_other_team = 0;
sLog.outErrorDb("Table `creature_model_info` has nonexistent modelid_alternative model (%u) defined for model id %u.", minfo->modelid_alternative, minfo->modelid);
const_cast<CreatureModelInfo*>(minfo)->modelid_alternative = 0;
}
}
}
Expand Down

0 comments on commit ba946d9

Please sign in to comment.