• Страница 1 из 1
  • 1
Модератор форума: Dimitro  
Форум » TrinityCore » [TrinityCore] Help » Транс (WoW 2.4.3)
Транс
vanz7796
Капрал
Такая проблема
Когда трансмутю шмотки всё происходит отлично, но когда игрок другой начинает осматривать показывается шмотка на которую я трансмутил, но не та, которая на мне одета.
Подскажите пожалуйста, как это решить(
Вот шмотка, которая на мне одета


Вот шмотка, которую видет другой игрок


Вот код транса

Код
/*##
##TRANSMOGRIFICATION
##*/
std::string GetItemName(Item* item, WorldSession* session)
   
// local name
{
        std::string name = item->GetProto()->Name1;
        int loc_idx = session->GetSessionDbLocaleIndex();
        if (loc_idx >= 0)
            if (ItemLocale const* il = objmgr.GetItemLocale(item->GetEntry()))
            if(il)
            {
                if(il->Name.size() > size_t(loc_idx) && !il->Name[loc_idx].empty())
                    name = il->Name[loc_idx];
            }
            
               
        return name;
}

std::map<uint64, std::map<uint32, Item*> > _items; // _items[lowGUID] [DISPLAY]= item

const char * GetSlotName(uint8 slot, WorldSession* session)
{
    switch(slot)
    {
        case EQUIPMENT_SLOT_HEAD      : return session->GetOregonString(LANG_SLOT_NAME_HEAD);
        case EQUIPMENT_SLOT_SHOULDERS : return session->GetOregonString(LANG_SLOT_NAME_SHOULDERS);
        case EQUIPMENT_SLOT_BODY      : return session->GetOregonString(LANG_SLOT_NAME_BODY);
        case EQUIPMENT_SLOT_CHEST     : return session->GetOregonString(LANG_SLOT_NAME_CHEST);
        case EQUIPMENT_SLOT_WAIST     : return session->GetOregonString(LANG_SLOT_NAME_WAIST);
        case EQUIPMENT_SLOT_LEGS      : return session->GetOregonString(LANG_SLOT_NAME_LEGS);
        case EQUIPMENT_SLOT_FEET      : return session->GetOregonString(LANG_SLOT_NAME_FEET);
        case EQUIPMENT_SLOT_WRISTS    : return session->GetOregonString(LANG_SLOT_NAME_WRISTS);
        case EQUIPMENT_SLOT_HANDS     : return session->GetOregonString(LANG_SLOT_NAME_HANDS);
        case EQUIPMENT_SLOT_BACK      : return session->GetOregonString(LANG_SLOT_NAME_BACK);
        case EQUIPMENT_SLOT_MAINHAND  : return session->GetOregonString(LANG_SLOT_NAME_MAINHAND);
        case EQUIPMENT_SLOT_OFFHAND   : return session->GetOregonString(LANG_SLOT_NAME_OFFHAND);
        case EQUIPMENT_SLOT_RANGED    : return session->GetOregonString(LANG_SLOT_NAME_RANGED);
        case EQUIPMENT_SLOT_TABARD    : return session->GetOregonString(LANG_SLOT_NAME_TABARD);
        default: return NULL;
    }
}

bool GossipHello_transmog(Player* player, Creature* creature)
    {
        WorldSession* session = player->GetSession();
        for (uint8 slot = EQUIPMENT_SLOT_START; slot < EQUIPMENT_SLOT_TABARD; slot++) // EQUIPMENT_SLOT_END
        {
            if (Item* newItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, slot))
            {
                if (newItem->HasGoodFakeQuality())
                {
                    if (const char* slotName = GetSlotName(slot, session))
                        player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, slotName, EQUIPMENT_SLOT_END, slot);
                }
            }
        }
        player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_INTERACT_1, session->GetOregonString(LANG_OPTION_REMOVE_ALL), EQUIPMENT_SLOT_END+2, 0, session->GetOregonString(LANG_POPUP_REMOVE_ALL), 0, false);
        player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TALK, session->GetOregonString(LANG_OPTION_UPDATE_MENU), EQUIPMENT_SLOT_END+1, 0);
        player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID());
        return true;
    }

