Informations
Jump to content

Lorem Ipsum...

Click to Dismiss this Notification
Ładowanie danych...

Recommended Posts

  • Administrator

Unbugged offline shops in full version:

spacer.png

spacer.png

 

This is the hidden content, please

This is the hidden content, please

This is the hidden content, please

This is the hidden content, please

 

Fix 1 - ChatInfoTrans

In -->> newofflineshop.h

 

Find:

#define CASESEND(var) case var: ch->ChatInfoTrans((#var)); break;

Change to:

#ifdef __ENABLE_MULTILANGUAGE__
#define CASESEND(var) case var: ch->ChatPacket(CHAT_TYPE_INFO, #var); break;
#else
#define CASESEND(var) case var: ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT(#var)); break;
#endif

 

In -->> cmd_gm.cpp

 

Find:

#ifdef __ENABLE_NEW_OFFLINESHOP__
std::string GetNewShopName(const std::string& oldname, const std::string& newname)
{
    auto nameindex = oldname.find('@');
    if (nameindex == std::string::npos)
    {
        return newname;
    }
    else
    {
        auto playername = oldname.substr(0, nameindex);
        return playername + '@' + newname;
    }
}

ACMD(do_offshop_change_shop_name)
{
    char arg1[50]; char arg2[256];
    argument = one_argument(argument, arg1, sizeof(arg1));
    argument = one_argument(argument, arg2, sizeof(arg2));

    if (arg1[0] != 0 && isdigit(arg1[0]) && arg2[0] != 0)
    {
        DWORD id = 0;
        str_to_number(id, arg1);

        if (id == 0)
        {
            ch->ChatInfoTrans(("syntax: offshop_change_shop_name <player-id> <new-name>"));
            return;
        }
        else
        {
            offlineshop::CShop* pkShop = offlineshop::GetManager().GetShopByOwnerID(id);
            if (!pkShop)
            {
            ch->ChatInfoTrans(("Cannot find shop by id %u "), id);
                return;
            } else
            {
                std::string oldname = pkShop->GetName();
                offlineshop::GetManager().SendShopChangeNameDBPacket(id, GetNewShopName(oldname, arg2).c_str());
                ch->ChatInfoTrans(("shop's name changed."));
            }
        }

    }
    else
    {
        ch->ChatInfoTrans(("syntax: offshop_change_shop_name <player-id> <new-name>"));
        return;
    }
}

ACMD(do_offshop_force_close_shop)
{
    char arg1[50];
    argument = one_argument(argument, arg1, sizeof(arg1));
    if (arg1[0] != 0 && isdigit(arg1[0]))
    {

        DWORD id = 0;
        str_to_number(id, arg1);

        if (id == 0)
        {
            ch->ChatInfoTrans(("syntax: offshop_force_close_shop <player-id>"));
            return;
        }
        else
        {
            offlineshop::CShop* pkShop = offlineshop::GetManager().GetShopByOwnerID(id);
            if (!pkShop)
            {
                ch->ChatInfoTrans(("Cannot find shop by id %u"), id);
                return;
            }
            else
            {
                offlineshop::GetManager().SendShopForceCloseDBPacket(id);
                ch->ChatInfoTrans(("shop closed successfully."));
            }
        }

    }
    else
    {
        ch->ChatInfoTrans(("syntax: offshop_force_close_shop <player-id>"));
        return;
    }
}
#endif

 

Change to:

 

#ifdef __ENABLE_NEW_OFFLINESHOP__
std::string GetNewShopName(const std::string& oldname, const std::string& newname)
{
    auto nameindex = oldname.find('@');
    if (nameindex == std::string::npos)
    {
        return newname;
    }
    else
    {
        auto playername = oldname.substr(0, nameindex);
        return playername + '@' + newname;
    }
}

ACMD(do_offshop_change_shop_name)
{
    char arg1[50]; char arg2[256];
    argument = one_argument(argument, arg1, sizeof(arg1));
    argument = one_argument(argument, arg2, sizeof(arg2));

    if (arg1[0] != 0 && isdigit(arg1[0]) && arg2[0] != 0)
    {
        DWORD id = 0;
        str_to_number(id, arg1);

        if (id == 0)
        {
            ch->ChatPacket(CHAT_TYPE_INFO, "syntax : offshop_change_shop_name  <player-id>  <new-name> ");
            return;
        }
        else
        {
            offlineshop::CShop* pkShop = offlineshop::GetManager().GetShopByOwnerID(id);
            if (!pkShop)
            {
                ch->ChatPacket(CHAT_TYPE_INFO, "Cannot find shop by id %u ", id);
                return;
            } else
            {
                std::string oldname = pkShop->GetName();
                offlineshop::GetManager().SendShopChangeNameDBPacket(id, GetNewShopName(oldname, arg2).c_str());
                ch->ChatPacket(CHAT_TYPE_INFO, "shop's name changed.");
            }
        }

    }
    else
    {
        ch->ChatPacket(CHAT_TYPE_INFO , "syntax : offshop_change_shop_name  <player-id>  <new-name> ");
        return;
    }
}

