Welcome to pyTB’s documentation!¶
Indices and tables¶
CharCreator, will house the character generator / creator allowing players to create custom chars
- class CharCreator.CharCreator(**params)¶
Base char creator class
- clear_player_list(item)¶
Clear the player list
- fetch_player_list(load=False)¶
returns the list of players to the main game and closes the char creator
- on_change_select()¶
update the text area with the specific class stats
- onchange(value)¶
Called when the OK button is pressed to generate a new char
- remove_from_list(item)¶
remove selected item from the list
- run(temp_screen)¶
main function that gets executed by the main game
- CharCreator.change_stuff(value)¶
replace the values
- CharCreator.check_for_savegame()¶
check for the existance of a savegame
- CharCreator.namegen_orc_first()¶
Generate an orc firstname
- CharCreator.namegen_orc_second()¶
Generate an orc second name
This is a helper class to create a color picker for the players pathlines
- class ColorPicker.ColorPicker(value, **params)¶
creates a color picker
- adjust(value)¶
adjust the slider values
Reworked textArea to be a read only combat log from pgu
- class CombatLog.CombatLog(value='', width=120, height=30, size=20, **params)¶
A multi-line text output.
- event(e)¶
Called when an event is passed to this object.
Please note that if you use an event, returning the value True will stop parent containers from also using the event. (For example, if your widget handles TABs or arrow keys, and you don’t want those to also alter the focus.)
This should be implemented by a subclass.
- paint(s)¶
Render this widget onto the given surface
This should be implemented by a subclass.
Various cursors used by the game
- class Cursors.Cursors¶
Main cursor class
Main file for the project till I have time to refactor the code to something more manage-able
- class Game.Game¶
Main game object
- advance_turn()¶
Advance one turn in game time
- button_click_down()¶
v button clicked to move the viewport down
- button_click_left()¶
< button clicked to move the viewport left
- button_click_right()¶
> button clicked to move the viewport right
- button_click_up()¶
^ button clicked to move the viewport up
- button_click_z_down()¶
button was clicked to go down a zlevel
- button_click_z_up()¶
button was clicked to go up a zlevel
- center_vp_on(x, y, z)¶
Center the view port onto the coords x, y, z
- center_vp_on_player()¶
Center the viewport on the player
- check_click_map(x, y, z)¶
checks the click map
- check_map(x, y, zlevel)¶
returns the mapdata value for the coords
- check_map_for_mob(x, y, z)¶
check the map location for a monster and flag it as selected
- check_map_for_player(x, y, z)¶
check a map location for players, and flag them as selected
- check_mob_collision(x, y, z, xx, yy, zz)¶
checks the adjacent tiles of a monster for the presence of a player
- check_mob_portrait_clicks(mx, my)¶
Was the click on the portrait?
- check_player_portrait_clicks(mx, my)¶
Was the click in on the portrait
- click_in_viewport(x, y)¶
Is the mouse click in the viewport?
- combat()¶
initiate combat
- compute_path(start, end)¶
Return the individual steps of a path in a list between two points
- compute_path_mob(start, end)¶
Return the individual steps of a path in a list between two points, ignoring fog tiles for monsters.
- draw_char_box()¶
draw the box at the bottom with the char / mob portraits
- draw_click_map()¶
draw the click map, used for debugging
- draw_map()¶
draws the portion of the map thats in the viewport onto the screen
- draw_mouse_box()¶
Draw the box that follows the mouse around in the viewport
- draw_path_lines()¶
Draw the players pathes using their colors
- draw_players_and_mobs()¶
draws the players and monsters if they are within the viewport
- draw_possible_moves()¶
draw’s all the possible moves
- draw_stats()¶
Draw the stats window
- find_down_stairs_on(z)¶
returns the location of some downstairs given a zlevel
- find_fov(x, y, z, size)¶
return a list of spots within a given FOV area
- find_moves(x, y, z, movement)¶
find moves within a movement range
- find_up_stairs_on(z)¶
return the location of some up stairs on a given zlevel
- get_center_of_vp()¶
return the center of the viewport
- get_fog_neighbors_values(x, y, z)¶
check if its foggy near the given coord, used to pick which tiles to display on fog bordering unfogged locations
- get_item_list()¶
Get the list of items that are scattered about for when we reload a savegame
- get_neighbors_values(x, y, z)¶
return a list of the adjacent tiles values
- get_open_spot_around(x, y, z)¶
get the first open spot around the coords provided
- get_open_spots_around(x, y, z)¶
get a list of the open spots around a given coord
- get_possible_moves(x, y, z)¶
return a list of all the possible moves for a particular coord
- get_tile_items(x, y, z)¶
get list of items on a particular tile
- handle_events()¶
run through the pygame events and give them to the proper functions
- handle_fog_of_war()¶
unfog tiles around the players within their view ranges
- handle_keyboard(event)¶
handle the keyboard events
- handle_mouse_cursor()¶
handle mouse actions
- handle_viewport()¶
manage the viewport v / h scroll bounds
- handle_win_condition()¶
basic win condition
- in_vp(x, y, z)¶
is the coords given within the viewport set?
- is_blocked(x, y, z)¶
check if a tile is blocked
- is_foggy(x, y, z)¶
check if its foggy
- is_sight_blocked(x, y, z)¶
check if you can see past this block
- load_game()¶
Load the last savegame
- logic()¶
main logic happens here
- lookup_mob_by_uuid(uuid)¶
lookup a monster via the uuid, returns the monster or None
- lookup_player_by_uuid(uuid)¶
lookup a player via uuid, returns the player or None
- make_map()¶
generate the map
- mob_movement()¶
handle mob movement, pops a pathline off and moves them there.
- pick_dest(x, y, z)¶
pick a destination as long as it isn’t blocked or foggy
- player_movement()¶
handle the player movement, pop a move off their pathlines and move them there
- recalc_vp()¶
recalculate the viewport if the screen moved around
- remove_dead_stuff()¶
remove dead players / monsters from their respective lists
- render()¶
rendering stuffs to the screen happens here
- run()¶
This is the main function
- save_game()¶
Saves the game to disk
- screen_resize(w, h)¶
gets called when the screen is resized either by the min / max buttons or draging the borders
- set_fullscreen()¶
gets called when we go fullscreen, recalc all the offsets
- set_not_fullscreen()¶
gets called when we revert back from fullscreen mode
- successors(x, y, z)¶
get a list of the possible moves
- successors_and_center(x, y, z)¶
get a list of the possible moves
- successors_for_mobs(x, y, z)¶
get a list of the possible moves
- un_fog(x, y, z)¶
unfog this location
- update_click_map(x, y, z, value)¶
update the click map with the specified value
- update_clicked_mob()¶
toggle selected mob status
- update_combat_log()¶
update the combat log
- update_map(x, y, z, value)¶
set a value to the map, not currently used I don’t think
- view_port_click_to_coords(x, y, z)¶
get the clicked tiles coord value
Inventory class
- class Inventory.Inventory(player, **params)¶
Base class for the inventory screen
- draw_selected_item(screen)¶
Draws the selected itembox to the screen with its info
- equip_or_use_item(item)¶
use or equip the passed in item
- exit_inventory()¶
exits the inventory
- remove_from_list(item)¶
remove selected item from the list
- run(temp_screen)¶
main function that gets executed by the main game
- Inventory.is_equipped(item)¶
checks if the item is equipped
This will be for the item display window
- class ItemDisplay.ItemDisplay(height, width)¶
ItemDisplay class
- update_stats(item)¶
Show the item stats
ItemGenerator used to get a random item, or a specific item created.
- class ItemGenerator.ItemGenerator¶
ItemGenerator Class
- generate_random_item()¶
generates a random item, that isn’t “special” like stairs
Base class for item, items should be able to read themselves in from config files
- class Item.Item(name, image, special)¶
this will be the holder class for items
This will be the main job class, that the other jobs will fill out as a template
- class Job.Job(job_name, attack_bonus, defense_bonus, view_range_bonus, damage, hit_dice, description)¶
Main Job class that will be plugged into players / monsters to adjust stats
This will create a list of all the different jobs based on the config files in the jobs directory
- class JobList.JobList¶
Job list creator Class
- get_list()¶
return the whole list, used by the character creator
- pick_a_random_job()¶
picks a job at random useful for generating monsters with different jobs
Basic MapTile container for tile data
- class MapTile.MapTile(value)¶
MapTile class, generic class for a tile
This will allow adding monster dynamically from a set of configuration files in the ‘mobs’ directory, images for the monsters should be put in the images directory. Eventually the images will get restructured into better locations, but for now thats where its going.
- class MonsterGenerator.MonsterGenerator¶
MonsterGenerator Class
- generate_monster(mob_level, name=None, job=None)¶
This is the function thats called and will generate the specified monster, 2 optional params (name and job)
- MonsterGenerator.namegen_orc_first()¶
Generate an Orcish first name
- MonsterGenerator.namegen_orc_second()¶
Generate an Orcish last name
Player Info class will probably be used when a player is selected and the user presses c
- class PlayerInfo.PlayerInfo(player, **params)¶
Base class for the PlayerInfo screen
- class Player.Player(name, job)¶
Player Class
- gain_xp(num)¶
Gain some Xp
- get_attack_bonus()¶
return the job attack bonus + the str bonus that’s not implemented yet :)
- get_defense_bonus()¶
return the job defense bonus and the level bonus till I get the stats bonus’s worked out
- get_view_range()¶
return the view range with bonuses
- heal(num)¶
heals the player for num
- pressed_portrait(mx, my)¶
portrait was clicked
- take_damage(damage)¶
Ouch
This is the quit popup screen
- class QuitDialogue.QuitDialogue(**params)¶
Base class for the Quit screen
- cancel_exit()¶
Cancel quitting the game
- exit_game()¶
exits the game
- run(temp_screen)¶
main function that gets executed by the main game
This will be for the statistics window
- class TestTheme.TestTheme(**params)¶