def render(self):
     read_game = self.env.read_game
     frame = self.env.frame
     if not read_game.is_in_game or not keys["KEY_CROSSHAIR"]: return
     
     x = read_game.screen_center_x
     y = read_game.screen_center_y
     draw_line_abs(frame.line, x - CROSSHAIR_SIZE, y, x + CROSSHAIR_SIZE, y, CROSSHAIR_WIDTH, CROSSHAIR_COLOR)
     draw_line_abs(frame.line, x, y - CROSSHAIR_SIZE, x, y + CROSSHAIR_SIZE, CROSSHAIR_WIDTH, CROSSHAIR_COLOR)
Beispiel #2
0
    def render(self):
        read_game = self.env.read_game
        frame = self.env.frame
        weapon_names = self.env.weapon_names
        if not read_game.is_in_game: return
        
        if keys["KEY_BOXESP"]:
            for idx in range(PLAYERMAX):
                p = read_game.player[idx]
                if (p.type == ET_PLAYER) and p.valid and p.alive and p != read_game.my_player:
                    # colors already calculated
                    feet, head, size_x, size_y = self.calc_size_xy(p)
                    if feet and head:
                        p.color_esp = self.get_faded_color(p.pos, p.color_esp)

                        if keys["KEY_BOXESP"]:
                            draw_box(frame.line, feet.x - size_x/2, feet.y, size_x, -size_y, COLOR_BOX_OUTER_WIDTH, p.color_esp)
                            if keys["KEY_WEAPON_ESP"]:
                                name_esp_str = "%s [%s]" % (p.name, weapon_names.get_weapon_name(p.weapon_num))
                            else:
                                name_esp_str = p.name
                            draw_string_center(frame.font, feet.x, feet.y - size_y, COLOR_PLAYER_NAME, name_esp_str)
                        if keys["KEY_BOX_SNAPLINE"] and p.enemy and p.alive & ALIVE_FLAG:
                            draw_line_abs(frame.line, read_game.screen_center_x, read_game.resolution_y,
                                  feet.x, feet.y, COLOR_BOX_LINE_WIDTH, p.color_esp)      # w/h ratio
                        if keys["KEY_BOXESP"]:
                            self.draw_distance_ESP(p.pos, feet.x, feet.y, COLOR_PLAYER_NAME)
                        if keys["KEY_TRIGGERBOT"] and keys["KEY_TRIGGER_BOT_KEY"]:
                            if p.alive & ALIVE_FLAG and p.enemy and p.pose != 0:
                                if (read_game.screen_center_x > feet.x - size_x/2) and (read_game.screen_center_x < feet.x + size_x/2):
                                    if (read_game.screen_center_y > feet.y - size_y) and (read_game.screen_center_y < feet.y ):
                                        #print "try trigger bot"
                                        if self.env.ticks - self.last_trigger_tick > 5:
                                            #print "triggerbot fire"
                                            self.last_trigger_tick = self.env.ticks
                                            windll.User32.keybd_event(TRIGGER_BOT_FIRE_KEY, 0x12, 0, 0)
                                            windll.User32.keybd_event(TRIGGER_BOT_FIRE_KEY, 0x12, KEYEVENTF_KEYUP, 0)
                            
                            
        
        #=======================================================================
        # pp = cast(pointer(read_game.mw2_entity), POINTER(c_int))
        # for i in range(ENTITIESMAX):
        #    #type = pp[0xE0/4 + 0x204/4*i]
        #    type = pp[0x38 + 0x81*i]
        #    if type == ET_TURRET or type == ET_EXPLOSIVE or type==ET_HELICOPTER or type==ET_PLANE:
        #=======================================================================
        for idx in range(ENTITIESMAX):
            e = read_game.mw2_entity.arr[idx]
            if e.type == ET_TURRET and e.alive & ALIVE_FLAG and keys["KEY_BOXESP"]:
                if e.owner_turret >= 0 and e.owner_turret < PLAYERMAX:
                    self.env.tracker.track_entity(idx, e.owner_turret)
                    if read_game.player[e.owner_turret].enemy:
                        head_pos = VECTOR(e.pos.x, e.pos.y, e.pos.z + 20)       # eyepos of standing player
                        feet = read_game.world_to_screen(e.pos)
                        head = read_game.world_to_screen(head_pos)
                        if feet and head:
                            size_y = feet.y - head.y
                            if size_y < 5:  size_y = 5
                            size_x = size_y / 2.75
                            draw_box(frame.line, feet.x - size_x/2, feet.y, size_x, -size_y, COLOR_BOX_OUTER_WIDTH, COLOR_SENTRY)
                    
            elif e.type == ET_EXPLOSIVE and e.alive & ALIVE_FLAG:
                #self.draw_explosive(e)
                self.track_explosive(idx)
                    
            elif (e.type == ET_HELICOPTER or e.type == ET_PLANE) and e.alive & ALIVE_FLAG and keys["KEY_BOXESP"]:
                if e.owner_air >= 0 and e.owner_air < PLAYERMAX:
                    self.env.tracker.track_entity(idx, e.owner_air)
                    if e.type == ET_PLANE or read_game.player[e.owner_air].enemy:
                        # all planes are shown because we don't know if they are enemies
                        head_pos = VECTOR(e.pos.x, e.pos.y, e.pos.z + 100)       # eyepos of standing player
                        feet = read_game.world_to_screen(e.pos)
                        head = read_game.world_to_screen(head_pos)
                        if feet and head:
                            size_y = feet.y - head.y
                            if size_y < 10:  size_y = 10
                            size_x = size_y
                            draw_box(frame.line, feet.x - size_x/2, feet.y, size_x, -size_y, COLOR_BOX_OUTER_WIDTH, COLOR_PLANE)
                            if keys["KEY_BOX_SNAPLINE"]:
                                draw_line_abs(frame.line, read_game.screen_center_x, read_game.resolution_y,
                                      feet.x, feet.y, COLOR_BOX_LINE_WIDTH, COLOR_PLANE)
                        
        self.loop_tracked_explo()
