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

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

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

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

在下文中一共展示了GetGUIDLow函数的25个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: GetGUIDLow

void Item::SaveToDB(){    uint32 guid = GetGUIDLow();    switch (uState)    {        case ITEM_NEW:        {            static SqlStatementID deleteItem;            static SqlStatementID saveItem;            SqlStatement stmt = RealmDataDatabase.CreateStatement(deleteItem, "DELETE FROM item_instance WHERE guid = ?");            stmt.PExecute(guid);            stmt = RealmDataDatabase.CreateStatement(saveItem, "INSERT INTO item_instance (guid, owner_guid, data) VALUES (?, ?, ?)");            std::ostringstream ss;            for (uint16 i = 0; i < m_valuesCount; i++)                ss << GetUInt32Value(i) << " ";            stmt.PExecute(guid, GUID_LOPART(GetOwnerGUID()), ss.str().c_str());        }        break;        case ITEM_CHANGED:        {            static SqlStatementID updateItem;            static SqlStatementID updateGift;            SqlStatement stmt = RealmDataDatabase.CreateStatement(updateItem, "UPDATE item_instance SET data = ?,  owner_guid = ? WHERE guid = ?");            std::ostringstream ss;            for (uint16 i = 0; i < m_valuesCount; i++)                ss << GetUInt32Value(i) << " ";            stmt.PExecute(ss.str().c_str(), GUID_LOPART(GetOwnerGUID()), guid);            if (HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_WRAPPED))            {                stmt = RealmDataDatabase.CreateStatement(updateGift, "UPDATE character_gifts SET guid = ? WHERE item_guid = ?");                stmt.PExecute(GUID_LOPART(GetOwnerGUID()), GetGUIDLow());            }        }        break;        case ITEM_REMOVED:        {            static SqlStatementID deleteItem;            static SqlStatementID deleteItemText;            static SqlStatementID deleteGift;            SqlStatement stmt = RealmDataDatabase.CreateStatement(deleteItem, "DELETE FROM item_instance WHERE guid = ?");            stmt.PExecute(guid);            if (GetUInt32Value(ITEM_FIELD_ITEM_TEXT_ID) > 0)            {                stmt = RealmDataDatabase.CreateStatement(deleteItemText, "DELETE FROM item_text WHERE id = ?");                stmt.PExecute(GetUInt32Value(ITEM_FIELD_ITEM_TEXT_ID));            }            if (HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_WRAPPED))            {                stmt = RealmDataDatabase.CreateStatement(deleteGift, "DELETE FROM character_gifts WHERE item_guid = ?");                stmt.PExecute(GetGUIDLow());            }            delete this;            return;        }        case ITEM_UNCHANGED:            break;    }    SetState(ITEM_UNCHANGED);}
开发者ID:Dolmero,项目名称:L4G_Core,代码行数:71,


示例2: GetGUIDLow

void Item::SaveToDB(SQLTransaction& trans){    uint32 guid = GetGUIDLow();    switch (uState)    {        case ITEM_NEW:        case ITEM_CHANGED:        {            uint8 index = 0;            PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(uState == ITEM_NEW ? CHAR_ADD_ITEM_INSTANCE : CHAR_UPDATE_ITEM_INSTANCE);            stmt->setUInt32(  index, GetEntry());            stmt->setUInt32(++index, GUID_LOPART(GetOwnerGUID()));            stmt->setUInt32(++index, GUID_LOPART(GetUInt64Value(ITEM_FIELD_CREATOR)));            stmt->setUInt32(++index, GUID_LOPART(GetUInt64Value(ITEM_FIELD_GIFTCREATOR)));            stmt->setUInt32(++index, GetCount());            stmt->setUInt32(++index, GetUInt32Value(ITEM_FIELD_DURATION));            std::ostringstream ssSpells;            for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)                ssSpells << GetSpellCharges(i) << " ";            stmt->setString(++index, ssSpells.str());            stmt->setUInt32(++index, GetUInt32Value(ITEM_FIELD_FLAGS));            std::ostringstream ssEnchants;            for (uint8 i = 0; i < MAX_ENCHANTMENT_SLOT; ++i)            {                ssEnchants << GetEnchantmentId(EnchantmentSlot(i)) << " ";                ssEnchants << GetEnchantmentDuration(EnchantmentSlot(i)) << " ";                ssEnchants << GetEnchantmentCharges(EnchantmentSlot(i)) << " ";            }            stmt->setString(++index, ssEnchants.str());            stmt->setInt32 (++index, GetItemRandomPropertyId());            stmt->setUInt32(++index, GetUInt32Value(ITEM_FIELD_DURABILITY));            stmt->setUInt32(++index, GetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME));            stmt->setString(++index, m_text);            stmt->setUInt32(++index, guid);            trans->Append(stmt);            if ((uState == ITEM_CHANGED) && HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_WRAPPED))            {                stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPDATE_GIFT_OWNER);                stmt->setUInt32(0, GUID_LOPART(GetOwnerGUID()));                stmt->setUInt32(1, guid);                trans->Append(stmt);            }            break;        }        case ITEM_REMOVED:        {            PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE);            stmt->setUInt32(0, guid);            trans->Append(stmt);            if (HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_WRAPPED))            {                stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GIFT);                stmt->setUInt32(0, guid);                trans->Append(stmt);            }            delete this;            return;        }        case ITEM_UNCHANGED:            break;    }    SetState(ITEM_UNCHANGED);}
开发者ID:Ballwinkle,项目名称:SkyFireEMU,代码行数:70,


示例3: DeleteFromInventoryDB

void Item::DeleteFromInventoryDB(){    CharacterDatabase.PExecute("DELETE FROM character_inventory WHERE item = '%u'",GetGUIDLow());}
开发者ID:Sanzzes,项目名称:wopc-core,代码行数:4,


示例4: ObjectGuid

