您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ GetEntry函数代码示例

51自学网 2021-06-01 21:07:17
  C++
这篇教程C++ GetEntry函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中GetEntry函数的典型用法代码示例。如果您正苦于以下问题:C++ GetEntry函数的具体用法?C++ GetEntry怎么用?C++ GetEntry使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了GetEntry函数的25个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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());}
开发者ID:3DViking,项目名称:TrinityCore-MOP-5.0.5,代码行数:7,


示例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);    }//.........这里部分代码省略.........
开发者ID:treetrees,项目名称:Edge-of-Chaos,代码行数:101,


示例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;}
开发者ID:chrayn,项目名称:mangos-06,代码行数:40,


示例4: GetTemplate

ItemTemplate const* Item::GetTemplate() const{    return sObjectMgr->GetItemTemplate(GetEntry());}
开发者ID:jacobmain1,项目名称:ApocalypseCore,代码行数:4,


示例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();}
开发者ID:marx123,项目名称:core,代码行数:96,


示例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);}
开发者ID:wk23,项目名称:tst,代码行数:101,


示例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}
开发者ID:jacobmain1,项目名称:ApocalypseCore,代码行数:17,


示例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);}
开发者ID:Kishii,项目名称:Dev,代码行数:66,


示例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);	}
开发者ID:SboichakovDmitriy,项目名称:leechcraft,代码行数:78,


示例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();}
开发者ID:Goatform,项目名称:ascent,代码行数:63,


示例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);	}
开发者ID:pfchrono,项目名称:rs-ascent,代码行数:89,


示例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);}
开发者ID:ahuraa,项目名称:blizzlikecore,代码行数:79,


示例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;}
开发者ID:Lbniese,项目名称:WoWCircle434,代码行数:87,


示例14: GetProto

ItemPrototype const* Item::GetProto() const{    return ObjectMgr::GetItemPrototype(GetEntry());}
开发者ID:cipherCOM,项目名称:mangos,代码行数:4,


示例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;    }}
开发者ID:Krill156,项目名称:FreyaCore,代码行数:101,


示例16: switch

//.........这里部分代码省略.........                return;            }            break;        }        case TEMPSUMMON_DEAD_DESPAWN:        {            if (IsDespawned())            {                UnSummon();                return;            }            break;        }        case TEMPSUMMON_TIMED_OOC_OR_CORPSE_DESPAWN:        {            // if m_deathState is DEAD, CORPSE was skipped            if (IsDead())            {                UnSummon();                return;            }            if (!IsInCombat())            {                if (m_timer <= update_diff)                {                    UnSummon();                    return;                }                else                    { m_timer -= update_diff; }            }            else if (m_timer != m_lifetime)                { m_timer = m_lifetime; }            break;        }        case TEMPSUMMON_TIMED_OOC_OR_DEAD_DESPAWN:        {            // if m_deathState is DEAD, CORPSE was skipped            if (IsDespawned())            {                UnSummon();                return;            }            if (!IsInCombat() && IsAlive())            {                if (m_timer <= update_diff)                {                    UnSummon();                    return;                }                else                    { m_timer -= update_diff; }            }            else if (m_timer != m_lifetime)                { m_timer = m_lifetime; }            break;        }        case TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN:        {            // if m_deathState is DEAD, CORPSE was skipped            if (IsDead())            {                UnSummon();                return;            }            if (m_timer <= update_diff)            {                UnSummon();                return;            }            m_timer -= update_diff;            break;        }        case TEMPSUMMON_TIMED_OR_DEAD_DESPAWN:        {            // if m_deathState is DEAD, CORPSE was skipped            if (IsDespawned())            {                UnSummon();                return;            }            if (m_timer <= update_diff)            {                UnSummon();                return;            }            m_timer -= update_diff;            break;        }        default:            UnSummon();            sLog.outError("Temporary summoned creature (entry: %u) have unknown type %u of ", GetEntry(), m_type);            break;    }    Creature::Update(update_diff, diff);}
开发者ID:Numielle,项目名称:server,代码行数:101,


