Core/Creature: update creature_template and some other small things
http://www.trinitycore.org/f/topic/9572-creature-damage/
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
ALTER TABLE `creature_template`
|
||||
DROP COLUMN `mindmg`,
|
||||
DROP COLUMN `maxdmg`,
|
||||
DROP COLUMN `attackpower`,
|
||||
DROP COLUMN `minrangedmg`,
|
||||
DROP COLUMN `maxrangedmg`,
|
||||
DROP COLUMN `rangedattackpower`,
|
||||
CHANGE `baseattacktime` `BaseAttackTime` INT(10) UNSIGNED DEFAULT 0 NOT NULL,
|
||||
CHANGE `rangeattacktime` `RangeAttackTime` INT(10) UNSIGNED DEFAULT 0 NOT NULL,
|
||||
ADD COLUMN `BaseVariance` FLOAT DEFAULT 1 NOT NULL AFTER `RangeAttackTime`,
|
||||
ADD COLUMN `RangeVariance` FLOAT DEFAULT 1 NOT NULL AFTER `BaseVariance`,
|
||||
CHANGE `Health_mod` `HealthModifier` FLOAT DEFAULT 1 NOT NULL,
|
||||
CHANGE `Mana_mod` `ManaModifier` FLOAT DEFAULT 1 NOT NULL,
|
||||
CHANGE `Armor_mod` `ArmorModifier` FLOAT DEFAULT 1 NOT NULL,
|
||||
CHANGE `dmg_multiplier` `DamageModifier` FLOAT DEFAULT 1 NOT NULL AFTER `ArmorModifier`,
|
||||
ADD COLUMN `ExperienceModifier` FLOAT DEFAULT 1 NOT NULL AFTER `DamageModifier`;
|
||||
@@ -68,7 +68,7 @@ namespace FactorySelector
|
||||
else
|
||||
ai_factory = ai_registry.GetRegistryItem("NullCreatureAI");
|
||||
}
|
||||
else if (creature->GetCreatureType() == CREATURE_TYPE_CRITTER && !creature->HasUnitTypeMask(UNIT_MASK_GUARDIAN))
|
||||
else if (creature->IsCritter() && !creature->HasUnitTypeMask(UNIT_MASK_GUARDIAN))
|
||||
ai_factory = ai_registry.GetRegistryItem("CritterAI");
|
||||
}
|
||||
|
||||
|
||||
@@ -384,9 +384,9 @@ bool Creature::UpdateEntry(uint32 entry, CreatureData const* data /*= nullptr*/)
|
||||
|
||||
RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT);
|
||||
|
||||
SetAttackTime(BASE_ATTACK, cInfo->baseattacktime);
|
||||
SetAttackTime(OFF_ATTACK, cInfo->baseattacktime);
|
||||
SetAttackTime(RANGED_ATTACK, cInfo->rangeattacktime);
|
||||
SetAttackTime(BASE_ATTACK, cInfo->BaseAttackTime);
|
||||
SetAttackTime(OFF_ATTACK, cInfo->BaseAttackTime);
|
||||
SetAttackTime(RANGED_ATTACK, cInfo->RangeAttackTime);
|
||||
|
||||
SelectLevel();
|
||||
|
||||
@@ -815,7 +815,7 @@ bool Creature::Create(uint32 guidlow, Map* map, uint32 phaseMask, uint32 entry,
|
||||
|
||||
void Creature::InitializeReactState()
|
||||
{
|
||||
if (IsTotem() || IsTrigger() || GetCreatureType() == CREATURE_TYPE_CRITTER || IsSpiritService())
|
||||
if (IsTotem() || IsTrigger() || IsCritter() || IsSpiritService())
|
||||
SetReactState(REACT_PASSIVE);
|
||||
/*
|
||||
else if (IsCivilian())
|
||||
|
||||
@@ -64,12 +64,12 @@ enum CreatureFlagsExtra
|
||||
CREATURE_FLAG_EXTRA_NO_SKILLGAIN | CREATURE_FLAG_EXTRA_TAUNT_DIMINISH | CREATURE_FLAG_EXTRA_ALL_DIMINISH | \
|
||||
CREATURE_FLAG_EXTRA_GUARD)
|
||||
|
||||
#define MAX_KILL_CREDIT 2
|
||||
#define CREATURE_REGEN_INTERVAL 2 * IN_MILLISECONDS
|
||||
|
||||
#define MAX_KILL_CREDIT 2
|
||||
#define MAX_CREATURE_MODELS 4
|
||||
#define MAX_CREATURE_QUEST_ITEMS 6
|
||||
|
||||
#define MAX_EQUIPMENT_ITEMS 3
|
||||
#define CREATURE_MAX_SPELLS 8
|
||||
|
||||
// from `creature_template` table
|
||||
struct CreatureTemplate
|
||||
@@ -94,13 +94,11 @@ struct CreatureTemplate
|
||||
float speed_run;
|
||||
float scale;
|
||||
uint32 rank;
|
||||
float mindmg;
|
||||
float maxdmg;
|
||||
uint32 dmgschool;
|
||||
uint32 attackpower;
|
||||
float dmg_multiplier;
|
||||
uint32 baseattacktime;
|
||||
uint32 rangeattacktime;
|
||||
uint32 BaseAttackTime;
|
||||
uint32 RangeAttackTime;
|
||||
float BaseVariance;
|
||||
float RangeVariance;
|
||||
uint32 unit_class; // enum Classes. Note only 4 classes are known for creatures.
|
||||
uint32 unit_flags; // enum UnitFlags mask values
|
||||
uint32 unit_flags2; // enum UnitFlags2 mask values
|
||||
@@ -110,9 +108,6 @@ struct CreatureTemplate
|
||||
uint32 trainer_spell;
|
||||
uint32 trainer_class;
|
||||
uint32 trainer_race;
|
||||
float minrangedmg;
|
||||
float maxrangedmg;
|
||||
uint32 rangedattackpower;
|
||||
uint32 type; // enum CreatureType values
|
||||
uint32 type_flags; // enum CreatureTypeFlags mask values
|
||||
uint32 lootid;
|
||||
@@ -131,6 +126,8 @@ struct CreatureTemplate
|
||||
float ModHealth;
|
||||
float ModMana;
|
||||
float ModArmor;
|
||||
float ModDamage;
|
||||
float ModExperience;
|
||||
bool RacialLeader;
|
||||
uint32 questItems[MAX_CREATURE_QUEST_ITEMS];
|
||||
uint32 movementId;
|
||||
@@ -237,6 +234,8 @@ struct PointOfInterestLocale
|
||||
StringVector IconName;
|
||||
};
|
||||
|
||||
#define MAX_EQUIPMENT_ITEMS 3
|
||||
|
||||
struct EquipmentInfo
|
||||
{
|
||||
uint32 ItemEntry[MAX_EQUIPMENT_ITEMS];
|
||||
|
||||
@@ -805,14 +805,16 @@ namespace Trinity
|
||||
class ObjectDistanceOrderPred
|
||||
{
|
||||
public:
|
||||
ObjectDistanceOrderPred(WorldObject const* pRefObj, bool ascending = true) : m_refObj(pRefObj), m_ascending(ascending) { }
|
||||
bool operator()(WorldObject const* pLeft, WorldObject const* pRight) const
|
||||
ObjectDistanceOrderPred(WorldObject const* refObj, bool ascending = true) : _refObj(refObj), _ascending(ascending) { }
|
||||
|
||||
bool operator()(WorldObject const* left, WorldObject const* right) const
|
||||
{
|
||||
return m_ascending ? m_refObj->GetDistanceOrder(pLeft, pRight) : !m_refObj->GetDistanceOrder(pLeft, pRight);
|
||||
return _refObj->GetDistanceOrder(left, right) == _ascending;
|
||||
}
|
||||
|
||||
private:
|
||||
WorldObject const* m_refObj;
|
||||
const bool m_ascending;
|
||||
WorldObject const* _refObj;
|
||||
bool _ascending;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -183,7 +183,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petEntry, uint32 petnumber, bool c
|
||||
SetUInt32Value(UNIT_CREATED_BY_SPELL, summonSpellId);
|
||||
|
||||
CreatureTemplate const* cinfo = GetCreatureTemplate();
|
||||
if (cinfo->type == CREATURE_TYPE_CRITTER)
|
||||
if (IsCritter())
|
||||
{
|
||||
float px, py, pz;
|
||||
owner->GetClosePoint(px, py, pz, GetObjectSize(), PET_FOLLOW_DIST, GetFollowAngle());
|
||||
@@ -1019,7 +1019,7 @@ bool Guardian::InitStatsForLevel(uint8 petlevel)
|
||||
SetCreateHealth(30*petlevel);
|
||||
|
||||
// wolf attack speed is 1.5s
|
||||
SetAttackTime(BASE_ATTACK, cinfo->baseattacktime);
|
||||
SetAttackTime(BASE_ATTACK, cinfo->BaseAttackTime);
|
||||
|
||||
SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float((petlevel * 4 - petlevel)));
|
||||
SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float((petlevel * 4 + petlevel)));
|
||||
|
||||
@@ -1037,17 +1037,21 @@ void Creature::UpdateAttackPowerAndDamage(bool ranged)
|
||||
|
||||
void Creature::CalculateMinMaxDamage(WeaponAttackType attType, bool normalized, bool addTotalPct, float& minDamage, float& maxDamage)
|
||||
{
|
||||
float variance = 1.0f;
|
||||
UnitMods unitMod;
|
||||
switch (attType)
|
||||
{
|
||||
case BASE_ATTACK:
|
||||
default:
|
||||
variance = GetCreatureTemplate()->BaseVariance;
|
||||
unitMod = UNIT_MOD_DAMAGE_MAINHAND;
|
||||
break;
|
||||
case OFF_ATTACK:
|
||||
variance = GetCreatureTemplate()->BaseVariance;
|
||||
unitMod = UNIT_MOD_DAMAGE_OFFHAND;
|
||||
break;
|
||||
case RANGED_ATTACK:
|
||||
variance = GetCreatureTemplate()->RangeVariance;
|
||||
unitMod = UNIT_MOD_DAMAGE_RANGED;
|
||||
break;
|
||||
}
|
||||
@@ -1070,11 +1074,11 @@ void Creature::CalculateMinMaxDamage(WeaponAttackType attType, bool normalized,
|
||||
|
||||
float attackPower = GetTotalAttackPowerValue(attType);
|
||||
float attackSpeedMulti = GetAPMultiplier(attType, normalized);
|
||||
float baseValue = GetModifierValue(unitMod, BASE_VALUE) + (attackPower / 14.0f);
|
||||
float baseValue = GetModifierValue(unitMod, BASE_VALUE) + (attackPower / 14.0f) * variance;
|
||||
float basePct = GetModifierValue(unitMod, BASE_PCT) * attackSpeedMulti;
|
||||
float totalValue = GetModifierValue(unitMod, TOTAL_VALUE);
|
||||
float totalPct = addTotalPct ? GetModifierValue(unitMod, TOTAL_PCT) : 1.0f;
|
||||
float dmgMultiplier = GetCreatureTemplate()->dmg_multiplier; // = dmg_multiplier * _GetDamageMod(rank);
|
||||
float dmgMultiplier = GetCreatureTemplate()->ModDamage; // = ModDamage * _GetDamageMod(rank);
|
||||
|
||||
minDamage = ((weaponMinDamage + baseValue) * dmgMultiplier * basePct + totalValue) * totalPct;
|
||||
maxDamage = ((weaponMaxDamage + baseValue) * dmgMultiplier * basePct + totalValue) * totalPct;
|
||||
|
||||
@@ -13998,7 +13998,7 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, u
|
||||
// On melee based hit/miss/resist need update skill (for victim and attacker)
|
||||
if (procExtra & (PROC_EX_NORMAL_HIT|PROC_EX_MISS|PROC_EX_RESIST))
|
||||
{
|
||||
if (target->GetTypeId() != TYPEID_PLAYER && target->GetCreatureType() != CREATURE_TYPE_CRITTER)
|
||||
if (target->GetTypeId() != TYPEID_PLAYER && !target->IsCritter())
|
||||
ToPlayer()->UpdateCombatSkills(target, attType, isVictim);
|
||||
}
|
||||
// Update defence if player is victim and parry/dodge/block
|
||||
@@ -14662,7 +14662,7 @@ Unit* Unit::SelectNearbyTarget(Unit* exclude, float dist) const
|
||||
// remove not LoS targets
|
||||
for (std::list<Unit*>::iterator tIter = targets.begin(); tIter != targets.end();)
|
||||
{
|
||||
if (!IsWithinLOSInMap(*tIter) || (*tIter)->IsTotem() || (*tIter)->IsSpiritService() || (*tIter)->GetCreatureType() == CREATURE_TYPE_CRITTER)
|
||||
if (!IsWithinLOSInMap(*tIter) || (*tIter)->IsTotem() || (*tIter)->IsSpiritService() || (*tIter)->IsCritter())
|
||||
targets.erase(tIter++);
|
||||
else
|
||||
++tIter;
|
||||
@@ -15283,7 +15283,7 @@ void Unit::Kill(Unit* victim, bool durabilityLoss)
|
||||
if (Unit* owner = GetOwner())
|
||||
owner->ProcDamageAndSpell(victim, PROC_FLAG_KILL, PROC_FLAG_NONE, PROC_EX_NONE, 0);
|
||||
|
||||
if (victim->GetCreatureType() != CREATURE_TYPE_CRITTER)
|
||||
if (!victim->IsCritter())
|
||||
ProcDamageAndSpell(victim, PROC_FLAG_KILL, PROC_FLAG_KILLED, PROC_EX_NONE, 0);
|
||||
|
||||
// Proc auras on death - must be before aura/combat remove
|
||||
|
||||
@@ -265,7 +265,6 @@ enum UnitRename
|
||||
UNIT_CAN_BE_ABANDONED = 0x02
|
||||
};
|
||||
|
||||
#define CREATURE_MAX_SPELLS 8
|
||||
#define MAX_SPELL_CHARM 4
|
||||
#define MAX_SPELL_VEHICLE 6
|
||||
#define MAX_SPELL_POSSESS 8
|
||||
@@ -1528,6 +1527,7 @@ class Unit : public WorldObject
|
||||
bool IsArmorer() const { return HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_REPAIR); }
|
||||
bool IsServiceProvider() const;
|
||||
bool IsSpiritService() const { return HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPIRITHEALER | UNIT_NPC_FLAG_SPIRITGUIDE); }
|
||||
bool IsCritter() const { return GetCreatureType() == CREATURE_TYPE_CRITTER; }
|
||||
|
||||
bool IsInFlight() const { return HasUnitState(UNIT_STATE_IN_FLIGHT); }
|
||||
|
||||
|
||||
@@ -393,22 +393,22 @@ void ObjectMgr::LoadCreatureTemplates()
|
||||
{
|
||||
uint32 oldMSTime = getMSTime();
|
||||
|
||||
// 0 1 2 3 4 5 6 7 8
|
||||
// 0 1 2 3 4 5 6 7 8
|
||||
QueryResult result = WorldDatabase.Query("SELECT entry, difficulty_entry_1, difficulty_entry_2, difficulty_entry_3, KillCredit1, KillCredit2, modelid1, modelid2, modelid3, "
|
||||
// 9 10 11 12 13 14 15 16 17 18 19 20 21
|
||||
// 9 10 11 12 13 14 15 16 17 18 19 20
|
||||
"modelid4, name, subname, IconName, gossip_menu_id, minlevel, maxlevel, exp, faction, npcflag, speed_walk, speed_run, "
|
||||
// 22 23 24 25 26 27 28 29 30 31 32 33
|
||||
"scale, rank, mindmg, maxdmg, dmgschool, attackpower, dmg_multiplier, baseattacktime, rangeattacktime, unit_class, unit_flags, unit_flags2, "
|
||||
// 34 35 36 37 38 39 40 41 42 43
|
||||
"dynamicflags, family, trainer_type, trainer_spell, trainer_class, trainer_race, minrangedmg, maxrangedmg, rangedattackpower, type, "
|
||||
// 44 45 46 47 48 49 50 51 52 53 54
|
||||
// 21 22 23 24 25 26 27 28 29 30
|
||||
"scale, rank, dmgschool, BaseAttackTime, RangeAttackTime, BaseVariance, RangeVariance, unit_class, unit_flags, unit_flags2, "
|
||||
// 31 32 33 34 35 36 37
|
||||
"dynamicflags, family, trainer_type, trainer_spell, trainer_class, trainer_race, type, "
|
||||
// 38 39 40 41 42 43 44 45 46 47 48
|
||||
"type_flags, lootid, pickpocketloot, skinloot, resistance1, resistance2, resistance3, resistance4, resistance5, resistance6, spell1, "
|
||||
// 55 56 57 58 59 60 61 62 63 64 65 66 67
|
||||
// 49 50 51 52 53 54 55 56 57 58 59 60 61
|
||||
"spell2, spell3, spell4, spell5, spell6, spell7, spell8, PetSpellDataId, VehicleId, mingold, maxgold, AIName, MovementType, "
|
||||
// 68 69 70 71 72 73 74 75 76 77 78
|
||||
"InhabitType, HoverHeight, Health_mod, Mana_mod, Armor_mod, RacialLeader, questItem1, questItem2, questItem3, questItem4, questItem5, "
|
||||
// 79 80 81 82 83 84
|
||||
" questItem6, movementId, RegenHealth, mechanic_immune_mask, flags_extra, ScriptName "
|
||||
// 62 63 64 65 66 67 68 69
|
||||
"InhabitType, HoverHeight, HealthModifier, ManaModifier, ArmorModifier, DamageModifier, ExperienceModifier, RacialLeader, "
|
||||
// 70 71 72 73 74 75 76 77 78 79 80
|
||||
"questItem1, questItem2, questItem3, questItem4, questItem5, questItem6, movementId, RegenHealth, mechanic_immune_mask, flags_extra, ScriptName "
|
||||
"FROM creature_template;");
|
||||
|
||||
if (!result)
|
||||
@@ -422,90 +422,7 @@ void ObjectMgr::LoadCreatureTemplates()
|
||||
do
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
uint32 entry = fields[0].GetUInt32();
|
||||
|
||||
|
||||
CreatureTemplate& creatureTemplate = _creatureTemplateStore[entry];
|
||||
|
||||
creatureTemplate.Entry = entry;
|
||||
|
||||
for (uint8 i = 0; i < MAX_DIFFICULTY - 1; ++i)
|
||||
creatureTemplate.DifficultyEntry[i] = fields[1 + i].GetUInt32();
|
||||
|
||||
for (uint8 i = 0; i < MAX_KILL_CREDIT; ++i)
|
||||
creatureTemplate.KillCredit[i] = fields[4 + i].GetUInt32();
|
||||
|
||||
creatureTemplate.Modelid1 = fields[6].GetUInt32();
|
||||
creatureTemplate.Modelid2 = fields[7].GetUInt32();
|
||||
creatureTemplate.Modelid3 = fields[8].GetUInt32();
|
||||
creatureTemplate.Modelid4 = fields[9].GetUInt32();
|
||||
creatureTemplate.Name = fields[10].GetString();
|
||||
creatureTemplate.SubName = fields[11].GetString();
|
||||
creatureTemplate.IconName = fields[12].GetString();
|
||||
creatureTemplate.GossipMenuId = fields[13].GetUInt32();
|
||||
creatureTemplate.minlevel = fields[14].GetUInt8();
|
||||
creatureTemplate.maxlevel = fields[15].GetUInt8();
|
||||
creatureTemplate.expansion = uint32(fields[16].GetInt16());
|
||||
creatureTemplate.faction = uint32(fields[17].GetUInt16());
|
||||
creatureTemplate.npcflag = fields[18].GetUInt32();
|
||||
creatureTemplate.speed_walk = fields[19].GetFloat();
|
||||
creatureTemplate.speed_run = fields[20].GetFloat();
|
||||
creatureTemplate.scale = fields[21].GetFloat();
|
||||
creatureTemplate.rank = uint32(fields[22].GetUInt8());
|
||||
creatureTemplate.mindmg = fields[23].GetFloat();
|
||||
creatureTemplate.maxdmg = fields[24].GetFloat();
|
||||
creatureTemplate.dmgschool = uint32(fields[25].GetInt8());
|
||||
creatureTemplate.attackpower = fields[26].GetUInt32();
|
||||
creatureTemplate.dmg_multiplier = fields[27].GetFloat();
|
||||
creatureTemplate.baseattacktime = fields[28].GetUInt32();
|
||||
creatureTemplate.rangeattacktime = fields[29].GetUInt32();
|
||||
creatureTemplate.unit_class = uint32(fields[30].GetUInt8());
|
||||
creatureTemplate.unit_flags = fields[31].GetUInt32();
|
||||
creatureTemplate.unit_flags2 = fields[32].GetUInt32();
|
||||
creatureTemplate.dynamicflags = fields[33].GetUInt32();
|
||||
creatureTemplate.family = uint32(fields[34].GetUInt8());
|
||||
creatureTemplate.trainer_type = uint32(fields[35].GetUInt8());
|
||||
creatureTemplate.trainer_spell = fields[36].GetUInt32();
|
||||
creatureTemplate.trainer_class = uint32(fields[37].GetUInt8());
|
||||
creatureTemplate.trainer_race = uint32(fields[38].GetUInt8());
|
||||
creatureTemplate.minrangedmg = fields[39].GetFloat();
|
||||
creatureTemplate.maxrangedmg = fields[40].GetFloat();
|
||||
creatureTemplate.rangedattackpower = uint32(fields[41].GetUInt16());
|
||||
creatureTemplate.type = uint32(fields[42].GetUInt8());
|
||||
creatureTemplate.type_flags = fields[43].GetUInt32();
|
||||
creatureTemplate.lootid = fields[44].GetUInt32();
|
||||
creatureTemplate.pickpocketLootId = fields[45].GetUInt32();
|
||||
creatureTemplate.SkinLootId = fields[46].GetUInt32();
|
||||
|
||||
for (uint8 i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i)
|
||||
creatureTemplate.resistance[i] = fields[47 + i -1].GetInt16();
|
||||
|
||||
for (uint8 i = 0; i < CREATURE_MAX_SPELLS; ++i)
|
||||
creatureTemplate.spells[i] = fields[53 + i].GetUInt32();
|
||||
|
||||
creatureTemplate.PetSpellDataId = fields[61].GetUInt32();
|
||||
creatureTemplate.VehicleId = fields[62].GetUInt32();
|
||||
creatureTemplate.mingold = fields[63].GetUInt32();
|
||||
creatureTemplate.maxgold = fields[64].GetUInt32();
|
||||
creatureTemplate.AIName = fields[65].GetString();
|
||||
creatureTemplate.MovementType = uint32(fields[66].GetUInt8());
|
||||
creatureTemplate.InhabitType = uint32(fields[67].GetUInt8());
|
||||
creatureTemplate.HoverHeight = fields[68].GetFloat();
|
||||
creatureTemplate.ModHealth = fields[69].GetFloat();
|
||||
creatureTemplate.ModMana = fields[70].GetFloat();
|
||||
creatureTemplate.ModArmor = fields[71].GetFloat();
|
||||
creatureTemplate.RacialLeader = fields[72].GetBool();
|
||||
|
||||
for (uint8 i = 0; i < MAX_CREATURE_QUEST_ITEMS; ++i)
|
||||
creatureTemplate.questItems[i] = fields[73 + i].GetUInt32();
|
||||
|
||||
creatureTemplate.movementId = fields[79].GetUInt32();
|
||||
creatureTemplate.RegenHealth = fields[80].GetBool();
|
||||
creatureTemplate.MechanicImmuneMask = fields[81].GetUInt32();
|
||||
creatureTemplate.flags_extra = fields[82].GetUInt32();
|
||||
creatureTemplate.ScriptID = GetScriptId(fields[83].GetCString());
|
||||
|
||||
LoadCreatureTemplate(fields);
|
||||
++count;
|
||||
}
|
||||
while (result->NextRow());
|
||||
@@ -517,6 +434,88 @@ void ObjectMgr::LoadCreatureTemplates()
|
||||
TC_LOG_INFO("server.loading", ">> Loaded %u creature definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||
}
|
||||
|
||||
void ObjectMgr::LoadCreatureTemplate(Field* fields)
|
||||
{
|
||||
uint32 entry = fields[0].GetUInt32();
|
||||
|
||||
CreatureTemplate& creatureTemplate = _creatureTemplateStore[entry];
|
||||
|
||||
creatureTemplate.Entry = entry;
|
||||
|
||||
for (uint8 i = 0; i < MAX_DIFFICULTY - 1; ++i)
|
||||
creatureTemplate.DifficultyEntry[i] = fields[1 + i].GetUInt32();
|
||||
|
||||
for (uint8 i = 0; i < MAX_KILL_CREDIT; ++i)
|
||||
creatureTemplate.KillCredit[i] = fields[4 + i].GetUInt32();
|
||||
|
||||
creatureTemplate.Modelid1 = fields[6].GetUInt32();
|
||||
creatureTemplate.Modelid2 = fields[7].GetUInt32();
|
||||
creatureTemplate.Modelid3 = fields[8].GetUInt32();
|
||||
creatureTemplate.Modelid4 = fields[9].GetUInt32();
|
||||
creatureTemplate.Name = fields[10].GetString();
|
||||
creatureTemplate.SubName = fields[11].GetString();
|
||||
creatureTemplate.IconName = fields[12].GetString();
|
||||
creatureTemplate.GossipMenuId = fields[13].GetUInt32();
|
||||
creatureTemplate.minlevel = fields[14].GetUInt8();
|
||||
creatureTemplate.maxlevel = fields[15].GetUInt8();
|
||||
creatureTemplate.expansion = uint32(fields[16].GetInt16());
|
||||
creatureTemplate.faction = fields[17].GetUInt16();
|
||||
creatureTemplate.npcflag = fields[18].GetUInt32();
|
||||
creatureTemplate.speed_walk = fields[19].GetFloat();
|
||||
creatureTemplate.speed_run = fields[20].GetFloat();
|
||||
creatureTemplate.scale = fields[21].GetFloat();
|
||||
creatureTemplate.rank = fields[22].GetUInt8();
|
||||
creatureTemplate.dmgschool = uint32(fields[23].GetInt8());
|
||||
creatureTemplate.BaseAttackTime = fields[24].GetUInt32();
|
||||
creatureTemplate.RangeAttackTime = fields[25].GetUInt32();
|
||||
creatureTemplate.BaseVariance = fields[26].GetFloat();
|
||||
creatureTemplate.RangeVariance = fields[27].GetFloat();
|
||||
creatureTemplate.unit_class = fields[28].GetUInt8();
|
||||
creatureTemplate.unit_flags = fields[29].GetUInt32();
|
||||
creatureTemplate.unit_flags2 = fields[30].GetUInt32();
|
||||
creatureTemplate.dynamicflags = fields[31].GetUInt32();
|
||||
creatureTemplate.family = fields[32].GetUInt8();
|
||||
creatureTemplate.trainer_type = fields[33].GetUInt8();
|
||||
creatureTemplate.trainer_spell = fields[34].GetUInt32();
|
||||
creatureTemplate.trainer_class = fields[35].GetUInt8();
|
||||
creatureTemplate.trainer_race = fields[36].GetUInt8();
|
||||
creatureTemplate.type = fields[37].GetUInt8();
|
||||
creatureTemplate.type_flags = fields[38].GetUInt32();
|
||||
creatureTemplate.lootid = fields[39].GetUInt32();
|
||||
creatureTemplate.pickpocketLootId = fields[40].GetUInt32();
|
||||
creatureTemplate.SkinLootId = fields[41].GetUInt32();
|
||||
|
||||
for (uint8 i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i)
|
||||
creatureTemplate.resistance[i] = fields[42 + i - 1].GetInt16();
|
||||
|
||||
for (uint8 i = 0; i < CREATURE_MAX_SPELLS; ++i)
|
||||
creatureTemplate.spells[i] = fields[48 + i].GetUInt32();
|
||||
|
||||
creatureTemplate.PetSpellDataId = fields[56].GetUInt32();
|
||||
creatureTemplate.VehicleId = fields[57].GetUInt32();
|
||||
creatureTemplate.mingold = fields[58].GetUInt32();
|
||||
creatureTemplate.maxgold = fields[59].GetUInt32();
|
||||
creatureTemplate.AIName = fields[60].GetString();
|
||||
creatureTemplate.MovementType = fields[61].GetUInt8();
|
||||
creatureTemplate.InhabitType = fields[62].GetUInt8();
|
||||
creatureTemplate.HoverHeight = fields[63].GetFloat();
|
||||
creatureTemplate.ModHealth = fields[64].GetFloat();
|
||||
creatureTemplate.ModMana = fields[65].GetFloat();
|
||||
creatureTemplate.ModArmor = fields[66].GetFloat();
|
||||
creatureTemplate.ModDamage = fields[67].GetFloat();
|
||||
creatureTemplate.ModExperience = fields[68].GetFloat();
|
||||
creatureTemplate.RacialLeader = fields[69].GetBool();
|
||||
|
||||
for (uint8 i = 0; i < MAX_CREATURE_QUEST_ITEMS; ++i)
|
||||
creatureTemplate.questItems[i] = fields[70 + i].GetUInt32();
|
||||
|
||||
creatureTemplate.movementId = fields[76].GetUInt32();
|
||||
creatureTemplate.RegenHealth = fields[77].GetBool();
|
||||
creatureTemplate.MechanicImmuneMask = fields[78].GetUInt32();
|
||||
creatureTemplate.flags_extra = fields[79].GetUInt32();
|
||||
creatureTemplate.ScriptID = GetScriptId(fields[80].GetCString());
|
||||
}
|
||||
|
||||
void ObjectMgr::LoadCreatureTemplateAddons()
|
||||
{
|
||||
uint32 oldMSTime = getMSTime();
|
||||
@@ -856,11 +855,11 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo)
|
||||
const_cast<CreatureTemplate*>(cInfo)->dmgschool = SPELL_SCHOOL_NORMAL;
|
||||
}
|
||||
|
||||
if (cInfo->baseattacktime == 0)
|
||||
const_cast<CreatureTemplate*>(cInfo)->baseattacktime = BASE_ATTACK_TIME;
|
||||
if (cInfo->BaseAttackTime == 0)
|
||||
const_cast<CreatureTemplate*>(cInfo)->BaseAttackTime = BASE_ATTACK_TIME;
|
||||
|
||||
if (cInfo->rangeattacktime == 0)
|
||||
const_cast<CreatureTemplate*>(cInfo)->rangeattacktime = BASE_ATTACK_TIME;
|
||||
if (cInfo->RangeAttackTime == 0)
|
||||
const_cast<CreatureTemplate*>(cInfo)->RangeAttackTime = BASE_ATTACK_TIME;
|
||||
|
||||
if ((cInfo->npcflag & UNIT_NPC_FLAG_TRAINER) && cInfo->trainer_type >= MAX_TRAINER_TYPE)
|
||||
TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has wrong trainer type %u.", cInfo->Entry, cInfo->trainer_type);
|
||||
@@ -955,7 +954,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo)
|
||||
const_cast<CreatureTemplate*>(cInfo)->flags_extra &= CREATURE_FLAG_EXTRA_DB_ALLOWED;
|
||||
}
|
||||
|
||||
const_cast<CreatureTemplate*>(cInfo)->dmg_multiplier *= Creature::_GetDamageMod(cInfo->rank);
|
||||
const_cast<CreatureTemplate*>(cInfo)->ModDamage *= Creature::_GetDamageMod(cInfo->rank);
|
||||
}
|
||||
|
||||
void ObjectMgr::LoadCreatureAddons()
|
||||
|
||||
@@ -961,6 +961,7 @@ class ObjectMgr
|
||||
void LoadCreatureLocales();
|
||||
void LoadCreatureTemplates();
|
||||
void LoadCreatureTemplateAddons();
|
||||
void LoadCreatureTemplate(Field* fields);
|
||||
void CheckCreatureTemplate(CreatureTemplate const* cInfo);
|
||||
void LoadTempSummons();
|
||||
void LoadCreatures();
|
||||
|
||||
@@ -160,27 +160,32 @@ namespace Trinity
|
||||
|
||||
inline uint32 Gain(Player* player, Unit* u)
|
||||
{
|
||||
uint32 gain;
|
||||
Creature* creature = u->ToCreature();
|
||||
uint32 gain = 0;
|
||||
|
||||
if (u->GetTypeId() == TYPEID_UNIT &&
|
||||
(((Creature*)u)->IsTotem() || ((Creature*)u)->IsPet() ||
|
||||
(((Creature*)u)->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_XP_AT_KILL) ||
|
||||
((Creature*)u)->GetCreatureTemplate()->type == CREATURE_TYPE_CRITTER))
|
||||
gain = 0;
|
||||
else
|
||||
if (!creature || (!creature->IsTotem() && !creature->IsPet() && !creature->IsCritter() &&
|
||||
!(creature->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_XP_AT_KILL)))
|
||||
{
|
||||
float xpMod = 1.0f;
|
||||
|
||||
gain = BaseGain(player->getLevel(), u->getLevel(), GetContentLevelsForMapAndZone(u->GetMapId(), u->GetZoneId()));
|
||||
|
||||
if (gain != 0 && u->GetTypeId() == TYPEID_UNIT && ((Creature*)u)->isElite())
|
||||
if (gain && creature)
|
||||
{
|
||||
// Elites in instances have a 2.75x XP bonus instead of the regular 2x world bonus.
|
||||
if (u->GetMap() && u->GetMap()->IsDungeon())
|
||||
gain = uint32(gain * 2.75);
|
||||
else
|
||||
gain *= 2;
|
||||
if (creature->isElite())
|
||||
{
|
||||
// Elites in instances have a 2.75x XP bonus instead of the regular 2x world bonus.
|
||||
if (u->GetMap() && u->GetMap()->IsDungeon())
|
||||
xpMod *= 2.75f;
|
||||
else
|
||||
xpMod *= 2.0f;
|
||||
}
|
||||
|
||||
xpMod *= creature->GetCreatureTemplate()->ModExperience;
|
||||
}
|
||||
|
||||
gain = uint32(gain * sWorld->getRate(RATE_XP_KILL));
|
||||
xpMod *= sWorld->getRate(RATE_XP_KILL);
|
||||
gain = uint32(gain * xpMod);
|
||||
}
|
||||
|
||||
sScriptMgr->OnGainCalculation(gain, player, u);
|
||||
|
||||
@@ -266,7 +266,6 @@ void AddSC_blasted_lands();
|
||||
void AddSC_burning_steppes();
|
||||
void AddSC_duskwood();
|
||||
void AddSC_eastern_plaguelands();
|
||||
void AddSC_eversong_woods();
|
||||
void AddSC_ghostlands();
|
||||
void AddSC_hinterlands();
|
||||
void AddSC_isle_of_queldanas();
|
||||
|
||||
@@ -5088,7 +5088,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
return SPELL_FAILED_TARGET_UNSKINNABLE;
|
||||
|
||||
Creature* creature = m_targets.GetUnitTarget()->ToCreature();
|
||||
if (creature->GetCreatureType() != CREATURE_TYPE_CRITTER && !creature->loot.isLooted())
|
||||
if (!creature->IsCritter() && !creature->loot.isLooted())
|
||||
return SPELL_FAILED_TARGET_NOT_LOOTED;
|
||||
|
||||
uint32 skill = creature->GetCreatureTemplate()->GetRequiredLootSkill();
|
||||
|
||||
@@ -109,21 +109,23 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (sWorld->BanCharacter(name, durationStr, reasonStr, handler->GetSession() ? handler->GetSession()->GetPlayerName().c_str() : ""))
|
||||
std::string author = handler->GetSession() ? handler->GetSession()->GetPlayerName() : "Server";
|
||||
|
||||
switch (sWorld->BanCharacter(name, durationStr, reasonStr, author))
|
||||
{
|
||||
case BAN_SUCCESS:
|
||||
{
|
||||
if (atoi(durationStr) > 0)
|
||||
{
|
||||
if (sWorld->getBoolConfig(CONFIG_SHOW_BAN_IN_WORLD))
|
||||
sWorld->SendWorldText(LANG_BAN_CHARACTER_YOUBANNEDMESSAGE_WORLD, (handler->GetSession() ? handler->GetSession()->GetPlayerName().c_str() : "Server"), name.c_str(), secsToTimeString(TimeStringToSecs(durationStr), true).c_str(), reasonStr);
|
||||
sWorld->SendWorldText(LANG_BAN_CHARACTER_YOUBANNEDMESSAGE_WORLD, author.c_str(), name.c_str(), secsToTimeString(TimeStringToSecs(durationStr), true).c_str(), reasonStr);
|
||||
else
|
||||
handler->PSendSysMessage(LANG_BAN_YOUBANNED, name.c_str(), secsToTimeString(TimeStringToSecs(durationStr), true).c_str(), reasonStr);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sWorld->getBoolConfig(CONFIG_SHOW_BAN_IN_WORLD))
|
||||
sWorld->SendWorldText(LANG_BAN_CHARACTER_YOUPERMBANNEDMESSAGE_WORLD, (handler->GetSession() ? handler->GetSession()->GetPlayerName().c_str() : "Server"), name.c_str(), reasonStr);
|
||||
sWorld->SendWorldText(LANG_BAN_CHARACTER_YOUPERMBANNEDMESSAGE_WORLD, author.c_str(), name.c_str(), reasonStr);
|
||||
else
|
||||
handler->PSendSysMessage(LANG_BAN_YOUPERMBANNED, name.c_str(), reasonStr);
|
||||
}
|
||||
@@ -195,20 +197,22 @@ public:
|
||||
break;
|
||||
}
|
||||
|
||||
switch (sWorld->BanAccount(mode, nameOrIP, durationStr, reasonStr, handler->GetSession() ? handler->GetSession()->GetPlayerName().c_str() : ""))
|
||||
std::string author = handler->GetSession() ? handler->GetSession()->GetPlayerName() : "Server";
|
||||
|
||||
switch (sWorld->BanAccount(mode, nameOrIP, durationStr, reasonStr, author))
|
||||
{
|
||||
case BAN_SUCCESS:
|
||||
if (atoi(durationStr) > 0)
|
||||
{
|
||||
if (sWorld->getBoolConfig(CONFIG_SHOW_BAN_IN_WORLD))
|
||||
sWorld->SendWorldText(LANG_BAN_ACCOUNT_YOUBANNEDMESSAGE_WORLD, (handler->GetSession() ? handler->GetSession()->GetPlayerName().c_str() : "Server"), nameOrIP.c_str(), secsToTimeString(TimeStringToSecs(durationStr), true).c_str(), reasonStr);
|
||||
sWorld->SendWorldText(LANG_BAN_ACCOUNT_YOUBANNEDMESSAGE_WORLD, author.c_str(), nameOrIP.c_str(), secsToTimeString(TimeStringToSecs(durationStr), true).c_str(), reasonStr);
|
||||
else
|
||||
handler->PSendSysMessage(LANG_BAN_YOUBANNED, nameOrIP.c_str(), secsToTimeString(TimeStringToSecs(durationStr), true).c_str(), reasonStr);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sWorld->getBoolConfig(CONFIG_SHOW_BAN_IN_WORLD))
|
||||
sWorld->SendWorldText(LANG_BAN_ACCOUNT_YOUPERMBANNEDMESSAGE_WORLD, (handler->GetSession() ? handler->GetSession()->GetPlayerName().c_str() : "Server"), nameOrIP.c_str(), reasonStr);
|
||||
sWorld->SendWorldText(LANG_BAN_ACCOUNT_YOUPERMBANNEDMESSAGE_WORLD, author.c_str(), nameOrIP.c_str(), reasonStr);
|
||||
else
|
||||
handler->PSendSysMessage(LANG_BAN_YOUPERMBANNED, nameOrIP.c_str(), reasonStr);
|
||||
}
|
||||
|
||||
@@ -1609,16 +1609,7 @@ public:
|
||||
banReason = fields[3].GetString();
|
||||
}
|
||||
|
||||
// Can be used to query data from World database
|
||||
stmt2 = WorldDatabase.GetPreparedStatement(WORLD_SEL_REQ_XP);
|
||||
stmt2->setUInt8(0, level);
|
||||
PreparedQueryResult result3 = WorldDatabase.Query(stmt2);
|
||||
|
||||
if (result3)
|
||||
{
|
||||
Field* fields = result3->Fetch();
|
||||
xptotal = fields[0].GetUInt32();
|
||||
}
|
||||
|
||||
// Can be used to query data from Characters database
|
||||
stmt2 = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PINFO_XP);
|
||||
@@ -1630,6 +1621,7 @@ public:
|
||||
Field* fields = result4->Fetch();
|
||||
xp = fields[0].GetUInt32(); // Used for "current xp" output and "%u XP Left" calculation
|
||||
uint32 gguid = fields[1].GetUInt32(); // We check if have a guild for the person, so we might not require to query it at all
|
||||
xptotal = sObjectMgr->GetXPForLevel(level);
|
||||
|
||||
if (gguid != 0)
|
||||
{
|
||||
@@ -1766,10 +1758,10 @@ public:
|
||||
Player* player = handler->GetSession()->GetPlayer();
|
||||
|
||||
// accept only explicitly selected target (not implicitly self targeting case)
|
||||
Unit* target = handler->getSelectedUnit();
|
||||
if (player->GetTarget() && target)
|
||||
Creature* target = player->GetTarget() ? handler->getSelectedCreature() : nullptr;
|
||||
if (target)
|
||||
{
|
||||
if (target->GetTypeId() != TYPEID_UNIT || target->IsPet())
|
||||
if (target->IsPet())
|
||||
{
|
||||
handler->SendSysMessage(LANG_SELECT_CREATURE);
|
||||
handler->SetSentErrorMessage(true);
|
||||
@@ -1777,19 +1769,13 @@ public:
|
||||
}
|
||||
|
||||
if (target->isDead())
|
||||
target->ToCreature()->Respawn();
|
||||
target->Respawn();
|
||||
return true;
|
||||
}
|
||||
|
||||
CellCoord p(Trinity::ComputeCellCoord(player->GetPositionX(), player->GetPositionY()));
|
||||
Cell cell(p);
|
||||
cell.SetNoCreate();
|
||||
|
||||
Trinity::RespawnDo u_do;
|
||||
Trinity::WorldObjectWorker<Trinity::RespawnDo> worker(player, u_do);
|
||||
|
||||
TypeContainerVisitor<Trinity::WorldObjectWorker<Trinity::RespawnDo>, GridTypeMapContainer > obj_worker(worker);
|
||||
cell.Visit(p, obj_worker, *player->GetMap(), *player, player->GetGridActivationRange());
|
||||
player->VisitNearbyGridObject(player->GetGridActivationRange(), worker);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1843,14 +1829,9 @@ public:
|
||||
std::string nameLink = handler->playerLink(targetName);
|
||||
|
||||
if (sWorld->getBoolConfig(CONFIG_SHOW_MUTE_IN_WORLD))
|
||||
{
|
||||
sWorld->SendWorldText(LANG_COMMAND_MUTEMESSAGE_WORLD, (handler->GetSession() ? handler->GetSession()->GetPlayerName().c_str() : "Server"), nameLink.c_str(), notSpeakTime, muteReasonStr.c_str());
|
||||
ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOUR_CHAT_DISABLED, notSpeakTime, muteBy.c_str(), muteReasonStr.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOUR_CHAT_DISABLED, notSpeakTime, muteBy.c_str(), muteReasonStr.c_str());
|
||||
}
|
||||
sWorld->SendWorldText(LANG_COMMAND_MUTEMESSAGE_WORLD, muteBy.c_str(), nameLink.c_str(), notSpeakTime, muteReasonStr.c_str());
|
||||
|
||||
ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOUR_CHAT_DISABLED, notSpeakTime, muteBy.c_str(), muteReasonStr.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1865,10 +1846,11 @@ public:
|
||||
LoginDatabase.Execute(stmt);
|
||||
std::string nameLink = handler->playerLink(targetName);
|
||||
|
||||
if (sWorld->getBoolConfig(CONFIG_SHOW_MUTE_IN_WORLD) && !target)
|
||||
sWorld->SendWorldText(LANG_COMMAND_MUTEMESSAGE_WORLD, handler->GetSession()->GetPlayerName().c_str(), nameLink.c_str(), notSpeakTime, muteReasonStr.c_str());
|
||||
else
|
||||
handler->PSendSysMessage(target ? LANG_YOU_DISABLE_CHAT : LANG_COMMAND_DISABLE_CHAT_DELAYED, nameLink.c_str(), notSpeakTime, muteReasonStr.c_str());
|
||||
if (sWorld->getBoolConfig(CONFIG_SHOW_MUTE_IN_WORLD) && !target)
|
||||
sWorld->SendWorldText(LANG_COMMAND_MUTEMESSAGE_WORLD, muteBy.c_str(), nameLink.c_str(), notSpeakTime, muteReasonStr.c_str());
|
||||
else
|
||||
handler->PSendSysMessage(target ? LANG_YOU_DISABLE_CHAT : LANG_COMMAND_DISABLE_CHAT_DELAYED, nameLink.c_str(), notSpeakTime, muteReasonStr.c_str());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -440,7 +440,7 @@ public:
|
||||
continue;
|
||||
}
|
||||
|
||||
CreatureTemplate* cInfo = const_cast<CreatureTemplate*>(sObjectMgr->GetCreatureTemplate(entry));
|
||||
CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(entry);
|
||||
if (!cInfo)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_COMMAND_CREATURESTORAGE_NOTFOUND, entry);
|
||||
@@ -450,89 +450,7 @@ public:
|
||||
TC_LOG_INFO("misc", "Reloading creature template entry %u", entry);
|
||||
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
cInfo->DifficultyEntry[0] = fields[0].GetUInt32();
|
||||
cInfo->DifficultyEntry[1] = fields[1].GetUInt32();
|
||||
cInfo->DifficultyEntry[2] = fields[2].GetUInt32();
|
||||
cInfo->KillCredit[0] = fields[3].GetUInt32();
|
||||
cInfo->KillCredit[1] = fields[4].GetUInt32();
|
||||
cInfo->Modelid1 = fields[5].GetUInt32();
|
||||
cInfo->Modelid2 = fields[6].GetUInt32();
|
||||
cInfo->Modelid3 = fields[7].GetUInt32();
|
||||
cInfo->Modelid4 = fields[8].GetUInt32();
|
||||
cInfo->Name = fields[9].GetString();
|
||||
cInfo->SubName = fields[10].GetString();
|
||||
cInfo->IconName = fields[11].GetString();
|
||||
cInfo->GossipMenuId = fields[12].GetUInt32();
|
||||
cInfo->minlevel = fields[13].GetUInt8();
|
||||
cInfo->maxlevel = fields[14].GetUInt8();
|
||||
cInfo->expansion = fields[15].GetUInt16();
|
||||
cInfo->faction = fields[16].GetUInt16();
|
||||
cInfo->npcflag = fields[17].GetUInt32();
|
||||
cInfo->speed_walk = fields[18].GetFloat();
|
||||
cInfo->speed_run = fields[19].GetFloat();
|
||||
cInfo->scale = fields[20].GetFloat();
|
||||
cInfo->rank = fields[21].GetUInt8();
|
||||
cInfo->mindmg = fields[22].GetFloat();
|
||||
cInfo->maxdmg = fields[23].GetFloat();
|
||||
cInfo->dmgschool = fields[24].GetUInt8();
|
||||
cInfo->attackpower = fields[25].GetUInt32();
|
||||
cInfo->dmg_multiplier = fields[26].GetFloat();
|
||||
cInfo->baseattacktime = fields[27].GetUInt32();
|
||||
cInfo->rangeattacktime = fields[28].GetUInt32();
|
||||
cInfo->unit_class = fields[29].GetUInt8();
|
||||
cInfo->unit_flags = fields[30].GetUInt32();
|
||||
cInfo->unit_flags2 = fields[31].GetUInt32();
|
||||
cInfo->dynamicflags = fields[32].GetUInt32();
|
||||
cInfo->family = fields[33].GetUInt8();
|
||||
cInfo->trainer_type = fields[34].GetUInt8();
|
||||
cInfo->trainer_spell = fields[35].GetUInt32();
|
||||
cInfo->trainer_class = fields[36].GetUInt8();
|
||||
cInfo->trainer_race = fields[37].GetUInt8();
|
||||
cInfo->minrangedmg = fields[38].GetFloat();
|
||||
cInfo->maxrangedmg = fields[39].GetFloat();
|
||||
cInfo->rangedattackpower = fields[40].GetUInt16();
|
||||
cInfo->type = fields[41].GetUInt8();
|
||||
cInfo->type_flags = fields[42].GetUInt32();
|
||||
cInfo->lootid = fields[43].GetUInt32();
|
||||
cInfo->pickpocketLootId = fields[44].GetUInt32();
|
||||
cInfo->SkinLootId = fields[45].GetUInt32();
|
||||
|
||||
for (uint8 i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i)
|
||||
cInfo->resistance[i] = fields[46 + i -1].GetUInt16();
|
||||
|
||||
cInfo->spells[0] = fields[52].GetUInt32();
|
||||
cInfo->spells[1] = fields[53].GetUInt32();
|
||||
cInfo->spells[2] = fields[54].GetUInt32();
|
||||
cInfo->spells[3] = fields[55].GetUInt32();
|
||||
cInfo->spells[4] = fields[56].GetUInt32();
|
||||
cInfo->spells[5] = fields[57].GetUInt32();
|
||||
cInfo->spells[6] = fields[58].GetUInt32();
|
||||
cInfo->spells[7] = fields[59].GetUInt32();
|
||||
cInfo->PetSpellDataId = fields[60].GetUInt32();
|
||||
cInfo->VehicleId = fields[61].GetUInt32();
|
||||
cInfo->mingold = fields[62].GetUInt32();
|
||||
cInfo->maxgold = fields[63].GetUInt32();
|
||||
cInfo->AIName = fields[64].GetString();
|
||||
cInfo->MovementType = fields[65].GetUInt8();
|
||||
cInfo->InhabitType = fields[66].GetUInt8();
|
||||
cInfo->HoverHeight = fields[67].GetFloat();
|
||||
cInfo->ModHealth = fields[68].GetFloat();
|
||||
cInfo->ModMana = fields[69].GetFloat();
|
||||
cInfo->ModArmor = fields[70].GetFloat();
|
||||
cInfo->RacialLeader = fields[71].GetBool();
|
||||
cInfo->questItems[0] = fields[72].GetUInt32();
|
||||
cInfo->questItems[1] = fields[73].GetUInt32();
|
||||
cInfo->questItems[2] = fields[74].GetUInt32();
|
||||
cInfo->questItems[3] = fields[75].GetUInt32();
|
||||
cInfo->questItems[4] = fields[76].GetUInt32();
|
||||
cInfo->questItems[5] = fields[77].GetUInt32();
|
||||
cInfo->movementId = fields[78].GetUInt32();
|
||||
cInfo->RegenHealth = fields[79].GetBool();
|
||||
cInfo->MechanicImmuneMask = fields[80].GetUInt32();
|
||||
cInfo->flags_extra = fields[81].GetUInt32();
|
||||
cInfo->ScriptID = sObjectMgr->GetScriptId(fields[82].GetCString());
|
||||
|
||||
sObjectMgr->LoadCreatureTemplate(fields);
|
||||
sObjectMgr->CheckCreatureTemplate(cInfo);
|
||||
}
|
||||
|
||||
|
||||
@@ -47,27 +47,20 @@ class npc_willix : public CreatureScript
|
||||
public:
|
||||
npc_willix() : CreatureScript("npc_willix") { }
|
||||
|
||||
bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest) override
|
||||
{
|
||||
if (quest->GetQuestId() == QUEST_WILLIX_THE_IMPORTER)
|
||||
{
|
||||
ENSURE_AI(npc_escortAI, (creature->AI()))->Start(true, false, player->GetGUID());
|
||||
creature->AI()->Talk(SAY_READY, player);
|
||||
creature->setFaction(113);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const override
|
||||
{
|
||||
return new npc_willixAI(creature);
|
||||
}
|
||||
|
||||
struct npc_willixAI : public npc_escortAI
|
||||
{
|
||||
npc_willixAI(Creature* creature) : npc_escortAI(creature) { }
|
||||
|
||||
void sQuestAccept(Player* player, Quest const* quest) override
|
||||
{
|
||||
if (quest->GetQuestId() == QUEST_WILLIX_THE_IMPORTER)
|
||||
{
|
||||
Start(true, false, player->GetGUID());
|
||||
Talk(SAY_READY, player);
|
||||
me->setFaction(113);
|
||||
}
|
||||
}
|
||||
|
||||
void WaypointReached(uint32 waypointId) override
|
||||
{
|
||||
Player* player = GetPlayerForEscort();
|
||||
@@ -137,6 +130,10 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const override
|
||||
{
|
||||
return new npc_willixAI(creature);
|
||||
}
|
||||
};
|
||||
|
||||
enum SnufflenoseGopher
|
||||
@@ -147,18 +144,6 @@ enum SnufflenoseGopher
|
||||
POINT_TUBBER = 0
|
||||
};
|
||||
|
||||
struct DistanceOrder : public std::binary_function<GameObject, GameObject, bool>
|
||||
{
|
||||
DistanceOrder(Creature* me) : me(me) { }
|
||||
|
||||
bool operator() (GameObject* first, GameObject* second)
|
||||
{
|
||||
return me->GetDistanceOrder(first, second);
|
||||
}
|
||||
|
||||
Creature* me;
|
||||
};
|
||||
|
||||
struct npc_snufflenose_gopher : public CreatureScript
|
||||
{
|
||||
public:
|
||||
@@ -208,18 +193,14 @@ public:
|
||||
if (tubbersInRange.empty())
|
||||
return;
|
||||
|
||||
tubbersInRange.sort(DistanceOrder(me));
|
||||
GameObject* nearestTubber = NULL;
|
||||
|
||||
for (std::list<GameObject*>::const_iterator itr = tubbersInRange.begin(); itr != tubbersInRange.end(); ++itr)
|
||||
tubbersInRange.remove_if([](GameObject* go)
|
||||
{
|
||||
if (!(*itr)->isSpawned() && (*itr)->HasFlag(GAMEOBJECT_FLAGS, GO_FLAG_INTERACT_COND))
|
||||
{
|
||||
nearestTubber = *itr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return go->isSpawned() || !go->HasFlag(GAMEOBJECT_FLAGS, GO_FLAG_INTERACT_COND);
|
||||
});
|
||||
|
||||
tubbersInRange.sort(Trinity::ObjectDistanceOrderPred(me));
|
||||
|
||||
GameObject* nearestTubber = tubbersInRange.front();
|
||||
if (!nearestTubber)
|
||||
return;
|
||||
|
||||
@@ -259,21 +240,16 @@ class spell_snufflenose_command : public SpellScriptLoader
|
||||
{
|
||||
PrepareSpellScript(spell_snufflenose_commandSpellScript);
|
||||
|
||||
bool Load() override
|
||||
void HandleEffect(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
|
||||
}
|
||||
|
||||
void HandleAfterCast()
|
||||
{
|
||||
if (Unit* target = GetCaster()->ToPlayer()->GetSelectedUnit())
|
||||
if (Creature* target = GetHitCreature())
|
||||
if (target->GetEntry() == NPC_SNUFFLENOSE_GOPHER)
|
||||
target->ToCreature()->AI()->DoAction(ACTION_FIND_NEW_TUBBER);
|
||||
target->AI()->DoAction(ACTION_FIND_NEW_TUBBER);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
AfterCast += SpellCastFn(spell_snufflenose_commandSpellScript::HandleAfterCast);
|
||||
OnEffectHitTarget += SpellEffectFn(spell_snufflenose_commandSpellScript::HandleEffect, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ class npc_pet_hunter_snake_trap : public CreatureScript
|
||||
me->SetMaxHealth(uint32(107 * (me->getLevel() - 40) * 0.025f));
|
||||
// Add delta to make them not all hit the same time
|
||||
uint32 delta = (rand32() % 7) * 100;
|
||||
me->SetAttackTime(BASE_ATTACK, Info->baseattacktime + delta);
|
||||
me->SetAttackTime(BASE_ATTACK, Info->BaseAttackTime + delta);
|
||||
//me->SetStatFloatValue(UNIT_FIELD_RANGED_ATTACK_POWER, float(Info->attackpower));
|
||||
|
||||
// Start attacking attacker of owner on first ai update after spawn - move in line of sight may choose better target
|
||||
|
||||
@@ -991,7 +991,7 @@ class spell_item_unsated_craving : public SpellScriptLoader
|
||||
return false;
|
||||
|
||||
Unit* target = procInfo.GetActionTarget();
|
||||
if (!target || target->GetTypeId() != TYPEID_UNIT || target->GetCreatureType() == CREATURE_TYPE_CRITTER || (target->GetEntry() != NPC_SINDRAGOSA && target->IsSummon()))
|
||||
if (!target || target->GetTypeId() != TYPEID_UNIT || target->IsCritter() || (target->GetEntry() != NPC_SINDRAGOSA && target->IsSummon()))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
||||
@@ -76,7 +76,7 @@ void WorldDatabaseConnection::DoPrepareStatements()
|
||||
PrepareStatement(WORLD_SEL_WAYPOINT_SCRIPT_ID_BY_GUID, "SELECT id FROM waypoint_scripts WHERE guid = ?", CONNECTION_SYNCH);
|
||||
PrepareStatement(WORLD_DEL_CREATURE, "DELETE FROM creature WHERE guid = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(WORLD_SEL_COMMANDS, "SELECT name, permission, help FROM command", CONNECTION_SYNCH);
|
||||
PrepareStatement(WORLD_SEL_CREATURE_TEMPLATE, "SELECT difficulty_entry_1, difficulty_entry_2, difficulty_entry_3, KillCredit1, KillCredit2, modelid1, modelid2, modelid3, modelid4, name, subname, IconName, gossip_menu_id, minlevel, maxlevel, exp, faction, npcflag, speed_walk, speed_run, scale, rank, mindmg, maxdmg, dmgschool, attackpower, dmg_multiplier, baseattacktime, rangeattacktime, unit_class, unit_flags, unit_flags2, dynamicflags, family, trainer_type, trainer_spell, trainer_class, trainer_race, minrangedmg, maxrangedmg, rangedattackpower, type, type_flags, lootid, pickpocketloot, skinloot, resistance1, resistance2, resistance3, resistance4, resistance5, resistance6, spell1, spell2, spell3, spell4, spell5, spell6, spell7, spell8, PetSpellDataId, VehicleId, mingold, maxgold, AIName, MovementType, InhabitType, HoverHeight, Health_mod, Mana_mod, Armor_mod, RacialLeader, questItem1, questItem2, questItem3, questItem4, questItem5, questItem6, movementId, RegenHealth, mechanic_immune_mask, flags_extra, ScriptName FROM creature_template WHERE entry = ?", CONNECTION_SYNCH);
|
||||
PrepareStatement(WORLD_SEL_CREATURE_TEMPLATE, "SELECT entry, difficulty_entry_1, difficulty_entry_2, difficulty_entry_3, KillCredit1, KillCredit2, modelid1, modelid2, modelid3, modelid4, name, subname, IconName, gossip_menu_id, minlevel, maxlevel, exp, faction, npcflag, speed_walk, speed_run, scale, rank, dmgschool, BaseAttackTime, RangeAttackTime, BaseVariance, RangeVariance, unit_class, unit_flags, unit_flags2, dynamicflags, family, trainer_type, trainer_spell, trainer_class, trainer_race, type, type_flags, lootid, pickpocketloot, skinloot, resistance1, resistance2, resistance3, resistance4, resistance5, resistance6, spell1, spell2, spell3, spell4, spell5, spell6, spell7, spell8, PetSpellDataId, VehicleId, mingold, maxgold, AIName, MovementType, InhabitType, HoverHeight, HealthModifier, ManaModifier, ArmorModifier, DamageModifier, ExperienceModifier, RacialLeader, questItem1, questItem2, questItem3, questItem4, questItem5, questItem6, movementId, RegenHealth, mechanic_immune_mask, flags_extra, ScriptName FROM creature_template WHERE entry = ?", CONNECTION_SYNCH);
|
||||
PrepareStatement(WORLD_SEL_WAYPOINT_SCRIPT_BY_ID, "SELECT guid, delay, command, datalong, datalong2, dataint, x, y, z, o FROM waypoint_scripts WHERE id = ?", CONNECTION_SYNCH);
|
||||
PrepareStatement(WORLD_SEL_ITEM_TEMPLATE_BY_NAME, "SELECT entry FROM item_template WHERE name = ?", CONNECTION_SYNCH);
|
||||
PrepareStatement(WORLD_SEL_CREATURE_BY_ID, "SELECT guid FROM creature WHERE id = ?", CONNECTION_SYNCH);
|
||||
@@ -89,6 +89,4 @@ void WorldDatabaseConnection::DoPrepareStatements()
|
||||
PrepareStatement(WORLD_INS_DISABLES, "INSERT INTO disables (entry, sourceType, flags, comment) VALUES (?, ?, ?, ?)", CONNECTION_ASYNC);
|
||||
PrepareStatement(WORLD_SEL_DISABLES, "SELECT entry FROM disables WHERE entry = ? AND sourceType = ?", CONNECTION_SYNCH);
|
||||
PrepareStatement(WORLD_DEL_DISABLES, "DELETE FROM disables WHERE entry = ? AND sourceType = ?", CONNECTION_ASYNC);
|
||||
// 0: uint8
|
||||
PrepareStatement(WORLD_SEL_REQ_XP, "SELECT xp_for_next_level FROM player_xp_for_level WHERE lvl = ?", CONNECTION_SYNCH);
|
||||
}
|
||||
|
||||
@@ -110,7 +110,6 @@ enum WorldDatabaseStatements
|
||||
WORLD_SEL_DISABLES,
|
||||
WORLD_INS_DISABLES,
|
||||
WORLD_DEL_DISABLES,
|
||||
WORLD_SEL_REQ_XP,
|
||||
|
||||
MAX_WORLDDATABASE_STATEMENTS
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user