bool Item::LoadFromDB(uint32 guidLow, Field* fields, ObjectGuid ownerGuid){    // create item before any checks for store correct guid    // and allow use "FSetState(ITEM_REMOVED); SaveToDB();" for deleting item from DB    Object::_Create(guidLow, 0, HIGHGUID_ITEM);    if (!LoadValues(fields[0].GetString()))    {        sLog.outError("Item #%d have broken data in `data` field. Can't be loaded.", guidLow);        return false;    }    bool need_save = false;                                 // need explicit save data at load fixes    // overwrite possible wrong/corrupted guid    ObjectGuid new_item_guid = ObjectGuid(HIGHGUID_ITEM, guidLow);    if (GetGuidValue(OBJECT_FIELD_GUID) != new_item_guid)    {        SetGuidValue(OBJECT_FIELD_GUID, new_item_guid);        need_save = true;    }    ItemPrototype const* proto = GetProto();    if (!proto)        return false;    // update max durability (and durability) if need    if (proto->MaxDurability!= GetUInt32Value(ITEM_FIELD_MAXDURABILITY))    {        SetUInt32Value(ITEM_FIELD_MAXDURABILITY, proto->MaxDurability);        if (GetUInt32Value(ITEM_FIELD_DURABILITY) > proto->MaxDurability)            SetUInt32Value(ITEM_FIELD_DURABILITY, proto->MaxDurability);        need_save = true;    }    // Remove bind flag for items vs NO_BIND set    if (IsSoulBound() && proto->Bonding == NO_BIND)    {        ApplyModFlag(ITEM_FIELD_FLAGS, ITEM_DYNFLAG_BINDED, false);        need_save = true;    }    // update duration if need, and remove if not need    if ((proto->Duration == 0) != (GetUInt32Value(ITEM_FIELD_DURATION) == 0))    {        SetUInt32Value(ITEM_FIELD_DURATION, proto->Duration);        need_save = true;    }    // set correct owner    if (ownerGuid && GetOwnerGuid() != ownerGuid)    {        SetOwnerGuid(ownerGuid);        need_save = true;    }    // set correct wrapped state    if (HasFlag(ITEM_FIELD_FLAGS, ITEM_DYNFLAG_WRAPPED))    {        // wrapped item must be wrapper (used version that not stackable)        if (!(proto->Flags & ITEM_FLAG_WRAPPER) || GetMaxStackCount() > 1)        {            RemoveFlag(ITEM_FIELD_FLAGS, ITEM_DYNFLAG_WRAPPED);            need_save = true;            static SqlStatementID delGifts ;            // also cleanup for sure gift table            SqlStatement stmt = CharacterDatabase.CreateStatement(delGifts, "DELETE FROM character_gifts WHERE item_guid = ?");            stmt.PExecute(GetGUIDLow());        }    }    if (need_save)                                          // normal item changed state set not work at loading    {        static SqlStatementID updItem ;        SqlStatement stmt = CharacterDatabase.CreateStatement(updItem, "UPDATE item_instance SET data = ?, owner_guid = ? WHERE guid = ?");        std::ostringstream ss;        for (uint16 i = 0; i < m_valuesCount; ++i)            ss << GetUInt32Value(i) << " ";        stmt.addString(ss);        stmt.addUInt32(GetOwnerGuid().GetCounter());        stmt.addUInt32(guidLow);        stmt.Execute();    }    return true;}
开发者ID:PanteraPolnocy,项目名称:MaNGOS-Zero,代码行数:92,


示例5: GetOwnerGUID

GameObject::~GameObject(){    if(m_uint32Values)                                      // field array can be not exist if GameOBject not loaded    {        // crash possable at access to deleted GO in Unit::m_gameobj        uint64 owner_guid = GetOwnerGUID();        if(owner_guid)        {            Unit* owner = ObjectAccessor::GetUnit(*this,owner_guid);            if(owner)                owner->RemoveGameObject(this,false);            else if(!IS_PLAYER_GUID(owner_guid))                sLog.outError("Delete GameObject (GUID: %u Entry: %u ) that have references in not found creature %u GO list. Crash possable later.",GetGUIDLow(),GetGOInfo()->id,GUID_LOPART(owner_guid));        }    }}
开发者ID:yunishaa,项目名称:mangos-112,代码行数:16,


示例6: time_t

bool Corpse::LoadFromDB(uint32 lowguid, Field* fields){    ////                                                    0            1       2                  3                  4                  5                   6    //QueryResult *result = CharacterDatabase.Query("SELECT corpse.guid, player, corpse.position_x, corpse.position_y, corpse.position_z, corpse.orientation, corpse.map,"    ////   7     8            9         10      11    12     13           14            15              16       17    //    "time, corpse_type, instance, gender, race, class, playerBytes, playerBytes2, equipmentCache, guildId, playerFlags FROM corpse"    uint32 playerLowGuid = fields[1].GetUInt32();    float positionX     = fields[2].GetFloat();    float positionY     = fields[3].GetFloat();    float positionZ     = fields[4].GetFloat();    float orientation   = fields[5].GetFloat();    uint32 mapid        = fields[6].GetUInt32();    Object::_Create(lowguid, 0, HIGHGUID_CORPSE);    m_time = time_t(fields[7].GetUInt64());    m_type = CorpseType(fields[8].GetUInt32());    if (m_type >= MAX_CORPSE_TYPE)    {        sLog.outError("%s Owner %s have wrong corpse type (%i), not load.", GetGuidStr().c_str(), GetOwnerGuid().GetString().c_str(), m_type);        return false;    }    uint32 instanceid   = fields[9].GetUInt32();    uint8 gender        = fields[10].GetUInt8();    uint8 race          = fields[11].GetUInt8();    uint8 _class        = fields[12].GetUInt8();    uint32 playerBytes  = fields[13].GetUInt32();    uint32 playerBytes2 = fields[14].GetUInt32();    uint32 guildId      = fields[16].GetUInt32();    uint32 playerFlags  = fields[17].GetUInt32();    ObjectGuid guid = ObjectGuid(HIGHGUID_CORPSE, lowguid);    ObjectGuid playerGuid = ObjectGuid(HIGHGUID_PLAYER, playerLowGuid);    // overwrite possible wrong/corrupted guid    SetGuidValue(OBJECT_FIELD_GUID, guid);    SetGuidValue(CORPSE_FIELD_OWNER, playerGuid);    SetObjectScale(DEFAULT_OBJECT_SCALE);    PlayerInfo const* info = sObjectMgr.GetPlayerInfo(race, _class);    if (!info)    {        sLog.outError("Player %u has incorrect race/class pair.", GetGUIDLow());        return false;    }    SetUInt32Value(CORPSE_FIELD_DISPLAY_ID, gender == GENDER_FEMALE ? info->displayId_f : info->displayId_m);    // Load equipment    Tokens data = StrSplit(fields[15].GetCppString(), " ");    for (uint8 slot = 0; slot < EQUIPMENT_SLOT_END; ++slot)    {        uint32 visualbase = slot * 2;        uint32 item_id = GetUInt32ValueFromArray(data, visualbase);        const ItemPrototype* proto = ObjectMgr::GetItemPrototype(item_id);        if (!proto)        {            SetUInt32Value(CORPSE_FIELD_ITEM + slot, 0);            continue;        }        SetUInt32Value(CORPSE_FIELD_ITEM + slot, proto->DisplayInfoID | (proto->InventoryType << 24));    }    uint8 skin       = (uint8)(playerBytes);    uint8 face       = (uint8)(playerBytes >> 8);    uint8 hairstyle  = (uint8)(playerBytes >> 16);    uint8 haircolor  = (uint8)(playerBytes >> 24);    uint8 facialhair = (uint8)(playerBytes2);    SetUInt32Value(CORPSE_FIELD_BYTES_1, ((0x00) | (race << 8) | (gender << 16) | (skin << 24)));    SetUInt32Value(CORPSE_FIELD_BYTES_2, ((face) | (hairstyle << 8) | (haircolor << 16) | (facialhair << 24)));    SetUInt32Value(CORPSE_FIELD_GUILD, guildId);    uint32 flags = CORPSE_FLAG_UNK2;    if (playerFlags & PLAYER_FLAGS_HIDE_HELM)        flags |= CORPSE_FLAG_HIDE_HELM;    if (playerFlags & PLAYER_FLAGS_HIDE_CLOAK)        flags |= CORPSE_FLAG_HIDE_CLOAK;    SetUInt32Value(CORPSE_FIELD_FLAGS, flags);    // no need to mark corpse as lootable, because corpses are not saved in battle grounds    // place    SetLocationInstanceId(instanceid);    SetLocationMapId(mapid);    Relocate(positionX, positionY, positionZ, orientation);    if (!IsPositionValid())    {        sLog.outError("%s Owner %s not created. Suggested coordinates isn't valid (X: %f Y: %f)",                      GetGuidStr().c_str(), GetOwnerGuid().GetString().c_str(), GetPositionX(), GetPositionY());        return false;    }    m_grid = MaNGOS::ComputeGridPair(GetPositionX(), GetPositionY());    return true;//.........这里部分代码省略.........
开发者ID:mangLua,项目名称:server,代码行数:101,


示例7: switch

void GameObject::Update(uint32 /*p_time*/){    if (IS_MO_TRANSPORT(GetGUID()))    {        //((Transport*)this)->Update(p_time);        return;    }    switch (m_lootState)    {        case GO_NOT_READY:        {            switch(GetGoType())            {                case GAMEOBJECT_TYPE_TRAP:                {                    // Arming Time for GAMEOBJECT_TYPE_TRAP (6)                    Unit* owner = GetOwner();                    if (owner && ((Player*)owner)->isInCombat())                        m_cooldownTime = time(NULL) + GetGOInfo()->trap.startDelay;                    m_lootState = GO_READY;                    break;                }                case GAMEOBJECT_TYPE_FISHINGNODE:                {                    // fishing code (bobber ready)                    if( time(NULL) > m_respawnTime - FISHING_BOBBER_READY_TIME )                    {                        // splash bobber (bobber ready now)                        Unit* caster = GetOwner();                        if(caster && caster->GetTypeId()==TYPEID_PLAYER)                        {                            SetGoState(GO_STATE_ACTIVE);                            SetUInt32Value(GAMEOBJECT_FLAGS, GO_FLAG_NODESPAWN);                            UpdateData udata;                            WorldPacket packet;                            BuildValuesUpdateBlockForPlayer(&udata,((Player*)caster));                            udata.BuildPacket(&packet);                            ((Player*)caster)->GetSession()->SendPacket(&packet);                            WorldPacket data(SMSG_GAMEOBJECT_CUSTOM_ANIM,8+4);                            data << GetGUID();                            data << (uint32)(0);                            ((Player*)caster)->SendMessageToSet(&data,true);                        }                        m_lootState = GO_READY;                 // can be successfully open with some chance                    }                    return;                }                default:                    m_lootState = GO_READY;                         // for other GOis same switched without delay to GO_READY                    break;            }            // NO BREAK for switch (m_lootState)        }        case GO_READY:        {            if (m_respawnTime > 0)                          // timer on            {                if (m_respawnTime <= time(NULL))            // timer expired                {                    m_respawnTime = 0;                    m_SkillupList.clear();                    m_usetimes = 0;                    switch (GetGoType())                    {                        case GAMEOBJECT_TYPE_FISHINGNODE:   //  can't fish now                        {                            Unit* caster = GetOwner();                            if(caster && caster->GetTypeId()==TYPEID_PLAYER)                            {                                caster->FinishSpell(CURRENT_CHANNELED_SPELL);                                WorldPacket data(SMSG_FISH_NOT_HOOKED,0);                                ((Player*)caster)->GetSession()->SendPacket(&data);                            }                            // can be delete                            m_lootState = GO_JUST_DEACTIVATED;                            return;                        }                        case GAMEOBJECT_TYPE_DOOR:                        case GAMEOBJECT_TYPE_BUTTON:                            //we need to open doors if they are closed (add there another condition if this code breaks some usage, but it need to be here for battlegrounds)                            if (GetGoState() != GO_STATE_READY)                                ResetDoorOrButton();                            //flags in AB are type_button and we need to add them here so no break!                        default:                            if (!m_spawnedByDefault)        // despawn timer                            {                                                            // can be despawned or destroyed                                SetLootState(GO_JUST_DEACTIVATED);                                return;                            }                                                            // respawn timer                            uint16 poolid = sPoolMgr.IsPartOfAPool(GetGUIDLow(), TYPEID_GAMEOBJECT);                            if (poolid)                                sPoolMgr.UpdatePool(poolid, GetGUIDLow(), TYPEID_GAMEOBJECT);//.........这里部分代码省略.........
开发者ID:wk23,项目名称:tst,代码行数:101,


示例8: GetFakeEntry

uint32 Item::GetFakeEntry() // custom{    ItemFakeEntryContainer::const_iterator itr = sObjectMgr->_itemFakeEntryStore.find(GetGUIDLow());    if (itr == sObjectMgr->_itemFakeEntryStore.end()) return NULL;    return itr->second;}
开发者ID:jacobmain1,项目名称:ApocalypseCore,代码行数:6,


示例9: DeleteFromInventoryDB

void Item::DeleteFromInventoryDB(SQLTransaction& trans, uint32 playerGuid){    DeleteFromInventoryDB(trans, GetGUIDLow(), playerGuid);}
开发者ID:Allowed,项目名称:Strawberry335,代码行数:4,


示例10: GetGUIDLow

void Item::DeleteRefundDataFromDB(SQLTransaction* trans){    if (trans && !trans->null())        (*trans)->PAppend("DELETE FROM item_refund_instance WHERE item_guid = '%u'", GetGUIDLow());}
开发者ID:Zone-Emu,项目名称:ZoneEmuWotlk,代码行数:5,


示例11: RemoveFakeDisplay

void Item::DeleteFromDB(SQLTransaction& trans){    RemoveFakeDisplay();    DeleteFromDB(trans, GetGUIDLow());}
开发者ID:Odiis,项目名称:MythCore,代码行数:5,


示例12: SetUInt64Value

bool Bag::LoadFromDB(uint32 guid, uint64 owner_guid){    if(!Item::LoadFromDB(guid, owner_guid))        return false;    // cleanup bag content related item value fields (its will be filled correctly from `character_inventory`)    for (uint32 i = 0; i < GetProto()->ContainerSlots; i++)    {        SetUInt64Value(CONTAINER_FIELD_SLOT_1 + (i*2), 0);        if (m_bagslot[i])        {            delete m_bagslot[i];            m_bagslot[i] = NULL;        }    }    if(!IsInBag())                                          // equiped bag    {        QueryResult *result = sDatabase.PQuery("SELECT `slot`,`item`,`item_template` FROM `character_inventory` WHERE `guid` = '%u' AND `bag` = '%u'", GUID_LOPART(GetOwnerGUID()), GetGUIDLow());        if (result)        {            do            {                Field *fields = result->Fetch();                uint8  slot      = fields[0].GetUInt8();                uint32 item_guid = fields[1].GetUInt32();                uint32 item_id   = fields[2].GetUInt32();                ItemPrototype const *proto = objmgr.GetItemPrototype(item_id);                if(!proto)                {                    sLog.outError( "Bag::LoadFromDB: Player %d have unknown item (id: #%u) in bag #%u, skipped.", GUID_LOPART(GetOwnerGUID()), item_id, GetSlot());                    continue;                }                Item *item = NewItemOrBag(proto);                item->SetSlot(NULL_SLOT);                if(!item->LoadFromDB(item_guid, owner_guid))                {                    delete item;                    continue;                }                StoreItem( slot, item, true );                item->SetState(ITEM_UNCHANGED);            } while (result->NextRow());            delete result;        }    }    return true;}
开发者ID:Artea,项目名称:mangos-svn,代码行数:53,


示例13: GetGUIDLow

void Item::SaveToDB(){    uint32 guid = GetGUIDLow();    switch (uState)    {        case ITEM_NEW:        {            std::string text = m_text;            CharacterDatabase.escape_string(text);            CharacterDatabase.PExecute( "DELETE FROM item_instance WHERE guid = '%u'", guid );            std::ostringstream ss;            ss << "INSERT INTO item_instance (guid,owner_guid,data,text) VALUES (" << guid << "," << GetOwnerGuid().GetCounter() << ",'";            for(uint16 i = 0; i < m_valuesCount; ++i )                ss << GetUInt32Value(i) << " ";            ss << "', '" << text << "')";            CharacterDatabase.Execute( ss.str().c_str() );        } break;        case ITEM_CHANGED:        {            std::string text = m_text;            CharacterDatabase.escape_string(text);            std::ostringstream ss;            ss << "UPDATE item_instance SET data = '";            for(uint16 i = 0; i < m_valuesCount; ++i )                ss << GetUInt32Value(i) << " ";            ss << "', owner_guid = '" << GetOwnerGuid().GetCounter();            ss << "', text = '" << text << "' WHERE guid = '" << guid << "'";            CharacterDatabase.Execute( ss.str().c_str() );            if (HasFlag(ITEM_FIELD_FLAGS, ITEM_DYNFLAG_WRAPPED))                CharacterDatabase.PExecute("UPDATE character_gifts SET guid = '%u' WHERE item_guid = '%u'", GetOwnerGuid().GetCounter(), GetGUIDLow());        } break;        case ITEM_REMOVED:        {            CharacterDatabase.PExecute("DELETE FROM item_instance WHERE guid = '%u'", guid);            if (HasFlag(ITEM_FIELD_FLAGS, ITEM_DYNFLAG_WRAPPED))                CharacterDatabase.PExecute("DELETE FROM character_gifts WHERE item_guid = '%u'", GetGUIDLow());            if (HasSavedLoot())                CharacterDatabase.PExecute("DELETE FROM item_loot WHERE guid = '%u'", GetGUIDLow());            delete this;            return;        }        case ITEM_UNCHANGED:            return;    }    if (m_lootState == ITEM_LOOT_CHANGED || m_lootState == ITEM_LOOT_REMOVED)        CharacterDatabase.PExecute("DELETE FROM item_loot WHERE guid = '%u'", GetGUIDLow());    if (m_lootState == ITEM_LOOT_NEW || m_lootState == ITEM_LOOT_CHANGED)    {        if(Player* owner = GetOwner())        {            // save money as 0 itemid data            if (loot.gold)                CharacterDatabase.PExecute("INSERT INTO item_loot (guid,owner_guid,itemid,amount,suffix,property) "                    "VALUES (%u, %u, 0, %u, 0, 0)",                    GetGUIDLow(), owner->GetGUIDLow(), loot.gold);            // save items and quest items (at load its all will added as normal, but this not important for item loot case)            for (size_t i = 0; i < loot.GetMaxSlotInLootFor(owner); ++i)            {                QuestItem *qitem = NULL;                LootItem *item = loot.LootItemInSlot(i,owner,&qitem);                if(!item)                    continue;                // questitems use the blocked field for other purposes                if (!qitem && item->is_blocked)                    continue;                CharacterDatabase.PExecute("INSERT INTO item_loot (guid,owner_guid,itemid,amount,suffix,property) "                    "VALUES (%u, %u, %u, %u, %u, %i)",                    GetGUIDLow(), owner->GetGUIDLow(), item->itemid, item->count, item->randomSuffix, item->randomPropertyId);            }        }    }    if (m_lootState != ITEM_LOOT_NONE && m_lootState != ITEM_LOOT_TEMPORARY)        SetLootState(ITEM_LOOT_UNCHANGED);    SetState(ITEM_UNCHANGED);}
开发者ID:syenet,项目名称:mangos,代码行数:88,


示例14: GetOwner

void Item::SetFakeEntry(uint32 entry) // custom{    GetOwner()->UpdateUInt32Value(PLAYER_VISIBLE_ITEM_1_ENTRYID + (GetSlot() * 2), entry);    sObjectMgr->_itemFakeEntryStore[GetGUIDLow()] = entry;    CharacterDatabase.PExecute("REPLACE INTO custom_transmogrification (GUID, FakeEntry) VALUES (%u, %u)", GetGUIDLow(), entry);}
开发者ID:jacobmain1,项目名称:ApocalypseCore,代码行数:6,


示例15: 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,


示例16: switch

void Creature::Update(uint32 diff){    switch( m_deathState )    {        case JUST_DIED:            // Dont must be called, see Creature::setDeathState JUST_DIED -> CORPSE promoting.            sLog.outError("Creature (GUIDLow: %u Entry: %u ) in wrong state: JUST_DEAD (1)",GetGUIDLow(),GetEntry());            break;        case DEAD:        {            if( m_respawnTime <= time(NULL) )            {                DEBUG_LOG("Respawning...");                m_respawnTime = 0;                CreatureInfo const *cinfo = objmgr.GetCreatureTemplate(this->GetEntry());                SelectLevel(cinfo);                SetUInt32Value(UNIT_DYNAMIC_FLAGS, 0);                RemoveFlag (UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE);                SetUInt32Value(UNIT_NPC_FLAGS, cinfo->npcflag);                SetHealth(GetMaxHealth());                setDeathState( ALIVE );                clearUnitState(UNIT_STAT_ALL_STATE);                i_motionMaster.Clear();                MapManager::Instance().GetMap(GetMapId(), this)->Add(this);            }            break;        }        case CORPSE:        {            if( m_deathTimer <= diff )            {                m_deathTimer = 0;                DEBUG_LOG("Removing corpse... %u ", GetUInt32Value(OBJECT_FIELD_ENTRY));                ObjectAccessor::Instance().RemoveCreatureCorpseFromPlayerView(this);                lootForPickPocketed = false;                lootForBody         = false;                loot.clear();                setDeathState(DEAD);                m_respawnTime = time(NULL) + m_respawnDelay;                float x,y,z;                GetRespawnCoord(x, y, z);                MapManager::Instance().GetMap(GetMapId(), this)->CreatureRelocation(this,x,y,z,GetOrientation());            }            else            {                m_deathTimer -= diff;                if (m_groupLootTimer && lootingGroupLeaderGUID)                {                    if(diff <= m_groupLootTimer)                    {                        m_groupLootTimer -= diff;                    }                    else                    {                        Group* group = objmgr.GetGroupByLeader(lootingGroupLeaderGUID);                        if (group)                            group->EndRoll();                        m_groupLootTimer = 0;                        lootingGroupLeaderGUID = 0;                    }                }            }            break;        }        case ALIVE:        {            Unit::Update( diff );            i_motionMaster.UpdateMotion(diff);            i_AI->UpdateAI(diff);            if(m_regenTimer > 0)            {                if(diff >= m_regenTimer)                    m_regenTimer = 0;                else                    m_regenTimer -= diff;            }            if (m_regenTimer != 0)                break;            if (!isInCombat())            {                RegenerateHealth();                RegenerateMana();            }            m_regenTimer = 2000;            break;        }        default:            break;    }}
开发者ID:chrayn,项目名称:mangos-06,代码行数:95,


示例17: GetGUIDLow

void Item::SaveToDB(){    uint32 guid = GetGUIDLow();    switch (uState)    {        case ITEM_NEW:        {            static SqlStatementID delItem ;            static SqlStatementID insItem ;            SqlStatement stmt = CharacterDatabase.CreateStatement(delItem, "DELETE FROM item_instance WHERE guid = ?");            stmt.PExecute(guid);            std::ostringstream ss;            for (uint16 i = 0; i < m_valuesCount; ++i)                ss << GetUInt32Value(i) << " ";            stmt = CharacterDatabase.CreateStatement(insItem, "INSERT INTO item_instance (guid,owner_guid,data) VALUES (?, ?, ?)");            stmt.PExecute(guid, GetOwnerGuid().GetCounter(), ss.str().c_str());        } break;        case ITEM_CHANGED:        {            static SqlStatementID updInstance ;            static SqlStatementID updGifts ;            SqlStatement stmt = CharacterDatabase.CreateStatement(updInstance, "UPDATE item_instance SET data = ?, owner_guid = ? WHERE guid = ?");            std::ostringstream ss;            for (uint16 i = 0; i < m_valuesCount; ++i)                ss << GetUInt32Value(i) << " ";            stmt.PExecute(ss.str().c_str(), GetOwnerGuid().GetCounter(), guid);            if (HasFlag(ITEM_FIELD_FLAGS, ITEM_DYNFLAG_WRAPPED))            {                stmt = CharacterDatabase.CreateStatement(updGifts, "UPDATE character_gifts SET guid = ? WHERE item_guid = ?");                stmt.PExecute(GetOwnerGuid().GetCounter(), GetGUIDLow());            }        } break;        case ITEM_REMOVED:        {            static SqlStatementID delItemText;            static SqlStatementID delInst ;            static SqlStatementID delGifts ;            static SqlStatementID delLoot ;            if (uint32 item_text_id = GetUInt32Value(ITEM_FIELD_ITEM_TEXT_ID))            {                SqlStatement stmt = CharacterDatabase.CreateStatement(delItemText, "DELETE FROM item_text WHERE id = ?");                stmt.PExecute(item_text_id);            }            SqlStatement stmt = CharacterDatabase.CreateStatement(delInst, "DELETE FROM item_instance WHERE guid = ?");            stmt.PExecute(guid);            if (HasFlag(ITEM_FIELD_FLAGS, ITEM_DYNFLAG_WRAPPED))            {                stmt = CharacterDatabase.CreateStatement(delGifts, "DELETE FROM character_gifts WHERE item_guid = ?");                stmt.PExecute(GetGUIDLow());            }            if (HasSavedLoot())            {                stmt = CharacterDatabase.CreateStatement(delLoot, "DELETE FROM item_loot WHERE guid = ?");                stmt.PExecute(GetGUIDLow());            }            delete this;            return;        }        case ITEM_UNCHANGED:            return;    }    if (m_lootState == ITEM_LOOT_CHANGED || m_lootState == ITEM_LOOT_REMOVED)    {        static SqlStatementID delLoot ;        SqlStatement stmt = CharacterDatabase.CreateStatement(delLoot, "DELETE FROM item_loot WHERE guid = ?");        stmt.PExecute(GetGUIDLow());    }    if (m_lootState == ITEM_LOOT_NEW || m_lootState == ITEM_LOOT_CHANGED)    {        if (Player* owner = GetOwner())        {            static SqlStatementID saveGold ;            static SqlStatementID saveLoot ;            // save money as 0 itemid data            if (loot.gold)            {                SqlStatement stmt = CharacterDatabase.CreateStatement(saveGold, "INSERT INTO item_loot (guid,owner_guid,itemid,amount,property) VALUES (?, ?, 0, ?, 0)");                stmt.PExecute(GetGUIDLow(), owner->GetGUIDLow(), loot.gold);            }            SqlStatement stmt = CharacterDatabase.CreateStatement(saveLoot, "INSERT INTO item_loot (guid,owner_guid,itemid,amount,property) VALUES (?, ?, ?, ?, ?)");            // save items and quest items (at load its all will added as normal, but this not important for item loot case)            for (size_t i = 0; i < loot.GetMaxSlotInLootFor(owner); ++i)//.........这里部分代码省略.........
开发者ID:PanteraPolnocy,项目名称:MaNGOS-Zero,代码行数:101,


示例18: GetGUIDLow

bool Creature::isCanTrainingOf(Player* pPlayer, bool msg) const{    if(!isTrainer())        return false;    if(m_tspells.empty())    {        sLog.outErrorDb("Creature %u (Entry: %u) have UNIT_NPC_FLAG_TRAINER but have empty trainer spell list.",            GetGUIDLow(),GetCreatureInfo()->Entry);        return false;    }    switch(GetCreatureInfo()->trainer_type)    {        case TRAINER_TYPE_CLASS:            if(pPlayer->getClass()!=GetCreatureInfo()->classNum)            {                if(msg)                {                    pPlayer->PlayerTalkClass->ClearMenus();                    switch(GetCreatureInfo()->classNum)                    {                        case CLASS_DRUID:  pPlayer->PlayerTalkClass->SendGossipMenu( 4913,GetGUID()); break;                        case CLASS_HUNTER: pPlayer->PlayerTalkClass->SendGossipMenu(10090,GetGUID()); break;                        case CLASS_MAGE:   pPlayer->PlayerTalkClass->SendGossipMenu(  328,GetGUID()); break;                        case CLASS_PALADIN:pPlayer->PlayerTalkClass->SendGossipMenu( 1635,GetGUID()); break;                        case CLASS_PRIEST: pPlayer->PlayerTalkClass->SendGossipMenu( 4436,GetGUID()); break;                        case CLASS_ROGUE:  pPlayer->PlayerTalkClass->SendGossipMenu( 4797,GetGUID()); break;                        case CLASS_SHAMAN: pPlayer->PlayerTalkClass->SendGossipMenu( 5003,GetGUID()); break;                        case CLASS_WARLOCK:pPlayer->PlayerTalkClass->SendGossipMenu( 5836,GetGUID()); break;                        case CLASS_WARRIOR:pPlayer->PlayerTalkClass->SendGossipMenu( 4985,GetGUID()); break;                    }                }                return false;            }            break;        case TRAINER_TYPE_PETS:            if(pPlayer->getClass()!=CLASS_HUNTER)            {                pPlayer->PlayerTalkClass->ClearMenus();                pPlayer->PlayerTalkClass->SendGossipMenu(3620,GetGUID());                return false;            }            break;        case TRAINER_TYPE_MOUNTS:            if(GetCreatureInfo()->race && pPlayer->getRace() != GetCreatureInfo()->race)            {                if(msg)                {                    pPlayer->PlayerTalkClass->ClearMenus();                    switch(GetCreatureInfo()->classNum)                    {                        case RACE_DWARF:        pPlayer->PlayerTalkClass->SendGossipMenu(5865,GetGUID()); break;                        case RACE_GNOME:        pPlayer->PlayerTalkClass->SendGossipMenu(4881,GetGUID()); break;                        case RACE_HUMAN:        pPlayer->PlayerTalkClass->SendGossipMenu(5861,GetGUID()); break;                        case RACE_NIGHTELF:     pPlayer->PlayerTalkClass->SendGossipMenu(5862,GetGUID()); break;                        case RACE_ORC:          pPlayer->PlayerTalkClass->SendGossipMenu(5863,GetGUID()); break;                        case RACE_TAUREN:       pPlayer->PlayerTalkClass->SendGossipMenu(5864,GetGUID()); break;                        case RACE_TROLL:        pPlayer->PlayerTalkClass->SendGossipMenu(5816,GetGUID()); break;                        case RACE_UNDEAD_PLAYER:pPlayer->PlayerTalkClass->SendGossipMenu( 624,GetGUID()); break;                    }                }                return false;            }            break;        case TRAINER_TYPE_TRADESKILLS:            if(GetCreatureInfo()->trainer_spell && !pPlayer->HasSpell(GetCreatureInfo()->trainer_spell))            {                if(msg)                {                    pPlayer->PlayerTalkClass->ClearMenus();                    pPlayer->PlayerTalkClass->SendGossipMenu(11031,GetGUID());                }                return false;            }            break;        default:            sLog.outErrorDb("Creature %u (entry: %u) have trainer type %u",GetGUIDLow(),GetCreatureInfo()->Entry,GetCreatureInfo()->trainer_type);            return false;    }    return true;}
开发者ID:chrayn,项目名称:mangos-06,代码行数:82,


示例19: SetLootState

void Item::LoadLootFromDB(Field* fields){    uint32 item_id     = fields[1].GetUInt32();    uint32 item_amount = fields[2].GetUInt32();    int32  item_propid = fields[3].GetInt32();    // money value special case    if (item_id == 0)    {        loot.gold = item_amount;        SetLootState(ITEM_LOOT_UNCHANGED);        return;    }    // normal item case    ItemPrototype const* proto = ObjectMgr::GetItemPrototype(item_id);    if (!proto)    {        CharacterDatabase.PExecute("DELETE FROM item_loot WHERE guid = '%u' AND itemid = '%u'", GetGUIDLow(), item_id);        sLog.outError("Item::LoadLootFromDB: %s has an unknown item (id: #%u) in item_loot, deleted.", GetOwnerGuid().GetString().c_str(), item_id);        return;    }    loot.items.push_back(LootItem(item_id, item_amount, item_propid));    ++loot.unlootedCount;    SetLootState(ITEM_LOOT_UNCHANGED);}
开发者ID:PanteraPolnocy,项目名称:MaNGOS-Zero,代码行数:29,


示例20: LoadGossipOptions

void Creature::prepareGossipMenu( Player *pPlayer,uint32 gossipid ){    PlayerMenu* pm=pPlayer->PlayerTalkClass;    pm->ClearMenus();    if(!m_goptions.size())        LoadGossipOptions();    GossipOption* gso;    GossipOption* ingso;    for( GossipOptionList::iterator i = m_goptions.begin( ); i != m_goptions.end( ); i++ )    {        gso=&*i;        if(gso->GossipId == gossipid)        {            bool cantalking=true;            if(gso->Id==1)            {                uint32 textid=GetNpcTextId();                GossipText * gossiptext=objmgr.GetGossipText(textid);                if(!gossiptext)                    cantalking=false;            }            else            {                switch (gso->Action)                {                    case GOSSIP_OPTION_QUESTGIVER:                        pPlayer->PrepareQuestMenu(GetGUID());                        //if (pm->GetQuestMenu()->MenuItemCount() == 0)                        cantalking=false;                        //pm->GetQuestMenu()->ClearMenu();                        break;                    case GOSSIP_OPTION_ARMORER:                        cantalking=false;                   // added in special mode                        break;                    case GOSSIP_OPTION_SPIRITHEALER:                        if( !pPlayer->isDead() )                            cantalking=false;                        break;                    case GOSSIP_OPTION_VENDOR:                        if(!GetItemCount())                        {                            sLog.outErrorDb("Creature %u (Entry: %u) have UNIT_NPC_FLAG_VENDOR but have empty trading item list.",                                GetGUIDLow(),GetCreatureInfo()->Entry);                            cantalking=false;                        }                        break;                    case GOSSIP_OPTION_TRAINER:                        if(!isCanTrainingOf(pPlayer,false))                            cantalking=false;                        break;                    case GOSSIP_OPTION_UNLEARNTALENTS:                        if(!isCanTrainingAndResetTalentsOf(pPlayer))                            cantalking=false;                        break;                    case GOSSIP_OPTION_TAXIVENDOR:                        if ( pPlayer->GetSession()->SendLearnNewTaxiNode(GetGUID()) )                            return;                    case GOSSIP_OPTION_GUARD:                    case GOSSIP_OPTION_INNKEEPER:                    case GOSSIP_OPTION_BANKER:                    case GOSSIP_OPTION_PETITIONER:                    case GOSSIP_OPTION_STABLEPET:                    case GOSSIP_OPTION_TABARDVENDOR:                    case GOSSIP_OPTION_BATTLEFIELD:                    case GOSSIP_OPTION_AUCTIONEER:                        break;                              // no checks                    default:                        sLog.outErrorDb("Creature %u (entry: %u) have unknown gossip option %u",GetGUIDLow(),GetCreatureInfo()->Entry,gso->Action);                        break;                }            }            if(gso->Option!="" && cantalking )            {                pm->GetGossipMenu()->AddMenuItem((uint8)gso->Icon,gso->Option.c_str(), gossipid,gso->Action,false);                ingso=gso;            }        }    }    if(pm->GetGossipMenu()->MenuItemCount()==0 && HasFlag(UNIT_NPC_FLAGS,UNIT_NPC_FLAG_TRAINER) && !pm->GetQuestMenu()->MenuItemCount())        isCanTrainingOf(pPlayer,true);    /*    if(pm->GetGossipMenu()->MenuItemCount()==1 && ingso->Id==8 && GetGossipCount( ingso->GossipId )>0)    {        pm->ClearMenus();        for( GossipOptionList::iterator i = m_goptions.begin( ); i != m_goptions.end( ); i++ )        {            gso=&*i;            if(gso->GossipId==ingso->Id)            {                if(gso->Option!="")                    pm->GetGossipMenu()->AddMenuItem((uint8)gso->Icon,gso->Option.c_str(),ingso->GossipId,gso->Action,false);            }        }    }//.........这里部分代码省略.........
开发者ID:chrayn,项目名称:mangos-06,代码行数:101,


示例21: DeleteFromInventoryDB

void Item::DeleteFromInventoryDB(SQLTransaction& trans){    DeleteFromInventoryDB(trans, GetGUIDLow());}
开发者ID:samiisb,项目名称:Heroic,代码行数:4,


示例22: GetCreatureInfo

void Creature::CreateTrainerSpells(){    for(SpellsList::iterator i = m_tspells.begin(); i != m_tspells.end(); ++i)        delete *i;    m_tspells.clear();    TrainerSpell *tspell;    Field *fields;    QueryResult *result = sDatabase.PQuery("SELECT `spell`,`spellcost`,`reqskill`,`reqskillvalue`,`reqlevel` FROM `npc_trainer` WHERE `entry` = '%u'", GetCreatureInfo()->Entry);    if(!result) return;    do    {        fields = result->Fetch();        uint32 spellid = fields[0].GetUInt32();        SpellEntry const *spellinfo = sSpellStore.LookupEntry(spellid);        if(!spellinfo)        {            sLog.outErrorDb("Trainer (GUID: %u ID: %u ) have in list non existed spell %u",GetGUIDLow(),GetEntry(),spellid);            continue;        }        tspell = new TrainerSpell;        tspell->spell = spellinfo;        tspell->spellcost = fields[1].GetUInt32();        tspell->reqskill = fields[2].GetUInt32();        tspell->reqskillvalue = fields[3].GetUInt32();        tspell->reqlevel = fields[4].GetUInt32();        m_tspells.push_back(tspell);    } while( result->NextRow() );    delete result;}
开发者ID:chrayn,项目名称:mangos-06,代码行数:38,


示例23: SetUInt32Value

bool Creature::CreateFromProto(uint32 guidlow,uint32 Entry){    Object::_Create(guidlow, HIGHGUID_UNIT);    m_DBTableGuid = guidlow;    SetUInt32Value(OBJECT_FIELD_ENTRY,Entry);    CreatureInfo const *cinfo = objmgr.GetCreatureTemplate(Entry);    if(!cinfo)    {        sLog.outError("Error: creature entry %u does not exist.",Entry);        return false;    }    uint32 rank = isPet()? 0 : cinfo->rank;    float damagemod = _GetDamageMod(rank);;    uint32 display_id = cinfo->randomDisplayID();    SetUInt32Value(UNIT_FIELD_DISPLAYID,display_id );    SetUInt32Value(UNIT_FIELD_NATIVEDISPLAYID,display_id );    SetUInt32Value(UNIT_FIELD_BYTES_2,1);                   // let creature used equiped weapon in fight    SetName(GetCreatureInfo()->Name);    SelectLevel(cinfo);    SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE,cinfo->faction);    SetUInt32Value(UNIT_NPC_FLAGS,cinfo->npcflag);    SetFloatValue(UNIT_FIELD_MINDAMAGE,cinfo->mindmg * damagemod);    SetFloatValue(UNIT_FIELD_MAXDAMAGE,cinfo->maxdmg * damagemod);    SetFloatValue(UNIT_FIELD_MINRANGEDDAMAGE,cinfo->minrangedmg * damagemod);    SetFloatValue(UNIT_FIELD_MAXRANGEDDAMAGE,cinfo->maxrangedmg * damagemod);    SetAttackTime(BASE_ATTACK,  cinfo->baseattacktime);    SetAttackTime(RANGED_ATTACK,cinfo->rangeattacktime);    SetUInt32Value(UNIT_FIELD_FLAGS,cinfo->Flags);    SetUInt32Value(UNIT_DYNAMIC_FLAGS,cinfo->dynamicflags);    SetArmor(cinfo->armor);    SetResistance(SPELL_SCHOOL_HOLY,cinfo->resistance1);    SetResistance(SPELL_SCHOOL_FIRE,cinfo->resistance2);    SetResistance(SPELL_SCHOOL_NATURE,cinfo->resistance3);    SetResistance(SPELL_SCHOOL_FROST,cinfo->resistance4);    SetResistance(SPELL_SCHOOL_SHADOW,cinfo->resistance5);    SetResistance(SPELL_SCHOOL_ARCANE,cinfo->resistance6);    //this is probably wrong    SetUInt32Value( UNIT_VIRTUAL_ITEM_SLOT_DISPLAY, cinfo->equipmodel[0]);    SetUInt32Value( UNIT_VIRTUAL_ITEM_INFO , cinfo->equipinfo[0]);    SetUInt32Value( UNIT_VIRTUAL_ITEM_INFO  + 1, cinfo->equipslot[0]);    SetUInt32Value( UNIT_VIRTUAL_ITEM_SLOT_DISPLAY+1, cinfo->equipmodel[1]);    SetUInt32Value( UNIT_VIRTUAL_ITEM_INFO + 2, cinfo->equipinfo[1]);    SetUInt32Value( UNIT_VIRTUAL_ITEM_INFO + 2 + 1, cinfo->equipslot[1]);    SetUInt32Value( UNIT_VIRTUAL_ITEM_SLOT_DISPLAY+2, cinfo->equipmodel[2]);    SetUInt32Value( UNIT_VIRTUAL_ITEM_INFO + 4, cinfo->equipinfo[2]);    SetUInt32Value( UNIT_VIRTUAL_ITEM_INFO + 4 + 1, cinfo->equipslot[2]);    SetFloatValue(OBJECT_FIELD_SCALE_X, cinfo->size);    SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS,cinfo->bounding_radius);    SetFloatValue(UNIT_FIELD_COMBATREACH,cinfo->combat_reach );    FactionTemplateEntry const* factionTemplate = sFactionTemplateStore.LookupEntry(cinfo->faction);    if (factionTemplate)    {        FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionTemplate->faction);        if (factionEntry)            if (cinfo->civilian != 1 && (factionEntry->team == ALLIANCE || factionEntry->team == HORDE))                SetPvP(true);    } else    sLog.outErrorDb("Error: invalid faction (%u) for creature (GUIDLow: %u Entry: %u)", cinfo->faction, GetGUIDLow(),Entry);    if (cinfo->mount != 0)        Mount(cinfo->mount);    m_spells[0] = cinfo->spell1;    m_spells[1] = cinfo->spell2;    m_spells[2] = cinfo->spell3;    m_spells[3] = cinfo->spell4;    SetSpeed(MOVE_WALK,     cinfo->speed );    SetSpeed(MOVE_RUN,      cinfo->speed );    SetSpeed(MOVE_WALKBACK, cinfo->speed );    SetSpeed(MOVE_SWIM,     cinfo->speed);    SetSpeed(MOVE_SWIMBACK, cinfo->speed);    if(cinfo->MovementType < MAX_DB_MOTION_TYPE)        m_defaultMovementType = MovementGeneratorType(cinfo->MovementType);    else    {        m_defaultMovementType = IDLE_MOTION_TYPE;        sLog.outErrorDb("Creature template %u have wrong movement generator type value %u, ignore and set to IDLE.",Entry,cinfo->MovementType);    }//.........这里部分代码省略.........
开发者ID:chrayn,项目名称:mangos-06,代码行数:101,


示例24: DeleteFromDB

void Item::DeleteFromDB(){    CharacterDatabase.PExecute("DELETE FROM item_instance WHERE guid = '%u'",GetGUIDLow());}
开发者ID:mcore,项目名称:mangos,代码行数:4,


示例25: SetFlag

void Item::SetSoulboundTradeable(AllowedLooterSet* allowedLooters, Player* currentOwner, bool apply){    if (apply)    {        SetFlag(ITEM_FIELD_FLAGS, ITEM_DYNFLAG_BOP_TRADEABLE);        allowedGUIDs = *allowedLooters;    }    else    {        RemoveFlag(ITEM_FIELD_FLAGS, ITEM_DYNFLAG_BOP_TRADEABLE);        if (allowedGUIDs.empty())            return;        allowedGUIDs.clear();        SetState(ITEM_CHANGED, currentOwner);        CharacterDatabase.PExecute( "DELETE FROM item_soulbound_trade_data WHERE itemGuid = '%u'", GetGUIDLow() );    }}
开发者ID:TestWoW,项目名称:Pruebas,代码行数:19,



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


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