示例17: GetGUIDLow

bool Item::ItemContainerLoadLootFromDB(){    // Loads the money and item loot associated with an openable item from the DB    // Default. If there are no records for this item then it will be rolled for in Player::SendLoot()    m_lootGenerated = false;    uint32 container_id = GetGUIDLow();    // Save this for later use    loot.containerID = container_id;    // First, see if there was any money loot. This gets added directly to the container.    PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ITEMCONTAINER_MONEY);    stmt->setUInt32(0, container_id);    PreparedQueryResult money_result = CharacterDatabase.Query(stmt);    if (money_result)    {        Field* fields = money_result->Fetch();        loot.gold = fields[0].GetUInt32();    }    // Next, load any items that were saved    stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ITEMCONTAINER_ITEMS);    stmt->setUInt32(0, container_id);    PreparedQueryResult item_result = CharacterDatabase.Query(stmt);    if (item_result)    {        // Get a LootTemplate for the container item. This is where        //  the saved loot was originally rolled from, we will copy conditions from it        LootTemplate const* lt = LootTemplates_Item.GetLootFor(GetEntry());        if (lt)        {            do            {                // Create an empty LootItem                LootItem loot_item = LootItem();                // Fill in the rest of the LootItem from the DB                Field* fields = item_result->Fetch();                // item_id, itm_count, follow_rules, ffa, blocked, counted, under_threshold, needs_quest, rnd_prop, rnd_suffix                loot_item.itemid = fields[0].GetUInt32();                loot_item.count = fields[1].GetUInt32();                loot_item.follow_loot_rules = fields[2].GetBool();                loot_item.freeforall = fields[3].GetBool();                loot_item.is_blocked = fields[4].GetBool();                loot_item.is_counted = fields[5].GetBool();                loot_item.canSave = true;                loot_item.is_underthreshold = fields[6].GetBool();                loot_item.needs_quest = fields[7].GetBool();                loot_item.randomPropertyId = fields[8].GetInt32();                loot_item.randomSuffix = fields[9].GetUInt32();                // Copy the extra loot conditions from the item in the loot template                lt->CopyConditions(&loot_item);                // If container item is in a bag, add that player as an allowed looter                if (GetBagSlot())                    loot_item.allowedGUIDs.insert(GetOwner()->GetGUIDLow());                // Finally add the LootItem to the container                loot.items.push_back(loot_item);                // Increment unlooted count                loot.unlootedCount++;            }            while (item_result->NextRow());        }    }    // Mark the item if it has loot so it won't be generated again on open    m_lootGenerated = !loot.isLooted();    return m_lootGenerated;}
开发者ID:jacobmain1,项目名称:ApocalypseCore,代码行数:78,


示例18: GetStat

void Guardian::UpdateAttackPowerAndDamage(bool ranged){    if (ranged)        return;    float val = 0.0f;    float bonusAP = 0.0f;    UnitMods unitMod = UNIT_MOD_ATTACK_POWER;    if (GetEntry() == ENTRY_IMP)                                   // 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 (IsHunterPet())                      //hunter pets benefit from owner's attack power        {            float mod = 1.0f;                                                 //Hunter contribution modifier            bonusAP = owner->GetTotalAttackPowerValue(RANGED_ATTACK) * 0.22f * mod;            SetBonusDamage(int32(owner->GetTotalAttackPowerValue(RANGED_ATTACK) * 0.1287f * mod));        }        else if (IsPetGhoul()) //ghouls benefit from deathknight's attack power (may be summon pet or not)        {            bonusAP = owner->GetTotalAttackPowerValue(BASE_ATTACK) * 0.22f;            SetBonusDamage(int32(owner->GetTotalAttackPowerValue(BASE_ATTACK) * 0.1287f));        }        else if (IsSpiritWolf()) //wolf benefit from shaman's attack power        {            float dmg_multiplier = 0.31f;            if (m_owner->GetAuraEffect(63271, 0)) // Glyph of Feral Spirit                dmg_multiplier = 0.61f;            bonusAP = owner->GetTotalAttackPowerValue(BASE_ATTACK) * dmg_multiplier;            SetBonusDamage(int32(owner->GetTotalAttackPowerValue(BASE_ATTACK) * dmg_multiplier));        }        //demons benefit from warlocks shadow or fire damage        else if (IsPet())        {            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 (GetEntry() == ENTRY_WATER_ELEMENTAL)        {            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 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_MULTIPLIER field    SetFloatValue(UNIT_FIELD_ATTACK_POWER_MULTIPLIER, attPowerMultiplier);    //automatically update weapon damage after attack power modification    UpdateDamagePhysical(BASE_ATTACK);}
开发者ID:AnthoDevMoP,项目名称:Pandaren5.3.0,代码行数:71,


示例19: AI

void Transport::Update(uint32 diff){    uint32 const positionUpdateDelay = 200;    if (AI())        AI()->UpdateAI(diff);    else if (!AIM_Initialize())        TC_LOG_ERROR("entities.transport", "Could not initialize GameObjectAI for Transport");    if (GetKeyFrames().size() <= 1)        return;    if (IsMoving() || !_pendingStop)        m_goValue.Transport.PathProgress += diff;    uint32 timer = m_goValue.Transport.PathProgress % GetTransportPeriod();    // Set current waypoint    // Desired outcome: _currentFrame->DepartureTime < timer < _nextFrame->ArriveTime    // ... arrive | ... delay ... | departure    //      event /         event /    for (;;)    {        if (timer >= _currentFrame->ArriveTime)        {            if (!_triggeredArrivalEvent)            {                DoEventIfAny(*_currentFrame, false);                _triggeredArrivalEvent = true;            }            if (timer < _currentFrame->DepartureTime)            {                SetMoving(false);                if (_pendingStop && GetGoState() != GO_STATE_READY)                {                    SetGoState(GO_STATE_READY);                    m_goValue.Transport.PathProgress = (m_goValue.Transport.PathProgress / GetTransportPeriod());                    m_goValue.Transport.PathProgress *= GetTransportPeriod();                    m_goValue.Transport.PathProgress += _currentFrame->ArriveTime;                }                break;  // its a stop frame and we are waiting            }        }        if (timer >= _currentFrame->DepartureTime && !_triggeredDepartureEvent)        {            DoEventIfAny(*_currentFrame, true); // departure event            _triggeredDepartureEvent = true;        }        // not waiting anymore        SetMoving(true);        // Enable movement        if (GetGOInfo()->moTransport.canBeStopped)            SetGoState(GO_STATE_ACTIVE);        if (timer >= _currentFrame->DepartureTime && timer < _currentFrame->NextArriveTime)            break;  // found current waypoint        MoveToNextWaypoint();        sScriptMgr->OnRelocate(this, _currentFrame->Node->NodeIndex, _currentFrame->Node->MapID, _currentFrame->Node->LocX, _currentFrame->Node->LocY, _currentFrame->Node->LocZ);        TC_LOG_DEBUG("entities.transport", "Transport %u (%s) moved to node %u %u %f %f %f", GetEntry(), GetName().c_str(), _currentFrame->Node->NodeIndex, _currentFrame->Node->MapID, _currentFrame->Node->LocX, _currentFrame->Node->LocY, _currentFrame->Node->LocZ);        // Departure event        if (_currentFrame->IsTeleportFrame())            if (TeleportTransport(_nextFrame->Node->MapID, _nextFrame->Node->LocX, _nextFrame->Node->LocY, _nextFrame->Node->LocZ, _nextFrame->InitialOrientation))                return; // Update more in new map thread    }    // Add model to map after we are fully done with moving maps    if (_delayedAddModel)    {        _delayedAddModel = false;        if (m_model)            GetMap()->InsertGameObjectModel(*m_model);    }    // Set position    _positionChangeTimer.Update(diff);    if (_positionChangeTimer.Passed())    {        _positionChangeTimer.Reset(positionUpdateDelay);        if (IsMoving())        {            float t = CalculateSegmentPos(float(timer) * 0.001f);            G3D::Vector3 pos, dir;            _currentFrame->Spline->evaluate_percent(_currentFrame->Index, t, pos);            _currentFrame->Spline->evaluate_derivative(_currentFrame->Index, t, dir);            UpdatePosition(pos.x, pos.y, pos.z, std::atan2(dir.y, dir.x) + float(M_PI));        }        else        {            /* There are four possible scenarios that trigger loading/unloading passengers:              1. transport moves from inactive to active grid              2. the grid that transport is currently in becomes active              3. transport moves from active to inactive grid//.........这里部分代码省略.........
开发者ID:deathkayn,项目名称:Core-W,代码行数:101,


示例20: assert

bool Vehicle::AddPassenger(Unit *unit, int8 seatId){    if(unit->m_Vehicle != this)        return false;    SeatMap::iterator seat;    if(seatId < 0) // no specific seat requirement    {        for(seat = m_Seats.begin(); seat != m_Seats.end(); ++seat)            if(!seat->second.passenger && seat->second.seatInfo->IsUsable())                break;        if(seat == m_Seats.end()) // no available seat            return false;    }    else    {        seat = m_Seats.find(seatId);        if(seat == m_Seats.end())            return false;        if(seat->second.passenger)            seat->second.passenger->ExitVehicle();        assert(!seat->second.passenger);    }    sLog.outDebug("Unit %s enter vehicle entry %u id %u dbguid %u", unit->GetName(), GetEntry(), m_vehicleInfo->m_ID, GetDBTableGUIDLow());    seat->second.passenger = unit;    if(seat->second.seatInfo->IsUsable())    {        assert(m_usableSeatNum);        --m_usableSeatNum;        if(!m_usableSeatNum)            RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);    }    if(!(seat->second.seatInfo->m_flags & 0x4000))        unit->addUnitState(UNIT_STAT_ONVEHICLE);    //SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_24);    unit->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT);    VehicleSeatEntry const *veSeat = seat->second.seatInfo;    unit->m_movementInfo.t_x = veSeat->m_attachmentOffsetX;    unit->m_movementInfo.t_y = veSeat->m_attachmentOffsetY;    unit->m_movementInfo.t_z = veSeat->m_attachmentOffsetZ;    unit->m_movementInfo.t_o = 0;    unit->m_movementInfo.t_time = 0; // 1 for player    unit->m_movementInfo.t_seat = seat->first;    if(unit->GetTypeId() == TYPEID_PLAYER && seat->first == 0 && seat->second.seatInfo->m_flags & 0x800) // not right        if (!SetCharmedBy(unit, CHARM_TYPE_VEHICLE))            assert(false);    if(IsInWorld())    {        unit->SendMonsterMoveTransport(this);        GetMap()->CreatureRelocation(this, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());    }    //if(unit->GetTypeId() == TYPEID_PLAYER)    //    ((Player*)unit)->SendTeleportAckMsg();    //unit->SendMovementFlagUpdate();    return true;}
开发者ID:MilchBuby,项目名称:riboncore,代码行数:68,


示例21: ARCEMU_ASSERT

//.........这里部分代码省略.........    //SetTextId( fields[11].GetUInt32() );    SetDurabilityMax(m_itemProto->MaxDurability);    SetDurability(fields[12].GetUInt32());    if(light)        return;    string enchant_field = fields[15].GetString();    vector< string > enchants = StrSplit(enchant_field, ";");    uint32 enchant_id;    EnchantEntry* entry;    uint32 time_left;    uint32 enchslot;    for(vector<string>::iterator itr = enchants.begin(); itr != enchants.end(); ++itr)    {        if(sscanf((*itr).c_str(), "%u,%u,%u", (unsigned int*)&enchant_id, (unsigned int*)&time_left, (unsigned int*)&enchslot) == 3)        {            entry = dbcEnchant.LookupEntryForced(enchant_id);            if(entry && entry->Id == enchant_id && m_itemProto->SubClass != ITEM_SUBCLASS_WEAPON_THROWN)            {                AddEnchantment(entry, time_left, (time_left == 0), false, false, enchslot);                //(enchslot != 2) ? false : true, false);            }            else            {                /*                EnchantEntry *pEnchant = new EnchantEntry;                memset(pEnchant,0,sizeof(EnchantEntry));                pEnchant->Id = enchant_id;                if(enchslot != 2)                	AddEnchantment(pEnchant,0,true, false);                else                	AddEnchantment(pEnchant,0,false,false);                */            }        }    }    ItemExpiresOn = fields[16].GetUInt32();///////////////////////////////////////////////////// Refund stuff ////////////////////////    std::pair< time_t, uint32 > refundentry;    refundentry.first = fields[17].GetUInt32();    refundentry.second = fields[18].GetUInt32();    if(refundentry.first != 0 && refundentry.second != 0 && GetOwner() != NULL)    {        uint32* played = GetOwner()->GetPlayedtime();        if(played[1] < (refundentry.first + 60 * 60 * 2))            m_owner->GetItemInterface()->AddRefundable(this, refundentry.second, refundentry.first);    }///////////////////////////////////////////////////////////////////////////////////////////    text = fields[19].GetString();    ApplyRandomProperties(false);    // Charter stuff    if(GetEntry() == ITEM_ENTRY_GUILD_CHARTER)    {        SoulBind();        SetStackCount(1);        SetItemRandomSuffixFactor(57813883);        if(plr != NULL && plr->m_charters[CHARTER_TYPE_GUILD])            SetEnchantmentId(0, plr->m_charters[CHARTER_TYPE_GUILD]->GetID());    }    if(GetEntry() == ARENA_TEAM_CHARTER_2v2)    {        SoulBind();        SetStackCount(1);        SetItemRandomSuffixFactor(57813883);        if(plr != NULL && plr->m_charters[CHARTER_TYPE_ARENA_2V2])            SetEnchantmentId(0, plr->m_charters[CHARTER_TYPE_ARENA_2V2]->GetID());    }    if(GetEntry() == ARENA_TEAM_CHARTER_3v3)    {        SoulBind();        SetStackCount(1);        SetItemRandomSuffixFactor(57813883);        if(plr != NULL && plr->m_charters[CHARTER_TYPE_ARENA_3V3])            SetEnchantmentId(0,  plr->m_charters[CHARTER_TYPE_ARENA_3V3]->GetID());    }    if(GetEntry() == ARENA_TEAM_CHARTER_5v5)    {        SoulBind();        SetStackCount(1);        SetItemRandomSuffixFactor(57813883);        if(plr != NULL && plr->m_charters[CHARTER_TYPE_ARENA_5V5])            SetEnchantmentId(0,  plr->m_charters[CHARTER_TYPE_ARENA_5V5]->GetID());    }}
开发者ID:treetrees,项目名称:Edge-of-Chaos,代码行数:101,


示例22: ON

bool Creature::LoadFromDB(uint32 guid, QueryResult *result, uint32 InstanceId){    bool external = (result != NULL);    if (!external)        //                                0    1     2            3            4            5             6               7           8                  9                  10                 11          12        13            14           15             16        result = sDatabase.PQuery("SELECT `id`,`map`,`position_x`,`position_y`,`position_z`,`orientation`,`spawntimesecs`,`spawndist`,`spawn_position_x`,`spawn_position_y`,`spawn_position_z`,`curhealth`,`curmana`,`respawntime`,`DeathState`,`MovementType`,`auras` "            "FROM `creature` LEFT JOIN `creature_respawn` ON ((`creature`.`guid`=`creature_respawn`.`guid`) AND (`creature_respawn`.`instance` = '%u')) WHERE `creature`.`guid` = '%u'", InstanceId, guid);    if(!result)    {        sLog.outErrorDb("Creature (GUID: %u) not found in table `creature`, can't load. ",guid);        return false;    }    Field *fields = result->Fetch();    uint32 stored_guid = guid;    if (InstanceId != 0) guid = objmgr.GenerateLowGuid(HIGHGUID_UNIT);    SetInstanceId(InstanceId);    if(!Create(guid,fields[1].GetUInt32(),fields[2].GetFloat(),fields[3].GetFloat(),        fields[4].GetFloat(),fields[5].GetFloat(),fields[0].GetUInt32()))    {        if (!external) delete result;        return false;    }    m_DBTableGuid = stored_guid;    if(GetCreatureInfo()->rank > 0)        this->m_corpseDelay *= 3;                           //if creature is elite, then remove corpse later    SetHealth(fields[11].GetUInt32());    SetPower(POWER_MANA,fields[12].GetUInt32());    m_respawnradius = fields[7].GetFloat();    respawn_cord[0] = fields[8].GetFloat();    respawn_cord[1] = fields[9].GetFloat();    respawn_cord[2] = fields[10].GetFloat();    m_respawnDelay = fields[6].GetUInt32();    m_deathState = (DeathState)fields[14].GetUInt32();    if(m_deathState == JUST_DIED)                           // Dont must be set to JUST_DEAD, see Creature::setDeathState JUST_DIED -> CORPSE promoting.    {        sLog.outErrorDb("Creature (GUIDLow: %u Entry: %u ) in wrong state: JUST_DEAD (1). State set to ALIVE.",GetGUIDLow(),GetEntry());        m_deathState = ALIVE;    }    else    if(m_deathState < ALIVE || m_deathState > DEAD)    {        sLog.outErrorDb("Creature (GUIDLow: %u Entry: %u ) in wrong state: %d. State set to ALIVE.",GetGUIDLow(),GetEntry(),m_deathState);        m_deathState = ALIVE;    }    m_respawnTime  = (time_t)fields[13].GetUInt64();    if(m_respawnTime > time(NULL))                          // not ready to respawn        m_deathState = DEAD;    else                                                    // ready to respawn    {        m_respawnTime = 0;        sDatabase.PExecute("DELETE FROM `creature_respawn` WHERE `guid` = '%u' AND `instance` = '%u'", m_DBTableGuid, GetInstanceId());    }    {        uint32 mtg = fields[15].GetUInt32();        if(mtg < MAX_DB_MOTION_TYPE)            m_defaultMovementType = MovementGeneratorType(mtg);        else        {            m_defaultMovementType = IDLE_MOTION_TYPE;            sLog.outErrorDb("Creature (GUID: %u ID: %u) have wrong movement generator type value %u, ignore and set to IDLE.",guid,GetEntry(),mtg);        }    }    if(!external) delete result;    LoadFlagRelatedData();        AIM_Initialize();    return true;}
开发者ID:chrayn,项目名称:mangos-06,代码行数:81,


示例23: GetTemplate

ItemTemplate const* Item::GetTemplate() const{    if (GetOwner() && GetOwner()->InArena())        return sObjectMgr->GetItemTemplate(GetPermittedItemInArena());    return sObjectMgr->GetItemTemplate(GetEntry());}
开发者ID:Allowed,项目名称:Strawberry335,代码行数:6,


示例24:

CreatureInfo const *Creature::GetCreatureInfo() const{    return objmgr.GetCreatureTemplate(GetEntry());}
开发者ID:chrayn,项目名称:mangos-06,代码行数:4,


示例25: MYTRACE

void CStudentInfoView::OnUpdate(CView* /*pSender*/, LPARAM /*lHint*/, CObject* /*pHint*/){    MYTRACE("Enter");    m_StudentListPos = m_StudentList->GetHeadPosition();    GetEntry(m_StudentListPos); // Doc -> View}
开发者ID:7zhang,项目名称:studies,代码行数:6,



注:本文中的GetEntry函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ GetEnvironmentVariable函数代码示例
C++ GetEntityName函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。