Esempio n. 1
0
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;
}
Esempio n. 2
0
        bool OnGossipSelect(Player* player, Creature* pCreature, uint32 sender, uint32 uiAction)
        {
            player->PlayerTalkClass->ClearMenus();

            switch(uiAction)
            {
                case GOSSIP_ACTION_INFO_DEF:
                    switch (player->getClass())
                    {
                        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;
        }