本文整理汇总了C++中GetEntry函数的典型用法代码示例。如果您正苦于以下问题:C++ GetEntry函数的具体用法?C++ GetEntry怎么用?C++ GetEntry使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetEntry函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetEntry
Item::~Item()
{
// WARNING : THAT CHECK MAY CAUSE LAGS !
if (Player * plr = GetOwner())
if (plr->RemoveItemByDelete(this))
sLog->OutPandashan("Item %u on player guid %u is in destructor, and pointer is still referenced in player's data ...", GetEntry(), plr->GetGUIDLow());
}
示例2: GetGiftCreatorGUID
void Item::SaveToDB(int8 containerslot, int8 slot, bool firstsave, QueryBuffer* buf)
{
if(GetOwner() && GetOwner()->IsSaveBlocked())
return;
if(!m_isDirty && !firstsave)
return;
uint64 GiftCreatorGUID = GetGiftCreatorGUID();
uint64 CreatorGUID = GetCreatorGUID();
std::stringstream ss;
ss << "DELETE FROM playeritems WHERE guid = " << GetLowGUID() << ";";
if(firstsave)
CharacterDatabase.WaitExecute(ss.str().c_str());
else
{
if(buf == NULL)
CharacterDatabase.Execute(ss.str().c_str());
else
buf->AddQueryNA(ss.str().c_str());
}
ss.rdbuf()->str("");
uint64 ownerGUID = GetOwnerGUID();
ss << "INSERT INTO playeritems VALUES(";
ss << (Arcemu::Util::GUID_LOPART(ownerGUID)) << ",";
ss << GetLowGUID() << ",";
ss << GetEntry() << ",";
ss << wrapped_item_id << ",";
ss << (Arcemu::Util::GUID_LOPART(GiftCreatorGUID)) << ",";
ss << (Arcemu::Util::GUID_LOPART(CreatorGUID)) << ",";
ss << GetStackCount() << ",";
ss << int32(GetChargesLeft()) << ",";
ss << uint32(m_uint32Values[ ITEM_FIELD_FLAGS ]) << ",";
ss << random_prop << ", " << random_suffix << ", ";
ss << 0 << ",";
ss << GetDurability() << ",";
ss << static_cast<int>(containerslot) << ",";
ss << static_cast<int>(slot) << ",'";
// Pack together enchantment fields
if(Enchantments.size() > 0)
{
EnchantmentMap::iterator itr = Enchantments.begin();
for(; itr != Enchantments.end(); ++itr)
{
if(itr->second.RemoveAtLogout)
continue;
uint32 elapsed_duration = uint32(UNIXTIME - itr->second.ApplyTime);
int32 remaining_duration = itr->second.Duration - elapsed_duration;
if(remaining_duration < 0)
remaining_duration = 0;
try
{
if(itr->second.Enchantment && (remaining_duration > 5 || itr->second.Duration == 0))
{
ss << itr->second.Enchantment->Id << ",";
ss << remaining_duration << ",";
ss << itr->second.Slot << ";";
}
}
catch (...)
{
printf("Caught fatal exception: Item.cpp < void Item::SaveToDB(...)\n");
}
}
}
ss << "','";
ss << ItemExpiresOn << "','";
////////////////////////////////////////////////// Refund stuff /////////////////////////////////
// Check if the owner is instantiated. When sending mail he/she obviously will not be :P
if(this->GetOwner() != NULL)
{
std::pair< time_t, uint32 > refundentry;
refundentry.first = 0;
refundentry.second = 0;
refundentry = this->GetOwner()->GetItemInterface()->LookupRefundable(this->GetGUID());
ss << uint32(refundentry.first) << "','";
ss << uint32(refundentry.second);
}
else
{
ss << uint32(0) << "','";
ss << uint32(0);
}
//.........这里部分代码省略.........
示例3: GetEntry
void Creature::_LoadQuests()
{
mQuests.clear();
mInvolvedQuests.clear();
Field *fields;
QueryResult *result = sDatabase.PQuery("SELECT `quest` FROM `creature_questrelation` WHERE `id` = '%u'", GetEntry());
if(result)
{
do
{
fields = result->Fetch();
Quest* qInfo = objmgr.QuestTemplates[fields[0].GetUInt32()];
if (!qInfo) continue;
addQuest(qInfo->GetQuestId());
}
while( result->NextRow() );
delete result;
}
QueryResult *result1 = sDatabase.PQuery("SELECT `quest` FROM `creature_involvedrelation` WHERE `id` = '%u'", GetEntry());
if(!result1) return;
do
{
fields = result1->Fetch();
Quest* qInfo = objmgr.QuestTemplates[fields[0].GetUInt32()];
if (!qInfo) continue;
addInvolvedQuest(qInfo->GetQuestId());
}
while( result1->NextRow() );
delete result1;
}
示例4: GetTemplate
ItemTemplate const* Item::GetTemplate() const
{
return sObjectMgr->GetItemTemplate(GetEntry());
}
示例5: data0
void Vehicle::AddPassenger(Unit *unit, int8 seatId, bool force)
{
SeatMap::iterator seat;
seat = m_Seats.find(seatId);
// this should never happen
if(seat == m_Seats.end())
return;
unit->SetVehicleGUID(GetGUID());
unit->m_movementInfo.AddMovementFlag(MOVEFLAG_ONTRANSPORT);
unit->m_movementInfo.AddMovementFlag(MOVEFLAG_ROOT);
seat->second.passenger = unit;
if(unit->GetTypeId() == TYPEID_UNIT && ((Creature*)unit)->isVehicle())
{
if(((Vehicle*)unit)->GetEmptySeatsCount(true) == 0)
seat->second.flags = SEAT_VEHICLE_FULL;
else
seat->second.flags = SEAT_VEHICLE_FREE;
}
else
{
seat->second.flags = SEAT_FULL;
}
if(unit->GetTypeId() == TYPEID_PLAYER)
{
WorldPacket data0(SMSG_FORCE_MOVE_ROOT, 10);
data0 << unit->GetPackGUID();
data0 << (uint32)((seat->second.vs_flags & SF_CAN_CAST) ? 2 : 0);
unit->SendMessageToSet(&data0,true);
}
if(seat->second.vs_flags & SF_MAIN_RIDER)
{
if(!(GetVehicleFlags() & VF_MOVEMENT))
{
GetMotionMaster()->Clear(false);
GetMotionMaster()->MoveIdle();
SetCharmerGUID(unit->GetGUID());
unit->SetUInt64Value(UNIT_FIELD_CHARM, GetGUID());
if(unit->GetTypeId() == TYPEID_PLAYER)
{
((Player*)unit)->SetMover(this);
((Player*)unit)->SetClientControl(this, 1);
((Player*)unit)->GetCamera().SetView(this);
}
if(canFly() || HasAuraType(SPELL_AURA_FLY) || HasAuraType(SPELL_AURA_MOD_FLIGHT_SPEED))
{
WorldPacket data3(SMSG_MOVE_SET_CAN_FLY, 12);
data3<< GetPackGUID();
data3 << (uint32)(0);
SendMessageToSet(&data3,false);
}
}
SpellClickInfoMapBounds clickPair = sObjectMgr.GetSpellClickInfoMapBounds(GetEntry());
for(SpellClickInfoMap::const_iterator itr = clickPair.first; itr != clickPair.second; ++itr)
{
if (unit->GetTypeId() == TYPEID_UNIT || itr->second.IsFitToRequirements((Player*)unit))
{
Unit *caster = (itr->second.castFlags & 0x1) ? unit : this;
Unit *target = (itr->second.castFlags & 0x2) ? unit : this;
caster->CastSpell(target, itr->second.spellId, true);
}
}
if(unit->GetTypeId() == TYPEID_PLAYER)
{
// it should be added only on rider enter?
if(((Player*)unit)->GetGroup())
((Player*)unit)->SetGroupUpdateFlag(GROUP_UPDATE_VEHICLE);
BuildVehicleActionBar((Player*)unit);
}
if(!(GetVehicleFlags() & VF_FACTION))
setFaction(unit->getFaction());
if(GetVehicleFlags() & VF_CANT_MOVE)
{
WorldPacket data2(SMSG_FORCE_MOVE_ROOT, 10);
data2<< GetPackGUID();
data2 << (uint32)(2);
SendMessageToSet(&data2,false);
}
if(GetVehicleFlags() & VF_NON_SELECTABLE)
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
}
if(seat->second.vs_flags & SF_UNATTACKABLE)
unit->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
EmptySeatsCountChanged();
}
示例6: switch
//.........这里部分代码省略.........
break;
}
case GAMEOBJECT_TYPE_FLAGSTAND: // 24
{
if(user->GetTypeId()!=TYPEID_PLAYER)
return;
Player* player = (Player*)user;
if( player->CanUseBattleGroundObject() )
{
// in battleground check
BattleGround *bg = player->GetBattleGround();
if(!bg)
return;
// BG flag click
// AB:
// 15001
// 15002
// 15003
// 15004
// 15005
bg->EventPlayerClickedOnFlag(player, this);
return; //we don;t need to delete flag ... it is despawned!
}
break;
}
case GAMEOBJECT_TYPE_FLAGDROP: // 26
{
if(user->GetTypeId()!=TYPEID_PLAYER)
return;
Player* player = (Player*)user;
if( player->CanUseBattleGroundObject() )
{
// in battleground check
BattleGround *bg = player->GetBattleGround();
if(!bg)
return;
// BG flag dropped
// WS:
// 179785 - Silverwing Flag
// 179786 - Warsong Flag
// EotS:
// 184142 - Netherstorm Flag
GameObjectInfo const* info = GetGOInfo();
if(info)
{
switch(info->id)
{
case 179785: // Silverwing Flag
// check if it's correct bg
if(bg->GetTypeID() == BATTLEGROUND_WS)
bg->EventPlayerClickedOnFlag(player, this);
break;
case 179786: // Warsong Flag
if(bg->GetTypeID() == BATTLEGROUND_WS)
bg->EventPlayerClickedOnFlag(player, this);
break;
case 184142: // Netherstorm Flag
if(bg->GetTypeID() == BATTLEGROUND_EY)
bg->EventPlayerClickedOnFlag(player, this);
break;
}
}
//this cause to call return, all flags must be deleted here!!
spellId = 0;
Delete();
}
break;
}
default:
sLog.outDebug("Unknown Object Type %u", GetGoType());
break;
}
if(!spellId)
return;
SpellEntry const *spellInfo = sSpellStore.LookupEntry( spellId );
if(!spellInfo)
{
if(user->GetTypeId()!=TYPEID_PLAYER || !sOutdoorPvPMgr.HandleCustomSpell((Player*)user,spellId,this))
sLog.outError("WORLD: unknown spell id %u at use action for gameobject (Entry: %u GoType: %u )", spellId,GetEntry(),GetGoType());
else
sLog.outDebug("WORLD: %u non-dbc spell was handled by OutdoorPvP", spellId);
return;
}
Spell *spell = new Spell(spellCaster, spellInfo, false, GetGUID());
// spell target is user of GO
SpellCastTargets targets;
targets.setUnitTarget( user );
spell->prepare(&targets);
}
示例7: TC_LOG_DEBUG
void Item::UpdateDuration(Player* owner, uint32 diff)
{
if (!GetUInt32Value(ITEM_FIELD_DURATION))
return;
TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "Item::UpdateDuration Item (Entry: %u Duration %u Diff %u)", GetEntry(), GetUInt32Value(ITEM_FIELD_DURATION), diff);
if (GetUInt32Value(ITEM_FIELD_DURATION) <= diff)
{
sScriptMgr->OnItemExpire(owner, GetTemplate());
owner->DestroyItem(GetBagSlot(), GetSlot(), true);
return;
}
SetUInt32Value(ITEM_FIELD_DURATION, GetUInt32Value(ITEM_FIELD_DURATION) - diff);
SetState(ITEM_CHANGED, owner); // save new time in database
}
示例8: UpdateAttackPowerAndDamage
void Pet::UpdateAttackPowerAndDamage(bool ranged)
{
if(ranged)
return;
float val = 0.0f;
float bonusAP = 0.0f;
UnitMods unitMod = UNIT_MOD_ATTACK_POWER;
if(GetEntry() == 416) // imp's attack power
val = GetStat(STAT_STRENGTH) - 10.0f;
else
val = 2 * GetStat(STAT_STRENGTH) - 20.0f;
Unit* owner = GetOwner();
if( owner && owner->GetTypeId()==TYPEID_PLAYER)
{
if(getPetType() == HUNTER_PET) //hunter pets benefit from owner's attack power
{
bonusAP = owner->GetTotalAttackPowerValue(RANGED_ATTACK) * 0.22f;
SetBonusDamage( int32(owner->GetTotalAttackPowerValue(RANGED_ATTACK) * 0.1287f));
}
//ghouls benefit from deathknight's attack power
else if(getPetType() == SUMMON_PET && owner->getClass() == CLASS_DEATH_KNIGHT)
{
bonusAP = owner->GetTotalAttackPowerValue(BASE_ATTACK) * 0.82f;
SetBonusDamage( int32(owner->GetTotalAttackPowerValue(BASE_ATTACK) * 0.8287f));
}
//demons benefit from warlocks shadow or fire damage
else if(getPetType() == SUMMON_PET && owner->getClass() == CLASS_WARLOCK)
{
int32 fire = int32(owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FIRE)) - owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_FIRE);
int32 shadow = int32(owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_SHADOW)) - owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_SHADOW);
int32 maximum = (fire > shadow) ? fire : shadow;
if(maximum < 0)
maximum = 0;
SetBonusDamage( int32(maximum * 0.15f));
bonusAP = maximum * 0.57f;
}
//water elementals benefit from mage's frost damage
else if(getPetType() == SUMMON_PET && owner->getClass() == CLASS_MAGE)
{
int32 frost = int32(owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FROST)) - owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_FROST);
if(frost < 0)
frost = 0;
SetBonusDamage( int32(frost * 0.4f));
}
}
SetModifierValue(UNIT_MOD_ATTACK_POWER, BASE_VALUE, val + bonusAP);
//in BASE_VALUE of UNIT_MOD_ATTACK_POWER for creatures we store data of meleeattackpower field in DB
float base_attPower = GetModifierValue(unitMod, BASE_VALUE) * GetModifierValue(unitMod, BASE_PCT);
float attPowerMod = GetModifierValue(unitMod, TOTAL_VALUE);
float attPowerMultiplier = GetModifierValue(unitMod, TOTAL_PCT) - 1.0f;
//UNIT_FIELD_(RANGED)_ATTACK_POWER field
SetInt32Value(UNIT_FIELD_ATTACK_POWER, (int32)base_attPower);
//UNIT_FIELD_(RANGED)_ATTACK_POWER_MODS field
SetInt32Value(UNIT_FIELD_ATTACK_POWER_MODS, (int32)attPowerMod);
//UNIT_FIELD_(RANGED)_ATTACK_POWER_MULTIPLIER field
SetFloatValue(UNIT_FIELD_ATTACK_POWER_MULTIPLIER, attPowerMultiplier);
//automatically update weapon damage after attack power modification
UpdateDamagePhysical(BASE_ATTACK);
}
示例9: sourceModel
bool SortFilterProxyModel::filterAcceptsRow (int row, const QModelIndex& parent) const
{
if (MUCMode_)
{
if (!MUCEntry_)
return false;
const QModelIndex& idx = sourceModel ()->index (row, 0, parent);
switch (GetType (idx))
{
case Core::CLETAccount:
{
QObject *acc = qobject_cast<ICLEntry*> (MUCEntry_)->GetParentAccount ();
return acc == idx.data (Core::CLRAccountObject).value<QObject*> ();
}
case Core::CLETCategory:
{
const QString& gName = idx.data ().toString ();
return gName == qobject_cast<IMUCEntry*> (MUCEntry_)->GetGroupName () ||
qobject_cast<ICLEntry*> (MUCEntry_)->Groups ().contains (gName);
}
default:
break;
}
}
else
{
const QModelIndex& idx = sourceModel ()->index (row, 0, parent);
if (!filterRegExp ().isEmpty ())
return GetType (idx) == Core::CLETContact ?
idx.data ().toString ().contains (filterRegExp ()) :
true;
if (idx.data (Core::CLRUnreadMsgCount).toInt ())
return true;
const auto type = GetType (idx);
if (type == Core::CLETContact)
{
ICLEntry *entry = GetEntry (idx);
const State state = entry->GetStatus ().State_;
if (!ShowOffline_ &&
state == SOffline &&
!idx.data (Core::CLRUnreadMsgCount).toInt ())
return false;
if (HideMUCParts_ &&
entry->GetEntryType () == ICLEntry::ETPrivateChat)
return false;
if (!ShowSelfContacts_ &&
entry->GetEntryFeatures () & ICLEntry::FSelfContact)
return false;
}
else if (type == Core::CLETCategory)
{
if (!ShowOffline_ &&
!idx.data (Core::CLRNumOnline).toInt ())
return false;
for (int subRow = 0; subRow < sourceModel ()->rowCount (idx); ++subRow)
if (filterAcceptsRow (subRow, idx))
return true;
return false;
}
else if (type == Core::CLETAccount)
{
const auto& accObj = idx.data (Core::CLRAccountObject).value<QObject*> ();
auto acc = qobject_cast<IAccount*> (accObj);
return acc->IsShownInRoster ();
}
}
return QSortFilterProxyModel::filterAcceptsRow (row, parent);
}
示例10: Pending
void Transporter::TransportPassengers(uint32 mapid, uint32 oldmap, float x, float y, float z)
{
sEventMgr.RemoveEvents(this, EVENT_TRANSPORTER_NEXT_WAYPOINT);
if(mPassengers.size() > 0)
{
PassengerIterator itr = mPassengers.begin();
PassengerIterator it2;
WorldPacket Pending(SMSG_TRANSFER_PENDING, 12);
Pending << mapid << GetEntry() << oldmap;
WorldPacket NewWorld;
LocationVector v;
for(; itr != mPassengers.end();)
{
it2 = itr;
++itr;
Player *plr = objmgr.GetPlayer(it2->first);
if(!plr)
{
// remove from map
mPassengers.erase(it2);
continue;
}
if(!plr->GetSession() || !plr->IsInWorld())
continue;
plr->m_lockTransportVariables = true;
v.x = x + plr->m_TransporterX;
v.y = y + plr->m_TransporterY;
v.z = z + plr->m_TransporterZ;
v.o = plr->GetOrientation();
if(mapid == 530 && !plr->GetSession()->HasFlag(ACCOUNT_FLAG_XPACK_01))
{
// player is not flagged to access bc content, repop at graveyard
plr->RepopAtGraveyard(plr->GetPositionX(), plr->GetPositionY(), plr->GetPositionZ(), plr->GetMapId());
continue;
}
plr->GetSession()->SendPacket(&Pending);
plr->_Relocate(mapid, v, false, true, 0);
// Lucky bitch. Do it like on official.
if(plr->isDead())
{
plr->ResurrectPlayer();
plr->SetUInt32Value(UNIT_FIELD_HEALTH, plr->GetUInt32Value(UNIT_FIELD_MAXHEALTH));
plr->SetUInt32Value(UNIT_FIELD_POWER1, plr->GetUInt32Value(UNIT_FIELD_MAXPOWER1));
}
}
}
// Set our position
RemoveFromWorld(false);
SetMapId(mapid);
SetPosition(x,y,z,m_position.o,false);
AddToWorld();
}
示例11: generateLoot
void Creature::generateLoot()
{
if (!loot.items.empty()) return;
lootmgr.FillCreatureLoot(&loot,GetEntry(), m_mapMgr ? (m_mapMgr->iInstanceMode > 0 ? true : false) : false);
loot.gold = proto ? proto->money : 0;
// Master Looting Ninja Checker
if(sWorld.antiMasterLootNinja && this->m_lootMethod == PARTY_LOOT_MASTER)
{
Player *looter = objmgr.GetPlayer((uint32)this->TaggerGuid);
if(looter && looter->GetGroup())
{
uint16 lootThreshold = looter->GetGroup()->GetThreshold();
for(vector<__LootItem>::iterator itr = loot.items.begin(); itr != loot.items.end(); itr++)
{
if(itr->item.itemproto->Quality < lootThreshold)
continue;
// Master Loot Stuff - Let the rest of the raid know what dropped..
//TODO: Shouldn't we move this array to a global position? Or maybe it allready exists^^ (VirtualAngel) --- I can see (dead) talking pigs...^^
char* itemColours[7] = { "9d9d9d", "ffffff", "1eff00", "0070dd", "a335ee", "ff8000", "e6cc80" };
char buffer[256];
sprintf(buffer, "\174cff%s\174Hitem:%u:0:0:0:0:0:0:0\174h[%s]\174h\174r", itemColours[itr->item.itemproto->Quality], itr->item.itemproto->ItemId, itr->item.itemproto->Name1);
this->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, buffer);
}
}
}
/*
* If there's an amount given, take it as an expected value and
* generated a corresponding random value. The random value is
* something similar to a normal distribution.
*
* You'd get a ``better'' distribution if you called `rand()' for each
* copper individually. However, if the loot was 1G we'd call `rand()'
* 15000 times, which is not ideal. So we use one call to `rand()' to
* (hopefully) get 24 random bits, which is then used to create a
* normal distribution over 1/24th of the difference.
*/
if ((loot.gold > 0) && (loot.gold < 12))
{
/* Don't use the below formula for very small cash - rouding
* errors will be too bad.. */
}
else if (loot.gold >= 12)
{
uint32 random_bits;
double chunk_size;
double gold_fp;
/* Split up the difference into 12 chunks.. */
chunk_size = ((double) loot.gold) / 12.0;
/* Get 24 random bits. We use the low order bits, because we're
* too lazy to check how many random bits the system actually
* returned. */
random_bits = rand () & 0x00ffffff;
gold_fp = 0.0;
while (random_bits != 0)
{
/* If last bit is one .. */
if ((random_bits & 0x01) == 1)
/* .. increase loot by 1/12th of expected value */
gold_fp += chunk_size;
/* Shift away the LSB */
random_bits >>= 1;
}
/* To hide your discrete values a bit, add another random
* amount between -(chunk_size/2) and +(chunk_size/2). */
gold_fp += chunk_size
* ((((double) rand ()) / (((double) RAND_MAX) + 1.0)) - .5);
/*
* In theory we can end up with a negative amount. Give at
* least one chunk_size here to prevent this from happening. In
* case you're interested, the probability is around 2.98e-8.
*/
if (gold_fp < chunk_size)
gold_fp = chunk_size;
/* Convert the floating point gold value to an integer again
* and we're done. */
loot.gold = (uint32) (.5 + gold_fp);
}
示例12: int32
void Guardian::UpdateDamagePhysical(WeaponAttackType attType)
{
if (attType > BASE_ATTACK)
return;
float bonusDamage = 0.0f;
if (Unit* owner = GetOwner())
{
//force of nature
if (GetEntry() == 1964)
{
int32 spellDmg = int32(owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_NATURE)) - owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_NATURE);
if (spellDmg > 0)
bonusDamage = spellDmg * 0.09f;
}
//greater fire elemental
else if (GetEntry() == 15438)
{
if (Unit* shaman = owner->GetOwner())
{
int32 spellDmg = int32(shaman->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FIRE)) - shaman->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_FIRE);
if (spellDmg > 0)
bonusDamage = spellDmg * 0.4f;
}
}
// shadowfiend 65.7% per 10 hits so 6.57 per hit
else if (GetEntry() == 19668)
{
if (Unit* owner = GetOwner())
{
int32 spellDmg = int32(owner->SpellBaseDamageBonus(SPELL_SCHOOL_MASK_SHADOW));
if (spellDmg > 0)
bonusDamage = spellDmg * 0.0657f;
}
}
}
UnitMods unitMod = UNIT_MOD_DAMAGE_MAINHAND;
float att_speed = float(GetAttackTime(BASE_ATTACK))/1000.0f;
float base_value = GetModifierValue(unitMod, BASE_VALUE) + GetTotalAttackPowerValue(attType)/ 14.0f * att_speed + bonusDamage;
float base_pct = GetModifierValue(unitMod, BASE_PCT);
float total_value = GetModifierValue(unitMod, TOTAL_VALUE);
float total_pct = GetModifierValue(unitMod, TOTAL_PCT);
float weapon_mindamage = GetWeaponDamageRange(BASE_ATTACK, MINDAMAGE);
float weapon_maxdamage = GetWeaponDamageRange(BASE_ATTACK, MAXDAMAGE);
int32 speed_mod = GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKSPEED);
base_pct *= 100.0f/(100.0f+float(speed_mod/2));
float mindamage = ((base_value + weapon_mindamage) * base_pct + total_value) * total_pct;
float maxdamage = ((base_value + weapon_maxdamage) * base_pct + total_value) * total_pct;
// Pet's base damage changes depending on happiness
if (isHunterPet() && attType == BASE_ATTACK)
{
switch (ToPet()->GetHappinessState())
{
case HAPPY:
// 125% of normal damage
mindamage = mindamage * 1.25f;
maxdamage = maxdamage * 1.25f;
break;
case CONTENT:
// 100% of normal damage, nothing to modify
break;
case UNHAPPY:
// 75% of normal damage
mindamage = mindamage * 0.75f;
maxdamage = maxdamage * 0.75f;
break;
}
}
SetStatFloatValue(UNIT_FIELD_MINDAMAGE, mindamage);
SetStatFloatValue(UNIT_FIELD_MAXDAMAGE, maxdamage);
}
示例13: GetTotalStatValue
bool Guardian::UpdateStats(Stats stat)
{
if (stat >= MAX_STATS)
return false;
// value = ((base_value * base_pct) + total_value) * total_pct
float value = GetTotalStatValue(stat);
ApplyStatBuffMod(stat, m_statFromOwner[stat], false);
float ownersBonus = 0.0f;
Unit* owner = GetOwner();
float mod = 0.75f;
switch (stat)
{
case STAT_STRENGTH:
{
if (IsPetGhoul())
{
mod = 0.7f;
// Glyph of the Ghoul
if (AuraEffect const* aurEff = owner->GetAuraEffect(58686, 0))
mod += CalculatePct(1.0f, aurEff->GetAmount());
ownersBonus = owner->GetStat(stat) * mod;
value += ownersBonus;
}
break;
}
case STAT_STAMINA:
{
mod = 0.0f;
if (IsPetGhoul() || IsPetGargoyle())
{
// Glyph of the Ghoul
if (AuraEffect const* aurEff = owner->GetAuraEffect(58686, 0))
mod += CalculatePct(1.0f, aurEff->GetAmount());
}
ownersBonus = owner->GetStat(stat) * mod;
ownersBonus *= GetModifierValue(UNIT_MOD_STAT_STAMINA, TOTAL_PCT);
value += ownersBonus;
break;
}
case STAT_INTELLECT:
{
if (owner->getClass() == CLASS_WARLOCK || owner->getClass() == CLASS_MAGE)
{
mod = 0.3f;
ownersBonus = owner->GetStat(stat) * mod;
}
else if (owner->getClass() == CLASS_DEATH_KNIGHT && GetEntry() == 31216)
{
mod = 0.3f;
if (owner->getSimulacrumTarget())
ownersBonus = owner->getSimulacrumTarget()->GetStat(stat) * mod;
else
ownersBonus = owner->GetStat(stat) * mod;
}
value += ownersBonus;
break;
}
}
SetStat(stat, int32(value));
m_statFromOwner[stat] = ownersBonus;
ApplyStatBuffMod(stat, m_statFromOwner[stat], true);
switch (stat)
{
case STAT_STRENGTH: UpdateAttackPowerAndDamage(); break;
case STAT_AGILITY: UpdateArmor(); break;
case STAT_STAMINA: UpdateMaxHealth(); break;
case STAT_INTELLECT:
UpdateMaxPower(POWER_MANA);
if (isPet() && (owner->getClass() == CLASS_WARLOCK || owner->getClass() == CLASS_MAGE))
UpdateAttackPowerAndDamage();
break;
case STAT_SPIRIT:
default:
break;
}
return true;
}
示例14: GetProto
ItemPrototype const* Item::GetProto() const
{
return ObjectMgr::GetItemPrototype(GetEntry());
}
示例15: UnSummon
//.........这里部分代码省略.........
if (m_timer <= diff)
{
UnSummon();
return;
}
m_timer -= diff;
}
else if (m_timer != m_lifetime)
m_timer = m_lifetime;
break;
}
case TEMPSUMMON_CORPSE_TIMED_DESPAWN:
{
if (m_deathState == CORPSE)
{
if (m_timer <= diff)
{
UnSummon();
return;
}
m_timer -= diff;
}
break;
}
case TEMPSUMMON_CORPSE_DESPAWN:
{
// if m_deathState is DEAD, CORPSE was skipped
if (m_deathState == CORPSE || m_deathState == DEAD)
{
UnSummon();
return;
}
break;
}
case TEMPSUMMON_DEAD_DESPAWN:
{
if (m_deathState == DEAD)
{
UnSummon();
return;
}
break;
}
case TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN:
{
// if m_deathState is DEAD, CORPSE was skipped
if (m_deathState == CORPSE || m_deathState == DEAD)
{
UnSummon();
return;
}
if (!isInCombat())
{
if (m_timer <= diff)
{
UnSummon();
return;
}
else
m_timer -= diff;
}
else if (m_timer != m_lifetime)
m_timer = m_lifetime;
break;
}
case TEMPSUMMON_TIMED_OR_DEAD_DESPAWN:
{
// if m_deathState is DEAD, CORPSE was skipped
if (m_deathState == DEAD)
{
UnSummon();
return;
}
if (!isInCombat() && isAlive())
{
if (m_timer <= diff)
{
UnSummon();
return;
}
else
m_timer -= diff;
}
else if (m_timer != m_lifetime)
m_timer = m_lifetime;
break;
}
default:
UnSummon();
sLog->outError("Temporary summoned creature (entry: %u) have unknown type %u of ", GetEntry(), m_type);
break;
}
}