What do you mean by "no quantity in the new store"? If it's just that your shop doesn't have a price for them, could you not just add them to the price list for the shop (if you've written your own shop code, this may be outside of the remit of the battle engine)? If you're using the price list classes in the engine, in fact, you should just be able to set the buyExclusive parameter to False when you create the price list, and they'll be able to buy any item regardless of whether it's on their price list?Mole-chan wrote: It works, but the resulting items have no quantity in the new store, and thus can't be sold.
I actually wrote this a while ago, but since there's been no release of the engine since then, it's not been released. Here's the code:DaFool wrote:I'm really wishing for a drag n drop version of the panning code. This would make the Android version more intuitive by making the whole map pannable by swiping.
Code: Select all
class BattleDragDisplayable(BattleDisplayable):
def __init__(self, threshold, *args, **properties):
super(BattleDragDisplayable, self).__init__(*args, **properties)
self._threshold = threshold
self._startPos = None
self._dragPos = None
self._dragging = False
self._last = None
def event(self, event, x, y, st):
if (self._last == None):
self._last = st
else:
if (st - self._last < 0.05) and (event.type != pygame.MOUSEBUTTONDOWN) and (event.type != pygame.MOUSEBUTTONUP):
return
else:
self._last = st
if (self._dragging == False):
rv = super(BattleDisplayable, self).event(event, x, y, st)
if rv is not None:
return rv
if self._dragging:
if (self._dragPos != None):
prevX = self._dragPos[0]
prevY = self._dragPos[1]
dx = x - prevX
dy = y - prevY
battle.CameraX = battle.CameraX - dx
battle.CameraY = battle.CameraY - dy
self._dragPos = (x, y)
else:
if (self._startPos != None):
dx = math.fabs(x - self._startPos[0])
dy = math.fabs(y - self._startPos[1])
#dist = math.sqrt((dx*dx)+(dy*dy))
dist = dx + dy
if (dist > self._threshold):
self._dragging = True
if (event.type == pygame.MOUSEBUTTONDOWN) and (event.button == 1):
self._startPos = (x, y)
self._dragPos = (x, y)
if (event.type == pygame.MOUSEBUTTONUP) and (event.button == 1):
self._dragPos = None
self._startPos = None
if (self._dragging):
self._dragging = False
raise renpy.display.core.IgnoreEvent()
def render(self, width, height, st, at):
return renpy.Render(config.screen_width, config.screen_height)
class DragToPanExtra(Extra):
def __init__(self, threshold=50):
self._disp = BattleDragDisplayable(threshold)
def Show(self):
l = self._battle.GetLayer('UI')
pos = Transform(xpos=0.5, ypos=0.5)
renpy.show("dragOverlay", what=self._disp, at_list=[pos], layer=l, zorder=999999)
If you find that it lags when dragging, then adjust the value on the line:
Code: Select all
if (st - self._last < 0.05) and (event.type != pygame.MOUSEBUTTONDOWN) and (event.type != pygame.MOUSEBUTTONUP):