bool GossipSelect_transmog(Player* player, Creature* creature, uint32 sender, uint32 uiAction)
{
    WorldSession* session = player->GetSession();
    player->PlayerTalkClass->ClearMenus();
        switch(sender)
        {
        case EQUIPMENT_SLOT_END: // Show items you can use
        {
            if (Item* oldItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, uiAction))
            {
                uint32 lowGUID = player->GetGUIDLow();
                _items[lowGUID].clear();
                uint32 limit = 0;
                for (uint8 i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; i++)
                {
                        if (limit > 30)
                            break;
                        if (Item* newItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, i))
                        {
                            uint32 display = newItem->GetProto()->DisplayInfoID;
                            if (player->SuitableForTransmogrification(oldItem, newItem) == ERR_FAKE_OK)
                            {
                    if (_items[lowGUID].find(display) == _items[lowGUID].end())
                    {
                    limit++;
                    _items[lowGUID] [display]= newItem;
                    player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_INTERACT_1, newItem->GetProto()->Name1, uiAction, display, session->GetOregonString(LANG_POPUP_TRANSMOGRIFY)+GetItemName(newItem, session), 0, false);
                        }
                            }
                        }
                    }

                    for (uint8 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++)
                    {
                        if (Bag* bag = player->GetBagByPos(i))
                        {
                            for (uint32 j = 0; j < bag->GetBagSize(); j++)
                            {
                    if (limit > 30)
                    break;
                    if (Item* newItem = player->GetItemByPos(i, j))
                    {
                    uint32 display = newItem->GetProto()->DisplayInfoID;
                    if (player->SuitableForTransmogrification(oldItem, newItem) == ERR_FAKE_OK)
                    {
                    if (_items[lowGUID].find(display) == _items[lowGUID].end())
                    {
                    limit++;
                    _items[lowGUID] [display]= newItem;
                    player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_INTERACT_1, newItem->GetProto()->Name1, uiAction, display, session->GetOregonString(LANG_POPUP_TRANSMOGRIFY)+GetItemName(newItem, session), GOLD_COST_FUNCTION, false);}
                    }
                    }
                            }
                        }
                    }

                    char popup[250];
                    snprintf(popup, 250, session->GetOregonString(LANG_POPUP_REMOVE_ONE), GetSlotName(uiAction, session));
                    player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_INTERACT_1, session->GetOregonString(LANG_OPTION_REMOVE_ONE), EQUIPMENT_SLOT_END+3, uiAction, popup, 0, false);
                    player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TALK, session->GetOregonString(LANG_OPTION_BACK), EQUIPMENT_SLOT_END+1, 0);
                    player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID());
                }
                else
                    GossipHello_transmog(player, creature);
            } break;
        case EQUIPMENT_SLOT_END+1: // Back
            {
                GossipHello_transmog(player, creature);
            } break;
        case EQUIPMENT_SLOT_END+2: // Remove Transmogrifications
            {
                bool removed = false;
                for (uint8 Slot = EQUIPMENT_SLOT_START; Slot < EQUIPMENT_SLOT_END; Slot++)
                {
                    if (Item* newItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, Slot))
                    {
                        if (newItem->DeleteFakeEntry() && !removed)
                            removed = true;
                    }
                }
                if (removed)
                {
                    session->SendAreaTriggerMessage(session->GetOregonString(LANG_REM_TRANSMOGRIFICATIONS_ITEMS));
                    player->PlayDirectSound(3337);
                }
                else
                    session->SendNotification(session->GetOregonString(LANG_ERR_NO_TRANSMOGRIFICATIONS));
                GossipHello_transmog(player, creature);
            } break;
        case EQUIPMENT_SLOT_END+3: // Remove Transmogrification from single item
            {
                if (Item* newItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, uiAction))
                {
                    if (newItem->DeleteFakeEntry())
                    {
                        session->SendAreaTriggerMessage(session->GetOregonString(LANG_REM_TRANSMOGRIFICATION_ITEM), GetSlotName(uiAction, session));
                        player->PlayDirectSound(3337);
                    }
                    else
                        session->SendNotification(session->GetOregonString(LANG_ERR_NO_TRANSMOGRIFICATION), GetSlotName(uiAction, session));
                }
                GossipSelect_transmog(player, creature, EQUIPMENT_SLOT_END, uiAction);
            } break;
        default: // Transmogrify
            {
                uint32 lowGUID = player->GetGUIDLow();
                if (Item* oldItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, sender))
                {
                    if (_items[lowGUID].find(uiAction) != _items[lowGUID].end() && _items[lowGUID][uiAction]->IsInWorld())
                    {
                        Item* newItem = _items[lowGUID][uiAction];
                        if (newItem->GetOwnerGUID() == player->GetGUIDLow() && (newItem->IsInBag() || newItem->GetBagSlot() == INVENTORY_SLOT_BAG_0) && player->SuitableForTransmogrification(oldItem, newItem) == ERR_FAKE_OK)
                        {
#if (GOLD_COST)
                            player->ModifyMoney(-1*GetFakePrice(oldItem)); // take cost
#endif
                            oldItem->SetFakeEntry(newItem->GetEntry());
                            newItem->SetBinding(true);
                            player->PlayDirectSound(3337);
                            session->SendAreaTriggerMessage(session->GetOregonString(LANG_ITEM_TRANSMOGRIFIED), GetSlotName(sender, session));
                        }
                        else
                            session->SendNotification(session->GetOregonString(LANG_ERR_NO_ITEM_SUITABLE));
                    }
                    else
                        session->SendNotification(session->GetOregonString(LANG_ERR_NO_ITEM_EXISTS));
                }
                else
                    session->SendNotification(session->GetOregonString(LANG_ERR_EQUIP_SLOT_EMPTY));
                _items[lowGUID].clear();
                GossipSelect_transmog(player, creature, EQUIPMENT_SLOT_END, sender);
            } break;
        }
        return true;
}

#if (GOLD_COST)
    uint32 GetFakePrice(Item* item)
    {
        uint32 sellPrice = item->GetProto()->SellPrice;
        uint32 minPrice = item->GetProto()->RequiredLevel * 1176;
        if (sellPrice < minPrice)
            sellPrice = minPrice;
        return sellPrice;
    }
#endif
Сервер WoW 2.4.3 ZetSmart(OregonCore) - отличная работоспособность и множество интересных патчей.
http://wowjp.net/forum/123-299941-1
Продажа исходников OregonCore.
https://wowjp.net/forum/187-310795-1
Сообщение # 1 отредактировано vanz7796 - Воскресенье, 05.11.2017, 20:27
Shkrest
Центурион
Ну как бы хз че у тебя там трансмутер делает. Покажи код. Может кто подскажет. Учись правильно задавать вопрос =0
Сообщение # 2 написано 31.10.2017 в 19:37
vanz7796
Капрал
Цитата Shkrest ()
Покажи код
Код вставил
Сервер WoW 2.4.3 ZetSmart(OregonCore) - отличная работоспособность и множество интересных патчей.
http://wowjp.net/forum/123-299941-1
Продажа исходников OregonCore.
https://wowjp.net/forum/187-310795-1
Сообщение # 3 написано 05.11.2017 в 20:27
Форум » TrinityCore » [TrinityCore] Help » Транс (WoW 2.4.3)
  • Страница 1 из 1
  • 1
Поиск: