public PortalRequestProcessor( int character_id, Point3d portal_position, float portal_angle, int portal_id) { m_character_id = character_id; m_portal_position = new Point3d(portal_position); m_portal_angle = portal_angle; m_portal_id = portal_id; m_world = null; m_room = null; m_opposing_room = null; m_portal = null; m_opposing_portal = null; m_opposing_portal_position = new Point3d(); m_current_room_key = null; m_opposing_room_key = null; m_current_character_position = new Point3d(); m_current_character_angle = 0.0f; m_game_id = -1; m_move_to_target = false; m_result_event_list = null; }
public SpawnMobsRequestProcessor( World world, Room room) { m_world = world; m_room = room; m_chosenMobSpawners = new List<MobSpawner>(); m_newMobs = new List<Mob>(); }
public AIMoveRequestProcessor( RoomKey roomKey) { m_roomKey = new RoomKey(roomKey); m_world = null; m_room = null; m_mobContexts = new List<MobUpdateContext>(); m_relevantGameEvents = new List<GameEventParameters>(); m_playerPaths = new List<EntityPath>(); }
public HackEnergyTankRequestProcessor( int character_id, int energy_tank_id) { m_character_id = character_id; m_energy_tank_id = energy_tank_id; m_world = null; m_room = null; m_energy_tank = null; m_current_room_key = null; m_current_character_position = new Point3d(); m_current_character_angle = 0.0f; m_game_id = -1; m_move_to_target = false; m_ai_relevant_events = new List<GameEventParameters>(); m_result_event_list = null; }
public MoveRequestProcessor( int character_id, Point3d target_position, float target_angle) { m_character_id = character_id; m_target_position = new Point3d(target_position); m_target_angle = target_angle; m_world = null; m_room = null; m_current_room_key = null; m_current_character_position = new Point3d(); m_current_character_angle = 0.0f; m_game_id = -1; m_ai_relevant_events = new List<GameEventParameters>(); m_result_event_list = null; }
//TODO: LoadRoom - Convert this over to a request processor public static bool LoadRoom( AsyncRPGDataContext context, World world, RoomKey room_key, out Room room, out string result) { bool success; string json_static_data = WorldQueries.GetRoomStaticData(context, room_key); room = null; success = false; // Load static room data for this room if (json_static_data.Length > 0) { StaticRoomData static_room_data = null; try { if (json_static_data.Length == 0) { throw new ArgumentException(); } static_room_data = JsonMapper.ToObject<StaticRoomData>(json_static_data); } catch (System.Exception) { static_room_data = null; } if (static_room_data != null) { room = new Room(room_key); room.static_room_data = static_room_data; success = true; result = SuccessMessages.GENERAL_SUCCESS; } else { result = ErrorMessages.DB_ERROR + "(Failed to parse room static data)"; } } else { result = ErrorMessages.DB_ERROR + "(Failed to get room static data)"; } // If the static room data parsed, load everything else if (success) { RoomTemplate roomTemplate = world.RoomTemplates.GetTemplateByName(room.static_room_data.room_template_name); // Load the random seed for the room room.random_seed = WorldQueries.GetRoomRandomSeed(context, room_key); // Setup the runtime nav mesh room.runtime_nav_mesh = new NavMesh(room.room_key, roomTemplate.NavMeshTemplate); // Load all of the portals for this room room.portals = WorldQueries.GetRoomPortals(context, room_key); // Flag all of the room sides that have portals foreach (Portal p in room.portals) { room.portalRoomSideBitmask.Set(p.room_side, true); } // Load mob spawners for this room room.mobSpawners = MobQueries.GetMobSpawners(context, world.MobSpawnTables, room_key); } return success; }
public static Portal CreatePortal(Room room, MathConstants.eSignedDirection roomSide) { Portal newPortal = new Portal(); newPortal.portal_id = -1; // portal ID not set until this portal gets saved into the DB newPortal.target_portal_id = -1; newPortal.room_side = roomSide; newPortal.room_x = room.room_key.x; newPortal.room_y = room.room_key.y; newPortal.room_z = room.room_key.z; switch (roomSide) { case MathConstants.eSignedDirection.positive_x: { Point3d p1= WorldConstants.ROOM_BOUNDS.Max; Point3d p0= p1 - Vector3d.I*WorldConstants.PORTAL_WIDTH - Vector3d.J*WorldConstants.ROOM_Y_SIZE; newPortal.bounding_box= new AABB3d(p0, p1); } break; case MathConstants.eSignedDirection.negative_x: { Point3d p0 = WorldConstants.ROOM_BOUNDS.Min; Point3d p1 = p0 + Vector3d.I * WorldConstants.PORTAL_WIDTH + Vector3d.J * WorldConstants.ROOM_Y_SIZE; newPortal.bounding_box= new AABB3d(p0, p1); } break; case MathConstants.eSignedDirection.positive_y: { Point3d p1 = WorldConstants.ROOM_BOUNDS.Max; Point3d p0 = p1 - Vector3d.I * WorldConstants.ROOM_X_SIZE - Vector3d.J * WorldConstants.PORTAL_WIDTH; newPortal.bounding_box= new AABB3d(p0, p1); } break; case MathConstants.eSignedDirection.negative_y: { Point3d p0 = WorldConstants.ROOM_BOUNDS.Min; Point3d p1 = p0 + Vector3d.I * WorldConstants.ROOM_X_SIZE + Vector3d.J * WorldConstants.PORTAL_WIDTH; newPortal.bounding_box= new AABB3d(p0, p1); } break; case MathConstants.eSignedDirection.positive_z: case MathConstants.eSignedDirection.negative_z: { int column = RNGUtilities.RandomInt(WorldConstants.ROOM_X_TILES / 3, 2 * WorldConstants.ROOM_X_TILES / 3); int row = RNGUtilities.RandomInt(WorldConstants.ROOM_Y_TILES / 3, 2 * WorldConstants.ROOM_Y_TILES / 3); Point3d p0 = WorldConstants.GetTilePosition(column, row); Point3d p1 = p0 + Vector3d.I * WorldConstants.ROOM_TILE_SIZE + Vector3d.J * WorldConstants.ROOM_TILE_SIZE; newPortal.bounding_box = new AABB3d(p0, p1); } break; } return newPortal; }
public bool GetRoom( AsyncRPGDataContext context, RoomKey room_key, out Room room, out string result) { bool success = true; room = null; result = SuccessMessages.GENERAL_SUCCESS; if (m_rooms.ContainsKey(room_key)) { room = m_rooms[room_key]; } else { if (!WorldQueries.DoesRoomExist(context, room_key)) { room = null; success = false; result = ErrorMessages.INVALID_ROOM; } if (success && !Room.LoadRoom(context, this, room_key, out room, out result)) { result = ErrorMessages.DB_ERROR; success = false; } // If we got a room, update the cache if (success) { m_rooms[room_key] = room; } } return success; }