Beispiel #3
0
    def render(self):
        read_game = self.env.read_game
        frame = self.env.frame
        weapon_names = self.env.weapon_names
        if not read_game.is_in_game: return
        
        # enemy behind indicators
        enemy_behind = enemy_left = enemy_right = INFINITY

        if keys["KEY_BOXESP"]:
            for idx in range(PLAYERMAX):
                p = read_game.player[idx]
                if (p.type == ET_PLAYER) and p.valid and p.alive and p != read_game.my_player:
                    # colors already calculated
                    feet, head, size_x, size_y = self.calc_size_xy(p)
                    if feet and head:
                        p.color_esp = self.get_faded_color(p.pos, p.color_esp)

                        if keys["KEY_BOXESP"]:
                            draw_box(frame.line, feet.x - size_x/2, feet.y, size_x, -size_y, COLOR_BOX_OUTER_WIDTH, p.color_esp)
                            if keys["KEY_WEAPON_ESP"]:
                                name_esp_str = "%s [%s]" % (p.name, weapon_names.get_weapon_model(p.weapon_num))
                            else:
                                name_esp_str = p.name
                            draw_string_center(frame.font, feet.x, feet.y - size_y, COLOR_PLAYER_NAME, name_esp_str)
                        if keys["KEY_BOX_SNAPLINE"] and p.enemy and p.alive & ALIVE_FLAG:
                            draw_line_abs(frame.line, read_game.screen_center_x, read_game.resolution_y,
                                  feet.x, feet.y, COLOR_BOX_LINE_WIDTH, p.color_esp)      # w/h ratio
                        if keys["KEY_BOXESP"]:
                            self.draw_distance_ESP(p.pos, feet.x, feet.y, COLOR_PLAYER_NAME)
                        if keys["KEY_TRIGGERBOT"] and keys["KEY_TRIGGER_BOT_KEY"]:
                            if p.alive & ALIVE_FLAG and p.enemy and p.pose != 0:
                                if (read_game.screen_center_x > feet.x - (size_x/3+1)) and (read_game.screen_center_x < feet.x + (size_x/3+1)):
                                    if (read_game.screen_center_y > feet.y - size_y) and (read_game.screen_center_y < feet.y ):
                                        if self.env.ticks - self.last_trigger_tick >= TRIGGER_BOT_FIRE_TICK_DELAY:
                                            self.last_trigger_tick = self.env.ticks
                                            windll.User32.keybd_event(ord(TRIGGER_BOT_FIRE_KEY), 0x12, 0, 0)
                                            windll.User32.keybd_event(ord(TRIGGER_BOT_FIRE_KEY), 0x12, KEYEVENTF_KEYUP, 0)
                    else:
                        # check if we need to show enemy behind indicator
                        transform = read_game.world_to_screen_transform(p.pos)
                        if transform.z < -10 and p.enemy:
                            distance = (p.pos - self.env.read_game.my_player.pos).length()
                            if abs(transform.x / transform.z) < 1:
                                if distance < enemy_behind:     enemy_behind = distance
                            elif transform.x > 0:
                                if distance < enemy_left:       enemy_left = distance
                            else:
                                if distance < enemy_right:      enemy_right = distance


                            
        if keys["KEY_ENEMY_BEHIND"] and (enemy_behind or enemy_left or enemy_right):
            sprites = self.env.sprites
            if enemy_behind < INFINITY:
                color = self.get_faded_color_dist(ENEMY_BEHIND_COLOR_BLEND, enemy_behind)
                sprites.draw_sprite("down", read_game.screen_center_x, read_game.screen_center_y + ENEMY_BEHIND_Y,
                                    0, color, ENEMY_BEHIND_SCALING)
            if enemy_left < INFINITY:
                color = self.get_faded_color_dist(ENEMY_BEHIND_COLOR_BLEND, enemy_left)
                sprites.draw_sprite("left-down", read_game.screen_center_x - ENEMY_BEHIND_X, read_game.screen_center_y + ENEMY_BEHIND_Y,
                                    0, color, ENEMY_BEHIND_SCALING)
            if enemy_right < INFINITY:
                color = self.get_faded_color_dist(ENEMY_BEHIND_COLOR_BLEND, enemy_right)
                sprites.draw_sprite("right-down", read_game.screen_center_x + ENEMY_BEHIND_X, read_game.screen_center_y + ENEMY_BEHIND_Y,
                                    0, color, ENEMY_BEHIND_SCALING)
                    

        for idx in range(ENTITIESMAX):
            e = read_game.cod7_entity.arr[idx]
            
            if e.type == ET_TURRET and e.alive & ALIVE_FLAG and keys["KEY_BOXESP"]:
                self.env.tracker.track_entity(idx)
                head_pos = VECTOR(e.pos.x, e.pos.y, e.pos.z + 20)       # eyepos of standing player
                feet = read_game.world_to_screen(e.pos)
                head = read_game.world_to_screen(head_pos)
                if feet and head:
                    size_y = feet.y - head.y
                    if size_y < 5:  size_y = 5
                    size_x = size_y / 2.75
                    draw_box(frame.line, feet.x - size_x/2, feet.y, size_x, -size_y, COLOR_BOX_OUTER_WIDTH, COLOR_SENTRY)
