当前位置: 首页>>代码示例>>C++>>正文


C++ Item::AddToWorld方法代码示例

本文整理汇总了C++中Item::AddToWorld方法的典型用法代码示例。如果您正苦于以下问题:C++ Item::AddToWorld方法的具体用法?C++ Item::AddToWorld怎么用?C++ Item::AddToWorld使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Item的用法示例。


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

示例1: item

bool Guild::BankTab::LoadItemFromDB(Field* fields)
{
    uint8 slotId = fields[13].GetUInt8();
    uint32 itemGuid = fields[14].GetUInt32();
    uint32 itemEntry = fields[15].GetUInt32();
    if (slotId >= GUILD_BANK_MAX_SLOTS)
    {
        TC_LOG_ERROR(LOG_FILTER_GUILD, "Invalid slot for item (GUID: %u, id: %u) in guild bank, skipped.", itemGuid, itemEntry);
        return false;
    }

    ItemTemplate const* proto = sObjectMgr->GetItemTemplate(itemEntry);
    if (!proto)
    {
        TC_LOG_ERROR(LOG_FILTER_GUILD, "Unknown item (GUID: %u, id: %u) in guild bank, skipped.", itemGuid, itemEntry);
        return false;
    }

    Item* pItem = NewItemOrBag(proto);
    if (!pItem->LoadFromDB(itemGuid, 0, fields, itemEntry))
    {
        TC_LOG_ERROR(LOG_FILTER_GUILD, "Item (GUID %u, id: %u) not found in item_instance, deleting from guild bank!", itemGuid, itemEntry);

        PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_NONEXISTENT_GUILD_BANK_ITEM);
        stmt->setUInt32(0, m_guildId);
        stmt->setUInt8 (1, m_tabId);
        stmt->setUInt8 (2, slotId);
        CharacterDatabase.Execute(stmt);

        delete pItem;
        return false;
    }

    pItem->AddToWorld();
    m_items[slotId] = pItem;
    return true;
}
开发者ID:,项目名称:,代码行数:37,代码来源:

示例2: OnGossipSelect


//.........这里部分代码省略.........
                    {
                        case CLASS_DEATH_KNIGHT:
                            if (player->getLevel() >= 55)
                            {
                                player->learnSpell(48778, false);
                                player->learnSpell(53428, false);
                                player->learnSpell(50977, false);
                                player->learnSpell(48743, false);
                            }
                            if (player->getLevel() >= 61)
                            {
                                player->learnSpell(3714, false);
                            }
                            if (player->getLevel() >= 65)
                            {
                                player->learnSpell(57330, false);
                            }
                            if (player->getLevel() >= 67)
                            {
                                player->learnSpell(56815, false);
                            }
                            break;

                        case CLASS_WARLOCK:
                            if (player->getLevel() >= 20)
                            {
                                player->learnSpell(5784, false);
                            }
                            if (player->getLevel() >= 40)
                            {
                                player->learnSpell(23161, false);
                            }
                            break;

                        case CLASS_PALADIN:
                            if (player->getFaction() == ALLIANCE)
                            {
                                if (player->getLevel() >= 20)
                                {
                                    player->learnSpell(13819, false);
                                }
                                if (player->getLevel() >= 40)
                                {
                                    player->learnSpell(23214, false);
                                }
                            }
                            if (player->getFaction() == HORDE)
                            {
                                if (player->getLevel() >= 20)
                                {
                                    player->learnSpell(34769, false);
                                }
                                if (player->getLevel() >= 40)
                                {
                                    player->learnSpell(34767, false);
                                }
                            }
                            break;

                        case CLASS_DRUID:
                            if(player->getLevel() >= 60)
                            {
                                player->learnSpell(33943, false);
                            }
                            if(player->getLevel() >= 71)
                            {
                                player->learnSpell(40120, false);
                            }
                            break;

                        default:
                            break;
                    }
                    player->GetSession()->SendTrainerList(pCreature->GetGUID());
                    break;

                case GOSSIP_ACTION_INFO_DEF+1:
                    player->SendTalentWipeConfirm(pCreature->GetGUID());
                    player->CLOSE_GOSSIP_MENU();
                    break;

                case GOSSIP_ACTION_INFO_DEF+2:
                    player->GetSession()->SendListInventory(pCreature->GetGUID());
                    break;

                case GOSSIP_ACTION_INFO_DEF+15:
                    player->TeleportTo(0, -7634.04f, -4565.26f, 131.41f, 3.21f);
                    player->CLOSE_GOSSIP_MENU();
                    break;

                case GOSSIP_ACTION_INFO_DEF+16:
                    Item * item;
                    item->AddToWorld();
                    break;

                default:
                    break;
            }
            return true;
        }
开发者ID:,项目名称:,代码行数:101,代码来源:


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