refactor(CORE/scripts): Clearer error when script unassigned or alrea… (#2576)

This commit is contained in:
Barbz
2020-01-29 08:18:59 +01:00
committed by GitHub
parent 1c4dbb571f
commit 8760a9f5c9
2 changed files with 22 additions and 119 deletions

View File

@@ -469,11 +469,11 @@ public:
class MovementHandlerScript : public ScriptObject
{
protected:
MovementHandlerScript(const char* name);
public:
//Called whenever a player moves
virtual void OnPlayerMove(Player* /*player*/, MovementInfo /*movementInfo*/, uint32 /*opcode*/) { }
};
@@ -762,7 +762,7 @@ class AchievementCriteriaScript : public ScriptObject
bool IsDatabaseBound() const { return true; }
// Called when an additional criteria is checked.
virtual bool OnCheck(Player* source, Unit* target, uint32 /*criteria_id*/) {
virtual bool OnCheck(Player* source, Unit* target, uint32 /*criteria_id*/) {
return OnCheck(source, target);
}
// deprecated/legacy
@@ -777,7 +777,7 @@ class PlayerScript : public ScriptObject
public:
virtual void OnPlayerReleasedGhost(Player* /*player*/) { }
// Called when a player completes a quest
virtual void OnPlayerCompleteQuest(Player* /*player*/, Quest const* /*quest_id*/) { }
@@ -921,7 +921,7 @@ class PlayerScript : public ScriptObject
// To change behaviour of set visible item slot
virtual void OnAfterSetVisibleItemSlot(Player* /*player*/, uint8 /*slot*/, Item* /*item*/) { }
// After an item has been moved from inventory
virtual void OnAfterMoveItemFromInventory(Player* /*player*/, Item* /*it*/, uint8 /*bag*/, uint8 /*slot*/, bool /*update*/) { }
@@ -933,7 +933,7 @@ class PlayerScript : public ScriptObject
// After player enters queue for Arena
virtual void OnPlayerJoinArena(Player* /*player*/) { }
//After looting item
virtual void OnLootItem(Player* /*player*/, Item* /*item*/, uint32 /*count*/, uint64 /*lootguid*/) { }
@@ -1079,7 +1079,7 @@ class GlobalScript : public ScriptObject
// items
virtual void OnItemDelFromDB(SQLTransaction& /*trans*/, uint32 /*itemGuid*/) { }
virtual void OnMirrorImageDisplayItem(const Item* /*item*/, uint32& /*display*/) { }
// loot
virtual void OnAfterRefCount(Player const* /*player*/, LootStoreItem* /*LootStoreItem*/, Loot& /*loot*/, bool /*canRate*/, uint16 /*lootMode*/, uint32& /*maxcount*/, LootStore const& /*store*/) { }
virtual void OnBeforeDropAddItem(Player const* /*player*/, Loot& /*loot*/, bool /*canRate*/, uint16 /*lootMode*/, LootStoreItem* /*LootStoreItem*/, LootStore const& /*store*/) { }
@@ -1087,10 +1087,10 @@ class GlobalScript : public ScriptObject
virtual void OnInitializeLockedDungeons(Player* /*player*/, uint8& /*level*/, uint32& /*lockData*/) { }
virtual void OnAfterInitializeLockedDungeons(Player* /*player*/) { }
// On Before arena points distribution
virtual void OnBeforeUpdateArenaPoints(ArenaTeam* /*at*/, std::map<uint32, uint32> & /*ap*/) { }
// Called when a dungeon encounter is updated.
virtual void OnAfterUpdateEncounterState(Map* /*map*/, EncounterCreditType /*type*/, uint32 /*creditEntry*/, Unit* /*source*/, Difficulty /*difficulty_fixed*/, DungeonEncounterList const* /*encounters*/, uint32 /*dungeonCompleted*/, bool /*updated*/) { }
};
@@ -1145,7 +1145,7 @@ public:
bool IsDatabaseBound() const { return false; }
// Calculate max duration in applying aura
// Calculate max duration in applying aura
virtual void OnCalcMaxDuration(Aura const* /*aura*/, int32& /*maxDuration*/) { }
};
@@ -1167,7 +1167,7 @@ protected:
public:
// Runs on start event
virtual void OnStart(uint16 /*EventID*/) { }
// Runs on stop event
virtual void OnStop(uint16 /*EventID*/) { }
};
@@ -1479,11 +1479,11 @@ class ScriptMgr
uint32 DealDamage(Unit* AttackerUnit, Unit *pVictim, uint32 damage, DamageEffectType damagetype);
void OnBeforeRollMeleeOutcomeAgainst(const Unit* attacker, const Unit* victim, WeaponAttackType attType, int32 &attackerMaxSkillValueForLevel, int32 &victimMaxSkillValueForLevel, int32 &attackerWeaponSkill, int32 &victimDefenseSkill, int32 &crit_chance, int32 &miss_chance, int32 &dodge_chance, int32 &parry_chance, int32 &block_chance);
public: /* MovementHandlerScript */
void OnPlayerMove(Player* player, MovementInfo movementInfo, uint32 opcode);
public: /* AllCreatureScript */
//listener function (OnAllCreatureUpdate) is called by OnCreatureUpdate
@@ -1512,7 +1512,7 @@ class ScriptMgr
bool CanSendMessageQueue(BattlegroundQueue* queue, Player* leader, Battleground* bg, PvPDifficultyEntry const* bracketEntry);
public: /* SpellSC */
void OnCalcMaxDuration(Aura const* aura, int32& maxDuration);
public: /* GameEventScript */
@@ -1606,7 +1606,7 @@ class ScriptRegistry
else
{
// If the script is already assigned -> delete it!
sLog->outError("Script '%s' already assigned with the same script name, so the script can't work.",
sLog->outError("Script named '%s' is already assigned (two or more scripts have the same name), so the script can't work, aborting...",
script->GetName().c_str());
ABORT(); // Error that should be fixed ASAP.
@@ -1616,7 +1616,7 @@ class ScriptRegistry
{
// The script uses a script name from database, but isn't assigned to anything.
if (script->GetName().find("Smart") == std::string::npos)
sLog->outErrorDb("Script named '%s' does not have a script name assigned in database.",
sLog->outErrorDb("Script named '%s' is not assigned in the database.",
script->GetName().c_str());
}
} else {