Code:
uishop.py
search :
def SetShopInfo(self, sign, channel, index, x, y, timeLeft, update):
change all :
def SetShopInfo(self, sign, channel, index, x, y, timeLeft, update):
expired = self.expireTime <= time.clock()
self.expireTime = time.clock() + timeLeft
(mapName, xBase, yBase) = background.GlobalPositionToMapInfo(x, y)
localeMapName = localeInfo.MINIMAP_ZONE_NAME_DICT.get(mapName, "")
self.posInfoText.SetText("CH %d, %s (%d, %d)" % (channel, localeMapName, int(x - xBase) / 100, int(y - yBase) / 100))
m, s = divmod(self.expireTime - time.clock(), 60)
h, m = divmod(m, 60)
d, h = divmod(h, 24)
self.timeLeftText.SetText(uiScriptLocale.OFFLINE_SHOP_TIME_LEFT % ((d, h, m) if not expired else (0, 0, 0)))
if expired:
self.lockButton.SetText(uiScriptLocale.OFFLINE_SHOP_BUTTON_RENEW)
self.signInputBoard.SetDescription(uiScriptLocale.OFFLINE_SHOP_INPUT_SIGN_DESC % sign)
self.signText.SetText(sign if len(sign) < 18 else sign[:17] + "...")
add anywhere:
def OnUpdate(self):
USE_SHOP_LIMIT_RANGE = 1000
(x, y, z) = player.GetMainCharacterPosition()
if abs(x - self.xShopStart) > USE_SHOP_LIMIT_RANGE or abs(y - self.yShopStart) > USE_SHOP_LIMIT_RANGE:
self.Close()
self.offlineShopWnd.UpdateTime()
Char.cpp
search :
void CHARACTER::CreateMyOfflineShop(const char *c_pszSign, TShopItemTable *pTable, BYTE bItemCount)
{
add below :
int iOpenPrice = OFFLINE_SHOP_OPEN_PRICE;
if (GetGold() < iOpenPrice)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You don't have enough gold to open an offline shop! (%d)"), iOpenPrice);
return;
}
PointChange(POINT_GOLD, -iOpenPrice);
service.h
add
#define OFFLINE_SHOP_OPEN_PRICE 1000000 //OFFLINE MARKET OPENING PRICE