#                if e.owner_turret >= 0 and e.owner_turret < PLAYERMAX:
#                    self.env.tracker.track_entity(idx, e.owner_turret)
#                    if read_game.player[e.owner_turret].enemy:
#                        head_pos = VECTOR(e.pos.x, e.pos.y, e.pos.z + 20)       # eyepos of standing player
#                        feet = read_game.world_to_screen(e.pos)
#                        head = read_game.world_to_screen(head_pos)
#                        if feet and head:
#                            size_y = feet.y - head.y
#                            if size_y < 5:  size_y = 5
#                            size_x = size_y / 2.75
#                            draw_box(frame.line, feet.x - size_x/2, feet.y, size_x, -size_y, COLOR_BOX_OUTER_WIDTH, COLOR_SENTRY)

            if e.type == ET_EXPLOSIVE and e.alive & ALIVE_FLAG:
                self.track_explosive(idx)
            
            elif e.type == ET_VEHICLE and e.alive & ALIVE_FLAG:
                if weapon_names.get_weapon_model(e.weapon) == "rc_car_weapon_mp":      # RC-XD
                    self.env.tracker.track_rcxd(idx)

            elif (e.type == ET_HELICOPTER or e.type == ET_PLANE) and e.alive & ALIVE_FLAG and keys["KEY_BOXESP"]:
                # all planes are shown because we don't know if they are enemies                
                self.env.tracker.track_entity(idx)
                head_pos = VECTOR(e.pos.x, e.pos.y, e.pos.z + 100)
                feet = read_game.world_to_screen(e.pos)
                head = read_game.world_to_screen(head_pos)
                if feet and head:
                    size_y = feet.y - head.y
                    if size_y < 10:  size_y = 10
                    size_x = size_y
                    draw_box(frame.line, feet.x - size_x/2, feet.y, size_x, -size_y, COLOR_BOX_OUTER_WIDTH, COLOR_PLANE)
                    if keys["KEY_BOX_SNAPLINE"]:
                        draw_line_abs(frame.line, read_game.screen_center_x, read_game.resolution_y,
                              feet.x, feet.y, COLOR_BOX_LINE_WIDTH, COLOR_PLANE)
                        
#            elif (e.type == ET_HELICOPTER or e.type == ET_PLANE) and e.alive & ALIVE_FLAG and keys["KEY_BOXESP"]:
#                if e.owner_air >= 0 and e.owner_air < PLAYERMAX:
#                    self.env.tracker.track_entity(idx, e.owner_air)
#                    if e.type == ET_PLANE or read_game.player[e.owner_air].enemy:
#                        # all planes are shown because we don't know if they are enemies
#                        head_pos = VECTOR(e.pos.x, e.pos.y, e.pos.z + 100)       # eyepos of standing player
#                        feet = read_game.world_to_screen(e.pos)
#                        head = read_game.world_to_screen(head_pos)
#                        if feet and head:
#                            size_y = feet.y - head.y
#                            if size_y < 10:  size_y = 10
#                            size_x = size_y
#                            draw_box(frame.line, feet.x - size_x/2, feet.y, size_x, -size_y, COLOR_BOX_OUTER_WIDTH, COLOR_PLANE)
#                            if keys["KEY_BOX_SNAPLINE"]:
#                                draw_line_abs(frame.line, read_game.screen_center_x, read_game.resolution_y,
#                                      feet.x, feet.y, COLOR_BOX_LINE_WIDTH, COLOR_PLANE)
#
        if keys["KEY_DOGS_ESP"]:
            for idx in range(DOGSMAX):
                dog = read_game.cod7_dog.arr[idx]
                client_num = dog.client_num             # the entity number holding the dog
                if client_num > 0 and client_num < ENTITIESMAX:     # let's look the real entity
                    e = read_game.cod7_entity.arr[client_num]
                    if e.alive & ALIVE_FLAG:
                        if DEBUG:
                            print "Found living dog idx=%i, clientnum=%i, owner=%i, team=%i"
                            self.env.inspector.dump_entity(client_num)
                        self.env.tracker.track_dog(client_num)
                                    
        self.loop_tracked_explo()