bool CHARACTER::WarpSet(long x, long y, long lPrivateMapIndex, long lCustomAddr, WORD wCustomPort) { if (!IsPC()) return false; long lAddr; long lMapIndex; WORD wPort; if (!CMapLocation::instance().Get(x, y, lMapIndex, lAddr, wPort)) { sys_err("cannot find map location index %d x %d y %d name %s", lMapIndex, x, y, GetName()); return false; } //Send Supplementary Data Block if new map requires security packages in loading this map { long lCurAddr; long lCurMapIndex = 0; WORD wCurPort; CMapLocation::instance().Get(GetX(), GetY(), lCurMapIndex, lCurAddr, wCurPort); //do not send SDB files if char is in the same map if( lCurMapIndex != lMapIndex ) { const TMapRegion * rMapRgn = SECTREE_MANAGER::instance().GetMapRegion(lMapIndex); { DESC_MANAGER::instance().SendClientPackageSDBToLoadMap( GetDesc(), rMapRgn->strMapName.c_str() ); } } } if (lPrivateMapIndex >= 10000) { if (lPrivateMapIndex / 10000 != lMapIndex) { sys_err("Invalid map inedx %d, must be child of %d", lPrivateMapIndex, lMapIndex); return false; } lMapIndex = lPrivateMapIndex; } #ifdef __SORT_INVENTORY_SYSTEM__ if (GetSortInventoryPulse() > thecore_pulse()) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You cannot warp after sorting your inventory.")); return false; } if (GetSortSpecialInventoryPulse() > thecore_pulse()) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You cannot warp after sorting your inventory.")); return false; } #endif Stop(); Save(); if (GetSectree()) { GetSectree()->RemoveEntity(this); ViewCleanup(); EncodeRemovePacket(this); } m_lWarpMapIndex = lMapIndex; m_posWarp.x = x; m_posWarp.y = y; sys_log(0, "WarpSet %s %d %d current map %d target map %d", GetName(), x, y, GetMapIndex(), lMapIndex); TPacketGCWarp p; p.bHeader = HEADER_GC_WARP; p.lX = x; p.lY = y; p.lAddr = lCustomAddr ? lCustomAddr : lAddr; p.wPort = wCustomPort ? wCustomPort : wPort; #ifdef ENABLE_PROXY_IP if (!g_stProxyIP.empty()) p.lAddr = inet_addr(g_stProxyIP.c_str()); #endif GetDesc()->Packet(&p, sizeof(TPacketGCWarp)); char buf[256]; snprintf(buf, sizeof(buf), "%s MapIdx %ld DestMapIdx%ld DestX%ld DestY%ld Empire%d", GetName(), GetMapIndex(), lPrivateMapIndex, x, y, GetEmpire()); LogManager::instance().CharLog(this, 0, "WARP", buf); return true; }