CHANNEL SWITCHER FIX

  • Autor subiect Petrinel
  • Dată creare
  • Răspunsuri: Răspunsuri 0
  • Vizualizări: Vizualizări 2K

Petrinel

Well-known member
29 Aug 2020
159
708
93
23
Falciu
Monede Dragon
0
Deschideti char.cpp si cautati:

Cod:
void CHARACTER::ChannelSwitch(int iNewChannel)

Si schimbati tot codul cu :

Cod:
void CHARACTER::ChannelSwitch(int iNewChannel){
    //* START DUPLICATION FIX
    //* prevent problems about duplication of items
    //* using safebox/exchange/shop/acce
    if(!CanWarp()){
      return;
    }
    //* END DUPLICATION FIX

    long lAddr;
    long lMapIndex;
    WORD wPort;
    long x = this->GetX();
    long y = this->GetY();

    if (!CMapLocation::instance().Get(x, y, lMapIndex, lAddr, wPort))
    {
      return;
    }

    if(lMapIndex >= 10000){
      return;
    }

    std::map<WORD, int>ch;

    for(int i = 0; i < 4; i++){
      for(int i2 = 1; i2 < 9; i2++){
        ch[30*1000 + i*100 + i2] = i+1;
      }
    }
    int chan;
    if(ch.find(wPort) != ch.end()){
      chan = ch[wPort];
    }else{return;}
    Stop();
    Save();

    if(GetSectree()){
      GetSectree()->RemoveEntity(this);
      ViewCleanup();

      EncodeRemovePacket(this);
    }

    TPacketGCWarp p;
    p.bHeader    = HEADER_GC_WARP;
    p.lX    = x;
    p.lY    = y;
    p.lAddr    = lAddr;
    p.wPort    = (wPort - 100*(chan-1) + 100*(iNewChannel-1));

    GetDesc()->Packet(&p, sizeof(TPacketGCWarp));
}

De fapt, problema este rezolvată aici, dar există o continuare a soluției pentru cei care folosesc magazinul offline.

Cautati:
Cod:
bool CARACTER :: CanWarp () const:

Si schimbati totul cu :

Cod:
bool CHARACTER::CanWarp() const
{
    const int iPulse = thecore_pulse();
    const int limit_time = PASSES_PER_SEC(g_nPortalLimitTime);

    if ((iPulse - GetSafeboxLoadTime()) < limit_time)
        return false;

    if ((iPulse - GetExchangeTime()) < limit_time)
        return false;

    if ((iPulse - GetMyShopTime()) < limit_time)
        return false;

    if ((iPulse - GetRefineTime()) < limit_time)
        return false;

    if (GetExchange() || GetMyShop() || GetShopOwner() || IsOpenSafebox() || IsCubeOpen())
        return false;

#ifdef __ENABLE_NEW_OFFLINESHOP__
    if (iPulse - GetOfflineShopUseTime() < limit_time)
        return false;

    if (GetOfflineShopGuest() || GetAuctionGuest())
        return false;
#endif

    return true;
}

Cautati:
Cod:
void            ResetStopTime();

Adaugati mai jos:

Cod:
#ifdef __ENABLE_NEW_OFFLINESHOP__
  public:
        int            GetOfflineShopUseTime() const {return m_iOfflineShopUseTime;}
        void            SetOfflineShopUseTime(){m_iOfflineShopUseTime = thecore_pulse();}

  private:
        int            m_iOfflineShopUseTime = 0;
#endif