mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-19 17:05:44 +01:00
Core/Creature: update creature_template and some other small things
http://www.trinitycore.org/f/topic/9572-creature-damage/
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user