mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-02-02 07:07:29 +01:00
Core/Script: Clean-Up in Scripts.
Item* pItem -> Item* item Signed-off-by: Gyx <2359980687@qq.com>
This commit is contained in:
@@ -55,8 +55,8 @@ class spell_item_trigger_spell : public SpellScriptLoader
|
||||
void HandleDummy(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
if (Item* pItem = GetCastItem())
|
||||
caster->CastSpell(caster, _triggeredSpellId, true, pItem);
|
||||
if (Item* item = GetCastItem())
|
||||
caster->CastSpell(caster, _triggeredSpellId, true, item);
|
||||
}
|
||||
|
||||
void Register()
|
||||
|
||||
@@ -47,9 +47,9 @@ class item_only_for_flight : public ItemScript
|
||||
public:
|
||||
item_only_for_flight() : ItemScript("item_only_for_flight") { }
|
||||
|
||||
bool OnUse(Player* player, Item* pItem, SpellCastTargets const& /*targets*/)
|
||||
bool OnUse(Player* player, Item* item, SpellCastTargets const& /*targets*/)
|
||||
{
|
||||
uint32 itemId = pItem->GetEntry();
|
||||
uint32 itemId = item->GetEntry();
|
||||
bool disabled = false;
|
||||
|
||||
//for special scripts
|
||||
@@ -74,7 +74,7 @@ public:
|
||||
return false;
|
||||
|
||||
// error
|
||||
player->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, pItem, NULL);
|
||||
player->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, item, NULL);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@@ -110,13 +110,13 @@ class item_gor_dreks_ointment : public ItemScript
|
||||
public:
|
||||
item_gor_dreks_ointment() : ItemScript("item_gor_dreks_ointment") { }
|
||||
|
||||
bool OnUse(Player* player, Item* pItem, SpellCastTargets const& targets)
|
||||
bool OnUse(Player* player, Item* item, SpellCastTargets const& targets)
|
||||
{
|
||||
if (targets.GetUnitTarget() && targets.GetUnitTarget()->GetTypeId() == TYPEID_UNIT &&
|
||||
targets.GetUnitTarget()->GetEntry() == 20748 && !targets.GetUnitTarget()->HasAura(32578))
|
||||
return false;
|
||||
|
||||
player->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, pItem, NULL);
|
||||
player->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, item, NULL);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@@ -130,13 +130,13 @@ class item_incendiary_explosives : public ItemScript
|
||||
public:
|
||||
item_incendiary_explosives() : ItemScript("item_incendiary_explosives") { }
|
||||
|
||||
bool OnUse(Player* player, Item* pItem, SpellCastTargets const & /*targets*/)
|
||||
bool OnUse(Player* player, Item* item, SpellCastTargets const & /*targets*/)
|
||||
{
|
||||
if (player->FindNearestCreature(26248, 15) || player->FindNearestCreature(26249, 15))
|
||||
return false;
|
||||
else
|
||||
{
|
||||
player->SendEquipError(EQUIP_ERR_OUT_OF_RANGE, pItem, NULL);
|
||||
player->SendEquipError(EQUIP_ERR_OUT_OF_RANGE, item, NULL);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -219,7 +219,7 @@ class item_pile_fake_furs : public ItemScript
|
||||
public:
|
||||
item_pile_fake_furs() : ItemScript("item_pile_fake_furs") { }
|
||||
|
||||
bool OnUse(Player* player, Item* /*pItem*/, SpellCastTargets const & /*targets*/)
|
||||
bool OnUse(Player* player, Item* /*item*/, SpellCastTargets const & /*targets*/)
|
||||
{
|
||||
GameObject* go = NULL;
|
||||
for (uint8 i = 0; i < CaribouTrapsNum; ++i)
|
||||
@@ -264,14 +264,14 @@ class item_petrov_cluster_bombs : public ItemScript
|
||||
public:
|
||||
item_petrov_cluster_bombs() : ItemScript("item_petrov_cluster_bombs") { }
|
||||
|
||||
bool OnUse(Player* player, Item* pItem, const SpellCastTargets & /*targets*/)
|
||||
bool OnUse(Player* player, Item* item, const SpellCastTargets & /*targets*/)
|
||||
{
|
||||
if (player->GetZoneId() != ZONE_ID_HOWLING)
|
||||
return false;
|
||||
|
||||
if (!player->GetTransport() || player->GetAreaId() != AREA_ID_SHATTERED_STRAITS)
|
||||
{
|
||||
player->SendEquipError(EQUIP_ERR_NONE, pItem, NULL);
|
||||
player->SendEquipError(EQUIP_ERR_NONE, item, NULL);
|
||||
|
||||
if (const SpellInfo* spellInfo = sSpellMgr->GetSpellInfo(SPELL_PETROV_BOMB))
|
||||
Spell::SendCastResult(player, spellInfo, 1, SPELL_FAILED_NOT_HERE);
|
||||
@@ -330,7 +330,7 @@ class item_dehta_trap_smasher : public ItemScript
|
||||
public:
|
||||
item_dehta_trap_smasher() : ItemScript("item_dehta_trap_smasher") { }
|
||||
|
||||
bool OnUse(Player* player, Item* /*pItem*/, const SpellCastTargets & /*targets*/)
|
||||
bool OnUse(Player* player, Item* /*item*/, const SpellCastTargets & /*targets*/)
|
||||
{
|
||||
if (player->GetQuestStatus(QUEST_CANNOT_HELP_THEMSELVES) != QUEST_STATUS_INCOMPLETE)
|
||||
return false;
|
||||
@@ -367,7 +367,7 @@ class item_trident_of_nazjan : public ItemScript
|
||||
public:
|
||||
item_trident_of_nazjan() : ItemScript("item_Trident_of_Nazjan") { }
|
||||
|
||||
bool OnUse(Player* player, Item* pItem, const SpellCastTargets & /*targets*/)
|
||||
bool OnUse(Player* player, Item* item, const SpellCastTargets & /*targets*/)
|
||||
{
|
||||
if (player->GetQuestStatus(QUEST_THE_EMISSARY) == QUEST_STATUS_INCOMPLETE)
|
||||
{
|
||||
@@ -376,9 +376,9 @@ public:
|
||||
pLeviroth->AI()->AttackStart(player);
|
||||
return false;
|
||||
} else
|
||||
player->SendEquipError(EQUIP_ERR_OUT_OF_RANGE, pItem, NULL);
|
||||
player->SendEquipError(EQUIP_ERR_OUT_OF_RANGE, item, NULL);
|
||||
} else
|
||||
player->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, pItem, NULL);
|
||||
player->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, item, NULL);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@@ -394,17 +394,17 @@ class item_captured_frog : public ItemScript
|
||||
public:
|
||||
item_captured_frog() : ItemScript("item_captured_frog") { }
|
||||
|
||||
bool OnUse(Player* player, Item* pItem, SpellCastTargets const& /*targets*/)
|
||||
bool OnUse(Player* player, Item* item, SpellCastTargets const& /*targets*/)
|
||||
{
|
||||
if (player->GetQuestStatus(QUEST_THE_PERFECT_SPIES) == QUEST_STATUS_INCOMPLETE)
|
||||
{
|
||||
if (player->FindNearestCreature(NPC_VANIRAS_SENTRY_TOTEM, 10.0f))
|
||||
return false;
|
||||
else
|
||||
player->SendEquipError(EQUIP_ERR_OUT_OF_RANGE, pItem, NULL);
|
||||
player->SendEquipError(EQUIP_ERR_OUT_OF_RANGE, item, NULL);
|
||||
}
|
||||
else
|
||||
player->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, pItem, NULL);
|
||||
player->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, item, NULL);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -241,14 +241,14 @@ bool EquippedOk(Player* player, uint32 spellId)
|
||||
if (!reqSpell)
|
||||
continue;
|
||||
|
||||
Item* pItem;
|
||||
Item* item = NULL;
|
||||
for (uint8 j = EQUIPMENT_SLOT_START; j < EQUIPMENT_SLOT_END; ++j)
|
||||
{
|
||||
pItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, j);
|
||||
if (pItem && pItem->GetTemplate()->RequiredSpell == reqSpell)
|
||||
item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, j);
|
||||
if (item && item->GetTemplate()->RequiredSpell == reqSpell)
|
||||
{
|
||||
//player has item equipped that require specialty. Not allow to unlearn, player has to unequip first
|
||||
sLog->outDebug(LOG_FILTER_TSCR, "TSCR: player attempt to unlearn spell %u, but item %u is equipped.", reqSpell, pItem->GetEntry());
|
||||
sLog->outDebug(LOG_FILTER_TSCR, "TSCR: player attempt to unlearn spell %u, but item %u is equipped.", reqSpell, item->GetEntry());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user