Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static uint32 copseReclaimDelay[MAX_DEATH_COUNT] = { 30, 60, 120 };
- // For Player::GiveLevel remove shaman weapon enchants on prestige
- static uint32 weaponEnchantsToRemove[5] = {1, 4, 5, 6, 29};
- static uint32 weaponEnchantsToRemoveSPELLS[5] = {8019, 8027, 8024, 8018, 8017};
- uint32 Player::CalculateTalentsPoints() const
- {
- uint32 base_talent = getLevel() < 10 ? 0 : getLevel()-9;
- uint32 guid = GetGUID();
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PRESTIGELEVEL_BY_GUID);
- stmt->setUInt32(0, guid);
- PreparedQueryResult resultPrestige = CharacterDatabase.Query(stmt);
- if ((resultPrestige) && (getLevel() > 9))
- {
- uint32 prestige_level = (*resultPrestige)[0].GetUInt32();
- if (prestige_level > 10)
- base_talent += 10;
- else
- base_talent += prestige_level;
- }
- void Player::HandleFall
- if (damage > 0)
- {
- if (HasSpell(90170))
- damage = damage / 2;
- void Player::GiveXP
- // RaF does NOT stack with rested experience
- if (recruitAFriend)
- bonus_xp = 2 * xp; // xp + bonus_xp must add up to 3 * xp for RaF; calculation for quests done client-side
- else
- {
- bonus_xp = victim ? GetXPRestBonus(xp) : 0; // XP resting bonus
- if (HasSpell(90168))
- bonus_xp *= 1.5f;
- }
- float Player::GetReputationPriceDiscount(FactionTemplateEntry const* factionTemplate) const
- {
- if (!factionTemplate || !factionTemplate->faction)
- return 1.0f;
- if (HasSpell(90158))
- return 0.8f;
- ReputationRank rank = GetReputationRank(factionTemplate->faction);
- if (rank <= REP_NEUTRAL)
- return 1.0f;
- return 1.0f - 0.05f* (rank - REP_NEUTRAL);
- }
- void Player::GiveLevel(uint8 level)
- {
- if (level == 1)
- {
- // If player has a pet when resetting back to level 1, remove it.
- if (Pet* pet = GetPet())
- {
- RemovePet(pet, PET_SAVE_NOT_IN_SLOT, true);
- }
- // If player is a hunter, remove pets from all slots including stable, active, and dismissed.
- if (getClass() == CLASS_HUNTER)
- {
- PreparedStatement* stmt;
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_PET_BY_SLOT);
- stmt->setUInt32(0, this->GetGUID());
- CharacterDatabase.Execute(stmt);
- }
- // If player is a shaman and has a temporary enchantment on a weapon in any slot when prestiging, get rid of it.
- if (getClass() == CLASS_SHAMAN)
- {
- // Remove from bags
- for (uint8 i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; i++)
- {
- if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
- {
- for (uint8 slot = 0; slot < MAX_ENCHANTMENT_SLOT; ++slot)
- {
- uint32 enchantId = pItem->GetEnchantmentId(EnchantmentSlot(slot));
- if (enchantId > 0)
- {
- for (int i = 0; i < sizeof(weaponEnchantsToRemove); ++i)
- {
- if (enchantId == weaponEnchantsToRemove[i])
- {
- pItem->ClearEnchantment(EnchantmentSlot(slot));
- }
- }
- }
- }
- }
- }
- for (uint8 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++)
- {
- if (Bag* pBag = GetBagByPos(i))
- {
- for (uint32 j = 0; j < pBag->GetBagSize(); j++)
- {
- if (Item* pItem = GetItemByPos(i, j))
- {
- for (uint8 slot = 0; slot < MAX_ENCHANTMENT_SLOT; ++slot)
- {
- uint32 enchantId = pItem->GetEnchantmentId(EnchantmentSlot(slot));
- if (enchantId > 0)
- {
- for (int i = 0; i < sizeof(weaponEnchantsToRemove); ++i)
- {
- if (enchantId == weaponEnchantsToRemove[i])
- {
- pItem->ClearEnchantment(EnchantmentSlot(slot));
- }
- }
- }
- }
- }
- }
- }
- }
- /* Remove from buyback menu
- for (uint8 i = BUYBACK_SLOT_START; i < BUYBACK_SLOT_END; i++)
- {
- if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
- {
- for (uint8 slot = 0; slot < MAX_ENCHANTMENT_SLOT; ++slot)
- {
- uint32 enchantId = pItem->GetEnchantmentId(EnchantmentSlot(slot));
- if (enchantId > 0)
- {
- for (int i = 0; i < sizeof(weaponEnchantsToRemove); ++i)
- {
- if (enchantId == weaponEnchantsToRemove[i])
- {
- pItem->ClearEnchantment(EnchantmentSlot(slot));
- }
- }
- }
- }
- }
- }*/
- // Remove from bank slots
- for (uint8 i = BANK_SLOT_ITEM_START; i < BANK_SLOT_ITEM_END; i++)
- {
- if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
- {
- for (uint8 slot = 0; slot < MAX_ENCHANTMENT_SLOT; ++slot)
- {
- uint32 enchantId = pItem->GetEnchantmentId(EnchantmentSlot(slot));
- if (enchantId > 0)
- {
- for (int i = 0; i < sizeof(weaponEnchantsToRemove); ++i)
- {
- if (enchantId == weaponEnchantsToRemove[i])
- {
- pItem->ClearEnchantment(EnchantmentSlot(slot));
- }
- }
- }
- }
- }
- }
- for (uint8 i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; i++)
- {
- if (Bag* pBag = GetBagByPos(i))
- {
- for (uint32 j = 0; j < pBag->GetBagSize(); j++)
- {
- if (Item* pItem = GetItemByPos(i, j))
- {
- for (uint8 slot = 0; slot < MAX_ENCHANTMENT_SLOT; ++slot)
- {
- uint32 enchantId = pItem->GetEnchantmentId(EnchantmentSlot(slot));
- if (enchantId > 0)
- {
- for (int i = 0; i < sizeof(weaponEnchantsToRemove); ++i)
- {
- if (enchantId == weaponEnchantsToRemove[i])
- {
- pItem->ClearEnchantment(EnchantmentSlot(slot));
- }
- }
- }
- }
- }
- }
- }
- }
- // Remove from equipment slot
- if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, 15))
- {
- for (uint8 slot = 0; slot < MAX_ENCHANTMENT_SLOT; ++slot)
- {
- uint32 enchantId = pItem->GetEnchantmentId(EnchantmentSlot(slot));
- if (enchantId > 0)
- {
- for (int i = 0; i < sizeof(weaponEnchantsToRemove); ++i)
- {
- if (enchantId == weaponEnchantsToRemove[i])
- {
- pItem->ClearEnchantment(EnchantmentSlot(slot));
- this->EquipItem(15, pItem, true);
- }
- }
- }
- }
- }
- }
- }
- Item* Player::EquipItem
- Item* pItem2 = GetItemByPos(bag, slot);
- // Remove Shaman temp enchants if don't have the spell.
- if (getClass() == CLASS_SHAMAN)
- {
- if (!IsGameMaster())
- {
- if (pItem && (pItem->GetTemplate()->InventoryType == INVTYPE_WEAPON || pItem->GetTemplate()->InventoryType == INVTYPE_2HWEAPON || pItem->GetTemplate()->InventoryType == INVTYPE_WEAPONMAINHAND))
- {
- for (uint8 slot = 0; slot < MAX_ENCHANTMENT_SLOT; ++slot)
- {
- uint32 enchantId = pItem->GetEnchantmentId(EnchantmentSlot(slot));
- for (int i = 0; i < sizeof(weaponEnchantsToRemove); ++i)
- {
- if (enchantId == (weaponEnchantsToRemove[i]))
- {
- if (!HasSpell(weaponEnchantsToRemoveSPELLS[i]))
- {
- pItem->ClearEnchantment(EnchantmentSlot(slot));
- }
- }
- }
- }
- }
- }
- }
- Player::LearnSpell
- LearnSpell(itr2->second, false, fromSkill);
- }
- }
- // If has the Naga racial, set backwards movement speed.
- if (spell_id == 90178)
- SetSpeedRate(MOVE_RUN_BACK, 4.75f);
- Player::RemoveSpell
- if (!prev_activate)
- {
- WorldPacket data(SMSG_REMOVED_SPELL, 4);
- data << uint32(spell_id);
- SendDirectMessage(&data);
- }
- // If losing the Naga racial, set backwards movement speed.
- if (spell_id == 90178)
- UpdateSpeed(MOVE_RUN_BACK);
- }
- void Player:BuildPlayerRepop
- SendDirectMessage(&data);
- // If the player has the Wisp racial then cast the Wisp aura on them
- if (HasSpell(20585))
- {
- CastSpell(this, 20584, true);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement