def QueueGameCommand_RightClick(xy): """Queue right click action. :param xy: (y * 65536) + x, where (x, y) is coordinate for right click. """ RightClickCommand = c.Db(b'...\x14XXYY\0\0\xE4\0\x00') c.SetVariables(ut.EPD(RightClickCommand + 4), xy) QueueGameCommand(RightClickCommand + 3, 10)
def EUDLoopUnit(): ut.EUDCreateBlock('unitloop', 0x628430) ptr, epd = f_cunitepdread_epd(ut.EPD(0x628430)) if cs.EUDWhile()(ptr >= 1): yield ptr, epd cs.EUDSetContinuePoint() c.SetVariables([ptr, epd], f_cunitepdread_epd(epd + 1)) cs.EUDEndWhile() ut.EUDPopBlock('unitloop')
def EUDLoopPlayerUnit(player): player = c.EncodePlayer(player) first_player_unit = 0x6283F8 ut.EUDCreateBlock('playerunitloop', first_player_unit) ptr, epd = f_cunitepdread_epd(ut.EPD(first_player_unit) + player) if cs.EUDWhile()(ptr >= 1): yield ptr, epd cs.EUDSetContinuePoint() # /*0x06C*/ BW::CUnit* nextPlayerUnit; c.SetVariables([ptr, epd], f_cunitepdread_epd(epd + 0x6C // 4)) cs.EUDEndWhile() ut.EUDPopBlock('playerunitloop')
def EUDLoopSprite(): y_epd = c.EUDVariable() y_epd << ut.EPD(0x629688) ut.EUDCreateBlock('spriteloop', 'sprlo') if cs.EUDWhile()(y_epd < ut.EPD(0x629688) + 256): ptr, epd = f_dwepdread_epd(y_epd) if cs.EUDWhile()(ptr >= 1): yield ptr, epd cs.EUDSetContinuePoint() c.SetVariables([ptr, epd], f_dwepdread_epd(epd + 1)) cs.EUDEndWhile() y_epd += 1 cs.EUDEndWhile() ut.EUDPopBlock('spriteloop')
def EUDLoopList(header_offset, break_offset=None): blockname = 'listloop' ut.EUDCreateBlock(blockname, header_offset) ptr, epd = f_dwepdread_epd(ut.EPD(header_offset)) if break_offset is not None: cs.EUDWhileNot()(ptr == break_offset) else: cs.EUDWhile()([ptr > 0, ptr <= 0x7FFFFFFF]) yield ptr, epd cs.EUDSetContinuePoint() c.SetVariables([ptr, epd], f_dwepdread_epd(epd + 1)) cs.EUDEndWhile() ut.ep_assert( ut.EUDPopBlock(blockname)[1] is header_offset, 'listloop mismatch' )
def QueueGameCommand(data, size): """Queue game command to packet queue. Starcraft periodically boradcasts game packets to other player. Game packets are stored to queue, and this function add data to that queue, so that SC can boradcast it. :param data: Data to put in queue :param size: Size of data .. note:: If packet queue is full, this function fails. This behavior is silent without any warning or error, since this behavior shouldn't happen in common situations. So **Don't use this function too much in a frame.** """ prov_maxbuffer = f_dwread_epd(ut.EPD(0x57F0D8)) cmdqlen = f_dwread_epd(ut.EPD(0x654AA0)) if cs.EUDIfNot()(cmdqlen + size + 1 >= prov_maxbuffer): f_memcpy(0x654880 + cmdqlen, data, size) c.SetVariables(ut.EPD(0x654AA0), cmdqlen + size) cs.EUDEndIf()
def f_dbstr_addstr(dst, src): """Print string as string to dst. Same as strcpy except of return value. :param dst: Destination address (Not EPD player) :param src: Source address (Not EPD player) :returns: dst + strlen(src) """ b = c.EUDVariable() br1.seekoffset(src) bw1.seekoffset(dst) if cs.EUDInfLoop()(): c.SetVariables(b, br1.readbyte()) bw1.writebyte(b) cs.EUDBreakIf(b == 0) dst += 1 cs.EUDEndInfLoop() bw1.flushdword() return dst