ACMD(do_offshop_force_close_shop)
{
    char arg1[50];
    argument = one_argument(argument, arg1, sizeof(arg1));
    if (arg1[0] != 0 && isdigit(arg1[0]))
    {

        DWORD id = 0;
        str_to_number(id, arg1);

        if (id == 0)
        {
            ch->ChatPacket(CHAT_TYPE_INFO, "syntax : offshop_force_close_shop  <player-id>  ");
            return;
        }
        else
        {
            offlineshop::CShop* pkShop = offlineshop::GetManager().GetShopByOwnerID(id);
            if (!pkShop)
            {
                ch->ChatPacket(CHAT_TYPE_INFO, "Cannot find shop by id %u ", id);
                return;
            }
            else
            {
                offlineshop::GetManager().SendShopForceCloseDBPacket(id);
                ch->ChatPacket(CHAT_TYPE_INFO, "shop closed successfully.");
            }
        }

    }
    else
    {
        ch->ChatPacket(CHAT_TYPE_INFO, "syntax : offshop_force_close_shop  <player-id>  ");
        return;
    }
}
#endif

 

Fix 2 - CanTakeInventoryItem

In -->> char.cpp

Find:

void CHARACTER::SetShopSafebox(offlineshop::CShopSafebox* pk)

Add before:

bool CHARACTER::CanTakeInventoryItem(LPITEM item, TItemPos* cell)
{
    int iEmpty = -1;
    if (item->IsDragonSoul())
    {
        cell->window_type = DRAGON_SOUL_INVENTORY;
        cell->cell = iEmpty = GetEmptyDragonSoulInventory(item);
    }
#ifdef ENABLE_SPECIAL_INVENTORY
    else if (item->IsBook())
    {
        cell->window_type = BOOK_INVENTORY;
        cell->cell = iEmpty = GetEmptyBookInventory(item->GetSize());
    }
    else if (item->IsUpgradeItem())
    {
        cell->window_type = UPGRADE_INVENTORY;
        cell->cell = iEmpty = GetEmptyUpgradeInventory(item->GetSize());
    }
    else if (item->IsStone())
    {
        cell->window_type = STONE_INVENTORY;
        cell->cell = iEmpty = GetEmptyStoneInventory(item->GetSize());
    }
    else if (item->IsAttr())
    {
        cell->window_type = ATTR_INVENTORY;
        cell->cell = iEmpty = GetEmptyAttrInventory(item->GetSize());
    }
    else if (item->IsFlower())
    {
        cell->window_type = FLOWER_INVENTORY;
        cell->cell = iEmpty = GetEmptyFlowerInventory(item->GetSize());
    }
    else if (item->IsBlendS())
    {
        cell->window_type = BLEND_INVENTORY;
        cell->cell = iEmpty = GetEmptyBlendInventory(item->GetSize());
    }
#endif
    else
    {
        cell->window_type = INVENTORY;
        cell->cell = iEmpty = GetEmptyInventory(item->GetSize());
    }

    return iEmpty != -1;
}

 

In -->> char.cpp

Find:

bool                        IsLookingOfflineshopOfferList() { return m_bIsLookingOfflineshopOfferList; }

Add under:

bool                        CanTakeInventoryItem(LPITEM item, TItemPos* pos);

 

Fix 3 - OfflineShopLog

In -->> service.h / commondefines.h

Find:

#define ENABLE_NEW_OFFLINESHOP_LOGS

Exchange:

//#define ENABLE_NEW_OFFLINESHOP_LOGS

 

Fix 4 - YangMax

In -->> new_offlineshop_manager.cpp

Find:

yang_max

Exchange:

GOLD_MAX

 

Fix 5 - ChangeGold

In -->> new_offlineshop_manager.cpp

Find:

changegold

Exchange:

ch->PointChange(POINT_GOLD, -pPrice->illYang);

Find:

changegold

Exchange:

ch->PointChange(POINT_GOLD, -offer.price.illYang);

Find:

changegold

Exchange:

ch->PointChange(POINT_GOLD, valutes.illYang);

Find:

changegold

Exchange:

ch->PointChange(POINT_GOLD, -price.illYang);

 

  • Love It 1
Link to comment
Share on other sites


Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.

spacer.png

Disable AdBlock
The popup will be closed in 5 seconds...